From a8361f134a8fa6f6270cc79edd89a3e7b5eeafbb Mon Sep 17 00:00:00 2001 From: Roman Date: Wed, 25 Feb 2026 10:38:49 +0000 Subject: [PATCH 1/2] chore: remove unused dependencies (#29230) Removes unused dependencies ## Summary by CodeRabbit * **Chores** * Removed unused development dependencies to streamline the build process. --- packages/internals/package.json | 2 - pnpm-lock.yaml | 158 ++------------------------------ 2 files changed, 10 insertions(+), 150 deletions(-) diff --git a/packages/internals/package.json b/packages/internals/package.json index c7d7ba8a5a00..15bd53fe12dc 100644 --- a/packages/internals/package.json +++ b/packages/internals/package.json @@ -34,13 +34,11 @@ "@types/jest": "29.5.14", "@types/node": "~20.19.24", "@types/resolve": "1.20.6", - "archiver": "6.0.2", "checkpoint-client": "1.1.33", "cli-truncate": "4.0.0", "empathic": "2.0.0", "escape-string-regexp": "5.0.0", "execa": "8.0.1", - "fast-glob": "3.3.3", "find-up": "7.0.0", "fp-ts": "2.16.9", "fs-extra": "11.3.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ec0b86cc4302..e511639f2f1c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1593,9 +1593,6 @@ importers: '@types/resolve': specifier: 1.20.6 version: 1.20.6 - archiver: - specifier: 6.0.2 - version: 6.0.2 checkpoint-client: specifier: 1.1.33 version: 1.1.33(encoding@0.1.13) @@ -1611,9 +1608,6 @@ importers: execa: specifier: 8.0.1 version: 8.0.1 - fast-glob: - specifier: 3.3.3 - version: 3.3.3 find-up: specifier: 7.0.0 version: 7.0.0 @@ -1930,7 +1924,7 @@ importers: dependencies: '@ark/attest': specifier: 0.48.2 - version: 0.48.2(typescript@5.8.2) + version: 0.48.2(typescript@5.4.5) '@prisma/client': specifier: workspace:* version: link:../client @@ -4456,14 +4450,6 @@ packages: aproba@2.0.0: resolution: {integrity: sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ==} - archiver-utils@4.0.1: - resolution: {integrity: sha512-Q4Q99idbvzmgCTEAAhi32BkOyq8iVI5EwdO0PmBDSGIzzjYNdcFn7Q7k3OzbLy4kLUPXfJtG6fO2RjftXbobBg==} - engines: {node: '>= 12.0.0'} - - archiver@6.0.2: - resolution: {integrity: sha512-UQ/2nW7NMl1G+1UnrLypQw1VdT9XZg/ECcKPq7l+STzStrSivFIXIp34D8M5zeNGW5NoOupdYCHv6VySCPNNlw==} - engines: {node: '>= 12.0.0'} - are-we-there-yet@3.0.1: resolution: {integrity: sha512-QZW4EDmGwlYur0Yyf/b2uGucHQMa8aFUP7eu9ddR73vvhFyt4V0Vl3QHPcTNJ8l6qYOBdxgXdnBXQrHilfRQBg==} engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0} @@ -4513,9 +4499,6 @@ packages: async-mutex@0.5.0: resolution: {integrity: sha512-1A94B18jkJ3DYq284ohPxoXbfTA5HsQ7/Mf4DEhcyLx3Bz27Rh59iScbB6EPiP+B+joue6YCxcMXSbFC1tZKwA==} - async@3.2.4: - resolution: {integrity: sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ==} - asynckit@0.4.0: resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==} @@ -4660,9 +4643,6 @@ packages: resolution: {integrity: sha512-MTxGsqgYTwfshYWTRdmZRC+M7FnG1b4y7RO7p2k3X24Wq0yv1m77Wsj0BzlPzd/IowgESfsruQCUToa7vbOpPQ==} engines: {node: '>=16.20.1'} - buffer-crc32@0.2.13: - resolution: {integrity: sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==} - buffer-equal-constant-time@1.0.1: resolution: {integrity: sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==} @@ -4871,10 +4851,6 @@ packages: common-path-prefix@3.0.0: resolution: {integrity: sha512-QE33hToZseCH3jS0qN96O/bSh3kaw/h+Tq7ngyY9eWDUnTlTNUyqfqvCXioLe5Na5jFsL78ra/wuBU4iuEgd4w==} - compress-commons@5.0.1: - resolution: {integrity: sha512-MPh//1cERdLtqwO3pOFLeXtpuai0Y2WCd5AhtKxznqM7WtaMYaOEMSgn45d9D10sIHSfIKE603HlOp8OPGrvag==} - engines: {node: '>= 12.0.0'} - concat-map@0.0.1: resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} @@ -4920,22 +4896,10 @@ packages: core-util-is@1.0.2: resolution: {integrity: sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==} - core-util-is@1.0.3: - resolution: {integrity: sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==} - cors@2.8.5: resolution: {integrity: sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==} engines: {node: '>= 0.10'} - crc-32@1.2.2: - resolution: {integrity: sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==} - engines: {node: '>=0.8'} - hasBin: true - - crc32-stream@5.0.0: - resolution: {integrity: sha512-B0EPa1UK+qnpBZpG+7FgPCu0J2ETLpXq09o9BkLkEAhdB6Z61Qo4pJ3JYu0c+Qi+/SAL7QThqnzS06pmSSyZaw==} - engines: {node: '>= 12.0.0'} - create-jest@29.7.0: resolution: {integrity: sha512-Adz2bdH0Vq3F53KEMJOoftQFutWCukm6J24wbPWRO4k1kMY7gS7ds/uoJkNuV8wDCtWWnuwGcJwpWcih+zEW1Q==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} @@ -5697,16 +5661,17 @@ packages: glob@10.4.5: resolution: {integrity: sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==} + deprecated: Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me hasBin: true glob@7.2.3: resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==} - deprecated: Glob versions prior to v9 are no longer supported + deprecated: Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me glob@8.1.0: resolution: {integrity: sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==} engines: {node: '>=12'} - deprecated: Glob versions prior to v9 are no longer supported + deprecated: Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me global-directory@4.0.0: resolution: {integrity: sha512-3vKugswCmRx+wqK8azY+6yFXfi3DzPLyMtzUmVbBp6CqV+7v6vcOwUJGt50fmc9orIyCh29g2ypcXWfbCMZVWw==} @@ -6058,9 +6023,6 @@ packages: resolution: {integrity: sha512-UcVfVfaK4Sc4m7X3dUSoHoozQGBEFeDC+zVo06t98xe8CzHSZZBekNXH+tu0NalHolcJ/QAGqS46Hef7QXBIMw==} engines: {node: '>=16'} - isarray@1.0.0: - resolution: {integrity: sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==} - isexe@2.0.0: resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} @@ -6362,10 +6324,6 @@ packages: resolution: {integrity: sha512-HzhziW6sc5m0pwi5M196+7cEBtbt0lCYi67wNsiwMUmz833wloE0gbzJPWKs1gliFKQb34huItDQX97LyOdPdA==} engines: {node: '>=18'} - lazystream@1.0.1: - resolution: {integrity: sha512-b94GiNHQNy6JNTrt5w6zNyffMrNkXZb3KTkCZJb2V1xaEGCk093vkZ2jk3tpaeP33/OiXC+WvK9AxUebnf5nbw==} - engines: {node: '>= 0.6.3'} - leven@3.1.0: resolution: {integrity: sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==} engines: {node: '>=6'} @@ -7249,6 +7207,7 @@ packages: prebuild-install@7.1.3: resolution: {integrity: sha512-8Mf2cbV7x1cXPUILADGI3wuhfqWvtiLA1iclTDbFRZkgRQS0NqsPZphna9V+HyTEadheuPmjaJMsbzKQFOzLug==} engines: {node: '>=10'} + deprecated: No longer maintained. Please contact the author of the relevant native addon; alternatives are available. hasBin: true prelude-ls@1.2.1: @@ -7288,9 +7247,6 @@ packages: printable-characters@1.0.42: resolution: {integrity: sha512-dKp+C4iXWK4vVYZmYSd0KBH5F/h1HoZRsbJ82AVKRO3PEo8L4lBS/vLwhVtpwwuYcoIsVY+1JYKR268yn480uQ==} - process-nextick-args@2.0.1: - resolution: {integrity: sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==} - process@0.11.10: resolution: {integrity: sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==} engines: {node: '>= 0.6.0'} @@ -7387,13 +7343,6 @@ packages: resolution: {integrity: sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg==} engines: {node: '>=8'} - readable-stream@2.3.7: - resolution: {integrity: sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==} - - readable-stream@3.6.0: - resolution: {integrity: sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==} - engines: {node: '>= 6'} - readable-stream@3.6.2: resolution: {integrity: sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==} engines: {node: '>= 6'} @@ -7402,9 +7351,6 @@ packages: resolution: {integrity: sha512-Lk/fICSyIhodxy1IDK2HazkeGjSmezAWX2egdtJnYhtzKEsBPJowlI6F6LPb5tqIQILrMbx22S5o3GuJavPusA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - readdir-glob@1.1.2: - resolution: {integrity: sha512-6RLVvwJtVwEDfPdn6X6Ille4/lxGl0ATOY4FN/B9nxQcgOazvvI0nodiD19ScKq0PvA/29VpaOQML36o5IzZWA==} - readdirp@4.1.2: resolution: {integrity: sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==} engines: {node: '>= 14.18.0'} @@ -7794,9 +7740,6 @@ packages: resolution: {integrity: sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==} engines: {node: '>=18'} - string_decoder@1.1.1: - resolution: {integrity: sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==} - string_decoder@1.3.0: resolution: {integrity: sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==} @@ -8590,10 +8533,6 @@ packages: zeptomatch@2.1.0: resolution: {integrity: sha512-KiGErG2J0G82LSpniV0CtIzjlJ10E04j02VOudJsPyPwNZgGnRKQy7I1R7GMyg/QswnE4l7ohSGrQbQbjXPPDA==} - zip-stream@5.0.1: - resolution: {integrity: sha512-UfZ0oa0C8LI58wJ+moL46BDIMgCQbnsb+2PoiJYtonhBsMh2bq1eRBVkvjfVsqbEHd9/EgKPUuL9saSSsec8OA==} - engines: {node: '>= 12.0.0'} - zod-to-json-schema@3.24.5: resolution: {integrity: sha512-/AuWwMP+YqiPbsJx5D6TfgRTc4kTLjsh5SOcd4bLsfUg2RcEXrFMJl1DGgdHy2aCfsIA/cr/1JM0xcB2GZji8g==} peerDependencies: @@ -8627,16 +8566,16 @@ snapshots: '@antfu/ni@0.21.12': {} - '@ark/attest@0.48.2(typescript@5.8.2)': + '@ark/attest@0.48.2(typescript@5.4.5)': dependencies: '@ark/fs': 0.46.0 '@ark/util': 0.46.0 '@prettier/sync': 0.5.5(prettier@3.5.3) '@typescript/analyze-trace': 0.10.1 - '@typescript/vfs': 1.6.1(typescript@5.8.2) + '@typescript/vfs': 1.6.1(typescript@5.4.5) arktype: 2.1.20 prettier: 3.5.3 - typescript: 5.8.2 + typescript: 5.4.5 transitivePeerDependencies: - supports-color @@ -10906,10 +10845,10 @@ snapshots: treeify: 1.1.0 yargs: 16.2.0 - '@typescript/vfs@1.6.1(typescript@5.8.2)': + '@typescript/vfs@1.6.1(typescript@5.4.5)': dependencies: debug: 4.4.1 - typescript: 5.8.2 + typescript: 5.4.5 transitivePeerDependencies: - supports-color @@ -11189,25 +11128,6 @@ snapshots: aproba@2.0.0: optional: true - archiver-utils@4.0.1: - dependencies: - glob: 8.1.0 - graceful-fs: 4.2.11 - lazystream: 1.0.1 - lodash: 4.17.23 - normalize-path: 3.0.0 - readable-stream: 3.6.2 - - archiver@6.0.2: - dependencies: - archiver-utils: 4.0.1 - async: 3.2.4 - buffer-crc32: 0.2.13 - readable-stream: 3.6.0 - readdir-glob: 1.1.2 - tar-stream: 3.1.6 - zip-stream: 5.0.1 - are-we-there-yet@3.0.1: dependencies: delegates: 1.0.0 @@ -11253,8 +11173,6 @@ snapshots: dependencies: tslib: 2.8.1 - async@3.2.4: {} - asynckit@0.4.0: {} aws-ssl-profiles@1.1.2: {} @@ -11458,8 +11376,6 @@ snapshots: bson@6.10.3: {} - buffer-crc32@0.2.13: {} - buffer-equal-constant-time@1.0.1: {} buffer-from@1.1.2: {} @@ -11681,13 +11597,6 @@ snapshots: common-path-prefix@3.0.0: {} - compress-commons@5.0.1: - dependencies: - crc-32: 1.2.2 - crc32-stream: 5.0.0 - normalize-path: 3.0.0 - readable-stream: 3.6.2 - concat-map@0.0.1: {} confbox@0.2.2: {} @@ -11717,20 +11626,11 @@ snapshots: core-util-is@1.0.2: {} - core-util-is@1.0.3: {} - cors@2.8.5: dependencies: object-assign: 4.1.1 vary: 1.1.2 - crc-32@1.2.2: {} - - crc32-stream@5.0.0: - dependencies: - crc-32: 1.2.2 - readable-stream: 3.6.2 - create-jest@29.7.0(@types/node@20.19.25)(ts-node@10.9.2(@swc/core@1.11.5)(@types/node@20.19.25)(typescript@5.4.5)): dependencies: '@jest/types': 29.6.3 @@ -12883,8 +12783,6 @@ snapshots: dependencies: is-inside-container: 1.0.0 - isarray@1.0.0: {} - isexe@2.0.0: {} istanbul-lib-coverage@3.2.0: {} @@ -13371,10 +13269,6 @@ snapshots: ky@1.7.5: {} - lazystream@1.0.1: - dependencies: - readable-stream: 2.3.7 - leven@3.1.0: {} levn@0.4.1: @@ -14340,8 +14234,6 @@ snapshots: printable-characters@1.0.42: {} - process-nextick-args@2.0.1: {} - process@0.11.10: {} progress@2.0.3: {} @@ -14438,22 +14330,6 @@ snapshots: parse-json: 5.2.0 type-fest: 0.6.0 - readable-stream@2.3.7: - dependencies: - core-util-is: 1.0.3 - inherits: 2.0.4 - isarray: 1.0.0 - process-nextick-args: 2.0.1 - safe-buffer: 5.1.2 - string_decoder: 1.1.1 - util-deprecate: 1.0.2 - - readable-stream@3.6.0: - dependencies: - inherits: 2.0.4 - string_decoder: 1.3.0 - util-deprecate: 1.0.2 - readable-stream@3.6.2: dependencies: inherits: 2.0.4 @@ -14468,10 +14344,6 @@ snapshots: process: 0.11.10 string_decoder: 1.3.0 - readdir-glob@1.1.2: - dependencies: - minimatch: 5.1.6 - readdirp@4.1.2: {} redent@3.0.0: @@ -14928,10 +14800,6 @@ snapshots: get-east-asian-width: 1.3.0 strip-ansi: 7.1.0 - string_decoder@1.1.1: - dependencies: - safe-buffer: 5.1.2 - string_decoder@1.3.0: dependencies: safe-buffer: 5.2.1 @@ -15806,12 +15674,6 @@ snapshots: grammex: 3.1.11 graphmatch: 1.1.0 - zip-stream@5.0.1: - dependencies: - archiver-utils: 4.0.1 - compress-commons: 5.0.1 - readable-stream: 3.6.2 - zod-to-json-schema@3.24.5(zod@3.24.2): dependencies: zod: 3.24.2 From 28d098133c87d3328e754a9e61022658bc209c42 Mon Sep 17 00:00:00 2001 From: Dmitry Prudnikov Date: Wed, 25 Feb 2026 12:40:16 +0200 Subject: [PATCH 2/2] test(client): preserve BigInt precision in relationJoins queries (#29009) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary This PR adds a regression test for a critical bug where BigInt values lose precision when using driver adapters (like `@prisma/adapter-pg`) with the `relationJoins` preview feature enabled. Fixes #29010 ### The Problem When `previewFeatures = ["relationJoins"]` is enabled, Prisma uses lateral joins to fetch related data. The related records are returned as JSON-aggregated columns. When parsing this JSON data, standard `JSON.parse()` converts large integers (exceeding `Number.MAX_SAFE_INTEGER`) to JavaScript Numbers, silently corrupting the values. **Example corruption:** - Original value: `312590077454712834` - After JSON.parse: `312590077454712800` (precision lost!) ### The Fix The fix is implemented at the SQL level in `prisma-engines`: - Postgres: cast BigInt to text in `JSONB_BUILD_OBJECT` (prisma/prisma-engines#5745) - MySQL + CockroachDB: cast BigInt/INT8 values to string in JSON builders (prisma/prisma-engines#5752) BigInt columns are cast to string before JSON aggregation, so values arrive as strings and are correctly parsed without precision loss. **Changes in this PR:** - Added regression test in `packages/client/tests/functional/issues/29010-bigint-precision-relation-joins/` - Minor type safety improvement (explicit `as Value` cast) in `data-mapper.ts` ## Reproduction
Schema ```prisma generator client { provider = "prisma-client-js" previewFeatures = ["driverAdapters", "relationJoins"] } datasource db { provider = "postgresql" url = env("DATABASE_URL") } model User { id BigInt @id @default(autoincrement()) files UserFile[] } model UserFile { id String @id @default(uuid()) userId BigInt user User @relation(fields: [userId], references: [id]) } ```
Test Code ```typescript // Create test data const user = await prisma.user.create({ data: {} }) const file = await prisma.userFile.create({ data: { userId: user.id } }) // Fetch with include (triggers relationJoins) const result = await prisma.userFile.findUnique({ where: { id: file.id }, include: { user: true } }) // Before fix: result.userId !== result.user.id (BigInt corrupted in nested relation) // After fix: result.userId === result.user.id (correct) ```
## Test Plan - [x] Regression test added for BigInt precision in relationJoins queries - [x] Test covers PostgreSQL, CockroachDB, and MySQL (requires updated Wasm artifacts from prisma-engines#5752) - [x] Tests nested relationJoins queries ## Breaking Changes None. This is a bugfix that preserves intended behavior. ## Summary by CodeRabbit ## Release Notes * **Bug Fixes** * Improved JSON data parsing and type handling in data mapping operations. * **Tests** * Added comprehensive test coverage for BigInt precision with relationJoins across PostgreSQL, CockroachDB, and MySQL database providers. ✏️ Tip: You can customize this high-level summary in your review settings. --------- Co-authored-by: Oleksii Orlenko --- .../_matrix.ts | 6 ++ .../prisma/_schema.ts | 27 +++++++ .../tests.ts | 70 +++++++++++++++++++ 3 files changed, 103 insertions(+) create mode 100644 packages/client/tests/functional/issues/29010-bigint-precision-relation-joins/_matrix.ts create mode 100644 packages/client/tests/functional/issues/29010-bigint-precision-relation-joins/prisma/_schema.ts create mode 100644 packages/client/tests/functional/issues/29010-bigint-precision-relation-joins/tests.ts diff --git a/packages/client/tests/functional/issues/29010-bigint-precision-relation-joins/_matrix.ts b/packages/client/tests/functional/issues/29010-bigint-precision-relation-joins/_matrix.ts new file mode 100644 index 000000000000..47282f12799e --- /dev/null +++ b/packages/client/tests/functional/issues/29010-bigint-precision-relation-joins/_matrix.ts @@ -0,0 +1,6 @@ +import { defineMatrix } from '../../_utils/defineMatrix' +import { Providers } from '../../_utils/providers' + +export default defineMatrix(() => [ + [{ provider: Providers.POSTGRESQL }, { provider: Providers.COCKROACHDB }, { provider: Providers.MYSQL }], +]) diff --git a/packages/client/tests/functional/issues/29010-bigint-precision-relation-joins/prisma/_schema.ts b/packages/client/tests/functional/issues/29010-bigint-precision-relation-joins/prisma/_schema.ts new file mode 100644 index 000000000000..fcb5863472d3 --- /dev/null +++ b/packages/client/tests/functional/issues/29010-bigint-precision-relation-joins/prisma/_schema.ts @@ -0,0 +1,27 @@ +import testMatrix from '../_matrix' + +export default testMatrix.setupSchema(({ provider }) => { + return /* Prisma */ ` + generator client { + provider = "prisma-client-js" + previewFeatures = ["relationJoins"] + } + + datasource db { + provider = "${provider}" + } + + model User { + id BigInt @id + name String + posts Post[] + } + + model Post { + id BigInt @id + title String + authorId BigInt + author User @relation(fields: [authorId], references: [id]) + } + ` +}) diff --git a/packages/client/tests/functional/issues/29010-bigint-precision-relation-joins/tests.ts b/packages/client/tests/functional/issues/29010-bigint-precision-relation-joins/tests.ts new file mode 100644 index 000000000000..7910208073c2 --- /dev/null +++ b/packages/client/tests/functional/issues/29010-bigint-precision-relation-joins/tests.ts @@ -0,0 +1,70 @@ +import testMatrix from './_matrix' +// @ts-ignore +import type { PrismaClient } from './generated/prisma/client' + +declare let prisma: PrismaClient + +// BigInt IDs that exceed Number.MAX_SAFE_INTEGER (2^53 - 1 = 9007199254740991) +const USER_ID = BigInt('312590077454712834') +const POST_ID = BigInt('412590077454712834') + +testMatrix.setupTestSuite( + () => { + beforeAll(async () => { + await prisma.post.deleteMany() + await prisma.user.deleteMany() + + await prisma.user.create({ + data: { + id: USER_ID, + name: 'Alice', + posts: { + create: { + id: POST_ID, + title: 'Hello World', + }, + }, + }, + }) + }) + + test('preserves BigInt precision in relationJoins queries', async () => { + const user = await prisma.user.findUnique({ + where: { id: USER_ID }, + relationLoadStrategy: 'join', + include: { posts: true }, + }) + + expect(user).not.toBeNull() + expect(user!.id).toBe(USER_ID) + expect(user!.posts).toHaveLength(1) + expect(user!.posts[0].id).toBe(POST_ID) + expect(user!.posts[0].authorId).toBe(USER_ID) + }) + + test('preserves BigInt precision in nested relationJoins queries', async () => { + const post = await prisma.post.findUnique({ + where: { id: POST_ID }, + relationLoadStrategy: 'join', + include: { + author: { + include: { posts: true }, + }, + }, + }) + + expect(post).not.toBeNull() + expect(post!.id).toBe(POST_ID) + expect(post!.authorId).toBe(USER_ID) + expect(post!.author.id).toBe(USER_ID) + expect(post!.author.posts).toHaveLength(1) + expect(post!.author.posts[0].id).toBe(POST_ID) + }) + }, + { + optOut: { + from: ['mongodb', 'sqlite', 'sqlserver'], + reason: 'relationJoins not supported', + }, + }, +)