From 023bc7a0b1e6fb0ebdc5055f0243d9dad255a667 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 21 Oct 2021 23:30:17 +0000 Subject: [PATCH 1/5] Update prisma monorepo to v3.3.0 (minor) (#6804) * Update prisma monorepo to v3.3.0 * Update utils.ts * changeset Co-authored-by: Renovate Bot Co-authored-by: Thomas Walker Co-authored-by: Charles --- .changeset/popular-zoos-run.md | 7 ++ packages/keystone/package.json | 8 +- prisma-utils/package.json | 4 +- tests/api-tests/utils.ts | 2 +- yarn.lock | 167 +++++++++++++++------------------ 5 files changed, 89 insertions(+), 99 deletions(-) create mode 100644 .changeset/popular-zoos-run.md diff --git a/.changeset/popular-zoos-run.md b/.changeset/popular-zoos-run.md new file mode 100644 index 00000000000..22e00392801 --- /dev/null +++ b/.changeset/popular-zoos-run.md @@ -0,0 +1,7 @@ +--- +"@keystone-next/keystone": patch +"@keystone-next/api-tests-legacy": patch +"@keystone-next/prisma-utils": patch +--- + +Update prisma monorepo to [v3.3.0 (minor)](https://github.com/prisma/prisma/releases/tag/3.3.0) diff --git a/packages/keystone/package.json b/packages/keystone/package.json index b6a80847df4..9846f6da02a 100644 --- a/packages/keystone/package.json +++ b/packages/keystone/package.json @@ -48,9 +48,9 @@ "@keystone-ui/toast": "^4.0.4", "@keystone-ui/tooltip": "^4.0.3", "@preconstruct/next": "^3.0.0", - "@prisma/client": "3.2.1", - "@prisma/migrate": "3.2.1", - "@prisma/sdk": "3.2.1", + "@prisma/client": "3.3.0", + "@prisma/migrate": "3.3.0", + "@prisma/sdk": "3.3.0", "@sindresorhus/slugify": "^1.1.2", "@types/apollo-upload-client": "14.1.0", "@types/bcryptjs": "^2.4.2", @@ -109,7 +109,7 @@ "pirates": "^4.0.1", "pluralize": "^8.0.0", "prettier": "^2.4.1", - "prisma": "3.2.1", + "prisma": "3.3.0", "prompts": "^2.4.2", "react": "^17.0.2", "react-dom": "^17.0.2", diff --git a/prisma-utils/package.json b/prisma-utils/package.json index cedfc744327..18d51fd386b 100644 --- a/prisma-utils/package.json +++ b/prisma-utils/package.json @@ -4,8 +4,8 @@ "private": true, "main": "dist/keystone-next-prisma-utils.cjs.js", "dependencies": { - "@prisma/generator-helper": "3.2.1", - "@prisma/sdk": "3.2.1", + "@prisma/generator-helper": "3.3.0", + "@prisma/sdk": "3.3.0", "fs-extra": "^10.0.0", "prettier": "^2.4.1" }, diff --git a/tests/api-tests/utils.ts b/tests/api-tests/utils.ts index 8c42f112056..668d51173cd 100644 --- a/tests/api-tests/utils.ts +++ b/tests/api-tests/utils.ts @@ -132,7 +132,7 @@ export const expectPrismaError = ( args.map(({ path, message, code, target }) => ({ extensions: { code: 'KS_PRISMA_ERROR', - prisma: { clientVersion: '3.2.1', code, meta: { target } }, + prisma: { clientVersion: '3.3.0', code, meta: { target } }, }, path, message, diff --git a/yarn.lock b/yarn.lock index 412a0920bd2..09ea12596ae 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1998,21 +1998,12 @@ resolved "https://registry.yarnpkg.com/@preconstruct/next/-/next-3.0.0.tgz#71781cbaecd011f43e456a149817094a43e4755f" integrity sha512-G90cyJX9w4Zr3Bt/j2fURgDhsJb5+agqf4YUgrvDe3Dyvbbssy9a6d0tzLH0ehfa2Osxw/EEhQb+W4X+v/x06A== -"@prisma/client@3.2.1": - version "3.2.1" - resolved "https://registry.yarnpkg.com/@prisma/client/-/client-3.2.1.tgz#b0c60b4c42ec5b701a271380780c70de55bc3311" - integrity sha512-nakt9YoDFD4cgTkRTSVbzG40AKmmbVEtXE3csVqBdDXsm0/L4PQdtbtzILNzq28xv8HH8oHgFKWnsItM23mSDw== - dependencies: - "@prisma/engines-version" "3.2.1-1.b71d8cb16c4ddc7e3e9821f42fd09b0f82d7934c" - -"@prisma/debug@3.2.0": - version "3.2.0" - resolved "https://registry.yarnpkg.com/@prisma/debug/-/debug-3.2.0.tgz#aa7d8f2f588ac089d5e7b0f2b612056ddefc5251" - integrity sha512-QcGbt0f4qCeWYVWWk41F+bFnt6gqw8Wqr3vWZ/vAVjUI1MCFpIuzHUV4veIlriopA0kvFe0aQj5P+Ihg507Ijg== +"@prisma/client@3.3.0": + version "3.3.0" + resolved "https://registry.yarnpkg.com/@prisma/client/-/client-3.3.0.tgz#7945101206af1927d925a8d9c62bb188e9260c97" + integrity sha512-34tonDW2v74VcG1mx+k/IUGG/eSHKwDiYKfFIZgaPLq/C0h8YQxh7pro272xpOf1pt6duX1Bi90dpGijh1MYgQ== dependencies: - "@types/debug" "4.1.7" - debug "4.3.2" - ms "2.1.3" + "@prisma/engines-version" "3.3.0-30.33838b0f78f1fe9052cf9a00e9761c9dc097a63c" "@prisma/debug@3.2.1": version "3.2.1" @@ -2023,15 +2014,23 @@ debug "4.3.2" ms "2.1.3" -"@prisma/engine-core@3.2.1": - version "3.2.1" - resolved "https://registry.yarnpkg.com/@prisma/engine-core/-/engine-core-3.2.1.tgz#133d28e4925ab870ba450a44cddacbf8fb229a9c" - integrity sha512-6iQTtVFPzJgGASm7ByErxTadAH974srRFXfJ5cEzh+RVH3d/oEnxXniybkzUd7yYlUNz+5wU89vzGhBz33NWOg== +"@prisma/debug@3.3.0": + version "3.3.0" + resolved "https://registry.yarnpkg.com/@prisma/debug/-/debug-3.3.0.tgz#2a8cd7dbdc643f1f3d8efd958e6100740d3f3d23" + integrity sha512-1Xk67BScNKxqsWfMm1taR/Y71jC3FjYmVfkLkdXbxU0lUCyd4Dw8x1OCZXo4N4ceU8MhjwVCTvKj1SQniJmatQ== dependencies: - "@prisma/debug" "3.2.1" - "@prisma/engines" "3.2.1-1.b71d8cb16c4ddc7e3e9821f42fd09b0f82d7934c" - "@prisma/generator-helper" "3.2.1" - "@prisma/get-platform" "3.2.1-1.b71d8cb16c4ddc7e3e9821f42fd09b0f82d7934c" + "@types/debug" "4.1.7" + ms "2.1.3" + +"@prisma/engine-core@3.3.0": + version "3.3.0" + resolved "https://registry.yarnpkg.com/@prisma/engine-core/-/engine-core-3.3.0.tgz#de8fc8deee1d92632fcb0044bc04cb7f3bb970a1" + integrity sha512-iv0kbKG0JSdfXqLwZyV33pP7AOfDxHW0g3VPv3WcYYj5DN1XLpSjhG/gAqcxuWAXc20PAAbfM+mxQdgntvSnrQ== + dependencies: + "@prisma/debug" "3.3.0" + "@prisma/engines" "3.3.0-30.33838b0f78f1fe9052cf9a00e9761c9dc097a63c" + "@prisma/generator-helper" "3.3.0" + "@prisma/get-platform" "3.3.0-30.33838b0f78f1fe9052cf9a00e9761c9dc097a63c" chalk "4.1.2" execa "5.1.1" get-stream "6.0.1" @@ -2041,23 +2040,23 @@ terminal-link "2.1.1" undici "3.3.6" -"@prisma/engines-version@3.2.1-1.b71d8cb16c4ddc7e3e9821f42fd09b0f82d7934c": - version "3.2.1-1.b71d8cb16c4ddc7e3e9821f42fd09b0f82d7934c" - resolved "https://registry.yarnpkg.com/@prisma/engines-version/-/engines-version-3.2.1-1.b71d8cb16c4ddc7e3e9821f42fd09b0f82d7934c.tgz#63032b40ee09f56ec423eb47617c26de125ffb1e" - integrity sha512-O4dHSbqfX7yAjFMawIEzv6wefv3LRMDK4J20Y70NvE3otbE3CnChlmghkCvMsQ1CGF1QuGlrqfw20aI2JfZcaw== +"@prisma/engines-version@3.3.0-30.33838b0f78f1fe9052cf9a00e9761c9dc097a63c": + version "3.3.0-30.33838b0f78f1fe9052cf9a00e9761c9dc097a63c" + resolved "https://registry.yarnpkg.com/@prisma/engines-version/-/engines-version-3.3.0-30.33838b0f78f1fe9052cf9a00e9761c9dc097a63c.tgz#10269530152dc126c81b363c27cefc3c060013e2" + integrity sha512-g21xPYq0zHoJ/xUkNxIf5Hle0oiDyelZHU8gwq7J3RNVrccjbUZ28S99KT4yUabV8SQQRNSnR0QMLGMv9Eqs/A== -"@prisma/engines@3.2.1-1.b71d8cb16c4ddc7e3e9821f42fd09b0f82d7934c": - version "3.2.1-1.b71d8cb16c4ddc7e3e9821f42fd09b0f82d7934c" - resolved "https://registry.yarnpkg.com/@prisma/engines/-/engines-3.2.1-1.b71d8cb16c4ddc7e3e9821f42fd09b0f82d7934c.tgz#d2a41a76a89548ea411043c3198eee4a75475dbb" - integrity sha512-wnHODKLQGKkE2ZCHxHQEf/4Anq/EP0ZCvX++D5w34033mwZ94iZiOsEKZZ31fgki7MTh28F1VNF5ZSFdnRjgvQ== +"@prisma/engines@3.3.0-30.33838b0f78f1fe9052cf9a00e9761c9dc097a63c": + version "3.3.0-30.33838b0f78f1fe9052cf9a00e9761c9dc097a63c" + resolved "https://registry.yarnpkg.com/@prisma/engines/-/engines-3.3.0-30.33838b0f78f1fe9052cf9a00e9761c9dc097a63c.tgz#99026c466ffe1229c94e3392a1ae923a149be4f1" + integrity sha512-T3nEnRWmoneNZJPd9IBR29G8ZDUjNelA8+cG5y8/lh6vySm6ryWSNxj1s377U9YzFYyZmXiA9vK1iyxMoRff/g== -"@prisma/fetch-engine@3.2.1-1.b71d8cb16c4ddc7e3e9821f42fd09b0f82d7934c": - version "3.2.1-1.b71d8cb16c4ddc7e3e9821f42fd09b0f82d7934c" - resolved "https://registry.yarnpkg.com/@prisma/fetch-engine/-/fetch-engine-3.2.1-1.b71d8cb16c4ddc7e3e9821f42fd09b0f82d7934c.tgz#e0db2a8b897e754f019cfc98c0a63e350db5beca" - integrity sha512-3+GVygY7UxLcMzKrLkPzc+On6RUNUwEpPVfPAZO1kGpJ96TP4BRGyC+unjOF2x8cMIyOjEnCc6j40coF9Y/HfQ== +"@prisma/fetch-engine@3.3.0-30.33838b0f78f1fe9052cf9a00e9761c9dc097a63c": + version "3.3.0-30.33838b0f78f1fe9052cf9a00e9761c9dc097a63c" + resolved "https://registry.yarnpkg.com/@prisma/fetch-engine/-/fetch-engine-3.3.0-30.33838b0f78f1fe9052cf9a00e9761c9dc097a63c.tgz#6e6a14a1e13099bfcfa4b33833d2d490e341e8e3" + integrity sha512-RBW+VtmOzBQ/xSad5ZEnO0Nquf0v7owRhIXUNwAsbdzBEfGsLIB6QeZSLrYW25DEVug3y3DZDR2eBCxsRCaHgg== dependencies: - "@prisma/debug" "3.2.0" - "@prisma/get-platform" "3.2.1-1.b71d8cb16c4ddc7e3e9821f42fd09b0f82d7934c" + "@prisma/debug" "3.2.1" + "@prisma/get-platform" "3.3.0-30.33838b0f78f1fe9052cf9a00e9761c9dc097a63c" chalk "^4.0.0" execa "^5.0.0" find-cache-dir "^3.3.1" @@ -2074,55 +2073,53 @@ temp-dir "^2.0.0" tempy "^1.0.0" -"@prisma/generator-helper@3.2.1": - version "3.2.1" - resolved "https://registry.yarnpkg.com/@prisma/generator-helper/-/generator-helper-3.2.1.tgz#bdaafdaaf2575c3ca22f909cdb524a9a0e5a7f61" - integrity sha512-vjKOcHTkK4uJWgG8uBOst9qsTTgXDh2yUJ2uPCM0887b1epwCz+eYfe3XJXUIDXmZ0HzVVSlf045VcRT3peyJQ== +"@prisma/generator-helper@3.3.0": + version "3.3.0" + resolved "https://registry.yarnpkg.com/@prisma/generator-helper/-/generator-helper-3.3.0.tgz#a8a69aa713bccba824ad106c892d9974efee41b3" + integrity sha512-JWIlaslU43LcjbKHdchoVIRtqUV/P9UfoiDmpw2737h3MXe71gIUY0nie2JVUFtMUh8+jYiolVGcgltOtRpwjg== dependencies: - "@prisma/debug" "3.2.1" + "@prisma/debug" "3.3.0" "@types/cross-spawn" "6.0.2" chalk "4.1.2" cross-spawn "7.0.3" -"@prisma/get-platform@3.2.1-1.b71d8cb16c4ddc7e3e9821f42fd09b0f82d7934c": - version "3.2.1-1.b71d8cb16c4ddc7e3e9821f42fd09b0f82d7934c" - resolved "https://registry.yarnpkg.com/@prisma/get-platform/-/get-platform-3.2.1-1.b71d8cb16c4ddc7e3e9821f42fd09b0f82d7934c.tgz#40702b64d4787604d22e1858ddbd225cf7ea50e0" - integrity sha512-ndlrfG+rPzadkbI/h5c6Z2MQIivg/JELWG/i4TKwilDLv49Vg0gXHGF/NIvWxxxGC2bZgtmKEAaLZUgkbMruhA== +"@prisma/get-platform@3.3.0-30.33838b0f78f1fe9052cf9a00e9761c9dc097a63c": + version "3.3.0-30.33838b0f78f1fe9052cf9a00e9761c9dc097a63c" + resolved "https://registry.yarnpkg.com/@prisma/get-platform/-/get-platform-3.3.0-30.33838b0f78f1fe9052cf9a00e9761c9dc097a63c.tgz#b787555a332252948411cffee1b984e49cef4c66" + integrity sha512-Hw9KYpThSX+DLSplo3aTH9QXPnD5bQh4vxs+uGyi6G/r9+FVal36aqtcFaSdv9XMnuNZgqyOZeiwFU4dc4dYXA== dependencies: - "@prisma/debug" "3.2.0" + "@prisma/debug" "3.2.1" -"@prisma/migrate@3.2.1": - version "3.2.1" - resolved "https://registry.yarnpkg.com/@prisma/migrate/-/migrate-3.2.1.tgz#7b7cf82a47686b1014c916948d76f0b57face189" - integrity sha512-geCkeye3znvdvDHzsy/eMtw9HUzBOwgtTlBteRDvucLPuPY22hL4CaRn7cvooWUGMPFIR9Ykj0QQe7/RiaX1bg== +"@prisma/migrate@3.3.0": + version "3.3.0" + resolved "https://registry.yarnpkg.com/@prisma/migrate/-/migrate-3.3.0.tgz#8a3f2d05a028ecb1ce35bcdca3f86a5654001928" + integrity sha512-SwfL1w0na7/bmnyBnYNrQpKVZuPh67R0mSXoB7RxyAH7ns8xg6TQkVx3YHQXfGr7AR0/s5j2pv1Ayg8Hjd/AcQ== dependencies: - "@prisma/debug" "3.2.1" - "@prisma/get-platform" "3.2.1-1.b71d8cb16c4ddc7e3e9821f42fd09b0f82d7934c" + "@prisma/debug" "3.3.0" + "@prisma/get-platform" "3.3.0-30.33838b0f78f1fe9052cf9a00e9761c9dc097a63c" "@sindresorhus/slugify" "1.1.2" execa "5.1.1" - global-dirs "3.0.0" has-yarn "2.1.0" indent-string "4.0.0" log-update "4.0.0" new-github-issue-url "0.2.1" open "7.4.2" pkg-up "3.1.0" - prompts "2.4.1" - resolve-pkg "2.0.0" + prompts "2.4.2" strip-ansi "6.0.1" strip-indent "3.0.0" -"@prisma/sdk@3.2.1": - version "3.2.1" - resolved "https://registry.yarnpkg.com/@prisma/sdk/-/sdk-3.2.1.tgz#f83a84d90e334249c5268aca0755553dd6e62ffe" - integrity sha512-CBJ6yew1WAve1YRE0zf6vZ5TCAQl5+UOieWp4TehbO9g6Tnl1KLpiZCHA6K9mWo1FEVqLA7VUpM3LRvQ9EOcsQ== - dependencies: - "@prisma/debug" "3.2.1" - "@prisma/engine-core" "3.2.1" - "@prisma/engines" "3.2.1-1.b71d8cb16c4ddc7e3e9821f42fd09b0f82d7934c" - "@prisma/fetch-engine" "3.2.1-1.b71d8cb16c4ddc7e3e9821f42fd09b0f82d7934c" - "@prisma/generator-helper" "3.2.1" - "@prisma/get-platform" "3.2.1-1.b71d8cb16c4ddc7e3e9821f42fd09b0f82d7934c" +"@prisma/sdk@3.3.0": + version "3.3.0" + resolved "https://registry.yarnpkg.com/@prisma/sdk/-/sdk-3.3.0.tgz#757a70169974b0deeef359fbbdb18d5189ae57a0" + integrity sha512-GMxvDcfReYlDbAaOxH5pwlnrwU0JLzFZaNB7UkyGN3v7rQd9FA+ynoEnn60MFYNYRdFfyLdMR+wgCTBlW8J2lA== + dependencies: + "@prisma/debug" "3.3.0" + "@prisma/engine-core" "3.3.0" + "@prisma/engines" "3.3.0-30.33838b0f78f1fe9052cf9a00e9761c9dc097a63c" + "@prisma/fetch-engine" "3.3.0-30.33838b0f78f1fe9052cf9a00e9761c9dc097a63c" + "@prisma/generator-helper" "3.3.0" + "@prisma/get-platform" "3.3.0-30.33838b0f78f1fe9052cf9a00e9761c9dc097a63c" "@timsuchanek/copy" "1.4.5" archiver "4.0.2" arg "5.0.1" @@ -2130,6 +2127,7 @@ checkpoint-client "1.1.20" cli-truncate "2.1.0" dotenv "10.0.0" + escape-string-regexp "4.0.0" execa "5.1.1" find-up "5.0.0" global-dirs "3.0.0" @@ -5521,6 +5519,11 @@ escape-html@~1.0.3: resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988" integrity sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg= +escape-string-regexp@4.0.0, escape-string-regexp@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" + integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== + escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" @@ -5531,11 +5534,6 @@ escape-string-regexp@^2.0.0: resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz#a30304e99daa32e23b2fd20f51babd07cffca344" integrity sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w== -escape-string-regexp@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" - integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== - escodegen@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-2.0.0.tgz#5e32b12833e8aa8fa35e1bf0befa89380484c7dd" @@ -10025,12 +10023,12 @@ prism-react-renderer@^1.2.1: resolved "https://registry.yarnpkg.com/prism-react-renderer/-/prism-react-renderer-1.2.1.tgz#392460acf63540960e5e3caa699d851264e99b89" integrity sha512-w23ch4f75V1Tnz8DajsYKvY5lF7H1+WvzvLUcF0paFxkTHSp42RS0H5CttdN2Q8RR3DRGZ9v5xD/h3n8C8kGmg== -prisma@3.2.1: - version "3.2.1" - resolved "https://registry.yarnpkg.com/prisma/-/prisma-3.2.1.tgz#696871f6d0e374df2de96297df4c04756ee6e3b5" - integrity sha512-nXhldcFYemNSMqdTAEziggVWBNbCHTrr0amkCJruP3G2AFpzxrKtksPRLYNetxdKMJAt7aRRumusbtmTTDgyzw== +prisma@3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/prisma/-/prisma-3.3.0.tgz#9fd685111c26d078dd7eb6ffaddc584a33ec42b4" + integrity sha512-E7C9mXRwZVpcnSeJT533qGHUVrYULsE9ihFvAtQMuxhTXkxoRlMLyo/1ZOyeu9GdXP8DJ7ruLOw06kEs/N3dVg== dependencies: - "@prisma/engines" "3.2.1-1.b71d8cb16c4ddc7e3e9821f42fd09b0f82d7934c" + "@prisma/engines" "3.3.0-30.33838b0f78f1fe9052cf9a00e9761c9dc097a63c" process-nextick-args@~2.0.0: version "2.0.1" @@ -10047,15 +10045,7 @@ progress@^2.0.0, progress@^2.0.3: resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8" integrity sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA== -prompts@2.4.1: - version "2.4.1" - resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.4.1.tgz#befd3b1195ba052f9fd2fde8a486c4e82ee77f61" - integrity sha512-EQyfIuO2hPDsX1L/blblV+H7I0knhgAd82cVneCwcdND9B8AuCDuRcBH6yIcG4dFzlOUqbazQqwGjx5xmsNLuQ== - dependencies: - kleur "^3.0.3" - sisteransi "^1.0.5" - -prompts@^2.0.1, prompts@^2.4.2: +prompts@2.4.2, prompts@^2.0.1, prompts@^2.4.2: version "2.4.2" resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.4.2.tgz#7b57e73b3a48029ad10ebd44f74b01722a4cb069" integrity sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q== @@ -10813,13 +10803,6 @@ resolve-from@^5.0.0: resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-5.0.0.tgz#c35225843df8f776df21c57557bc087e9dfdfc69" integrity sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw== -resolve-pkg@2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/resolve-pkg/-/resolve-pkg-2.0.0.tgz#ac06991418a7623edc119084edc98b0e6bf05a41" - integrity sha512-+1lzwXehGCXSeryaISr6WujZzowloigEofRB+dj75y9RRa/obVcYgbHJd53tdYw8pvZj8GojXaaENws8Ktw/hQ== - dependencies: - resolve-from "^5.0.0" - resolve-url@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" From fb5b21c033fcad26745b91e2c73a2e43cc921828 Mon Sep 17 00:00:00 2001 From: Opliko Date: Mon, 25 Oct 2021 02:47:22 +0200 Subject: [PATCH 2/5] Better display for document fields in list view and card view (#6705) --- .changeset/lazy-parrots-do.md | 5 +++++ packages/fields-document/package.json | 1 + packages/fields-document/src/views.tsx | 21 ++++++++++++++++++--- 3 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 .changeset/lazy-parrots-do.md diff --git a/.changeset/lazy-parrots-do.md b/.changeset/lazy-parrots-do.md new file mode 100644 index 00000000000..8e44f94b556 --- /dev/null +++ b/.changeset/lazy-parrots-do.md @@ -0,0 +1,5 @@ +--- +'@keystone-next/fields-document': minor +--- + +Add short plain-text display to document fields for Cell (list view; resolves #6522) and a rendered document view in CardValue diff --git a/packages/fields-document/package.json b/packages/fields-document/package.json index d749dcca534..bcede9a68ef 100644 --- a/packages/fields-document/package.json +++ b/packages/fields-document/package.json @@ -25,6 +25,7 @@ "@babel/runtime": "^7.15.4", "@braintree/sanitize-url": "^5.0.2", "@emotion/weak-memoize": "^0.2.5", + "@keystone-next/document-renderer": "^4.0.1", "@keystone-ui/button": "^5.0.2", "@keystone-ui/core": "^3.2.1", "@keystone-ui/fields": "^5.0.1", diff --git a/packages/fields-document/src/views.tsx b/packages/fields-document/src/views.tsx index 4f158b4a9aa..3df4593e8f6 100644 --- a/packages/fields-document/src/views.tsx +++ b/packages/fields-document/src/views.tsx @@ -4,6 +4,7 @@ import { jsx } from '@keystone-ui/core'; import { FieldContainer, FieldLabel } from '@keystone-ui/fields'; import { Descendant, Node, Text } from 'slate'; +import { DocumentRenderer } from '@keystone-next/document-renderer'; import { CardValueComponent, @@ -13,6 +14,7 @@ import { FieldProps, } from '@keystone-next/keystone/types'; import weakMemoize from '@emotion/weak-memoize'; +import { CellContainer, CellLink } from '@keystone-next/keystone/admin-ui/components'; import { DocumentEditor } from './DocumentEditor'; import { ComponentBlock } from './component-blocks'; import { Relationships } from './DocumentEditor/relationship'; @@ -42,15 +44,28 @@ export const Field = ({ ); -export const Cell: CellComponent = () => { - return null; +const serialize = (nodes: Node[]) => { + return nodes.map((n: Node) => Node.string(n)).join('\n'); }; +export const Cell: CellComponent = ({ item, field, linkTo }) => { + const value = item[field.path]?.document; + if (!value) return null; + const plainText = serialize(value); + const cutText = plainText.length > 100 ? plainText.slice(0, 100) + '...' : plainText; + return linkTo ? ( + {cutText} + ) : ( + {cutText} + ); +}; +Cell.supportsLinkTo = true; + export const CardValue: CardValueComponent = ({ item, field }) => { return ( {field.label} -
{JSON.stringify(item[field.path], null, 2)}
+
); }; From c0661b8ee9e16a1ffdd7fc77c9c56fead0efda36 Mon Sep 17 00:00:00 2001 From: Mitchell Hamilton Date: Tue, 26 Oct 2021 08:59:29 +1000 Subject: [PATCH 3/5] Update `@graphql-ts/schema` (#6813) --- .changeset/mighty-donuts-report.md | 5 +++++ packages/keystone/package.json | 2 +- .../keystone/src/types/schema/graphql-ts-schema.ts | 12 ++++++------ yarn.lock | 8 ++++---- 4 files changed, 16 insertions(+), 11 deletions(-) create mode 100644 .changeset/mighty-donuts-report.md diff --git a/.changeset/mighty-donuts-report.md b/.changeset/mighty-donuts-report.md new file mode 100644 index 00000000000..5ce4b06d04a --- /dev/null +++ b/.changeset/mighty-donuts-report.md @@ -0,0 +1,5 @@ +--- +'@keystone-next/keystone': major +--- + +Updated `@graphql-ts/schema` to `0.5.0`. The `__rootVal` properties on `ObjectType`, `InterfaceType` and `UnionType` have been renamed to `__source`, this is intended to be internal but it could be depended on so if you did, you will need to change to `__source`. The `fields` property on `InterfaceType` has been renamed to `__fields` and it will no longer exist at runtime like the other types. diff --git a/packages/keystone/package.json b/packages/keystone/package.json index 9846f6da02a..91802367450 100644 --- a/packages/keystone/package.json +++ b/packages/keystone/package.json @@ -32,7 +32,7 @@ "@emotion/hash": "^0.8.0", "@emotion/weak-memoize": "^0.2.5", "@graphql-tools/schema": "^8.2.0", - "@graphql-ts/schema": "0.3.1", + "@graphql-ts/schema": "0.5.0", "@hapi/iron": "^6.0.0", "@keystone-ui/button": "^5.0.2", "@keystone-ui/core": "^3.2.1", diff --git a/packages/keystone/src/types/schema/graphql-ts-schema.ts b/packages/keystone/src/types/schema/graphql-ts-schema.ts index 21dbb5e2cba..58bd48c9f42 100644 --- a/packages/keystone/src/types/schema/graphql-ts-schema.ts +++ b/packages/keystone/src/types/schema/graphql-ts-schema.ts @@ -143,22 +143,22 @@ export type Type = graphqlTsSchema.Type; export type NullableOutputType = graphqlTsSchema.NullableOutputType; export type OutputType = graphqlTsSchema.OutputType; export type Field< - RootVal, + Source, Args extends Record>, TType extends OutputType, Key extends string -> = graphqlTsSchema.Field; +> = graphqlTsSchema.Field; export type FieldResolver< - RootVal, + Source, Args extends Record>, TType extends OutputType -> = graphqlTsSchema.FieldResolver; +> = graphqlTsSchema.FieldResolver; export type ObjectType = graphqlTsSchema.ObjectType; export type UnionType = graphqlTsSchema.UnionType; export type InterfaceType< - RootVal, + Source, Fields extends Record> -> = graphqlTsSchema.InterfaceType; +> = graphqlTsSchema.InterfaceType; export type InterfaceField< Args extends Record>, TType extends OutputType diff --git a/yarn.lock b/yarn.lock index 09ea12596ae..4054379d2bf 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1487,10 +1487,10 @@ dependencies: tslib "~2.3.0" -"@graphql-ts/schema@0.3.1": - version "0.3.1" - resolved "https://registry.yarnpkg.com/@graphql-ts/schema/-/schema-0.3.1.tgz#d98eefce24212c20808a43338ce014ebae1ca6d7" - integrity sha512-sPK1dXo0HEk4+DkMm9eE1MeylcDxtjK/sAKJJ4FJbYKK5F0gew7ohszVfgidVwk1nrjcT2/SWncdwM3plBX28g== +"@graphql-ts/schema@0.5.0": + version "0.5.0" + resolved "https://registry.yarnpkg.com/@graphql-ts/schema/-/schema-0.5.0.tgz#cc9cbf614ed931aff4c9987e88094a4030ad9e32" + integrity sha512-uljlEm6hRk92MG3XMXpKfSWzJ+03MXRLbsmGj5alZ/gbfS+CJkeh+hsvQOjwPD1EL5RhCE7L3E/zDWjH6W+V6g== dependencies: "@babel/runtime" "^7.9.2" From ddabdbd02230374ff921998f9d21c0ad7d32b226 Mon Sep 17 00:00:00 2001 From: Mitchell Hamilton Date: Tue, 26 Oct 2021 12:33:49 +1000 Subject: [PATCH 4/5] Fix Apollo CORS/playground issues (#6824) --- .changeset/curvy-beds-yawn.md | 5 +++++ .changeset/sour-snails-flash.md | 5 +++++ docs/pages/docs/apis/config.mdx | 5 ++++- packages/keystone/package.json | 1 + .../keystone/src/lib/server/createApolloServer.ts | 14 ++++++++++++++ .../src/lib/server/createExpressServer.ts | 6 +----- packages/keystone/src/types/config/index.ts | 15 +++++++++++---- 7 files changed, 41 insertions(+), 10 deletions(-) create mode 100644 .changeset/curvy-beds-yawn.md create mode 100644 .changeset/sour-snails-flash.md diff --git a/.changeset/curvy-beds-yawn.md b/.changeset/curvy-beds-yawn.md new file mode 100644 index 00000000000..0da46d7cd41 --- /dev/null +++ b/.changeset/curvy-beds-yawn.md @@ -0,0 +1,5 @@ +--- +'@keystone-next/keystone': major +--- + +Keystone will now default to using GraphQL Playground instead of Apollo Sandbox as it did prior to updating to Apollo Server 3. If you want to use Apollo Sandbox, you can set `graphql.playground: 'apollo'` to use Apollo. `graphql.playground` defaults to `process.env.NODE_ENV !== 'production'`, which will serve GraphQL Playground in development and serve nothing in production, if you'd like to set it to one of those always, you can set `graphql.playground` to a boolean explicitly. diff --git a/.changeset/sour-snails-flash.md b/.changeset/sour-snails-flash.md new file mode 100644 index 00000000000..603af5bb8c2 --- /dev/null +++ b/.changeset/sour-snails-flash.md @@ -0,0 +1,5 @@ +--- +'@keystone-next/keystone': major +--- + +Removed `graphql.cors` option. You should exclusively configure `cors` with the `server.cors` option. diff --git a/docs/pages/docs/apis/config.mdx b/docs/pages/docs/apis/config.mdx index dd36cf5ecfb..4a09d2c75e0 100644 --- a/docs/pages/docs/apis/config.mdx +++ b/docs/pages/docs/apis/config.mdx @@ -345,7 +345,10 @@ Options: - `queryLimits` (default: `undefined`): Allows you to limit the total number of results returned from a query to your GraphQL API. See also the per-list `graphql.queryLimits` option in the [Schema API](./schema). - `path` (default: `'/api/graphql'`): The path of the GraphQL API endpoint. -- `cors` (default: `rocess.env.NODE_ENV !== 'production' ? { origin: 'https://studio.apollographql.com', credentials: true } : undefined`): The CORS configuration to use on the GraphQL API endpoint. The default is setup to allow access access to API from the Apollo Sandbox during development +- `playground` (default: `process.env.NODE_ENV !== 'production'`) + - `true` - Add `ApolloServerPluginLandingPageGraphQLPlayground` to the Apollo Server plugins + - `false` - Add `ApolloServerPluginLandingPageDisabled` to the Apollo Server plugins + - `'apollo'` - Do not add any plugins to the Apollo config, this will use [Apollo Sandbox](https://www.apollographql.com/docs/apollo-server/testing/build-run-queries/#apollo-sandbox) - `apolloConfig` (default: `undefined`): Allows you to pass [extra options](https://www.apollographql.com/docs/apollo-server/api/apollo-server/#constructor) into the `ApolloServer` constructor. ```typescript diff --git a/packages/keystone/package.json b/packages/keystone/package.json index 91802367450..f7cdd0c29da 100644 --- a/packages/keystone/package.json +++ b/packages/keystone/package.json @@ -69,6 +69,7 @@ "@types/supertest": "^2.0.11", "@types/uid-safe": "^2.1.2", "@types/uuid": "^8.3.1", + "apollo-server-core": "^3.4.0", "apollo-server-errors": "^3.2.0", "apollo-server-express": "^3.4.0", "apollo-server-micro": "^3.4.0", diff --git a/packages/keystone/src/lib/server/createApolloServer.ts b/packages/keystone/src/lib/server/createApolloServer.ts index c4852c42cff..ad8fc735e73 100644 --- a/packages/keystone/src/lib/server/createApolloServer.ts +++ b/packages/keystone/src/lib/server/createApolloServer.ts @@ -2,6 +2,10 @@ import type { IncomingMessage, ServerResponse } from 'http'; import { GraphQLError, GraphQLSchema } from 'graphql'; import { ApolloServer as ApolloServerMicro } from 'apollo-server-micro'; import { ApolloServer as ApolloServerExpress } from 'apollo-server-express'; +import { + ApolloServerPluginLandingPageDisabled, + ApolloServerPluginLandingPageGraphQLPlayground, +} from 'apollo-server-core'; import type { CreateContext, GraphQLConfig, SessionStrategy } from '../../types'; import { createSessionContext } from '../../session'; @@ -61,11 +65,21 @@ const _createApolloServerConfig = ({ graphqlConfig?: GraphQLConfig; }) => { const apolloConfig = graphqlConfig?.apolloConfig; + const playgroundOption = graphqlConfig?.playground ?? process.env.NODE_ENV !== 'production'; return { schema: graphQLSchema, debug: graphqlConfig?.debug, // If undefined, use Apollo default of NODE_ENV !== 'production' ...apolloConfig, + plugins: + playgroundOption === 'apollo' + ? apolloConfig?.plugins + : [ + playgroundOption + ? ApolloServerPluginLandingPageGraphQLPlayground() + : ApolloServerPluginLandingPageDisabled(), + ...(apolloConfig?.plugins || []), + ], formatError: formatError(graphqlConfig), }; }; diff --git a/packages/keystone/src/lib/server/createExpressServer.ts b/packages/keystone/src/lib/server/createExpressServer.ts index 4ee752e613d..f7f5c9574ef 100644 --- a/packages/keystone/src/lib/server/createExpressServer.ts +++ b/packages/keystone/src/lib/server/createExpressServer.ts @@ -46,11 +46,7 @@ const addApolloServer = async ({ apolloServer.applyMiddleware({ app: server, path: config.graphql?.path || '/api/graphql', - cors: - config.graphql?.cors || - (process.env.NODE_ENV !== 'production' - ? { origin: 'https://studio.apollographql.com', credentials: true } - : undefined), + cors: false, }); }; diff --git a/packages/keystone/src/types/config/index.ts b/packages/keystone/src/types/config/index.ts index 41f03f12d5b..e63205fe2e8 100644 --- a/packages/keystone/src/types/config/index.ts +++ b/packages/keystone/src/types/config/index.ts @@ -119,12 +119,19 @@ export type GraphQLConfig = { queryLimits?: { maxTotalResults?: number; }; + /** + * - `true` - Add `ApolloServerPluginLandingPageGraphQLPlayground` to the Apollo Server plugins + * - `false` - Add `ApolloServerPluginLandingPageDisabled` to the Apollo Server plugins + * - `'apollo'` - Do not add any plugins to the Apollo config, this will use [Apollo Sandbox](https://www.apollographql.com/docs/apollo-server/testing/build-run-queries/#apollo-sandbox) + * @default process.env.NODE_ENV !== 'production' + */ + playground?: boolean | 'apollo'; /** * Additional options to pass into the ApolloServer constructor. * @see https://www.apollographql.com/docs/apollo-server/api/apollo-server/#constructor */ apolloConfig?: Config; - /* + /** * When an error is returned from the GraphQL API, Apollo can include a stacktrace * indicating where the error occurred. When Keystone is processing mutations, it * will sometimes captures more than one error at a time, and then group these into @@ -140,7 +147,7 @@ export type GraphQLConfig = { * `apolloConfig.formatError` to log the stacktraces and then strip them out before * returning the error. * - * ``` + * ```ts * graphql: { * debug: true, * apolloConfig: { @@ -154,8 +161,8 @@ export type GraphQLConfig = { * }, * } * ``` - * * - * Default: process.env.NODE_ENV !== 'production' + * + * @default process.env.NODE_ENV !== 'production' */ debug?: boolean; }; From c723eb851b353fe0a34ac7d8065d19ddb09e9771 Mon Sep 17 00:00:00 2001 From: Mitchell Hamilton Date: Wed, 27 Oct 2021 08:34:31 +1000 Subject: [PATCH 5/5] Set credentials: same-origin in GraphQL playground (#6826) --- packages/keystone/src/lib/server/createApolloServer.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/keystone/src/lib/server/createApolloServer.ts b/packages/keystone/src/lib/server/createApolloServer.ts index ad8fc735e73..37676b378fc 100644 --- a/packages/keystone/src/lib/server/createApolloServer.ts +++ b/packages/keystone/src/lib/server/createApolloServer.ts @@ -76,7 +76,9 @@ const _createApolloServerConfig = ({ ? apolloConfig?.plugins : [ playgroundOption - ? ApolloServerPluginLandingPageGraphQLPlayground() + ? ApolloServerPluginLandingPageGraphQLPlayground({ + settings: { 'request.credentials': 'same-origin' }, + }) : ApolloServerPluginLandingPageDisabled(), ...(apolloConfig?.plugins || []), ],