diff --git a/.changeset/nice-bags-type.md b/.changeset/nice-bags-type.md new file mode 100644 index 00000000000..7fe01de1db2 --- /dev/null +++ b/.changeset/nice-bags-type.md @@ -0,0 +1,38 @@ +--- +'@keystonejs/fields': major +'@keystonejs/keystone': major +'@keystonejs/api-tests': patch +'@keystonejs/demo-custom-fields': patch +--- + +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](/docs/discussions/server-side-graphql.md) for more details on how to use `context.executeGraphQL()`. diff --git a/.changeset/popular-suns-move.md b/.changeset/popular-suns-move.md deleted file mode 100644 index 2d091900a86..00000000000 --- a/.changeset/popular-suns-move.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@keystonejs/utils': patch ---- - -Updated doc comments. diff --git a/.changeset/red-months-lay.md b/.changeset/red-months-lay.md deleted file mode 100644 index 8e46d43587d..00000000000 --- a/.changeset/red-months-lay.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@keystonejs/keystone': minor ---- - -Support GraphQL AST input in `executeGraphQL`. This should be created with the `gql` template literal imported from `apollo-server-express`. diff --git a/.changeset/spotty-news-carry.md b/.changeset/spotty-news-carry.md deleted file mode 100644 index 0725f298b14..00000000000 --- a/.changeset/spotty-news-carry.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@keystonejs/fields': patch ---- - -Updated docs for `Virtual` field type to show how to execute server-side GraphQL operations. diff --git a/api-tests/CHANGELOG.md b/api-tests/CHANGELOG.md index a6251f9816c..7b8e4f4bd85 100644 --- a/api-tests/CHANGELOG.md +++ b/api-tests/CHANGELOG.md @@ -1,5 +1,37 @@ # @keystonejs/api-tests +## 6.0.0 + +### Major Changes + +- [`4ddc3dc6f`](https://github.com/keystonejs/keystone/commit/4ddc3dc6f87c192627d00db85a1080411400eeb5) [#3212](https://github.com/keystonejs/keystone/pull/3212) Thanks [@timleslie](https://github.com/timleslie)! - Removed the `name` argument to `setupServer`. This value will now be autogenerated by the test system. If you would like to use a specific name you can still pass through `{ keystoneOptions: { name: '...' } }` to retain the original behaviour. + + ``` + setupServer({ name: 'foo', adapterName, createLists, ... }); + ``` + + can now be written as + + ``` + setupServer({ adapterName, createLists, ... }) + ``` + + or, if you would like the `Keystone` instance to have a specific name, + + ``` + setupServer({ adapterName, createLists, keystoneOptions: { name: 'foo' }, ... }) + ``` + +### Patch Changes + +- Updated dependencies [[`4ddc3dc6f`](https://github.com/keystonejs/keystone/commit/4ddc3dc6f87c192627d00db85a1080411400eeb5), [`69d7f2e50`](https://github.com/keystonejs/keystone/commit/69d7f2e50ef2325c0d3b02b8bb5c310590796fed), [`f296866df`](https://github.com/keystonejs/keystone/commit/f296866dfab3af54381fd527473e3dc98425b3b9), [`2806a0bdf`](https://github.com/keystonejs/keystone/commit/2806a0bdfd65429e7c44ed070983f121d6934955), [`3adb2ac2a`](https://github.com/keystonejs/keystone/commit/3adb2ac2ac4ab65636ffea1b2b1f7044410c2b8b), [`9ab6961e0`](https://github.com/keystonejs/keystone/commit/9ab6961e0202277a980bd60a323a1c599f1dd085)]: + - @keystonejs/fields@13.0.2 + - @keystonejs/test-utils@7.0.1 + - @keystonejs/utils@5.4.2 + - @keystonejs/keystone@11.2.0 + - @keystonejs/session@7.0.1 + - @keystonejs/app-graphql@5.1.9 + ## 5.4.9 ### Patch Changes diff --git a/api-tests/CalendarDay.test.js b/api-tests/CalendarDay.test.js index 2f0df6a0ce1..a984473a8ab 100644 --- a/api-tests/CalendarDay.test.js +++ b/api-tests/CalendarDay.test.js @@ -1,12 +1,10 @@ const { multiAdapterRunners, setupServer, graphqlRequest } = require('@keystonejs/test-utils'); const { CalendarDay } = require('@keystonejs/fields'); -const cuid = require('cuid'); function setupKeystone(adapterName) { return setupServer({ adapterName, - name: `ks5-testdb-${cuid()}`, createLists: keystone => { keystone.createList('User', { fields: { diff --git a/api-tests/DateTime.test.js b/api-tests/DateTime.test.js index 1b0bf2ea97f..86fdba5af75 100644 --- a/api-tests/DateTime.test.js +++ b/api-tests/DateTime.test.js @@ -1,11 +1,9 @@ const { multiAdapterRunners, setupServer, graphqlRequest } = require('@keystonejs/test-utils'); const { Text, DateTime } = require('@keystonejs/fields'); -const cuid = require('cuid'); function setupKeystone(adapterName) { return setupServer({ adapterName, - name: `ks5-testdb-${cuid()}`, createLists: keystone => { keystone.createList('Post', { fields: { diff --git a/api-tests/Virtual.test.js b/api-tests/Virtual.test.js index a333fea5d28..9cc42b85932 100644 --- a/api-tests/Virtual.test.js +++ b/api-tests/Virtual.test.js @@ -1,12 +1,10 @@ const { multiAdapterRunners, setupServer, graphqlRequest } = require('@keystonejs/test-utils'); const { Integer, Virtual } = require('@keystonejs/fields'); -const cuid = require('cuid'); function makeSetupKeystone(fields) { return function setupKeystone(adapterName) { return setupServer({ adapterName, - name: `ks5-testdb-${cuid()}`, createLists: keystone => { keystone.createList('Post', { fields: { diff --git a/api-tests/access-control/utils.js b/api-tests/access-control/utils.js index 188cc32fae2..5ec9f57d57a 100644 --- a/api-tests/access-control/utils.js +++ b/api-tests/access-control/utils.js @@ -1,4 +1,3 @@ -const cuid = require('cuid'); const { setupServer } = require('@keystonejs/test-utils'); const { Text } = require('@keystonejs/fields'); const { objMerge } = require('@keystonejs/utils'); @@ -102,7 +101,6 @@ const createFieldImperative = fieldAccess => ({ function setupKeystone(adapterName) { return setupServer({ adapterName, - name: `ks5-testdb-${cuid()}`, createLists: keystone => { keystone.createList('User', { fields: { name: { type: Text } } }); diff --git a/api-tests/auth-header.test.js b/api-tests/auth-header.test.js index 5e630609ba0..40097b7b5b3 100644 --- a/api-tests/auth-header.test.js +++ b/api-tests/auth-header.test.js @@ -2,7 +2,6 @@ const { PasswordAuthStrategy } = require('@keystonejs/auth-password'); const { Text, Password, DateTime } = require('@keystonejs/fields'); const { multiAdapterRunners, networkedGraphqlRequest } = require('@keystonejs/test-utils'); const { setupServer } = require('@keystonejs/test-utils'); -const cuid = require('cuid'); const initialData = { User: [ @@ -25,7 +24,6 @@ const defaultAccess = ({ authentication: { item } }) => !!item; function setupKeystone(adapterName) { return setupServer({ adapterName, - name: `Jest Test Project For Login Auth ${cuid()}`, createLists: keystone => { keystone.createList('Post', { fields: { diff --git a/api-tests/default-value/defaults.test.js b/api-tests/default-value/defaults.test.js index 69c0fe800e8..81d91cc511e 100644 --- a/api-tests/default-value/defaults.test.js +++ b/api-tests/default-value/defaults.test.js @@ -1,10 +1,8 @@ const { multiAdapterRunners, setupServer, graphqlRequest } = require('@keystonejs/test-utils'); const { Text } = require('@keystonejs/fields'); -const cuid = require('cuid'); const setupList = (adapterName, fields) => setupServer({ - name: `ks5-testdb-${cuid()}`, adapterName, createLists: keystone => { keystone.createList('User', { fields }); @@ -146,7 +144,6 @@ describe('defaultValue field config', () => { expect.objectContaining({ context: expect.any(Object), originalInput: expect.any(Object), - actions: expect.any(Object), }) ); }) @@ -174,7 +171,6 @@ describe('defaultValue field config', () => { originalInput: { salutation: 'Doctor', }, - actions: expect.any(Object), }) ); expect(data.createUser).toMatchObject({ diff --git a/api-tests/extend-graphql-schema/extend-graphql-schema.test.js b/api-tests/extend-graphql-schema/extend-graphql-schema.test.js index 85e9ea9cf4a..8ce4d0f0607 100644 --- a/api-tests/extend-graphql-schema/extend-graphql-schema.test.js +++ b/api-tests/extend-graphql-schema/extend-graphql-schema.test.js @@ -5,14 +5,12 @@ const { graphqlRequest, networkedGraphqlRequest, } = require('@keystonejs/test-utils'); -const cuid = require('cuid'); const falseFn = () => false; function setupKeystone(adapterName) { return setupServer({ adapterName, - name: `ks5-testdb-${cuid()}`, createLists: keystone => { keystone.createList('User', { fields: { name: { type: Text } }, diff --git a/api-tests/fields.test.js b/api-tests/fields.test.js index 2f0a3c5c1a6..1747c4ac223 100644 --- a/api-tests/fields.test.js +++ b/api-tests/fields.test.js @@ -1,6 +1,5 @@ const globby = require('globby'); const path = require('path'); -const cuid = require('cuid'); const { multiAdapterRunners, setupServer } = require('@keystonejs/test-utils'); // `mongodb-memory-server` downloads a binary on first run in CI, which can take @@ -20,14 +19,13 @@ describe('Fields', () => { const keystoneTestWrapper = (testFn = () => {}) => runner( () => { - const name = `Field tests for ${mod.name} ${cuid()}`; const createLists = keystone => { // Create a list with all the fields required for testing const fields = mod.getTestFields(); keystone.createList(listName, { fields }); }; - return setupServer({ name, adapterName, createLists }); + return setupServer({ adapterName, createLists }); }, async ({ keystone, ...rest }) => { // Populate the database before running the tests diff --git a/api-tests/hooks/list-hooks.test.js b/api-tests/hooks/list-hooks.test.js index 005641bc98b..185c000bc5e 100644 --- a/api-tests/hooks/list-hooks.test.js +++ b/api-tests/hooks/list-hooks.test.js @@ -1,11 +1,9 @@ const { Text } = require('@keystonejs/fields'); const { multiAdapterRunners, setupServer, graphqlRequest } = require('@keystonejs/test-utils'); -const cuid = require('cuid'); function setupKeystone(adapterName) { return setupServer({ adapterName, - name: `ks5-testdb-${cuid()}`, createLists: keystone => { keystone.createList('User', { fields: { diff --git a/api-tests/package.json b/api-tests/package.json index 4faec57f4b9..b4bdf15b246 100644 --- a/api-tests/package.json +++ b/api-tests/package.json @@ -2,7 +2,7 @@ "name": "@keystonejs/api-tests", "description": "A set of tests for running against the KeystoneJS API.", "private": true, - "version": "5.4.9", + "version": "6.0.0", "author": "The KeystoneJS Development Team", "license": "MIT", "engines": { @@ -24,10 +24,9 @@ }, "dependencies": { "@keystonejs/auth-password": "^5.1.10", - "@keystonejs/fields": "^13.0.1", - "@keystonejs/test-utils": "^7.0.0", - "@keystonejs/utils": "^5.4.1", - "cuid": "^2.1.8", + "@keystonejs/fields": "^13.0.2", + "@keystonejs/test-utils": "^7.0.1", + "@keystonejs/utils": "^5.4.2", "date-fns": "^2.14.0", "express": "^4.17.1" } diff --git a/api-tests/queries-access-control/meta.test.js b/api-tests/queries-access-control/meta.test.js index d33fb8c5a32..3fb1c628ccd 100644 --- a/api-tests/queries-access-control/meta.test.js +++ b/api-tests/queries-access-control/meta.test.js @@ -1,11 +1,9 @@ const { Text, Relationship } = require('@keystonejs/fields'); const { multiAdapterRunners, setupServer, graphqlRequest } = require('@keystonejs/test-utils'); -const cuid = require('cuid'); function setupKeystone(adapterName) { return setupServer({ adapterName, - name: `ks5-testdb-${cuid()}`, createLists: keystone => { keystone.createList('User', { fields: { diff --git a/api-tests/queries/cache-hints.test.js b/api-tests/queries/cache-hints.test.js index b350dfd345b..8bbc9b64e72 100644 --- a/api-tests/queries/cache-hints.test.js +++ b/api-tests/queries/cache-hints.test.js @@ -5,12 +5,9 @@ const { networkedGraphqlRequest, } = require('@keystonejs/test-utils'); -const cuid = require('cuid'); - function setupKeystone(adapterName) { return setupServer({ adapterName, - name: `ks5-testdb-${cuid()}`, createLists: keystone => { keystone.createList('Post', { fields: { diff --git a/api-tests/queries/limits.test.js b/api-tests/queries/limits.test.js index 3dfe3953535..7bc3c8aeb77 100644 --- a/api-tests/queries/limits.test.js +++ b/api-tests/queries/limits.test.js @@ -9,12 +9,9 @@ const { validation: { depthLimit, definitionLimit, fieldLimit }, } = require('@keystonejs/app-graphql'); -const cuid = require('cuid'); - function setupKeystone(adapterName) { return setupServer({ adapterName, - name: `ks5-testdb-${cuid()}`, createLists: keystone => { keystone.createList('Post', { fields: { diff --git a/api-tests/queries/meta.test.js b/api-tests/queries/meta.test.js index 565bc537f8a..c7c5124ac31 100644 --- a/api-tests/queries/meta.test.js +++ b/api-tests/queries/meta.test.js @@ -1,11 +1,9 @@ const { Text, Relationship } = require('@keystonejs/fields'); const { multiAdapterRunners, setupServer, graphqlRequest } = require('@keystonejs/test-utils'); -const cuid = require('cuid'); function setupKeystone(adapterName) { return setupServer({ adapterName, - name: `ks5-testdb-${cuid()}`, createLists: keystone => { keystone.createList('User', { fields: { diff --git a/api-tests/queries/relationships.test.js b/api-tests/queries/relationships.test.js index a1522b5134f..2c7544e8f19 100644 --- a/api-tests/queries/relationships.test.js +++ b/api-tests/queries/relationships.test.js @@ -4,12 +4,10 @@ const { Text, Relationship } = require('@keystonejs/fields'); const { multiAdapterRunners, setupServer, graphqlRequest } = require('@keystonejs/test-utils'); const alphanumGenerator = gen.alphaNumString.notEmpty(); -const cuid = require('cuid'); function setupKeystone(adapterName) { return setupServer({ adapterName, - name: `ks5-testdb-${cuid()}`, createLists: keystone => { keystone.createList('Post', { fields: { diff --git a/api-tests/queries/search.test.js b/api-tests/queries/search.test.js index 58ac5b18168..4445f5f636a 100644 --- a/api-tests/queries/search.test.js +++ b/api-tests/queries/search.test.js @@ -1,12 +1,9 @@ const { Text, Integer } = require('@keystonejs/fields'); const { multiAdapterRunners, setupServer, graphqlRequest } = require('@keystonejs/test-utils'); -const cuid = require('cuid'); - function setupKeystone(adapterName) { return setupServer({ adapterName, - name: `ks5-testdb-${cuid()}`, createLists: keystone => { keystone.createList('Test', { fields: { diff --git a/api-tests/relationships/crud-self-ref/many-to-many-one-sided.test.js b/api-tests/relationships/crud-self-ref/many-to-many-one-sided.test.js index 9cb20a24886..5aa8b0ec744 100644 --- a/api-tests/relationships/crud-self-ref/many-to-many-one-sided.test.js +++ b/api-tests/relationships/crud-self-ref/many-to-many-one-sided.test.js @@ -1,6 +1,5 @@ const { gen, sampleOne } = require('testcheck'); const { Text, Relationship } = require('@keystonejs/fields'); -const cuid = require('cuid'); const { multiAdapterRunners, setupServer, graphqlRequest } = require('@keystonejs/test-utils'); const alphanumGenerator = gen.alphaNumString.notEmpty(); @@ -113,11 +112,7 @@ multiAdapterRunners().map(({ runner, adapterName }) => describe(`Many-to-many relationships`, () => { function setupKeystone(adapterName) { - return setupServer({ - adapterName, - name: `ks5-testdb-${cuid()}`, - createLists, - }); + return setupServer({ adapterName, createLists }); } describe('Read', () => { diff --git a/api-tests/relationships/crud-self-ref/many-to-many.test.js b/api-tests/relationships/crud-self-ref/many-to-many.test.js index d7aca30988e..1b6d7a90d4b 100644 --- a/api-tests/relationships/crud-self-ref/many-to-many.test.js +++ b/api-tests/relationships/crud-self-ref/many-to-many.test.js @@ -1,6 +1,5 @@ const { gen, sampleOne } = require('testcheck'); const { Text, Relationship } = require('@keystonejs/fields'); -const cuid = require('cuid'); const { multiAdapterRunners, setupServer, graphqlRequest } = require('@keystonejs/test-utils'); const alphanumGenerator = gen.alphaNumString.notEmpty(); @@ -127,11 +126,7 @@ multiAdapterRunners().map(({ runner, adapterName }) => ].forEach(([createLists, order]) => { describe(`Many-to-many relationships - ${order}`, () => { function setupKeystone(adapterName) { - return setupServer({ - adapterName, - name: `ks5-testdb-${cuid()}`, - createLists, - }); + return setupServer({ adapterName, createLists }); } describe('Read', () => { diff --git a/api-tests/relationships/crud-self-ref/one-to-many-one-sided.test.js b/api-tests/relationships/crud-self-ref/one-to-many-one-sided.test.js index b845a52a633..ceaf229ab41 100644 --- a/api-tests/relationships/crud-self-ref/one-to-many-one-sided.test.js +++ b/api-tests/relationships/crud-self-ref/one-to-many-one-sided.test.js @@ -1,6 +1,5 @@ const { gen, sampleOne } = require('testcheck'); const { Text, Relationship } = require('@keystonejs/fields'); -const cuid = require('cuid'); const { multiAdapterRunners, setupServer, graphqlRequest } = require('@keystonejs/test-utils'); const alphanumGenerator = gen.alphaNumString.notEmpty(); @@ -118,11 +117,7 @@ multiAdapterRunners().map(({ runner, adapterName }) => describe(`One-to-many relationships `, () => { function setupKeystone(adapterName) { - return setupServer({ - adapterName, - name: `ks5-testdb-${cuid()}`, - createLists, - }); + return setupServer({ adapterName, createLists }); } describe('Count', () => { diff --git a/api-tests/relationships/crud-self-ref/one-to-many.test.js b/api-tests/relationships/crud-self-ref/one-to-many.test.js index 2be78780d10..9ddbe8eedec 100644 --- a/api-tests/relationships/crud-self-ref/one-to-many.test.js +++ b/api-tests/relationships/crud-self-ref/one-to-many.test.js @@ -1,6 +1,5 @@ const { gen, sampleOne } = require('testcheck'); const { Text, Relationship } = require('@keystonejs/fields'); -const cuid = require('cuid'); const { multiAdapterRunners, setupServer, graphqlRequest } = require('@keystonejs/test-utils'); const alphanumGenerator = gen.alphaNumString.notEmpty(); @@ -124,11 +123,7 @@ multiAdapterRunners().map(({ runner, adapterName }) => ].forEach(([createLists, order]) => { describe(`One-to-many relationships - ${order}`, () => { function setupKeystone(adapterName) { - return setupServer({ - adapterName, - name: `ks5-testdb-${cuid()}`, - createLists, - }); + return setupServer({ adapterName, createLists }); } describe('Read', () => { diff --git a/api-tests/relationships/crud-self-ref/one-to-one.test.js b/api-tests/relationships/crud-self-ref/one-to-one.test.js index b3279bc2e99..bc13ca966f6 100644 --- a/api-tests/relationships/crud-self-ref/one-to-one.test.js +++ b/api-tests/relationships/crud-self-ref/one-to-one.test.js @@ -1,6 +1,5 @@ const { gen, sampleOne } = require('testcheck'); const { Text, Relationship } = require('@keystonejs/fields'); -const cuid = require('cuid'); const { multiAdapterRunners, setupServer, graphqlRequest } = require('@keystonejs/test-utils'); const alphanumGenerator = gen.alphaNumString.notEmpty(); @@ -90,11 +89,7 @@ multiAdapterRunners().map(({ runner, adapterName }) => ].forEach(([createLists, order]) => { describe(`One-to-one relationships - ${order}`, () => { function setupKeystone(adapterName) { - return setupServer({ - adapterName, - name: `ks5-testdb-${cuid()}`, - createLists, - }); + return setupServer({ adapterName, createLists }); } describe('Read', () => { diff --git a/api-tests/relationships/crud/many-to-many-one-sided.test.js b/api-tests/relationships/crud/many-to-many-one-sided.test.js index 64db2ef67c3..d4cd6226742 100644 --- a/api-tests/relationships/crud/many-to-many-one-sided.test.js +++ b/api-tests/relationships/crud/many-to-many-one-sided.test.js @@ -1,6 +1,5 @@ const { gen, sampleOne } = require('testcheck'); const { Text, Relationship } = require('@keystonejs/fields'); -const cuid = require('cuid'); const { multiAdapterRunners, setupServer, graphqlRequest } = require('@keystonejs/test-utils'); const alphanumGenerator = gen.alphaNumString.notEmpty(); @@ -136,11 +135,7 @@ multiAdapterRunners().map(({ runner, adapterName }) => ].forEach(([createLists, order]) => { describe(`Many-to-many relationships - ${order}`, () => { function setupKeystone(adapterName) { - return setupServer({ - adapterName, - name: `ks5-testdb-${cuid()}`, - createLists, - }); + return setupServer({ adapterName, createLists }); } describe('Read', () => { diff --git a/api-tests/relationships/crud/many-to-many.test.js b/api-tests/relationships/crud/many-to-many.test.js index cc53c4bd0fa..93fe771017b 100644 --- a/api-tests/relationships/crud/many-to-many.test.js +++ b/api-tests/relationships/crud/many-to-many.test.js @@ -1,6 +1,5 @@ const { gen, sampleOne } = require('testcheck'); const { Text, Relationship } = require('@keystonejs/fields'); -const cuid = require('cuid'); const { multiAdapterRunners, setupServer, graphqlRequest } = require('@keystonejs/test-utils'); const alphanumGenerator = gen.alphaNumString.notEmpty(); @@ -138,11 +137,7 @@ multiAdapterRunners().map(({ runner, adapterName }) => ].forEach(([createLists, order]) => { describe(`Many-to-many relationships - ${order}`, () => { function setupKeystone(adapterName) { - return setupServer({ - adapterName, - name: `ks5-testdb-${cuid()}`, - createLists, - }); + return setupServer({ adapterName, createLists }); } describe('Read', () => { diff --git a/api-tests/relationships/crud/one-to-many-one-sided.test.js b/api-tests/relationships/crud/one-to-many-one-sided.test.js index 50635503a0e..d626f26b23b 100644 --- a/api-tests/relationships/crud/one-to-many-one-sided.test.js +++ b/api-tests/relationships/crud/one-to-many-one-sided.test.js @@ -1,6 +1,5 @@ const { gen, sampleOne } = require('testcheck'); const { Text, Relationship } = require('@keystonejs/fields'); -const cuid = require('cuid'); const { multiAdapterRunners, setupServer, graphqlRequest } = require('@keystonejs/test-utils'); const alphanumGenerator = gen.alphaNumString.notEmpty(); @@ -146,11 +145,7 @@ multiAdapterRunners().map(({ runner, adapterName }) => ].forEach(([createLists, order]) => { describe(`One-to-many relationships - ${order}`, () => { function setupKeystone(adapterName) { - return setupServer({ - adapterName, - name: `ks5-testdb-${cuid()}`, - createLists, - }); + return setupServer({ adapterName, createLists }); } describe('Count', () => { diff --git a/api-tests/relationships/crud/one-to-many.test.js b/api-tests/relationships/crud/one-to-many.test.js index 55fdcef73c6..90cd41148b5 100644 --- a/api-tests/relationships/crud/one-to-many.test.js +++ b/api-tests/relationships/crud/one-to-many.test.js @@ -1,6 +1,5 @@ const { gen, sampleOne } = require('testcheck'); const { Text, Relationship } = require('@keystonejs/fields'); -const cuid = require('cuid'); const { multiAdapterRunners, setupServer, graphqlRequest } = require('@keystonejs/test-utils'); const alphanumGenerator = gen.alphaNumString.notEmpty(); @@ -134,11 +133,7 @@ multiAdapterRunners().map(({ runner, adapterName }) => ].forEach(([createLists, order]) => { describe(`One-to-many relationships - ${order}`, () => { function setupKeystone(adapterName) { - return setupServer({ - adapterName, - name: `ks5-testdb-${cuid()}`, - createLists, - }); + return setupServer({ adapterName, createLists }); } describe('Read', () => { diff --git a/api-tests/relationships/crud/one-to-one.test.js b/api-tests/relationships/crud/one-to-one.test.js index 9ade5101c50..239cd162471 100644 --- a/api-tests/relationships/crud/one-to-one.test.js +++ b/api-tests/relationships/crud/one-to-one.test.js @@ -1,6 +1,5 @@ const { gen, sampleOne } = require('testcheck'); const { Text, Relationship } = require('@keystonejs/fields'); -const cuid = require('cuid'); const { multiAdapterRunners, setupServer, graphqlRequest } = require('@keystonejs/test-utils'); const alphanumGenerator = gen.alphaNumString.notEmpty(); @@ -130,11 +129,7 @@ multiAdapterRunners().map(({ runner, adapterName }) => ].forEach(([createLists, order]) => { describe(`One-to-one relationships - ${order}`, () => { function setupKeystone(adapterName) { - return setupServer({ - adapterName, - name: `ks5-testdb-${cuid()}`, - createLists, - }); + return setupServer({ adapterName, createLists }); } describe('Read', () => { diff --git a/api-tests/relationships/filtering/access-control.test.js b/api-tests/relationships/filtering/access-control.test.js index 1b1a051dfc9..c74fb7a3bd6 100644 --- a/api-tests/relationships/filtering/access-control.test.js +++ b/api-tests/relationships/filtering/access-control.test.js @@ -5,7 +5,6 @@ const { setupServer, networkedGraphqlRequest, } = require('@keystonejs/test-utils'); -const cuid = require('cuid'); const alphanumGenerator = gen.alphaNumString.notEmpty(); @@ -14,7 +13,6 @@ const postNames = ['Post 1', 'Post 2', 'Post 3']; function setupKeystone(adapterName) { return setupServer({ adapterName, - name: `ks5-testdb-${cuid()}`, createLists: keystone => { keystone.createList('UserToPostLimitedRead', { fields: { diff --git a/api-tests/relationships/filtering/filtering.test.js b/api-tests/relationships/filtering/filtering.test.js index 0e8eb7c7059..c11a148b7f9 100644 --- a/api-tests/relationships/filtering/filtering.test.js +++ b/api-tests/relationships/filtering/filtering.test.js @@ -1,11 +1,9 @@ const { Text, Relationship } = require('@keystonejs/fields'); const { multiAdapterRunners, setupServer, graphqlRequest } = require('@keystonejs/test-utils'); -const cuid = require('cuid'); function setupKeystone(adapterName) { return setupServer({ adapterName, - name: `ks5-testdb-${cuid()}`, createLists: keystone => { keystone.createList('User', { fields: { diff --git a/api-tests/relationships/filtering/nested.test.js b/api-tests/relationships/filtering/nested.test.js index dcbdea6ccb3..f66da58600b 100644 --- a/api-tests/relationships/filtering/nested.test.js +++ b/api-tests/relationships/filtering/nested.test.js @@ -1,11 +1,9 @@ const { Text, Relationship } = require('@keystonejs/fields'); const { multiAdapterRunners, setupServer, graphqlRequest } = require('@keystonejs/test-utils'); -const cuid = require('cuid'); function setupKeystone(adapterName) { return setupServer({ adapterName, - name: `ks5-testdb-${cuid()}`, createLists: keystone => { keystone.createList('User', { fields: { diff --git a/api-tests/relationships/nested-mutations/connect-many.test.js b/api-tests/relationships/nested-mutations/connect-many.test.js index 5c9c1c5947b..261186401e8 100644 --- a/api-tests/relationships/nested-mutations/connect-many.test.js +++ b/api-tests/relationships/nested-mutations/connect-many.test.js @@ -1,6 +1,5 @@ const { gen, sampleOne } = require('testcheck'); const { Text, Relationship } = require('@keystonejs/fields'); -const cuid = require('cuid'); const { multiAdapterRunners, setupServer, @@ -13,7 +12,6 @@ const alphanumGenerator = gen.alphaNumString.notEmpty(); function setupKeystone(adapterName) { return setupServer({ adapterName, - name: `ks5-testdb-${cuid()}`, createLists: keystone => { keystone.createList('Note', { fields: { diff --git a/api-tests/relationships/nested-mutations/connect-singular.test.js b/api-tests/relationships/nested-mutations/connect-singular.test.js index bd7edf10cae..18fabaaddbe 100644 --- a/api-tests/relationships/nested-mutations/connect-singular.test.js +++ b/api-tests/relationships/nested-mutations/connect-singular.test.js @@ -1,6 +1,5 @@ const { gen, sampleOne } = require('testcheck'); const { Text, Relationship } = require('@keystonejs/fields'); -const cuid = require('cuid'); const { multiAdapterRunners, setupServer, @@ -11,7 +10,6 @@ const { function setupKeystone(adapterName) { return setupServer({ adapterName, - name: `ks5-testdb-${cuid()}`, createLists: keystone => { keystone.createList('Group', { fields: { diff --git a/api-tests/relationships/nested-mutations/create-and-connect-many.test.js b/api-tests/relationships/nested-mutations/create-and-connect-many.test.js index da4e1d2c580..fb3fd792c15 100644 --- a/api-tests/relationships/nested-mutations/create-and-connect-many.test.js +++ b/api-tests/relationships/nested-mutations/create-and-connect-many.test.js @@ -1,6 +1,5 @@ const { gen, sampleOne } = require('testcheck'); const { Text, Relationship } = require('@keystonejs/fields'); -const cuid = require('cuid'); const { multiAdapterRunners, setupServer, @@ -13,7 +12,6 @@ const alphanumGenerator = gen.alphaNumString.notEmpty(); function setupKeystone(adapterName) { return setupServer({ adapterName, - name: `ks5-testdb-${cuid()}`, createLists: keystone => { keystone.createList('Note', { fields: { diff --git a/api-tests/relationships/nested-mutations/create-and-connect-singular.test.js b/api-tests/relationships/nested-mutations/create-and-connect-singular.test.js index 42012a88c4f..28a26bf5bdc 100644 --- a/api-tests/relationships/nested-mutations/create-and-connect-singular.test.js +++ b/api-tests/relationships/nested-mutations/create-and-connect-singular.test.js @@ -1,11 +1,9 @@ const { Text, Relationship } = require('@keystonejs/fields'); -const cuid = require('cuid'); const { multiAdapterRunners, setupServer, graphqlRequest } = require('@keystonejs/test-utils'); function setupKeystone(adapterName) { return setupServer({ adapterName, - name: `ks5-testdb-${cuid()}`, createLists: keystone => { keystone.createList('Group', { fields: { diff --git a/api-tests/relationships/nested-mutations/create-many.test.js b/api-tests/relationships/nested-mutations/create-many.test.js index 7de1415040c..fe52d3f443b 100644 --- a/api-tests/relationships/nested-mutations/create-many.test.js +++ b/api-tests/relationships/nested-mutations/create-many.test.js @@ -1,6 +1,5 @@ const { gen, sampleOne } = require('testcheck'); const { Text, Relationship } = require('@keystonejs/fields'); -const cuid = require('cuid'); const { multiAdapterRunners, setupServer, @@ -13,7 +12,6 @@ const alphanumGenerator = gen.alphaNumString.notEmpty(); function setupKeystone(adapterName) { return setupServer({ adapterName, - name: `ks5-testdb-${cuid()}`, createLists: keystone => { keystone.createList('Note', { fields: { diff --git a/api-tests/relationships/nested-mutations/create-singular.test.js b/api-tests/relationships/nested-mutations/create-singular.test.js index 2e622c31e89..00220844135 100644 --- a/api-tests/relationships/nested-mutations/create-singular.test.js +++ b/api-tests/relationships/nested-mutations/create-singular.test.js @@ -1,6 +1,5 @@ const { gen, sampleOne } = require('testcheck'); const { Text, Relationship } = require('@keystonejs/fields'); -const cuid = require('cuid'); const { multiAdapterRunners, setupServer, @@ -11,7 +10,6 @@ const { function setupKeystone(adapterName) { return setupServer({ adapterName, - name: `ks5-testdb-${cuid()}`, createLists: keystone => { keystone.createList('Group', { fields: { diff --git a/api-tests/relationships/nested-mutations/disconnect-all-many.test.js b/api-tests/relationships/nested-mutations/disconnect-all-many.test.js index 515be32bbab..9e4a2515421 100644 --- a/api-tests/relationships/nested-mutations/disconnect-all-many.test.js +++ b/api-tests/relationships/nested-mutations/disconnect-all-many.test.js @@ -1,6 +1,5 @@ const { gen, sampleOne } = require('testcheck'); const { Text, Relationship } = require('@keystonejs/fields'); -const cuid = require('cuid'); const { setupServer, graphqlRequest, @@ -13,7 +12,6 @@ const alphanumGenerator = gen.alphaNumString.notEmpty(); function setupKeystone(adapterName) { return setupServer({ adapterName, - name: `ks5-testdb-${cuid()}`, createLists: keystone => { keystone.createList('Note', { fields: { diff --git a/api-tests/relationships/nested-mutations/disconnect-all-singular.test.js b/api-tests/relationships/nested-mutations/disconnect-all-singular.test.js index 2563c2d16b0..3d6cd8c3b96 100644 --- a/api-tests/relationships/nested-mutations/disconnect-all-singular.test.js +++ b/api-tests/relationships/nested-mutations/disconnect-all-singular.test.js @@ -1,6 +1,5 @@ const { gen, sampleOne } = require('testcheck'); const { Text, Relationship } = require('@keystonejs/fields'); -const cuid = require('cuid'); const { multiAdapterRunners, setupServer, @@ -13,7 +12,6 @@ const alphanumGenerator = gen.alphaNumString.notEmpty(); function setupKeystone(adapterName) { return setupServer({ adapterName, - name: `ks5-testdb-${cuid()}`, createLists: keystone => { keystone.createList('Group', { fields: { diff --git a/api-tests/relationships/nested-mutations/disconnect-many.test.js b/api-tests/relationships/nested-mutations/disconnect-many.test.js index e17b75e4499..d2d38cb32f3 100644 --- a/api-tests/relationships/nested-mutations/disconnect-many.test.js +++ b/api-tests/relationships/nested-mutations/disconnect-many.test.js @@ -1,6 +1,5 @@ const { gen, sampleOne } = require('testcheck'); const { Text, Relationship } = require('@keystonejs/fields'); -const cuid = require('cuid'); const { multiAdapterRunners, setupServer, @@ -13,7 +12,6 @@ const alphanumGenerator = gen.alphaNumString.notEmpty(); function setupKeystone(adapterName) { return setupServer({ adapterName, - name: `ks5-testdb-${cuid()}`, createLists: keystone => { keystone.createList('Note', { fields: { diff --git a/api-tests/relationships/nested-mutations/disconnect-singular.test.js b/api-tests/relationships/nested-mutations/disconnect-singular.test.js index 6d599fa8bc9..d29003b164f 100644 --- a/api-tests/relationships/nested-mutations/disconnect-singular.test.js +++ b/api-tests/relationships/nested-mutations/disconnect-singular.test.js @@ -1,6 +1,5 @@ const { gen, sampleOne } = require('testcheck'); const { Text, Relationship } = require('@keystonejs/fields'); -const cuid = require('cuid'); const { multiAdapterRunners, setupServer, @@ -13,7 +12,6 @@ const alphanumGenerator = gen.alphaNumString.notEmpty(); function setupKeystone(adapterName) { return setupServer({ adapterName, - name: `ks5-testdb-${cuid()}`, createLists: keystone => { keystone.createList('Group', { fields: { diff --git a/api-tests/relationships/nested-mutations/reconnect-many-to-one.test.js b/api-tests/relationships/nested-mutations/reconnect-many-to-one.test.js index 67af3eb767c..a354d5f401b 100644 --- a/api-tests/relationships/nested-mutations/reconnect-many-to-one.test.js +++ b/api-tests/relationships/nested-mutations/reconnect-many-to-one.test.js @@ -1,11 +1,9 @@ const { Text, Relationship } = require('@keystonejs/fields'); -const cuid = require('cuid'); const { multiAdapterRunners, setupServer, graphqlRequest } = require('@keystonejs/test-utils'); function setupKeystone(adapterName) { return setupServer({ adapterName, - name: `ks5-testdb-${cuid()}`, createLists: keystone => { keystone.createList('Note', { fields: { diff --git a/api-tests/relationships/nested-mutations/two-way-backreference/to-many.test.js b/api-tests/relationships/nested-mutations/two-way-backreference/to-many.test.js index d8b36ad6dd0..b5221efbb45 100644 --- a/api-tests/relationships/nested-mutations/two-way-backreference/to-many.test.js +++ b/api-tests/relationships/nested-mutations/two-way-backreference/to-many.test.js @@ -1,6 +1,5 @@ const { gen, sampleOne } = require('testcheck'); const { Text, Relationship } = require('@keystonejs/fields'); -const cuid = require('cuid'); const { multiAdapterRunners, setupServer, graphqlRequest } = require('@keystonejs/test-utils'); const alphanumGenerator = gen.alphaNumString.notEmpty(); @@ -14,7 +13,6 @@ jest.setTimeout(60000); function setupKeystone(adapterName) { return setupServer({ adapterName, - name: `ks5-testdb-${cuid()}`, createLists: keystone => { keystone.createList('Student', { fields: { diff --git a/api-tests/relationships/nested-mutations/two-way-backreference/to-one-required.test.js b/api-tests/relationships/nested-mutations/two-way-backreference/to-one-required.test.js index b6001053e8e..5ceac163e3b 100644 --- a/api-tests/relationships/nested-mutations/two-way-backreference/to-one-required.test.js +++ b/api-tests/relationships/nested-mutations/two-way-backreference/to-one-required.test.js @@ -1,6 +1,5 @@ const { gen, sampleOne } = require('testcheck'); const { Text, Relationship } = require('@keystonejs/fields'); -const cuid = require('cuid'); const { multiAdapterRunners, setupServer, graphqlRequest } = require('@keystonejs/test-utils'); const alphanumGenerator = gen.alphaNumString.notEmpty(); @@ -10,7 +9,6 @@ jest.setTimeout(6000000); function setupKeystone(adapterName) { return setupServer({ adapterName, - name: `ks5-testdb-${cuid()}`, createLists: keystone => { keystone.createList('Company', { fields: { diff --git a/api-tests/required.test.js b/api-tests/required.test.js index 0b2dd2768bf..51a68aefc0d 100644 --- a/api-tests/required.test.js +++ b/api-tests/required.test.js @@ -1,4 +1,3 @@ -const cuid = require('cuid'); const globby = require('globby'); const { multiAdapterRunners, setupServer, graphqlRequest } = require('@keystonejs/test-utils'); const { Text } = require('@keystonejs/fields'); @@ -17,7 +16,6 @@ describe('Test isRequired flag for all field types', () => { runner( () => setupServer({ - name: `Field tests for ${type.type} ${cuid()}`, adapterName, createLists: keystone => { if (type.type === 'Select') { diff --git a/api-tests/uniqueness/unique.test.js b/api-tests/uniqueness/unique.test.js index c03b35b2634..406a680fede 100644 --- a/api-tests/uniqueness/unique.test.js +++ b/api-tests/uniqueness/unique.test.js @@ -1,11 +1,9 @@ const { Text } = require('@keystonejs/fields'); const { multiAdapterRunners, setupServer, graphqlRequest } = require('@keystonejs/test-utils'); -const cuid = require('cuid'); function setupKeystone(adapterName) { return setupServer({ adapterName, - name: `ks5-testdb-${cuid()}`, createLists: keystone => { keystone.createList('User', { fields: { diff --git a/benchmarks/CHANGELOG.md b/benchmarks/CHANGELOG.md index 555fbeda7c2..6d873898c1a 100644 --- a/benchmarks/CHANGELOG.md +++ b/benchmarks/CHANGELOG.md @@ -1,5 +1,18 @@ # @keystonejs/benchmarks +## 5.1.14 + +### Patch Changes + +- [`4ddc3dc6f`](https://github.com/keystonejs/keystone/commit/4ddc3dc6f87c192627d00db85a1080411400eeb5) [#3212](https://github.com/keystonejs/keystone/pull/3212) Thanks [@timleslie](https://github.com/timleslie)! - Removed `name` argument from calls to `setupServer` in tests. + +- Updated dependencies [[`4ddc3dc6f`](https://github.com/keystonejs/keystone/commit/4ddc3dc6f87c192627d00db85a1080411400eeb5), [`f296866df`](https://github.com/keystonejs/keystone/commit/f296866dfab3af54381fd527473e3dc98425b3b9), [`2806a0bdf`](https://github.com/keystonejs/keystone/commit/2806a0bdfd65429e7c44ed070983f121d6934955), [`3adb2ac2a`](https://github.com/keystonejs/keystone/commit/3adb2ac2ac4ab65636ffea1b2b1f7044410c2b8b), [`9ab6961e0`](https://github.com/keystonejs/keystone/commit/9ab6961e0202277a980bd60a323a1c599f1dd085)]: + - @keystonejs/fields@13.0.2 + - @keystonejs/test-utils@7.0.1 + - @keystonejs/keystone@11.2.0 + - @keystonejs/session@7.0.1 + - @keystonejs/app-graphql@5.1.9 + ## 5.1.13 ### Patch Changes diff --git a/benchmarks/fixtures/create-related.js b/benchmarks/fixtures/create-related.js index f2c1800a06c..a46a840e4a0 100644 --- a/benchmarks/fixtures/create-related.js +++ b/benchmarks/fixtures/create-related.js @@ -1,4 +1,3 @@ -const cuid = require('cuid'); const { Text, Relationship } = require('@keystonejs/fields'); const { setupServer } = require('@keystonejs/test-utils'); const { FixtureGroup, timeQuery, populate, range } = require('../lib/utils'); @@ -6,7 +5,6 @@ const { FixtureGroup, timeQuery, populate, range } = require('../lib/utils'); function setupKeystone(adapterName) { return setupServer({ adapterName, - name: `ks5-testdb-${cuid()}`, createLists: keystone => { keystone.createList('User', { fields: { diff --git a/benchmarks/fixtures/create.js b/benchmarks/fixtures/create.js index 1207fb6fac7..d2d94dce08a 100644 --- a/benchmarks/fixtures/create.js +++ b/benchmarks/fixtures/create.js @@ -1,4 +1,3 @@ -const cuid = require('cuid'); const { Text } = require('@keystonejs/fields'); const { setupServer } = require('@keystonejs/test-utils'); const { FixtureGroup, timeQuery, populate, range } = require('../lib/utils'); @@ -6,7 +5,6 @@ const { FixtureGroup, timeQuery, populate, range } = require('../lib/utils'); function setupKeystone(adapterName) { return setupServer({ adapterName, - name: `ks5-testdb-${cuid()}`, createLists: keystone => { keystone.createList('User', { fields: { diff --git a/benchmarks/fixtures/query.js b/benchmarks/fixtures/query.js index 9f5c7a022d6..793b2e122b0 100644 --- a/benchmarks/fixtures/query.js +++ b/benchmarks/fixtures/query.js @@ -1,4 +1,3 @@ -const cuid = require('cuid'); const { Text, Relationship } = require('@keystonejs/fields'); const { setupServer, graphqlRequest } = require('@keystonejs/test-utils'); const { FixtureGroup, timeQuery, populate, range } = require('../lib/utils'); @@ -6,7 +5,6 @@ const { FixtureGroup, timeQuery, populate, range } = require('../lib/utils'); function setupKeystone(adapterName) { return setupServer({ adapterName, - name: `ks5-testdb-${cuid()}`, createLists: keystone => { keystone.createList('User', { fields: { diff --git a/benchmarks/package.json b/benchmarks/package.json index 2ddb404e423..a86cb5f0c03 100644 --- a/benchmarks/package.json +++ b/benchmarks/package.json @@ -2,7 +2,7 @@ "name": "@keystonejs/benchmarks", "description": "A set of benchmarks for running against the KeystoneJS API.", "private": true, - "version": "5.1.13", + "version": "5.1.14", "author": "The KeystoneJS Development Team", "license": "MIT", "engines": { @@ -16,14 +16,13 @@ "dependencies": { "@keystonejs/adapter-knex": "^10.1.0", "@keystonejs/adapter-mongoose": "^8.1.3", - "@keystonejs/app-graphql": "^5.1.8", - "@keystonejs/fields": "^13.0.1", - "@keystonejs/keystone": "^11.1.1", - "@keystonejs/session": "^7.0.0", - "@keystonejs/test-utils": "^7.0.0", + "@keystonejs/app-graphql": "^5.1.9", + "@keystonejs/fields": "^13.0.2", + "@keystonejs/keystone": "^11.2.0", + "@keystonejs/session": "^7.0.1", + "@keystonejs/test-utils": "^7.0.1", "body-parser": "^1.18.2", "cookie-signature": "^1.1.0", - "cuid": "^2.1.8", "supertest-light": "^1.0.3", "testcheck": "^1.0.0-rc.2" } diff --git a/demo-projects/custom-fields/fields/MultiCheck/Implementation.js b/demo-projects/custom-fields/fields/MultiCheck/Implementation.js index 47895223eb8..c0473ea3c77 100644 --- a/demo-projects/custom-fields/fields/MultiCheck/Implementation.js +++ b/demo-projects/custom-fields/fields/MultiCheck/Implementation.js @@ -35,11 +35,11 @@ class MultiCheck extends Text.implementation { ]; } - getDefaultValue({ context, originalInput, actions }) { + getDefaultValue({ context, originalInput }) { let result; if (typeof this.defaultValue !== 'undefined') { if (typeof this.defaultValue === 'function') { - result = this.defaultValue({ context, originalInput, actions }); + result = this.defaultValue({ context, originalInput }); } else { result = this.defaultValue; } diff --git a/docs/api/hooks.md b/docs/api/hooks.md index 67d9f166051..ee6aa64eb8f 100644 --- a/docs/api/hooks.md +++ b/docs/api/hooks.md @@ -133,7 +133,6 @@ The result is passed to [the next function in the execution order](/docs/guides/ | `originalInput` | `Object` | The data received by the GraphQL mutation | | `resolvedData` | `Object` | The data received by the GraphQL mutation plus defaults values | | `context` | `Apollo Context` | The [Apollo `context` object](https://www.apollographql.com/docs/apollo-server/data/data/#context-argument) for this request | -| `actions` | `Object` | Contains a `query` functions that queries the list within the current operations context, see [Query Helper](#query-helper) | #### Usage @@ -146,7 +145,6 @@ const resolveInput = ({ originalInput, resolvedData, context, - actions, }) => { // Input resolution logic. Object returned is used in place of `resolvedData`. return resolvedData; @@ -172,7 +170,6 @@ Return values are ignored. | `originalInput` | `Object` | The data received by the GraphQL mutation | | `resolvedData` | `Object` | The data received by the GraphQL mutation plus defaults values | | `context` | `Apollo Context` | The [Apollo `context` object](https://www.apollographql.com/docs/apollo-server/data/data/#context-argument) for this request | -| `actions` | `Object` | Contains a `query` functions that queries the list within the current operations context, see [Query Helper](#query-helper) | | `addFieldValidationError` | `Function` | Used to set a field validation error; accepts a `String` | #### Usage @@ -186,7 +183,6 @@ const validateInput = ({ originalInput, resolvedData, context, - actions, addFieldValidationError, }) => { // Throw error objects or register validation errors with addFieldValidationError() @@ -213,7 +209,6 @@ Return values are ignored. | `originalInput` | `Object` | The data received by the GraphQL mutation | | `resolvedData` | `Object` | The data received by the GraphQL mutation plus defaults values | | `context` | `Apollo Context` | The [Apollo `context` object](https://www.apollographql.com/docs/apollo-server/data/data/#context-argument) for this request | -| `actions` | `Object` | Contains a `query` functions that queries the list within the current operations context, see [Query Helper](#query-helper) | #### Usage @@ -226,7 +221,6 @@ const beforeChange = ({ originalInput, resolvedData, context, - actions, }) => { // Perform side effects // Return values ignored @@ -256,7 +250,6 @@ Return values are ignored. | `originalInput` | `Object` | The data received by the GraphQL mutation | | `updatedItem` | `Object` | The new/currently stored item | | `context` | `Apollo Context` | The [Apollo `context` object](https://www.apollographql.com/docs/apollo-server/data/data/#context-argument) for this request | -| `actions` | `Object` | Contains a `query` functions that queries the list within the current operations context, see [Query Helper](#query-helper) | #### Usage @@ -269,7 +262,6 @@ const afterChange = ({ originalInput, updatedItem, context, - actions, }) => { // Perform side effects // Return values ignored @@ -292,7 +284,6 @@ Should throw or register errors with `addFieldValidationError()` if the | `operation` | `String` | The operation being performed (`delete` in this case) | | `existingItem` | `Object` | The current stored item | | `context` | `Apollo Context` | The [Apollo `context` object](https://www.apollographql.com/docs/apollo-server/data/data/#context-argument) for this request | -| `actions` | `Object` | Contains a `query` functions that queries the list within the current operations context, see [Query Helper](#query-helper) | | `addFieldValidationError` | `Function` | Used to set a field validation error; accepts a `String` | #### Usage @@ -304,7 +295,6 @@ const validateDelete = ({ operation, existingItem, context, - actions, addFieldValidationError, }) => { // Throw error objects or register validation errors with addFieldValidationError() @@ -329,7 +319,6 @@ Return values are ignored. | `operation` | `String` | The operation being performed (`delete` in this case) | | `existingItem` | `Object` | The current stored item | | `context` | `Apollo Context` | The [Apollo `context` object](https://www.apollographql.com/docs/apollo-server/data/data/#context-argument) for this request | -| `actions` | `Object` | Contains a `query` functions that queries the list within the current operations context, see [Query Helper](#query-helper) | #### Usage @@ -340,7 +329,6 @@ const beforeDelete = ({ operation, existingItem, context, - actions, }) => { // Perform side effects // Return values ignored @@ -366,7 +354,6 @@ Return values are ignored. | `operation` | `String` | The operation being performed (`delete` in this case) | | `existingItem` | `Object` | The previously stored item, now deleted | | `context` | `Apollo Context` | The [Apollo `context` object](https://www.apollographql.com/docs/apollo-server/data/data/#context-argument) for this request | -| `actions` | `Object` | Contains a `query` functions that queries the list within the current operations context, see [Query Helper](#query-helper) | #### Usage @@ -377,55 +364,13 @@ const afterDelete = ({ operation, existingItem, context, - actions, }) => { // Perform side effects // Return values ignored }; ``` -## The `actions` argument +### Running GraphQL Queries From Hook -All hooks receive an `actions` object as an argument. - -It contains helper functionality for accessing the GraphQL schema, optionally _within_ the context of the current request. -When used, this context reuse causes access control to be applied as though the caller themselves initiated an operation. -It can therefore be useful for performing additional operations on behalf of the caller. - -The `actions` object currently contains a single function: `query`. - -### Query helper - -Perform a GraphQL query, optionally _within_ the context of the current request. -It returns a `Promise` containing the standard GraphQL `errors` and `data` properties. - -#### Argument - -| Argument | Type | Description | -| :-------------------------- | :-------- | :----------------------------------------------------------------------------------------------------------------------------------- | -| `queryString` | `String` | A graphQL query string | -| `options` | `Object` | Config for the query | -| `options.skipAccessControl` | `Boolean` | By default access control _of the user making the initial request_ is still tested. Pass as `true` to disable access control checks. | -| `options.variables` | `Object` | The variables passed to the graphql query for the given queryString | - -#### Usage - -```js -const myHook = ({ - actions: { query }, -}) => { - const queryString = ` - query { - # GraphQL query here... - } - `; - const options = { - skipAccessControl: false, - variables: { /* GraphQL variables here.. */ }, - }; - const { errors, data } = await query(queryString, options); - - // Check for errors - // Do something with data -}; -``` +If you need to execute a GraphQL query from within your hook function you can use `context.executeGraphQL()`. +See the docs on [server-side graphql operations](/docs/discussions/server-side-graphql.md) for more details. diff --git a/packages/app-admin-ui/CHANGELOG.md b/packages/app-admin-ui/CHANGELOG.md index 7d297477195..d537d20cf4b 100644 --- a/packages/app-admin-ui/CHANGELOG.md +++ b/packages/app-admin-ui/CHANGELOG.md @@ -1,5 +1,15 @@ # @keystonejs/app-admin-ui +## 7.0.5 + +### Patch Changes + +- Updated dependencies [[`887ad8199`](https://github.com/keystonejs/keystone/commit/887ad8199aa5c32a3db8588104f4548c90aa106c), [`4ddc3dc6f`](https://github.com/keystonejs/keystone/commit/4ddc3dc6f87c192627d00db85a1080411400eeb5), [`69d7f2e50`](https://github.com/keystonejs/keystone/commit/69d7f2e50ef2325c0d3b02b8bb5c310590796fed), [`2806a0bdf`](https://github.com/keystonejs/keystone/commit/2806a0bdfd65429e7c44ed070983f121d6934955), [`3adb2ac2a`](https://github.com/keystonejs/keystone/commit/3adb2ac2ac4ab65636ffea1b2b1f7044410c2b8b)]: + - @arch-ui/pagination@0.0.23 + - @keystonejs/fields@13.0.2 + - @keystonejs/utils@5.4.2 + - @keystonejs/session@7.0.1 + ## 7.0.4 ### Patch Changes diff --git a/packages/app-admin-ui/package.json b/packages/app-admin-ui/package.json index 3cd629e9441..e82437a5e88 100644 --- a/packages/app-admin-ui/package.json +++ b/packages/app-admin-ui/package.json @@ -1,7 +1,7 @@ { "name": "@keystonejs/app-admin-ui", "description": "KeystoneJS Admin UI App.", - "version": "7.0.4", + "version": "7.0.5", "author": "The KeystoneJS Development Team", "license": "MIT", "engines": { @@ -29,7 +29,7 @@ "@arch-ui/lozenge": "^0.0.16", "@arch-ui/navbar": "^0.1.11", "@arch-ui/options": "^0.0.21", - "@arch-ui/pagination": "^0.0.22", + "@arch-ui/pagination": "^0.0.23", "@arch-ui/pill": "^0.1.15", "@arch-ui/popout": "^0.0.19", "@arch-ui/select": "^0.1.8", @@ -41,9 +41,9 @@ "@emotion/core": "^10.0.28", "@keystonejs/build-field-types": "^5.2.9", "@keystonejs/field-views-loader": "^6.0.0", - "@keystonejs/fields": "^13.0.0", - "@keystonejs/session": "^7.0.0", - "@keystonejs/utils": "^5.4.1", + "@keystonejs/fields": "^13.0.2", + "@keystonejs/session": "^7.0.1", + "@keystonejs/utils": "^5.4.2", "@types/react": "^16.8.12", "apollo-cache-inmemory": "^1.6.6", "apollo-client": "^2.6.10", diff --git a/packages/app-graphql/CHANGELOG.md b/packages/app-graphql/CHANGELOG.md index 9dfe536c5cc..ba4d47feab4 100644 --- a/packages/app-graphql/CHANGELOG.md +++ b/packages/app-graphql/CHANGELOG.md @@ -1,5 +1,15 @@ # @keystonejs/app-graphql +## 5.1.9 + +### Patch Changes + +- [`9ab6961e0`](https://github.com/keystonejs/keystone/commit/9ab6961e0202277a980bd60a323a1c599f1dd085) [#3217](https://github.com/keystonejs/keystone/pull/3217) Thanks [@Vultraz](https://github.com/Vultraz)! - Updated apollo-server-express dependency to 2.15.1. + +- Updated dependencies [[`69d7f2e50`](https://github.com/keystonejs/keystone/commit/69d7f2e50ef2325c0d3b02b8bb5c310590796fed), [`2806a0bdf`](https://github.com/keystonejs/keystone/commit/2806a0bdfd65429e7c44ed070983f121d6934955)]: + - @keystonejs/utils@5.4.2 + - @keystonejs/session@7.0.1 + ## 5.1.8 ### Patch Changes diff --git a/packages/app-graphql/package.json b/packages/app-graphql/package.json index 5b41db398f5..0e6e557c25f 100644 --- a/packages/app-graphql/package.json +++ b/packages/app-graphql/package.json @@ -1,7 +1,7 @@ { "name": "@keystonejs/app-graphql", "description": "KeystoneJS GraphQL App.", - "version": "5.1.8", + "version": "5.1.9", "author": "The KeystoneJS Development Team", "license": "MIT", "engines": { @@ -10,10 +10,10 @@ "dependencies": { "@keystonejs/app-graphql-playground": "^5.1.4", "@keystonejs/logger": "^5.1.2", - "@keystonejs/session": "^7.0.0", - "@keystonejs/utils": "^5.4.1", + "@keystonejs/session": "^7.0.1", + "@keystonejs/utils": "^5.4.2", "apollo-errors": "^1.9.0", - "apollo-server-express": "^2.13.1", + "apollo-server-express": "^2.15.1", "cuid": "^2.1.8", "ensure-error": "^2.0.0", "graphql": "^14.6.0", diff --git a/packages/arch/docs/CHANGELOG.md b/packages/arch/docs/CHANGELOG.md index 50443a23750..dc93bb31482 100644 --- a/packages/arch/docs/CHANGELOG.md +++ b/packages/arch/docs/CHANGELOG.md @@ -1,5 +1,12 @@ # @arch-ui/docs +## 1.1.24 + +### Patch Changes + +- Updated dependencies [[`887ad8199`](https://github.com/keystonejs/keystone/commit/887ad8199aa5c32a3db8588104f4548c90aa106c)]: + - @arch-ui/pagination@0.0.23 + ## 1.1.23 ### Patch Changes diff --git a/packages/arch/docs/package.json b/packages/arch/docs/package.json index 3a263e799f6..9e2876efc19 100644 --- a/packages/arch/docs/package.json +++ b/packages/arch/docs/package.json @@ -1,6 +1,6 @@ { "name": "@arch-ui/docs", - "version": "1.1.23", + "version": "1.1.24", "private": true, "license": "MIT", "dependencies": { @@ -17,7 +17,7 @@ "@arch-ui/loading": "^0.0.17", "@arch-ui/lozenge": "^0.0.16", "@arch-ui/navbar": "^0.1.11", - "@arch-ui/pagination": "^0.0.22", + "@arch-ui/pagination": "^0.0.23", "@arch-ui/pill": "^0.1.15", "@arch-ui/popout": "^0.0.19", "@arch-ui/select": "^0.1.8", diff --git a/packages/arch/packages/pagination/CHANGELOG.md b/packages/arch/packages/pagination/CHANGELOG.md index 09870aaf7cb..860d34f79c8 100644 --- a/packages/arch/packages/pagination/CHANGELOG.md +++ b/packages/arch/packages/pagination/CHANGELOG.md @@ -1,5 +1,11 @@ # @arch-ui/pagination +## 0.0.23 + +### Patch Changes + +- [`887ad8199`](https://github.com/keystonejs/keystone/commit/887ad8199aa5c32a3db8588104f4548c90aa106c) [#3178](https://github.com/keystonejs/keystone/pull/3178) Thanks [@Vultraz](https://github.com/Vultraz)! - Redesigned Pagination display. + ## 0.0.22 ### Patch Changes diff --git a/packages/arch/packages/pagination/package.json b/packages/arch/packages/pagination/package.json index 6c0b36606e6..93c7eae89b9 100644 --- a/packages/arch/packages/pagination/package.json +++ b/packages/arch/packages/pagination/package.json @@ -1,7 +1,7 @@ { "name": "@arch-ui/pagination", "description": "Pagination UI as used in @keystonejs Admin UI.", - "version": "0.0.22", + "version": "0.0.23", "author": "Jed Watson", "license": "MIT", "main": "dist/pagination.cjs.js", diff --git a/packages/arch/packages/pagination/src/Page.js b/packages/arch/packages/pagination/src/Page.js index f796651b84e..630684a74b1 100644 --- a/packages/arch/packages/pagination/src/Page.js +++ b/packages/arch/packages/pagination/src/Page.js @@ -15,6 +15,7 @@ const Page = props => { return (