diff --git a/.github/renovate.json b/.github/renovate.json index 9c447b098bf1..160a3f05775d 100644 --- a/.github/renovate.json +++ b/.github/renovate.json @@ -218,11 +218,6 @@ "matchFileNames": ["packages/client/tests/e2e/ts-version/**"], "schedule": ["before 7am on Wednesday"] }, - { - "groupName": "Weekly vitess docker image version update", - "matchPackageNames": ["vitess/vttestserver"], - "schedule": ["before 7am on Wednesday"] - }, { "groupName": "Extension: Accelerate", "automerge": true, @@ -260,6 +255,17 @@ "@types/pg" ], "schedule": ["before 7am on Wednesday"] + }, + { + "groupName": "Vitess Docker image", + "matchDatasources": ["docker"], + "matchPackageNames": ["vitess/vttestserver"], + "schedule": ["before 7am on Wednesday"] + }, + { + "groupName": "MySQL Docker image", + "matchDatasources": ["docker"], + "matchPackageNames": ["mysql"] } ] } diff --git a/.github/workflows/lint-workflow-files.yml b/.github/workflows/lint-workflow-files.yml index e4bd6f5ec949..641af0f4b347 100644 --- a/.github/workflows/lint-workflow-files.yml +++ b/.github/workflows/lint-workflow-files.yml @@ -13,4 +13,4 @@ jobs: # see https://github.com/rhysd/actionlint/blob/main/docs/usage.md - name: Check workflow files # https://hub.docker.com/r/rhysd/actionlint/tags - uses: docker://rhysd/actionlint:1.7.0 + uses: docker://rhysd/actionlint:1.7.1 diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index bc5916260008..3462c0d319a2 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -73,7 +73,7 @@ services: # Planetscale # From https://github.com/prisma/prisma-engines/blob/976a00ae3c30ab9507fa742986c9c6f5327ba10f/docker-compose.yml vitess-8: - image: vitess/vttestserver:mysql80@sha256:80d7a5af966f45d8579408f35ba31a434d99b6a56fab3597c5707e26c476b2eb + image: vitess/vttestserver:mysql80@sha256:61c67c927f22be141b41846a0c4101d5b61729c722777ec306a22bada0575999 restart: unless-stopped ports: - 33807:33807 diff --git a/package.json b/package.json index 2aba1ba1ef35..c25e5f02b787 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "bundle-size": "pnpm i && pnpm -r dev && pnpm -r --parallel exec pnpm pack && cd packages/bundle-size && pnpm run create-gzip-files" }, "devDependencies": { - "@microsoft/api-extractor": "7.43.2", + "@microsoft/api-extractor": "7.46.2", "@prisma/engines": "workspace:*", "@sindresorhus/slugify": "1.1.2", "@size-limit/file": "9.0.0", @@ -42,16 +42,16 @@ "@types/node": "20.12.7", "@types/redis": "2.8.32", "@types/resolve": "1.20.6", - "@typescript-eslint/eslint-plugin": "7.9.0", - "@typescript-eslint/parser": "7.9.0", - "@typescript-eslint/utils": "7.9.0", + "@typescript-eslint/eslint-plugin": "7.11.0", + "@typescript-eslint/parser": "7.11.0", + "@typescript-eslint/utils": "7.11.0", "arg": "5.0.2", "batching-toposort": "1.2.0", "buffer": "6.0.3", "chokidar": "3.6.0", "decimal.js-light": "2.5.1", "dotenv-cli": "7.4.2", - "esbuild": "0.21.2", + "esbuild": "0.21.4", "esbuild-register": "3.5.0", "eslint": "8.57.0", "eslint-config-prettier": "9.1.0", @@ -70,7 +70,7 @@ "is-ci": "3.0.1", "jest-junit": "16.0.0", "kleur": "4.1.5", - "lint-staged": "15.2.2", + "lint-staged": "15.2.5", "p-map": "4.0.0", "p-reduce": "2.1.0", "p-retry": "4.6.2", @@ -80,14 +80,14 @@ "regenerator-runtime": "0.14.1", "resolve": "1.22.8", "safe-buffer": "5.2.1", - "semver": "7.6.1", + "semver": "7.6.2", "size-limit": "9.0.0", "spdx-exceptions": "2.5.0", - "spdx-license-ids": "3.0.17", + "spdx-license-ids": "3.0.18", "staged-git-files": "1.3.0", "ts-node": "10.9.2", "ts-toolbelt": "9.6.0", - "tsx": "4.10.1", + "tsx": "4.11.0", "typescript": "5.4.5", "zx": "7.2.3" }, diff --git a/packages/adapter-d1/package.json b/packages/adapter-d1/package.json index b70f8406b7d9..0179593987e8 100644 --- a/packages/adapter-d1/package.json +++ b/packages/adapter-d1/package.json @@ -39,7 +39,7 @@ "sideEffects": false, "dependencies": { "@prisma/driver-adapter-utils": "workspace:*", - "@cloudflare/workers-types": "4.20240512.0" + "@cloudflare/workers-types": "4.20240529.0" }, "devDependencies": {}, "peerDependencies": {} diff --git a/packages/adapter-libsql/package.json b/packages/adapter-libsql/package.json index fdbabf55b341..6accecf6de51 100644 --- a/packages/adapter-libsql/package.json +++ b/packages/adapter-libsql/package.json @@ -39,7 +39,7 @@ "async-mutex": "0.5.0" }, "devDependencies": { - "@libsql/client": "0.6.0" + "@libsql/client": "0.6.1" }, "peerDependencies": { "@libsql/client": "^0.3.5 || ^0.4.0 || ^0.5.0 || ^0.6.0" diff --git a/packages/adapter-neon/package.json b/packages/adapter-neon/package.json index 96ed3c00d7ab..12ecbe33ce37 100644 --- a/packages/adapter-neon/package.json +++ b/packages/adapter-neon/package.json @@ -40,8 +40,8 @@ "postgres-array": "3.0.2" }, "devDependencies": { - "@neondatabase/serverless": "0.9.1", - "@swc/core": "1.5.3", + "@neondatabase/serverless": "0.9.3", + "@swc/core": "1.5.7", "@swc/jest": "0.2.36", "jest": "29.7.0", "jest-junit": "16.0.0" diff --git a/packages/adapter-neon/src/conversion.ts b/packages/adapter-neon/src/conversion.ts index dfc110aadae5..462d9ff885b4 100644 --- a/packages/adapter-neon/src/conversion.ts +++ b/packages/adapter-neon/src/conversion.ts @@ -1,5 +1,5 @@ import { types } from '@neondatabase/serverless' -import { type ColumnType, ColumnTypeEnum, JsonNullMarker } from '@prisma/driver-adapter-utils' +import { type ColumnType, ColumnTypeEnum } from '@prisma/driver-adapter-utils' import { parse as parseArray } from 'postgres-array' const ScalarColumnType = types.builtins @@ -342,17 +342,12 @@ types.setTypeParser(ArrayColumnType.MONEY_ARRAY, normalize_array(normalize_money /*****************/ /** - * JsonNull are stored in JSON strings as the string "null", distinguishable from - * the `null` value which is used by the driver to represent the database NULL. - * By default, JSON and JSONB columns use JSON.parse to parse a JSON column value - * and this will lead to serde_json::Value::Null in Rust, which will be interpreted - * as DbNull. - * - * By converting "null" to JsonNullMarker, we can signal JsonNull in Rust side and - * convert it to QuaintValue::Json(Some(Null)). + * We hand off JSON handling entirely to engines, so we keep it + * stringified here. This function needs to exist as otherwise + * the default type parser attempts to deserialise it. */ function toJson(json: string): unknown { - return json === 'null' ? JsonNullMarker : JSON.parse(json) + return json } types.setTypeParser(ScalarColumnType.JSONB, toJson) diff --git a/packages/adapter-pg-worker/package.json b/packages/adapter-pg-worker/package.json index cecdd02e1656..fe7a81acb9ff 100644 --- a/packages/adapter-pg-worker/package.json +++ b/packages/adapter-pg-worker/package.json @@ -41,7 +41,7 @@ }, "devDependencies": { "@prisma/pg-worker": "workspace:*", - "@swc/core": "1.5.3", + "@swc/core": "1.5.7", "@swc/jest": "0.2.36", "jest": "29.7.0", "jest-junit": "16.0.0" diff --git a/packages/adapter-pg-worker/src/conversion.ts b/packages/adapter-pg-worker/src/conversion.ts index e9017f5317dc..4f997717f349 100644 --- a/packages/adapter-pg-worker/src/conversion.ts +++ b/packages/adapter-pg-worker/src/conversion.ts @@ -1,4 +1,4 @@ -import { type ColumnType, ColumnTypeEnum, JsonNullMarker } from '@prisma/driver-adapter-utils' +import { type ColumnType, ColumnTypeEnum } from '@prisma/driver-adapter-utils' import * as pg from '@prisma/pg-worker' import { parse as parseArray } from 'postgres-array' @@ -343,17 +343,12 @@ setTypeParser(ArrayColumnType.MONEY_ARRAY, normalize_array(normalize_money)) /*****************/ /** - * JsonNull are stored in JSON strings as the string "null", distinguishable from - * the `null` value which is used by the driver to represent the database NULL. - * By default, JSON and JSONB columns use JSON.parse to parse a JSON column value - * and this will lead to serde_json::Value::Null in Rust, which will be interpreted - * as DbNull. - * - * By converting "null" to JsonNullMarker, we can signal JsonNull in Rust side and - * convert it to QuaintValue::Json(Some(Null)). + * We hand off JSON handling entirely to engines, so we keep it + * stringified here. This function needs to exist as otherwise + * the default type parser attempts to deserialise it. */ function toJson(json: string): unknown { - return json === 'null' ? JsonNullMarker : JSON.parse(json) + return json } setTypeParser(ScalarColumnType.JSONB, toJson) diff --git a/packages/adapter-pg/package.json b/packages/adapter-pg/package.json index 4568f4413bed..403566aca8e7 100644 --- a/packages/adapter-pg/package.json +++ b/packages/adapter-pg/package.json @@ -40,9 +40,9 @@ "postgres-array": "3.0.2" }, "devDependencies": { - "@swc/core": "1.5.3", + "@swc/core": "1.5.7", "@swc/jest": "0.2.36", - "@types/pg": "8.11.5", + "@types/pg": "8.11.6", "jest": "29.7.0", "jest-junit": "16.0.0", "pg": "8.11.5" diff --git a/packages/adapter-pg/src/conversion.ts b/packages/adapter-pg/src/conversion.ts index 5942d6a728b8..02a782f83689 100644 --- a/packages/adapter-pg/src/conversion.ts +++ b/packages/adapter-pg/src/conversion.ts @@ -1,4 +1,4 @@ -import { type ColumnType, ColumnTypeEnum, JsonNullMarker } from '@prisma/driver-adapter-utils' +import { type ColumnType, ColumnTypeEnum } from '@prisma/driver-adapter-utils' // @ts-ignore: this is used to avoid the `Module '"/node_modules/@types/pg/index"' has no default export.` error. import pg from 'pg' import { parse as parseArray } from 'postgres-array' @@ -344,17 +344,12 @@ setTypeParser(ArrayColumnType.MONEY_ARRAY, normalize_array(normalize_money)) /*****************/ /** - * JsonNull are stored in JSON strings as the string "null", distinguishable from - * the `null` value which is used by the driver to represent the database NULL. - * By default, JSON and JSONB columns use JSON.parse to parse a JSON column value - * and this will lead to serde_json::Value::Null in Rust, which will be interpreted - * as DbNull. - * - * By converting "null" to JsonNullMarker, we can signal JsonNull in Rust side and - * convert it to QuaintValue::Json(Some(Null)). + * We hand off JSON handling entirely to engines, so we keep it + * stringified here. This function needs to exist as otherwise + * the default type parser attempts to deserialise it. */ function toJson(json: string): unknown { - return json === 'null' ? JsonNullMarker : JSON.parse(json) + return json } setTypeParser(ScalarColumnType.JSONB, toJson) diff --git a/packages/adapter-planetscale/package.json b/packages/adapter-planetscale/package.json index 1e571ce1a5f2..3f343117e7e9 100644 --- a/packages/adapter-planetscale/package.json +++ b/packages/adapter-planetscale/package.json @@ -40,7 +40,7 @@ }, "devDependencies": { "@planetscale/database": "1.18.0", - "@swc/core": "1.5.3", + "@swc/core": "1.5.7", "@swc/jest": "0.2.36", "jest": "29.7.0", "jest-junit": "16.0.0", diff --git a/packages/adapter-planetscale/src/conversion.ts b/packages/adapter-planetscale/src/conversion.ts index 5464be4d6f51..69087b3f46a3 100644 --- a/packages/adapter-planetscale/src/conversion.ts +++ b/packages/adapter-planetscale/src/conversion.ts @@ -1,5 +1,5 @@ import { cast as defaultCast } from '@planetscale/database' -import { type ColumnType, ColumnTypeEnum, JsonNullMarker } from '@prisma/driver-adapter-utils' +import { type ColumnType, ColumnTypeEnum } from '@prisma/driver-adapter-utils' // See: https://github.com/planetscale/vitess-types/blob/06235e372d2050b4c0fff49972df8111e696c564/src/vitess/query/v16/query.proto#L108-L218 export type PlanetScaleColumnType = @@ -98,8 +98,8 @@ export function fieldToColumnType(field: PlanetScaleColumnType): ColumnType { } export const cast: typeof defaultCast = (field, value) => { - if (field.type === 'JSON' && value === 'null') { - return JsonNullMarker + if (field.type === 'JSON') { + return value } const defaultValue = defaultCast(field, value) diff --git a/packages/bundle-size/create-gzip-files.ts b/packages/bundle-size/create-gzip-files.ts index cb56f0f2c6b2..923f2b931125 100644 --- a/packages/bundle-size/create-gzip-files.ts +++ b/packages/bundle-size/create-gzip-files.ts @@ -19,6 +19,8 @@ void (async () => { await $`pnpm install` // needs this for `pnpm prisma` + await $`pnpm list -r --depth -2` // print the versions of the dependencies installed + for (const project of projects) { // `nodejs_compat` is only needed when using `pg` const compatFlags = project === 'da-workers-pg-worker' ? 'nodejs_compat' : '' @@ -34,7 +36,13 @@ void (async () => { await $`rm -rf ${projectDir}/output.tgz` // Use wrangler to generate the function output - await $`pnpm wrangler deploy ${projectDir}/index.js --dry-run --outdir=${projectDir}/output --compatibility-date 2024-01-26 --compatibility-flags [${compatFlags}] ${nodeCompat} --name ${project} --tsconfig ${__dirname}/tsconfig.json` + await $`pnpm wrangler deploy ${projectDir}/index.js \ + --dry-run \ + --outdir=${projectDir}/output \ + --compatibility-date 2024-01-26 \ + --compatibility-flags [${compatFlags}] ${nodeCompat} \ + --name ${project} \ + --tsconfig ${__dirname}/tsconfig.json` // Delete *.js.map & Markdown files await $`rm ${projectDir}/output/*.js.map` diff --git a/packages/bundle-size/package.json b/packages/bundle-size/package.json index dcc15345aacf..f46550318802 100644 --- a/packages/bundle-size/package.json +++ b/packages/bundle-size/package.json @@ -9,7 +9,7 @@ "author": "Pierre-Antoine Mills", "license": "Apache-2.0", "dependencies": { - "@libsql/client": "0.6.0", + "@libsql/client": "0.6.1", "@neondatabase/serverless": "0.9.3", "@planetscale/database": "1.18.0", "@prisma/adapter-neon": "workspace:*", @@ -22,6 +22,6 @@ "@prisma/adapter-pg-worker": "workspace:*", "pg": "8.11.5", "prisma": "workspace:*", - "wrangler": "3.56.0" + "wrangler": "3.57.2" } } diff --git a/packages/bundled-js-drivers/package.json b/packages/bundled-js-drivers/package.json index 502f7ccecd50..aea8ba39eba5 100644 --- a/packages/bundled-js-drivers/package.json +++ b/packages/bundled-js-drivers/package.json @@ -29,10 +29,10 @@ "build": "tsx helpers/build.ts" }, "dependencies": { - "@libsql/client": "0.6.0", + "@libsql/client": "0.6.1", "@neondatabase/serverless": "0.9.3", "@planetscale/database": "1.18.0", - "@types/pg": "8.11.5", + "@types/pg": "8.11.6", "pg": "8.11.5" } } diff --git a/packages/cli/package.json b/packages/cli/package.json index 0f9d126098e5..7575dcf36039 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -79,7 +79,7 @@ "@prisma/mini-proxy": "0.9.5", "@prisma/studio": "0.500.0", "@prisma/studio-server": "0.500.0", - "@swc/core": "1.5.3", + "@swc/core": "1.5.7", "@swc/jest": "0.2.36", "@types/debug": "4.1.12", "@types/fs-extra": "9.0.13", @@ -90,7 +90,7 @@ "checkpoint-client": "1.1.33", "debug": "4.3.4", "dotenv": "16.0.3", - "esbuild": "0.21.2", + "esbuild": "0.21.4", "execa": "5.1.1", "fast-glob": "3.3.2", "fs-extra": "11.1.1", @@ -109,7 +109,7 @@ "resolve-pkg": "2.0.0", "rimraf": "3.0.2", "strip-ansi": "6.0.1", - "ts-pattern": "5.1.1", + "ts-pattern": "5.1.2", "typescript": "5.4.5", "xdg-app-paths": "8.3.0", "zx": "7.2.3" diff --git a/packages/cli/src/DebugInfo.ts b/packages/cli/src/DebugInfo.ts index 8d52ee040c98..8f28895e4e42 100644 --- a/packages/cli/src/DebugInfo.ts +++ b/packages/cli/src/DebugInfo.ts @@ -2,7 +2,7 @@ import type { Command } from '@prisma/internals' import { arg, format, - getSchemaPath, + getSchemaWithPath, HelpError, isCi, isError, @@ -65,7 +65,7 @@ export class DebugInfo implements Command { let schemaPath try { - schemaPath = link((await getSchemaPath(args['--schema']))?.schemaPath) + schemaPath = link((await getSchemaWithPath(args['--schema']))?.schemaPath) } catch (e) { schemaPath = e.message } diff --git a/packages/cli/src/Version.ts b/packages/cli/src/Version.ts index 3756f4c320b8..1c9885cb41e2 100644 --- a/packages/cli/src/Version.ts +++ b/packages/cli/src/Version.ts @@ -9,7 +9,7 @@ import { getConfig, getEnginesMetaInfo, getSchema, - getSchemaPath, + getSchemaWithPath, HelpError, isError, loadEnvFile, @@ -113,7 +113,7 @@ export class Version implements Command { enginesMetaInfoErrors.forEach((e) => console.error(e)) } - const schemaPath = (await getSchemaPath())?.schemaPath ?? null + const schemaPath = (await getSchemaWithPath())?.schemaPath ?? null const featureFlags = await this.getFeatureFlags(schemaPath) if (featureFlags && featureFlags.length > 0) { rows.push(['Preview Features', featureFlags.join(', ')]) diff --git a/packages/cli/src/__tests__/artificial-panic.test.ts b/packages/cli/src/__tests__/artificial-panic.test.ts index ee5fba931d8e..3e8782443ef6 100644 --- a/packages/cli/src/__tests__/artificial-panic.test.ts +++ b/packages/cli/src/__tests__/artificial-panic.test.ts @@ -1,6 +1,6 @@ import { jestContext } from '@prisma/get-platform' import { serialize } from '@prisma/get-platform/src/test-utils/jestSnapshotSerializer' -import { getDMMF, isRustPanic } from '@prisma/internals' +import { getDMMF, isRustPanic, MultipleSchemas, relativizePathInPSLError } from '@prisma/internals' import { DbPull } from '@prisma/migrate' import { Format } from '../Format' @@ -8,6 +8,14 @@ import { Validate } from '../Validate' const ctx = jestContext.new().assemble() +/// Normally, we use absolute paths for schema files throughout the codebase. +/// However, for tests we can't just store aboslute snapshot within the snapshot - we +/// want it to be transferable between different machines and operating systems. So, that's +/// why we are converting paths to relative before snapshoting them +function sanitizeSchemas(schemas: MultipleSchemas | undefined): MultipleSchemas | undefined { + return schemas?.map(([path, content]) => [relativizePathInPSLError(path), content]) +} + /** * Note: under the hood, these artificial-panic tests uses the Wasm'd `getConfig` and `getDMMF` definitions */ @@ -38,8 +46,11 @@ describe('artificial-panic introspection', () => { expect(isRustPanic(e)).toBe(true) expect(e.rustStack).toBeTruthy() expect(e.schemaPath).toBeTruthy() - expect(e.schema).toMatchInlineSnapshot(` - "// This is your Prisma schema file, + expect(sanitizeSchemas(e.schema)).toMatchInlineSnapshot(` + [ + [ + "prisma/schema.prisma", + "// This is your Prisma schema file, // learn more about it in the docs: https://pris.ly/d/prisma-schema generator client { @@ -50,7 +61,9 @@ describe('artificial-panic introspection', () => { provider = "postgresql" url = "postgres://user:password@randomhost:5432" } - " + ", + ], + ] `), expect(e).toMatchObject({ area: 'LIFT_CLI', @@ -83,8 +96,11 @@ describe('artificial-panic formatter', () => { expect(e.rustStack).toBeTruthy() expect(e.schemaPath.replace(/\\/g, '/')) // replace due to Windows CI .toContain('prisma/schema.prisma') - expect(e.schema).toMatchInlineSnapshot(` - "// This is your Prisma schema file, + expect(sanitizeSchemas(e.schema)).toMatchInlineSnapshot(` + [ + [ + "prisma/schema.prisma", + "// This is your Prisma schema file, // learn more about it in the docs: https://pris.ly/d/prisma-schema generator client { @@ -95,7 +111,9 @@ describe('artificial-panic formatter', () => { provider = "postgresql" url = "postgres://user:password@randomhost:5432" } - " + ", + ], + ] `) } }) @@ -123,8 +141,11 @@ describe('artificial-panic get-config', () => { `) expect(isRustPanic(e)).toBe(true) expect(e.rustStack).toBeTruthy() - expect(e.schema).toMatchInlineSnapshot(` - "// This is your Prisma schema file, + expect(sanitizeSchemas(e.schema)).toMatchInlineSnapshot(` + [ + [ + "prisma/schema.prisma", + "// This is your Prisma schema file, // learn more about it in the docs: https://pris.ly/d/prisma-schema generator client { @@ -135,7 +156,9 @@ describe('artificial-panic get-config', () => { provider = "postgresql" url = "postgres://user:password@randomhost:5432" } - " + ", + ], + ] `) expect(e).toMatchObject({ schemaPath: undefined, @@ -166,8 +189,11 @@ describe('artificial-panic validate', () => { `) expect(isRustPanic(e)).toBe(true) expect(e.rustStack).toBeTruthy() - expect(e.schema).toMatchInlineSnapshot(` - "// This is your Prisma schema file, + expect(sanitizeSchemas(e.schema)).toMatchInlineSnapshot(` + [ + [ + "prisma/schema.prisma", + "// This is your Prisma schema file, // learn more about it in the docs: https://pris.ly/d/prisma-schema generator client { @@ -178,7 +204,9 @@ describe('artificial-panic validate', () => { provider = "postgresql" url = "postgres://user:password@randomhost:5432" } - " + ", + ], + ] `) expect(e.schemaPath).toBeTruthy() } @@ -199,8 +227,11 @@ describe('artificial-panic validate', () => { `) expect(isRustPanic(e)).toBe(true) expect(e.rustStack).toBeTruthy() - expect(e.schema).toMatchInlineSnapshot(` - "// This is your Prisma schema file, + expect(sanitizeSchemas(e.schema)).toMatchInlineSnapshot(` + [ + [ + "prisma/schema.prisma", + "// This is your Prisma schema file, // learn more about it in the docs: https://pris.ly/d/prisma-schema generator client { @@ -211,7 +242,9 @@ describe('artificial-panic validate', () => { provider = "postgresql" url = "postgres://user:password@randomhost:5432" } - " + ", + ], + ] `) expect(e.schemaPath).toBeTruthy() } @@ -244,9 +277,14 @@ describe('artificial-panic getDMMF', () => { expect(isRustPanic(e)).toBe(true) expect(e.rustStack).toBeTruthy() expect(e.schema).toMatchInlineSnapshot(` - "generator client { + [ + [ + "schema.prisma", + "generator client { provider = "prisma-client-js" - }" + }", + ], + ] `) expect(e).toMatchObject({ schemaPath: undefined, diff --git a/packages/cli/src/__tests__/commands/CLI.test.ts b/packages/cli/src/__tests__/commands/CLI.test.ts index 0c4a102e8e97..cb01ccbefd14 100644 --- a/packages/cli/src/__tests__/commands/CLI.test.ts +++ b/packages/cli/src/__tests__/commands/CLI.test.ts @@ -9,6 +9,7 @@ const cliInstance = CLI.new( { // init: Init.new(), // migrate: MigrateCommand.new({ + // diff: MigrateDiff.new(), // dev: MigrateDev.new(), // status: MigrateStatus.new(), // resolve: MigrateResolve.new(), diff --git a/packages/cli/src/utils/test-handlePanic.ts b/packages/cli/src/utils/test-handlePanic.ts index 4ee769c1b08e..6b2d0249c75d 100644 --- a/packages/cli/src/utils/test-handlePanic.ts +++ b/packages/cli/src/utils/test-handlePanic.ts @@ -1,6 +1,5 @@ -import { handlePanic } from '@prisma/internals' +import { getSchema, handlePanic, toSchemasContainer } from '@prisma/internals' import { SchemaEngine } from '@prisma/migrate' -import fs from 'fs' import path from 'path' async function main() { @@ -13,15 +12,13 @@ async function main() { process.chdir(dirPath) - // TODO: update with `getSchema`. - const schemaPath = path.join(dirPath, 'schema.prisma') - const schema = fs.readFileSync(schemaPath, 'utf-8') + const schemas = await getSchema(path.join(dirPath, 'schema.prisma')) const engine = new SchemaEngine({ projectDir: dirPath, }) - await engine.introspect({ schema, force: false }) + await engine.introspect({ schema: toSchemasContainer(schemas), force: false }) await engine.debugPanic() } catch (err) { console.debug({ err }) diff --git a/packages/client/package.json b/packages/client/package.json index 79469c8e2e8b..248255393398 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -157,16 +157,16 @@ "extension.d.ts" ], "devDependencies": { - "@cloudflare/workers-types": "4.20240512.0", + "@cloudflare/workers-types": "4.20240529.0", "@codspeed/benchmark.js-plugin": "3.1.0", "@faker-js/faker": "8.4.1", - "@fast-check/jest": "1.8.1", - "@inquirer/prompts": "5.0.2", + "@fast-check/jest": "1.8.2", + "@inquirer/prompts": "5.0.4", "@jest/create-cache-key-function": "29.7.0", "@jest/globals": "29.7.0", "@jest/test-sequencer": "29.7.0", - "@libsql/client": "0.6.0", - "@neondatabase/serverless": "0.9.1", + "@libsql/client": "0.6.1", + "@neondatabase/serverless": "0.9.3", "@opentelemetry/api": "1.8.0", "@opentelemetry/context-async-hooks": "1.24.1", "@opentelemetry/instrumentation": "0.51.1", @@ -183,7 +183,7 @@ "@prisma/debug": "workspace:*", "@prisma/driver-adapter-utils": "workspace:*", "@prisma/engines": "workspace:*", - "@prisma/engines-version": "5.15.0-7.0af42cb19116c37b029e1f3665681074acb38bb4", + "@prisma/engines-version": "5.15.0-24.9ee43833e58f4ec014ce0f45b6ae27ee7e0165fc", "@prisma/fetch-engine": "workspace:*", "@prisma/generator-helper": "workspace:*", "@prisma/get-platform": "workspace:*", @@ -192,10 +192,10 @@ "@prisma/migrate": "workspace:*", "@prisma/mini-proxy": "0.9.5", "@prisma/pg-worker": "workspace:*", - "@prisma/query-engine-wasm": "5.15.0-7.0af42cb19116c37b029e1f3665681074acb38bb4", + "@prisma/query-engine-wasm": "5.15.0-24.9ee43833e58f4ec014ce0f45b6ae27ee7e0165fc", "@snaplet/copycat": "0.17.3", "@swc-node/register": "1.9.1", - "@swc/core": "1.5.3", + "@swc/core": "1.5.7", "@swc/jest": "0.2.36", "@timsuchanek/copy": "1.4.5", "@types/debug": "4.1.12", @@ -204,14 +204,14 @@ "@types/js-levenshtein": "1.1.3", "@types/mssql": "9.1.5", "@types/node": "18.19.31", - "@types/pg": "8.11.5", + "@types/pg": "8.11.6", "arg": "5.0.2", "benchmark": "2.1.4", "ci-info": "4.0.0", "decimal.js": "10.4.3", "detect-runtime": "1.0.4", "env-paths": "2.2.1", - "esbuild": "0.21.2", + "esbuild": "0.21.4", "execa": "5.1.1", "expect-type": "0.19.0", "flat-map-polyfill": "0.3.8", @@ -246,11 +246,11 @@ "strip-ansi": "6.0.1", "strip-indent": "3.0.0", "ts-node": "10.9.2", - "ts-pattern": "5.1.1", + "ts-pattern": "5.1.2", "tsd": "0.31.0", "typescript": "5.4.5", "undici": "5.28.4", - "wrangler": "3.56.0", + "wrangler": "3.57.2", "zx": "7.2.3" }, "peerDependencies": { diff --git a/packages/client/src/__tests__/integration/happy/not-so-exhaustive-schema-mongo/__snapshots__/binary.test.ts.snap b/packages/client/src/__tests__/integration/happy/not-so-exhaustive-schema-mongo/__snapshots__/binary.test.ts.snap index a045a7c5b6fe..5d7f824682c9 100644 --- a/packages/client/src/__tests__/integration/happy/not-so-exhaustive-schema-mongo/__snapshots__/binary.test.ts.snap +++ b/packages/client/src/__tests__/integration/happy/not-so-exhaustive-schema-mongo/__snapshots__/binary.test.ts.snap @@ -2565,16 +2565,15 @@ export namespace Prisma { scalarList?: boolean }, ExtArgs["result"]["embed"]> + export type EmbedSelectScalar = { text?: boolean boolean?: boolean scalarList?: boolean } - export type EmbedInclude = {} - export type $EmbedPayload = { name: "Embed" objects: {} @@ -2590,7 +2589,6 @@ export namespace Prisma { } } - type EmbedGetPayload = $Result.GetResult @@ -2636,13 +2634,13 @@ export namespace Prisma { boolean?: boolean }, ExtArgs["result"]["embedEmbed"]> + export type EmbedEmbedSelectScalar = { text?: boolean boolean?: boolean } - export type $EmbedEmbedPayload = { name: "EmbedEmbed" objects: {} @@ -2653,7 +2651,6 @@ export namespace Prisma { composites: {} } - type EmbedEmbedGetPayload = $Result.GetResult @@ -2856,6 +2853,7 @@ export namespace Prisma { author?: boolean | UserDefaultArgs }, ExtArgs["result"]["post"]> + export type PostSelectScalar = { id?: boolean createdAt?: boolean @@ -2865,12 +2863,10 @@ export namespace Prisma { authorId?: boolean } - export type PostInclude = { author?: boolean | UserDefaultArgs } - export type $PostPayload = { name: "Post" objects: { @@ -2887,7 +2883,6 @@ export namespace Prisma { composites: {} } - type PostGetPayload = $Result.GetResult type PostCountArgs = @@ -3938,6 +3933,7 @@ export namespace Prisma { _count?: boolean | UserCountOutputTypeDefaultArgs }, ExtArgs["result"]["user"]> + export type UserSelectScalar = { id?: boolean email?: boolean @@ -3956,14 +3952,12 @@ export namespace Prisma { embedHolderId?: boolean } - export type UserInclude = { posts?: boolean | User$postsArgs embedHolder?: boolean | EmbedHolderDefaultArgs _count?: boolean | UserCountOutputTypeDefaultArgs } - export type $UserPayload = { name: "User" objects: { @@ -3990,7 +3984,6 @@ export namespace Prisma { composites: {} } - type UserGetPayload = $Result.GetResult type UserCountArgs = @@ -4948,6 +4941,7 @@ export namespace Prisma { _count?: boolean | EmbedHolderCountOutputTypeDefaultArgs }, ExtArgs["result"]["embedHolder"]> + export type EmbedHolderSelectScalar = { id?: boolean time?: boolean @@ -4955,13 +4949,11 @@ export namespace Prisma { boolean?: boolean } - export type EmbedHolderInclude = { User?: boolean | EmbedHolder$UserArgs _count?: boolean | EmbedHolderCountOutputTypeDefaultArgs } - export type $EmbedHolderPayload = { name: "EmbedHolder" objects: { @@ -4980,7 +4972,6 @@ export namespace Prisma { } } - type EmbedHolderGetPayload = $Result.GetResult type EmbedHolderCountArgs = @@ -6036,6 +6027,7 @@ export namespace Prisma { _count?: boolean | MCountOutputTypeDefaultArgs }, ExtArgs["result"]["m"]> + export type MSelectScalar = { id?: boolean n_ids?: boolean @@ -6053,13 +6045,11 @@ export namespace Prisma { optionalBoolean?: boolean } - export type MInclude = { n?: boolean | M$nArgs _count?: boolean | MCountOutputTypeDefaultArgs } - export type $MPayload = { name: "M" objects: { @@ -6084,7 +6074,6 @@ export namespace Prisma { composites: {} } - type MGetPayload = $Result.GetResult type MCountArgs = @@ -7150,6 +7139,7 @@ export namespace Prisma { _count?: boolean | NCountOutputTypeDefaultArgs }, ExtArgs["result"]["n"]> + export type NSelectScalar = { id?: boolean m_ids?: boolean @@ -7167,13 +7157,11 @@ export namespace Prisma { optionalBoolean?: boolean } - export type NInclude = { m?: boolean | N$mArgs _count?: boolean | NCountOutputTypeDefaultArgs } - export type $NPayload = { name: "N" objects: { @@ -7198,7 +7186,6 @@ export namespace Prisma { composites: {} } - type NGetPayload = $Result.GetResult type NCountArgs = @@ -8260,6 +8247,7 @@ export namespace Prisma { _count?: boolean | OneOptionalCountOutputTypeDefaultArgs }, ExtArgs["result"]["oneOptional"]> + export type OneOptionalSelectScalar = { id?: boolean int?: boolean @@ -8276,13 +8264,11 @@ export namespace Prisma { optionalBoolean?: boolean } - export type OneOptionalInclude = { many?: boolean | OneOptional$manyArgs _count?: boolean | OneOptionalCountOutputTypeDefaultArgs } - export type $OneOptionalPayload = { name: "OneOptional" objects: { @@ -8306,7 +8292,6 @@ export namespace Prisma { composites: {} } - type OneOptionalGetPayload = $Result.GetResult type OneOptionalCountArgs = @@ -9374,6 +9359,7 @@ export namespace Prisma { one?: boolean | ManyRequired$oneArgs }, ExtArgs["result"]["manyRequired"]> + export type ManyRequiredSelectScalar = { id?: boolean oneOptionalId?: boolean @@ -9391,12 +9377,10 @@ export namespace Prisma { optionalBoolean?: boolean } - export type ManyRequiredInclude = { one?: boolean | ManyRequired$oneArgs } - export type $ManyRequiredPayload = { name: "ManyRequired" objects: { @@ -9421,7 +9405,6 @@ export namespace Prisma { composites: {} } - type ManyRequiredGetPayload = $Result.GetResult type ManyRequiredCountArgs = @@ -10485,6 +10468,7 @@ export namespace Prisma { opti?: boolean | OptionalSide1$optiArgs }, ExtArgs["result"]["optionalSide1"]> + export type OptionalSide1SelectScalar = { id?: boolean optionalSide2Id?: boolean @@ -10502,12 +10486,10 @@ export namespace Prisma { optionalBoolean?: boolean } - export type OptionalSide1Include = { opti?: boolean | OptionalSide1$optiArgs } - export type $OptionalSide1Payload = { name: "OptionalSide1" objects: { @@ -10532,7 +10514,6 @@ export namespace Prisma { composites: {} } - type OptionalSide1GetPayload = $Result.GetResult type OptionalSide1CountArgs = @@ -11588,6 +11569,7 @@ export namespace Prisma { opti?: boolean | OptionalSide2$optiArgs }, ExtArgs["result"]["optionalSide2"]> + export type OptionalSide2SelectScalar = { id?: boolean int?: boolean @@ -11604,12 +11586,10 @@ export namespace Prisma { optionalBoolean?: boolean } - export type OptionalSide2Include = { opti?: boolean | OptionalSide2$optiArgs } - export type $OptionalSide2Payload = { name: "OptionalSide2" objects: { @@ -11633,7 +11613,6 @@ export namespace Prisma { composites: {} } - type OptionalSide2GetPayload = $Result.GetResult type OptionalSide2CountArgs = @@ -12635,6 +12614,7 @@ export namespace Prisma { bInt?: boolean }, ExtArgs["result"]["a"]> + export type ASelectScalar = { id?: boolean email?: boolean @@ -12645,7 +12625,6 @@ export namespace Prisma { } - export type $APayload = { name: "A" objects: {} @@ -12666,7 +12645,6 @@ export namespace Prisma { composites: {} } - type AGetPayload = $Result.GetResult type ACountArgs = @@ -13577,6 +13555,7 @@ export namespace Prisma { dFloat?: boolean }, ExtArgs["result"]["b"]> + export type BSelectScalar = { id?: boolean float?: boolean @@ -13584,7 +13563,6 @@ export namespace Prisma { } - export type $BPayload = { name: "B" objects: {} @@ -13596,7 +13574,6 @@ export namespace Prisma { composites: {} } - type BGetPayload = $Result.GetResult type BCountArgs = @@ -14498,6 +14475,7 @@ export namespace Prisma { uuid?: boolean }, ExtArgs["result"]["c"]> + export type CSelectScalar = { id?: boolean char?: boolean @@ -14509,7 +14487,6 @@ export namespace Prisma { } - export type $CPayload = { name: "C" objects: {} @@ -14525,7 +14502,6 @@ export namespace Prisma { composites: {} } - type CGetPayload = $Result.GetResult type CCountArgs = @@ -15453,6 +15429,7 @@ export namespace Prisma { list?: boolean }, ExtArgs["result"]["d"]> + export type DSelectScalar = { id?: boolean bool?: boolean @@ -15464,7 +15441,6 @@ export namespace Prisma { } - export type $DPayload = { name: "D" objects: {} @@ -15480,7 +15456,6 @@ export namespace Prisma { composites: {} } - type DGetPayload = $Result.GetResult type DCountArgs = @@ -16362,6 +16337,7 @@ export namespace Prisma { ts?: boolean }, ExtArgs["result"]["e"]> + export type ESelectScalar = { id?: boolean date?: boolean @@ -16370,7 +16346,6 @@ export namespace Prisma { } - export type $EPayload = { name: "E" objects: {} @@ -16383,7 +16358,6 @@ export namespace Prisma { composites: {} } - type EGetPayload = $Result.GetResult type ECountArgs = diff --git a/packages/client/src/__tests__/integration/happy/not-so-exhaustive-schema-mongo/__snapshots__/library.test.ts.snap b/packages/client/src/__tests__/integration/happy/not-so-exhaustive-schema-mongo/__snapshots__/library.test.ts.snap index f2c1aeda7332..a7cd5ece0f7e 100644 --- a/packages/client/src/__tests__/integration/happy/not-so-exhaustive-schema-mongo/__snapshots__/library.test.ts.snap +++ b/packages/client/src/__tests__/integration/happy/not-so-exhaustive-schema-mongo/__snapshots__/library.test.ts.snap @@ -2565,16 +2565,15 @@ export namespace Prisma { scalarList?: boolean }, ExtArgs["result"]["embed"]> + export type EmbedSelectScalar = { text?: boolean boolean?: boolean scalarList?: boolean } - export type EmbedInclude = {} - export type $EmbedPayload = { name: "Embed" objects: {} @@ -2590,7 +2589,6 @@ export namespace Prisma { } } - type EmbedGetPayload = $Result.GetResult @@ -2636,13 +2634,13 @@ export namespace Prisma { boolean?: boolean }, ExtArgs["result"]["embedEmbed"]> + export type EmbedEmbedSelectScalar = { text?: boolean boolean?: boolean } - export type $EmbedEmbedPayload = { name: "EmbedEmbed" objects: {} @@ -2653,7 +2651,6 @@ export namespace Prisma { composites: {} } - type EmbedEmbedGetPayload = $Result.GetResult @@ -2856,6 +2853,7 @@ export namespace Prisma { author?: boolean | UserDefaultArgs }, ExtArgs["result"]["post"]> + export type PostSelectScalar = { id?: boolean createdAt?: boolean @@ -2865,12 +2863,10 @@ export namespace Prisma { authorId?: boolean } - export type PostInclude = { author?: boolean | UserDefaultArgs } - export type $PostPayload = { name: "Post" objects: { @@ -2887,7 +2883,6 @@ export namespace Prisma { composites: {} } - type PostGetPayload = $Result.GetResult type PostCountArgs = @@ -3938,6 +3933,7 @@ export namespace Prisma { _count?: boolean | UserCountOutputTypeDefaultArgs }, ExtArgs["result"]["user"]> + export type UserSelectScalar = { id?: boolean email?: boolean @@ -3956,14 +3952,12 @@ export namespace Prisma { embedHolderId?: boolean } - export type UserInclude = { posts?: boolean | User$postsArgs embedHolder?: boolean | EmbedHolderDefaultArgs _count?: boolean | UserCountOutputTypeDefaultArgs } - export type $UserPayload = { name: "User" objects: { @@ -3990,7 +3984,6 @@ export namespace Prisma { composites: {} } - type UserGetPayload = $Result.GetResult type UserCountArgs = @@ -4948,6 +4941,7 @@ export namespace Prisma { _count?: boolean | EmbedHolderCountOutputTypeDefaultArgs }, ExtArgs["result"]["embedHolder"]> + export type EmbedHolderSelectScalar = { id?: boolean time?: boolean @@ -4955,13 +4949,11 @@ export namespace Prisma { boolean?: boolean } - export type EmbedHolderInclude = { User?: boolean | EmbedHolder$UserArgs _count?: boolean | EmbedHolderCountOutputTypeDefaultArgs } - export type $EmbedHolderPayload = { name: "EmbedHolder" objects: { @@ -4980,7 +4972,6 @@ export namespace Prisma { } } - type EmbedHolderGetPayload = $Result.GetResult type EmbedHolderCountArgs = @@ -6036,6 +6027,7 @@ export namespace Prisma { _count?: boolean | MCountOutputTypeDefaultArgs }, ExtArgs["result"]["m"]> + export type MSelectScalar = { id?: boolean n_ids?: boolean @@ -6053,13 +6045,11 @@ export namespace Prisma { optionalBoolean?: boolean } - export type MInclude = { n?: boolean | M$nArgs _count?: boolean | MCountOutputTypeDefaultArgs } - export type $MPayload = { name: "M" objects: { @@ -6084,7 +6074,6 @@ export namespace Prisma { composites: {} } - type MGetPayload = $Result.GetResult type MCountArgs = @@ -7150,6 +7139,7 @@ export namespace Prisma { _count?: boolean | NCountOutputTypeDefaultArgs }, ExtArgs["result"]["n"]> + export type NSelectScalar = { id?: boolean m_ids?: boolean @@ -7167,13 +7157,11 @@ export namespace Prisma { optionalBoolean?: boolean } - export type NInclude = { m?: boolean | N$mArgs _count?: boolean | NCountOutputTypeDefaultArgs } - export type $NPayload = { name: "N" objects: { @@ -7198,7 +7186,6 @@ export namespace Prisma { composites: {} } - type NGetPayload = $Result.GetResult type NCountArgs = @@ -8260,6 +8247,7 @@ export namespace Prisma { _count?: boolean | OneOptionalCountOutputTypeDefaultArgs }, ExtArgs["result"]["oneOptional"]> + export type OneOptionalSelectScalar = { id?: boolean int?: boolean @@ -8276,13 +8264,11 @@ export namespace Prisma { optionalBoolean?: boolean } - export type OneOptionalInclude = { many?: boolean | OneOptional$manyArgs _count?: boolean | OneOptionalCountOutputTypeDefaultArgs } - export type $OneOptionalPayload = { name: "OneOptional" objects: { @@ -8306,7 +8292,6 @@ export namespace Prisma { composites: {} } - type OneOptionalGetPayload = $Result.GetResult type OneOptionalCountArgs = @@ -9374,6 +9359,7 @@ export namespace Prisma { one?: boolean | ManyRequired$oneArgs }, ExtArgs["result"]["manyRequired"]> + export type ManyRequiredSelectScalar = { id?: boolean oneOptionalId?: boolean @@ -9391,12 +9377,10 @@ export namespace Prisma { optionalBoolean?: boolean } - export type ManyRequiredInclude = { one?: boolean | ManyRequired$oneArgs } - export type $ManyRequiredPayload = { name: "ManyRequired" objects: { @@ -9421,7 +9405,6 @@ export namespace Prisma { composites: {} } - type ManyRequiredGetPayload = $Result.GetResult type ManyRequiredCountArgs = @@ -10485,6 +10468,7 @@ export namespace Prisma { opti?: boolean | OptionalSide1$optiArgs }, ExtArgs["result"]["optionalSide1"]> + export type OptionalSide1SelectScalar = { id?: boolean optionalSide2Id?: boolean @@ -10502,12 +10486,10 @@ export namespace Prisma { optionalBoolean?: boolean } - export type OptionalSide1Include = { opti?: boolean | OptionalSide1$optiArgs } - export type $OptionalSide1Payload = { name: "OptionalSide1" objects: { @@ -10532,7 +10514,6 @@ export namespace Prisma { composites: {} } - type OptionalSide1GetPayload = $Result.GetResult type OptionalSide1CountArgs = @@ -11588,6 +11569,7 @@ export namespace Prisma { opti?: boolean | OptionalSide2$optiArgs }, ExtArgs["result"]["optionalSide2"]> + export type OptionalSide2SelectScalar = { id?: boolean int?: boolean @@ -11604,12 +11586,10 @@ export namespace Prisma { optionalBoolean?: boolean } - export type OptionalSide2Include = { opti?: boolean | OptionalSide2$optiArgs } - export type $OptionalSide2Payload = { name: "OptionalSide2" objects: { @@ -11633,7 +11613,6 @@ export namespace Prisma { composites: {} } - type OptionalSide2GetPayload = $Result.GetResult type OptionalSide2CountArgs = @@ -12635,6 +12614,7 @@ export namespace Prisma { bInt?: boolean }, ExtArgs["result"]["a"]> + export type ASelectScalar = { id?: boolean email?: boolean @@ -12645,7 +12625,6 @@ export namespace Prisma { } - export type $APayload = { name: "A" objects: {} @@ -12666,7 +12645,6 @@ export namespace Prisma { composites: {} } - type AGetPayload = $Result.GetResult type ACountArgs = @@ -13577,6 +13555,7 @@ export namespace Prisma { dFloat?: boolean }, ExtArgs["result"]["b"]> + export type BSelectScalar = { id?: boolean float?: boolean @@ -13584,7 +13563,6 @@ export namespace Prisma { } - export type $BPayload = { name: "B" objects: {} @@ -13596,7 +13574,6 @@ export namespace Prisma { composites: {} } - type BGetPayload = $Result.GetResult type BCountArgs = @@ -14498,6 +14475,7 @@ export namespace Prisma { uuid?: boolean }, ExtArgs["result"]["c"]> + export type CSelectScalar = { id?: boolean char?: boolean @@ -14509,7 +14487,6 @@ export namespace Prisma { } - export type $CPayload = { name: "C" objects: {} @@ -14525,7 +14502,6 @@ export namespace Prisma { composites: {} } - type CGetPayload = $Result.GetResult type CCountArgs = @@ -15453,6 +15429,7 @@ export namespace Prisma { list?: boolean }, ExtArgs["result"]["d"]> + export type DSelectScalar = { id?: boolean bool?: boolean @@ -15464,7 +15441,6 @@ export namespace Prisma { } - export type $DPayload = { name: "D" objects: {} @@ -15480,7 +15456,6 @@ export namespace Prisma { composites: {} } - type DGetPayload = $Result.GetResult type DCountArgs = @@ -16362,6 +16337,7 @@ export namespace Prisma { ts?: boolean }, ExtArgs["result"]["e"]> + export type ESelectScalar = { id?: boolean date?: boolean @@ -16370,7 +16346,6 @@ export namespace Prisma { } - export type $EPayload = { name: "E" objects: {} @@ -16383,7 +16358,6 @@ export namespace Prisma { composites: {} } - type EGetPayload = $Result.GetResult type ECountArgs = diff --git a/packages/client/src/__tests__/integration/happy/not-so-exhaustive-schema/__snapshots__/binary.test.ts.snap b/packages/client/src/__tests__/integration/happy/not-so-exhaustive-schema/__snapshots__/binary.test.ts.snap index c1cb35293c60..1800f808ba75 100644 --- a/packages/client/src/__tests__/integration/happy/not-so-exhaustive-schema/__snapshots__/binary.test.ts.snap +++ b/packages/client/src/__tests__/integration/happy/not-so-exhaustive-schema/__snapshots__/binary.test.ts.snap @@ -2644,6 +2644,16 @@ export namespace Prisma { author?: boolean | UserDefaultArgs }, ExtArgs["result"]["post"]> + export type PostSelectCreateManyAndReturn = $Extensions.GetSelect<{ + id?: boolean + createdAt?: boolean + title?: boolean + content?: boolean + published?: boolean + authorId?: boolean + author?: boolean | UserDefaultArgs + }, ExtArgs["result"]["post"]> + export type PostSelectScalar = { id?: boolean createdAt?: boolean @@ -2653,11 +2663,12 @@ export namespace Prisma { authorId?: boolean } - export type PostInclude = { author?: boolean | UserDefaultArgs } - + export type PostIncludeCreateManyAndReturn = { + author?: boolean | UserDefaultArgs + } export type $PostPayload = { name: "Post" @@ -2675,7 +2686,6 @@ export namespace Prisma { composites: {} } - type PostGetPayload = $Result.GetResult type PostCountArgs = @@ -3313,16 +3323,16 @@ export namespace Prisma { /** * Select specific fields to fetch from the Post */ - select?: PostSelect | null - /** - * Choose, which related nodes to fetch as well - */ - include?: PostInclude | null + select?: PostSelectCreateManyAndReturn | null /** * The data used to create many Posts. */ data: PostCreateManyInput | PostCreateManyInput[] skipDuplicates?: boolean + /** + * Choose, which related nodes to fetch as well + */ + include?: PostIncludeCreateManyAndReturn | null } /** @@ -3712,6 +3722,23 @@ export namespace Prisma { _count?: boolean | UserCountOutputTypeDefaultArgs }, ExtArgs["result"]["user"]> + export type UserSelectCreateManyAndReturn = $Extensions.GetSelect<{ + id?: boolean + email?: boolean + int?: boolean + optionalInt?: boolean + float?: boolean + optionalFloat?: boolean + string?: boolean + optionalString?: boolean + json?: boolean + optionalJson?: boolean + enum?: boolean + optionalEnum?: boolean + boolean?: boolean + optionalBoolean?: boolean + }, ExtArgs["result"]["user"]> + export type UserSelectScalar = { id?: boolean email?: boolean @@ -3729,12 +3756,11 @@ export namespace Prisma { optionalBoolean?: boolean } - export type UserInclude = { posts?: boolean | User$postsArgs _count?: boolean | UserCountOutputTypeDefaultArgs } - + export type UserIncludeCreateManyAndReturn = {} export type $UserPayload = { name: "User" @@ -3760,7 +3786,6 @@ export namespace Prisma { composites: {} } - type UserGetPayload = $Result.GetResult type UserCountArgs = @@ -4406,11 +4431,7 @@ export namespace Prisma { /** * Select specific fields to fetch from the User */ - select?: UserSelect | null - /** - * Choose, which related nodes to fetch as well - */ - include?: UserInclude | null + select?: UserSelectCreateManyAndReturn | null /** * The data used to create many Users. */ @@ -4817,6 +4838,22 @@ export namespace Prisma { _count?: boolean | MCountOutputTypeDefaultArgs }, ExtArgs["result"]["m"]> + export type MSelectCreateManyAndReturn = $Extensions.GetSelect<{ + id?: boolean + int?: boolean + optionalInt?: boolean + float?: boolean + optionalFloat?: boolean + string?: boolean + optionalString?: boolean + json?: boolean + optionalJson?: boolean + enum?: boolean + optionalEnum?: boolean + boolean?: boolean + optionalBoolean?: boolean + }, ExtArgs["result"]["m"]> + export type MSelectScalar = { id?: boolean int?: boolean @@ -4833,12 +4870,11 @@ export namespace Prisma { optionalBoolean?: boolean } - export type MInclude = { n?: boolean | M$nArgs _count?: boolean | MCountOutputTypeDefaultArgs } - + export type MIncludeCreateManyAndReturn = {} export type $MPayload = { name: "M" @@ -4863,7 +4899,6 @@ export namespace Prisma { composites: {} } - type MGetPayload = $Result.GetResult type MCountArgs = @@ -5508,11 +5543,7 @@ export namespace Prisma { /** * Select specific fields to fetch from the M */ - select?: MSelect | null - /** - * Choose, which related nodes to fetch as well - */ - include?: MInclude | null + select?: MSelectCreateManyAndReturn | null /** * The data used to create many MS. */ @@ -5919,6 +5950,22 @@ export namespace Prisma { _count?: boolean | NCountOutputTypeDefaultArgs }, ExtArgs["result"]["n"]> + export type NSelectCreateManyAndReturn = $Extensions.GetSelect<{ + id?: boolean + int?: boolean + optionalInt?: boolean + float?: boolean + optionalFloat?: boolean + string?: boolean + optionalString?: boolean + json?: boolean + optionalJson?: boolean + enum?: boolean + optionalEnum?: boolean + boolean?: boolean + optionalBoolean?: boolean + }, ExtArgs["result"]["n"]> + export type NSelectScalar = { id?: boolean int?: boolean @@ -5935,12 +5982,11 @@ export namespace Prisma { optionalBoolean?: boolean } - export type NInclude = { m?: boolean | N$mArgs _count?: boolean | NCountOutputTypeDefaultArgs } - + export type NIncludeCreateManyAndReturn = {} export type $NPayload = { name: "N" @@ -5965,7 +6011,6 @@ export namespace Prisma { composites: {} } - type NGetPayload = $Result.GetResult type NCountArgs = @@ -6610,11 +6655,7 @@ export namespace Prisma { /** * Select specific fields to fetch from the N */ - select?: NSelect | null - /** - * Choose, which related nodes to fetch as well - */ - include?: NInclude | null + select?: NSelectCreateManyAndReturn | null /** * The data used to create many NS. */ @@ -7021,6 +7062,22 @@ export namespace Prisma { _count?: boolean | OneOptionalCountOutputTypeDefaultArgs }, ExtArgs["result"]["oneOptional"]> + export type OneOptionalSelectCreateManyAndReturn = $Extensions.GetSelect<{ + id?: boolean + int?: boolean + optionalInt?: boolean + float?: boolean + optionalFloat?: boolean + string?: boolean + optionalString?: boolean + json?: boolean + optionalJson?: boolean + enum?: boolean + optionalEnum?: boolean + boolean?: boolean + optionalBoolean?: boolean + }, ExtArgs["result"]["oneOptional"]> + export type OneOptionalSelectScalar = { id?: boolean int?: boolean @@ -7037,12 +7094,11 @@ export namespace Prisma { optionalBoolean?: boolean } - export type OneOptionalInclude = { many?: boolean | OneOptional$manyArgs _count?: boolean | OneOptionalCountOutputTypeDefaultArgs } - + export type OneOptionalIncludeCreateManyAndReturn = {} export type $OneOptionalPayload = { name: "OneOptional" @@ -7067,7 +7123,6 @@ export namespace Prisma { composites: {} } - type OneOptionalGetPayload = $Result.GetResult type OneOptionalCountArgs = @@ -7712,11 +7767,7 @@ export namespace Prisma { /** * Select specific fields to fetch from the OneOptional */ - select?: OneOptionalSelect | null - /** - * Choose, which related nodes to fetch as well - */ - include?: OneOptionalInclude | null + select?: OneOptionalSelectCreateManyAndReturn | null /** * The data used to create many OneOptionals. */ @@ -8134,6 +8185,24 @@ export namespace Prisma { one?: boolean | ManyRequired$oneArgs }, ExtArgs["result"]["manyRequired"]> + export type ManyRequiredSelectCreateManyAndReturn = $Extensions.GetSelect<{ + id?: boolean + oneOptionalId?: boolean + int?: boolean + optionalInt?: boolean + float?: boolean + optionalFloat?: boolean + string?: boolean + optionalString?: boolean + json?: boolean + optionalJson?: boolean + enum?: boolean + optionalEnum?: boolean + boolean?: boolean + optionalBoolean?: boolean + one?: boolean | ManyRequired$oneArgs + }, ExtArgs["result"]["manyRequired"]> + export type ManyRequiredSelectScalar = { id?: boolean oneOptionalId?: boolean @@ -8151,11 +8220,12 @@ export namespace Prisma { optionalBoolean?: boolean } - export type ManyRequiredInclude = { one?: boolean | ManyRequired$oneArgs } - + export type ManyRequiredIncludeCreateManyAndReturn = { + one?: boolean | ManyRequired$oneArgs + } export type $ManyRequiredPayload = { name: "ManyRequired" @@ -8181,7 +8251,6 @@ export namespace Prisma { composites: {} } - type ManyRequiredGetPayload = $Result.GetResult type ManyRequiredCountArgs = @@ -8827,16 +8896,16 @@ export namespace Prisma { /** * Select specific fields to fetch from the ManyRequired */ - select?: ManyRequiredSelect | null - /** - * Choose, which related nodes to fetch as well - */ - include?: ManyRequiredInclude | null + select?: ManyRequiredSelectCreateManyAndReturn | null /** * The data used to create many ManyRequireds. */ data: ManyRequiredCreateManyInput | ManyRequiredCreateManyInput[] skipDuplicates?: boolean + /** + * Choose, which related nodes to fetch as well + */ + include?: ManyRequiredIncludeCreateManyAndReturn | null } /** @@ -9244,6 +9313,24 @@ export namespace Prisma { opti?: boolean | OptionalSide1$optiArgs }, ExtArgs["result"]["optionalSide1"]> + export type OptionalSide1SelectCreateManyAndReturn = $Extensions.GetSelect<{ + id?: boolean + optionalSide2Id?: boolean + int?: boolean + optionalInt?: boolean + float?: boolean + optionalFloat?: boolean + string?: boolean + optionalString?: boolean + json?: boolean + optionalJson?: boolean + enum?: boolean + optionalEnum?: boolean + boolean?: boolean + optionalBoolean?: boolean + opti?: boolean | OptionalSide1$optiArgs + }, ExtArgs["result"]["optionalSide1"]> + export type OptionalSide1SelectScalar = { id?: boolean optionalSide2Id?: boolean @@ -9261,11 +9348,12 @@ export namespace Prisma { optionalBoolean?: boolean } - export type OptionalSide1Include = { opti?: boolean | OptionalSide1$optiArgs } - + export type OptionalSide1IncludeCreateManyAndReturn = { + opti?: boolean | OptionalSide1$optiArgs + } export type $OptionalSide1Payload = { name: "OptionalSide1" @@ -9291,7 +9379,6 @@ export namespace Prisma { composites: {} } - type OptionalSide1GetPayload = $Result.GetResult type OptionalSide1CountArgs = @@ -9937,16 +10024,16 @@ export namespace Prisma { /** * Select specific fields to fetch from the OptionalSide1 */ - select?: OptionalSide1Select | null - /** - * Choose, which related nodes to fetch as well - */ - include?: OptionalSide1Include | null + select?: OptionalSide1SelectCreateManyAndReturn | null /** * The data used to create many OptionalSide1s. */ data: OptionalSide1CreateManyInput | OptionalSide1CreateManyInput[] skipDuplicates?: boolean + /** + * Choose, which related nodes to fetch as well + */ + include?: OptionalSide1IncludeCreateManyAndReturn | null } /** @@ -10342,6 +10429,22 @@ export namespace Prisma { opti?: boolean | OptionalSide2$optiArgs }, ExtArgs["result"]["optionalSide2"]> + export type OptionalSide2SelectCreateManyAndReturn = $Extensions.GetSelect<{ + id?: boolean + int?: boolean + optionalInt?: boolean + float?: boolean + optionalFloat?: boolean + string?: boolean + optionalString?: boolean + json?: boolean + optionalJson?: boolean + enum?: boolean + optionalEnum?: boolean + boolean?: boolean + optionalBoolean?: boolean + }, ExtArgs["result"]["optionalSide2"]> + export type OptionalSide2SelectScalar = { id?: boolean int?: boolean @@ -10358,11 +10461,10 @@ export namespace Prisma { optionalBoolean?: boolean } - export type OptionalSide2Include = { opti?: boolean | OptionalSide2$optiArgs } - + export type OptionalSide2IncludeCreateManyAndReturn = {} export type $OptionalSide2Payload = { name: "OptionalSide2" @@ -10387,7 +10489,6 @@ export namespace Prisma { composites: {} } - type OptionalSide2GetPayload = $Result.GetResult type OptionalSide2CountArgs = @@ -11032,11 +11133,7 @@ export namespace Prisma { /** * Select specific fields to fetch from the OptionalSide2 */ - select?: OptionalSide2Select | null - /** - * Choose, which related nodes to fetch as well - */ - include?: OptionalSide2Include | null + select?: OptionalSide2SelectCreateManyAndReturn | null /** * The data used to create many OptionalSide2s. */ @@ -11416,6 +11513,18 @@ export namespace Prisma { inc_bInt?: boolean }, ExtArgs["result"]["a"]> + export type ASelectCreateManyAndReturn = $Extensions.GetSelect<{ + id?: boolean + email?: boolean + name?: boolean + int?: boolean + sInt?: boolean + bInt?: boolean + inc_int?: boolean + inc_sInt?: boolean + inc_bInt?: boolean + }, ExtArgs["result"]["a"]> + export type ASelectScalar = { id?: boolean email?: boolean @@ -11429,7 +11538,6 @@ export namespace Prisma { } - export type $APayload = { name: "A" objects: {} @@ -11453,7 +11561,6 @@ export namespace Prisma { composites: {} } - type AGetPayload = $Result.GetResult type ACountArgs = @@ -12069,7 +12176,7 @@ export namespace Prisma { /** * Select specific fields to fetch from the A */ - select?: ASelect | null + select?: ASelectCreateManyAndReturn | null /** * The data used to create many AS. */ @@ -12378,6 +12485,14 @@ export namespace Prisma { numFloat?: boolean }, ExtArgs["result"]["b"]> + export type BSelectCreateManyAndReturn = $Extensions.GetSelect<{ + id?: boolean + float?: boolean + dFloat?: boolean + decFloat?: boolean + numFloat?: boolean + }, ExtArgs["result"]["b"]> + export type BSelectScalar = { id?: boolean float?: boolean @@ -12387,7 +12502,6 @@ export namespace Prisma { } - export type $BPayload = { name: "B" objects: {} @@ -12401,7 +12515,6 @@ export namespace Prisma { composites: {} } - type BGetPayload = $Result.GetResult type BCountArgs = @@ -13013,7 +13126,7 @@ export namespace Prisma { /** * Select specific fields to fetch from the B */ - select?: BSelect | null + select?: BSelectCreateManyAndReturn | null /** * The data used to create many BS. */ @@ -13292,6 +13405,16 @@ export namespace Prisma { uuid?: boolean }, ExtArgs["result"]["c"]> + export type CSelectCreateManyAndReturn = $Extensions.GetSelect<{ + id?: boolean + char?: boolean + vChar?: boolean + text?: boolean + bit?: boolean + vBit?: boolean + uuid?: boolean + }, ExtArgs["result"]["c"]> + export type CSelectScalar = { id?: boolean char?: boolean @@ -13303,7 +13426,6 @@ export namespace Prisma { } - export type $CPayload = { name: "C" objects: {} @@ -13319,7 +13441,6 @@ export namespace Prisma { composites: {} } - type CGetPayload = $Result.GetResult type CCountArgs = @@ -13933,7 +14054,7 @@ export namespace Prisma { /** * Select specific fields to fetch from the C */ - select?: CSelect | null + select?: CSelectCreateManyAndReturn | null /** * The data used to create many CS. */ @@ -14234,6 +14355,16 @@ export namespace Prisma { list?: boolean }, ExtArgs["result"]["d"]> + export type DSelectCreateManyAndReturn = $Extensions.GetSelect<{ + id?: boolean + bool?: boolean + byteA?: boolean + xml?: boolean + json?: boolean + jsonb?: boolean + list?: boolean + }, ExtArgs["result"]["d"]> + export type DSelectScalar = { id?: boolean bool?: boolean @@ -14245,7 +14376,6 @@ export namespace Prisma { } - export type $DPayload = { name: "D" objects: {} @@ -14261,7 +14391,6 @@ export namespace Prisma { composites: {} } - type DGetPayload = $Result.GetResult type DCountArgs = @@ -14875,7 +15004,7 @@ export namespace Prisma { /** * Select specific fields to fetch from the D */ - select?: DSelect | null + select?: DSelectCreateManyAndReturn | null /** * The data used to create many DS. */ @@ -15130,6 +15259,13 @@ export namespace Prisma { ts?: boolean }, ExtArgs["result"]["e"]> + export type ESelectCreateManyAndReturn = $Extensions.GetSelect<{ + id?: boolean + date?: boolean + time?: boolean + ts?: boolean + }, ExtArgs["result"]["e"]> + export type ESelectScalar = { id?: boolean date?: boolean @@ -15138,7 +15274,6 @@ export namespace Prisma { } - export type $EPayload = { name: "E" objects: {} @@ -15151,7 +15286,6 @@ export namespace Prisma { composites: {} } - type EGetPayload = $Result.GetResult type ECountArgs = @@ -15762,7 +15896,7 @@ export namespace Prisma { /** * Select specific fields to fetch from the E */ - select?: ESelect | null + select?: ESelectCreateManyAndReturn | null /** * The data used to create many ES. */ diff --git a/packages/client/src/__tests__/integration/happy/not-so-exhaustive-schema/__snapshots__/library.test.ts.snap b/packages/client/src/__tests__/integration/happy/not-so-exhaustive-schema/__snapshots__/library.test.ts.snap index 1020038e233f..09c71a2bb6b1 100644 --- a/packages/client/src/__tests__/integration/happy/not-so-exhaustive-schema/__snapshots__/library.test.ts.snap +++ b/packages/client/src/__tests__/integration/happy/not-so-exhaustive-schema/__snapshots__/library.test.ts.snap @@ -2644,6 +2644,16 @@ export namespace Prisma { author?: boolean | UserDefaultArgs }, ExtArgs["result"]["post"]> + export type PostSelectCreateManyAndReturn = $Extensions.GetSelect<{ + id?: boolean + createdAt?: boolean + title?: boolean + content?: boolean + published?: boolean + authorId?: boolean + author?: boolean | UserDefaultArgs + }, ExtArgs["result"]["post"]> + export type PostSelectScalar = { id?: boolean createdAt?: boolean @@ -2653,11 +2663,12 @@ export namespace Prisma { authorId?: boolean } - export type PostInclude = { author?: boolean | UserDefaultArgs } - + export type PostIncludeCreateManyAndReturn = { + author?: boolean | UserDefaultArgs + } export type $PostPayload = { name: "Post" @@ -2675,7 +2686,6 @@ export namespace Prisma { composites: {} } - type PostGetPayload = $Result.GetResult type PostCountArgs = @@ -3313,16 +3323,16 @@ export namespace Prisma { /** * Select specific fields to fetch from the Post */ - select?: PostSelect | null - /** - * Choose, which related nodes to fetch as well - */ - include?: PostInclude | null + select?: PostSelectCreateManyAndReturn | null /** * The data used to create many Posts. */ data: PostCreateManyInput | PostCreateManyInput[] skipDuplicates?: boolean + /** + * Choose, which related nodes to fetch as well + */ + include?: PostIncludeCreateManyAndReturn | null } /** @@ -3712,6 +3722,23 @@ export namespace Prisma { _count?: boolean | UserCountOutputTypeDefaultArgs }, ExtArgs["result"]["user"]> + export type UserSelectCreateManyAndReturn = $Extensions.GetSelect<{ + id?: boolean + email?: boolean + int?: boolean + optionalInt?: boolean + float?: boolean + optionalFloat?: boolean + string?: boolean + optionalString?: boolean + json?: boolean + optionalJson?: boolean + enum?: boolean + optionalEnum?: boolean + boolean?: boolean + optionalBoolean?: boolean + }, ExtArgs["result"]["user"]> + export type UserSelectScalar = { id?: boolean email?: boolean @@ -3729,12 +3756,11 @@ export namespace Prisma { optionalBoolean?: boolean } - export type UserInclude = { posts?: boolean | User$postsArgs _count?: boolean | UserCountOutputTypeDefaultArgs } - + export type UserIncludeCreateManyAndReturn = {} export type $UserPayload = { name: "User" @@ -3760,7 +3786,6 @@ export namespace Prisma { composites: {} } - type UserGetPayload = $Result.GetResult type UserCountArgs = @@ -4406,11 +4431,7 @@ export namespace Prisma { /** * Select specific fields to fetch from the User */ - select?: UserSelect | null - /** - * Choose, which related nodes to fetch as well - */ - include?: UserInclude | null + select?: UserSelectCreateManyAndReturn | null /** * The data used to create many Users. */ @@ -4817,6 +4838,22 @@ export namespace Prisma { _count?: boolean | MCountOutputTypeDefaultArgs }, ExtArgs["result"]["m"]> + export type MSelectCreateManyAndReturn = $Extensions.GetSelect<{ + id?: boolean + int?: boolean + optionalInt?: boolean + float?: boolean + optionalFloat?: boolean + string?: boolean + optionalString?: boolean + json?: boolean + optionalJson?: boolean + enum?: boolean + optionalEnum?: boolean + boolean?: boolean + optionalBoolean?: boolean + }, ExtArgs["result"]["m"]> + export type MSelectScalar = { id?: boolean int?: boolean @@ -4833,12 +4870,11 @@ export namespace Prisma { optionalBoolean?: boolean } - export type MInclude = { n?: boolean | M$nArgs _count?: boolean | MCountOutputTypeDefaultArgs } - + export type MIncludeCreateManyAndReturn = {} export type $MPayload = { name: "M" @@ -4863,7 +4899,6 @@ export namespace Prisma { composites: {} } - type MGetPayload = $Result.GetResult type MCountArgs = @@ -5508,11 +5543,7 @@ export namespace Prisma { /** * Select specific fields to fetch from the M */ - select?: MSelect | null - /** - * Choose, which related nodes to fetch as well - */ - include?: MInclude | null + select?: MSelectCreateManyAndReturn | null /** * The data used to create many MS. */ @@ -5919,6 +5950,22 @@ export namespace Prisma { _count?: boolean | NCountOutputTypeDefaultArgs }, ExtArgs["result"]["n"]> + export type NSelectCreateManyAndReturn = $Extensions.GetSelect<{ + id?: boolean + int?: boolean + optionalInt?: boolean + float?: boolean + optionalFloat?: boolean + string?: boolean + optionalString?: boolean + json?: boolean + optionalJson?: boolean + enum?: boolean + optionalEnum?: boolean + boolean?: boolean + optionalBoolean?: boolean + }, ExtArgs["result"]["n"]> + export type NSelectScalar = { id?: boolean int?: boolean @@ -5935,12 +5982,11 @@ export namespace Prisma { optionalBoolean?: boolean } - export type NInclude = { m?: boolean | N$mArgs _count?: boolean | NCountOutputTypeDefaultArgs } - + export type NIncludeCreateManyAndReturn = {} export type $NPayload = { name: "N" @@ -5965,7 +6011,6 @@ export namespace Prisma { composites: {} } - type NGetPayload = $Result.GetResult type NCountArgs = @@ -6610,11 +6655,7 @@ export namespace Prisma { /** * Select specific fields to fetch from the N */ - select?: NSelect | null - /** - * Choose, which related nodes to fetch as well - */ - include?: NInclude | null + select?: NSelectCreateManyAndReturn | null /** * The data used to create many NS. */ @@ -7021,6 +7062,22 @@ export namespace Prisma { _count?: boolean | OneOptionalCountOutputTypeDefaultArgs }, ExtArgs["result"]["oneOptional"]> + export type OneOptionalSelectCreateManyAndReturn = $Extensions.GetSelect<{ + id?: boolean + int?: boolean + optionalInt?: boolean + float?: boolean + optionalFloat?: boolean + string?: boolean + optionalString?: boolean + json?: boolean + optionalJson?: boolean + enum?: boolean + optionalEnum?: boolean + boolean?: boolean + optionalBoolean?: boolean + }, ExtArgs["result"]["oneOptional"]> + export type OneOptionalSelectScalar = { id?: boolean int?: boolean @@ -7037,12 +7094,11 @@ export namespace Prisma { optionalBoolean?: boolean } - export type OneOptionalInclude = { many?: boolean | OneOptional$manyArgs _count?: boolean | OneOptionalCountOutputTypeDefaultArgs } - + export type OneOptionalIncludeCreateManyAndReturn = {} export type $OneOptionalPayload = { name: "OneOptional" @@ -7067,7 +7123,6 @@ export namespace Prisma { composites: {} } - type OneOptionalGetPayload = $Result.GetResult type OneOptionalCountArgs = @@ -7712,11 +7767,7 @@ export namespace Prisma { /** * Select specific fields to fetch from the OneOptional */ - select?: OneOptionalSelect | null - /** - * Choose, which related nodes to fetch as well - */ - include?: OneOptionalInclude | null + select?: OneOptionalSelectCreateManyAndReturn | null /** * The data used to create many OneOptionals. */ @@ -8134,6 +8185,24 @@ export namespace Prisma { one?: boolean | ManyRequired$oneArgs }, ExtArgs["result"]["manyRequired"]> + export type ManyRequiredSelectCreateManyAndReturn = $Extensions.GetSelect<{ + id?: boolean + oneOptionalId?: boolean + int?: boolean + optionalInt?: boolean + float?: boolean + optionalFloat?: boolean + string?: boolean + optionalString?: boolean + json?: boolean + optionalJson?: boolean + enum?: boolean + optionalEnum?: boolean + boolean?: boolean + optionalBoolean?: boolean + one?: boolean | ManyRequired$oneArgs + }, ExtArgs["result"]["manyRequired"]> + export type ManyRequiredSelectScalar = { id?: boolean oneOptionalId?: boolean @@ -8151,11 +8220,12 @@ export namespace Prisma { optionalBoolean?: boolean } - export type ManyRequiredInclude = { one?: boolean | ManyRequired$oneArgs } - + export type ManyRequiredIncludeCreateManyAndReturn = { + one?: boolean | ManyRequired$oneArgs + } export type $ManyRequiredPayload = { name: "ManyRequired" @@ -8181,7 +8251,6 @@ export namespace Prisma { composites: {} } - type ManyRequiredGetPayload = $Result.GetResult type ManyRequiredCountArgs = @@ -8827,16 +8896,16 @@ export namespace Prisma { /** * Select specific fields to fetch from the ManyRequired */ - select?: ManyRequiredSelect | null - /** - * Choose, which related nodes to fetch as well - */ - include?: ManyRequiredInclude | null + select?: ManyRequiredSelectCreateManyAndReturn | null /** * The data used to create many ManyRequireds. */ data: ManyRequiredCreateManyInput | ManyRequiredCreateManyInput[] skipDuplicates?: boolean + /** + * Choose, which related nodes to fetch as well + */ + include?: ManyRequiredIncludeCreateManyAndReturn | null } /** @@ -9244,6 +9313,24 @@ export namespace Prisma { opti?: boolean | OptionalSide1$optiArgs }, ExtArgs["result"]["optionalSide1"]> + export type OptionalSide1SelectCreateManyAndReturn = $Extensions.GetSelect<{ + id?: boolean + optionalSide2Id?: boolean + int?: boolean + optionalInt?: boolean + float?: boolean + optionalFloat?: boolean + string?: boolean + optionalString?: boolean + json?: boolean + optionalJson?: boolean + enum?: boolean + optionalEnum?: boolean + boolean?: boolean + optionalBoolean?: boolean + opti?: boolean | OptionalSide1$optiArgs + }, ExtArgs["result"]["optionalSide1"]> + export type OptionalSide1SelectScalar = { id?: boolean optionalSide2Id?: boolean @@ -9261,11 +9348,12 @@ export namespace Prisma { optionalBoolean?: boolean } - export type OptionalSide1Include = { opti?: boolean | OptionalSide1$optiArgs } - + export type OptionalSide1IncludeCreateManyAndReturn = { + opti?: boolean | OptionalSide1$optiArgs + } export type $OptionalSide1Payload = { name: "OptionalSide1" @@ -9291,7 +9379,6 @@ export namespace Prisma { composites: {} } - type OptionalSide1GetPayload = $Result.GetResult type OptionalSide1CountArgs = @@ -9937,16 +10024,16 @@ export namespace Prisma { /** * Select specific fields to fetch from the OptionalSide1 */ - select?: OptionalSide1Select | null - /** - * Choose, which related nodes to fetch as well - */ - include?: OptionalSide1Include | null + select?: OptionalSide1SelectCreateManyAndReturn | null /** * The data used to create many OptionalSide1s. */ data: OptionalSide1CreateManyInput | OptionalSide1CreateManyInput[] skipDuplicates?: boolean + /** + * Choose, which related nodes to fetch as well + */ + include?: OptionalSide1IncludeCreateManyAndReturn | null } /** @@ -10342,6 +10429,22 @@ export namespace Prisma { opti?: boolean | OptionalSide2$optiArgs }, ExtArgs["result"]["optionalSide2"]> + export type OptionalSide2SelectCreateManyAndReturn = $Extensions.GetSelect<{ + id?: boolean + int?: boolean + optionalInt?: boolean + float?: boolean + optionalFloat?: boolean + string?: boolean + optionalString?: boolean + json?: boolean + optionalJson?: boolean + enum?: boolean + optionalEnum?: boolean + boolean?: boolean + optionalBoolean?: boolean + }, ExtArgs["result"]["optionalSide2"]> + export type OptionalSide2SelectScalar = { id?: boolean int?: boolean @@ -10358,11 +10461,10 @@ export namespace Prisma { optionalBoolean?: boolean } - export type OptionalSide2Include = { opti?: boolean | OptionalSide2$optiArgs } - + export type OptionalSide2IncludeCreateManyAndReturn = {} export type $OptionalSide2Payload = { name: "OptionalSide2" @@ -10387,7 +10489,6 @@ export namespace Prisma { composites: {} } - type OptionalSide2GetPayload = $Result.GetResult type OptionalSide2CountArgs = @@ -11032,11 +11133,7 @@ export namespace Prisma { /** * Select specific fields to fetch from the OptionalSide2 */ - select?: OptionalSide2Select | null - /** - * Choose, which related nodes to fetch as well - */ - include?: OptionalSide2Include | null + select?: OptionalSide2SelectCreateManyAndReturn | null /** * The data used to create many OptionalSide2s. */ @@ -11416,6 +11513,18 @@ export namespace Prisma { inc_bInt?: boolean }, ExtArgs["result"]["a"]> + export type ASelectCreateManyAndReturn = $Extensions.GetSelect<{ + id?: boolean + email?: boolean + name?: boolean + int?: boolean + sInt?: boolean + bInt?: boolean + inc_int?: boolean + inc_sInt?: boolean + inc_bInt?: boolean + }, ExtArgs["result"]["a"]> + export type ASelectScalar = { id?: boolean email?: boolean @@ -11429,7 +11538,6 @@ export namespace Prisma { } - export type $APayload = { name: "A" objects: {} @@ -11453,7 +11561,6 @@ export namespace Prisma { composites: {} } - type AGetPayload = $Result.GetResult type ACountArgs = @@ -12069,7 +12176,7 @@ export namespace Prisma { /** * Select specific fields to fetch from the A */ - select?: ASelect | null + select?: ASelectCreateManyAndReturn | null /** * The data used to create many AS. */ @@ -12378,6 +12485,14 @@ export namespace Prisma { numFloat?: boolean }, ExtArgs["result"]["b"]> + export type BSelectCreateManyAndReturn = $Extensions.GetSelect<{ + id?: boolean + float?: boolean + dFloat?: boolean + decFloat?: boolean + numFloat?: boolean + }, ExtArgs["result"]["b"]> + export type BSelectScalar = { id?: boolean float?: boolean @@ -12387,7 +12502,6 @@ export namespace Prisma { } - export type $BPayload = { name: "B" objects: {} @@ -12401,7 +12515,6 @@ export namespace Prisma { composites: {} } - type BGetPayload = $Result.GetResult type BCountArgs = @@ -13013,7 +13126,7 @@ export namespace Prisma { /** * Select specific fields to fetch from the B */ - select?: BSelect | null + select?: BSelectCreateManyAndReturn | null /** * The data used to create many BS. */ @@ -13292,6 +13405,16 @@ export namespace Prisma { uuid?: boolean }, ExtArgs["result"]["c"]> + export type CSelectCreateManyAndReturn = $Extensions.GetSelect<{ + id?: boolean + char?: boolean + vChar?: boolean + text?: boolean + bit?: boolean + vBit?: boolean + uuid?: boolean + }, ExtArgs["result"]["c"]> + export type CSelectScalar = { id?: boolean char?: boolean @@ -13303,7 +13426,6 @@ export namespace Prisma { } - export type $CPayload = { name: "C" objects: {} @@ -13319,7 +13441,6 @@ export namespace Prisma { composites: {} } - type CGetPayload = $Result.GetResult type CCountArgs = @@ -13933,7 +14054,7 @@ export namespace Prisma { /** * Select specific fields to fetch from the C */ - select?: CSelect | null + select?: CSelectCreateManyAndReturn | null /** * The data used to create many CS. */ @@ -14234,6 +14355,16 @@ export namespace Prisma { list?: boolean }, ExtArgs["result"]["d"]> + export type DSelectCreateManyAndReturn = $Extensions.GetSelect<{ + id?: boolean + bool?: boolean + byteA?: boolean + xml?: boolean + json?: boolean + jsonb?: boolean + list?: boolean + }, ExtArgs["result"]["d"]> + export type DSelectScalar = { id?: boolean bool?: boolean @@ -14245,7 +14376,6 @@ export namespace Prisma { } - export type $DPayload = { name: "D" objects: {} @@ -14261,7 +14391,6 @@ export namespace Prisma { composites: {} } - type DGetPayload = $Result.GetResult type DCountArgs = @@ -14875,7 +15004,7 @@ export namespace Prisma { /** * Select specific fields to fetch from the D */ - select?: DSelect | null + select?: DSelectCreateManyAndReturn | null /** * The data used to create many DS. */ @@ -15130,6 +15259,13 @@ export namespace Prisma { ts?: boolean }, ExtArgs["result"]["e"]> + export type ESelectCreateManyAndReturn = $Extensions.GetSelect<{ + id?: boolean + date?: boolean + time?: boolean + ts?: boolean + }, ExtArgs["result"]["e"]> + export type ESelectScalar = { id?: boolean date?: boolean @@ -15138,7 +15274,6 @@ export namespace Prisma { } - export type $EPayload = { name: "E" objects: {} @@ -15151,7 +15286,6 @@ export namespace Prisma { composites: {} } - type EGetPayload = $Result.GetResult type ECountArgs = @@ -15762,7 +15896,7 @@ export namespace Prisma { /** * Select specific fields to fetch from the E */ - select?: ESelect | null + select?: ESelectCreateManyAndReturn | null /** * The data used to create many ES. */ diff --git a/packages/client/src/generation/TSClient/Args.ts b/packages/client/src/generation/TSClient/Args.ts index ec060fceea28..c97f9cc9367e 100644 --- a/packages/client/src/generation/TSClient/Args.ts +++ b/packages/client/src/generation/TSClient/Args.ts @@ -46,15 +46,12 @@ export class ArgsTypeBuilder { return this } - addSelectArg(): this { + addSelectArg(selectTypeName: string = getSelectName(this.type.name)): this { this.addProperty( ts .property( 'select', - ts.unionType([ - ts.namedType(getSelectName(this.type.name)).addGenericArgument(extArgsParam.toArgument()), - ts.nullType, - ]), + ts.unionType([ts.namedType(selectTypeName).addGenericArgument(extArgsParam.toArgument()), ts.nullType]), ) .optional() .setDocComment(ts.docComment(`Select specific fields to fetch from the ${this.type.name}`)), @@ -63,8 +60,8 @@ export class ArgsTypeBuilder { return this } - addIncludeArgIfHasRelations(): this { - const hasRelationField = this.type.fields.some((f) => f.outputType.location === 'outputObjectTypes') + addIncludeArgIfHasRelations(includeTypeName = getIncludeName(this.type.name), type = this.type): this { + const hasRelationField = type.fields.some((f) => f.outputType.location === 'outputObjectTypes') if (!hasRelationField) { return this } @@ -73,10 +70,7 @@ export class ArgsTypeBuilder { ts .property( 'include', - ts.unionType([ - ts.namedType(getIncludeName(this.type.name)).addGenericArgument(extArgsParam.toArgument()), - ts.nullType, - ]), + ts.unionType([ts.namedType(includeTypeName).addGenericArgument(extArgsParam.toArgument()), ts.nullType]), ) .optional() .setDocComment(ts.docComment('Choose, which related nodes to fetch as well')), diff --git a/packages/client/src/generation/TSClient/Model.ts b/packages/client/src/generation/TSClient/Model.ts index abbc931d8acb..15f92012bd57 100644 --- a/packages/client/src/generation/TSClient/Model.ts +++ b/packages/client/src/generation/TSClient/Model.ts @@ -13,17 +13,20 @@ import { getAvgAggregateName, getCountAggregateInputName, getCountAggregateOutputName, + getCreateManyAndReturnOutputType, getFieldArgName, getFieldRefsTypeName, getGroupByArgsName, getGroupByName, getGroupByPayloadName, + getIncludeCreateManyAndReturnName, getMaxAggregateName, getMinAggregateName, getModelArgName, getModelFieldArgsName, getPayloadName, getReturnType, + getSelectCreateManyAndReturnName, getSumAggregateName, } from '../utils' import { InputField } from './../TSClient' @@ -41,6 +44,7 @@ import { getModelActions } from './utils/getModelActions' export class Model implements Generable { protected type: DMMF.OutputType + protected createManyAndReturnType: undefined | DMMF.OutputType protected mapping?: DMMF.ModelMapping private dmmf: DMMFHelper private genericsInfo: GenericArgsInfo @@ -48,6 +52,8 @@ export class Model implements Generable { this.dmmf = context.dmmf this.genericsInfo = context.genericArgsInfo this.type = this.context.dmmf.outputTypeMap.model[model.name] + + this.createManyAndReturnType = this.context.dmmf.outputTypeMap.model[getCreateManyAndReturnOutputType(model.name)] this.mapping = this.context.dmmf.mappings.modelOperations.find((m) => m.model === model.name)! } @@ -75,6 +81,19 @@ export class Model implements Generable { .addSchemaArgs(field.args) .createExport(), ) + } else if (action === 'createManyAndReturn') { + const args = new ArgsTypeBuilder(this.type, this.context, action as DMMF.ModelAction) + .addSelectArg(getSelectCreateManyAndReturnName(this.type.name)) + .addOmitArg() + .addSchemaArgs(field.args) + + if (this.createManyAndReturnType) { + args.addIncludeArgIfHasRelations( + getIncludeCreateManyAndReturnName(this.model.name), + this.createManyAndReturnType, + ) + } + argsTypes.push(args.createExport()) } else if (action !== 'groupBy' && action !== 'aggregate') { argsTypes.push( new ArgsTypeBuilder(this.type, this.context, action as DMMF.ModelAction) @@ -316,17 +335,32 @@ export type ${getAggregateGetName(model.name)} f.kind === 'object') const includeType = hasRelationField ? ts.stringify(buildIncludeType({ modelName: this.model.name, dmmf: this.dmmf, fields: this.type.fields }), { - newLine: 'both', + newLine: 'leading', }) : '' + const createManyAndReturnIncludeType = + hasRelationField && this.createManyAndReturnType + ? ts.stringify( + buildIncludeType({ + typeName: getIncludeCreateManyAndReturnName(this.model.name), + modelName: this.model.name, + dmmf: this.dmmf, + fields: this.createManyAndReturnType.fields, + }), + { + newLine: 'leading', + }, + ) + : '' + return ` /** * Model ${model.name} @@ -337,12 +371,24 @@ ${!isComposite ? this.getAggregationTypes() : ''} ${!isComposite ? this.getGroupByTypes() : ''} ${ts.stringify(buildSelectType({ modelName: this.model.name, fields: this.type.fields }))} +${ + this.createManyAndReturnType + ? ts.stringify( + buildSelectType({ + modelName: this.model.name, + fields: this.createManyAndReturnType.fields, + typeName: getSelectCreateManyAndReturnName(this.model.name), + }), + { newLine: 'leading' }, + ) + : '' +} ${ts.stringify(buildScalarSelectType({ modelName: this.model.name, fields: this.type.fields }), { newLine: 'leading', })} -${omitType} -${includeType} -${ts.stringify(buildModelPayload(this.model, this.dmmf), { newLine: 'both' })} +${omitType}${includeType}${createManyAndReturnIncludeType} + +${ts.stringify(buildModelPayload(this.model, this.dmmf), { newLine: 'none' })} type ${model.name}GetPayload(ts.booleanType) if (field.outputType.location === 'outputObjectTypes') { const subSelectType = ts.namedType(getFieldArgName(field, modelName)) - subSelectType.addGenericArgument(extArgsParam.toArgument()) fieldType.addVariant(subSelectType) diff --git a/packages/client/src/generation/generateClient.ts b/packages/client/src/generation/generateClient.ts index b12d3e47a9d0..8ca9ce9006b6 100644 --- a/packages/client/src/generation/generateClient.ts +++ b/packages/client/src/generation/generateClient.ts @@ -200,15 +200,34 @@ export async function buildClient({ // In short: A lot can be simplified, but can only happen in GA & P6. fileMap['default.js'] = JS(trampolineTsClient) fileMap['default.d.ts'] = TS(trampolineTsClient) - fileMap['wasm-worker-loader.js'] = `export default (await import('./query_engine_bg.wasm')).default` - fileMap['wasm-edge-light-loader.js'] = `export default (await import('./query_engine_bg.wasm?module')).default` + fileMap['wasm-worker-loader.js'] = `export default import('./query_engine_bg.wasm')` + fileMap['wasm-edge-light-loader.js'] = `export default import('./query_engine_bg.wasm?module')` + pkgJson['browser'] = 'default.js' // also point to the trampoline client otherwise it is picked up by cfw pkgJson['imports'] = { // when `import('#wasm-engine-loader')` is called, it will be resolved to the correct file '#wasm-engine-loader': { + // Keys reference: https://runtime-keys.proposal.wintercg.org/#keys + + /** + * Vercel Edge Functions / Next.js Middlewares + */ 'edge-light': './wasm-edge-light-loader.js', + + /** + * Cloudflare Workers, Cloudflare Pages + */ workerd: './wasm-worker-loader.js', + + /** + * (Old) Cloudflare Workers + * @millsp It's a fallback, in case both other keys didn't work because we could be on a different edge platform. It's a hypothetical case rather than anything actually tested. + */ worker: './wasm-worker-loader.js', + + /** + * Fallback for every other JavaScript runtime + */ default: './wasm-worker-loader.js', }, // when `require('#main-entry-point')` is called, it will be resolved to the correct file diff --git a/packages/client/src/generation/utils.ts b/packages/client/src/generation/utils.ts index 62702cf2a78a..a6b0ddcd5b65 100644 --- a/packages/client/src/generation/utils.ts +++ b/packages/client/src/generation/utils.ts @@ -7,6 +7,26 @@ export function getSelectName(modelName: string): string { return `${modelName}Select` } +export function getSelectCreateManyAndReturnName(modelName: string): string { + return `${modelName}SelectCreateManyAndReturn` +} + +export function getIncludeName(modelName: string): string { + return `${modelName}Include` +} + +export function getIncludeCreateManyAndReturnName(modelName: string): string { + return `${modelName}IncludeCreateManyAndReturn` +} + +export function getCreateManyAndReturnOutputType(modelName: string): string { + return `CreateMany${modelName}AndReturnOutputType` +} + +export function getOmitName(modelName: string): string { + return `${modelName}Omit` +} + export function getAggregateName(modelName: string): string { return `Aggregate${capitalize(modelName)}` } @@ -63,14 +83,6 @@ export function getAggregateScalarGetName(modelName: string): string { return `Get${capitalize(modelName)}AggregateScalarType` } -export function getIncludeName(modelName: string): string { - return `${modelName}Include` -} - -export function getOmitName(modelName: string): string { - return `${modelName}Omit` -} - export function getFieldArgName(field: DMMF.SchemaField, modelName: string): string { if (field.args.length) { return getModelFieldArgsName(field, modelName) diff --git a/packages/client/src/generation/utils/buildGetQueryEngineWasmModule.ts b/packages/client/src/generation/utils/buildGetQueryEngineWasmModule.ts index 48db6f0e086c..b5854102c9fe 100644 --- a/packages/client/src/generation/utils/buildGetQueryEngineWasmModule.ts +++ b/packages/client/src/generation/utils/buildGetQueryEngineWasmModule.ts @@ -29,7 +29,9 @@ export function buildQueryEngineWasmModule( return `config.engineWasm = { getRuntime: () => require('./query_engine_bg.js'), getQueryEngineWasmModule: async () => { - return (await import('#wasm-engine-loader')).default + const loader = (await import('#wasm-engine-loader')).default + const engine = (await loader).default + return engine } }` } diff --git a/packages/client/src/runtime/core/engines/library/LibraryEngine.ts b/packages/client/src/runtime/core/engines/library/LibraryEngine.ts index 4fa50a085800..6eef4c884977 100644 --- a/packages/client/src/runtime/core/engines/library/LibraryEngine.ts +++ b/packages/client/src/runtime/core/engines/library/LibraryEngine.ts @@ -117,6 +117,12 @@ export class LibraryEngine implements Engine { } private checkForTooManyEngines() { + // We don't show this warning for Edge Functions, + // see https://github.com/prisma/team-orm/issues/1094. + if (this.config.adapter && ['wasm'].includes(TARGET_BUILD_TYPE)) { + return + } + if (engineInstanceCount === 10) { console.warn( `${yellow( diff --git a/packages/client/src/utils/generateInFolder.ts b/packages/client/src/utils/generateInFolder.ts index 41e3622c2cc6..e339d99b4c17 100644 --- a/packages/client/src/utils/generateInFolder.ts +++ b/packages/client/src/utils/generateInFolder.ts @@ -1,7 +1,7 @@ import Debug from '@prisma/debug' import { getEnginesPath } from '@prisma/engines' import { getBinaryTargetForCurrentPlatform, getNodeAPIName } from '@prisma/get-platform' -import { getSchemaPath, type GetSchemaResult, mergeSchemas } from '@prisma/internals' +import { type GetSchemaResult, getSchemaWithPath, mergeSchemas } from '@prisma/internals' import { ClientEngineType, extractPreviewFeatures, @@ -46,7 +46,7 @@ export async function generateInFolder({ const schemaNotFoundError = new Error(`Could not find any schema.prisma in ${projectDir} or sub directories.`) try { - schemaPathResult = await getSchemaPath(undefined, { cwd: projectDir }) + schemaPathResult = await getSchemaWithPath(undefined, { cwd: projectDir }) } catch (e) { debug('Error in getSchemaPath', e) } diff --git a/packages/client/src/utils/getTestClient.ts b/packages/client/src/utils/getTestClient.ts index 47f3fac4d1f9..57a7efae96b6 100644 --- a/packages/client/src/utils/getTestClient.ts +++ b/packages/client/src/utils/getTestClient.ts @@ -5,7 +5,7 @@ import { getClientEngineType, getConfig, getEnvPaths, - getSchemaPath, + getSchemaWithPath, parseEnvValue, printConfigWarnings, } from '@prisma/internals' @@ -27,7 +27,7 @@ export async function getTestClient(schemaDir?: string, printWarnings?: boolean) const callSite = path.dirname(require.main?.filename ?? '') const absSchemaDir = path.resolve(callSite, schemaDir ?? '') - const { schemaPath, schemas: datamodel } = (await getSchemaPath(undefined, { cwd: absSchemaDir }))! + const { schemaPath, schemas: datamodel } = (await getSchemaWithPath(undefined, { cwd: absSchemaDir }))! const config = await getConfig({ datamodel, ignoreEnvVarErrors: true }) if (printWarnings) { diff --git a/packages/client/tests/e2e/16418-slow-compilation-big-schema/package.json b/packages/client/tests/e2e/16418-slow-compilation-big-schema/package.json index 49c325db8582..7fc177afc43e 100644 --- a/packages/client/tests/e2e/16418-slow-compilation-big-schema/package.json +++ b/packages/client/tests/e2e/16418-slow-compilation-big-schema/package.json @@ -8,7 +8,7 @@ }, "devDependencies": { "@types/jest": "29.5.12", - "@types/node": "16.18.96", + "@types/node": "16.18.97", "prisma": "/tmp/prisma-0.0.0.tgz" } } diff --git a/packages/client/tests/e2e/accelerate-types/package.json b/packages/client/tests/e2e/accelerate-types/package.json index 00e6042a437a..4fa7c55d5e7d 100644 --- a/packages/client/tests/e2e/accelerate-types/package.json +++ b/packages/client/tests/e2e/accelerate-types/package.json @@ -5,11 +5,11 @@ "scripts": {}, "dependencies": { "@prisma/client": "/tmp/prisma-client-0.0.0.tgz", - "@prisma/extension-accelerate": "1.0.0" + "@prisma/extension-accelerate": "1.1.0" }, "devDependencies": { "@types/jest": "29.5.12", - "@types/node": "16.18.96", + "@types/node": "16.18.97", "expect-type": "0.19.0", "prisma": "/tmp/prisma-0.0.0.tgz", "typescript": "5.4.5" diff --git a/packages/client/tests/e2e/adapter-d1-itx-error/package.json b/packages/client/tests/e2e/adapter-d1-itx-error/package.json index efc1335ce5ac..0543b5883a1c 100644 --- a/packages/client/tests/e2e/adapter-d1-itx-error/package.json +++ b/packages/client/tests/e2e/adapter-d1-itx-error/package.json @@ -9,7 +9,7 @@ }, "devDependencies": { "@types/jest": "29.5.12", - "@types/node": "16.18.96", + "@types/node": "16.18.97", "prisma": "/tmp/prisma-0.0.0.tgz" } } diff --git a/packages/client/tests/e2e/browser-enum/package.json b/packages/client/tests/e2e/browser-enum/package.json index 49c325db8582..7fc177afc43e 100644 --- a/packages/client/tests/e2e/browser-enum/package.json +++ b/packages/client/tests/e2e/browser-enum/package.json @@ -8,7 +8,7 @@ }, "devDependencies": { "@types/jest": "29.5.12", - "@types/node": "16.18.96", + "@types/node": "16.18.97", "prisma": "/tmp/prisma-0.0.0.tgz" } } diff --git a/packages/client/tests/e2e/browser-unsupported-errors/package.json b/packages/client/tests/e2e/browser-unsupported-errors/package.json index 49c325db8582..7fc177afc43e 100644 --- a/packages/client/tests/e2e/browser-unsupported-errors/package.json +++ b/packages/client/tests/e2e/browser-unsupported-errors/package.json @@ -8,7 +8,7 @@ }, "devDependencies": { "@types/jest": "29.5.12", - "@types/node": "16.18.96", + "@types/node": "16.18.97", "prisma": "/tmp/prisma-0.0.0.tgz" } } diff --git a/packages/client/tests/e2e/bundler-detection-error/package.json b/packages/client/tests/e2e/bundler-detection-error/package.json index 5758687ee8e4..06d508b0a485 100644 --- a/packages/client/tests/e2e/bundler-detection-error/package.json +++ b/packages/client/tests/e2e/bundler-detection-error/package.json @@ -7,7 +7,7 @@ "@prisma/client": "/tmp/prisma-client-0.0.0.tgz" }, "devDependencies": { - "@types/node": "16.18.96", + "@types/node": "16.18.97", "esbuild": "latest", "prisma": "/tmp/prisma-0.0.0.tgz" } diff --git a/packages/client/tests/e2e/connection-limit-reached/docker-compose.yaml b/packages/client/tests/e2e/connection-limit-reached/docker-compose.yaml index de82af1b7fed..24842a5516d7 100644 --- a/packages/client/tests/e2e/connection-limit-reached/docker-compose.yaml +++ b/packages/client/tests/e2e/connection-limit-reached/docker-compose.yaml @@ -7,7 +7,7 @@ services: condition: service_healthy mysql: - image: mysql:8.3 + image: mysql:lts command: --lower_case_table_names=1 --max_connections=2 environment: - MYSQL_ROOT_PASSWORD=root diff --git a/packages/client/tests/e2e/connection-limit-reached/package.json b/packages/client/tests/e2e/connection-limit-reached/package.json index 49c325db8582..7fc177afc43e 100644 --- a/packages/client/tests/e2e/connection-limit-reached/package.json +++ b/packages/client/tests/e2e/connection-limit-reached/package.json @@ -8,7 +8,7 @@ }, "devDependencies": { "@types/jest": "29.5.12", - "@types/node": "16.18.96", + "@types/node": "16.18.97", "prisma": "/tmp/prisma-0.0.0.tgz" } } diff --git a/packages/client/tests/e2e/default-version/package.json b/packages/client/tests/e2e/default-version/package.json index a299d43ab41b..6c951212bcda 100644 --- a/packages/client/tests/e2e/default-version/package.json +++ b/packages/client/tests/e2e/default-version/package.json @@ -8,6 +8,6 @@ }, "devDependencies": { "@types/jest": "29.5.12", - "@types/node": "16.18.96" + "@types/node": "16.18.97" } } diff --git a/packages/client/tests/e2e/driver-adapters-accelerate/package.json b/packages/client/tests/e2e/driver-adapters-accelerate/package.json index 49c325db8582..7fc177afc43e 100644 --- a/packages/client/tests/e2e/driver-adapters-accelerate/package.json +++ b/packages/client/tests/e2e/driver-adapters-accelerate/package.json @@ -8,7 +8,7 @@ }, "devDependencies": { "@types/jest": "29.5.12", - "@types/node": "16.18.96", + "@types/node": "16.18.97", "prisma": "/tmp/prisma-0.0.0.tgz" } } diff --git a/packages/client/tests/e2e/engine-not-found-error/binary-targets-incorrectly-pinned/package.json b/packages/client/tests/e2e/engine-not-found-error/binary-targets-incorrectly-pinned/package.json index 7c02940e660c..c8474b04dc7a 100644 --- a/packages/client/tests/e2e/engine-not-found-error/binary-targets-incorrectly-pinned/package.json +++ b/packages/client/tests/e2e/engine-not-found-error/binary-targets-incorrectly-pinned/package.json @@ -7,7 +7,7 @@ "@prisma/client": "/tmp/prisma-client-0.0.0.tgz" }, "devDependencies": { - "@types/node": "16.18.96", + "@types/node": "16.18.97", "prisma": "/tmp/prisma-0.0.0.tgz" } } diff --git a/packages/client/tests/e2e/engine-not-found-error/bundler-tampered-with-engine-copy/package.json b/packages/client/tests/e2e/engine-not-found-error/bundler-tampered-with-engine-copy/package.json index 075fe98a0f34..f335bad473ab 100644 --- a/packages/client/tests/e2e/engine-not-found-error/bundler-tampered-with-engine-copy/package.json +++ b/packages/client/tests/e2e/engine-not-found-error/bundler-tampered-with-engine-copy/package.json @@ -7,8 +7,8 @@ "@prisma/client": "/tmp/prisma-client-0.0.0.tgz" }, "devDependencies": { - "@types/node": "16.18.96", - "esbuild": "0.20.2", + "@types/node": "16.18.97", + "esbuild": "0.21.4", "prisma": "/tmp/prisma-0.0.0.tgz" } } diff --git a/packages/client/tests/e2e/engine-not-found-error/native-generated-different-platform/package.json b/packages/client/tests/e2e/engine-not-found-error/native-generated-different-platform/package.json index 7c02940e660c..c8474b04dc7a 100644 --- a/packages/client/tests/e2e/engine-not-found-error/native-generated-different-platform/package.json +++ b/packages/client/tests/e2e/engine-not-found-error/native-generated-different-platform/package.json @@ -7,7 +7,7 @@ "@prisma/client": "/tmp/prisma-client-0.0.0.tgz" }, "devDependencies": { - "@types/node": "16.18.96", + "@types/node": "16.18.97", "prisma": "/tmp/prisma-0.0.0.tgz" } } diff --git a/packages/client/tests/e2e/engine-not-found-error/tooling-tampered-with-engine-copy/package.json b/packages/client/tests/e2e/engine-not-found-error/tooling-tampered-with-engine-copy/package.json index 075fe98a0f34..f335bad473ab 100644 --- a/packages/client/tests/e2e/engine-not-found-error/tooling-tampered-with-engine-copy/package.json +++ b/packages/client/tests/e2e/engine-not-found-error/tooling-tampered-with-engine-copy/package.json @@ -7,8 +7,8 @@ "@prisma/client": "/tmp/prisma-client-0.0.0.tgz" }, "devDependencies": { - "@types/node": "16.18.96", - "esbuild": "0.20.2", + "@types/node": "16.18.97", + "esbuild": "0.21.4", "prisma": "/tmp/prisma-0.0.0.tgz" } } diff --git a/packages/client/tests/e2e/enum-import-in-edge/package.json b/packages/client/tests/e2e/enum-import-in-edge/package.json index 08ab8e67f98a..edc0436a95e8 100644 --- a/packages/client/tests/e2e/enum-import-in-edge/package.json +++ b/packages/client/tests/e2e/enum-import-in-edge/package.json @@ -5,11 +5,11 @@ "scripts": {}, "dependencies": { "@prisma/client": "/tmp/prisma-client-0.0.0.tgz", - "wrangler": "3.53.0" + "wrangler": "3.57.2" }, "devDependencies": { "@types/jest": "29.5.12", - "@types/node": "16.18.96", + "@types/node": "16.18.97", "prisma": "/tmp/prisma-0.0.0.tgz" } } diff --git a/packages/client/tests/e2e/example/package.json b/packages/client/tests/e2e/example/package.json index 49c325db8582..7fc177afc43e 100644 --- a/packages/client/tests/e2e/example/package.json +++ b/packages/client/tests/e2e/example/package.json @@ -8,7 +8,7 @@ }, "devDependencies": { "@types/jest": "29.5.12", - "@types/node": "16.18.96", + "@types/node": "16.18.97", "prisma": "/tmp/prisma-0.0.0.tgz" } } diff --git a/packages/client/tests/e2e/generator-config-types/package.json b/packages/client/tests/e2e/generator-config-types/package.json index 884a2a6fb872..61fcffcc9897 100644 --- a/packages/client/tests/e2e/generator-config-types/package.json +++ b/packages/client/tests/e2e/generator-config-types/package.json @@ -7,7 +7,7 @@ "@prisma/generator-helper": "/tmp/prisma-generator-helper-0.0.0.tgz" }, "devDependencies": { - "@types/node": "16.18.96", + "@types/node": "16.18.97", "expect-type": "0.19.0", "prisma": "/tmp/prisma-0.0.0.tgz" } diff --git a/packages/client/tests/e2e/invalid-package-version/package.json b/packages/client/tests/e2e/invalid-package-version/package.json index ad2f57327f33..72d1c86fbfc8 100644 --- a/packages/client/tests/e2e/invalid-package-version/package.json +++ b/packages/client/tests/e2e/invalid-package-version/package.json @@ -8,7 +8,7 @@ }, "devDependencies": { "@types/jest": "29.5.12", - "@types/node": "16.18.96", + "@types/node": "16.18.97", "prisma": "/tmp/prisma-0.0.0.tgz" } } diff --git a/packages/client/tests/e2e/issues/16600-tsc-crash-extensions/package.json b/packages/client/tests/e2e/issues/16600-tsc-crash-extensions/package.json index 7c02940e660c..c8474b04dc7a 100644 --- a/packages/client/tests/e2e/issues/16600-tsc-crash-extensions/package.json +++ b/packages/client/tests/e2e/issues/16600-tsc-crash-extensions/package.json @@ -7,7 +7,7 @@ "@prisma/client": "/tmp/prisma-client-0.0.0.tgz" }, "devDependencies": { - "@types/node": "16.18.96", + "@types/node": "16.18.97", "prisma": "/tmp/prisma-0.0.0.tgz" } } diff --git a/packages/client/tests/e2e/issues/19866-ts-composite-declaration/package.json b/packages/client/tests/e2e/issues/19866-ts-composite-declaration/package.json index 6ba2c03cc404..cd6eccea36c8 100644 --- a/packages/client/tests/e2e/issues/19866-ts-composite-declaration/package.json +++ b/packages/client/tests/e2e/issues/19866-ts-composite-declaration/package.json @@ -8,7 +8,7 @@ "typescript": "5.4.5" }, "devDependencies": { - "@types/node": "16.18.96", + "@types/node": "16.18.97", "prisma": "/tmp/prisma-0.0.0.tgz" } } diff --git a/packages/client/tests/e2e/issues/19999-tsc-extensions-oom/package.json b/packages/client/tests/e2e/issues/19999-tsc-extensions-oom/package.json index 62ffb0a4ca31..7a67397d28ed 100644 --- a/packages/client/tests/e2e/issues/19999-tsc-extensions-oom/package.json +++ b/packages/client/tests/e2e/issues/19999-tsc-extensions-oom/package.json @@ -7,7 +7,7 @@ "@prisma/client": "/tmp/prisma-client-0.0.0.tgz" }, "devDependencies": { - "@types/node": "16.18.96", + "@types/node": "16.18.97", "prisma": "/tmp/prisma-0.0.0.tgz", "typescript": "5.4.5" } diff --git a/packages/client/tests/e2e/mongodb-notablescan/package.json b/packages/client/tests/e2e/mongodb-notablescan/package.json index 49c325db8582..7fc177afc43e 100644 --- a/packages/client/tests/e2e/mongodb-notablescan/package.json +++ b/packages/client/tests/e2e/mongodb-notablescan/package.json @@ -8,7 +8,7 @@ }, "devDependencies": { "@types/jest": "29.5.12", - "@types/node": "16.18.96", + "@types/node": "16.18.97", "prisma": "/tmp/prisma-0.0.0.tgz" } } diff --git a/packages/client/tests/e2e/nextjs-schema-not-found/10_monorepo-serverComponents-customOutput-noReExport/packages/service/package.json b/packages/client/tests/e2e/nextjs-schema-not-found/10_monorepo-serverComponents-customOutput-noReExport/packages/service/package.json index 60873e257626..50c109ae743a 100644 --- a/packages/client/tests/e2e/nextjs-schema-not-found/10_monorepo-serverComponents-customOutput-noReExport/packages/service/package.json +++ b/packages/client/tests/e2e/nextjs-schema-not-found/10_monorepo-serverComponents-customOutput-noReExport/packages/service/package.json @@ -12,8 +12,8 @@ "author": "", "license": "ISC", "devDependencies": { - "@types/node": "18.19.31", - "@types/react": "18.3.1", + "@types/node": "18.19.33", + "@types/react": "18.3.3", "prisma": "/tmp/prisma-0.0.0.tgz" }, "dependencies": { diff --git a/packages/client/tests/e2e/nextjs-schema-not-found/11_monorepo-noServerComponents-noCustomOutput-reExportIndirect/packages/db/package.json b/packages/client/tests/e2e/nextjs-schema-not-found/11_monorepo-noServerComponents-noCustomOutput-reExportIndirect/packages/db/package.json index 7bfdd2d60604..97eed0b75a90 100644 --- a/packages/client/tests/e2e/nextjs-schema-not-found/11_monorepo-noServerComponents-noCustomOutput-reExportIndirect/packages/db/package.json +++ b/packages/client/tests/e2e/nextjs-schema-not-found/11_monorepo-noServerComponents-noCustomOutput-reExportIndirect/packages/db/package.json @@ -9,7 +9,7 @@ "author": "", "license": "ISC", "devDependencies": { - "@types/node": "18.19.31", + "@types/node": "18.19.33", "prisma": "/tmp/prisma-0.0.0.tgz" }, "dependencies": { diff --git a/packages/client/tests/e2e/nextjs-schema-not-found/11_monorepo-noServerComponents-noCustomOutput-reExportIndirect/packages/service/package.json b/packages/client/tests/e2e/nextjs-schema-not-found/11_monorepo-noServerComponents-noCustomOutput-reExportIndirect/packages/service/package.json index c7062498878a..915fdf704113 100644 --- a/packages/client/tests/e2e/nextjs-schema-not-found/11_monorepo-noServerComponents-noCustomOutput-reExportIndirect/packages/service/package.json +++ b/packages/client/tests/e2e/nextjs-schema-not-found/11_monorepo-noServerComponents-noCustomOutput-reExportIndirect/packages/service/package.json @@ -12,8 +12,8 @@ "author": "", "license": "ISC", "devDependencies": { - "@types/node": "18.19.31", - "@types/react": "18.3.1", + "@types/node": "18.19.33", + "@types/react": "18.3.3", "@prisma/nextjs-monorepo-workaround-plugin": "/tmp/prisma-nextjs-monorepo-workaround-plugin-0.0.0.tgz", "webpack": "5.91.0" }, diff --git a/packages/client/tests/e2e/nextjs-schema-not-found/12_monorepo-serverComponents-noCustomOutput-reExportIndirect/packages/db/package.json b/packages/client/tests/e2e/nextjs-schema-not-found/12_monorepo-serverComponents-noCustomOutput-reExportIndirect/packages/db/package.json index 6540ab256da6..ea5eeeb0e141 100644 --- a/packages/client/tests/e2e/nextjs-schema-not-found/12_monorepo-serverComponents-noCustomOutput-reExportIndirect/packages/db/package.json +++ b/packages/client/tests/e2e/nextjs-schema-not-found/12_monorepo-serverComponents-noCustomOutput-reExportIndirect/packages/db/package.json @@ -7,7 +7,7 @@ "author": "", "license": "ISC", "devDependencies": { - "@types/node": "18.19.31", + "@types/node": "18.19.33", "prisma": "/tmp/prisma-0.0.0.tgz" }, "dependencies": { diff --git a/packages/client/tests/e2e/nextjs-schema-not-found/12_monorepo-serverComponents-noCustomOutput-reExportIndirect/packages/service/package.json b/packages/client/tests/e2e/nextjs-schema-not-found/12_monorepo-serverComponents-noCustomOutput-reExportIndirect/packages/service/package.json index 878a2c81befe..88192c152d46 100644 --- a/packages/client/tests/e2e/nextjs-schema-not-found/12_monorepo-serverComponents-noCustomOutput-reExportIndirect/packages/service/package.json +++ b/packages/client/tests/e2e/nextjs-schema-not-found/12_monorepo-serverComponents-noCustomOutput-reExportIndirect/packages/service/package.json @@ -12,8 +12,8 @@ "author": "", "license": "ISC", "devDependencies": { - "@types/node": "18.19.31", - "@types/react": "18.3.1", + "@types/node": "18.19.33", + "@types/react": "18.3.3", "@prisma/nextjs-monorepo-workaround-plugin": "/tmp/prisma-nextjs-monorepo-workaround-plugin-0.0.0.tgz" }, "dependencies": { diff --git a/packages/client/tests/e2e/nextjs-schema-not-found/13_monorepo-noServerComponents-customOutput-reExportDirect/packages/service/package.json b/packages/client/tests/e2e/nextjs-schema-not-found/13_monorepo-noServerComponents-customOutput-reExportDirect/packages/service/package.json index 5e72b88488d7..eb2051155c99 100644 --- a/packages/client/tests/e2e/nextjs-schema-not-found/13_monorepo-noServerComponents-customOutput-reExportDirect/packages/service/package.json +++ b/packages/client/tests/e2e/nextjs-schema-not-found/13_monorepo-noServerComponents-customOutput-reExportDirect/packages/service/package.json @@ -12,8 +12,8 @@ "author": "", "license": "ISC", "devDependencies": { - "@types/node": "18.19.31", - "@types/react": "18.3.1", + "@types/node": "18.19.33", + "@types/react": "18.3.3", "@prisma/nextjs-monorepo-workaround-plugin": "/tmp/prisma-nextjs-monorepo-workaround-plugin-0.0.0.tgz" }, "dependencies": { diff --git a/packages/client/tests/e2e/nextjs-schema-not-found/14_monorepo-serverComponents-customOutput-reExportDirect/packages/service/package.json b/packages/client/tests/e2e/nextjs-schema-not-found/14_monorepo-serverComponents-customOutput-reExportDirect/packages/service/package.json index 5e72b88488d7..eb2051155c99 100644 --- a/packages/client/tests/e2e/nextjs-schema-not-found/14_monorepo-serverComponents-customOutput-reExportDirect/packages/service/package.json +++ b/packages/client/tests/e2e/nextjs-schema-not-found/14_monorepo-serverComponents-customOutput-reExportDirect/packages/service/package.json @@ -12,8 +12,8 @@ "author": "", "license": "ISC", "devDependencies": { - "@types/node": "18.19.31", - "@types/react": "18.3.1", + "@types/node": "18.19.33", + "@types/react": "18.3.3", "@prisma/nextjs-monorepo-workaround-plugin": "/tmp/prisma-nextjs-monorepo-workaround-plugin-0.0.0.tgz" }, "dependencies": { diff --git a/packages/client/tests/e2e/nextjs-schema-not-found/15_monorepo-noServerComponents-customOutput-reExportIndirect/packages/db/package.json b/packages/client/tests/e2e/nextjs-schema-not-found/15_monorepo-noServerComponents-customOutput-reExportIndirect/packages/db/package.json index 7bfdd2d60604..97eed0b75a90 100644 --- a/packages/client/tests/e2e/nextjs-schema-not-found/15_monorepo-noServerComponents-customOutput-reExportIndirect/packages/db/package.json +++ b/packages/client/tests/e2e/nextjs-schema-not-found/15_monorepo-noServerComponents-customOutput-reExportIndirect/packages/db/package.json @@ -9,7 +9,7 @@ "author": "", "license": "ISC", "devDependencies": { - "@types/node": "18.19.31", + "@types/node": "18.19.33", "prisma": "/tmp/prisma-0.0.0.tgz" }, "dependencies": { diff --git a/packages/client/tests/e2e/nextjs-schema-not-found/15_monorepo-noServerComponents-customOutput-reExportIndirect/packages/service/package.json b/packages/client/tests/e2e/nextjs-schema-not-found/15_monorepo-noServerComponents-customOutput-reExportIndirect/packages/service/package.json index c7062498878a..915fdf704113 100644 --- a/packages/client/tests/e2e/nextjs-schema-not-found/15_monorepo-noServerComponents-customOutput-reExportIndirect/packages/service/package.json +++ b/packages/client/tests/e2e/nextjs-schema-not-found/15_monorepo-noServerComponents-customOutput-reExportIndirect/packages/service/package.json @@ -12,8 +12,8 @@ "author": "", "license": "ISC", "devDependencies": { - "@types/node": "18.19.31", - "@types/react": "18.3.1", + "@types/node": "18.19.33", + "@types/react": "18.3.3", "@prisma/nextjs-monorepo-workaround-plugin": "/tmp/prisma-nextjs-monorepo-workaround-plugin-0.0.0.tgz", "webpack": "5.91.0" }, diff --git a/packages/client/tests/e2e/nextjs-schema-not-found/16_monorepo-serverComponents-customOutput-reExportIndirect/packages/db/package.json b/packages/client/tests/e2e/nextjs-schema-not-found/16_monorepo-serverComponents-customOutput-reExportIndirect/packages/db/package.json index 6540ab256da6..ea5eeeb0e141 100644 --- a/packages/client/tests/e2e/nextjs-schema-not-found/16_monorepo-serverComponents-customOutput-reExportIndirect/packages/db/package.json +++ b/packages/client/tests/e2e/nextjs-schema-not-found/16_monorepo-serverComponents-customOutput-reExportIndirect/packages/db/package.json @@ -7,7 +7,7 @@ "author": "", "license": "ISC", "devDependencies": { - "@types/node": "18.19.31", + "@types/node": "18.19.33", "prisma": "/tmp/prisma-0.0.0.tgz" }, "dependencies": { diff --git a/packages/client/tests/e2e/nextjs-schema-not-found/16_monorepo-serverComponents-customOutput-reExportIndirect/packages/service/package.json b/packages/client/tests/e2e/nextjs-schema-not-found/16_monorepo-serverComponents-customOutput-reExportIndirect/packages/service/package.json index 878a2c81befe..88192c152d46 100644 --- a/packages/client/tests/e2e/nextjs-schema-not-found/16_monorepo-serverComponents-customOutput-reExportIndirect/packages/service/package.json +++ b/packages/client/tests/e2e/nextjs-schema-not-found/16_monorepo-serverComponents-customOutput-reExportIndirect/packages/service/package.json @@ -12,8 +12,8 @@ "author": "", "license": "ISC", "devDependencies": { - "@types/node": "18.19.31", - "@types/react": "18.3.1", + "@types/node": "18.19.33", + "@types/react": "18.3.3", "@prisma/nextjs-monorepo-workaround-plugin": "/tmp/prisma-nextjs-monorepo-workaround-plugin-0.0.0.tgz" }, "dependencies": { diff --git a/packages/client/tests/e2e/nextjs-schema-not-found/17_monorepo-noServerComponents-customOutput-reExportIndirect-ts/packages/db/package.json b/packages/client/tests/e2e/nextjs-schema-not-found/17_monorepo-noServerComponents-customOutput-reExportIndirect-ts/packages/db/package.json index 1a9fc750f1ae..6cebf715bfc4 100644 --- a/packages/client/tests/e2e/nextjs-schema-not-found/17_monorepo-noServerComponents-customOutput-reExportIndirect-ts/packages/db/package.json +++ b/packages/client/tests/e2e/nextjs-schema-not-found/17_monorepo-noServerComponents-customOutput-reExportIndirect-ts/packages/db/package.json @@ -9,7 +9,7 @@ "author": "", "license": "ISC", "devDependencies": { - "@types/node": "18.19.31", + "@types/node": "18.19.33", "prisma": "/tmp/prisma-0.0.0.tgz" }, "dependencies": { diff --git a/packages/client/tests/e2e/nextjs-schema-not-found/17_monorepo-noServerComponents-customOutput-reExportIndirect-ts/packages/service/package.json b/packages/client/tests/e2e/nextjs-schema-not-found/17_monorepo-noServerComponents-customOutput-reExportIndirect-ts/packages/service/package.json index c7062498878a..915fdf704113 100644 --- a/packages/client/tests/e2e/nextjs-schema-not-found/17_monorepo-noServerComponents-customOutput-reExportIndirect-ts/packages/service/package.json +++ b/packages/client/tests/e2e/nextjs-schema-not-found/17_monorepo-noServerComponents-customOutput-reExportIndirect-ts/packages/service/package.json @@ -12,8 +12,8 @@ "author": "", "license": "ISC", "devDependencies": { - "@types/node": "18.19.31", - "@types/react": "18.3.1", + "@types/node": "18.19.33", + "@types/react": "18.3.3", "@prisma/nextjs-monorepo-workaround-plugin": "/tmp/prisma-nextjs-monorepo-workaround-plugin-0.0.0.tgz", "webpack": "5.91.0" }, diff --git a/packages/client/tests/e2e/nextjs-schema-not-found/18_monorepo-serverComponents-customOutput-reExportIndirect-ts/packages/db/package.json b/packages/client/tests/e2e/nextjs-schema-not-found/18_monorepo-serverComponents-customOutput-reExportIndirect-ts/packages/db/package.json index 041e60b62fae..fd7d27eebe40 100644 --- a/packages/client/tests/e2e/nextjs-schema-not-found/18_monorepo-serverComponents-customOutput-reExportIndirect-ts/packages/db/package.json +++ b/packages/client/tests/e2e/nextjs-schema-not-found/18_monorepo-serverComponents-customOutput-reExportIndirect-ts/packages/db/package.json @@ -7,7 +7,7 @@ "author": "", "license": "ISC", "devDependencies": { - "@types/node": "18.19.31", + "@types/node": "18.19.33", "prisma": "/tmp/prisma-0.0.0.tgz" }, "dependencies": { diff --git a/packages/client/tests/e2e/nextjs-schema-not-found/18_monorepo-serverComponents-customOutput-reExportIndirect-ts/packages/service/package.json b/packages/client/tests/e2e/nextjs-schema-not-found/18_monorepo-serverComponents-customOutput-reExportIndirect-ts/packages/service/package.json index 878a2c81befe..88192c152d46 100644 --- a/packages/client/tests/e2e/nextjs-schema-not-found/18_monorepo-serverComponents-customOutput-reExportIndirect-ts/packages/service/package.json +++ b/packages/client/tests/e2e/nextjs-schema-not-found/18_monorepo-serverComponents-customOutput-reExportIndirect-ts/packages/service/package.json @@ -12,8 +12,8 @@ "author": "", "license": "ISC", "devDependencies": { - "@types/node": "18.19.31", - "@types/react": "18.3.1", + "@types/node": "18.19.33", + "@types/react": "18.3.3", "@prisma/nextjs-monorepo-workaround-plugin": "/tmp/prisma-nextjs-monorepo-workaround-plugin-0.0.0.tgz" }, "dependencies": { diff --git a/packages/client/tests/e2e/nextjs-schema-not-found/3_simplerepo-noServerComponents-noCustomOutput-noReExport/package.json b/packages/client/tests/e2e/nextjs-schema-not-found/3_simplerepo-noServerComponents-noCustomOutput-noReExport/package.json index 60873e257626..50c109ae743a 100644 --- a/packages/client/tests/e2e/nextjs-schema-not-found/3_simplerepo-noServerComponents-noCustomOutput-noReExport/package.json +++ b/packages/client/tests/e2e/nextjs-schema-not-found/3_simplerepo-noServerComponents-noCustomOutput-noReExport/package.json @@ -12,8 +12,8 @@ "author": "", "license": "ISC", "devDependencies": { - "@types/node": "18.19.31", - "@types/react": "18.3.1", + "@types/node": "18.19.33", + "@types/react": "18.3.3", "prisma": "/tmp/prisma-0.0.0.tgz" }, "dependencies": { diff --git a/packages/client/tests/e2e/nextjs-schema-not-found/4_simplerepo-serverComponents-noCustomOutput-noReExport/package.json b/packages/client/tests/e2e/nextjs-schema-not-found/4_simplerepo-serverComponents-noCustomOutput-noReExport/package.json index 60873e257626..50c109ae743a 100644 --- a/packages/client/tests/e2e/nextjs-schema-not-found/4_simplerepo-serverComponents-noCustomOutput-noReExport/package.json +++ b/packages/client/tests/e2e/nextjs-schema-not-found/4_simplerepo-serverComponents-noCustomOutput-noReExport/package.json @@ -12,8 +12,8 @@ "author": "", "license": "ISC", "devDependencies": { - "@types/node": "18.19.31", - "@types/react": "18.3.1", + "@types/node": "18.19.33", + "@types/react": "18.3.3", "prisma": "/tmp/prisma-0.0.0.tgz" }, "dependencies": { diff --git a/packages/client/tests/e2e/nextjs-schema-not-found/5_simplerepo-noServerComponents-customOutput-noReExport/package.json b/packages/client/tests/e2e/nextjs-schema-not-found/5_simplerepo-noServerComponents-customOutput-noReExport/package.json index 60873e257626..50c109ae743a 100644 --- a/packages/client/tests/e2e/nextjs-schema-not-found/5_simplerepo-noServerComponents-customOutput-noReExport/package.json +++ b/packages/client/tests/e2e/nextjs-schema-not-found/5_simplerepo-noServerComponents-customOutput-noReExport/package.json @@ -12,8 +12,8 @@ "author": "", "license": "ISC", "devDependencies": { - "@types/node": "18.19.31", - "@types/react": "18.3.1", + "@types/node": "18.19.33", + "@types/react": "18.3.3", "prisma": "/tmp/prisma-0.0.0.tgz" }, "dependencies": { diff --git a/packages/client/tests/e2e/nextjs-schema-not-found/6_simplerepo-serverComponents-customOutput-noReExport/package.json b/packages/client/tests/e2e/nextjs-schema-not-found/6_simplerepo-serverComponents-customOutput-noReExport/package.json index 60873e257626..50c109ae743a 100644 --- a/packages/client/tests/e2e/nextjs-schema-not-found/6_simplerepo-serverComponents-customOutput-noReExport/package.json +++ b/packages/client/tests/e2e/nextjs-schema-not-found/6_simplerepo-serverComponents-customOutput-noReExport/package.json @@ -12,8 +12,8 @@ "author": "", "license": "ISC", "devDependencies": { - "@types/node": "18.19.31", - "@types/react": "18.3.1", + "@types/node": "18.19.33", + "@types/react": "18.3.3", "prisma": "/tmp/prisma-0.0.0.tgz" }, "dependencies": { diff --git a/packages/client/tests/e2e/nextjs-schema-not-found/7_monorepo-noServerComponents-noCustomOutput-noReExport/packages/service/package.json b/packages/client/tests/e2e/nextjs-schema-not-found/7_monorepo-noServerComponents-noCustomOutput-noReExport/packages/service/package.json index 60873e257626..50c109ae743a 100644 --- a/packages/client/tests/e2e/nextjs-schema-not-found/7_monorepo-noServerComponents-noCustomOutput-noReExport/packages/service/package.json +++ b/packages/client/tests/e2e/nextjs-schema-not-found/7_monorepo-noServerComponents-noCustomOutput-noReExport/packages/service/package.json @@ -12,8 +12,8 @@ "author": "", "license": "ISC", "devDependencies": { - "@types/node": "18.19.31", - "@types/react": "18.3.1", + "@types/node": "18.19.33", + "@types/react": "18.3.3", "prisma": "/tmp/prisma-0.0.0.tgz" }, "dependencies": { diff --git a/packages/client/tests/e2e/nextjs-schema-not-found/8_monorepo-serverComponents-noCustomOutput-noReExport/packages/service/package.json b/packages/client/tests/e2e/nextjs-schema-not-found/8_monorepo-serverComponents-noCustomOutput-noReExport/packages/service/package.json index 60873e257626..50c109ae743a 100644 --- a/packages/client/tests/e2e/nextjs-schema-not-found/8_monorepo-serverComponents-noCustomOutput-noReExport/packages/service/package.json +++ b/packages/client/tests/e2e/nextjs-schema-not-found/8_monorepo-serverComponents-noCustomOutput-noReExport/packages/service/package.json @@ -12,8 +12,8 @@ "author": "", "license": "ISC", "devDependencies": { - "@types/node": "18.19.31", - "@types/react": "18.3.1", + "@types/node": "18.19.33", + "@types/react": "18.3.3", "prisma": "/tmp/prisma-0.0.0.tgz" }, "dependencies": { diff --git a/packages/client/tests/e2e/nextjs-schema-not-found/9_monorepo-noServerComponents-customOutput-noReExport/packages/service/package.json b/packages/client/tests/e2e/nextjs-schema-not-found/9_monorepo-noServerComponents-customOutput-noReExport/packages/service/package.json index 60873e257626..50c109ae743a 100644 --- a/packages/client/tests/e2e/nextjs-schema-not-found/9_monorepo-noServerComponents-customOutput-noReExport/packages/service/package.json +++ b/packages/client/tests/e2e/nextjs-schema-not-found/9_monorepo-noServerComponents-customOutput-noReExport/packages/service/package.json @@ -12,8 +12,8 @@ "author": "", "license": "ISC", "devDependencies": { - "@types/node": "18.19.31", - "@types/react": "18.3.1", + "@types/node": "18.19.33", + "@types/react": "18.3.3", "prisma": "/tmp/prisma-0.0.0.tgz" }, "dependencies": { diff --git a/packages/client/tests/e2e/noengine-file-deletion/package.json b/packages/client/tests/e2e/noengine-file-deletion/package.json index 49c325db8582..7fc177afc43e 100644 --- a/packages/client/tests/e2e/noengine-file-deletion/package.json +++ b/packages/client/tests/e2e/noengine-file-deletion/package.json @@ -8,7 +8,7 @@ }, "devDependencies": { "@types/jest": "29.5.12", - "@types/node": "16.18.96", + "@types/node": "16.18.97", "prisma": "/tmp/prisma-0.0.0.tgz" } } diff --git a/packages/client/tests/e2e/output-location-warning/package.json b/packages/client/tests/e2e/output-location-warning/package.json index 5b9bfb1fe92b..d2762c11b78c 100644 --- a/packages/client/tests/e2e/output-location-warning/package.json +++ b/packages/client/tests/e2e/output-location-warning/package.json @@ -11,7 +11,7 @@ }, "devDependencies": { "@types/jest": "29.5.12", - "@types/node": "16.18.96", + "@types/node": "16.18.97", "jest": "29.7.0", "prisma": "/tmp/prisma-0.0.0.tgz" } diff --git a/packages/client/tests/e2e/pg-self-signed-cert-error/package.json b/packages/client/tests/e2e/pg-self-signed-cert-error/package.json index abd48faaa37d..a1312cc461d0 100644 --- a/packages/client/tests/e2e/pg-self-signed-cert-error/package.json +++ b/packages/client/tests/e2e/pg-self-signed-cert-error/package.json @@ -10,7 +10,7 @@ }, "devDependencies": { "@types/jest": "29.5.12", - "@types/node": "16.18.96", + "@types/node": "16.18.97", "prisma": "/tmp/prisma-0.0.0.tgz" } } diff --git a/packages/client/tests/e2e/platform-caching-error/package.json b/packages/client/tests/e2e/platform-caching-error/package.json index 7c02940e660c..c8474b04dc7a 100644 --- a/packages/client/tests/e2e/platform-caching-error/package.json +++ b/packages/client/tests/e2e/platform-caching-error/package.json @@ -7,7 +7,7 @@ "@prisma/client": "/tmp/prisma-client-0.0.0.tgz" }, "devDependencies": { - "@types/node": "16.18.96", + "@types/node": "16.18.97", "prisma": "/tmp/prisma-0.0.0.tgz" } } diff --git a/packages/client/tests/e2e/prisma-client-imports/package.json b/packages/client/tests/e2e/prisma-client-imports/package.json index 478eb3662bc5..4eef0780ea55 100644 --- a/packages/client/tests/e2e/prisma-client-imports/package.json +++ b/packages/client/tests/e2e/prisma-client-imports/package.json @@ -6,8 +6,8 @@ "test": "jest --verbose" }, "dependencies": { - "@cloudflare/workers-types": "4.20240512.0", - "@libsql/client": "0.6.0", + "@cloudflare/workers-types": "4.20240524.0", + "@libsql/client": "0.6.1", "@neondatabase/serverless": "0.9.3", "@planetscale/database": "1.18.0", "@prisma/adapter-d1": "/tmp/prisma-adapter-d1-0.0.0.tgz", @@ -17,7 +17,7 @@ "@prisma/adapter-pg-worker": "/tmp/prisma-adapter-pg-worker-0.0.0.tgz", "@prisma/adapter-planetscale": "/tmp/prisma-adapter-planetscale-0.0.0.tgz", "@prisma/client": "/tmp/prisma-client-0.0.0.tgz", - "@prisma/extension-accelerate": "1.0.0", + "@prisma/extension-accelerate": "1.1.0", "@prisma/extension-read-replicas": "0.3.0", "@prisma/pg-worker": "/tmp/prisma-pg-worker-0.0.0.tgz", "db": "link:custom", @@ -26,8 +26,8 @@ }, "devDependencies": { "@types/jest": "29.5.12", - "@types/node": "16.18.96", - "@types/pg": "8.11.5", + "@types/node": "16.18.97", + "@types/pg": "8.11.6", "@types/ws": "8.5.10", "jest": "29.7.0", "prisma": "/tmp/prisma-0.0.0.tgz", diff --git a/packages/client/tests/e2e/publish-extensions/package.json b/packages/client/tests/e2e/publish-extensions/package.json index 77f59927f878..953bbb491a42 100644 --- a/packages/client/tests/e2e/publish-extensions/package.json +++ b/packages/client/tests/e2e/publish-extensions/package.json @@ -9,7 +9,7 @@ }, "devDependencies": { "@types/jest": "29.5.12", - "@types/node": "16.18.96", + "@types/node": "16.18.97", "prisma": "/tmp/prisma-0.0.0.tgz" } } diff --git a/packages/client/tests/e2e/require-in-the-middle/package.json b/packages/client/tests/e2e/require-in-the-middle/package.json index 19614af5d16a..18c2e246a1f7 100644 --- a/packages/client/tests/e2e/require-in-the-middle/package.json +++ b/packages/client/tests/e2e/require-in-the-middle/package.json @@ -9,7 +9,7 @@ }, "devDependencies": { "@types/jest": "29.5.12", - "@types/node": "16.18.96", + "@types/node": "16.18.97", "prisma": "/tmp/prisma-0.0.0.tgz" } } diff --git a/packages/client/tests/e2e/runtimes/data-proxy-custom-output/package.json b/packages/client/tests/e2e/runtimes/data-proxy-custom-output/package.json index 30d766b1837f..a803c6adf037 100644 --- a/packages/client/tests/e2e/runtimes/data-proxy-custom-output/package.json +++ b/packages/client/tests/e2e/runtimes/data-proxy-custom-output/package.json @@ -7,7 +7,7 @@ "@prisma/client": "/tmp/prisma-client-0.0.0.tgz" }, "devDependencies": { - "@types/node": "16.18.96", + "@types/node": "16.18.97", "prisma": "/tmp/prisma-0.0.0.tgz", "expect-type": "0.19.0" } diff --git a/packages/client/tests/e2e/schema-not-found-sst-electron/package.json b/packages/client/tests/e2e/schema-not-found-sst-electron/package.json index 5758687ee8e4..06d508b0a485 100644 --- a/packages/client/tests/e2e/schema-not-found-sst-electron/package.json +++ b/packages/client/tests/e2e/schema-not-found-sst-electron/package.json @@ -7,7 +7,7 @@ "@prisma/client": "/tmp/prisma-client-0.0.0.tgz" }, "devDependencies": { - "@types/node": "16.18.96", + "@types/node": "16.18.97", "esbuild": "latest", "prisma": "/tmp/prisma-0.0.0.tgz" } diff --git a/packages/client/tests/e2e/ts-version/4.7/package.json b/packages/client/tests/e2e/ts-version/4.7/package.json index 5f49fed106e1..59b566647346 100644 --- a/packages/client/tests/e2e/ts-version/4.7/package.json +++ b/packages/client/tests/e2e/ts-version/4.7/package.json @@ -8,7 +8,7 @@ }, "devDependencies": { "@types/jest": "29.5.12", - "@types/node": "16.18.96", + "@types/node": "16.18.97", "prisma": "/tmp/prisma-0.0.0.tgz", "typescript": "4.7.4" } diff --git a/packages/client/tests/e2e/ts-version/4.8/package.json b/packages/client/tests/e2e/ts-version/4.8/package.json index ae6afc0e14fe..e6ade20f1082 100644 --- a/packages/client/tests/e2e/ts-version/4.8/package.json +++ b/packages/client/tests/e2e/ts-version/4.8/package.json @@ -8,7 +8,7 @@ }, "devDependencies": { "@types/jest": "29.5.12", - "@types/node": "16.18.96", + "@types/node": "16.18.97", "prisma": "/tmp/prisma-0.0.0.tgz", "typescript": "4.8.4" } diff --git a/packages/client/tests/e2e/ts-version/4.9/package.json b/packages/client/tests/e2e/ts-version/4.9/package.json index 282c62abb368..7432331e19c8 100644 --- a/packages/client/tests/e2e/ts-version/4.9/package.json +++ b/packages/client/tests/e2e/ts-version/4.9/package.json @@ -8,7 +8,7 @@ }, "devDependencies": { "@types/jest": "29.5.12", - "@types/node": "16.18.96", + "@types/node": "16.18.97", "prisma": "/tmp/prisma-0.0.0.tgz", "typescript": "4.9.5" } diff --git a/packages/client/tests/e2e/ts-version/5.0/package.json b/packages/client/tests/e2e/ts-version/5.0/package.json index 81dc6da54b45..313bac7a71f7 100644 --- a/packages/client/tests/e2e/ts-version/5.0/package.json +++ b/packages/client/tests/e2e/ts-version/5.0/package.json @@ -8,7 +8,7 @@ }, "devDependencies": { "@types/jest": "29.5.12", - "@types/node": "16.18.96", + "@types/node": "16.18.97", "prisma": "/tmp/prisma-0.0.0.tgz", "typescript": "5.0.4" } diff --git a/packages/client/tests/e2e/ts-version/5.1/package.json b/packages/client/tests/e2e/ts-version/5.1/package.json index b2592ccba622..eec6655fd005 100644 --- a/packages/client/tests/e2e/ts-version/5.1/package.json +++ b/packages/client/tests/e2e/ts-version/5.1/package.json @@ -8,7 +8,7 @@ }, "devDependencies": { "@types/jest": "29.5.12", - "@types/node": "16.18.96", + "@types/node": "16.18.97", "prisma": "/tmp/prisma-0.0.0.tgz", "typescript": "5.1.6" } diff --git a/packages/client/tests/e2e/ts-version/5.2/package.json b/packages/client/tests/e2e/ts-version/5.2/package.json index 8058eb1ce45c..def4cb246aa6 100644 --- a/packages/client/tests/e2e/ts-version/5.2/package.json +++ b/packages/client/tests/e2e/ts-version/5.2/package.json @@ -8,7 +8,7 @@ }, "devDependencies": { "@types/jest": "29.5.12", - "@types/node": "16.18.96", + "@types/node": "16.18.97", "prisma": "/tmp/prisma-0.0.0.tgz", "typescript": "5.2.2" } diff --git a/packages/client/tests/e2e/ts-version/5.3/package.json b/packages/client/tests/e2e/ts-version/5.3/package.json index a6d2d71210fe..07f89a993f6c 100644 --- a/packages/client/tests/e2e/ts-version/5.3/package.json +++ b/packages/client/tests/e2e/ts-version/5.3/package.json @@ -8,7 +8,7 @@ }, "devDependencies": { "@types/jest": "29.5.12", - "@types/node": "16.18.96", + "@types/node": "16.18.97", "prisma": "/tmp/prisma-0.0.0.tgz", "typescript": "5.3.3" } diff --git a/packages/client/tests/e2e/ts-version/5.4/package.json b/packages/client/tests/e2e/ts-version/5.4/package.json index 505e69868eb1..8e44885549b8 100644 --- a/packages/client/tests/e2e/ts-version/5.4/package.json +++ b/packages/client/tests/e2e/ts-version/5.4/package.json @@ -8,7 +8,7 @@ }, "devDependencies": { "@types/jest": "29.5.12", - "@types/node": "16.18.96", + "@types/node": "16.18.97", "prisma": "/tmp/prisma-0.0.0.tgz", "typescript": "5.4.5" } diff --git a/packages/client/tests/e2e/ts-version/beta/package.json b/packages/client/tests/e2e/ts-version/beta/package.json index 87bd0deffb4e..28a4ecaa217f 100644 --- a/packages/client/tests/e2e/ts-version/beta/package.json +++ b/packages/client/tests/e2e/ts-version/beta/package.json @@ -8,7 +8,7 @@ }, "devDependencies": { "@types/jest": "29.5.12", - "@types/node": "16.18.96", + "@types/node": "16.18.97", "prisma": "/tmp/prisma-0.0.0.tgz", "typescript": "beta" } diff --git a/packages/client/tests/e2e/ts-version/latest/package.json b/packages/client/tests/e2e/ts-version/latest/package.json index 3bf64f3a96b9..022ea6275d85 100644 --- a/packages/client/tests/e2e/ts-version/latest/package.json +++ b/packages/client/tests/e2e/ts-version/latest/package.json @@ -8,7 +8,7 @@ }, "devDependencies": { "@types/jest": "29.5.12", - "@types/node": "16.18.96", + "@types/node": "16.18.97", "prisma": "/tmp/prisma-0.0.0.tgz", "typescript": "latest" } diff --git a/packages/client/tests/e2e/ts-version/next/package.json b/packages/client/tests/e2e/ts-version/next/package.json index a77fd2b513fd..4324daddee12 100644 --- a/packages/client/tests/e2e/ts-version/next/package.json +++ b/packages/client/tests/e2e/ts-version/next/package.json @@ -8,7 +8,7 @@ }, "devDependencies": { "@types/jest": "29.5.12", - "@types/node": "16.18.96", + "@types/node": "16.18.97", "prisma": "/tmp/prisma-0.0.0.tgz", "typescript": "next" } diff --git a/packages/client/tests/e2e/unsupported-browser-error/package.json b/packages/client/tests/e2e/unsupported-browser-error/package.json index 25c8f189fbaa..996b8fc53a63 100644 --- a/packages/client/tests/e2e/unsupported-browser-error/package.json +++ b/packages/client/tests/e2e/unsupported-browser-error/package.json @@ -8,9 +8,9 @@ }, "devDependencies": { "@types/jest": "29.5.12", - "@types/node": "16.18.96", - "esbuild": "0.20.2", + "@types/node": "16.18.97", + "esbuild": "0.21.4", "prisma": "/tmp/prisma-0.0.0.tgz", - "wrangler": "3.53.0" + "wrangler": "3.57.2" } } diff --git a/packages/client/tests/e2e/unsupported-edge-error/package.json b/packages/client/tests/e2e/unsupported-edge-error/package.json index 5ae7a2d8af42..4c3665dab885 100644 --- a/packages/client/tests/e2e/unsupported-edge-error/package.json +++ b/packages/client/tests/e2e/unsupported-edge-error/package.json @@ -8,8 +8,8 @@ }, "devDependencies": { "@types/jest": "29.5.12", - "@types/node": "16.18.96", + "@types/node": "16.18.97", "prisma": "/tmp/prisma-0.0.0.tgz", - "wrangler": "3.53.0" + "wrangler": "3.57.2" } } diff --git a/packages/client/tests/functional/methods/createManyAndReturn-supported/tests.ts b/packages/client/tests/functional/methods/createManyAndReturn-supported/tests.ts index 2788344c545e..4d0137895a41 100644 --- a/packages/client/tests/functional/methods/createManyAndReturn-supported/tests.ts +++ b/packages/client/tests/functional/methods/createManyAndReturn-supported/tests.ts @@ -133,6 +133,114 @@ testMatrix.setupTestSuite( }, ]) }) + + test('should fail include on the user side', async () => { + const email1 = faker.internet.email() + + await expect( + prisma.user.createManyAndReturn({ + // @ts-expect-error + include: { + posts: true, + }, + data: [ + { + email: email1, + }, + ], + }), + ).rejects.toThrow('Unknown field `posts` for include statement on model `CreateManyUserAndReturnOutputType`.') + }) + + test('take should fail', async () => { + const email1 = faker.internet.email() + + await expect( + prisma.user.createManyAndReturn({ + // @ts-expect-error + take: 1, + data: [ + { + email: email1, + }, + ], + }), + ).rejects.toThrow('Unknown argument `take`') + }) + + test('orderBy should fail', async () => { + const email1 = faker.internet.email() + + await expect( + prisma.user.createManyAndReturn({ + // @ts-expect-error + orderBy: { + email: 'asc', + }, + data: [ + { + email: email1, + }, + ], + }), + ).rejects.toThrow('Unknown argument `orderBy`.') + }) + + test('distinct should fail', async () => { + const email1 = faker.internet.email() + + await expect( + prisma.user.createManyAndReturn({ + // @ts-expect-error + distinct: 'id', + data: [ + { + email: email1, + }, + ], + }), + ).rejects.toThrow('Unknown argument `distinct`.') + }) + + test('select _count should fail', async () => { + const email1 = faker.internet.email() + + await expect( + prisma.user.createManyAndReturn({ + select: { + // @ts-expect-error + _count: true, + }, + data: [ + { + email: email1, + }, + ], + }), + ).rejects.toThrow( + 'Unknown field `_count` for select statement on model `CreateManyUserAndReturnOutputType`. Available options are marked with ?.', + ) + }) + + test('include _count should fail', async () => { + const email1 = faker.internet.email() + + await expect( + prisma.user.createManyAndReturn({ + // @ts-expect-error + include: { + _count: true, + }, + data: [ + { + email: email1, + }, + ], + }), + ).rejects.toThrow( + 'Unknown field `_count` for include statement on model `CreateManyUserAndReturnOutputType`. Available options are marked with ?.', + ) + }) }, { skipDriverAdapter: { diff --git a/packages/client/tests/functional/postgres_raw_query_parameter_types/_matrix.ts b/packages/client/tests/functional/postgres_raw_query_parameter_types/_matrix.ts new file mode 100644 index 000000000000..ed3154c1aa61 --- /dev/null +++ b/packages/client/tests/functional/postgres_raw_query_parameter_types/_matrix.ts @@ -0,0 +1,4 @@ +import { defineMatrix } from '../_utils/defineMatrix' +import { Providers } from '../_utils/providers' + +export default defineMatrix(() => [[{ provider: Providers.POSTGRESQL }]]) diff --git a/packages/client/tests/functional/postgres_raw_query_parameter_types/prisma/_schema.ts b/packages/client/tests/functional/postgres_raw_query_parameter_types/prisma/_schema.ts new file mode 100644 index 000000000000..793a5a81df3d --- /dev/null +++ b/packages/client/tests/functional/postgres_raw_query_parameter_types/prisma/_schema.ts @@ -0,0 +1,19 @@ +import { idForProvider } from '../../_utils/idForProvider' +import testMatrix from '../_matrix' + +export default testMatrix.setupSchema(({ provider }) => { + return /* Prisma */ ` + generator client { + provider = "prisma-client-js" + } + + datasource db { + provider = "${provider}" + url = env("DATABASE_URI_${provider}") + } + + model User { + id ${idForProvider(provider)} + } + ` +}) diff --git a/packages/client/tests/functional/postgres_raw_query_parameter_types/test.ts b/packages/client/tests/functional/postgres_raw_query_parameter_types/test.ts new file mode 100644 index 000000000000..d9891953f6fb --- /dev/null +++ b/packages/client/tests/functional/postgres_raw_query_parameter_types/test.ts @@ -0,0 +1,36 @@ +import { Providers } from '../_utils/providers' +import testMatrix from './_matrix' +// @ts-ignore +import type { PrismaClient } from './node_modules/@prisma/client' + +declare let prisma: PrismaClient + +testMatrix.setupTestSuite( + (_suiteConfig, _suiteMeta) => { + test('$queryRaw works with different parameter types', async () => { + // Previously, there was a bug in how prepared statement caching was implemented. + // Parameter types were disregarded, resulting in the prepared statement with the + // wrong parameter types to be picked. + // Below, we issue two queries with identical SQL text which have different + // parameter types - integer vs decimal. If prepared statement cache does not respect + // parameter types, same prepared statement will be picked for both, resulting in a + // type mismatch error from Postgres. + // Issues which were affected by this bug include: + // - https://github.com/prisma/prisma/issues/22482 + // - https://github.com/prisma/prisma/issues/16611 + // - https://github.com/prisma/prisma/issues/23872 + // - https://github.com/prisma/prisma/issues/17110 + await prisma.$queryRaw`select * from version() where LENGTH("version") > ${1}` + await prisma.$queryRaw`select * from version() where LENGTH("version") > ${1.1}` + }) + }, + { + optOut: { + // if you are skipping tests for certain providers, you + // have to list them here and specify the reason + from: [Providers.MONGODB, Providers.COCKROACHDB, Providers.MYSQL, Providers.SQLITE, Providers.SQLSERVER], + reason: 'Test exercises specific bug with Postgres prepared statement caching.', + }, + skipDriverAdapter: { from: ['js_pg', 'js_neon'], reason: 'https://github.com/prisma/team-orm/issues/1159' }, + }, +) diff --git a/packages/client/tests/functional/too-many-instances-of-prisma-client/tests.ts b/packages/client/tests/functional/too-many-instances-of-prisma-client/tests.ts index 693e2f4c7fcd..70b77e409ac0 100644 --- a/packages/client/tests/functional/too-many-instances-of-prisma-client/tests.ts +++ b/packages/client/tests/functional/too-many-instances-of-prisma-client/tests.ts @@ -8,7 +8,7 @@ declare let newPrismaClient: NewPrismaClient const TIMEOUT = 60_000 testMatrix.setupTestSuite( - () => { + ({ clientRuntime }) => { const oldConsoleWarn = console.warn const warnings: any[] = [] @@ -24,7 +24,7 @@ testMatrix.setupTestSuite( console.warn = oldConsoleWarn }) - test( + testIf(clientRuntime !== 'wasm')( 'should console warn when spawning too many instances of PrismaClient', async () => { for (let i = 0; i < 15; i++) { @@ -38,6 +38,19 @@ testMatrix.setupTestSuite( }, TIMEOUT, ) + + testIf(clientRuntime === 'wasm')( + 'should not console warn when spawning too many instances of PrismaClient', + async () => { + for (let i = 0; i < 15; i++) { + const client = newPrismaClient() + await client.$connect() + } + + expect(warnings.join('')).toMatchInlineSnapshot(`""`) + }, + TIMEOUT, + ) }, { skipDataProxy: { diff --git a/packages/client/tests/functional/tracing-disabled/tests.ts b/packages/client/tests/functional/tracing-disabled/tests.ts index 2f289a1bcfc6..9f4b389f5563 100644 --- a/packages/client/tests/functional/tracing-disabled/tests.ts +++ b/packages/client/tests/functional/tracing-disabled/tests.ts @@ -2,7 +2,7 @@ import { context } from '@opentelemetry/api' import { AsyncHooksContextManager } from '@opentelemetry/context-async-hooks' import { Resource } from '@opentelemetry/resources' import { BasicTracerProvider, InMemorySpanExporter, SimpleSpanProcessor } from '@opentelemetry/sdk-trace-base' -import { SemanticResourceAttributes } from '@opentelemetry/semantic-conventions' +import { SEMRESATTRS_SERVICE_NAME, SEMRESATTRS_SERVICE_VERSION } from '@opentelemetry/semantic-conventions' import testMatrix from './_matrix' // @ts-ignore @@ -20,8 +20,8 @@ beforeAll(() => { const basicTracerProvider = new BasicTracerProvider({ resource: new Resource({ - [SemanticResourceAttributes.SERVICE_NAME]: `test-name`, - [SemanticResourceAttributes.SERVICE_VERSION]: '1.0.0', + [SEMRESATTRS_SERVICE_NAME]: 'test-name', + [SEMRESATTRS_SERVICE_VERSION]: '1.0.0', }), }) diff --git a/packages/client/tests/functional/tracing-no-sampling/tests.ts b/packages/client/tests/functional/tracing-no-sampling/tests.ts index 2ae9525d06ea..6c49862c00cb 100644 --- a/packages/client/tests/functional/tracing-no-sampling/tests.ts +++ b/packages/client/tests/functional/tracing-no-sampling/tests.ts @@ -8,7 +8,7 @@ import { SimpleSpanProcessor, TraceIdRatioBasedSampler, } from '@opentelemetry/sdk-trace-base' -import { SemanticResourceAttributes } from '@opentelemetry/semantic-conventions' +import { SEMRESATTRS_SERVICE_NAME, SEMRESATTRS_SERVICE_VERSION } from '@opentelemetry/semantic-conventions' import { PrismaInstrumentation } from '@prisma/instrumentation' import { NewPrismaClient } from '../_utils/types' @@ -30,8 +30,8 @@ beforeAll(() => { const basicTracerProvider = new BasicTracerProvider({ sampler: new TraceIdRatioBasedSampler(0), // 0% sampling!! resource: new Resource({ - [SemanticResourceAttributes.SERVICE_NAME]: `test-name`, - [SemanticResourceAttributes.SERVICE_VERSION]: '1.0.0', + [SEMRESATTRS_SERVICE_NAME]: 'test-name', + [SEMRESATTRS_SERVICE_VERSION]: '1.0.0', }), }) diff --git a/packages/client/tests/functional/tracing/tests.ts b/packages/client/tests/functional/tracing/tests.ts index 7ae402336015..5d81a604e446 100644 --- a/packages/client/tests/functional/tracing/tests.ts +++ b/packages/client/tests/functional/tracing/tests.ts @@ -10,7 +10,7 @@ import { SimpleSpanProcessor, SpanProcessor, } from '@opentelemetry/sdk-trace-base' -import { SemanticResourceAttributes } from '@opentelemetry/semantic-conventions' +import { SEMRESATTRS_SERVICE_NAME, SEMRESATTRS_SERVICE_VERSION } from '@opentelemetry/semantic-conventions' import { PrismaInstrumentation } from '@prisma/instrumentation' import { ClientEngineType } from '@prisma/internals' @@ -66,8 +66,8 @@ beforeAll(() => { const basicTracerProvider = new BasicTracerProvider({ resource: new Resource({ - [SemanticResourceAttributes.SERVICE_NAME]: `test-name`, - [SemanticResourceAttributes.SERVICE_VERSION]: '1.0.0', + [SEMRESATTRS_SERVICE_NAME]: 'test-name', + [SEMRESATTRS_SERVICE_VERSION]: '1.0.0', }), }) diff --git a/packages/debug/package.json b/packages/debug/package.json index 217c85353e75..600681d1e657 100644 --- a/packages/debug/package.json +++ b/packages/debug/package.json @@ -16,7 +16,7 @@ "devDependencies": { "@types/jest": "29.5.12", "@types/node": "18.19.31", - "esbuild": "0.21.2", + "esbuild": "0.21.4", "jest": "29.7.0", "jest-junit": "16.0.0", "strip-ansi": "6.0.1", diff --git a/packages/driver-adapter-utils/src/const.ts b/packages/driver-adapter-utils/src/const.ts index 94fd5712ce38..16cbcbb18707 100644 --- a/packages/driver-adapter-utils/src/const.ts +++ b/packages/driver-adapter-utils/src/const.ts @@ -41,8 +41,3 @@ export const ColumnTypeEnum = { // Custom UnknownNumber: 128, } as const - -// This string value paired with `ColumnType.Json` will be treated as JSON `null` -// when convering to a quaint value. This is to work around JS/JSON null values -// already being used to represent database NULLs. -export const JsonNullMarker = '$__prisma_null' diff --git a/packages/driver-adapter-utils/src/index.ts b/packages/driver-adapter-utils/src/index.ts index 465cfb94cbff..a2eb187438f9 100644 --- a/packages/driver-adapter-utils/src/index.ts +++ b/packages/driver-adapter-utils/src/index.ts @@ -1,5 +1,5 @@ export { bindAdapter } from './binder' -export { ColumnTypeEnum, JsonNullMarker } from './const' +export { ColumnTypeEnum } from './const' export { Debug } from './debug' export { err, ok, type Result } from './result' export type * from './types' diff --git a/packages/engines/package.json b/packages/engines/package.json index 4316b27d21e5..102ffbf652b9 100644 --- a/packages/engines/package.json +++ b/packages/engines/package.json @@ -12,7 +12,7 @@ "license": "Apache-2.0", "author": "Tim Suchanek ", "devDependencies": { - "@swc/core": "1.5.3", + "@swc/core": "1.5.7", "@swc/jest": "0.2.36", "@types/jest": "29.5.12", "@types/node": "18.19.31", @@ -22,7 +22,7 @@ }, "dependencies": { "@prisma/debug": "workspace:*", - "@prisma/engines-version": "5.15.0-7.0af42cb19116c37b029e1f3665681074acb38bb4", + "@prisma/engines-version": "5.15.0-24.9ee43833e58f4ec014ce0f45b6ae27ee7e0165fc", "@prisma/fetch-engine": "workspace:*", "@prisma/get-platform": "workspace:*" }, diff --git a/packages/fetch-engine/package.json b/packages/fetch-engine/package.json index c382f6ad8255..06eb73bba920 100644 --- a/packages/fetch-engine/package.json +++ b/packages/fetch-engine/package.json @@ -15,7 +15,7 @@ "bugs": "https://github.com/prisma/prisma/issues", "enginesOverride": {}, "devDependencies": { - "@swc/core": "1.5.3", + "@swc/core": "1.5.7", "@swc/jest": "0.2.36", "@types/jest": "29.5.12", "@types/node": "18.19.31", @@ -43,7 +43,7 @@ }, "dependencies": { "@prisma/debug": "workspace:*", - "@prisma/engines-version": "5.15.0-7.0af42cb19116c37b029e1f3665681074acb38bb4", + "@prisma/engines-version": "5.15.0-24.9ee43833e58f4ec014ce0f45b6ae27ee7e0165fc", "@prisma/get-platform": "workspace:*" }, "scripts": { diff --git a/packages/generator-helper/package.json b/packages/generator-helper/package.json index 9bf3b0b16d56..47fdc001bd95 100644 --- a/packages/generator-helper/package.json +++ b/packages/generator-helper/package.json @@ -25,11 +25,11 @@ }, "devDependencies": { "@swc-node/register": "1.9.1", - "@swc/core": "1.5.3", + "@swc/core": "1.5.7", "@swc/jest": "0.2.36", "@types/jest": "29.5.12", "@types/node": "18.19.31", - "esbuild": "0.21.2", + "esbuild": "0.21.4", "jest": "29.7.0", "jest-junit": "16.0.0", "ts-node": "10.9.2", diff --git a/packages/get-platform/package.json b/packages/get-platform/package.json index e46e47ee28f3..af3fc757c80f 100644 --- a/packages/get-platform/package.json +++ b/packages/get-platform/package.json @@ -15,7 +15,7 @@ "bugs": "https://github.com/prisma/prisma/issues", "devDependencies": { "@codspeed/benchmark.js-plugin": "3.1.0", - "@swc/core": "1.5.3", + "@swc/core": "1.5.7", "@swc/jest": "0.2.36", "@types/jest": "29.5.12", "@types/node": "18.19.31", @@ -31,7 +31,7 @@ "strip-ansi": "6.0.1", "tempy": "1.0.1", "terminal-link": "2.1.1", - "ts-pattern": "5.1.1" + "ts-pattern": "5.1.2" }, "dependencies": { "@prisma/debug": "workspace:*" diff --git a/packages/get-platform/src/test-utils/index.ts b/packages/get-platform/src/test-utils/index.ts index 225823889f61..2c8d82e5d2ac 100644 --- a/packages/get-platform/src/test-utils/index.ts +++ b/packages/get-platform/src/test-utils/index.ts @@ -1 +1 @@ -export { jestConsoleContext, jestContext, jestProcessContext } from './jestContext' +export { jestConsoleContext, jestContext, jestProcessContext, type BaseContext } from './jestContext' diff --git a/packages/get-platform/src/test-utils/jestContext.ts b/packages/get-platform/src/test-utils/jestContext.ts index 22c19d422c93..6e75849437d5 100644 --- a/packages/get-platform/src/test-utils/jestContext.ts +++ b/packages/get-platform/src/test-utils/jestContext.ts @@ -8,7 +8,7 @@ import tempy from 'tempy' /** * Base test context. */ -type BaseContext = { +export type BaseContext = { tmpDir: string fs: FSJetpack mocked: { diff --git a/packages/instrumentation/README.md b/packages/instrumentation/README.md index 0346921a7137..547d030e77a4 100644 --- a/packages/instrumentation/README.md +++ b/packages/instrumentation/README.md @@ -44,7 +44,7 @@ import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http' import { registerInstrumentations } from '@opentelemetry/instrumentation' import { Resource } from '@opentelemetry/resources' import { BasicTracerProvider, SimpleSpanProcessor } from '@opentelemetry/sdk-trace-base' -import { SemanticResourceAttributes } from '@opentelemetry/semantic-conventions' +import { SEMRESATTRS_SERVICE_NAME, SEMRESATTRS_SERVICE_VERSION } from '@opentelemetry/semantic-conventions' import { PrismaInstrumentation } from '@prisma/instrumentation' import { PrismaClient } from '.prisma/client' @@ -57,8 +57,8 @@ const otlpTraceExporter = new OTLPTraceExporter() const provider = new BasicTracerProvider({ resource: new Resource({ - [SemanticResourceAttributes.SERVICE_NAME]: 'test-tracing-service', - [SemanticResourceAttributes.SERVICE_VERSION]: '1.0.0', + [SEMRESATTRS_SERVICE_NAME]: 'test-tracing-service', + [SEMRESATTRS_SERVICE_VERSION]: '1.0.0', }), }) diff --git a/packages/instrumentation/package.json b/packages/instrumentation/package.json index d57454b6e9f9..ab9f32102366 100644 --- a/packages/instrumentation/package.json +++ b/packages/instrumentation/package.json @@ -14,7 +14,7 @@ "bugs": "https://github.com/prisma/prisma/issues", "devDependencies": { "@prisma/internals": "workspace:*", - "@swc/core": "1.5.3", + "@swc/core": "1.5.7", "@types/jest": "29.5.12", "@types/node": "18.19.31", "jest": "29.7.0", diff --git a/packages/integration-tests/package.json b/packages/integration-tests/package.json index bc520607b269..b2304f735402 100644 --- a/packages/integration-tests/package.json +++ b/packages/integration-tests/package.json @@ -16,15 +16,15 @@ "@prisma/internals": "workspace:*", "@prisma/migrate": "workspace:*", "@sindresorhus/slugify": "1.1.2", - "@swc/core": "1.5.3", + "@swc/core": "1.5.7", "@swc/jest": "0.2.36", "@types/jest": "29.5.12", "@types/mssql": "9.1.5", "@types/node": "18.19.31", - "@types/pg": "8.11.5", + "@types/pg": "8.11.6", "@types/sqlite3": "3.1.11", "decimal.js": "10.4.3", - "esbuild": "0.21.2", + "esbuild": "0.21.4", "execa": "5.1.1", "fs-jetpack": "5.1.0", "jest": "29.7.0", diff --git a/packages/integration-tests/src/__tests__/__helpers__/integrationTest.ts b/packages/integration-tests/src/__tests__/__helpers__/integrationTest.ts index 98c9bc533ca2..28f53d1c89db 100644 --- a/packages/integration-tests/src/__tests__/__helpers__/integrationTest.ts +++ b/packages/integration-tests/src/__tests__/__helpers__/integrationTest.ts @@ -304,7 +304,11 @@ async function setupScenario(kind: string, input: Input, scenario: Scenario) { const engine = new SchemaEngine({ projectDir: process.cwd(), }) - const introspectionResult = await engine.introspect({ schema: schemaBase }) + const introspectionResult = await engine.introspect({ + schema: { + files: [{ path: 'schema.prisma', content: schemaBase }], + }, + }) const prismaSchemaPath = ctx.fs.path('schema.prisma') diff --git a/packages/internals/package.json b/packages/internals/package.json index fc1bc83b9c17..a985cf708653 100644 --- a/packages/internals/package.json +++ b/packages/internals/package.json @@ -38,12 +38,12 @@ "checkpoint-client": "1.1.33", "cli-truncate": "2.1.0", "dotenv": "16.0.3", - "esbuild": "0.21.2", + "esbuild": "0.21.4", "escape-string-regexp": "4.0.0", "execa": "5.1.1", "fast-glob": "3.3.2", "find-up": "5.0.0", - "fp-ts": "2.16.5", + "fp-ts": "2.16.6", "fs-extra": "11.1.1", "fs-jetpack": "5.1.0", "global-dirs": "4.0.0", @@ -71,7 +71,7 @@ "terminal-link": "2.1.1", "tmp": "0.2.3", "ts-node": "10.9.2", - "ts-pattern": "5.1.1", + "ts-pattern": "5.1.2", "typescript": "5.4.5", "yarn": "1.22.22" }, @@ -81,7 +81,7 @@ "@prisma/fetch-engine": "workspace:*", "@prisma/generator-helper": "workspace:*", "@prisma/get-platform": "workspace:*", - "@prisma/prisma-schema-wasm": "5.15.0-7.0af42cb19116c37b029e1f3665681074acb38bb4", + "@prisma/prisma-schema-wasm": "5.15.0-24.9ee43833e58f4ec014ce0f45b6ae27ee7e0165fc", "@prisma/schema-files-loader": "workspace:*", "arg": "5.0.2", "prompts": "2.4.2" diff --git a/packages/internals/src/__tests__/getSchema.test.ts b/packages/internals/src/__tests__/getSchema.test.ts index 3448867fd967..c4b2c9d1db9b 100644 --- a/packages/internals/src/__tests__/getSchema.test.ts +++ b/packages/internals/src/__tests__/getSchema.test.ts @@ -1,6 +1,6 @@ import path from 'path' -import { getSchemaPathInternal, getSchemaPathSyncInternal } from '../cli/getSchema' +import { getSchemaWithPathInternal } from '../cli/getSchema' import { fixturesPath } from './__utils__/fixtures' if (process.env.CI) { @@ -20,21 +20,12 @@ function toUnixPath(path: string) { async function testSchemaPath(fixtureName: string, schemaPathFromArgs?: string) { const cwd = path.resolve(FIXTURE_CWD, fixtureName) - let syncResult: string | null | Error let asyncResult: string | null | Error - try { - syncResult = getSchemaPathSyncInternal(schemaPathFromArgs, { - cwd, - }) - } catch (e) { - syncResult = e as Error - } - try { asyncResult = ( - await getSchemaPathInternal(schemaPathFromArgs, { + await getSchemaWithPathInternal(schemaPathFromArgs, { cwd, }) )?.schemaPath ?? null @@ -42,40 +33,21 @@ async function testSchemaPath(fixtureName: string, schemaPathFromArgs?: string) asyncResult = e as Error } - /** - * Make paths relatives to enable snapshot testing on any machines - */ - if (typeof syncResult === 'string') { - syncResult = toUnixPath(path.relative('.', syncResult)) - } - if (typeof asyncResult === 'string') { asyncResult = toUnixPath(path.relative('.', asyncResult)) } - if (syncResult instanceof Error) { - syncResult.message = toUnixPath(syncResult.message.replace(__dirname, '.')) - } - if (asyncResult instanceof Error) { asyncResult.message = toUnixPath(asyncResult.message.replace(__dirname, '.')) } - return { - sync: syncResult, - async: asyncResult, - } + return asyncResult } it('returns null if no schema is found', async () => { const res = await testSchemaPath('no-schema') - expect(res).toMatchInlineSnapshot(` - { - "async": null, - "sync": null, - } - `) + expect(res).toMatchInlineSnapshot(`null`) }) it('reads from --schema args first even if package.json is provided', async () => { @@ -84,98 +56,61 @@ it('reads from --schema args first even if package.json is provided', async () = path.resolve(FIXTURE_CWD, 'pkg-json-with-schema-args', 'schema.prisma'), ) - expect(res).toMatchInlineSnapshot(` - { - "async": "src/__tests__/__fixtures__/getSchema/pkg-json-with-schema-args/schema.prisma", - "sync": "src/__tests__/__fixtures__/getSchema/pkg-json-with-schema-args/schema.prisma", - } - `) + expect(res).toMatchInlineSnapshot(`"src/__tests__/__fixtures__/getSchema/pkg-json-with-schema-args/schema.prisma"`) }) it('throws if schema args path is invalid', async () => { const res = await testSchemaPath('pkg-json-with-schema-args', path.resolve(FIXTURE_CWD, 'wrong_path')) - expect(res).toMatchInlineSnapshot(` - { - "async": [Error: Provided --schema at ./__fixtures__/getSchema/wrong_path doesn't exist.], - "sync": [Error: Provided --schema at ./__fixtures__/getSchema/wrong_path doesn't exist.], - } - `) + expect(res).toMatchInlineSnapshot(`[Error: Provided --schema at ./__fixtures__/getSchema/wrong_path doesn't exist.]`) }) it('reads relative schema path from the nearest package.json', async () => { const res = await testSchemaPath('pkg-json-valid-relative-path') - expect(res).toMatchInlineSnapshot(` - { - "async": "src/__tests__/__fixtures__/getSchema/pkg-json-valid-relative-path/db/schema.prisma", - "sync": "src/__tests__/__fixtures__/getSchema/pkg-json-valid-relative-path/db/schema.prisma", - } - `) + expect(res).toMatchInlineSnapshot( + `"src/__tests__/__fixtures__/getSchema/pkg-json-valid-relative-path/db/schema.prisma"`, + ) }) it('reads schema path from the nearest package.json and throws if path does not exist', async () => { const res = await testSchemaPath('pkg-json-invalid-path') - expect(res).toMatchInlineSnapshot(` - { - "async": [Error: Provided schema path \`wrong-path\` from \`package.json\` doesn't exist.], - "sync": [Error: Provided schema path \`wrong-path\` from \`package.json\` doesn't exist.], - } - `) + expect(res).toMatchInlineSnapshot(`[Error: Provided schema path \`wrong-path\` from \`package.json\` doesn't exist.]`) }) it('reads schema path from the nearest package.json and throws if path is not of type string', async () => { const res = await testSchemaPath('pkg-json-invalid-path-not-string') - expect(res).toMatchInlineSnapshot(` - { - "async": [Error: Provided schema path \`123\` from \`package.json\` must be of type string], - "sync": [Error: Provided schema path \`123\` from \`package.json\` must be of type string], - } - `) + expect(res).toMatchInlineSnapshot( + `[Error: Provided schema path \`123\` from \`package.json\` must be of type string]`, + ) }) it('reads from the nearest package.json of the cwd', async () => { const res = await testSchemaPath('pkg-json-nearest/packages/a') - expect(res).toMatchInlineSnapshot(` - { - "async": "src/__tests__/__fixtures__/getSchema/pkg-json-nearest/packages/a/db/schema.prisma", - "sync": "src/__tests__/__fixtures__/getSchema/pkg-json-nearest/packages/a/db/schema.prisma", - } - `) + expect(res).toMatchInlineSnapshot( + `"src/__tests__/__fixtures__/getSchema/pkg-json-nearest/packages/a/db/schema.prisma"`, + ) }) it('finds the conventional prisma/schema path without configuration', async () => { const res = await testSchemaPath('conventional-path') - expect(res).toMatchInlineSnapshot(` - { - "async": "src/__tests__/__fixtures__/getSchema/conventional-path/prisma/schema.prisma", - "sync": "src/__tests__/__fixtures__/getSchema/conventional-path/prisma/schema.prisma", - } - `) + expect(res).toMatchInlineSnapshot(`"src/__tests__/__fixtures__/getSchema/conventional-path/prisma/schema.prisma"`) }) it('finds the schema path in the root package.json of a yarn workspace from a child package', async () => { const res = await testSchemaPath('pkg-json-workspace-parent/packages/a') - expect(res).toMatchInlineSnapshot(` - { - "async": "src/__tests__/__fixtures__/getSchema/pkg-json-workspace-parent/db/schema.prisma", - "sync": "src/__tests__/__fixtures__/getSchema/pkg-json-workspace-parent/db/schema.prisma", - } - `) + expect(res).toMatchInlineSnapshot(`"src/__tests__/__fixtures__/getSchema/pkg-json-workspace-parent/db/schema.prisma"`) }) it('finds the conventional schema path with yarn workspaces', async () => { const res = await testSchemaPath('conventional-path-workspaces') - expect(res).toMatchInlineSnapshot(` - { - "async": "src/__tests__/__fixtures__/getSchema/conventional-path-workspaces/packages/b/schema.prisma", - "sync": "src/__tests__/__fixtures__/getSchema/conventional-path-workspaces/packages/b/schema.prisma", - } - `) + expect(res).toMatchInlineSnapshot( + `"src/__tests__/__fixtures__/getSchema/conventional-path-workspaces/packages/b/schema.prisma"`, + ) }) diff --git a/packages/internals/src/__tests__/sendPanic.test.ts b/packages/internals/src/__tests__/sendPanic.test.ts index 3177c2287fd4..8bd907db0fa9 100644 --- a/packages/internals/src/__tests__/sendPanic.test.ts +++ b/packages/internals/src/__tests__/sendPanic.test.ts @@ -76,7 +76,7 @@ describe('sendPanic should fail when the error report creation fails', () => { ).rejects.toThrow(createErrorReportTag) expect(spyCreateErrorReport).toHaveBeenCalledTimes(1) expect(spyCreateErrorReport.mock.calls[0][0]).toMatchObject({ - schemaFile: expectedMaskedSchema, + schemaFile: expect.stringContaining(expectedMaskedSchema), rustStackTrace, cliVersion, }) @@ -102,7 +102,7 @@ datasource db { 'test-request', ErrorArea.LIFT_CLI, // area undefined, // schemaPath - schema, + [['schema.prisma', schema]], undefined, // introspectionUrl ) @@ -116,7 +116,7 @@ datasource db { ).rejects.toThrow(createErrorReportTag) expect(spyCreateErrorReport).toHaveBeenCalledTimes(1) expect(spyCreateErrorReport.mock.calls[0][0]).toMatchObject({ - schemaFile: maskedSchema, + schemaFile: expect.stringContaining(maskedSchema), rustStackTrace, cliVersion, }) diff --git a/packages/internals/src/cli/checkUnsupportedDataProxy.ts b/packages/internals/src/cli/checkUnsupportedDataProxy.ts index 82ead7193c29..25c13b859a98 100644 --- a/packages/internals/src/cli/checkUnsupportedDataProxy.ts +++ b/packages/internals/src/cli/checkUnsupportedDataProxy.ts @@ -2,7 +2,7 @@ import fs from 'fs' import { green } from 'kleur/colors' import { O } from 'ts-toolbelt' -import { getConfig, getEffectiveUrl, getSchemaPath, link } from '..' +import { getConfig, getEffectiveUrl, getSchemaWithPath, link } from '..' import { resolveUrl } from '../engine-commands/getConfig' import { loadEnvFile } from '../utils/loadEnvFile' @@ -45,7 +45,7 @@ async function checkUnsupportedDataProxyMessage(command: string, args: Args, imp // when the schema can be implicit, we use its default location if (implicitSchema === true) { // TODO: Why do we perform this mutation? - args['--schema'] = (await getSchemaPath(args['--schema']))?.schemaPath ?? undefined + args['--schema'] = (await getSchemaWithPath(args['--schema']))?.schemaPath ?? undefined } const argList = Object.entries(args) diff --git a/packages/internals/src/cli/getSchema.ts b/packages/internals/src/cli/getSchema.ts index 497b26162d58..0ba6d75d682a 100644 --- a/packages/internals/src/cli/getSchema.ts +++ b/packages/internals/src/cli/getSchema.ts @@ -24,19 +24,19 @@ export type GetSchemaResult = { * Async */ -export async function getSchemaPath(): Promise -export async function getSchemaPath(schemaPathFromArgs: string, opts?: { cwd: string }): Promise -export async function getSchemaPath( +export async function getSchemaWithPath(): Promise +export async function getSchemaWithPath(schemaPathFromArgs: string, opts?: { cwd: string }): Promise +export async function getSchemaWithPath( schemaPathFromArgs?: string, opts?: { cwd: string }, ): Promise -export async function getSchemaPath( +export async function getSchemaWithPath( schemaPathFromArgs?: string, opts: { cwd: string } = { cwd: process.cwd(), }, ) { - return getSchemaPathInternal(schemaPathFromArgs, { + return getSchemaWithPathInternal(schemaPathFromArgs, { cwd: opts.cwd, }) } @@ -70,15 +70,15 @@ async function readSchemaFromMultiFiles(schemaPath: string): Promise -export async function getSchemaPathInternal( +export async function getSchemaWithPathInternal( schemaPathFromArgs: string, opts?: { cwd: string }, ): Promise -export async function getSchemaPathInternal( +export async function getSchemaWithPathInternal( schemaPathFromArgs?: string, opts: { cwd: string } = { cwd: process.cwd(), @@ -248,52 +248,6 @@ async function resolveYarnSchema(cwd: string): Promise { return null } -function resolveYarnSchemaSync(cwd: string): string | null { - if (process.env.npm_config_user_agent?.includes('yarn')) { - try { - const { stdout: version } = execa.commandSync('yarn --version', { - cwd, - }) - - if (version.startsWith('2')) { - return null - } - - const { stdout } = execa.commandSync('yarn workspaces info --json', { - cwd, - }) - const json = getJson(stdout) - const workspaces = Object.values<{ location: string }>(json) - const workspaceRootDir = findWorkspaceRootSync(cwd) - - if (!workspaceRootDir) { - return null - } - - // Iterate over the workspaces - for (const workspace of workspaces) { - const workspacePath = path.join(workspaceRootDir, workspace.location) - const workspaceSchemaPath = - getSchemaPathFromPackageJsonSync(workspacePath) ?? getRelativeSchemaPathSync(workspacePath) - - if (workspaceSchemaPath) { - return workspaceSchemaPath - } - } - - const workspaceSchemaPathFromRoot = - getSchemaPathFromPackageJsonSync(workspaceRootDir) ?? getRelativeSchemaPathSync(workspaceRootDir) - - if (workspaceSchemaPathFromRoot) { - return workspaceSchemaPathFromRoot - } - } catch (e) { - return null - } - } - return null -} - async function getAbsoluteSchemaPath(schemaPath: string): Promise { if (await exists(schemaPath)) { return schemaPath @@ -329,7 +283,7 @@ export async function getSchemaDir(schemaPathFromArgs?: string): Promise { - const schemaPathResult = await getSchemaPath(schemaPathFromArgs) + const schemaPathResult = await getSchemaWithPath(schemaPathFromArgs) if (!schemaPathResult) { throw new Error( @@ -355,46 +309,6 @@ export async function getSchema(schemaPathFromArgs?: string): Promise { let pkgJson = await isNearestPkgJsonWorkspaceRoot(cwd) @@ -516,25 +409,3 @@ async function findWorkspaceRoot(cwd: string): Promise { return path.dirname(pkgJson.path) } - -function findWorkspaceRootSync(cwd: string): string | null { - let pkgJson = isNearestPkgJsonWorkspaceRootSync(cwd) - - if (!pkgJson) { - return null - } - - if (pkgJson.isRoot === true) { - return path.dirname(pkgJson.path) - } - - const pkgJsonParentDir = path.dirname(path.dirname(pkgJson.path)) - - pkgJson = isNearestPkgJsonWorkspaceRootSync(pkgJsonParentDir) - - if (!pkgJson || pkgJson.isRoot === false) { - return null - } - - return path.dirname(pkgJson.path) -} diff --git a/packages/internals/src/cli/hashes.ts b/packages/internals/src/cli/hashes.ts index 260d63ae31cd..968f67382766 100644 --- a/packages/internals/src/cli/hashes.ts +++ b/packages/internals/src/cli/hashes.ts @@ -1,6 +1,6 @@ import crypto from 'crypto' -import { getSchemaPath } from './getSchema' +import { getSchemaWithPath } from './getSchema' import { arg } from './utils' /** @@ -11,7 +11,7 @@ export async function getProjectHash(): Promise { const args = arg(process.argv.slice(3), { '--schema': String }) // Default to cwd if the schema couldn't be found - const projectPath = (await getSchemaPath(args['--schema']))?.schemaPath ?? process.cwd() + const projectPath = (await getSchemaWithPath(args['--schema']))?.schemaPath ?? process.cwd() return crypto.createHash('sha256').update(projectPath).digest('hex').substring(0, 8) } diff --git a/packages/internals/src/engine-commands/formatSchema.ts b/packages/internals/src/engine-commands/formatSchema.ts index 843e8120c4d4..5461dcae159d 100644 --- a/packages/internals/src/engine-commands/formatSchema.ts +++ b/packages/internals/src/engine-commands/formatSchema.ts @@ -2,7 +2,7 @@ import Debug from '@prisma/debug' import { logger } from '..' import { ErrorArea, getWasmError, RustPanic, WasmPanic } from '../panic' -import { debugMultipleSchemaPaths, debugMultipleSchemas, type MultipleSchemas } from '../utils/schemaFileInput' +import { debugMultipleSchemaPaths, type MultipleSchemas } from '../utils/schemaFileInput' import { prismaSchemaWasm } from '../wasm' import { getLintWarningsAsText, lintSchema } from './lintSchema' @@ -80,7 +80,7 @@ function handleFormatPanic(tryCb: () => T, { schemas }: FormatSchemaParams) { /* request */ '@prisma/prisma-schema-wasm format', ErrorArea.FMT_CLI, /* schemaPath */ debugMultipleSchemaPaths(schemas), - /* schema */ debugMultipleSchemas(schemas), + /* schema */ schemas, ) throw panic diff --git a/packages/internals/src/engine-commands/getConfig.ts b/packages/internals/src/engine-commands/getConfig.ts index 7c81aa10bfe4..a16840ce03a4 100644 --- a/packages/internals/src/engine-commands/getConfig.ts +++ b/packages/internals/src/engine-commands/getConfig.ts @@ -7,12 +7,24 @@ import { bold, red } from 'kleur/colors' import { match } from 'ts-pattern' import { ErrorArea, getWasmError, isWasmPanic, RustPanic, WasmPanic } from '../panic' -import { type SchemaFileInput, schemaToStringDebug } from '../utils/schemaFileInput' +import { type SchemaFileInput, toMultipleSchemas } from '../utils/schemaFileInput' import { prismaSchemaWasm } from '../wasm' import { addVersionDetailsToErrorMessage } from './errorHelpers' -import { createDebugErrorType, parseQueryEngineError, QueryEngineErrorInit } from './queryEngineCommons' +import { + createDebugErrorType, + createSchemaValidationError, + parseQueryEngineError, + QueryEngineErrorInit, +} from './queryEngineCommons' +import { relativizePathInPSLError } from './relativizePathInPSLError' const debug = Debug('prisma:getConfig') +const SCHEMA_VALIDATION_ERROR_CODE = 'P1012' + +export interface GetConfigResponse { + config: ConfigMetaFormat + errors: GetConfigValidationError[] +} export interface ConfigMetaFormat { datasources: DataSource[] | [] @@ -20,6 +32,11 @@ export interface ConfigMetaFormat { warnings: string[] | [] } +interface GetConfigValidationError { + fileName: string | null + message: string +} + export type GetConfigOptions = { datamodel: SchemaFileInput cwd?: string @@ -106,7 +123,7 @@ export async function getConfig(options: GetConfigOptions): Promise // NOTE: this should never fail, as we expect returned values to be valid JSON-serializable strings E.tryCatch( - () => JSON.parse(result) as ConfigMetaFormat, + () => JSON.parse(result) as GetConfigResponse, (e) => ({ type: 'parse-json' as const, reason: 'Unable to parse JSON', @@ -114,6 +131,16 @@ export async function getConfig(options: GetConfigOptions): Promise { + if (response.errors.length > 0) { + return E.left({ + type: 'validation-error' as const, + reason: '(get-config wasm)', + error: response.errors, + }) + } + return E.right(response.config) + }), ) if (E.isRight(configEither)) { @@ -146,7 +173,7 @@ export async function getConfig(options: GetConfigOptions): Promise { + return new GetConfigError({ + _tag: 'parsed', + errorCode: SCHEMA_VALIDATION_ERROR_CODE, + reason: createSchemaValidationError(e.reason), + message: formatErrors(e.error), + }) + }) .otherwise((e) => { debugErrorType(e) return new GetConfigError({ _tag: 'unparsed', message: e.error.message, reason: e.reason }) @@ -187,3 +222,9 @@ async function resolveBinaryTargets(generator: GeneratorConfig) { generator.binaryTargets = [{ fromEnvVar: null, value: await getBinaryTargetForCurrentPlatform(), native: true }] } } + +function formatErrors(errors: GetConfigValidationError[]) { + const formattedErrors = errors.map((e) => relativizePathInPSLError(e.message)).join('\n\n') + const errorCount = `Validation Error Count: ${errors.length}` + return `${formattedErrors}\n${errorCount}` +} diff --git a/packages/internals/src/engine-commands/getDmmf.ts b/packages/internals/src/engine-commands/getDmmf.ts index 275273b17067..2b4360be451a 100644 --- a/packages/internals/src/engine-commands/getDmmf.ts +++ b/packages/internals/src/engine-commands/getDmmf.ts @@ -8,7 +8,7 @@ import { blue, bold, red } from 'kleur/colors' import { match } from 'ts-pattern' import { ErrorArea, getWasmError, isWasmPanic, RustPanic, WasmPanic } from '../panic' -import { type SchemaFileInput, schemaToStringDebug } from '../utils/schemaFileInput' +import { type SchemaFileInput, toMultipleSchemas } from '../utils/schemaFileInput' import { prismaSchemaWasm } from '../wasm' import { addVersionDetailsToErrorMessage } from './errorHelpers' import { createDebugErrorType, parseQueryEngineError, QueryEngineErrorInit } from './queryEngineCommons' @@ -158,7 +158,7 @@ export async function getDMMF(options: GetDMMFOptions): Promise { /* request */ '@prisma/prisma-schema-wasm get_dmmf', ErrorArea.FMT_CLI, /* schemaPath */ options.prismaPath, - /* schema */ schemaToStringDebug(options.datamodel), + /* schema */ toMultipleSchemas(options.datamodel), ) return panic } diff --git a/packages/internals/src/engine-commands/lintSchema.ts b/packages/internals/src/engine-commands/lintSchema.ts index 72a3e600752a..5df609bd2781 100644 --- a/packages/internals/src/engine-commands/lintSchema.ts +++ b/packages/internals/src/engine-commands/lintSchema.ts @@ -1,7 +1,7 @@ import { yellow } from 'kleur/colors' import { ErrorArea, getWasmError, RustPanic, WasmPanic } from '../panic' -import { debugMultipleSchemaPaths, debugMultipleSchemas, type MultipleSchemas } from '../utils/schemaFileInput' +import { debugMultipleSchemaPaths, type MultipleSchemas } from '../utils/schemaFileInput' import { prismaSchemaWasm } from '../wasm' type LintSchemaParams = { schemas: MultipleSchemas } @@ -39,7 +39,7 @@ export function handleLintPanic(tryCb: () => T, { schemas }: LintSchemaParams /* request */ '@prisma/prisma-schema-wasm lint', ErrorArea.FMT_CLI, /* schemaPath */ debugMultipleSchemaPaths(schemas), - /* schema */ debugMultipleSchemas(schemas), + /* schema */ schemas, ) throw panic diff --git a/packages/internals/src/engine-commands/mergeSchemas.ts b/packages/internals/src/engine-commands/mergeSchemas.ts index 557e53d1089c..756ae9c53a74 100644 --- a/packages/internals/src/engine-commands/mergeSchemas.ts +++ b/packages/internals/src/engine-commands/mergeSchemas.ts @@ -5,7 +5,7 @@ import { bold, red } from 'kleur/colors' import { match } from 'ts-pattern' import { ErrorArea, getWasmError, isWasmPanic, RustPanic, WasmPanic } from '../panic' -import { debugMultipleSchemaPaths, debugMultipleSchemas, type MultipleSchemas } from '../utils/schemaFileInput' +import { debugMultipleSchemaPaths, type MultipleSchemas } from '../utils/schemaFileInput' import { prismaSchemaWasm } from '../wasm' import { addVersionDetailsToErrorMessage } from './errorHelpers' import { createDebugErrorType, parseQueryEngineError, QueryEngineErrorInit } from './queryEngineCommons' @@ -91,7 +91,7 @@ export function mergeSchemas(options: MergeSchemasOptions): string { /* request */ '@prisma/prisma-schema-wasm merge_schemas', ErrorArea.FMT_CLI, /* schemaPath */ debugMultipleSchemaPaths(options.schemas), - /* schema */ debugMultipleSchemas(options.schemas), + /* schema */ options.schemas, ) return panic } diff --git a/packages/internals/src/engine-commands/queryEngineCommons.ts b/packages/internals/src/engine-commands/queryEngineCommons.ts index 1c56cb49736f..faaa69c31f2c 100644 --- a/packages/internals/src/engine-commands/queryEngineCommons.ts +++ b/packages/internals/src/engine-commands/queryEngineCommons.ts @@ -30,7 +30,7 @@ export const createDebugErrorType = debug(`error of type "${type}" in ${fnName}:\n`, { reason, error }) } -function createSchemaValidationError(reason: string) { +export function createSchemaValidationError(reason: string) { return `${red(bold('Prisma schema validation'))} - ${reason}` } diff --git a/packages/internals/src/engine-commands/validate.ts b/packages/internals/src/engine-commands/validate.ts index 42722deee09b..4c266fcd6bf6 100644 --- a/packages/internals/src/engine-commands/validate.ts +++ b/packages/internals/src/engine-commands/validate.ts @@ -5,7 +5,7 @@ import { bold, red } from 'kleur/colors' import { match } from 'ts-pattern' import { ErrorArea, getWasmError, isWasmPanic, RustPanic, WasmPanic } from '../panic' -import { debugMultipleSchemaPaths, debugMultipleSchemas, type MultipleSchemas } from '../utils/schemaFileInput' +import { debugMultipleSchemaPaths, type MultipleSchemas } from '../utils/schemaFileInput' import { prismaSchemaWasm } from '../wasm' import { addVersionDetailsToErrorMessage } from './errorHelpers' import { createDebugErrorType, parseQueryEngineError, QueryEngineErrorInit } from './queryEngineCommons' @@ -102,7 +102,7 @@ export function validate(options: ValidateOptions): void { /* request */ '@prisma/prisma-schema-wasm validate', ErrorArea.FMT_CLI, /* schemaPath */ debugMultipleSchemaPaths(options.schemas), - /* schema */ debugMultipleSchemas(options.schemas), + /* schema */ options.schemas, ) return panic } diff --git a/packages/internals/src/get-generators/getGenerators.ts b/packages/internals/src/get-generators/getGenerators.ts index b26a8839dcda..b71185ae75a1 100644 --- a/packages/internals/src/get-generators/getGenerators.ts +++ b/packages/internals/src/get-generators/getGenerators.ts @@ -9,7 +9,7 @@ import { bold, gray, green, red, underline, yellow } from 'kleur/colors' import pMap from 'p-map' import path from 'path' -import { getConfig, getDMMF, getSchemaPath, GetSchemaResult, mergeSchemas, vercelPkgPathRegex } from '..' +import { getConfig, getDMMF, GetSchemaResult, getSchemaWithPath, mergeSchemas, vercelPkgPathRegex } from '..' import { Generator } from '../Generator' import { resolveOutput } from '../resolveOutput' import { extractPreviewFeatures } from '../utils/extractPreviewFeatures' @@ -86,7 +86,7 @@ export async function getGenerators(options: GetGeneratorOptions): Promise | Tagged<'Schema', SchemasContainer> + export type GetDatabaseVersionParams = { + datasource: MigrateTypes.DatasourceParam } - export type GetDatabaseVersionParams = - | { - datasource: SchemaContainer | UrlContainer | PathContainer - } - | undefined + // Helper type for creating tagged enum variants + export type Tagged = Display<{ tag: Tag } & T> + + // Helper to force TS to display the fields of computed types, rather than type name + // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents + export type Display = { [K in keyof T]: T[K] } & unknown } diff --git a/packages/internals/src/panic.ts b/packages/internals/src/panic.ts index cf0fe115045f..d67643e18d06 100644 --- a/packages/internals/src/panic.ts +++ b/packages/internals/src/panic.ts @@ -1,10 +1,12 @@ +import { MultipleSchemas } from './utils/schemaFileInput' + export class RustPanic extends Error { public readonly __typename = 'RustPanic' public request: any public rustStack: string public area: ErrorArea public schemaPath?: string - public schema?: string + public schema?: MultipleSchemas public introspectionUrl?: string constructor( message: string, @@ -12,7 +14,7 @@ export class RustPanic extends Error { request: any, area: ErrorArea, schemaPath?: string, - schema?: string, + schema?: MultipleSchemas, introspectionUrl?: string, ) { super(message) diff --git a/packages/internals/src/sendPanic.ts b/packages/internals/src/sendPanic.ts index 4fd8b5cead13..1ce2c8ab5473 100644 --- a/packages/internals/src/sendPanic.ts +++ b/packages/internals/src/sendPanic.ts @@ -9,6 +9,7 @@ import stripAnsi from 'strip-ansi' import tmp from 'tmp' import { match, P } from 'ts-pattern' +import { getSchema } from './cli/getSchema' import { createErrorReport, type CreateErrorReportInput, @@ -19,7 +20,9 @@ import { import type { MigrateTypes } from './migrateTypes' import type { RustPanic } from './panic' import { ErrorArea } from './panic' -import { mapScalarValues, maskSchema } from './utils/maskSchema' +import { mapScalarValues, maskSchema, maskSchemas } from './utils/maskSchema' +import { MultipleSchemas } from './utils/schemaFileInput' +import { toSchemasContainer } from './utils/toSchemasContainer' // cleanup the temporary files even when an uncaught exception occurs tmp.setGracefulCleanup() @@ -30,7 +33,7 @@ type SendPanic = { enginesVersion: string // retrieve the database version for the given schema or url, without throwing any error - getDatabaseVersionSafe: (args: MigrateTypes.GetDatabaseVersionParams) => Promise + getDatabaseVersionSafe: (args: MigrateTypes.GetDatabaseVersionParams | undefined) => Promise } export async function sendPanic({ error, @@ -38,14 +41,14 @@ export async function sendPanic({ enginesVersion, getDatabaseVersionSafe, }: SendPanic): Promise { - const schema: string | undefined = match(error) + const schema: MultipleSchemas | undefined = await match(error) .with({ schemaPath: P.not(P.nullish) }, (err) => { - return fs.readFileSync(err.schemaPath, 'utf-8') + return getSchema(err.schemaPath) }) - .with({ schema: P.not(P.nullish) }, (err) => err.schema) + .with({ schema: P.not(P.nullish) }, (err) => Promise.resolve(err.schema)) .otherwise(() => undefined) - const maskedSchema: string | undefined = schema ? maskSchema(schema) : undefined + const maskedSchema: MultipleSchemas | undefined = schema ? maskSchemas(schema) : undefined let dbVersion: string | undefined if (error.area === ErrorArea.LIFT_CLI) { @@ -57,8 +60,8 @@ export async function sendPanic({ .with({ schema: P.not(undefined) }, ({ schema }) => { return { datasource: { - tag: 'SchemaString', - schema, + tag: 'Schema', + ...toSchemasContainer(schema), }, } as const }) @@ -97,7 +100,7 @@ export async function sendPanic({ operatingSystem: `${os.arch()} ${os.platform()} ${os.release()}`, platform: await getBinaryTargetForCurrentPlatform(), liftRequest: migrateRequest, - schemaFile: maskedSchema, + schemaFile: concatSchemaForReport(maskedSchema), fingerprint: await checkpoint.getSignature(), sqlDump: undefined, dbVersion: dbVersion, @@ -123,6 +126,13 @@ export async function sendPanic({ return id } +function concatSchemaForReport(schemaFiles: MultipleSchemas | undefined) { + if (!schemaFiles) { + return undefined + } + return schemaFiles.map(([path, content]) => `// ${path}\n${content}`).join('\n') +} + function getCommand(): string { // don't send url if (process.argv[2] === 'introspect') { diff --git a/packages/internals/src/utils/handlePanic.ts b/packages/internals/src/utils/handlePanic.ts index 9904304c50ff..d47512e9d35d 100644 --- a/packages/internals/src/utils/handlePanic.ts +++ b/packages/internals/src/utils/handlePanic.ts @@ -15,7 +15,7 @@ type HandlePanic = { command: string // retrieve the database version for the given schema or url, without throwing any error - getDatabaseVersionSafe: (args: MigrateTypes.GetDatabaseVersionParams) => Promise + getDatabaseVersionSafe: (args: MigrateTypes.GetDatabaseVersionParams | undefined) => Promise } export async function handlePanic(args: HandlePanic): Promise { diff --git a/packages/internals/src/utils/maskSchema.ts b/packages/internals/src/utils/maskSchema.ts index c36f79c13165..9fe2c95cc2e9 100644 --- a/packages/internals/src/utils/maskSchema.ts +++ b/packages/internals/src/utils/maskSchema.ts @@ -1,3 +1,9 @@ +import { MultipleSchemas } from './schemaFileInput' + +export function maskSchemas(schemas: MultipleSchemas): MultipleSchemas { + return schemas.map(([path, content]) => [path, maskSchema(content)]) +} + export function maskSchema(schema: string): string { const regex = /url\s*=\s*.+/ return schema diff --git a/packages/internals/src/utils/schemaFileInput.ts b/packages/internals/src/utils/schemaFileInput.ts index 13f05b7cf604..42262b51b3ed 100644 --- a/packages/internals/src/utils/schemaFileInput.ts +++ b/packages/internals/src/utils/schemaFileInput.ts @@ -21,6 +21,16 @@ export const schemaToStringDebug = (schemaFileInput: SchemaFileInput | unknown): return String(schemaFileInput) } +export function toMultipleSchemas(input: SchemaFileInput | undefined): MultipleSchemas | undefined { + if (typeof input === 'undefined') { + return undefined + } + if (typeof input === 'string') { + return [['schema.prisma', input]] + } + return input +} + export function debugMultipleSchemas(multipleSchemas: MultipleSchemas): string { return multipleSchemas.map(([, content]) => content).join('\n/* - newfile - */') } diff --git a/packages/internals/src/utils/toSchemasContainer.ts b/packages/internals/src/utils/toSchemasContainer.ts new file mode 100644 index 000000000000..04055c49a223 --- /dev/null +++ b/packages/internals/src/utils/toSchemasContainer.ts @@ -0,0 +1,25 @@ +import path from 'path' + +import { GetSchemaResult } from '../cli/getSchema' +import { MigrateTypes } from '../migrateTypes' +import { MultipleSchemas } from './schemaFileInput' + +export function toSchemasContainer(schemas: MultipleSchemas): MigrateTypes.SchemasContainer { + return { + files: multipleSchemasToSchemaContainers(schemas), + } +} + +export function toSchemasWithConfigDir(getSchemaResult: GetSchemaResult): MigrateTypes.SchemasWithConfigDir { + return { + files: multipleSchemasToSchemaContainers(getSchemaResult.schemas), + configDir: path.dirname(getSchemaResult.schemaPath), + } +} + +function multipleSchemasToSchemaContainers(schemas: MultipleSchemas): MigrateTypes.SchemaContainer[] { + return schemas.map(([path, content]) => ({ + path, + content, + })) +} diff --git a/packages/internals/src/utils/trimBlocksFromSchema.ts b/packages/internals/src/utils/trimBlocksFromSchema.ts deleted file mode 100644 index 1ec2623a69ed..000000000000 --- a/packages/internals/src/utils/trimBlocksFromSchema.ts +++ /dev/null @@ -1,59 +0,0 @@ -export type Position = { - start: number - end: number -} - -export function trimNewLine(str: string): string { - if (str === '') { - return str - } - let newStr = str - if (/\r?\n|\r/.exec(newStr[0])) { - newStr = newStr.slice(1) - } - if (newStr.length > 0 && /\r?\n|\r/.exec(newStr[newStr.length - 1])) { - newStr = newStr.slice(0, newStr.length - 1) - } - return newStr -} - -export function trimBlocksFromSchema(str: string, blocks = ['model', 'enum', 'datasource', 'generator']): string { - const lines = str.split(/\r\n|\r|\n/g) - - if (lines.length <= 2) { - return str - } - const modelPositions: Position[] = [] - let blockOpen = false - let currentStart = -1 - - lines.forEach((line, index) => { - const lineTrimmed = line.trim() - - if (blocks.some((b) => lineTrimmed.startsWith(b)) && lineTrimmed.endsWith('{')) { - blockOpen = true - currentStart = index - } - if (lineTrimmed.endsWith('}') && currentStart > -1 && blockOpen) { - modelPositions.push({ - start: currentStart, - end: index, - }) - blockOpen = false - currentStart = -1 - } - }) - - if (modelPositions.length === 0) { - return str - } - - return trimNewLine( - modelPositions - .reduceRight((acc, position) => { - acc.splice(position.start, position.end - position.start + 1) - return acc - }, lines) - .join('\n'), - ) -} diff --git a/packages/migrate/.gitignore b/packages/migrate/.gitignore index f7b9cae623e8..10a3d01cd617 100644 --- a/packages/migrate/.gitignore +++ b/packages/migrate/.gitignore @@ -8,3 +8,4 @@ pnpm-debug.log write-test *.tsbuildinfo pnpm-lock.yaml +*.db-journal diff --git a/packages/migrate/helpers/build.ts b/packages/migrate/helpers/build.ts index b0c95ac06b15..ae19dc9cc338 100644 --- a/packages/migrate/helpers/build.ts +++ b/packages/migrate/helpers/build.ts @@ -7,6 +7,7 @@ void build([ bundle: true, emitTypes: true, splitting: true, + external: ['@prisma/prisma-schema-wasm'], format: 'esm', plugins: [esmSplitCodeToCjs], }, diff --git a/packages/migrate/package.json b/packages/migrate/package.json index b36081909f20..c3dce95f8c32 100644 --- a/packages/migrate/package.json +++ b/packages/migrate/package.json @@ -18,17 +18,17 @@ }, "devDependencies": { "@sindresorhus/slugify": "1.1.2", - "@swc/core": "1.5.3", + "@swc/core": "1.5.7", "@swc/jest": "0.2.36", "@types/jest": "29.5.12", "@types/node": "18.19.31", - "@types/pg": "8.11.5", + "@types/pg": "8.11.6", "@types/prompts": "2.4.9", "@types/sqlite3": "3.1.11", "arg": "5.0.2", - "esbuild": "0.21.2", + "esbuild": "0.21.4", "execa": "5.1.1", - "fp-ts": "2.16.5", + "fp-ts": "2.16.6", "fs-jetpack": "5.1.0", "get-stdin": "8.0.0", "has-yarn": "2.1.0", @@ -39,7 +39,7 @@ "log-update": "4.0.0", "mariadb": "3.3.0", "mock-stdin": "1.0.0", - "mongoose": "8.3.4", + "mongoose": "8.4.0", "mssql": "10.0.2", "ora": "5.4.1", "pg": "8.11.5", @@ -47,8 +47,9 @@ "strip-ansi": "6.0.1", "strip-indent": "3.0.0", "tempy": "1.0.1", - "ts-pattern": "5.1.1", - "typescript": "5.4.5" + "ts-pattern": "5.1.2", + "typescript": "5.4.5", + "wrangler": "3.57.2" }, "peerDependencies": { "@prisma/generator-helper": "*", @@ -56,7 +57,7 @@ }, "dependencies": { "@prisma/debug": "workspace:*", - "@prisma/engines-version": "5.15.0-7.0af42cb19116c37b029e1f3665681074acb38bb4", + "@prisma/engines-version": "5.15.0-24.9ee43833e58f4ec014ce0f45b6ae27ee7e0165fc", "@prisma/generator-helper": "workspace:*", "@prisma/get-platform": "workspace:*", "@prisma/internals": "workspace:*", diff --git a/packages/migrate/src/Migrate.ts b/packages/migrate/src/Migrate.ts index 0693ee8df61d..4f5dae55a802 100644 --- a/packages/migrate/src/Migrate.ts +++ b/packages/migrate/src/Migrate.ts @@ -1,13 +1,17 @@ import { enginesVersion } from '@prisma/engines-version' -import { getGenerators, getGeneratorSuccessMessage, getSchemaPathSync } from '@prisma/internals' -import fs from 'fs' +import { + getGenerators, + getGeneratorSuccessMessage, + type GetSchemaResult, + getSchemaWithPath, + toSchemasContainer, +} from '@prisma/internals' import { dim } from 'kleur/colors' import logUpdate from 'log-update' import path from 'path' import { SchemaEngine } from './SchemaEngine' import type { EngineArgs, EngineResults } from './types' -import { NoSchemaFoundError } from './utils/errors' // TODO: `eval` is used so that the `version` field in package.json (resolved at compile-time) doesn't yield `0.0.0`. // We should mark this bit as `external` during the build, so that we can get rid of `eval` and still import the JSON we need at runtime. @@ -18,9 +22,6 @@ export class Migrate { private schemaPath?: string public migrationsDirectoryPath?: string - // TODO: make the constructor private, and only allow instantiation via an async static method. - // This would allow us to do async work in the constructor (such as using the async version of `getSchemaPath`, - // which supports multiple schema files), which is currently not possible. constructor(schemaPath?: string, enabledPreviewFeatures?: string[]) { // schemaPath and migrationsDirectoryPath is optional for primitives // like migrate diff and db execute @@ -44,20 +45,10 @@ export class Migrate { this.engine.stop() } - public getSchemaPath(schemaPathFromOptions?): string { - const schemaPath = getSchemaPathSync(schemaPathFromOptions) - - if (!schemaPath) { - throw new NoSchemaFoundError() - } - - return schemaPath - } - - public getPrismaSchema(): string { + public getPrismaSchema(): Promise { if (!this.schemaPath) throw new Error('this.schemaPath is undefined') - return fs.readFileSync(this.schemaPath, 'utf-8') + return getSchemaWithPath(this.schemaPath) } public reset(): Promise { @@ -120,19 +111,19 @@ export class Migrate { }) } - public evaluateDataLoss(): Promise { + public async evaluateDataLoss(): Promise { if (!this.migrationsDirectoryPath) throw new Error('this.migrationsDirectoryPath is undefined') - const schema = this.getPrismaSchema() + const schema = toSchemasContainer((await this.getPrismaSchema()).schemas) return this.engine.evaluateDataLoss({ migrationsDirectoryPath: this.migrationsDirectoryPath, - prismaSchema: schema, + schema: schema, }) } public async push({ force = false }: { force?: boolean }): Promise { - const schema = this.getPrismaSchema() + const schema = toSchemasContainer((await this.getPrismaSchema()).schemas) const { warnings, unexecutable, executedSteps } = await this.engine.schemaPush({ force, diff --git a/packages/migrate/src/SchemaEngine.ts b/packages/migrate/src/SchemaEngine.ts index 447664452332..d7fe0f889735 100644 --- a/packages/migrate/src/SchemaEngine.ts +++ b/packages/migrate/src/SchemaEngine.ts @@ -4,6 +4,9 @@ import Debug from '@prisma/debug' import { BinaryType, ErrorArea, + getSchema, + type MigrateTypes, + relativizePathInPSLError, resolveBinary, RustPanic, SchemaEngineExitCode, @@ -57,7 +60,7 @@ export class SchemaEngine { private enabledPreviewFeatures?: string[] // `latestSchema` is set to the latest schema that was used in `introspect()` - private latestSchema?: string + private latestSchema?: MigrateTypes.SchemasContainer // `isRunning` is set to true when the engine is initialized, and set to false when the engine is stopped public isRunning = false @@ -163,7 +166,7 @@ export class SchemaEngine { * If no argument is given, the version of the database associated to the Prisma schema provided * in the constructor will be returned. */ - public getDatabaseVersion(args?: EngineArgs.GetDatabaseVersionParams): Promise { + public getDatabaseVersion(args?: MigrateTypes.GetDatabaseVersionParams): Promise { return this.runCommand(this.getRPCPayload('getDatabaseVersion', args)) } @@ -175,13 +178,13 @@ export class SchemaEngine { schema, force = false, compositeTypeDepth = -1, // cannot be undefined - schemas, + namespaces, }: EngineArgs.IntrospectParams): Promise { this.latestSchema = schema try { const introspectResult: EngineArgs.IntrospectResult = await this.runCommand( - this.getRPCPayload('introspect', { schema, force, compositeTypeDepth, schemas }), + this.getRPCPayload('introspect', { schema, force, compositeTypeDepth, namespaces }), ) const { views } = introspectResult @@ -253,7 +256,7 @@ export class SchemaEngine { /** * The command behind db push. */ - public schemaPush(args: EngineArgs.SchemaPush): Promise { + public schemaPush(args: EngineArgs.SchemaPushInput): Promise { return this.runCommand(this.getRPCPayload('schemaPush', args)) } @@ -336,7 +339,9 @@ export class SchemaEngine { const args: string[] = [] if (this.schemaPath) { - args.push(...['-d', this.schemaPath]) + const schema = await getSchema(this.schemaPath) + const schemaArgs = schema.flatMap(([path]) => ['-d', path]) + args.push(...schemaArgs) } if ( @@ -398,7 +403,7 @@ export class SchemaEngine { this.lastRequest, ErrorArea.LIFT_CLI, /* schemaPath */ this.schemaPath, - /* schema */ this.latestSchema, + /* schema */ this.latestSchema?.files.map((schema) => [schema.path, schema.content]), ), ) } @@ -494,13 +499,13 @@ export class SchemaEngine { this.lastRequest, ErrorArea.LIFT_CLI, /* schemaPath */ this.schemaPath, - /* schema */ this.latestSchema, + /* schema */ this.latestSchema?.files.map((schema) => [schema.path, schema.content]), ), ) } else if (response.error.data?.message) { // Print known error code & message from engine // See known errors at https://github.com/prisma/specs/tree/master/errors#prisma-sdk - let message = `${red(response.error.data.message)}\n` + let message = `${red(relativizePathInPSLError(response.error.data.message))}\n` if (response.error.data?.error_code) { message = red(`${response.error.data.error_code}\n\n`) + message reject(new EngineError(message, response.error.data.error_code)) diff --git a/packages/migrate/src/__tests__/DbExecute.test.ts b/packages/migrate/src/__tests__/DbExecute.test.ts index 94b4b02ddd6c..25e5ee74f2f8 100644 --- a/packages/migrate/src/__tests__/DbExecute.test.ts +++ b/packages/migrate/src/__tests__/DbExecute.test.ts @@ -145,6 +145,14 @@ DROP TABLE 'test-dbexecute';` await expect(result).resolves.toMatchInlineSnapshot(`"Script executed successfully."`) }) + it('should pass with --file --schema folder', async () => { + ctx.fixture('schema-folder-sqlite') + + fs.writeFileSync('script.sql', sqlScript) + const result = DbExecute.new().parse(['--schema=./prisma/schema', '--file=./script.sql']) + await expect(result).resolves.toMatchInlineSnapshot(`"Script executed successfully."`) + }) + it('should pass using a transaction with --file --schema', async () => { ctx.fixture('schema-only-sqlite') @@ -287,6 +295,14 @@ DROP SCHEMA "test-dbexecute";` await expect(result).resolves.toMatchInlineSnapshot(`"Script executed successfully."`) }) + it('should pass with --file --schema folder', async () => { + ctx.fixture('schema-folder-postgres') + + fs.writeFileSync('script.sql', sqlScript) + const result = DbExecute.new().parse(['--schema=./prisma/schema', '--file=./script.sql']) + await expect(result).resolves.toMatchInlineSnapshot(`"Script executed successfully."`) + }) + it('should use env var from .env file', async () => { ctx.fixture('schema-only-postgresql') @@ -508,6 +524,14 @@ DROP SCHEMA "test-dbexecute";` await expect(result).resolves.toMatchInlineSnapshot(`"Script executed successfully."`) }, 10_000) + it('should pass with --file --schema folder', async () => { + ctx.fixture('schema-folder-cockroachdb') + + fs.writeFileSync('script.sql', sqlScript) + const result = DbExecute.new().parse(['--schema=./prisma/schema', '--file=./script.sql']) + await expect(result).resolves.toMatchInlineSnapshot(`"Script executed successfully."`) + }, 10_000) + it('should use env var from .env file', async () => { ctx.fixture('schema-only-cockroachdb') @@ -699,6 +723,14 @@ DROP DATABASE \`test-dbexecute\`;` await expect(result).resolves.toMatchInlineSnapshot(`"Script executed successfully."`) }) + it('should pass with --file --schema folder', async () => { + ctx.fixture('schema-folder-mysql') + + fs.writeFileSync('script.sql', sqlScript) + const result = DbExecute.new().parse(['--schema=./prisma/schema', '--file=./script.sql']) + await expect(result).resolves.toMatchInlineSnapshot(`"Script executed successfully."`) + }) + // Only fails on MySQL it('should fail with empty --file --schema', async () => { ctx.fixture('schema-only-mysql') @@ -883,6 +915,14 @@ DROP DATABASE "test-dbexecute";` await expect(result).resolves.toMatchInlineSnapshot(`"Script executed successfully."`) }) + it('should pass with --file --schema folder', async () => { + ctx.fixture('schema-folder-sqlserver') + + fs.writeFileSync('script.sql', sqlScript) + const result = DbExecute.new().parse(['--schema=./prisma/schema', '--file=./script.sql']) + await expect(result).resolves.toMatchInlineSnapshot(`"Script executed successfully."`) + }) + it('should pass with empty --file --schema', async () => { ctx.fixture('schema-only-sqlserver') diff --git a/packages/migrate/src/__tests__/DbPull/__snapshots__/postgresql.test.ts.snap b/packages/migrate/src/__tests__/DbPull/__snapshots__/postgresql.test.ts.snap index edb893a2790b..dfcce5099d86 100644 --- a/packages/migrate/src/__tests__/DbPull/__snapshots__/postgresql.test.ts.snap +++ b/packages/migrate/src/__tests__/DbPull/__snapshots__/postgresql.test.ts.snap @@ -1,5 +1,77 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`postgresql basic introspection --url + empty schema 2`] = ` +"datasource db { + provider = "postgresql" + url = "postgres://prisma:prisma@localhost:5432/tests-migrate-db-pull-postgresql" +} + +model Post { + id String @id + createdAt DateTime @default(now()) + updatedAt DateTime @default(dbgenerated("'1970-01-01 00:00:00'::timestamp without time zone")) + published Boolean @default(false) + title String + content String? + authorId String? + jsonData Json? + coinflips Boolean[] + User User? @relation(fields: [authorId], references: [id]) +} + +model User { + id String @id + email String @unique(map: "User.email") + name String? + Post Post[] +} + +enum Role { + USER + ADMIN +} + +" +`; + +exports[`postgresql basic introspection --url + schema with no linebreak after generator block 2`] = ` +"generator client { + provider = "prisma-client-js" +} + +datasource db { + provider = "postgresql" + url = "postgres://prisma:prisma@localhost:5432/tests-migrate-db-pull-postgresql" +} + +model Post { + id String @id + createdAt DateTime @default(now()) + updatedAt DateTime @default(dbgenerated("'1970-01-01 00:00:00'::timestamp without time zone")) + published Boolean @default(false) + title String + content String? + authorId String? + jsonData Json? + coinflips Boolean[] + User User? @relation(fields: [authorId], references: [id]) +} + +model User { + id String @id + email String @unique(map: "User.email") + name String? + Post Post[] +} + +enum Role { + USER + ADMIN +} + +" +`; + exports[`postgresql basic introspection --url 2`] = ` "datasource db { provider = "postgresql" diff --git a/packages/migrate/src/__tests__/DbPull/postgresql-multischema.test.ts b/packages/migrate/src/__tests__/DbPull/postgresql-multischema.test.ts index 559c58113a56..443849640fe1 100644 --- a/packages/migrate/src/__tests__/DbPull/postgresql-multischema.test.ts +++ b/packages/migrate/src/__tests__/DbPull/postgresql-multischema.test.ts @@ -88,7 +88,7 @@ describe('postgresql-multischema', () => { "Prisma schema validation - (get-config wasm) Error code: P1012 error: If provided, the schemas array can not be empty. - --> schema.prisma:4 + --> with-schemas-in-datasource-0-value.prisma:4 | 3 | url = env("TEST_POSTGRES_URI_MIGRATE") 4 | schemas = [] diff --git a/packages/migrate/src/__tests__/DbPull/postgresql-views.test.ts b/packages/migrate/src/__tests__/DbPull/postgresql-views.test.ts index fe3744ca23c0..9a2b0b1c755e 100644 --- a/packages/migrate/src/__tests__/DbPull/postgresql-views.test.ts +++ b/packages/migrate/src/__tests__/DbPull/postgresql-views.test.ts @@ -2,7 +2,7 @@ /* eslint-disable jest/no-identical-title */ import { jestConsoleContext, jestContext } from '@prisma/get-platform' -import { extractSchemaContent, getSchema, pathToPosix } from '@prisma/internals' +import { getSchema, pathToPosix, toSchemasContainer } from '@prisma/internals' import path from 'path' import { DbPull } from '../../commands/DbPull' @@ -100,10 +100,9 @@ describe('postgresql-views', () => { }) const schemas = await getSchema() - const schema = extractSchemaContent(schemas).join('\n') const introspectionResult = await engine.introspect({ - schema, + schema: toSchemasContainer(schemas), force: false, }) @@ -124,10 +123,9 @@ describe('postgresql-views', () => { }) const schemas = await getSchema() - const schema = extractSchemaContent(schemas).join('\n') const introspectionResult = await engine.introspect({ - schema, + schema: toSchemasContainer(schemas), force: false, }) @@ -153,10 +151,9 @@ describe('postgresql-views', () => { }) const schemas = await getSchema() - const schema = extractSchemaContent(schemas).join('\n') const introspectionResult = await engine.introspect({ - schema, + schema: toSchemasContainer(schemas), force: false, }) @@ -182,10 +179,9 @@ describe('postgresql-views', () => { }) const schemas = await getSchema() - const schema = extractSchemaContent(schemas).join('\n') const introspectionResult = await engine.introspect({ - schema, + schema: toSchemasContainer(schemas), force: false, }) diff --git a/packages/migrate/src/__tests__/DbPull/postgresql.test.ts b/packages/migrate/src/__tests__/DbPull/postgresql.test.ts index cb7bb634ca8d..e67c79c6f1c7 100644 --- a/packages/migrate/src/__tests__/DbPull/postgresql.test.ts +++ b/packages/migrate/src/__tests__/DbPull/postgresql.test.ts @@ -90,6 +90,26 @@ describe('postgresql', () => { expect(ctx.mocked['console.error'].mock.calls.join('\n')).toMatchInlineSnapshot(`""`) }) + test('basic introspection --url + empty schema', async () => { + ctx.fixture('empty-schema') + const introspect = new DbPull() + const result = introspect.parse(['--print', '--url', setupParams.connectionString]) + await expect(result).resolves.toMatchInlineSnapshot(`""`) + + expect(captureStdout.getCapturedText().join('\n')).toMatchSnapshot() + expect(ctx.mocked['console.error'].mock.calls.join('\n')).toMatchInlineSnapshot(`""`) + }) + + test('basic introspection --url + schema with no linebreak after generator block', async () => { + ctx.fixture('generator-only') + const introspect = new DbPull() + const result = introspect.parse(['--print', '--url', setupParams.connectionString]) + await expect(result).resolves.toMatchInlineSnapshot(`""`) + + expect(captureStdout.getCapturedText().join('\n')).toMatchSnapshot() + expect(ctx.mocked['console.error'].mock.calls.join('\n')).toMatchInlineSnapshot(`""`) + }) + test('introspection should load .env file with --print', async () => { ctx.fixture('schema-only-postgresql') expect.assertions(3) diff --git a/packages/migrate/src/__tests__/DbPull/sqlite.test.ts b/packages/migrate/src/__tests__/DbPull/sqlite.test.ts index 0e8ee178a49a..945bba7df3b7 100644 --- a/packages/migrate/src/__tests__/DbPull/sqlite.test.ts +++ b/packages/migrate/src/__tests__/DbPull/sqlite.test.ts @@ -375,7 +375,7 @@ describe('common/sqlite', () => { "P1012 error: Error validating model "something": Each model must have at least one unique criteria that has only required fields. Either mark a single field with \`@id\`, \`@unique\` or add a multi field criterion with \`@@id([])\` or \`@@unique([])\` to the model. - --> schema.prisma:11 + --> prisma/invalid.prisma:11 | 10 | 11 | model something { diff --git a/packages/migrate/src/__tests__/DbPull/sqlserver.test.ts b/packages/migrate/src/__tests__/DbPull/sqlserver.test.ts index a23fe4cb0a23..a134e9df47cc 100644 --- a/packages/migrate/src/__tests__/DbPull/sqlserver.test.ts +++ b/packages/migrate/src/__tests__/DbPull/sqlserver.test.ts @@ -184,7 +184,7 @@ describeIf(!process.env.TEST_SKIP_MSSQL)('sqlserver-multischema', () => { "Prisma schema validation - (get-config wasm) Error code: P1012 error: If provided, the schemas array can not be empty. - --> schema.prisma:4 + --> with-schemas-in-datasource-0-value.prisma:4 | 3 | url = env("TEST_MSSQL_JDBC_URI_MIGRATE") 4 | schemas = [] @@ -214,16 +214,16 @@ describeIf(!process.env.TEST_SKIP_MSSQL)('sqlserver-multischema', () => { expect(ctx.mocked['console.error'].mock.calls.join('\n')).toMatchInlineSnapshot(` - // *** WARNING *** - // - // The following models were ignored as they do not have a valid unique identifier or id. This is currently not supported by Prisma Client: - // - transactional_some_table - // - // These items were renamed due to their names being duplicates in the Prisma schema: - // - type: model, name: base_some_table - // - type: model, name: transactional_some_table - // - `) + // *** WARNING *** + // + // The following models were ignored as they do not have a valid unique identifier or id. This is currently not supported by Prisma Client: + // - transactional_some_table + // + // These items were renamed due to their names being duplicates in the Prisma schema: + // - type: model, name: base_some_table + // - type: model, name: transactional_some_table + // + `) }) test('datasource property `schemas=["base"]` should succeed', async () => { diff --git a/packages/migrate/src/__tests__/DbPush.test.ts b/packages/migrate/src/__tests__/DbPush.test.ts index fa2878b059bb..5d4bb830f4ea 100644 --- a/packages/migrate/src/__tests__/DbPush.test.ts +++ b/packages/migrate/src/__tests__/DbPush.test.ts @@ -53,7 +53,7 @@ describe('push', () => { "P1012 error: Native type VarChar is not supported for sqlite connector. - --> schema.prisma:12 + --> prisma/schema.prisma:12 | 11 | id Int @id 12 | name String @db.VarChar(100) @@ -97,6 +97,26 @@ describe('push', () => { expect(ctx.fs.inspect('dev.db')?.size).toBeUndefined() }) + it('missing SQLite db should be created next to the schema folder', async () => { + ctx.fixture('schema-folder-sqlite') + ctx.fs.remove('prisma/dev.db') + const schemaPath = 'prisma/schema' + + const result = DbPush.new().parse([]) + await expect(result).resolves.toMatchInlineSnapshot(`""`) + expect(removeRocketEmoji(captureStdout.getCapturedText().join(''))).toMatchInlineSnapshot(` + "Prisma schema loaded from prisma/schema + Datasource "my_db": SQLite database "dev.db" at "file:dev.db" + + SQLite database dev.db created at file:dev.db + + Your database is now in sync with your Prisma schema. Done in XXXms + " + `) + expect(ctx.fs.inspect(path.join(path.dirname(schemaPath), 'dev.db'))?.size).toBeGreaterThan(0) + expect(ctx.fs.inspect('dev.db')?.size).toBeUndefined() + }) + it('missing SQLite db should be created next to the --schema path', async () => { ctx.fixture('reset') ctx.fs.remove('prisma/dev.db') diff --git a/packages/migrate/src/__tests__/MigrateDeploy.test.ts b/packages/migrate/src/__tests__/MigrateDeploy.test.ts index 9cf9b221cfe3..c92a478ade12 100644 --- a/packages/migrate/src/__tests__/MigrateDeploy.test.ts +++ b/packages/migrate/src/__tests__/MigrateDeploy.test.ts @@ -96,6 +96,47 @@ describe('sqlite', () => { expect(ctx.mocked['console.error'].mock.calls.join('\n')).toMatchSnapshot() }) + it('1 unapplied migration (folder)', async () => { + ctx.fixture('schema-folder-sqlite-migration-exists') + fs.remove('prisma/dev.db') + + const result = MigrateDeploy.new().parse([]) + await expect(result).resolves.toMatchInlineSnapshot(` + "The following migration(s) have been applied: + + migrations/ + └─ 20201231000000_init/ + └─ migration.sql + + All migrations have been successfully applied." + `) + + // Second time should do nothing (already applied) + const resultBis = MigrateDeploy.new().parse([]) + await expect(resultBis).resolves.toMatchInlineSnapshot(`"No pending migrations to apply."`) + + expect(captureStdout.getCapturedText().join('')).toMatchInlineSnapshot(` + "Prisma schema loaded from prisma/schema + Datasource "my_db": SQLite database "dev.db" at "file:dev.db" + + SQLite database dev.db created at file:dev.db + + 1 migration found in prisma/migrations + + Applying migration \`20201231000000_init\` + + Prisma schema loaded from prisma/schema + Datasource "my_db": SQLite database "dev.db" at "file:dev.db" + + 1 migration found in prisma/migrations + + + " + `) + expect(ctx.mocked['console.log'].mock.calls).toMatchSnapshot() + expect(ctx.mocked['console.error'].mock.calls.join('\n')).toMatchSnapshot() + }) + it('should throw if database is not empty', async () => { ctx.fixture('existing-db-1-migration-conflict') diff --git a/packages/migrate/src/__tests__/MigrateDev.test.ts b/packages/migrate/src/__tests__/MigrateDev.test.ts index 5674f08a3099..ce9a437342f5 100644 --- a/packages/migrate/src/__tests__/MigrateDev.test.ts +++ b/packages/migrate/src/__tests__/MigrateDev.test.ts @@ -185,6 +185,32 @@ describe('sqlite', () => { `) }) + it('first migration (--name) (folder)', async () => { + ctx.fixture('schema-folder-sqlite') + const result = MigrateDev.new().parse(['--name=first']) + + await expect(result).resolves.toMatchInlineSnapshot(`""`) + expect(fs.exists('prisma/migrations/migration_lock.toml')).toEqual('file') + + expect(captureStdout.getCapturedText().join('')).toMatchInlineSnapshot(` + "Prisma schema loaded from prisma/schema + Datasource "my_db": SQLite database "dev.db" at "file:dev.db" + + SQLite database dev.db created at file:dev.db + + Applying migration \`20201231000000_first\` + + The following migration(s) have been created and applied from new schema changes: + + migrations/ + └─ 20201231000000_first/ + └─ migration.sql + + Your database is now in sync with your schema. + " + `) + }) + // // TODO: Windows: test fails with: // diff --git a/packages/migrate/src/__tests__/MigrateDiff.test.ts b/packages/migrate/src/__tests__/MigrateDiff.test.ts index af461531eae4..628071a2dd16 100644 --- a/packages/migrate/src/__tests__/MigrateDiff.test.ts +++ b/packages/migrate/src/__tests__/MigrateDiff.test.ts @@ -217,7 +217,7 @@ describe('migrate diff', () => { await MigrateDiff.new().parse(['--from-schema-datasource=./doesnoexists.prisma', '--to-empty']) } catch (e) { expect(e.code).toEqual(undefined) - expect(e.message).toContain(`Error trying to read Prisma schema file at`) + expect(e.message).toMatch(/Provided --schema at (.+?)[/\\]doesnoexists.prisma doesn't exist/) } }) @@ -315,6 +315,21 @@ describe('migrate diff', () => { " `) }) + + it('should diff --from-empty --to-schema-datamodel=./prisma/schema (folder)', async () => { + ctx.fixture('schema-folder-sqlite') + + const result = MigrateDiff.new().parse(['--from-empty', '--to-schema-datamodel=./prisma/schema']) + await expect(result).resolves.toMatchInlineSnapshot(`""`) + expect(captureStdout.getCapturedText().join('\n')).toMatchInlineSnapshot(` + " + [+] Added tables + - Blog + - User + " + `) + }) + it('should diff --from-empty --to-schema-datamodel=./prisma/schema.prisma --script', async () => { ctx.fixture('schema-only-sqlite') @@ -346,6 +361,21 @@ describe('migrate diff', () => { " `) }) + + it('should diff --from-schema-datamodel=./prisma/schema (folder) --to-empty', async () => { + ctx.fixture('schema-folder-sqlite') + + const result = MigrateDiff.new().parse(['--from-schema-datamodel=./prisma/schema', '--to-empty']) + await expect(result).resolves.toMatchInlineSnapshot(`""`) + expect(captureStdout.getCapturedText().join('\n')).toMatchInlineSnapshot(` + " + [-] Removed tables + - Blog + - User + " + `) + }) + it('should diff --from-schema-datamodel=./prisma/schema.prisma --to-empty --script', async () => { ctx.fixture('schema-only-sqlite') diff --git a/packages/migrate/src/__tests__/MigrateReset.test.ts b/packages/migrate/src/__tests__/MigrateReset.test.ts index 80ea66d00c1d..2f5c5603e0e8 100644 --- a/packages/migrate/src/__tests__/MigrateReset.test.ts +++ b/packages/migrate/src/__tests__/MigrateReset.test.ts @@ -101,6 +101,30 @@ describe('reset', () => { `) }) + it('should work with folder (--force)', async () => { + ctx.fixture('schema-folder-sqlite-migration-exists') + + const result = MigrateReset.new().parse(['--force']) + await expect(result).resolves.toMatchInlineSnapshot(`""`) + expect(captureStdout.getCapturedText().join('')).toMatchInlineSnapshot(` + "Prisma schema loaded from prisma/schema + Datasource "my_db": SQLite database "dev.db" at "file:dev.db" + + SQLite database dev.db created at file:dev.db + + Applying migration \`20201231000000_init\` + + Database reset successful + + The following migration(s) have been applied: + + migrations/ + └─ 20201231000000_init/ + └─ migration.sql + " + `) + }) + it('with missing db', async () => { ctx.fixture('reset') ctx.fs.remove('prisma/dev.db') diff --git a/packages/migrate/src/__tests__/MigrateResolve.test.ts b/packages/migrate/src/__tests__/MigrateResolve.test.ts index 092defa0d1a3..183361f42321 100644 --- a/packages/migrate/src/__tests__/MigrateResolve.test.ts +++ b/packages/migrate/src/__tests__/MigrateResolve.test.ts @@ -109,6 +109,19 @@ describe('sqlite', () => { `) }) + it('--applied should work on a failed migration (schema folder)', async () => { + ctx.fixture('schema-folder-sqlite-migration-failed') + const result = MigrateResolve.new().parse(['--applied', '20240527130802_init']) + await expect(result).resolves.toMatchInlineSnapshot(`""`) + expect(captureStdout.getCapturedText().join('')).toMatchInlineSnapshot(` + "Prisma schema loaded from prisma/schema + Datasource "my_db": SQLite database "dev.db" at "file:dev.db" + + Migration 20201231000000_init marked as applied. + " + `) + }) + // // --rolled-back // diff --git a/packages/migrate/src/__tests__/MigrateStatus.test.ts b/packages/migrate/src/__tests__/MigrateStatus.test.ts index aebb5340f02b..72fecd781372 100644 --- a/packages/migrate/src/__tests__/MigrateStatus.test.ts +++ b/packages/migrate/src/__tests__/MigrateStatus.test.ts @@ -122,6 +122,22 @@ describe('sqlite', () => { expect(ctx.mocked['console.error'].mock.calls.join('\n')).toMatchSnapshot() }) + it('schema-folder-db-exists', async () => { + ctx.fixture('schema-folder-sqlite-db-exists') + const result = MigrateStatus.new().parse([]) + await expect(result).resolves.toMatchInlineSnapshot(`"Database schema is up to date!"`) + + expect(captureStdout.getCapturedText().join('')).toMatchInlineSnapshot(` + "Prisma schema loaded from prisma/schema + Datasource "my_db": SQLite database "dev.db" at "file:dev.db" + + 1 migration found in prisma/migrations + + " + `) + expect(ctx.mocked['console.error'].mock.calls.join('\n')).toMatchSnapshot() + }) + it('existing-db-1-migration-conflict', async () => { ctx.fixture('existing-db-1-migration-conflict') const mockExit = jest.spyOn(process, 'exit').mockImplementation((number) => { diff --git a/packages/migrate/src/__tests__/__snapshots__/MigrateDeploy.test.ts.snap b/packages/migrate/src/__tests__/__snapshots__/MigrateDeploy.test.ts.snap index f961f7ecd190..99e5bb53f066 100644 --- a/packages/migrate/src/__tests__/__snapshots__/MigrateDeploy.test.ts.snap +++ b/packages/migrate/src/__tests__/__snapshots__/MigrateDeploy.test.ts.snap @@ -1,5 +1,9 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`sqlite 1 unapplied migration (folder) 4`] = `[]`; + +exports[`sqlite 1 unapplied migration (folder) 5`] = `""`; + exports[`sqlite 1 unapplied migration 4`] = `[]`; exports[`sqlite 1 unapplied migration 5`] = `""`; diff --git a/packages/migrate/src/__tests__/__snapshots__/MigrateStatus.test.ts.snap b/packages/migrate/src/__tests__/__snapshots__/MigrateStatus.test.ts.snap index 75a1350a9c06..1d8689f73fff 100644 --- a/packages/migrate/src/__tests__/__snapshots__/MigrateStatus.test.ts.snap +++ b/packages/migrate/src/__tests__/__snapshots__/MigrateStatus.test.ts.snap @@ -6,4 +6,6 @@ exports[`sqlite existing-db-1-migration 3`] = `""`; exports[`sqlite reset 3`] = `""`; +exports[`sqlite schema-folder-db-exists 3`] = `""`; + exports[`sqlite should fail if no sqlite db - empty schema 3`] = `""`; diff --git a/packages/migrate/src/__tests__/ensureDatabaseExists.test.ts b/packages/migrate/src/__tests__/ensureDatabaseExists.test.ts index e6e7b26ded5f..c6d155afe988 100644 --- a/packages/migrate/src/__tests__/ensureDatabaseExists.test.ts +++ b/packages/migrate/src/__tests__/ensureDatabaseExists.test.ts @@ -1,5 +1,5 @@ import { jestConsoleContext, jestContext } from '@prisma/get-platform' -import { getSchemaPath } from '@prisma/internals' +import { getSchemaWithPath } from '@prisma/internals' import { ensureDatabaseExists } from '../utils/ensureDatabaseExists' @@ -7,11 +7,17 @@ const ctx = jestContext.new().add(jestConsoleContext()).assemble() it('can create database - sqlite', async () => { ctx.fixture('schema-only-sqlite') - const { schemaPath } = (await getSchemaPath())! + const { schemaPath } = (await getSchemaWithPath())! const result = ensureDatabaseExists('create', schemaPath) await expect(result).resolves.toMatchInlineSnapshot(`"SQLite database dev.db created at file:dev.db"`) }) +it('can create database - sqlite - folder', async () => { + ctx.fixture('schema-folder-sqlite') + const { schemaPath } = (await getSchemaWithPath())! + const result = ensureDatabaseExists('create', schemaPath) + await expect(result).resolves.toMatchInlineSnapshot(`"SQLite database dev.db created at file:dev.db"`) +}) // // Would need logic to be reproducible for testing other databases // createDatabase is already tested in the `@prisma/internals` tests diff --git a/packages/migrate/src/__tests__/fixtures/empty-schema/schema.prisma b/packages/migrate/src/__tests__/fixtures/empty-schema/schema.prisma new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/migrate/src/__tests__/fixtures/generator-only/schema.prisma b/packages/migrate/src/__tests__/fixtures/generator-only/schema.prisma new file mode 100644 index 000000000000..165fa64426a3 --- /dev/null +++ b/packages/migrate/src/__tests__/fixtures/generator-only/schema.prisma @@ -0,0 +1,3 @@ +generator client { + provider = "prisma-client-js" +} \ No newline at end of file diff --git a/packages/migrate/src/__tests__/fixtures/schema-folder-cockroachdb/prisma/schema/Blog.prisma b/packages/migrate/src/__tests__/fixtures/schema-folder-cockroachdb/prisma/schema/Blog.prisma new file mode 100644 index 000000000000..a951a2ca201e --- /dev/null +++ b/packages/migrate/src/__tests__/fixtures/schema-folder-cockroachdb/prisma/schema/Blog.prisma @@ -0,0 +1,6 @@ +model Blog { + id Int @id + viewCount20 Int + ownerId Int + owner User @relation(fields: [ownerId], references: [id]) +} diff --git a/packages/migrate/src/__tests__/fixtures/schema-folder-cockroachdb/prisma/schema/User.prisma b/packages/migrate/src/__tests__/fixtures/schema-folder-cockroachdb/prisma/schema/User.prisma new file mode 100644 index 000000000000..31feedd6ccd5 --- /dev/null +++ b/packages/migrate/src/__tests__/fixtures/schema-folder-cockroachdb/prisma/schema/User.prisma @@ -0,0 +1,5 @@ +model User { + id Int @id + + blogs Blog[] +} diff --git a/packages/migrate/src/__tests__/fixtures/schema-folder-cockroachdb/prisma/schema/config.prisma b/packages/migrate/src/__tests__/fixtures/schema-folder-cockroachdb/prisma/schema/config.prisma new file mode 100644 index 000000000000..7ea5f588eedb --- /dev/null +++ b/packages/migrate/src/__tests__/fixtures/schema-folder-cockroachdb/prisma/schema/config.prisma @@ -0,0 +1,10 @@ +datasource my_db { + provider = "cockroachdb" + url = env("TEST_COCKROACH_URI_MIGRATE") +} + +generator client { + provider = "prisma-client-js" + output = "@prisma/client" + previewFeatures = ["prismaSchemaFolder"] +} diff --git a/packages/migrate/src/__tests__/fixtures/schema-folder-mysql/prisma/schema/Blog.prisma b/packages/migrate/src/__tests__/fixtures/schema-folder-mysql/prisma/schema/Blog.prisma new file mode 100644 index 000000000000..a951a2ca201e --- /dev/null +++ b/packages/migrate/src/__tests__/fixtures/schema-folder-mysql/prisma/schema/Blog.prisma @@ -0,0 +1,6 @@ +model Blog { + id Int @id + viewCount20 Int + ownerId Int + owner User @relation(fields: [ownerId], references: [id]) +} diff --git a/packages/migrate/src/__tests__/fixtures/schema-folder-mysql/prisma/schema/User.prisma b/packages/migrate/src/__tests__/fixtures/schema-folder-mysql/prisma/schema/User.prisma new file mode 100644 index 000000000000..31feedd6ccd5 --- /dev/null +++ b/packages/migrate/src/__tests__/fixtures/schema-folder-mysql/prisma/schema/User.prisma @@ -0,0 +1,5 @@ +model User { + id Int @id + + blogs Blog[] +} diff --git a/packages/migrate/src/__tests__/fixtures/schema-folder-mysql/prisma/schema/config.prisma b/packages/migrate/src/__tests__/fixtures/schema-folder-mysql/prisma/schema/config.prisma new file mode 100644 index 000000000000..93424c5fa42e --- /dev/null +++ b/packages/migrate/src/__tests__/fixtures/schema-folder-mysql/prisma/schema/config.prisma @@ -0,0 +1,10 @@ +datasource my_db { + provider = "mysql" + url = env("TEST_MYSQL_URI_MIGRATE") +} + +generator client { + provider = "prisma-client-js" + output = "@prisma/client" + previewFeatures = ["prismaSchemaFolder"] +} diff --git a/packages/migrate/src/__tests__/fixtures/schema-folder-postgres/prisma/schema/Blog.prisma b/packages/migrate/src/__tests__/fixtures/schema-folder-postgres/prisma/schema/Blog.prisma new file mode 100644 index 000000000000..a951a2ca201e --- /dev/null +++ b/packages/migrate/src/__tests__/fixtures/schema-folder-postgres/prisma/schema/Blog.prisma @@ -0,0 +1,6 @@ +model Blog { + id Int @id + viewCount20 Int + ownerId Int + owner User @relation(fields: [ownerId], references: [id]) +} diff --git a/packages/migrate/src/__tests__/fixtures/schema-folder-postgres/prisma/schema/User.prisma b/packages/migrate/src/__tests__/fixtures/schema-folder-postgres/prisma/schema/User.prisma new file mode 100644 index 000000000000..31feedd6ccd5 --- /dev/null +++ b/packages/migrate/src/__tests__/fixtures/schema-folder-postgres/prisma/schema/User.prisma @@ -0,0 +1,5 @@ +model User { + id Int @id + + blogs Blog[] +} diff --git a/packages/migrate/src/__tests__/fixtures/schema-folder-postgres/prisma/schema/config.prisma b/packages/migrate/src/__tests__/fixtures/schema-folder-postgres/prisma/schema/config.prisma new file mode 100644 index 000000000000..56c1947ee7f6 --- /dev/null +++ b/packages/migrate/src/__tests__/fixtures/schema-folder-postgres/prisma/schema/config.prisma @@ -0,0 +1,10 @@ +datasource my_db { + provider = "postgresql" + url = env("TEST_POSTGRES_URI_MIGRATE") +} + +generator client { + provider = "prisma-client-js" + output = "@prisma/client" + previewFeatures = ["prismaSchemaFolder"] +} diff --git a/packages/migrate/src/__tests__/fixtures/schema-folder-sqlite-db-exists/prisma/dev.db b/packages/migrate/src/__tests__/fixtures/schema-folder-sqlite-db-exists/prisma/dev.db new file mode 100644 index 000000000000..2e3f67dd6628 Binary files /dev/null and b/packages/migrate/src/__tests__/fixtures/schema-folder-sqlite-db-exists/prisma/dev.db differ diff --git a/packages/migrate/src/__tests__/fixtures/schema-folder-sqlite-db-exists/prisma/migrations/20240527130802_init/migration.sql b/packages/migrate/src/__tests__/fixtures/schema-folder-sqlite-db-exists/prisma/migrations/20240527130802_init/migration.sql new file mode 100644 index 000000000000..0f7041331750 --- /dev/null +++ b/packages/migrate/src/__tests__/fixtures/schema-folder-sqlite-db-exists/prisma/migrations/20240527130802_init/migration.sql @@ -0,0 +1,12 @@ +-- CreateTable +CREATE TABLE "Blog" ( + "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + "viewCount20" INTEGER NOT NULL, + "ownerId" INTEGER NOT NULL, + CONSTRAINT "Blog_ownerId_fkey" FOREIGN KEY ("ownerId") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE +); + +-- CreateTable +CREATE TABLE "User" ( + "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT +); diff --git a/packages/migrate/src/__tests__/fixtures/schema-folder-sqlite-db-exists/prisma/migrations/migration_lock.toml b/packages/migrate/src/__tests__/fixtures/schema-folder-sqlite-db-exists/prisma/migrations/migration_lock.toml new file mode 100644 index 000000000000..e5e5c4705ab0 --- /dev/null +++ b/packages/migrate/src/__tests__/fixtures/schema-folder-sqlite-db-exists/prisma/migrations/migration_lock.toml @@ -0,0 +1,3 @@ +# Please do not edit this file manually +# It should be added in your version-control system (i.e. Git) +provider = "sqlite" \ No newline at end of file diff --git a/packages/migrate/src/__tests__/fixtures/schema-folder-sqlite-db-exists/prisma/schema/Blog.prisma b/packages/migrate/src/__tests__/fixtures/schema-folder-sqlite-db-exists/prisma/schema/Blog.prisma new file mode 100644 index 000000000000..a951a2ca201e --- /dev/null +++ b/packages/migrate/src/__tests__/fixtures/schema-folder-sqlite-db-exists/prisma/schema/Blog.prisma @@ -0,0 +1,6 @@ +model Blog { + id Int @id + viewCount20 Int + ownerId Int + owner User @relation(fields: [ownerId], references: [id]) +} diff --git a/packages/migrate/src/__tests__/fixtures/schema-folder-sqlite-db-exists/prisma/schema/User.prisma b/packages/migrate/src/__tests__/fixtures/schema-folder-sqlite-db-exists/prisma/schema/User.prisma new file mode 100644 index 000000000000..31feedd6ccd5 --- /dev/null +++ b/packages/migrate/src/__tests__/fixtures/schema-folder-sqlite-db-exists/prisma/schema/User.prisma @@ -0,0 +1,5 @@ +model User { + id Int @id + + blogs Blog[] +} diff --git a/packages/migrate/src/__tests__/fixtures/schema-folder-sqlite-db-exists/prisma/schema/config.prisma b/packages/migrate/src/__tests__/fixtures/schema-folder-sqlite-db-exists/prisma/schema/config.prisma new file mode 100644 index 000000000000..4d0587fcd545 --- /dev/null +++ b/packages/migrate/src/__tests__/fixtures/schema-folder-sqlite-db-exists/prisma/schema/config.prisma @@ -0,0 +1,10 @@ +datasource my_db { + provider = "sqlite" + url = "file:dev.db" +} + +generator client { + provider = "prisma-client-js" + output = "@prisma/client" + previewFeatures = ["prismaSchemaFolder"] +} diff --git a/packages/migrate/src/__tests__/fixtures/schema-folder-sqlite-migration-exists/prisma/migrations/20240527130802_init/migration.sql b/packages/migrate/src/__tests__/fixtures/schema-folder-sqlite-migration-exists/prisma/migrations/20240527130802_init/migration.sql new file mode 100644 index 000000000000..0f7041331750 --- /dev/null +++ b/packages/migrate/src/__tests__/fixtures/schema-folder-sqlite-migration-exists/prisma/migrations/20240527130802_init/migration.sql @@ -0,0 +1,12 @@ +-- CreateTable +CREATE TABLE "Blog" ( + "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + "viewCount20" INTEGER NOT NULL, + "ownerId" INTEGER NOT NULL, + CONSTRAINT "Blog_ownerId_fkey" FOREIGN KEY ("ownerId") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE +); + +-- CreateTable +CREATE TABLE "User" ( + "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT +); diff --git a/packages/migrate/src/__tests__/fixtures/schema-folder-sqlite-migration-exists/prisma/migrations/migration_lock.toml b/packages/migrate/src/__tests__/fixtures/schema-folder-sqlite-migration-exists/prisma/migrations/migration_lock.toml new file mode 100644 index 000000000000..e5e5c4705ab0 --- /dev/null +++ b/packages/migrate/src/__tests__/fixtures/schema-folder-sqlite-migration-exists/prisma/migrations/migration_lock.toml @@ -0,0 +1,3 @@ +# Please do not edit this file manually +# It should be added in your version-control system (i.e. Git) +provider = "sqlite" \ No newline at end of file diff --git a/packages/migrate/src/__tests__/fixtures/schema-folder-sqlite-migration-exists/prisma/schema/Blog.prisma b/packages/migrate/src/__tests__/fixtures/schema-folder-sqlite-migration-exists/prisma/schema/Blog.prisma new file mode 100644 index 000000000000..a951a2ca201e --- /dev/null +++ b/packages/migrate/src/__tests__/fixtures/schema-folder-sqlite-migration-exists/prisma/schema/Blog.prisma @@ -0,0 +1,6 @@ +model Blog { + id Int @id + viewCount20 Int + ownerId Int + owner User @relation(fields: [ownerId], references: [id]) +} diff --git a/packages/migrate/src/__tests__/fixtures/schema-folder-sqlite-migration-exists/prisma/schema/User.prisma b/packages/migrate/src/__tests__/fixtures/schema-folder-sqlite-migration-exists/prisma/schema/User.prisma new file mode 100644 index 000000000000..31feedd6ccd5 --- /dev/null +++ b/packages/migrate/src/__tests__/fixtures/schema-folder-sqlite-migration-exists/prisma/schema/User.prisma @@ -0,0 +1,5 @@ +model User { + id Int @id + + blogs Blog[] +} diff --git a/packages/migrate/src/__tests__/fixtures/schema-folder-sqlite-migration-exists/prisma/schema/config.prisma b/packages/migrate/src/__tests__/fixtures/schema-folder-sqlite-migration-exists/prisma/schema/config.prisma new file mode 100644 index 000000000000..4d0587fcd545 --- /dev/null +++ b/packages/migrate/src/__tests__/fixtures/schema-folder-sqlite-migration-exists/prisma/schema/config.prisma @@ -0,0 +1,10 @@ +datasource my_db { + provider = "sqlite" + url = "file:dev.db" +} + +generator client { + provider = "prisma-client-js" + output = "@prisma/client" + previewFeatures = ["prismaSchemaFolder"] +} diff --git a/packages/migrate/src/__tests__/fixtures/schema-folder-sqlite-migration-failed/prisma/dev.db b/packages/migrate/src/__tests__/fixtures/schema-folder-sqlite-migration-failed/prisma/dev.db new file mode 100644 index 000000000000..556de0419003 Binary files /dev/null and b/packages/migrate/src/__tests__/fixtures/schema-folder-sqlite-migration-failed/prisma/dev.db differ diff --git a/packages/migrate/src/__tests__/fixtures/schema-folder-sqlite-migration-failed/prisma/migrations/20240527130802_init/migration.sql b/packages/migrate/src/__tests__/fixtures/schema-folder-sqlite-migration-failed/prisma/migrations/20240527130802_init/migration.sql new file mode 100644 index 000000000000..b2c7f15dc766 --- /dev/null +++ b/packages/migrate/src/__tests__/fixtures/schema-folder-sqlite-migration-failed/prisma/migrations/20240527130802_init/migration.sql @@ -0,0 +1 @@ +BROKEN SCRIPT; \ No newline at end of file diff --git a/packages/migrate/src/__tests__/fixtures/schema-folder-sqlite-migration-failed/prisma/migrations/migration_lock.toml b/packages/migrate/src/__tests__/fixtures/schema-folder-sqlite-migration-failed/prisma/migrations/migration_lock.toml new file mode 100644 index 000000000000..e5e5c4705ab0 --- /dev/null +++ b/packages/migrate/src/__tests__/fixtures/schema-folder-sqlite-migration-failed/prisma/migrations/migration_lock.toml @@ -0,0 +1,3 @@ +# Please do not edit this file manually +# It should be added in your version-control system (i.e. Git) +provider = "sqlite" \ No newline at end of file diff --git a/packages/migrate/src/__tests__/fixtures/schema-folder-sqlite-migration-failed/prisma/schema/Blog.prisma b/packages/migrate/src/__tests__/fixtures/schema-folder-sqlite-migration-failed/prisma/schema/Blog.prisma new file mode 100644 index 000000000000..a951a2ca201e --- /dev/null +++ b/packages/migrate/src/__tests__/fixtures/schema-folder-sqlite-migration-failed/prisma/schema/Blog.prisma @@ -0,0 +1,6 @@ +model Blog { + id Int @id + viewCount20 Int + ownerId Int + owner User @relation(fields: [ownerId], references: [id]) +} diff --git a/packages/migrate/src/__tests__/fixtures/schema-folder-sqlite-migration-failed/prisma/schema/User.prisma b/packages/migrate/src/__tests__/fixtures/schema-folder-sqlite-migration-failed/prisma/schema/User.prisma new file mode 100644 index 000000000000..31feedd6ccd5 --- /dev/null +++ b/packages/migrate/src/__tests__/fixtures/schema-folder-sqlite-migration-failed/prisma/schema/User.prisma @@ -0,0 +1,5 @@ +model User { + id Int @id + + blogs Blog[] +} diff --git a/packages/migrate/src/__tests__/fixtures/schema-folder-sqlite-migration-failed/prisma/schema/config.prisma b/packages/migrate/src/__tests__/fixtures/schema-folder-sqlite-migration-failed/prisma/schema/config.prisma new file mode 100644 index 000000000000..4d0587fcd545 --- /dev/null +++ b/packages/migrate/src/__tests__/fixtures/schema-folder-sqlite-migration-failed/prisma/schema/config.prisma @@ -0,0 +1,10 @@ +datasource my_db { + provider = "sqlite" + url = "file:dev.db" +} + +generator client { + provider = "prisma-client-js" + output = "@prisma/client" + previewFeatures = ["prismaSchemaFolder"] +} diff --git a/packages/migrate/src/__tests__/fixtures/schema-folder-sqlite/prisma/schema/Blog.prisma b/packages/migrate/src/__tests__/fixtures/schema-folder-sqlite/prisma/schema/Blog.prisma new file mode 100644 index 000000000000..a951a2ca201e --- /dev/null +++ b/packages/migrate/src/__tests__/fixtures/schema-folder-sqlite/prisma/schema/Blog.prisma @@ -0,0 +1,6 @@ +model Blog { + id Int @id + viewCount20 Int + ownerId Int + owner User @relation(fields: [ownerId], references: [id]) +} diff --git a/packages/migrate/src/__tests__/fixtures/schema-folder-sqlite/prisma/schema/User.prisma b/packages/migrate/src/__tests__/fixtures/schema-folder-sqlite/prisma/schema/User.prisma new file mode 100644 index 000000000000..31feedd6ccd5 --- /dev/null +++ b/packages/migrate/src/__tests__/fixtures/schema-folder-sqlite/prisma/schema/User.prisma @@ -0,0 +1,5 @@ +model User { + id Int @id + + blogs Blog[] +} diff --git a/packages/migrate/src/__tests__/fixtures/schema-folder-sqlite/prisma/schema/config.prisma b/packages/migrate/src/__tests__/fixtures/schema-folder-sqlite/prisma/schema/config.prisma new file mode 100644 index 000000000000..4d0587fcd545 --- /dev/null +++ b/packages/migrate/src/__tests__/fixtures/schema-folder-sqlite/prisma/schema/config.prisma @@ -0,0 +1,10 @@ +datasource my_db { + provider = "sqlite" + url = "file:dev.db" +} + +generator client { + provider = "prisma-client-js" + output = "@prisma/client" + previewFeatures = ["prismaSchemaFolder"] +} diff --git a/packages/migrate/src/__tests__/fixtures/schema-folder-sqlserver/prisma/schema/Blog.prisma b/packages/migrate/src/__tests__/fixtures/schema-folder-sqlserver/prisma/schema/Blog.prisma new file mode 100644 index 000000000000..a951a2ca201e --- /dev/null +++ b/packages/migrate/src/__tests__/fixtures/schema-folder-sqlserver/prisma/schema/Blog.prisma @@ -0,0 +1,6 @@ +model Blog { + id Int @id + viewCount20 Int + ownerId Int + owner User @relation(fields: [ownerId], references: [id]) +} diff --git a/packages/migrate/src/__tests__/fixtures/schema-folder-sqlserver/prisma/schema/User.prisma b/packages/migrate/src/__tests__/fixtures/schema-folder-sqlserver/prisma/schema/User.prisma new file mode 100644 index 000000000000..31feedd6ccd5 --- /dev/null +++ b/packages/migrate/src/__tests__/fixtures/schema-folder-sqlserver/prisma/schema/User.prisma @@ -0,0 +1,5 @@ +model User { + id Int @id + + blogs Blog[] +} diff --git a/packages/migrate/src/__tests__/fixtures/schema-folder-sqlserver/prisma/schema/config.prisma b/packages/migrate/src/__tests__/fixtures/schema-folder-sqlserver/prisma/schema/config.prisma new file mode 100644 index 000000000000..f109043b98bc --- /dev/null +++ b/packages/migrate/src/__tests__/fixtures/schema-folder-sqlserver/prisma/schema/config.prisma @@ -0,0 +1,10 @@ +datasource my_db { + provider = "sqlserver" + url = env("TEST_MSSQL_JDBC_URI_MIGRATE") +} + +generator client { + provider = "prisma-client-js" + output = "@prisma/client" + previewFeatures = ["prismaSchemaFolder"] +} diff --git a/packages/migrate/src/__tests__/fixtures/schema-sqlite-d1-24208/prisma/schema-0002_rename_new_field.prisma b/packages/migrate/src/__tests__/fixtures/schema-sqlite-d1-24208/prisma/schema-0002_rename_new_field.prisma new file mode 100644 index 000000000000..0a09c5481ca9 --- /dev/null +++ b/packages/migrate/src/__tests__/fixtures/schema-sqlite-d1-24208/prisma/schema-0002_rename_new_field.prisma @@ -0,0 +1,28 @@ +generator client { + provider = "prisma-client-js" + previewFeatures = ["driverAdapters"] +} + +datasource db { + provider = "sqlite" + url = "file:./dev.db" +} + +model User { + id Int @id @default(autoincrement()) + createdAt DateTime @default(now()) + email String @unique + name String? + posts Post[] + // previously: `oldField` + newField String? +} + +model Post { + id Int @id @default(autoincrement()) + createdAt DateTime @default(now()) + updatedAt DateTime? @updatedAt + title String + author User @relation(fields: [authorId], references: [id]) + authorId Int +} diff --git a/packages/migrate/src/__tests__/fixtures/schema-sqlite-d1-24208/prisma/schema.prisma b/packages/migrate/src/__tests__/fixtures/schema-sqlite-d1-24208/prisma/schema.prisma new file mode 100644 index 000000000000..e6a4702e8183 --- /dev/null +++ b/packages/migrate/src/__tests__/fixtures/schema-sqlite-d1-24208/prisma/schema.prisma @@ -0,0 +1,28 @@ +generator client { + provider = "prisma-client-js" + previewFeatures = ["driverAdapters"] +} + +datasource db { + provider = "sqlite" + url = "file:./dev.db" +} + +model User { + id Int @id @default(autoincrement()) + createdAt DateTime @default(now()) + email String @unique + name String? + posts Post[] + // rename this field, let's say to `newField` + oldField String? +} + +model Post { + id Int @id @default(autoincrement()) + createdAt DateTime @default(now()) + updatedAt DateTime? @updatedAt + title String + author User @relation(fields: [authorId], references: [id]) + authorId Int +} diff --git a/packages/migrate/src/__tests__/fixtures/schema-sqlite-d1-24208/wrangler.toml b/packages/migrate/src/__tests__/fixtures/schema-sqlite-d1-24208/wrangler.toml new file mode 100644 index 000000000000..16982a9191e2 --- /dev/null +++ b/packages/migrate/src/__tests__/fixtures/schema-sqlite-d1-24208/wrangler.toml @@ -0,0 +1,5 @@ +[[d1_databases]] +binding = "DB" # Should match preview_database_id +database_name = "D1_DATABASE" +database_id = "the-id-of-your-D1-database-goes-here" # wrangler d1 info YOUR_DATABASE_NAME +preview_database_id = "DB" # Required for Pages local development diff --git a/packages/migrate/src/__tests__/fixtures/schema-sqlite-d1-change-all-referenced-columns/prisma/schema-0002_change_all_referenced_columns.prisma b/packages/migrate/src/__tests__/fixtures/schema-sqlite-d1-change-all-referenced-columns/prisma/schema-0002_change_all_referenced_columns.prisma new file mode 100644 index 000000000000..a2c9ed2ed40f --- /dev/null +++ b/packages/migrate/src/__tests__/fixtures/schema-sqlite-d1-change-all-referenced-columns/prisma/schema-0002_change_all_referenced_columns.prisma @@ -0,0 +1,20 @@ +generator client { + provider = "prisma-client-js" + previewFeatures = ["driverAdapters"] +} + +datasource db { + provider = "sqlite" + url = "file:./dev.db" +} + +model Post { + id Int @id @default(autoincrement()) + author User? @relation(fields: [authorId], references: [uid]) + authorId Int? +} + +model User { + uid Int @id + posts Post[] +} diff --git a/packages/migrate/src/__tests__/fixtures/schema-sqlite-d1-change-all-referenced-columns/prisma/schema.prisma b/packages/migrate/src/__tests__/fixtures/schema-sqlite-d1-change-all-referenced-columns/prisma/schema.prisma new file mode 100644 index 000000000000..e25d01bc85f7 --- /dev/null +++ b/packages/migrate/src/__tests__/fixtures/schema-sqlite-d1-change-all-referenced-columns/prisma/schema.prisma @@ -0,0 +1,20 @@ +generator client { + provider = "prisma-client-js" + previewFeatures = ["driverAdapters"] +} + +datasource db { + provider = "sqlite" + url = "file:./dev.db" +} + +model Post { + id Int @id @default(autoincrement()) + author User? @relation(fields: [authorId], references: [id]) + authorId Int? +} + +model User { + id Int @id @default(autoincrement()) + posts Post[] +} diff --git a/packages/migrate/src/__tests__/fixtures/schema-sqlite-d1-change-all-referenced-columns/wrangler.toml b/packages/migrate/src/__tests__/fixtures/schema-sqlite-d1-change-all-referenced-columns/wrangler.toml new file mode 100644 index 000000000000..16982a9191e2 --- /dev/null +++ b/packages/migrate/src/__tests__/fixtures/schema-sqlite-d1-change-all-referenced-columns/wrangler.toml @@ -0,0 +1,5 @@ +[[d1_databases]] +binding = "DB" # Should match preview_database_id +database_name = "D1_DATABASE" +database_id = "the-id-of-your-D1-database-goes-here" # wrangler d1 info YOUR_DATABASE_NAME +preview_database_id = "DB" # Required for Pages local development diff --git a/packages/migrate/src/__tests__/fixtures/schema-sqlite-d1-migrations-do-not-cause-data-loss/prisma/schema-0002_passport_number_to_string.prisma b/packages/migrate/src/__tests__/fixtures/schema-sqlite-d1-migrations-do-not-cause-data-loss/prisma/schema-0002_passport_number_to_string.prisma new file mode 100644 index 000000000000..a77d746a987b --- /dev/null +++ b/packages/migrate/src/__tests__/fixtures/schema-sqlite-d1-migrations-do-not-cause-data-loss/prisma/schema-0002_passport_number_to_string.prisma @@ -0,0 +1,24 @@ +generator client { + provider = "prisma-client-js" + previewFeatures = ["driverAdapters"] +} + +datasource db { + provider = "sqlite" + url = "file:./dev.db" +} + +model Dog { + name String + passportNumber String + p Puppy[] + + @@id([name, passportNumber]) +} + +model Puppy { + id String @id + motherName String + motherPassportNumber String + mother Dog @relation(fields: [motherName, motherPassportNumber], references: [name, passportNumber]) +} diff --git a/packages/migrate/src/__tests__/fixtures/schema-sqlite-d1-migrations-do-not-cause-data-loss/prisma/schema.prisma b/packages/migrate/src/__tests__/fixtures/schema-sqlite-d1-migrations-do-not-cause-data-loss/prisma/schema.prisma new file mode 100644 index 000000000000..baba1c7af194 --- /dev/null +++ b/packages/migrate/src/__tests__/fixtures/schema-sqlite-d1-migrations-do-not-cause-data-loss/prisma/schema.prisma @@ -0,0 +1,24 @@ +generator client { + provider = "prisma-client-js" + previewFeatures = ["driverAdapters"] +} + +datasource db { + provider = "sqlite" + url = "file:./dev.db" +} + +model Dog { + name String + passportNumber Int + p Puppy[] + + @@id([name, passportNumber]) +} + +model Puppy { + id String @id + motherName String + motherPassportNumber Int + mother Dog @relation(fields: [motherName, motherPassportNumber], references: [name, passportNumber]) +} diff --git a/packages/migrate/src/__tests__/fixtures/schema-sqlite-d1-migrations-do-not-cause-data-loss/wrangler.toml b/packages/migrate/src/__tests__/fixtures/schema-sqlite-d1-migrations-do-not-cause-data-loss/wrangler.toml new file mode 100644 index 000000000000..16982a9191e2 --- /dev/null +++ b/packages/migrate/src/__tests__/fixtures/schema-sqlite-d1-migrations-do-not-cause-data-loss/wrangler.toml @@ -0,0 +1,5 @@ +[[d1_databases]] +binding = "DB" # Should match preview_database_id +database_name = "D1_DATABASE" +database_id = "the-id-of-your-D1-database-goes-here" # wrangler d1 info YOUR_DATABASE_NAME +preview_database_id = "DB" # Required for Pages local development diff --git a/packages/migrate/src/__tests__/fixtures/schema-sqlite-d1-mutual-references/prisma/schema-0002_add_mutual_references.prisma b/packages/migrate/src/__tests__/fixtures/schema-sqlite-d1-mutual-references/prisma/schema-0002_add_mutual_references.prisma new file mode 100644 index 000000000000..349eabdc9867 --- /dev/null +++ b/packages/migrate/src/__tests__/fixtures/schema-sqlite-d1-mutual-references/prisma/schema-0002_add_mutual_references.prisma @@ -0,0 +1,25 @@ +generator client { + provider = "prisma-client-js" + previewFeatures = ["driverAdapters"] +} + +datasource db { + provider = "sqlite" + url = "file:./dev.db" +} + +model A { + id Int + name String @unique + b_email String + brel B @relation("AtoB", fields: [b_email], references: [email], onDelete: NoAction, onUpdate: NoAction) + b B[] @relation("BtoA") +} + +model B { + id Int + email String @unique + a_name String + arel A @relation("BtoA", fields: [a_name], references: [name], onDelete: NoAction, onUpdate: NoAction) + a A[] @relation("AtoB") +} diff --git a/packages/migrate/src/__tests__/fixtures/schema-sqlite-d1-mutual-references/prisma/schema.prisma b/packages/migrate/src/__tests__/fixtures/schema-sqlite-d1-mutual-references/prisma/schema.prisma new file mode 100644 index 000000000000..bfb21285b1f6 --- /dev/null +++ b/packages/migrate/src/__tests__/fixtures/schema-sqlite-d1-mutual-references/prisma/schema.prisma @@ -0,0 +1,17 @@ +generator client { + provider = "prisma-client-js" + previewFeatures = ["driverAdapters"] +} + +datasource db { + provider = "sqlite" + url = "file:./dev.db" +} + +model A { + id Int @id +} + +model B { + id Int @id +} diff --git a/packages/migrate/src/__tests__/fixtures/schema-sqlite-d1-mutual-references/wrangler.toml b/packages/migrate/src/__tests__/fixtures/schema-sqlite-d1-mutual-references/wrangler.toml new file mode 100644 index 000000000000..16982a9191e2 --- /dev/null +++ b/packages/migrate/src/__tests__/fixtures/schema-sqlite-d1-mutual-references/wrangler.toml @@ -0,0 +1,5 @@ +[[d1_databases]] +binding = "DB" # Should match preview_database_id +database_name = "D1_DATABASE" +database_id = "the-id-of-your-D1-database-goes-here" # wrangler d1 info YOUR_DATABASE_NAME +preview_database_id = "DB" # Required for Pages local development diff --git a/packages/migrate/src/__tests__/fixtures/schema-sqlite-d1/prisma/schema-0002_add_count_to_user_table.prisma b/packages/migrate/src/__tests__/fixtures/schema-sqlite-d1/prisma/schema-0002_add_count_to_user_table.prisma new file mode 100644 index 000000000000..1fb24e275906 --- /dev/null +++ b/packages/migrate/src/__tests__/fixtures/schema-sqlite-d1/prisma/schema-0002_add_count_to_user_table.prisma @@ -0,0 +1,26 @@ +generator client { + provider = "prisma-client-js" + previewFeatures = ["driverAdapters"] +} + +datasource db { + provider = "sqlite" + url = "file:./dev.db" +} + +model Post { + id Int @id @default(autoincrement()) + title String + content String? + published Boolean @default(false) + author User @relation(fields: [authorId], references: [id]) + authorId Int +} + +model User { + id Int @id @default(autoincrement()) + email String @unique + name String? + count Int + Post Post[] +} diff --git a/packages/migrate/src/__tests__/fixtures/schema-sqlite-d1/prisma/schema-0003_change_user_id_to_count.prisma b/packages/migrate/src/__tests__/fixtures/schema-sqlite-d1/prisma/schema-0003_change_user_id_to_count.prisma new file mode 100644 index 000000000000..76d6786e779a --- /dev/null +++ b/packages/migrate/src/__tests__/fixtures/schema-sqlite-d1/prisma/schema-0003_change_user_id_to_count.prisma @@ -0,0 +1,26 @@ +generator client { + provider = "prisma-client-js" + previewFeatures = ["driverAdapters"] +} + +datasource db { + provider = "sqlite" + url = "file:./dev.db" +} + +model Post { + id Int @id @default(autoincrement()) + title String + content String? + published Boolean @default(false) + author User @relation(fields: [authorId], references: [count]) + authorId Int +} + +model User { + id Int + email String @unique + name String? + count Int @id @default(autoincrement()) + Post Post[] +} diff --git a/packages/migrate/src/__tests__/fixtures/schema-sqlite-d1/prisma/schema.prisma b/packages/migrate/src/__tests__/fixtures/schema-sqlite-d1/prisma/schema.prisma new file mode 100644 index 000000000000..b2cb077765dd --- /dev/null +++ b/packages/migrate/src/__tests__/fixtures/schema-sqlite-d1/prisma/schema.prisma @@ -0,0 +1,25 @@ +generator client { + provider = "prisma-client-js" + previewFeatures = ["driverAdapters"] +} + +datasource db { + provider = "sqlite" + url = "file:./dev.db" +} + +model Post { + id Int @id @default(autoincrement()) + title String + content String? + published Boolean @default(false) + author User @relation(fields: [authorId], references: [id]) + authorId Int +} + +model User { + id Int @id @default(autoincrement()) + email String @unique + name String? + Post Post[] +} diff --git a/packages/migrate/src/__tests__/fixtures/schema-sqlite-d1/wrangler.toml b/packages/migrate/src/__tests__/fixtures/schema-sqlite-d1/wrangler.toml new file mode 100644 index 000000000000..16982a9191e2 --- /dev/null +++ b/packages/migrate/src/__tests__/fixtures/schema-sqlite-d1/wrangler.toml @@ -0,0 +1,5 @@ +[[d1_databases]] +binding = "DB" # Should match preview_database_id +database_name = "D1_DATABASE" +database_id = "the-id-of-your-D1-database-goes-here" # wrangler d1 info YOUR_DATABASE_NAME +preview_database_id = "DB" # Required for Pages local development diff --git a/packages/migrate/src/__tests__/introspection/introspection.test.ts b/packages/migrate/src/__tests__/introspection/introspection.test.ts index 2dc4d38e4e30..f5e4f2282c48 100644 --- a/packages/migrate/src/__tests__/introspection/introspection.test.ts +++ b/packages/migrate/src/__tests__/introspection/introspection.test.ts @@ -1,20 +1,24 @@ +import { toSchemasContainer } from '@prisma/internals' import fs from 'fs' import path from 'path' import { SchemaEngine } from '../../SchemaEngine' test('introspection basic', async () => { + const schemaPath = path.join(__dirname, 'schema.prisma') const engine = new SchemaEngine({ projectDir: __dirname, - schemaPath: 'schema.prisma', + schemaPath, }) - const schema = await fs.promises.readFile(path.join(__dirname, 'schema.prisma'), { encoding: 'utf-8' }) + const schemaContent = await fs.promises.readFile(schemaPath, { encoding: 'utf-8' }) + + const schema = toSchemasContainer([['schema.prisma', schemaContent]]) const dbVersion = await engine.getDatabaseVersion({ datasource: { - tag: 'SchemaString', - schema, + tag: 'Schema', + ...schema, }, }) expect(dbVersion.length > 0).toBe(true) diff --git a/packages/migrate/src/__tests__/local-clouflare-d1-db-e2e.test.ts b/packages/migrate/src/__tests__/local-clouflare-d1-db-e2e.test.ts new file mode 100644 index 000000000000..01fbb6afc6b5 --- /dev/null +++ b/packages/migrate/src/__tests__/local-clouflare-d1-db-e2e.test.ts @@ -0,0 +1,691 @@ +import { type BaseContext, jestConsoleContext, jestContext } from '@prisma/get-platform' +import execa from 'execa' +import path from 'path' + +import { MigrateDiff } from '../../src' + +const ctx = jestContext.new().add(jestConsoleContext()).assemble() + +describe('d1 local', () => { + async function runWranglerCLI(ctx: BaseContext, ...args: string[]) { + return await execa('pnpm', ['wrangler', '--config', path.join(ctx.tmpDir, 'wrangler.toml'), ...args], { + cwd: __dirname, + }) + } + + async function createWranglerD1Migration(ctx: BaseContext, { name }: { name: string }) { + return await runWranglerCLI(ctx, 'd1', 'migrations', 'create', 'D1_DATABASE', name) + } + + async function applyWranglerD1Migration(ctx: BaseContext) { + return await runWranglerCLI(ctx, 'd1', 'migrations', 'apply', 'D1_DATABASE', '--local') + } + + async function executeWranglerD1Command(ctx: BaseContext, { command, json }: { command: string; json?: boolean }) { + const args = ['d1', 'execute', 'D1_DATABASE', '--local', '--command', command] + + if (json) { + args.push('--json') + } + + return await runWranglerCLI(ctx, ...args) + } + + // We follow the steps in https://www.prisma.io/docs/orm/overview/databases/cloudflare-d1#migration-workflows. + describe('d1 migration workflow', () => { + // See changing_all_referenced_columns_of_foreign_key_works + // in https://github.com/prisma/prisma-engines/blob/f8f78f335fd86dea323d7fbc581fdf500d745e9a/schema-engine/sql-migration-tests/tests/migrations/foreign_keys.rs#L287-L318. + it.failing( + 'changing_all_referenced_columns_of_foreign_key_works', + async () => { + const cliInstance = MigrateDiff.new() + ctx.fixture('schema-sqlite-d1-change-all-referenced-columns') + + // Create D1 database + const wranglerCreateD1 = await executeWranglerD1Command(ctx, { command: 'SELECT 1;' }) + expect(wranglerCreateD1.exitCode).toBe(0) + + // Create `init` migration file for D1 using `wrangler d1 migrations` + const wranglerCreateInitMigration = await createWranglerD1Migration(ctx, { name: 'init' }) + expect(wranglerCreateInitMigration.exitCode).toBe(0) + + // Create `init` SQL migration using `prisma migrate diff` + const prismaCreateInitMigration = cliInstance.parse([ + '--from-empty', + '--to-schema-datamodel', + './prisma/schema.prisma', + '--script', + '--output', + './migrations/0001_init.sql', + ]) + await expect(prismaCreateInitMigration).resolves.toMatchInlineSnapshot(`""`) + + // Print the `init` SQL migration file + const initMigrationSQL = ctx.fs.readAsync('./migrations/0001_init.sql') + await expect(initMigrationSQL).resolves.toMatchInlineSnapshot(` + "-- CreateTable + CREATE TABLE "Post" ( + "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + "authorId" INTEGER, + CONSTRAINT "Post_authorId_fkey" FOREIGN KEY ("authorId") REFERENCES "User" ("id") ON DELETE SET NULL ON UPDATE CASCADE + ); + + -- CreateTable + CREATE TABLE "User" ( + "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT + ); + " + `) + + // Apply `init` migration to D1 + const wranglerExecuteInitMigration = await applyWranglerD1Migration(ctx) + expect(wranglerExecuteInitMigration.exitCode).toBe(0) + + // + // Evolve the Prisma data model + // + + // Create `change_all_referenced_columns` migration file for D1 using `wrangler d1 migrations` + const wrangler2ndMigration = await createWranglerD1Migration(ctx, { + name: 'change_all_referenced_columns', + }) + expect(wrangler2ndMigration.exitCode).toBe(0) + + // Create `change_all_referenced_columns` migration SQL using `prisma migrate diff` + const prisma2ndMigration = cliInstance.parse([ + '--from-local-d1', + '--to-schema-datamodel', + './prisma/schema-0002_change_all_referenced_columns.prisma', + '--script', + '--output', + './migrations/0002_change_all_referenced_columns.sql', + ]) + await expect(prisma2ndMigration).resolves.toMatchInlineSnapshot(`""`) + + // Print the `change_all_referenced_columns` SQL migration file + const prisma2ndMigrationSQL = ctx.fs.readAsync('./migrations/0002_change_all_referenced_columns.sql') + await expect(prisma2ndMigrationSQL).resolves.toMatchInlineSnapshot(` + "-- RedefineTables + PRAGMA defer_foreign_keys=ON; + PRAGMA foreign_keys=OFF; + CREATE TABLE "new_Post" ( + "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + "authorId" INTEGER, + CONSTRAINT "Post_authorId_fkey" FOREIGN KEY ("authorId") REFERENCES "User" ("uid") ON DELETE SET NULL ON UPDATE CASCADE + ); + INSERT INTO "new_Post" ("authorId", "id") SELECT "authorId", "id" FROM "Post"; + DROP TABLE "Post"; + ALTER TABLE "new_Post" RENAME TO "Post"; + CREATE TABLE "new_User" ( + "uid" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT + ); + DROP TABLE "User"; + ALTER TABLE "new_User" RENAME TO "User"; + PRAGMA foreign_keys=ON; + PRAGMA defer_foreign_keys=OFF; + " + `) + + // Apply `change_all_referenced_columns` migration to D1 + // TODO: Currently failing with `foreign key mismatch - "new_Post" referencing "User"` + await applyWranglerD1Migration(ctx) + }, + 60_000, + ) + + // See migration_tests::existing_data::primary_key_migrations_do_not_cause_data_loss + // in https://github.com/prisma/prisma-engines/blob/6e26301fe272ba4ba0598fe43eb5d8df030be4db/schema-engine/sql-migration-tests/tests/existing_data/mod.rs#L784-L866. + it('migration_tests::existing_data::primary_key_migrations_do_not_cause_data_loss', async () => { + const cliInstance = MigrateDiff.new() + ctx.fixture('schema-sqlite-d1-migrations-do-not-cause-data-loss') + + // Create D1 database + const wranglerCreateD1 = await executeWranglerD1Command(ctx, { command: 'SELECT 1;' }) + expect(wranglerCreateD1.exitCode).toBe(0) + + // Create `init` migration file for D1 using `wrangler d1 migrations` + const wranglerCreateInitMigration = await createWranglerD1Migration(ctx, { name: 'init' }) + expect(wranglerCreateInitMigration.exitCode).toBe(0) + + // Create `init` SQL migration using `prisma migrate diff` + const prismaCreateInitMigration = cliInstance.parse([ + '--from-empty', + '--to-schema-datamodel', + './prisma/schema.prisma', + '--script', + '--output', + './migrations/0001_init.sql', + ]) + await expect(prismaCreateInitMigration).resolves.toMatchInlineSnapshot(`""`) + + // Print the `init` SQL migration file + const initMigrationSQL = ctx.fs.readAsync('./migrations/0001_init.sql') + await expect(initMigrationSQL).resolves.toMatchInlineSnapshot(` + "-- CreateTable + CREATE TABLE "Dog" ( + "name" TEXT NOT NULL, + "passportNumber" INTEGER NOT NULL, + + PRIMARY KEY ("name", "passportNumber") + ); + + -- CreateTable + CREATE TABLE "Puppy" ( + "id" TEXT NOT NULL PRIMARY KEY, + "motherName" TEXT NOT NULL, + "motherPassportNumber" INTEGER NOT NULL, + CONSTRAINT "Puppy_motherName_motherPassportNumber_fkey" FOREIGN KEY ("motherName", "motherPassportNumber") REFERENCES "Dog" ("name", "passportNumber") ON DELETE RESTRICT ON UPDATE CASCADE + ); + " + `) + + // Apply `init` migration to D1 + const wranglerExecuteInitMigration = await applyWranglerD1Migration(ctx) + expect(wranglerExecuteInitMigration.exitCode).toBe(0) + + // Seed some data into D1. + + const wranglerSeedUsers = await executeWranglerD1Command(ctx, { + command: `INSERT INTO Dog ('name', 'passportNumber') VALUES ('Marnie', 8000);`, + }) + expect(wranglerSeedUsers.exitCode).toBe(0) + + const wranglerSeedPosts = await executeWranglerD1Command(ctx, { + command: `INSERT INTO Puppy ('id', 'motherName', 'motherPassportNumber') VALUES ('12345', 'Marnie', 8000);`, + }) + expect(wranglerSeedPosts.exitCode).toBe(0) + + // + // Evolve the Prisma data model + // + + // Create `passport_number_to_string` migration file for D1 using `wrangler d1 migrations` + const wrangler2ndMigration = await createWranglerD1Migration(ctx, { + name: 'passport_number_to_string', + }) + expect(wrangler2ndMigration.exitCode).toBe(0) + + // Create `passport_number_to_string` migration SQL using `prisma migrate diff` + const prisma2ndMigration = cliInstance.parse([ + '--from-local-d1', + '--to-schema-datamodel', + './prisma/schema-0002_passport_number_to_string.prisma', + '--script', + '--output', + './migrations/0002_passport_number_to_string.sql', + ]) + await expect(prisma2ndMigration).resolves.toMatchInlineSnapshot(`""`) + + // Print the `passport_number_to_string` SQL migration file + const prisma2ndMigrationSQL = ctx.fs.readAsync('./migrations/0002_passport_number_to_string.sql') + await expect(prisma2ndMigrationSQL).resolves.toMatchInlineSnapshot(` + "-- RedefineTables + PRAGMA defer_foreign_keys=ON; + PRAGMA foreign_keys=OFF; + CREATE TABLE "new_Dog" ( + "name" TEXT NOT NULL, + "passportNumber" TEXT NOT NULL, + + PRIMARY KEY ("name", "passportNumber") + ); + INSERT INTO "new_Dog" ("name", "passportNumber") SELECT "name", "passportNumber" FROM "Dog"; + DROP TABLE "Dog"; + ALTER TABLE "new_Dog" RENAME TO "Dog"; + CREATE TABLE "new_Puppy" ( + "id" TEXT NOT NULL PRIMARY KEY, + "motherName" TEXT NOT NULL, + "motherPassportNumber" TEXT NOT NULL, + CONSTRAINT "Puppy_motherName_motherPassportNumber_fkey" FOREIGN KEY ("motherName", "motherPassportNumber") REFERENCES "Dog" ("name", "passportNumber") ON DELETE RESTRICT ON UPDATE CASCADE + ); + INSERT INTO "new_Puppy" ("id", "motherName", "motherPassportNumber") SELECT "id", "motherName", "motherPassportNumber" FROM "Puppy"; + DROP TABLE "Puppy"; + ALTER TABLE "new_Puppy" RENAME TO "Puppy"; + PRAGMA foreign_keys=ON; + PRAGMA defer_foreign_keys=OFF; + " + `) + + // Apply `passport_number_to_string` migration to D1 + await applyWranglerD1Migration(ctx) + }, 60_000) + + // See `migration_tests::migrations::relations::adding_mutual_references_on_existing_tables_works` + // in https://github.com/prisma/prisma-engines/blob/main/schema-engine/sql-migration-tests/tests/migrations/relations.rs. + it.failing( + 'relations::adding_mutual_references_on_existing_tables_works', + async () => { + const cliInstance = MigrateDiff.new() + ctx.fixture('schema-sqlite-d1-mutual-references') + + // Create D1 database + const wranglerCreateD1 = await executeWranglerD1Command(ctx, { command: 'SELECT 1;' }) + expect(wranglerCreateD1.exitCode).toBe(0) + + // Create `init` migration file for D1 using `wrangler d1 migrations` + const wranglerCreateInitMigration = await createWranglerD1Migration(ctx, { name: 'init' }) + expect(wranglerCreateInitMigration.exitCode).toBe(0) + + // Create `init` SQL migration using `prisma migrate diff` + const prismaCreateInitMigration = cliInstance.parse([ + '--from-empty', + '--to-schema-datamodel', + './prisma/schema.prisma', + '--script', + '--output', + './migrations/0001_init.sql', + ]) + await expect(prismaCreateInitMigration).resolves.toMatchInlineSnapshot(`""`) + + // Print the `init` SQL migration file + const initMigrationSQL = ctx.fs.readAsync('./migrations/0001_init.sql') + await expect(initMigrationSQL).resolves.toMatchInlineSnapshot(` + "-- CreateTable + CREATE TABLE "A" ( + "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT + ); + + -- CreateTable + CREATE TABLE "B" ( + "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT + ); + " + `) + + // Apply `init` migration to D1 + const wranglerExecuteInitMigration = await applyWranglerD1Migration(ctx) + expect(wranglerExecuteInitMigration.exitCode).toBe(0) + + // + // Evolve the Prisma data model + // + + // Create `add_mutual_references` migration file for D1 using `wrangler d1 migrations` + const wrangler2ndMigration = await createWranglerD1Migration(ctx, { + name: 'add_mutual_references', + }) + expect(wrangler2ndMigration.exitCode).toBe(0) + + // Create `add_mutual_references` migration SQL using `prisma migrate diff` + const prisma2ndMigration = cliInstance.parse([ + '--from-local-d1', + '--to-schema-datamodel', + './prisma/schema-0002_add_mutual_references.prisma', + '--script', + '--output', + './migrations/0002_add_mutual_references.sql', + ]) + await expect(prisma2ndMigration).resolves.toMatchInlineSnapshot(`""`) + + // Print the `add_mutual_references` SQL migration file + const prisma2ndMigrationSQL = ctx.fs.readAsync('./migrations/0002_add_mutual_references.sql') + await expect(prisma2ndMigrationSQL).resolves.toMatchInlineSnapshot(` + "-- RedefineTables + PRAGMA defer_foreign_keys=ON; + PRAGMA foreign_keys=OFF; + CREATE TABLE "new_A" ( + "id" INTEGER NOT NULL, + "name" TEXT NOT NULL, + "b_email" TEXT NOT NULL, + CONSTRAINT "A_b_email_fkey" FOREIGN KEY ("b_email") REFERENCES "B" ("email") ON DELETE NO ACTION ON UPDATE NO ACTION + ); + INSERT INTO "new_A" ("id") SELECT "id" FROM "A"; + DROP TABLE "A"; + ALTER TABLE "new_A" RENAME TO "A"; + CREATE UNIQUE INDEX "A_name_key" ON "A"("name"); + CREATE TABLE "new_B" ( + "id" INTEGER NOT NULL, + "email" TEXT NOT NULL, + "a_name" TEXT NOT NULL, + CONSTRAINT "B_a_name_fkey" FOREIGN KEY ("a_name") REFERENCES "A" ("name") ON DELETE NO ACTION ON UPDATE NO ACTION + ); + INSERT INTO "new_B" ("id") SELECT "id" FROM "B"; + DROP TABLE "B"; + ALTER TABLE "new_B" RENAME TO "B"; + CREATE UNIQUE INDEX "B_email_key" ON "B"("email"); + PRAGMA foreign_keys=ON; + PRAGMA defer_foreign_keys=OFF; + " + `) + + // Apply `add_mutual_references` migration to D1 + // TODO: currently fails with `foreign key mismatch - "new_A" referencing "B"` + await applyWranglerD1Migration(ctx) + }, + 60_000, + ) + + // Based on: https://github.com/prisma/prisma/issues/24208 + it('issue #24208 - broken migrations with relations', async () => { + const cliInstance = MigrateDiff.new() + ctx.fixture('schema-sqlite-d1-24208') + + // Create D1 database + const wranglerCreateD1 = await executeWranglerD1Command(ctx, { command: 'SELECT 1;' }) + expect(wranglerCreateD1.exitCode).toBe(0) + + // Create `init` migration file for D1 using `wrangler d1 migrations` + const wranglerCreateInitMigration = await createWranglerD1Migration(ctx, { name: 'init' }) + expect(wranglerCreateInitMigration.exitCode).toBe(0) + + // Create `init` SQL migration using `prisma migrate diff` + const prismaCreateInitMigration = cliInstance.parse([ + '--from-empty', + '--to-schema-datamodel', + './prisma/schema.prisma', + '--script', + '--output', + './migrations/0001_init.sql', + ]) + await expect(prismaCreateInitMigration).resolves.toMatchInlineSnapshot(`""`) + + // Print the `init` SQL migration file + const initMigrationSQL = ctx.fs.readAsync('./migrations/0001_init.sql') + await expect(initMigrationSQL).resolves.toMatchInlineSnapshot(` + "-- CreateTable + CREATE TABLE "User" ( + "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + "email" TEXT NOT NULL, + "name" TEXT, + "oldField" TEXT + ); + + -- CreateTable + CREATE TABLE "Post" ( + "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" DATETIME, + "title" TEXT NOT NULL, + "authorId" INTEGER NOT NULL, + CONSTRAINT "Post_authorId_fkey" FOREIGN KEY ("authorId") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE + ); + + -- CreateIndex + CREATE UNIQUE INDEX "User_email_key" ON "User"("email"); + " + `) + + // Apply `init` migration to D1 + const wranglerExecuteInitMigration = await applyWranglerD1Migration(ctx) + expect(wranglerExecuteInitMigration.exitCode).toBe(0) + + // Seed some data into D1. + + const wranglerSeedUsers = await executeWranglerD1Command(ctx, { + command: `INSERT INTO User ('id', 'email', 'name') VALUES (1, 'test@test.de', 'Test Test');`, + }) + expect(wranglerSeedUsers.exitCode).toBe(0) + + const wranglerSeedPosts = await executeWranglerD1Command(ctx, { + command: `INSERT INTO Post ('id', 'title', 'authorId') VALUES (1, 'Hello World', 1);`, + }) + expect(wranglerSeedPosts.exitCode).toBe(0) + + // + // Evolve the Prisma data model + // + + // Create `rename_new_field` migration file for D1 using `wrangler d1 migrations` + const wrangler2ndMigration = await createWranglerD1Migration(ctx, { name: 'rename_new_field' }) + expect(wrangler2ndMigration.exitCode).toBe(0) + + // Create `rename_new_field` migration SQL using `prisma migrate diff` + const prisma2ndMigration = cliInstance.parse([ + '--from-local-d1', + '--to-schema-datamodel', + './prisma/schema-0002_rename_new_field.prisma', + '--script', + '--output', + './migrations/0002_rename_new_field.sql', + ]) + await expect(prisma2ndMigration).resolves.toMatchInlineSnapshot(`""`) + + // Print the `rename_new_field` SQL migration file + const prisma2ndMigrationSQL = ctx.fs.readAsync('./migrations/0002_rename_new_field.sql') + await expect(prisma2ndMigrationSQL).resolves.toMatchInlineSnapshot(` + "-- RedefineTables + PRAGMA defer_foreign_keys=ON; + PRAGMA foreign_keys=OFF; + CREATE TABLE "new_User" ( + "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + "email" TEXT NOT NULL, + "name" TEXT, + "newField" TEXT + ); + INSERT INTO "new_User" ("createdAt", "email", "id", "name") SELECT "createdAt", "email", "id", "name" FROM "User"; + DROP TABLE "User"; + ALTER TABLE "new_User" RENAME TO "User"; + CREATE UNIQUE INDEX "User_email_key" ON "User"("email"); + PRAGMA foreign_keys=ON; + PRAGMA defer_foreign_keys=OFF; + " + `) + + // Apply `rename_new_field` migration to D1 + await applyWranglerD1Migration(ctx) + }, 60_000) + + it('incremental changes succeed until foreign keys are violated', async () => { + const cliInstance = MigrateDiff.new() + ctx.fixture('schema-sqlite-d1') + + // Create D1 database + const wranglerCreateD1 = await executeWranglerD1Command(ctx, { command: 'SELECT 1;' }) + expect(wranglerCreateD1.exitCode).toBe(0) + + // Create `init` migration file for D1 using `wrangler d1 migrations` + const wranglerCreateInitMigration = await createWranglerD1Migration(ctx, { name: 'init' }) + expect(wranglerCreateInitMigration.exitCode).toBe(0) + + // Create `init` SQL migration using `prisma migrate diff` + const prismaCreateInitMigration = cliInstance.parse([ + '--from-empty', + '--to-schema-datamodel', + './prisma/schema.prisma', + '--script', + '--output', + './migrations/0001_init.sql', + ]) + await expect(prismaCreateInitMigration).resolves.toMatchInlineSnapshot(`""`) + + // Print the `init` SQL migration file + const initMigrationSQL = ctx.fs.readAsync('./migrations/0001_init.sql') + await expect(initMigrationSQL).resolves.toMatchInlineSnapshot(` + "-- CreateTable + CREATE TABLE "Post" ( + "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + "title" TEXT NOT NULL, + "content" TEXT, + "published" BOOLEAN NOT NULL DEFAULT false, + "authorId" INTEGER NOT NULL, + CONSTRAINT "Post_authorId_fkey" FOREIGN KEY ("authorId") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE + ); + + -- CreateTable + CREATE TABLE "User" ( + "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + "email" TEXT NOT NULL, + "name" TEXT + ); + + -- CreateIndex + CREATE UNIQUE INDEX "User_email_key" ON "User"("email"); + " + `) + + // Apply `init` migration to D1 + const wranglerExecuteInitMigration = await applyWranglerD1Migration(ctx) + expect(wranglerExecuteInitMigration.exitCode).toBe(0) + + // + // Evolve the Prisma data model + // + + // Create `add_count_to_user_table` migration file for D1 using `wrangler d1 migrations` + const wrangler2ndMigration = await createWranglerD1Migration(ctx, { name: 'add_count_to_user_table' }) + expect(wrangler2ndMigration.exitCode).toBe(0) + + // Create `add_count_to_user_table` migration SQL using `prisma migrate diff` + const prisma2ndMigration = cliInstance.parse([ + '--from-local-d1', + '--to-schema-datamodel', + './prisma/schema-0002_add_count_to_user_table.prisma', + '--script', + '--output', + './migrations/0002_add_count_to_user_table.sql', + ]) + await expect(prisma2ndMigration).resolves.toMatchInlineSnapshot(`""`) + + // Print the `add_count_to_user_table` SQL migration file + const prisma2ndMigrationSQL = ctx.fs.readAsync('./migrations/0002_add_count_to_user_table.sql') + await expect(prisma2ndMigrationSQL).resolves.toMatchInlineSnapshot(` + "-- RedefineTables + PRAGMA defer_foreign_keys=ON; + PRAGMA foreign_keys=OFF; + CREATE TABLE "new_User" ( + "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + "email" TEXT NOT NULL, + "name" TEXT, + "count" INTEGER NOT NULL + ); + INSERT INTO "new_User" ("email", "id", "name") SELECT "email", "id", "name" FROM "User"; + DROP TABLE "User"; + ALTER TABLE "new_User" RENAME TO "User"; + CREATE UNIQUE INDEX "User_email_key" ON "User"("email"); + PRAGMA foreign_keys=ON; + PRAGMA defer_foreign_keys=OFF; + " + `) + + // Apply `add_count_to_user_table` migration to D1 + const wranglerExecute2ndMigration = await applyWranglerD1Migration(ctx) + expect(wranglerExecute2ndMigration.exitCode).toBe(0) + + // Seed some data into D1. + // Once we move the `PRIMARY KEY` from `User.id` to `User.count`, we would like to observe the `FOREIGN KEY` constraint failure, + // demonstrating that Prisma migrations check the integrity of the data, and rollback the migration if the data is not consistent. + + const wranglerSeedUsers = await executeWranglerD1Command(ctx, { + command: `INSERT INTO User ('id', 'count', 'email', 'name') VALUES (1, 2, 'schiabel@prisma.io', 'Schiabel');`, + }) + expect(wranglerSeedUsers.exitCode).toBe(0) + + const wranglerSeedPosts = await executeWranglerD1Command(ctx, { + command: `INSERT INTO Post ('id', 'title', 'authorId') VALUES (1, 'Post 1', '1');`, + }) + expect(wranglerSeedPosts.exitCode).toBe(0) + + // Create `change_user_id_to_count` migration file for D1 using `wrangler d1 migrations` + const wrangler3dMigration = await createWranglerD1Migration(ctx, { + name: 'change_user_id_to_count', + }) + expect(wrangler3dMigration.exitCode).toBe(0) + + // Create `add_count_to_user_table` migration SQL using `prisma migrate diff` + const prisma3dMigration = cliInstance.parse([ + '--from-local-d1', + '--to-schema-datamodel', + './prisma/schema-0003_change_user_id_to_count.prisma', + '--script', + '--output', + './migrations/0003_change_user_id_to_count.sql', + ]) + await expect(prisma3dMigration).resolves.toMatchInlineSnapshot(`""`) + + // Print the `add_count_to_user_table` SQL migration file. + const prisma3dMigrationSQL = ctx.fs.readAsync('./migrations/0003_change_user_id_to_count.sql') + await expect(prisma3dMigrationSQL).resolves.toMatchInlineSnapshot(` + "-- RedefineTables + PRAGMA defer_foreign_keys=ON; + PRAGMA foreign_keys=OFF; + CREATE TABLE "new_Post" ( + "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + "title" TEXT NOT NULL, + "content" TEXT, + "published" BOOLEAN NOT NULL DEFAULT false, + "authorId" INTEGER NOT NULL, + CONSTRAINT "Post_authorId_fkey" FOREIGN KEY ("authorId") REFERENCES "User" ("count") ON DELETE RESTRICT ON UPDATE CASCADE + ); + INSERT INTO "new_Post" ("authorId", "content", "id", "published", "title") SELECT "authorId", "content", "id", "published", "title" FROM "Post"; + DROP TABLE "Post"; + ALTER TABLE "new_Post" RENAME TO "Post"; + CREATE TABLE "new_User" ( + "id" INTEGER NOT NULL, + "email" TEXT NOT NULL, + "name" TEXT, + "count" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT + ); + INSERT INTO "new_User" ("count", "email", "id", "name") SELECT "count", "email", "id", "name" FROM "User"; + DROP TABLE "User"; + ALTER TABLE "new_User" RENAME TO "User"; + CREATE UNIQUE INDEX "User_email_key" ON "User"("email"); + PRAGMA foreign_keys=ON; + PRAGMA defer_foreign_keys=OFF; + " + `) + + // Apply `add_count_to_user_table` migration to D1 + try { + await applyWranglerD1Migration(ctx) + expect(true).toBe(false) // unreachable + } catch (error) { + const e = error as execa.ExecaError + + // There are two possible `FOREIGN KEY` constraint failure messages that could appear, depending on the order of the output of `prisma migrate diff`. + const possibleMatches = [ + 'FOREIGN KEY constraint failed', + 'foreign key mismatch - "new_Post" referencing "User"', + ] + expect(possibleMatches.some((match) => e.stderr.includes(match))).toBe(true) + } + + // Verify that the `User` table is still in the original state, i.e., that a `ROLLBACK` of the previous migration has occurred. + const wranglerVerifyUserTable = await executeWranglerD1Command(ctx, { + command: 'PRAGMA table_info(User);', + json: true, + }) + + const wranglerVerifyUserTableAsJSON = JSON.parse(wranglerVerifyUserTable.stdout) + expect(wranglerVerifyUserTableAsJSON).toMatchObject([ + { + results: [ + { + cid: 0, + name: 'id', + type: 'INTEGER', + notnull: 1, + dflt_value: 'null', + pk: 1, + }, + { + cid: 1, + name: 'email', + type: 'TEXT', + notnull: 1, + dflt_value: 'null', + pk: 0, + }, + { + cid: 2, + name: 'name', + type: 'TEXT', + notnull: 0, + dflt_value: 'null', + pk: 0, + }, + { + cid: 3, + name: 'count', + type: 'INTEGER', + notnull: 1, + dflt_value: 'null', + pk: 0, + }, + ], + success: true, + }, + ]) + }, 60_000) + }) +}) diff --git a/packages/migrate/src/__tests__/removeDatasource.test.ts b/packages/migrate/src/__tests__/removeDatasource.test.ts deleted file mode 100644 index ac2d284b8090..000000000000 --- a/packages/migrate/src/__tests__/removeDatasource.test.ts +++ /dev/null @@ -1,158 +0,0 @@ -import { removeDatasource } from '../utils/removeDatasource' - -test('simple schema', () => { - const schema = ` -datasource db { - provider = "sqlite" - url = "file:dev.db" -} - - -generator gen { - provider = "prisma-client-js" -} - -model User { - id Int @id @default(autoincrement()) - name String -} -` - expect(removeDatasource(schema)).toMatchInlineSnapshot(` - "generator gen { - provider = "prisma-client-js" - } - - model User { - id Int @id @default(autoincrement()) - name String - }" - `) -}) - -test('comments', () => { - const schema = ` -datasource db { -// datasource db { - provider = "sqlite" - // provider = "sqlite" - url = "file:dev.db" -} - - -generator gen { - provider = "prisma-client-js" -} - -model User { - id Int @id @default(autoincrement()) - name String -} -` - expect(removeDatasource(schema)).toMatchInlineSnapshot(` - "generator gen { - provider = "prisma-client-js" - } - - model User { - id Int @id @default(autoincrement()) - name String - }" - `) -}) - -test('schema without datasource', () => { - const schema = ` - -generator gen { - provider = "prisma-client-js" -} - -model User { - id Int @id @default(autoincrement()) - name String -} -` - expect(removeDatasource(schema)).toMatchInlineSnapshot(` - "generator gen { - provider = "prisma-client-js" - } - - model User { - id Int @id @default(autoincrement()) - name String - }" - `) -}) - -test('schema with multiple datasources', () => { - const schema = ` -datasource db { - provider = "sqlite" - url = "file:dev.db" -} - -datasource db2 { - provider = "sqlite" - url = "file:dev.db" -} - - -generator gen { - provider = "prisma-client-js" -} - -model User { - id Int @id @default(autoincrement()) - name String -} -` - expect(removeDatasource(schema)).toMatchInlineSnapshot(` - "generator gen { - provider = "prisma-client-js" - } - - model User { - id Int @id @default(autoincrement()) - name String - }" - `) -}) - -test('datasource block not starting at the beginning of the file and not at the beginning of a line with generator should only return the generator block', () => { - const schema = ` - datasource db { - provider = "postgres" - url = env("DATABASE_URL") -} - -generator client { - provider = "prisma-client-js" - previewFeatures = ["multiSchema"] -} -` - expect(removeDatasource(schema)).toMatchInlineSnapshot(` - "generator client { - provider = "prisma-client-js" - previewFeatures = ["multiSchema"] - }" - `) -}) - -test('datasource block not starting at the beginning of a line with generator should only return the generator block', () => { - const schema = ` datasource db { - provider = "postgres" - url = env("DATABASE_URL") -} - -generator client { - provider = "prisma-client-js" - previewFeatures = ["multiSchema"] -} -` - expect(removeDatasource(schema)).toMatchInlineSnapshot(` - "generator client { - provider = "prisma-client-js" - previewFeatures = ["multiSchema"] - }" - `) -}) diff --git a/packages/migrate/src/__tests__/rpc.test.ts b/packages/migrate/src/__tests__/rpc.test.ts index c5ece154de3c..ab9e1c029024 100644 --- a/packages/migrate/src/__tests__/rpc.test.ts +++ b/packages/migrate/src/__tests__/rpc.test.ts @@ -1,5 +1,5 @@ import { jestConsoleContext, jestContext } from '@prisma/get-platform' -import { getSchemaPath } from '@prisma/internals' +import { getSchema, getSchemaWithPath, MultipleSchemas, toSchemasContainer } from '@prisma/internals' import fs from 'fs-jetpack' import path from 'path' @@ -10,7 +10,7 @@ const ctx = jestContext.new().add(jestConsoleContext()).assemble() describe('applyMigrations', () => { it('should succeed', async () => { ctx.fixture('existing-db-1-migration') - const { schemaPath } = (await getSchemaPath())! + const { schemaPath } = (await getSchemaWithPath())! const migrate = new Migrate(schemaPath) const result = migrate.engine.applyMigrations({ migrationsDirectoryPath: migrate.migrationsDirectoryPath!, @@ -26,7 +26,7 @@ describe('applyMigrations', () => { it('should fail on existing brownfield db', async () => { ctx.fixture('existing-db-brownfield') - const { schemaPath } = (await getSchemaPath())! + const { schemaPath } = (await getSchemaWithPath())! const migrate = new Migrate(schemaPath) const result = migrate.engine.applyMigrations({ migrationsDirectoryPath: migrate.migrationsDirectoryPath!, @@ -61,14 +61,14 @@ describe('createDatabase', () => { migrate.stop() }) - it('should succeed - SchemaPath - postgresql', async () => { + it('should succeed - Schema - postgresql', async () => { ctx.fixture('schema-only') - const { schemaPath } = (await getSchemaPath())! + const schemas = await getSchema() const migrate = new Migrate() const result = migrate.engine.createDatabase({ datasource: { - tag: 'SchemaPath', - path: schemaPath, + tag: 'Schema', + ...toSchemasContainer(schemas), }, }) @@ -85,14 +85,13 @@ describe('createDatabase', () => { describe('createMigration', () => { it('should succeed - existing-db-1-migration', async () => { ctx.fixture('schema-only-sqlite') - const { schemaPath } = (await getSchemaPath())! + const { schemaPath, schemas } = (await getSchemaWithPath())! const migrate = new Migrate(schemaPath) - const schema = migrate.getPrismaSchema() const result = migrate.engine.createMigration({ migrationsDirectoryPath: migrate.migrationsDirectoryPath!, migrationName: 'my_migration', draft: false, - prismaSchema: schema, + schema: toSchemasContainer(schemas), }) await expect(result).resolves.toMatchInlineSnapshot(` @@ -105,14 +104,13 @@ describe('createMigration', () => { it('draft should succeed - existing-db-1-migration', async () => { ctx.fixture('existing-db-1-migration') - const { schemaPath } = (await getSchemaPath())! + const { schemaPath, schemas } = (await getSchemaWithPath())! const migrate = new Migrate(schemaPath) - const schema = migrate.getPrismaSchema() const result = migrate.engine.createMigration({ migrationsDirectoryPath: migrate.migrationsDirectoryPath!, migrationName: 'draft_123', draft: true, - prismaSchema: schema, + schema: toSchemasContainer(schemas), }) await expect(result).resolves.toMatchInlineSnapshot(` @@ -146,7 +144,7 @@ describe('dbExecute', () => { describe('devDiagnostic', () => { it('createMigration', async () => { ctx.fixture('schema-only-sqlite') - const { schemaPath } = (await getSchemaPath())! + const { schemaPath } = (await getSchemaWithPath())! const migrate = new Migrate(schemaPath) const result = migrate.engine.devDiagnostic({ migrationsDirectoryPath: migrate.migrationsDirectoryPath!, @@ -164,7 +162,7 @@ describe('devDiagnostic', () => { it('reset because drift', async () => { ctx.fixture('existing-db-1-migration-conflict') - const { schemaPath } = (await getSchemaPath())! + const { schemaPath } = (await getSchemaWithPath())! const migrate = new Migrate(schemaPath) const result = migrate.engine.devDiagnostic({ migrationsDirectoryPath: migrate.migrationsDirectoryPath!, @@ -197,7 +195,7 @@ describe('devDiagnostic', () => { describe('diagnoseMigrationHistory', () => { it('optInToShadowDatabase true should succeed - existing-db-1-migration', async () => { ctx.fixture('existing-db-1-migration') - const { schemaPath } = (await getSchemaPath())! + const { schemaPath } = (await getSchemaWithPath())! const migrate = new Migrate(schemaPath) const result = migrate.engine.diagnoseMigrationHistory({ migrationsDirectoryPath: migrate.migrationsDirectoryPath!, @@ -217,7 +215,7 @@ describe('diagnoseMigrationHistory', () => { it(' optInToShadowDatabase false should succeed - existing-db-1-migration', async () => { ctx.fixture('existing-db-1-migration') - const { schemaPath } = (await getSchemaPath())! + const { schemaPath } = (await getSchemaWithPath())! const migrate = new Migrate(schemaPath) const result = migrate.engine.diagnoseMigrationHistory({ migrationsDirectoryPath: migrate.migrationsDirectoryPath!, @@ -254,12 +252,12 @@ describe('ensureConnectionValidity', () => { it('should succeed when database exists - PostgreSQL', async () => { ctx.fixture('schema-only') - const { schemaPath } = (await getSchemaPath())! - const migrate = new Migrate() + const { schemaPath, schemas } = (await getSchemaWithPath())! + const migrate = new Migrate(schemaPath) const result = migrate.engine.ensureConnectionValidity({ datasource: { - tag: 'SchemaPath', - path: schemaPath, + tag: 'Schema', + ...toSchemasContainer(schemas), }, }) @@ -314,12 +312,11 @@ describe('evaluateDataLoss', () => { // migration is not yet applied it('should succeed - schema-only-sqlite', async () => { ctx.fixture('schema-only-sqlite') - const { schemaPath } = (await getSchemaPath())! + const { schemaPath, schemas } = (await getSchemaWithPath())! const migrate = new Migrate(schemaPath) - const schema = migrate.getPrismaSchema() const result = migrate.engine.evaluateDataLoss({ migrationsDirectoryPath: migrate.migrationsDirectoryPath!, - prismaSchema: schema, + schema: toSchemasContainer(schemas), }) await expect(result).resolves.toMatchInlineSnapshot(` @@ -335,12 +332,11 @@ describe('evaluateDataLoss', () => { // migration is already applied so should be empty it('should succeed - existing-db-1-migration', async () => { ctx.fixture('existing-db-1-migration') - const { schemaPath } = (await getSchemaPath())! + const { schemaPath, schemas } = (await getSchemaWithPath())! const migrate = new Migrate(schemaPath) - const schema = migrate.getPrismaSchema() const result = migrate.engine.evaluateDataLoss({ migrationsDirectoryPath: migrate.migrationsDirectoryPath!, - prismaSchema: schema, + schema: toSchemasContainer(schemas), }) await expect(result).resolves.toMatchInlineSnapshot(` @@ -357,7 +353,7 @@ describe('evaluateDataLoss', () => { describe('getDatabaseVersion - PostgreSQL', () => { it('[No params] should succeed', async () => { ctx.fixture('schema-only') - const { schemaPath } = (await getSchemaPath())! + const { schemaPath } = (await getSchemaWithPath())! const migrate = new Migrate(schemaPath) const result = migrate.engine.getDatabaseVersion() await expect(result).resolves.toContain('PostgreSQL') @@ -366,27 +362,12 @@ describe('getDatabaseVersion - PostgreSQL', () => { it('[SchemaPath] should succeed', async () => { ctx.fixture('schema-only') - const { schemaPath } = (await getSchemaPath())! + const { schemas } = (await getSchemaWithPath())! const migrate = new Migrate() const result = migrate.engine.getDatabaseVersion({ datasource: { - tag: 'SchemaPath', - path: schemaPath, - }, - }) - await expect(result).resolves.toContain('PostgreSQL') - migrate.stop() - }) - - it('[SchemaString] should succeed', async () => { - ctx.fixture('schema-only') - const { schemaPath } = (await getSchemaPath())! - const schema = (await fs.readAsync(schemaPath))! - const migrate = new Migrate() - const result = migrate.engine.getDatabaseVersion({ - datasource: { - tag: 'SchemaString', - schema, + tag: 'Schema', + ...toSchemasContainer(schemas), }, }) await expect(result).resolves.toContain('PostgreSQL') @@ -409,7 +390,7 @@ describe('getDatabaseVersion - PostgreSQL', () => { describe('listMigrationDirectories', () => { it('should succeed - existing-db-1-migration', async () => { ctx.fixture('existing-db-1-migration') - const { schemaPath } = (await getSchemaPath())! + const { schemaPath } = (await getSchemaWithPath())! const migrate = new Migrate(schemaPath) const result = migrate.engine.listMigrationDirectories({ migrationsDirectoryPath: migrate.migrationsDirectoryPath!, @@ -427,7 +408,7 @@ describe('listMigrationDirectories', () => { it('should succeed - schema-only-sqlite', async () => { ctx.fixture('schema-only-sqlite') - const { schemaPath } = (await getSchemaPath())! + const { schemaPath } = (await getSchemaWithPath())! const migrate = new Migrate(schemaPath) const result = migrate.engine.listMigrationDirectories({ migrationsDirectoryPath: migrate.migrationsDirectoryPath!, @@ -447,7 +428,7 @@ describe('markMigrationRolledBack', () => { jest.setTimeout(10_000) ctx.fixture('existing-db-1-migration') - const { schemaPath } = (await getSchemaPath())! + const { schemaPath } = (await getSchemaWithPath())! const migrate = new Migrate(schemaPath) const resultMarkRolledBacked = migrate.engine.markMigrationRolledBack({ @@ -466,14 +447,13 @@ describe('markMigrationRolledBack', () => { it('existing-db-1-migration', async () => { ctx.fixture('existing-db-1-migration') - const { schemaPath } = (await getSchemaPath())! + const { schemaPath, schemas } = (await getSchemaWithPath())! const migrate = new Migrate(schemaPath) - const schema = migrate.getPrismaSchema() const result = await migrate.engine.createMigration({ migrationsDirectoryPath: migrate.migrationsDirectoryPath!, migrationName: 'draft_123', draft: true, - prismaSchema: schema, + schema: toSchemasContainer(schemas), }) expect(result).toMatchInlineSnapshot(` @@ -527,14 +507,13 @@ describe('markMigrationRolledBack', () => { describe('markMigrationApplied', () => { it('existing-db-1-migration', async () => { ctx.fixture('existing-db-1-migration') - const { schemaPath } = (await getSchemaPath())! + const { schemaPath, schemas } = (await getSchemaWithPath())! const migrate = new Migrate(schemaPath) - const schema = migrate.getPrismaSchema() const result = await migrate.engine.createMigration({ migrationsDirectoryPath: migrate.migrationsDirectoryPath!, migrationName: 'draft_123', draft: true, - prismaSchema: schema, + schema: toSchemasContainer(schemas), }) expect(result).toMatchInlineSnapshot(` @@ -559,12 +538,11 @@ describe('schemaPush', () => { // Since 5.0.0 this RPC does not error anymore if the SQLite database file is missing it('should succeed if SQLite database file is missing', async () => { ctx.fixture('schema-only-sqlite') - const { schemaPath } = (await getSchemaPath())! + const { schemaPath, schemas } = (await getSchemaWithPath())! const migrate = new Migrate(schemaPath) - const schema = migrate.getPrismaSchema() const result = migrate.engine.schemaPush({ force: false, - schema: schema, + schema: toSchemasContainer(schemas), }) await expect(result).resolves.toMatchInlineSnapshot(` @@ -579,12 +557,11 @@ describe('schemaPush', () => { it('should succeed without warning', async () => { ctx.fixture('existing-db-1-draft') - const { schemaPath } = (await getSchemaPath())! + const { schemaPath, schemas } = (await getSchemaWithPath())! const migrate = new Migrate(schemaPath) - const schema = migrate.getPrismaSchema() const result = migrate.engine.schemaPush({ force: false, - schema: schema, + schema: toSchemasContainer(schemas), }) await expect(result).resolves.toMatchInlineSnapshot(` @@ -599,13 +576,12 @@ describe('schemaPush', () => { it('should return executedSteps 0 with warning if dataloss detected', async () => { ctx.fixture('existing-db-brownfield') - const { schemaPath } = (await getSchemaPath())! + const { schemaPath, schemas } = (await getSchemaWithPath())! const migrate = new Migrate(schemaPath) - const schema = migrate.getPrismaSchema() const result = migrate.engine.schemaPush({ force: false, - schema: schema.replace('Blog', 'Something'), + schema: toSchemasContainer(replaceInSchemas(schemas, 'Blog', 'Something')), }) await expect(result).resolves.toMatchInlineSnapshot(` @@ -622,13 +598,12 @@ describe('schemaPush', () => { it('force should accept dataloss', async () => { ctx.fixture('existing-db-brownfield') - const { schemaPath } = (await getSchemaPath())! + const { schemaPath, schemas } = (await getSchemaWithPath())! const migrate = new Migrate(schemaPath) - const schema = migrate.getPrismaSchema() const result = migrate.engine.schemaPush({ force: true, - schema: schema.replace('Blog', 'Something'), + schema: toSchemasContainer(replaceInSchemas(schemas, 'Blog', 'Something')), }) await expect(result).resolves.toMatchInlineSnapshot(` @@ -643,3 +618,7 @@ describe('schemaPush', () => { migrate.stop() }) }) + +function replaceInSchemas(schemas: MultipleSchemas, search: string, replace: string): MultipleSchemas { + return schemas.map(([path, content]) => [path, content.replace(search, replace)]) +} diff --git a/packages/migrate/src/commands/DbExecute.ts b/packages/migrate/src/commands/DbExecute.ts index 949bb9ba3673..e1aaa9a109b5 100644 --- a/packages/migrate/src/commands/DbExecute.ts +++ b/packages/migrate/src/commands/DbExecute.ts @@ -4,10 +4,11 @@ import { Command, format, getCommandWithExecutor, - getSchemaPath, + getSchemaWithPath, HelpError, isError, loadEnvFile, + toSchemasWithConfigDir, } from '@prisma/internals' import fs from 'fs' import getStdin from 'get-stdin' @@ -164,12 +165,12 @@ See \`${green(getCommandWithExecutor('prisma db execute -h'))}\``, else { // validate that schema file exists // throws an error if it doesn't - const { schemaPath } = (await getSchemaPath(args['--schema']))! + const schemaWithPath = (await getSchemaWithPath(args['--schema']))! // Execute command(s) to url from schema datasourceType = { tag: 'schema', - schema: schemaPath, + ...toSchemasWithConfigDir(schemaWithPath), } } diff --git a/packages/migrate/src/commands/DbPull.ts b/packages/migrate/src/commands/DbPull.ts index 68fc0fbbe022..1e6079a14091 100644 --- a/packages/migrate/src/commands/DbPull.ts +++ b/packages/migrate/src/commands/DbPull.ts @@ -8,12 +8,15 @@ import { getCommandWithExecutor, getConfig, getSchema, - getSchemaPath, + getSchemaWithPath, HelpError, link, loadEnvFile, locateLocalCloudflareD1, + type MultipleSchemas, protocolToConnectorType, + relativizePathInPSLError, + toSchemasContainer, } from '@prisma/internals' import fs from 'fs' import { bold, dim, green, red, underline, yellow } from 'kleur/colors' @@ -27,7 +30,7 @@ import { NoSchemaFoundError } from '../utils/errors' import { printDatasource } from '../utils/printDatasource' import type { ConnectorType } from '../utils/printDatasources' import { printDatasources } from '../utils/printDatasources' -import { removeDatasource } from '../utils/removeDatasource' +import { replaceOrAddDatasource } from '../utils/replaceOrAddDatasource' import { createSpinner } from '../utils/spinner' const debug = Debug('prisma:db:pull') @@ -115,7 +118,7 @@ Set composite types introspection depth to 2 levels const url: string | undefined = args['--url'] // getSchemaPathAndPrint is not flexible enough for this use case - const schemaPathResult = await getSchemaPath(args['--schema']) + const schemaPathResult = await getSchemaWithPath(args['--schema']) let schemaPath = schemaPathResult?.schemaPath ?? null debug('schemaPathResult', schemaPathResult) @@ -155,7 +158,7 @@ Set composite types introspection depth to 2 levels .when( (input): input is { url: string | undefined; schemaPath: string; fromD1: boolean } => input.schemaPath !== null, async (input) => { - const rawSchema = fs.readFileSync(input.schemaPath, 'utf-8') + const rawSchema = await getSchema(input.schemaPath) const config = await getConfig({ datamodel: rawSchema, ignoreEnvVarErrors: true, @@ -176,7 +179,7 @@ Set composite types introspection depth to 2 levels // TODO: better error handling with better error message // Related https://github.com/prisma/prisma/issues/14732 const providerFromUrl = protocolToConnectorType(`${input.url.split(':')[0]}:`) - const schema = `${this.urlToDatasource(input.url, providerFromSchema)}\n\n${removeDatasource(rawSchema)}` + const schema = replaceOrAddDatasource(this.urlToDatasource(input.url, providerFromSchema), rawSchema) // if providers are different the engine would return a misleading error // So we check here and return a better error @@ -194,18 +197,20 @@ Set composite types introspection depth to 2 levels ) } - return { firstDatasource, schema } + return { firstDatasource, schema, validationWarning: undefined } } else if (input.fromD1) { const d1Database = await locateLocalCloudflareD1({ arg: '--from-local-d1' }) const pathToSQLiteFile = path.relative(path.dirname(input.schemaPath), d1Database) - const schema = this.urlToDatasource(`file:${pathToSQLiteFile}`, 'sqlite') + const schema: MultipleSchemas = [ + ['schema.prisma', this.urlToDatasource(`file:${pathToSQLiteFile}`, 'sqlite')], + ] const config = await getConfig({ datamodel: schema, ignoreEnvVarErrors: true, }) - const result = { firstDatasource: config.datasources[0], schema } + const result = { firstDatasource: config.datasources[0], schema, validationWarning: undefined } const hasDriverAdaptersPreviewFeature = (previewFeatures || []).includes('driverAdapters') const validationWarning = `Without the ${bold( @@ -239,17 +244,18 @@ Set composite types introspection depth to 2 levels // TODO: `urlToDatasource(..)` doesn't generate a `generator client` block. Should it? // TODO: Should we also add the `Try Prisma Accelerate` comment like we do in `prisma init`? - const schema = `generator client { + const schemaContent = `generator client { provider = "prisma-client-js" previewFeatures = ["driverAdapters"] } ${this.urlToDatasource(`file:${pathToSQLiteFile}`, 'sqlite')}` + const schema: MultipleSchemas = [['schema.prisma', schemaContent]] const config = await getConfig({ datamodel: schema, ignoreEnvVarErrors: true, }) - return { firstDatasource: config.datasources[0], schema } + return { firstDatasource: config.datasources[0], schema, validationWarning: undefined } }, ) .when( @@ -259,12 +265,12 @@ ${this.urlToDatasource(`file:${pathToSQLiteFile}`, 'sqlite')}` // TODO: better error handling with better error message // Related https://github.com/prisma/prisma/issues/14732 protocolToConnectorType(`${input.url.split(':')[0]}:`) - const schema = this.urlToDatasource(input.url) + const schema: MultipleSchemas = [['schema.prisma', this.urlToDatasource(input.url)]] const config = await getConfig({ datamodel: schema, ignoreEnvVarErrors: true, }) - return { firstDatasource: config.datasources[0], schema } + return { firstDatasource: config.datasources[0], schema, validationWarning: undefined } }, ) .run() @@ -303,10 +309,10 @@ Some information will be lost (relations, comments, mapped fields, @ignore...), let introspectionWarnings: EngineArgs.IntrospectResult['warnings'] try { const introspectionResult = await engine.introspect({ - schema, + schema: toSchemasContainer(schema), force: args['--force'], compositeTypeDepth: args['--composite-type-depth'], - schemas: args['--schemas']?.split(','), + namespaces: args['--schemas']?.split(','), }) introspectionSchema = introspectionResult.datamodel @@ -362,10 +368,12 @@ Then you can run ${green(getCommandWithExecutor('prisma db pull'))} again. /* P1012: Schema parsing error */ process.stdout.write('\n') // empty line + const message = relativizePathInPSLError(e.message) + // TODO: this error is misleading, as it gets thrown even when the schema is valid but the protocol of the given // '--url' argument is different than the one written in the schema.prisma file. // We should throw another error earlier in case the URL protocol is not compatible with the schema provider. - throw new Error(`${red(`${e.message}`)} + throw new Error(`${red(message)} Introspection failed as your current Prisma schema file is invalid Please fix your current schema manually (using either ${green( diff --git a/packages/migrate/src/commands/DbSeed.ts b/packages/migrate/src/commands/DbSeed.ts index 5c2b0f36f15d..7ad998e9fef5 100644 --- a/packages/migrate/src/commands/DbSeed.ts +++ b/packages/migrate/src/commands/DbSeed.ts @@ -1,4 +1,4 @@ -import { arg, Command, format, getSchemaPath, HelpError, isError, loadEnvFile } from '@prisma/internals' +import { arg, Command, format, getSchemaWithPath, HelpError, isError, loadEnvFile } from '@prisma/internals' import { ArgError } from 'arg' import { bold, dim, red } from 'kleur/colors' @@ -57,7 +57,7 @@ ${dim('$')} prisma db seed -- --arg1 value1 --arg2 value2`) if (!seedCommandFromPkgJson) { // Only used to help users to set up their seeds from old way to new package.json config - const schemaResult = await getSchemaPath(args['--schema']) + const schemaResult = await getSchemaWithPath(args['--schema']) const message = await verifySeedConfigAndReturnMessage(schemaResult?.schemaPath ?? null) // Error because setup of the feature needs to be done diff --git a/packages/migrate/src/commands/MigrateDev.ts b/packages/migrate/src/commands/MigrateDev.ts index 26563b33fc1a..ba3ff782f21a 100644 --- a/packages/migrate/src/commands/MigrateDev.ts +++ b/packages/migrate/src/commands/MigrateDev.ts @@ -7,10 +7,11 @@ import { format, getCommandWithExecutor, getConfig, - getSchemaPath, + getSchemaWithPath, HelpError, isError, loadEnvFile, + toSchemasContainer, validate, } from '@prisma/internals' import { bold, dim, green, red } from 'kleur/colors' @@ -253,7 +254,7 @@ ${bold('Examples')} migrationsDirectoryPath: migrate.migrationsDirectoryPath!, migrationName: migrationName || '', draft: args['--create-only'] ? true : false, - prismaSchema: migrate.getPrismaSchema(), + schema: toSchemasContainer((await migrate.getPrismaSchema()).schemas), }) debug({ createMigrationResult }) @@ -322,7 +323,7 @@ ${green('Your database is now in sync with your schema.')}\n`, } } else { // Only used to help users to set up their seeds from old way to new package.json config - const { schemaPath } = (await getSchemaPath(args['--schema']))! + const { schemaPath } = (await getSchemaWithPath(args['--schema']))! // we don't want to output the returned warning message // but we still want to run it for `legacyTsNodeScriptWarning()` await verifySeedConfigAndReturnMessage(schemaPath) diff --git a/packages/migrate/src/commands/MigrateDiff.ts b/packages/migrate/src/commands/MigrateDiff.ts index 59f8b894345a..29bf31bb7dfd 100644 --- a/packages/migrate/src/commands/MigrateDiff.ts +++ b/packages/migrate/src/commands/MigrateDiff.ts @@ -9,11 +9,14 @@ import { link, loadEnvFile, locateLocalCloudflareD1, + toSchemasContainer, + toSchemasWithConfigDir, } from '@prisma/internals' import fs from 'fs-jetpack' import { bold, dim, green, italic } from 'kleur/colors' import path from 'path' +import { getSchemaWithPath } from '../../../internals/src/cli/getSchema' import { Migrate } from '../Migrate' import type { EngineArgs, EngineResults } from '../types' import { CaptureStdout } from '../utils/captureStdout' @@ -223,14 +226,16 @@ ${bold('Examples')} } else if (args['--from-schema-datasource']) { // Load .env file that might be needed loadEnvFile({ schemaPath: args['--from-schema-datasource'], printMessage: false }) + const schema = await getSchemaWithPath(path.resolve(args['--from-schema-datasource'])) from = { tag: 'schemaDatasource', - schema: path.resolve(args['--from-schema-datasource']), + ...toSchemasWithConfigDir(schema), } } else if (args['--from-schema-datamodel']) { + const schema = await getSchemaWithPath(path.resolve(args['--from-schema-datamodel'])) from = { tag: 'schemaDatamodel', - schema: path.resolve(args['--from-schema-datamodel']), + ...toSchemasContainer(schema.schemas), } } else if (args['--from-url']) { from = { @@ -258,14 +263,16 @@ ${bold('Examples')} } else if (args['--to-schema-datasource']) { // Load .env file that might be needed loadEnvFile({ schemaPath: args['--to-schema-datasource'], printMessage: false }) + const schema = await getSchemaWithPath(path.resolve(args['--to-schema-datasource'])) to = { tag: 'schemaDatasource', - schema: path.resolve(args['--to-schema-datasource']), + ...toSchemasWithConfigDir(schema), } } else if (args['--to-schema-datamodel']) { + const schema = await getSchemaWithPath(path.resolve(args['--to-schema-datamodel'])) to = { tag: 'schemaDatamodel', - schema: path.resolve(args['--to-schema-datamodel']), + ...toSchemasContainer(schema.schemas), } } else if (args['--to-url']) { to = { diff --git a/packages/migrate/src/commands/MigrateReset.ts b/packages/migrate/src/commands/MigrateReset.ts index aca3db4efb31..e1b1aaa4813f 100644 --- a/packages/migrate/src/commands/MigrateReset.ts +++ b/packages/migrate/src/commands/MigrateReset.ts @@ -4,7 +4,7 @@ import { checkUnsupportedDataProxy, Command, format, - getSchemaPath, + getSchemaWithPath, HelpError, isError, loadEnvFile, @@ -152,7 +152,7 @@ The following migration(s) have been applied:\n\n${printFilesFromMigrationIds('m } } else { // Only used to help users to set up their seeds from old way to new package.json config - const { schemaPath } = (await getSchemaPath(args['--schema']))! + const { schemaPath } = (await getSchemaWithPath(args['--schema']))! // we don't want to output the returned warning message // but we still want to run it for `legacyTsNodeScriptWarning()` await verifySeedConfigAndReturnMessage(schemaPath) diff --git a/packages/migrate/src/types.ts b/packages/migrate/src/types.ts index 1104852b4f90..b28208c405d8 100644 --- a/packages/migrate/src/types.ts +++ b/packages/migrate/src/types.ts @@ -90,7 +90,7 @@ export namespace EngineArgs { export interface CreateMigrationInput { migrationsDirectoryPath: string - prismaSchema: string + schema: MigrateTypes.SchemasContainer draft: boolean // if true, always generate a migration, but do not apply /// The user-given name for the migration. This will be used in the migration directory. migrationName?: string @@ -102,24 +102,16 @@ export namespace EngineArgs { // or the whole Prisma schema as a string, // or only the connection string. export interface CreateDatabaseInput { - datasource: MigrateTypes.SchemaContainer | MigrateTypes.UrlContainer | MigrateTypes.PathContainer + datasource: MigrateTypes.DatasourceParam } export interface DropDatabase { schema: string } - type DbExecuteDatasourceTypeSchema = { - // Path to the Prisma schema file to take the datasource URL from. - tag: 'schema' - schema: string - } - type DbExecuteDatasourceTypeUrl = { - // The URL of the database to run the command on. - tag: 'url' - url: string - } - export type DbExecuteDatasourceType = DbExecuteDatasourceTypeSchema | DbExecuteDatasourceTypeUrl + export type DbExecuteDatasourceType = + | MigrateTypes.Tagged<'schema', MigrateTypes.SchemasWithConfigDir> + | MigrateTypes.Tagged<'url', MigrateTypes.UrlContainer> export interface DbExecuteInput { // The location of the live database to connect to. datasourceType: DbExecuteDatasourceType @@ -127,15 +119,13 @@ export namespace EngineArgs { script: string } - export type GetDatabaseVersionParams = MigrateTypes.GetDatabaseVersionParams - export interface IntrospectParams { - schema: string + schema: MigrateTypes.SchemasContainer force?: Boolean // Note: this must be a non-negative integer compositeTypeDepth?: number - schemas?: string[] + namespaces?: string[] } export interface IntrospectResult { @@ -165,12 +155,12 @@ export namespace EngineArgs { } export interface EnsureConnectionValidityInput { - datasource: MigrateTypes.SchemaContainer | MigrateTypes.UrlContainer | MigrateTypes.PathContainer + datasource: MigrateTypes.DatasourceParam } export interface EvaluateDataLossInput { migrationsDirectoryPath: string - prismaSchema: string + schema: MigrateTypes.SchemasContainer } export interface ListMigrationDirectoriesInput { @@ -186,27 +176,13 @@ export namespace EngineArgs { migrationName: string } - type MigrateDiffTargetUrl = { - // The url to a live database. Its schema will be considered. - // This will cause the Schema engine to connect to the database and read from it. It will not write. - tag: 'url' - url: string - } + type MigrateDiffTargetUrl = MigrateTypes.Tagged<'url', MigrateTypes.UrlContainer> type MigrateDiffTargetEmpty = { // An empty schema. tag: 'empty' } - type MigrateDiffTargetSchemaDatamodel = { - // Path to the Prisma schema file to take the datasource URL from. - tag: 'schemaDatamodel' - schema: string - } - type MigrateDiffTargetSchemaDatasource = { - // The path to a Prisma schema. - // The datasource url will be considered, and the live database it points to introspected for its schema. - tag: 'schemaDatasource' - schema: string - } + type MigrateDiffTargetSchemaDatamodel = MigrateTypes.Tagged<'schemaDatamodel', MigrateTypes.SchemasContainer> + type MigrateDiffTargetSchemaDatasource = MigrateTypes.Tagged<'schemaDatasource', MigrateTypes.SchemasWithConfigDir> type MigrateDiffTargetMigrations = { // The path to a migrations directory of the shape expected by Prisma Migrate. // The migrations will be applied to a shadow database, and the resulting schema considered for diffing. @@ -235,8 +211,8 @@ export namespace EngineArgs { exitCode?: boolean } - export interface SchemaPush { - schema: string + export interface SchemaPushInput { + schema: MigrateTypes.SchemasContainer force: boolean } } diff --git a/packages/migrate/src/utils/getDatabaseVersionSafe.ts b/packages/migrate/src/utils/getDatabaseVersionSafe.ts index 047111ff62d6..edf80bf1d9b4 100644 --- a/packages/migrate/src/utils/getDatabaseVersionSafe.ts +++ b/packages/migrate/src/utils/getDatabaseVersionSafe.ts @@ -1,7 +1,7 @@ import Debug from '@prisma/debug' +import { MigrateTypes } from '@prisma/internals' import { SchemaEngine } from '../SchemaEngine' -import type { EngineArgs } from '../types' const debug = Debug('prisma:cli') @@ -9,7 +9,9 @@ const debug = Debug('prisma:cli') * Retrieve the database version from the given schema or url. * This function never throws, and was introduced to prevent circular dependencies in `@prisma/internals`. */ -export async function getDatabaseVersionSafe(args: EngineArgs.GetDatabaseVersionParams): Promise { +export async function getDatabaseVersionSafe( + args: MigrateTypes.GetDatabaseVersionParams | undefined, +): Promise { let engine: SchemaEngine | undefined let dbVersion: string | undefined try { diff --git a/packages/migrate/src/utils/getSchemaPathAndPrint.ts b/packages/migrate/src/utils/getSchemaPathAndPrint.ts index 5ec517f3534a..de9070f39402 100644 --- a/packages/migrate/src/utils/getSchemaPathAndPrint.ts +++ b/packages/migrate/src/utils/getSchemaPathAndPrint.ts @@ -1,4 +1,4 @@ -import { getSchemaPath, type GetSchemaResult, link, logger } from '@prisma/internals' +import { type GetSchemaResult, getSchemaWithPath, link, logger } from '@prisma/internals' import { dim } from 'kleur/colors' import path from 'path' @@ -25,7 +25,7 @@ export async function getSchemaPathAndPrint( postinstallCwd?: string, ): Promise { const cwdOptions = postinstallCwd ? { cwd: postinstallCwd } : undefined - const schemaPathResult = await getSchemaPath(schemaPathProvided, cwdOptions) + const schemaPathResult = await getSchemaWithPath(schemaPathProvided, cwdOptions) if (!schemaPathResult) { // Special case for Generate command if (cwdOptions !== undefined) { diff --git a/packages/migrate/src/utils/removeDatasource.ts b/packages/migrate/src/utils/removeDatasource.ts deleted file mode 100644 index 9b3cc4d933aa..000000000000 --- a/packages/migrate/src/utils/removeDatasource.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { trimBlocksFromSchema } from '@prisma/internals' - -export function removeDatasource(schema: string): string { - return trimBlocksFromSchema(schema, ['datasource']).trim() -} diff --git a/packages/migrate/src/utils/replaceOrAddDatasource.test.ts b/packages/migrate/src/utils/replaceOrAddDatasource.test.ts new file mode 100644 index 000000000000..8986f749efa9 --- /dev/null +++ b/packages/migrate/src/utils/replaceOrAddDatasource.test.ts @@ -0,0 +1,220 @@ +import { replaceOrAddDatasource } from './replaceOrAddDatasource' + +const replacement = `datasource new { + provider = "sqlite" + url = "file:new.db" +}` + +test('single file, with existing datasource', () => { + const result = replaceOrAddDatasource(replacement, [ + [ + 'a.prisma', + ` +datasource db { + provider = "postgresql" + url = "postgresql://example.com/db" +} + +model A { + id Int @id +} +`, + ], + ]) + + expect(result).toMatchInlineSnapshot(` + [ + [ + "a.prisma", + "datasource new { + provider = "sqlite" + url = "file:new.db" + } + + model A { + id Int @id + }", + ], + ] + `) +}) + +test('single file, with no datasource', () => { + const result = replaceOrAddDatasource(replacement, [ + [ + 'a.prisma', + ` + model A { + id Int @id + } + `, + ], + ]) + + expect(result).toMatchInlineSnapshot(` + [ + [ + "a.prisma", + "datasource new { + provider = "sqlite" + url = "file:new.db" + } + + model A { + id Int @id + } + ", + ], + ] + `) +}) + +test('single file, empty', () => { + const result = replaceOrAddDatasource(replacement, [['a.prisma', '']]) + + expect(result).toMatchInlineSnapshot(` + [ + [ + "a.prisma", + "datasource new { + provider = "sqlite" + url = "file:new.db" + } + ", + ], + ] + `) +}) + +test('single file, with existing datasource and commented out closing bracket', () => { + const result = replaceOrAddDatasource(replacement, [ + [ + 'a.prisma', + ` + datasource db { + provider = "postgresql" + url = "postgresql://example.com/db" + // } + } + + model A { + id Int @id + } + `, + ], + ]) + + expect(result).toMatchInlineSnapshot(` + [ + [ + "a.prisma", + "datasource new { + provider = "sqlite" + url = "file:new.db" + } + + model A { + id Int @id + }", + ], + ] + `) +}) + +test('multiple files, with existing datasource', () => { + const result = replaceOrAddDatasource(replacement, [ + [ + 'a.prisma', + ` +model A { + id Int @id +} +`, + ], + + [ + 'b.prisma', + ` +datasource db { + provider = "postgresql" + url = "postgresql://example.com/db" +} + +model B { + id Int @id +} + `, + ], + ]) + + expect(result).toMatchInlineSnapshot(` + [ + [ + "a.prisma", + " + model A { + id Int @id + } + ", + ], + [ + "b.prisma", + "datasource new { + provider = "sqlite" + url = "file:new.db" + } + + model B { + id Int @id + }", + ], + ] + `) +}) + +test('multiple files, no datasource', () => { + const result = replaceOrAddDatasource(replacement, [ + [ + 'a.prisma', + ` + model A { + id Int @id + } + `, + ], + + [ + 'b.prisma', + ` + model B { + id Int @id + } + `, + ], + ]) + + expect(result).toMatchInlineSnapshot(` + [ + [ + "a.prisma", + "datasource new { + provider = "sqlite" + url = "file:new.db" + } + + model A { + id Int @id + } + ", + ], + [ + "b.prisma", + " + model B { + id Int @id + } + ", + ], + ] + `) +}) diff --git a/packages/migrate/src/utils/replaceOrAddDatasource.ts b/packages/migrate/src/utils/replaceOrAddDatasource.ts new file mode 100644 index 000000000000..ad2b5b1251b4 --- /dev/null +++ b/packages/migrate/src/utils/replaceOrAddDatasource.ts @@ -0,0 +1,72 @@ +import { assertAlways, MultipleSchemas } from '@prisma/internals' + +export function replaceOrAddDatasource(newDatasource: string, files: MultipleSchemas): MultipleSchemas { + let replaced = false + const result: MultipleSchemas = files.map(([path, content]) => { + const replaceResult = replaceDatasourceSingle(newDatasource, content) + if (replaceResult.replaced) { + replaced = true + } + return [path, replaceResult.content] + }) + + if (!replaced) { + appendToFirstFile(newDatasource, result) + } + + return result +} + +function appendToFirstFile(newDatasource: string, files: MultipleSchemas) { + const firstFile = files[0] + assertAlways(firstFile, 'There always should be at least on file in the schema') + + // [1] = content of the file + // prepend new datasource to the first file + firstFile[1] = `${newDatasource}\n${firstFile[1]}` +} + +function replaceDatasourceSingle(newDatasource: string, content: string) { + const lines = content.split(/\r\n|\r|\n/g) + const existingDatasource = findDatasource(lines) + if (!existingDatasource) { + return { replaced: false, content } + } + lines.splice(existingDatasource.startLine, existingDatasource.endLine - existingDatasource.startLine + 1) + const noDatasource = lines.join('\n').trim() + + return { replaced: true, content: `${newDatasource}\n\n${noDatasource}` } +} + +type Position = { + startLine: number + endLine: number +} + +function findDatasource(lines: string[]): Position | undefined { + if (lines.length <= 2) { + return undefined + } + const startLine = lines.findIndex((line) => { + const lineTrimmed = line.trim() + return lineTrimmed.startsWith('datasource') && lineTrimmed.endsWith('{') + }) + + if (startLine === -1) { + return undefined + } + + let endLine = -1 + for (let index = startLine; index < lines.length; index++) { + const lineTrimmed = lines[index].trim() + if (lineTrimmed.endsWith('}') && !lineTrimmed.startsWith('//')) { + endLine = index + break + } + } + if (endLine === -1) { + return undefined + } + + return { startLine, endLine } +} diff --git a/packages/pg-worker/package.json b/packages/pg-worker/package.json index 2ffef2eea48b..4175a1dcc4e7 100644 --- a/packages/pg-worker/package.json +++ b/packages/pg-worker/package.json @@ -19,7 +19,7 @@ "@types/node": "18.19.31", "pg": "8.11.5", "pg-cloudflare": "1.1.1", - "esbuild": "0.21.2", + "esbuild": "0.21.4", "jest": "29.7.0", "jest-junit": "16.0.0", "typescript": "5.4.5" @@ -35,7 +35,7 @@ "dist" ], "dependencies": { - "@types/pg": "8.11.5" + "@types/pg": "8.11.6" }, "sideEffects": false } diff --git a/packages/schema-files-loader/package.json b/packages/schema-files-loader/package.json index c7cfda9c5ed6..64319ae38ae4 100644 --- a/packages/schema-files-loader/package.json +++ b/packages/schema-files-loader/package.json @@ -22,7 +22,7 @@ ], "sideEffects": false, "dependencies": { - "@prisma/prisma-schema-wasm": "5.15.0-7.0af42cb19116c37b029e1f3665681074acb38bb4", + "@prisma/prisma-schema-wasm": "5.15.0-24.9ee43833e58f4ec014ce0f45b6ae27ee7e0165fc", "fs-extra": "11.1.1" }, "devDependencies": { diff --git a/packages/schema-files-loader/src/__fixtures__/related-feature-invalid-schema/a.prisma b/packages/schema-files-loader/src/__fixtures__/related-feature-invalid-schema/a.prisma new file mode 100644 index 000000000000..cc62d99c5a74 --- /dev/null +++ b/packages/schema-files-loader/src/__fixtures__/related-feature-invalid-schema/a.prisma @@ -0,0 +1,9 @@ +generator client { + provider = "prisma-client-js" + previewFeatures = ["prismaSchemaFolder"] +} + +model M { +field + +Let me tell you a story about something. diff --git a/packages/schema-files-loader/src/__fixtures__/related-feature-invalid-schema/b.prisma b/packages/schema-files-loader/src/__fixtures__/related-feature-invalid-schema/b.prisma new file mode 100644 index 000000000000..6d46a2b1a6e0 --- /dev/null +++ b/packages/schema-files-loader/src/__fixtures__/related-feature-invalid-schema/b.prisma @@ -0,0 +1 @@ +// this is b diff --git a/packages/schema-files-loader/src/loadRelatedSchemaFiles.test.ts b/packages/schema-files-loader/src/loadRelatedSchemaFiles.test.ts index 8b9497841ae6..083f0b3a09e5 100644 --- a/packages/schema-files-loader/src/loadRelatedSchemaFiles.test.ts +++ b/packages/schema-files-loader/src/loadRelatedSchemaFiles.test.ts @@ -10,3 +10,16 @@ test('with feature enabled', async () => { const files = await loadRelatedSchemaFiles(fixturePath('related-feature', 'a.prisma')) expect(files).toEqual([loadedFile('related-feature', 'a.prisma'), loadedFile('related-feature', 'b.prisma')]) }) + +test('with feature enabled, starting from a file with no generator block', async () => { + const files = await loadRelatedSchemaFiles(fixturePath('related-feature', 'b.prisma')) + expect(files).toEqual([loadedFile('related-feature', 'a.prisma'), loadedFile('related-feature', 'b.prisma')]) +}) + +test('invalid schema and feature enabled', async () => { + const files = await loadRelatedSchemaFiles(fixturePath('related-feature-invalid-schema', 'a.prisma')) + expect(files).toEqual([ + loadedFile('related-feature-invalid-schema', 'a.prisma'), + loadedFile('related-feature-invalid-schema', 'b.prisma'), + ]) +}) diff --git a/packages/schema-files-loader/src/loadRelatedSchemaFiles.ts b/packages/schema-files-loader/src/loadRelatedSchemaFiles.ts index 8713e4fd6d3f..b1a425b4eb87 100644 --- a/packages/schema-files-loader/src/loadRelatedSchemaFiles.ts +++ b/packages/schema-files-loader/src/loadRelatedSchemaFiles.ts @@ -4,7 +4,7 @@ import { get_config } from '@prisma/prisma-schema-wasm' import { LoadedFile, loadSchemaFiles } from './loadSchemaFiles' import { FilesResolver, realFsResolver } from './resolver' -import { ConfigMetaFormat, usesPrismaSchemaFolder } from './usesPrismaSchemaFolder' +import { GetConfigResponse, usesPrismaSchemaFolder } from './usesPrismaSchemaFolder' /** * Given a single file path, returns @@ -38,8 +38,8 @@ function isPrismaFolderEnabled(files: LoadedFile[]): boolean { }) try { - const response = JSON.parse(get_config(params)) as ConfigMetaFormat - return usesPrismaSchemaFolder(response) + const response = JSON.parse(get_config(params)) as GetConfigResponse + return usesPrismaSchemaFolder(response.config) } catch (e) { return false } diff --git a/packages/schema-files-loader/src/usesPrismaSchemaFolder.ts b/packages/schema-files-loader/src/usesPrismaSchemaFolder.ts index 89cafdd0279e..f6f53c8b8aa0 100644 --- a/packages/schema-files-loader/src/usesPrismaSchemaFolder.ts +++ b/packages/schema-files-loader/src/usesPrismaSchemaFolder.ts @@ -1,5 +1,9 @@ // Minimal subset of the return type of `getConfig` from `@prisma/internals`, used for `usesPrismaSchemaFolder`. -// This is a simplified version of the actual `ConfigMetaFormat` type, which isn't imported to avoid circular dependencies. +// This is a simplified version of the actual `ConfigMetaFormat` type, which isn't imported to avoid circular dependencies.export +export type GetConfigResponse = { + config: ConfigMetaFormat +} + export type ConfigMetaFormat = { generators: Array<{ previewFeatures: string[] diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 379e375f2159..b876edd1d195 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9,8 +9,8 @@ importers: .: devDependencies: '@microsoft/api-extractor': - specifier: 7.43.2 - version: 7.43.2(@types/node@20.12.7) + specifier: 7.46.2 + version: 7.46.2(@types/node@20.12.7) '@prisma/engines': specifier: workspace:* version: link:packages/engines @@ -45,14 +45,14 @@ importers: specifier: 1.20.6 version: 1.20.6 '@typescript-eslint/eslint-plugin': - specifier: 7.9.0 - version: 7.9.0(@typescript-eslint/parser@7.9.0)(eslint@8.57.0)(typescript@5.4.5) + specifier: 7.11.0 + version: 7.11.0(@typescript-eslint/parser@7.11.0)(eslint@8.57.0)(typescript@5.4.5) '@typescript-eslint/parser': - specifier: 7.9.0 - version: 7.9.0(eslint@8.57.0)(typescript@5.4.5) + specifier: 7.11.0 + version: 7.11.0(eslint@8.57.0)(typescript@5.4.5) '@typescript-eslint/utils': - specifier: 7.9.0 - version: 7.9.0(eslint@8.57.0)(typescript@5.4.5) + specifier: 7.11.0 + version: 7.11.0(eslint@8.57.0)(typescript@5.4.5) arg: specifier: 5.0.2 version: 5.0.2 @@ -72,11 +72,11 @@ importers: specifier: 7.4.2 version: 7.4.2 esbuild: - specifier: 0.21.2 - version: 0.21.2 + specifier: 0.21.4 + version: 0.21.4 esbuild-register: specifier: 3.5.0 - version: 3.5.0(esbuild@0.21.2) + version: 3.5.0(esbuild@0.21.4) eslint: specifier: 8.57.0 version: 8.57.0 @@ -88,10 +88,10 @@ importers: version: 3.2.0(eslint@8.57.0) eslint-plugin-import: specifier: 2.29.1 - version: 2.29.1(@typescript-eslint/parser@7.9.0)(eslint@8.57.0) + version: 2.29.1(@typescript-eslint/parser@7.11.0)(eslint@8.57.0) eslint-plugin-jest: specifier: 28.5.0 - version: 28.5.0(@typescript-eslint/eslint-plugin@7.9.0)(eslint@8.57.0)(typescript@5.4.5) + version: 28.5.0(@typescript-eslint/eslint-plugin@7.11.0)(eslint@8.57.0)(typescript@5.4.5) eslint-plugin-local-rules: specifier: 2.0.1 version: 2.0.1 @@ -129,8 +129,8 @@ importers: specifier: 4.1.5 version: 4.1.5 lint-staged: - specifier: 15.2.2 - version: 15.2.2 + specifier: 15.2.5 + version: 15.2.5 p-map: specifier: 4.0.0 version: 4.0.0 @@ -159,8 +159,8 @@ importers: specifier: 5.2.1 version: 5.2.1 semver: - specifier: 7.6.1 - version: 7.6.1 + specifier: 7.6.2 + version: 7.6.2 size-limit: specifier: 9.0.0 version: 9.0.0 @@ -168,8 +168,8 @@ importers: specifier: 2.5.0 version: 2.5.0 spdx-license-ids: - specifier: 3.0.17 - version: 3.0.17 + specifier: 3.0.18 + version: 3.0.18 staged-git-files: specifier: 1.3.0 version: 1.3.0 @@ -180,8 +180,8 @@ importers: specifier: 9.6.0 version: 9.6.0 tsx: - specifier: 4.10.1 - version: 4.10.1 + specifier: 4.11.0 + version: 4.11.0 typescript: specifier: 5.4.5 version: 5.4.5 @@ -198,8 +198,8 @@ importers: packages/adapter-d1: dependencies: '@cloudflare/workers-types': - specifier: 4.20240512.0 - version: 4.20240512.0 + specifier: 4.20240529.0 + version: 4.20240529.0 '@prisma/driver-adapter-utils': specifier: workspace:* version: link:../driver-adapter-utils @@ -214,8 +214,8 @@ importers: version: 0.5.0 devDependencies: '@libsql/client': - specifier: 0.6.0 - version: 0.6.0 + specifier: 0.6.1 + version: 0.6.1 packages/adapter-neon: dependencies: @@ -227,14 +227,14 @@ importers: version: 3.0.2 devDependencies: '@neondatabase/serverless': - specifier: 0.9.1 - version: 0.9.1 + specifier: 0.9.3 + version: 0.9.3 '@swc/core': - specifier: 1.5.3 - version: 1.5.3 + specifier: 1.5.7 + version: 1.5.7 '@swc/jest': specifier: 0.2.36 - version: 0.2.36(@swc/core@1.5.3) + version: 0.2.36(@swc/core@1.5.7) jest: specifier: 29.7.0 version: 29.7.0(@types/node@20.12.7)(ts-node@10.9.2) @@ -252,14 +252,14 @@ importers: version: 3.0.2 devDependencies: '@swc/core': - specifier: 1.5.3 - version: 1.5.3 + specifier: 1.5.7 + version: 1.5.7 '@swc/jest': specifier: 0.2.36 - version: 0.2.36(@swc/core@1.5.3) + version: 0.2.36(@swc/core@1.5.7) '@types/pg': - specifier: 8.11.5 - version: 8.11.5 + specifier: 8.11.6 + version: 8.11.6 jest: specifier: 29.7.0 version: 29.7.0(@types/node@20.12.7)(ts-node@10.9.2) @@ -283,11 +283,11 @@ importers: specifier: workspace:* version: link:../pg-worker '@swc/core': - specifier: 1.5.3 - version: 1.5.3 + specifier: 1.5.7 + version: 1.5.7 '@swc/jest': specifier: 0.2.36 - version: 0.2.36(@swc/core@1.5.3) + version: 0.2.36(@swc/core@1.5.7) jest: specifier: 29.7.0 version: 29.7.0(@types/node@20.12.7)(ts-node@10.9.2) @@ -305,11 +305,11 @@ importers: specifier: 1.18.0 version: 1.18.0 '@swc/core': - specifier: 1.5.3 - version: 1.5.3 + specifier: 1.5.7 + version: 1.5.7 '@swc/jest': specifier: 0.2.36 - version: 0.2.36(@swc/core@1.5.3) + version: 0.2.36(@swc/core@1.5.7) jest: specifier: 29.7.0 version: 29.7.0(@types/node@20.12.7)(ts-node@10.9.2) @@ -323,8 +323,8 @@ importers: packages/bundle-size: dependencies: '@libsql/client': - specifier: 0.6.0 - version: 0.6.0 + specifier: 0.6.1 + version: 0.6.1 '@neondatabase/serverless': specifier: 0.9.3 version: 0.9.3 @@ -362,14 +362,14 @@ importers: specifier: workspace:* version: link:../cli wrangler: - specifier: 3.56.0 - version: 3.56.0(@cloudflare/workers-types@4.20240512.0) + specifier: 3.57.2 + version: 3.57.2(@cloudflare/workers-types@4.20240529.0) packages/bundled-js-drivers: dependencies: '@libsql/client': - specifier: 0.6.0 - version: 0.6.0 + specifier: 0.6.1 + version: 0.6.1 '@neondatabase/serverless': specifier: 0.9.3 version: 0.9.3 @@ -377,8 +377,8 @@ importers: specifier: 1.18.0 version: 1.18.0 '@types/pg': - specifier: 8.11.5 - version: 8.11.5 + specifier: 8.11.6 + version: 8.11.6 pg: specifier: 8.11.5 version: 8.11.5 @@ -420,11 +420,11 @@ importers: specifier: 0.500.0 version: 0.500.0(@prisma/client@packages+client)(@prisma/internals@packages+internals) '@swc/core': - specifier: 1.5.3 - version: 1.5.3 + specifier: 1.5.7 + version: 1.5.7 '@swc/jest': specifier: 0.2.36 - version: 0.2.36(@swc/core@1.5.3) + version: 0.2.36(@swc/core@1.5.7) '@types/debug': specifier: 4.1.12 version: 4.1.12 @@ -453,8 +453,8 @@ importers: specifier: 16.0.3 version: 16.0.3 esbuild: - specifier: 0.21.2 - version: 0.21.2 + specifier: 0.21.4 + version: 0.21.4 execa: specifier: 5.1.1 version: 5.1.1 @@ -510,8 +510,8 @@ importers: specifier: 6.0.1 version: 6.0.1 ts-pattern: - specifier: 5.1.1 - version: 5.1.1 + specifier: 5.1.2 + version: 5.1.2 typescript: specifier: 5.4.5 version: 5.4.5 @@ -525,8 +525,8 @@ importers: packages/client: devDependencies: '@cloudflare/workers-types': - specifier: 4.20240512.0 - version: 4.20240512.0 + specifier: 4.20240529.0 + version: 4.20240529.0 '@codspeed/benchmark.js-plugin': specifier: 3.1.0 version: 3.1.0(benchmark@2.1.4) @@ -534,11 +534,11 @@ importers: specifier: 8.4.1 version: 8.4.1 '@fast-check/jest': - specifier: 1.8.1 - version: 1.8.1(@jest/globals@29.7.0) + specifier: 1.8.2 + version: 1.8.2(@jest/globals@29.7.0) '@inquirer/prompts': - specifier: 5.0.2 - version: 5.0.2 + specifier: 5.0.4 + version: 5.0.4 '@jest/create-cache-key-function': specifier: 29.7.0 version: 29.7.0 @@ -549,11 +549,11 @@ importers: specifier: 29.7.0 version: 29.7.0 '@libsql/client': - specifier: 0.6.0 - version: 0.6.0 + specifier: 0.6.1 + version: 0.6.1 '@neondatabase/serverless': - specifier: 0.9.1 - version: 0.9.1 + specifier: 0.9.3 + version: 0.9.3 '@opentelemetry/api': specifier: 1.8.0 version: 1.8.0 @@ -603,8 +603,8 @@ importers: specifier: workspace:* version: link:../engines '@prisma/engines-version': - specifier: 5.15.0-7.0af42cb19116c37b029e1f3665681074acb38bb4 - version: 5.15.0-7.0af42cb19116c37b029e1f3665681074acb38bb4 + specifier: 5.15.0-24.9ee43833e58f4ec014ce0f45b6ae27ee7e0165fc + version: 5.15.0-24.9ee43833e58f4ec014ce0f45b6ae27ee7e0165fc '@prisma/fetch-engine': specifier: workspace:* version: link:../fetch-engine @@ -630,20 +630,20 @@ importers: specifier: workspace:* version: link:../pg-worker '@prisma/query-engine-wasm': - specifier: 5.15.0-7.0af42cb19116c37b029e1f3665681074acb38bb4 - version: 5.15.0-7.0af42cb19116c37b029e1f3665681074acb38bb4 + specifier: 5.15.0-24.9ee43833e58f4ec014ce0f45b6ae27ee7e0165fc + version: 5.15.0-24.9ee43833e58f4ec014ce0f45b6ae27ee7e0165fc '@snaplet/copycat': specifier: 0.17.3 version: 0.17.3 '@swc-node/register': specifier: 1.9.1 - version: 1.9.1(@swc/core@1.5.3)(typescript@5.4.5) + version: 1.9.1(@swc/core@1.5.7)(typescript@5.4.5) '@swc/core': - specifier: 1.5.3 - version: 1.5.3 + specifier: 1.5.7 + version: 1.5.7 '@swc/jest': specifier: 0.2.36 - version: 0.2.36(@swc/core@1.5.3) + version: 0.2.36(@swc/core@1.5.7) '@timsuchanek/copy': specifier: 1.4.5 version: 1.4.5 @@ -666,8 +666,8 @@ importers: specifier: 18.19.31 version: 18.19.31 '@types/pg': - specifier: 8.11.5 - version: 8.11.5 + specifier: 8.11.6 + version: 8.11.6 arg: specifier: 5.0.2 version: 5.0.2 @@ -687,8 +687,8 @@ importers: specifier: 2.2.1 version: 2.2.1 esbuild: - specifier: 0.21.2 - version: 0.21.2 + specifier: 0.21.4 + version: 0.21.4 execa: specifier: 5.1.1 version: 5.1.1 @@ -790,10 +790,10 @@ importers: version: 3.0.0 ts-node: specifier: 10.9.2 - version: 10.9.2(@swc/core@1.5.3)(@types/node@18.19.31)(typescript@5.4.5) + version: 10.9.2(@swc/core@1.5.7)(@types/node@18.19.31)(typescript@5.4.5) ts-pattern: - specifier: 5.1.1 - version: 5.1.1 + specifier: 5.1.2 + version: 5.1.2 tsd: specifier: 0.31.0 version: 0.31.0 @@ -804,8 +804,8 @@ importers: specifier: 5.28.4 version: 5.28.4 wrangler: - specifier: 3.56.0 - version: 3.56.0(@cloudflare/workers-types@4.20240512.0) + specifier: 3.57.2 + version: 3.57.2(@cloudflare/workers-types@4.20240529.0) zx: specifier: 7.2.3 version: 7.2.3 @@ -819,8 +819,8 @@ importers: specifier: 18.19.31 version: 18.19.31 esbuild: - specifier: 0.21.2 - version: 0.21.2 + specifier: 0.21.4 + version: 0.21.4 jest: specifier: 29.7.0 version: 29.7.0(@types/node@18.19.31)(ts-node@10.9.2) @@ -849,8 +849,8 @@ importers: specifier: workspace:* version: link:../debug '@prisma/engines-version': - specifier: 5.15.0-7.0af42cb19116c37b029e1f3665681074acb38bb4 - version: 5.15.0-7.0af42cb19116c37b029e1f3665681074acb38bb4 + specifier: 5.15.0-24.9ee43833e58f4ec014ce0f45b6ae27ee7e0165fc + version: 5.15.0-24.9ee43833e58f4ec014ce0f45b6ae27ee7e0165fc '@prisma/fetch-engine': specifier: workspace:* version: link:../fetch-engine @@ -859,11 +859,11 @@ importers: version: link:../get-platform devDependencies: '@swc/core': - specifier: 1.5.3 - version: 1.5.3 + specifier: 1.5.7 + version: 1.5.7 '@swc/jest': specifier: 0.2.36 - version: 0.2.36(@swc/core@1.5.3) + version: 0.2.36(@swc/core@1.5.7) '@types/jest': specifier: 29.5.12 version: 29.5.12 @@ -886,18 +886,18 @@ importers: specifier: workspace:* version: link:../debug '@prisma/engines-version': - specifier: 5.15.0-7.0af42cb19116c37b029e1f3665681074acb38bb4 - version: 5.15.0-7.0af42cb19116c37b029e1f3665681074acb38bb4 + specifier: 5.15.0-24.9ee43833e58f4ec014ce0f45b6ae27ee7e0165fc + version: 5.15.0-24.9ee43833e58f4ec014ce0f45b6ae27ee7e0165fc '@prisma/get-platform': specifier: workspace:* version: link:../get-platform devDependencies: '@swc/core': - specifier: 1.5.3 - version: 1.5.3 + specifier: 1.5.7 + version: 1.5.7 '@swc/jest': specifier: 0.2.36 - version: 0.2.36(@swc/core@1.5.3) + version: 0.2.36(@swc/core@1.5.7) '@types/jest': specifier: 29.5.12 version: 29.5.12 @@ -976,13 +976,13 @@ importers: devDependencies: '@swc-node/register': specifier: 1.9.1 - version: 1.9.1(@swc/core@1.5.3)(typescript@5.4.5) + version: 1.9.1(@swc/core@1.5.7)(typescript@5.4.5) '@swc/core': - specifier: 1.5.3 - version: 1.5.3 + specifier: 1.5.7 + version: 1.5.7 '@swc/jest': specifier: 0.2.36 - version: 0.2.36(@swc/core@1.5.3) + version: 0.2.36(@swc/core@1.5.7) '@types/cross-spawn': specifier: 6.0.6 version: 6.0.6 @@ -996,8 +996,8 @@ importers: specifier: 7.0.3 version: 7.0.3 esbuild: - specifier: 0.21.2 - version: 0.21.2 + specifier: 0.21.4 + version: 0.21.4 jest: specifier: 29.7.0 version: 29.7.0(@types/node@18.19.31)(ts-node@10.9.2) @@ -1009,7 +1009,7 @@ importers: version: 4.1.5 ts-node: specifier: 10.9.2 - version: 10.9.2(@swc/core@1.5.3)(@types/node@18.19.31)(typescript@5.4.5) + version: 10.9.2(@swc/core@1.5.7)(@types/node@18.19.31)(typescript@5.4.5) typescript: specifier: 5.4.5 version: 5.4.5 @@ -1024,11 +1024,11 @@ importers: specifier: 3.1.0 version: 3.1.0(benchmark@2.1.4) '@swc/core': - specifier: 1.5.3 - version: 1.5.3 + specifier: 1.5.7 + version: 1.5.7 '@swc/jest': specifier: 0.2.36 - version: 0.2.36(@swc/core@1.5.3) + version: 0.2.36(@swc/core@1.5.7) '@types/jest': specifier: 29.5.12 version: 29.5.12 @@ -1069,8 +1069,8 @@ importers: specifier: 2.1.1 version: 2.1.1 ts-pattern: - specifier: 5.1.1 - version: 5.1.1 + specifier: 5.1.2 + version: 5.1.2 typescript: specifier: 5.4.5 version: 5.4.5 @@ -1091,8 +1091,8 @@ importers: specifier: workspace:* version: link:../internals '@swc/core': - specifier: 1.5.3 - version: 1.5.3 + specifier: 1.5.7 + version: 1.5.7 '@types/jest': specifier: 29.5.12 version: 29.5.12 @@ -1124,11 +1124,11 @@ importers: specifier: 1.1.2 version: 1.1.2 '@swc/core': - specifier: 1.5.3 - version: 1.5.3 + specifier: 1.5.7 + version: 1.5.7 '@swc/jest': specifier: 0.2.36 - version: 0.2.36(@swc/core@1.5.3) + version: 0.2.36(@swc/core@1.5.7) '@types/jest': specifier: 29.5.12 version: 29.5.12 @@ -1139,8 +1139,8 @@ importers: specifier: 18.19.31 version: 18.19.31 '@types/pg': - specifier: 8.11.5 - version: 8.11.5 + specifier: 8.11.6 + version: 8.11.6 '@types/sqlite3': specifier: 3.1.11 version: 3.1.11 @@ -1148,8 +1148,8 @@ importers: specifier: 10.4.3 version: 10.4.3 esbuild: - specifier: 0.21.2 - version: 0.21.2 + specifier: 0.21.4 + version: 0.21.4 execa: specifier: 5.1.1 version: 5.1.1 @@ -1185,7 +1185,7 @@ importers: version: 1.0.1 ts-node: specifier: 10.9.2 - version: 10.9.2(@swc/core@1.5.3)(@types/node@18.19.31)(typescript@5.4.5) + version: 10.9.2(@swc/core@1.5.7)(@types/node@18.19.31)(typescript@5.4.5) typescript: specifier: 5.4.5 version: 5.4.5 @@ -1211,8 +1211,8 @@ importers: specifier: workspace:* version: link:../get-platform '@prisma/prisma-schema-wasm': - specifier: 5.15.0-7.0af42cb19116c37b029e1f3665681074acb38bb4 - version: 5.15.0-7.0af42cb19116c37b029e1f3665681074acb38bb4 + specifier: 5.15.0-24.9ee43833e58f4ec014ce0f45b6ae27ee7e0165fc + version: 5.15.0-24.9ee43833e58f4ec014ce0f45b6ae27ee7e0165fc '@prisma/schema-files-loader': specifier: workspace:* version: link:../schema-files-loader @@ -1257,8 +1257,8 @@ importers: specifier: 16.0.3 version: 16.0.3 esbuild: - specifier: 0.21.2 - version: 0.21.2 + specifier: 0.21.4 + version: 0.21.4 escape-string-regexp: specifier: 4.0.0 version: 4.0.0 @@ -1272,8 +1272,8 @@ importers: specifier: 5.0.0 version: 5.0.0 fp-ts: - specifier: 2.16.5 - version: 2.16.5 + specifier: 2.16.6 + version: 2.16.6 fs-extra: specifier: 11.1.1 version: 11.1.1 @@ -1356,8 +1356,8 @@ importers: specifier: 10.9.2 version: 10.9.2(@swc/core@1.2.204)(@types/node@18.19.31)(typescript@5.4.5) ts-pattern: - specifier: 5.1.1 - version: 5.1.1 + specifier: 5.1.2 + version: 5.1.2 typescript: specifier: 5.4.5 version: 5.4.5 @@ -1371,8 +1371,8 @@ importers: specifier: workspace:* version: link:../debug '@prisma/engines-version': - specifier: 5.15.0-7.0af42cb19116c37b029e1f3665681074acb38bb4 - version: 5.15.0-7.0af42cb19116c37b029e1f3665681074acb38bb4 + specifier: 5.15.0-24.9ee43833e58f4ec014ce0f45b6ae27ee7e0165fc + version: 5.15.0-24.9ee43833e58f4ec014ce0f45b6ae27ee7e0165fc '@prisma/generator-helper': specifier: workspace:* version: link:../generator-helper @@ -1390,11 +1390,11 @@ importers: specifier: 1.1.2 version: 1.1.2 '@swc/core': - specifier: 1.5.3 - version: 1.5.3 + specifier: 1.5.7 + version: 1.5.7 '@swc/jest': specifier: 0.2.36 - version: 0.2.36(@swc/core@1.5.3) + version: 0.2.36(@swc/core@1.5.7) '@types/jest': specifier: 29.5.12 version: 29.5.12 @@ -1402,8 +1402,8 @@ importers: specifier: 18.19.31 version: 18.19.31 '@types/pg': - specifier: 8.11.5 - version: 8.11.5 + specifier: 8.11.6 + version: 8.11.6 '@types/prompts': specifier: 2.4.9 version: 2.4.9 @@ -1414,14 +1414,14 @@ importers: specifier: 5.0.2 version: 5.0.2 esbuild: - specifier: 0.21.2 - version: 0.21.2 + specifier: 0.21.4 + version: 0.21.4 execa: specifier: 5.1.1 version: 5.1.1 fp-ts: - specifier: 2.16.5 - version: 2.16.5 + specifier: 2.16.6 + version: 2.16.6 fs-jetpack: specifier: 5.1.0 version: 5.1.0 @@ -1453,8 +1453,8 @@ importers: specifier: 1.0.0 version: 1.0.0 mongoose: - specifier: 8.3.4 - version: 8.3.4 + specifier: 8.4.0 + version: 8.4.0 mssql: specifier: 10.0.2 version: 10.0.2 @@ -1477,23 +1477,26 @@ importers: specifier: 1.0.1 version: 1.0.1 ts-pattern: - specifier: 5.1.1 - version: 5.1.1 + specifier: 5.1.2 + version: 5.1.2 typescript: specifier: 5.4.5 version: 5.4.5 + wrangler: + specifier: 3.57.2 + version: 3.57.2(@cloudflare/workers-types@4.20240529.0) packages/nextjs-monorepo-workaround-plugin: devDependencies: webpack: specifier: 5.91.0 - version: 5.91.0(esbuild@0.21.2) + version: 5.91.0(esbuild@0.21.4) packages/pg-worker: dependencies: '@types/pg': - specifier: 8.11.5 - version: 8.11.5 + specifier: 8.11.6 + version: 8.11.6 devDependencies: '@types/jest': specifier: 29.5.12 @@ -1502,8 +1505,8 @@ importers: specifier: 18.19.31 version: 18.19.31 esbuild: - specifier: 0.21.2 - version: 0.21.2 + specifier: 0.21.4 + version: 0.21.4 jest: specifier: 29.7.0 version: 29.7.0(@types/node@18.19.31)(ts-node@10.9.2) @@ -1523,8 +1526,8 @@ importers: packages/schema-files-loader: dependencies: '@prisma/prisma-schema-wasm': - specifier: 5.15.0-7.0af42cb19116c37b029e1f3665681074acb38bb4 - version: 5.15.0-7.0af42cb19116c37b029e1f3665681074acb38bb4 + specifier: 5.15.0-24.9ee43833e58f4ec014ce0f45b6ae27ee7e0165fc + version: 5.15.0-24.9ee43833e58f4ec014ce0f45b6ae27ee7e0165fc fs-extra: specifier: 11.1.1 version: 11.1.1 @@ -2077,48 +2080,48 @@ packages: dependencies: mime: 3.0.0 - /@cloudflare/workerd-darwin-64@1.20240512.0: - resolution: {integrity: sha512-VMp+CsSHFALQiBzPdQ5dDI4T1qwLu0mQ0aeKVNDosXjueN0f3zj/lf+mFil5/9jBbG3t4mG0y+6MMnalP9Lobw==} + /@cloudflare/workerd-darwin-64@1.20240524.0: + resolution: {integrity: sha512-ATaXjefbTsrv4mpn4Fdua114RRDXcX5Ky+Mv+f4JTUllgalmqC4CYMN4jxRz9IpJU/fNMN8IEfvUyuJBAcl9Iw==} engines: {node: '>=16'} cpu: [x64] os: [darwin] requiresBuild: true optional: true - /@cloudflare/workerd-darwin-arm64@1.20240512.0: - resolution: {integrity: sha512-lZktXGmzMrB5rJqY9+PmnNfv1HKlj/YLZwMjPfF0WVKHUFdvQbAHsi7NlKv6mW9uIvlZnS+K4sIkWc0MDXcRnA==} + /@cloudflare/workerd-darwin-arm64@1.20240524.0: + resolution: {integrity: sha512-wnbsZI4CS0QPCd+wnBHQ40C28A/2Qo4ESi1YhE2735G3UNcc876MWksZhsubd+XH0XPIra6eNFqyw6wRMpQOXA==} engines: {node: '>=16'} cpu: [arm64] os: [darwin] requiresBuild: true optional: true - /@cloudflare/workerd-linux-64@1.20240512.0: - resolution: {integrity: sha512-wrHvqCZZqXz6Y3MUTn/9pQNsvaoNjbJpuA6vcXsXu8iCzJi911iVW2WUEBX+MpUWD+mBIP0oXni5tTlhkokOPw==} + /@cloudflare/workerd-linux-64@1.20240524.0: + resolution: {integrity: sha512-E8mj+HPBryKwaJAiNsYzXtVjKCL0KvUBZbtxJxlWM4mLSQhT+uwGT3nydb/hFY59rZnQgZslw0oqEWht5TEYiQ==} engines: {node: '>=16'} cpu: [x64] os: [linux] requiresBuild: true optional: true - /@cloudflare/workerd-linux-arm64@1.20240512.0: - resolution: {integrity: sha512-YPezHMySL9J9tFdzxz390eBswQ//QJNYcZolz9Dgvb3FEfdpK345cE/bsWbMOqw5ws2f82l388epoenghtYvAg==} + /@cloudflare/workerd-linux-arm64@1.20240524.0: + resolution: {integrity: sha512-/Fr1W671t2triNCDCBWdStxngnbUfZunZ/2e4kaMLzJDJLYDtYdmvOUCBDzUD4ssqmIMbn9RCQQ0U+CLEoqBqw==} engines: {node: '>=16'} cpu: [arm64] os: [linux] requiresBuild: true optional: true - /@cloudflare/workerd-windows-64@1.20240512.0: - resolution: {integrity: sha512-SxKapDrIYSscMR7lGIp/av0l6vokjH4xQ9ACxHgXh+OdOus9azppSmjaPyw4/ePvg7yqpkaNjf9o258IxWtvKQ==} + /@cloudflare/workerd-windows-64@1.20240524.0: + resolution: {integrity: sha512-G+ThDEx57g9mAEKqhWnHaaJgpeGYtyhkmwM/BDpLqPks/rAY5YEfZbY4YL1pNk1kkcZDXGrwIsY8xe9Apf5JdA==} engines: {node: '>=16'} cpu: [x64] os: [win32] requiresBuild: true optional: true - /@cloudflare/workers-types@4.20240512.0: - resolution: {integrity: sha512-o2yTEWg+YK/I1t/Me+dA0oarO0aCbjibp6wSeaw52DSE9tDyKJ7S+Qdyw/XsMrKn4t8kF6f/YOba+9O4MJfW9w==} + /@cloudflare/workers-types@4.20240529.0: + resolution: {integrity: sha512-W5obfjAwCNdYk3feUHtDfUxtTU6WIq83k6gmrLLJv+HkgCkOTwwrDNs+3w1Qln0tMj+FQx/fbwxw3ZuHIoyzGg==} /@codspeed/benchmark.js-plugin@3.1.0(benchmark@2.1.4): resolution: {integrity: sha512-PHF/QJ3WzTEX9nyhq6EHPA/pkHfMCW0FtfmJvl1qQSt0yIqpM4f0iBIfowua1AzbyD+Pd6iOPvlLHqO7ziLc+Q==} @@ -2175,8 +2178,8 @@ packages: dev: true optional: true - /@esbuild/aix-ppc64@0.21.2: - resolution: {integrity: sha512-/c7hocx0pm14bHQlqUVKmxwdT/e5/KkyoY1W8F9lk/8CkE037STDDz8PXUP/LE6faj2HqchvDs9GcShxFhI78Q==} + /@esbuild/aix-ppc64@0.21.4: + resolution: {integrity: sha512-Zrm+B33R4LWPLjDEVnEqt2+SLTATlru1q/xYKVn8oVTbiRBGmK2VIMoIYGJDGyftnGaC788IuzGFAlb7IQ0Y8A==} engines: {node: '>=12'} cpu: [ppc64] os: [aix] @@ -2201,8 +2204,8 @@ packages: dev: true optional: true - /@esbuild/android-arm64@0.21.2: - resolution: {integrity: sha512-SGZKngoTWVUriO5bDjI4WDGsNx2VKZoXcds+ita/kVYB+8IkSCKDRDaK+5yu0b5S0eq6B3S7fpiEvpsa2ammlQ==} + /@esbuild/android-arm64@0.21.4: + resolution: {integrity: sha512-fYFnz+ObClJ3dNiITySBUx+oNalYUT18/AryMxfovLkYWbutXsct3Wz2ZWAcGGppp+RVVX5FiXeLYGi97umisA==} engines: {node: '>=12'} cpu: [arm64] os: [android] @@ -2227,8 +2230,8 @@ packages: dev: true optional: true - /@esbuild/android-arm@0.21.2: - resolution: {integrity: sha512-G1ve3b4FeyJeyCjB4MX1CiWyTaIJwT9wAYE+8+IRA53YoN/reC/Bf2GDRXAzDTnh69Fpl+1uIKg76DiB3U6vwQ==} + /@esbuild/android-arm@0.21.4: + resolution: {integrity: sha512-E7H/yTd8kGQfY4z9t3nRPk/hrhaCajfA3YSQSBrst8B+3uTcgsi8N+ZWYCaeIDsiVs6m65JPCaQN/DxBRclF3A==} engines: {node: '>=12'} cpu: [arm] os: [android] @@ -2253,8 +2256,8 @@ packages: dev: true optional: true - /@esbuild/android-x64@0.21.2: - resolution: {integrity: sha512-1wzzNoj2QtNkAYwIcWJ66UTRA80+RTQ/kuPMtEuP0X6dp5Ar23Dn566q3aV61h4EYrrgGlOgl/HdcqN/2S/2vg==} + /@esbuild/android-x64@0.21.4: + resolution: {integrity: sha512-mDqmlge3hFbEPbCWxp4fM6hqq7aZfLEHZAKGP9viq9wMUBVQx202aDIfc3l+d2cKhUJM741VrCXEzRFhPDKH3Q==} engines: {node: '>=12'} cpu: [x64] os: [android] @@ -2279,8 +2282,8 @@ packages: dev: true optional: true - /@esbuild/darwin-arm64@0.21.2: - resolution: {integrity: sha512-ZyMkPWc5eTROcLOA10lEqdDSTc6ds6nuh3DeHgKip/XJrYjZDfnkCVSty8svWdy+SC1f77ULtVeIqymTzaB6/Q==} + /@esbuild/darwin-arm64@0.21.4: + resolution: {integrity: sha512-72eaIrDZDSiWqpmCzVaBD58c8ea8cw/U0fq/PPOTqE3c53D0xVMRt2ooIABZ6/wj99Y+h4ksT/+I+srCDLU9TA==} engines: {node: '>=12'} cpu: [arm64] os: [darwin] @@ -2305,8 +2308,8 @@ packages: dev: true optional: true - /@esbuild/darwin-x64@0.21.2: - resolution: {integrity: sha512-K4ZdVq1zP9v51h/cKVna7im7G0zGTKKB6bP2yJiSmHjjOykbd8DdhrSi8V978sF69rkwrn8zCyL2t6I3ei6j9A==} + /@esbuild/darwin-x64@0.21.4: + resolution: {integrity: sha512-uBsuwRMehGmw1JC7Vecu/upOjTsMhgahmDkWhGLWxIgUn2x/Y4tIwUZngsmVb6XyPSTXJYS4YiASKPcm9Zitag==} engines: {node: '>=12'} cpu: [x64] os: [darwin] @@ -2331,8 +2334,8 @@ packages: dev: true optional: true - /@esbuild/freebsd-arm64@0.21.2: - resolution: {integrity: sha512-4kbOGdpA61CXqadD+Gb/Pw3YXamQGiz9mal/h93rFVSjr5cgMnmJd/gbfPRm+3BMifvnaOfS1gNWaIDxkE2A3A==} + /@esbuild/freebsd-arm64@0.21.4: + resolution: {integrity: sha512-8JfuSC6YMSAEIZIWNL3GtdUT5NhUA/CMUCpZdDRolUXNAXEE/Vbpe6qlGLpfThtY5NwXq8Hi4nJy4YfPh+TwAg==} engines: {node: '>=12'} cpu: [arm64] os: [freebsd] @@ -2357,8 +2360,8 @@ packages: dev: true optional: true - /@esbuild/freebsd-x64@0.21.2: - resolution: {integrity: sha512-ShS+R09nuHzDBfPeMUliKZX27Wrmr8UFp93aFf/S8p+++x5BZ+D344CLKXxmY6qzgTL3mILSImPCNJOzD6+RRg==} + /@esbuild/freebsd-x64@0.21.4: + resolution: {integrity: sha512-8d9y9eQhxv4ef7JmXny7591P/PYsDFc4+STaxC1GBv0tMyCdyWfXu2jBuqRsyhY8uL2HU8uPyscgE2KxCY9imQ==} engines: {node: '>=12'} cpu: [x64] os: [freebsd] @@ -2383,8 +2386,8 @@ packages: dev: true optional: true - /@esbuild/linux-arm64@0.21.2: - resolution: {integrity: sha512-Hdu8BL+AmO+eCDvvT6kz/fPQhvuHL8YK4ExKZfANWsNe1kFGOHw7VJvS/FKSLFqheXmB3rTF3xFQIgUWPYsGnA==} + /@esbuild/linux-arm64@0.21.4: + resolution: {integrity: sha512-/GLD2orjNU50v9PcxNpYZi+y8dJ7e7/LhQukN3S4jNDXCKkyyiyAz9zDw3siZ7Eh1tRcnCHAo/WcqKMzmi4eMQ==} engines: {node: '>=12'} cpu: [arm64] os: [linux] @@ -2409,8 +2412,8 @@ packages: dev: true optional: true - /@esbuild/linux-arm@0.21.2: - resolution: {integrity: sha512-nnGXjOAv+7cM3LYRx4tJsYdgy8dGDGkAzF06oIDGppWbUkUKN9SmgQA8H0KukpU0Pjrj9XmgbWqMVSX/U7eeTA==} + /@esbuild/linux-arm@0.21.4: + resolution: {integrity: sha512-2rqFFefpYmpMs+FWjkzSgXg5vViocqpq5a1PSRgT0AvSgxoXmGF17qfGAzKedg6wAwyM7UltrKVo9kxaJLMF/g==} engines: {node: '>=12'} cpu: [arm] os: [linux] @@ -2435,8 +2438,8 @@ packages: dev: true optional: true - /@esbuild/linux-ia32@0.21.2: - resolution: {integrity: sha512-m73BOCW2V9lcj7RtEMi+gBfHC6n3+VHpwQXP5offtQMPLDkpVolYn1YGXxOZ9hp4h3UPRKuezL7WkBsw+3EB3Q==} + /@esbuild/linux-ia32@0.21.4: + resolution: {integrity: sha512-pNftBl7m/tFG3t2m/tSjuYeWIffzwAZT9m08+9DPLizxVOsUl8DdFzn9HvJrTQwe3wvJnwTdl92AonY36w/25g==} engines: {node: '>=12'} cpu: [ia32] os: [linux] @@ -2461,8 +2464,8 @@ packages: dev: true optional: true - /@esbuild/linux-loong64@0.21.2: - resolution: {integrity: sha512-84eYHwwWHq3myIY/6ikALMcnwkf6Qo7NIq++xH0x+cJuUNpdwh8mlpUtRY+JiGUc60yu7ElWBbVHGWTABTclGw==} + /@esbuild/linux-loong64@0.21.4: + resolution: {integrity: sha512-cSD2gzCK5LuVX+hszzXQzlWya6c7hilO71L9h4KHwqI4qeqZ57bAtkgcC2YioXjsbfAv4lPn3qe3b00Zt+jIfQ==} engines: {node: '>=12'} cpu: [loong64] os: [linux] @@ -2487,8 +2490,8 @@ packages: dev: true optional: true - /@esbuild/linux-mips64el@0.21.2: - resolution: {integrity: sha512-9siSZngT0/ZKG+AH+/agwKF29LdCxw4ODi/PiE0F52B2rtLozlDP92umf8G2GPoVV611LN4pZ+nSTckebOscUA==} + /@esbuild/linux-mips64el@0.21.4: + resolution: {integrity: sha512-qtzAd3BJh7UdbiXCrg6npWLYU0YpufsV9XlufKhMhYMJGJCdfX/G6+PNd0+v877X1JG5VmjBLUiFB0o8EUSicA==} engines: {node: '>=12'} cpu: [mips64el] os: [linux] @@ -2513,8 +2516,8 @@ packages: dev: true optional: true - /@esbuild/linux-ppc64@0.21.2: - resolution: {integrity: sha512-y0T4aV2CA+ic04ULya1A/8M2RDpDSK2ckgTj6jzHKFJvCq0jQg8afQQIn4EM0G8u2neyOiNHgSF9YKPfuqKOVw==} + /@esbuild/linux-ppc64@0.21.4: + resolution: {integrity: sha512-yB8AYzOTaL0D5+2a4xEy7OVvbcypvDR05MsB/VVPVA7nL4hc5w5Dyd/ddnayStDgJE59fAgNEOdLhBxjfx5+dg==} engines: {node: '>=12'} cpu: [ppc64] os: [linux] @@ -2539,8 +2542,8 @@ packages: dev: true optional: true - /@esbuild/linux-riscv64@0.21.2: - resolution: {integrity: sha512-x5ssCdXmZC86L2Li1qQPF/VaC4VP20u/Zm8jlAu9IiVOVi79YsSz6cpPDYZl1rfKSHYCJW9XBfFCo66S5gVPSA==} + /@esbuild/linux-riscv64@0.21.4: + resolution: {integrity: sha512-Y5AgOuVzPjQdgU59ramLoqSSiXddu7F3F+LI5hYy/d1UHN7K5oLzYBDZe23QmQJ9PIVUXwOdKJ/jZahPdxzm9w==} engines: {node: '>=12'} cpu: [riscv64] os: [linux] @@ -2565,8 +2568,8 @@ packages: dev: true optional: true - /@esbuild/linux-s390x@0.21.2: - resolution: {integrity: sha512-NP7fTpGSFWdXyvp8iAFU04uFh9ARoplFVM/m+8lTRpaYG+2ytHPZWyscSsMM6cvObSIK2KoPHXiZD4l99WaxbQ==} + /@esbuild/linux-s390x@0.21.4: + resolution: {integrity: sha512-Iqc/l/FFwtt8FoTK9riYv9zQNms7B8u+vAI/rxKuN10HgQIXaPzKZc479lZ0x6+vKVQbu55GdpYpeNWzjOhgbA==} engines: {node: '>=12'} cpu: [s390x] os: [linux] @@ -2591,8 +2594,8 @@ packages: dev: true optional: true - /@esbuild/linux-x64@0.21.2: - resolution: {integrity: sha512-giZ/uOxWDKda44ZuyfKbykeXznfuVNkTgXOUOPJIjbayJV6FRpQ4zxUy9JMBPLaK9IJcdWtaoeQrYBMh3Rr4vQ==} + /@esbuild/linux-x64@0.21.4: + resolution: {integrity: sha512-Td9jv782UMAFsuLZINfUpoF5mZIbAj+jv1YVtE58rFtfvoKRiKSkRGQfHTgKamLVT/fO7203bHa3wU122V/Bdg==} engines: {node: '>=12'} cpu: [x64] os: [linux] @@ -2617,8 +2620,8 @@ packages: dev: true optional: true - /@esbuild/netbsd-x64@0.21.2: - resolution: {integrity: sha512-IeFMfGFSQfIj1d4XU+6lkbFzMR+mFELUUVYrZ+jvWzG4NGvs6o53ReEHLHpYkjRbdEjJy2W3lTekTxrFHW7YJg==} + /@esbuild/netbsd-x64@0.21.4: + resolution: {integrity: sha512-Awn38oSXxsPMQxaV0Ipb7W/gxZtk5Tx3+W+rAPdZkyEhQ6968r9NvtkjhnhbEgWXYbgV+JEONJ6PcdBS+nlcpA==} engines: {node: '>=12'} cpu: [x64] os: [netbsd] @@ -2643,8 +2646,8 @@ packages: dev: true optional: true - /@esbuild/openbsd-x64@0.21.2: - resolution: {integrity: sha512-48QhWD6WxcebNNaE4FCwgvQVUnAycuTd+BdvA/oZu+/MmbpU8pY2dMEYlYzj5uNHWIG5jvdDmFXu0naQeOWUoA==} + /@esbuild/openbsd-x64@0.21.4: + resolution: {integrity: sha512-IsUmQeCY0aU374R82fxIPu6vkOybWIMc3hVGZ3ChRwL9hA1TwY+tS0lgFWV5+F1+1ssuvvXt3HFqe8roCip8Hg==} engines: {node: '>=12'} cpu: [x64] os: [openbsd] @@ -2669,8 +2672,8 @@ packages: dev: true optional: true - /@esbuild/sunos-x64@0.21.2: - resolution: {integrity: sha512-90r3nTBLgdIgD4FCVV9+cR6Hq2Dzs319icVsln+NTmTVwffWcCqXGml8rAoocHuJ85kZK36DCteii96ba/PX8g==} + /@esbuild/sunos-x64@0.21.4: + resolution: {integrity: sha512-hsKhgZ4teLUaDA6FG/QIu2q0rI6I36tZVfM4DBZv3BG0mkMIdEnMbhc4xwLvLJSS22uWmaVkFkqWgIS0gPIm+A==} engines: {node: '>=12'} cpu: [x64] os: [sunos] @@ -2695,8 +2698,8 @@ packages: dev: true optional: true - /@esbuild/win32-arm64@0.21.2: - resolution: {integrity: sha512-sNndlsBT8OeE/MZDSGpRDJlWuhjuUz/dn80nH0EP4ZzDUYvMDVa7G87DVpweBrn4xdJYyXS/y4CQNrf7R2ODXg==} + /@esbuild/win32-arm64@0.21.4: + resolution: {integrity: sha512-UUfMgMoXPoA/bvGUNfUBFLCh0gt9dxZYIx9W4rfJr7+hKe5jxxHmfOK8YSH4qsHLLN4Ck8JZ+v7Q5fIm1huErg==} engines: {node: '>=12'} cpu: [arm64] os: [win32] @@ -2721,8 +2724,8 @@ packages: dev: true optional: true - /@esbuild/win32-ia32@0.21.2: - resolution: {integrity: sha512-Ti2QChGNFzWhUNNVuU4w21YkYTErsNh3h+CzvlEhzgRbwsJ7TrWQqRzW3bllLKKvTppuF3DJ3XP1GEg11AfrEQ==} + /@esbuild/win32-ia32@0.21.4: + resolution: {integrity: sha512-yIxbspZb5kGCAHWm8dexALQ9en1IYDfErzjSEq1KzXFniHv019VT3mNtTK7t8qdy4TwT6QYHI9sEZabONHg+aw==} engines: {node: '>=12'} cpu: [ia32] os: [win32] @@ -2747,8 +2750,8 @@ packages: dev: true optional: true - /@esbuild/win32-x64@0.21.2: - resolution: {integrity: sha512-VEfTCZicoZnZ6sGkjFPGRFFJuL2fZn2bLhsekZl1CJslflp2cJS/VoKs1jMk+3pDfsGW6CfQVUckP707HwbXeQ==} + /@esbuild/win32-x64@0.21.4: + resolution: {integrity: sha512-sywLRD3UK/qRJt0oBwdpYLBibk7KiRfbswmWRDabuncQYSlf8aLEEUor/oP6KRz8KEG+HoiVLBhPRD5JWjS8Sg==} engines: {node: '>=12'} cpu: [x64] os: [win32] @@ -2803,10 +2806,10 @@ packages: engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0, npm: '>=6.14.13'} dev: true - /@fast-check/jest@1.8.1(@jest/globals@29.7.0): - resolution: {integrity: sha512-qKtH74n1IY56zrAd0hs3IZsODxi4VzRgfIJDxjruBV7lZZQjHt9jFKVi++ML5Fzwllfkz5sF3FtVkAxUow8tpg==} + /@fast-check/jest@1.8.2(@jest/globals@29.7.0): + resolution: {integrity: sha512-+UgQKZ0og0olUZXWgZ5Zcw42eN+3OB0Nfw0CU9OnlHBhHFnd8xppUYviX5HriAyUsAko1t/li5LZ9mSIIakmhg==} peerDependencies: - '@fast-check/worker': '>=0.0.7 <0.4.0' + '@fast-check/worker': '>=0.0.7 <0.5.0' '@jest/expect': '>=28.0.0' '@jest/globals': '>=25.5.2' peerDependenciesMeta: @@ -2849,33 +2852,33 @@ packages: resolution: {integrity: sha512-6EwiSjwWYP7pTckG6I5eyFANjPhmPjUX9JRLUSfNPC7FX7zK9gyZAfUEaECL6ALTpGX5AjnBq3C9XmVWPitNpw==} dev: true - /@inquirer/checkbox@2.3.2: - resolution: {integrity: sha512-lUXKA/5PhPBXz6SVDE+EbBmV3Wi3X77SPRet6Mc1pn6fSXAIivvu1OWpHDpVUxc+RiFflbrDjXUgLfCQeofrWg==} + /@inquirer/checkbox@2.3.4: + resolution: {integrity: sha512-e+V2YLwDqajiftVisDOu+lvinyGEihQu0X4Y1+jF8ZOMQj/Fufa0QVdk0QsF825kc0kvqDigdtSylETsFg3PKg==} engines: {node: '>=18'} dependencies: - '@inquirer/core': 8.1.0 - '@inquirer/figures': 1.0.1 - '@inquirer/type': 1.3.1 + '@inquirer/core': 8.2.1 + '@inquirer/figures': 1.0.2 + '@inquirer/type': 1.3.2 ansi-escapes: 4.3.2 chalk: 4.1.2 dev: true - /@inquirer/confirm@3.1.6: - resolution: {integrity: sha512-Mj4TU29g6Uy+37UtpA8UpEOI2icBfpCwSW1QDtfx60wRhUy90s/kHPif2OXSSvuwDQT1lhAYRWUfkNf9Tecxvg==} + /@inquirer/confirm@3.1.8: + resolution: {integrity: sha512-f3INZ+ca4dQdn+MQiq1yP/mOIR/Oc8BLRYuDh6ciToWd6z4W8yArfzjBCMQ0BPY8PcJKwZxGIt8Z6yNT32eSTw==} engines: {node: '>=18'} dependencies: - '@inquirer/core': 8.1.0 - '@inquirer/type': 1.3.1 + '@inquirer/core': 8.2.1 + '@inquirer/type': 1.3.2 dev: true - /@inquirer/core@8.1.0: - resolution: {integrity: sha512-kfx0SU9nWgGe1f03ao/uXc85SFH1v2w3vQVH7QDGjKxdtJz+7vPitFtG++BTyJMYyYgH8MpXigutcXJeiQwVRw==} + /@inquirer/core@8.2.1: + resolution: {integrity: sha512-TIcuQMn2qrtyYe0j136UpHeYpk7AcR/trKeT/7YY0vRgcS9YSfJuQ2+PudPhSofLLsHNnRYAHScQCcVZrJkMqA==} engines: {node: '>=18'} dependencies: - '@inquirer/figures': 1.0.1 - '@inquirer/type': 1.3.1 + '@inquirer/figures': 1.0.2 + '@inquirer/type': 1.3.2 '@types/mute-stream': 0.0.4 - '@types/node': 20.12.7 + '@types/node': 20.12.12 '@types/wrap-ansi': 3.0.0 ansi-escapes: 4.3.2 chalk: 4.1.2 @@ -2887,82 +2890,82 @@ packages: wrap-ansi: 6.2.0 dev: true - /@inquirer/editor@2.1.6: - resolution: {integrity: sha512-CWmp6XhfQye6xwH6/XV1HGvY95rUfzw7EXyNDHzj5s5Qr1t/X3t6c7uRkfK7OD91y+sbSy7aL6MJv2bbNrMoew==} + /@inquirer/editor@2.1.8: + resolution: {integrity: sha512-Ob9GdfiDCi9PJSF/tU7+bfbp2bVoFOPxI8Aosqh39TOum3FTyHzUDsZzSmi36KYNWHnmMH33t6bHxg1bBFTwng==} engines: {node: '>=18'} dependencies: - '@inquirer/core': 8.1.0 - '@inquirer/type': 1.3.1 + '@inquirer/core': 8.2.1 + '@inquirer/type': 1.3.2 external-editor: 3.1.0 dev: true - /@inquirer/expand@2.1.6: - resolution: {integrity: sha512-mFW/vU6mSut0UjmvxPdLC81Sz+5b4t7sMZeF7RlHki1PJkZVZIQoT91MCvoJJN2S7lDqSAV/TxeYqF41RNkY2g==} + /@inquirer/expand@2.1.8: + resolution: {integrity: sha512-dsWqz7cx6BAXrkxxvmKvSoDjB9FTueS7TJjRjTJDHVP335Ntfpha2ogp6+RC7iYpKyuUzFI2qedl+Mme9KmTjA==} engines: {node: '>=18'} dependencies: - '@inquirer/core': 8.1.0 - '@inquirer/type': 1.3.1 + '@inquirer/core': 8.2.1 + '@inquirer/type': 1.3.2 chalk: 4.1.2 dev: true - /@inquirer/figures@1.0.1: - resolution: {integrity: sha512-mtup3wVKia3ZwULPHcbs4Mor8Voi+iIXEWD7wCNbIO6lYR62oPCTQyrddi5OMYVXHzeCSoneZwJuS8sBvlEwDw==} + /@inquirer/figures@1.0.2: + resolution: {integrity: sha512-4F1MBwVr3c/m4bAUef6LgkvBfSjzwH+OfldgHqcuacWwSUetFebM2wi58WfG9uk1rR98U6GwLed4asLJbwdV5w==} engines: {node: '>=18'} dev: true - /@inquirer/input@2.1.6: - resolution: {integrity: sha512-M8bUFOlcn/kQcVYskl4kkB6dYrHtymJJ1S4nSg/khXT3W3l71u2qhSzfo6PdBG3jUe6ILJZ0gUh4Kef2uJ5pxw==} + /@inquirer/input@2.1.8: + resolution: {integrity: sha512-W1hsmUArJRGI8kL8+Kl+9wgnm02xPbpKtSIlwoHtRfIn8f/b/9spfNuTWolCVDHh3ZA4LS+Et71d1P6UpdD20A==} engines: {node: '>=18'} dependencies: - '@inquirer/core': 8.1.0 - '@inquirer/type': 1.3.1 + '@inquirer/core': 8.2.1 + '@inquirer/type': 1.3.2 dev: true - /@inquirer/password@2.1.6: - resolution: {integrity: sha512-fkiTIijBRxotoMw0/ljA2BaSsz6PlGoiav9QyAjBXCZoyFsYoItstDKvJXbWwS9NrN42fXYvXn1ljBpldnJaeA==} + /@inquirer/password@2.1.8: + resolution: {integrity: sha512-uBN1Hxq9igMtlUDHxCssJ4wWEksCwSJmK1mGr8A0V1co+ZBWPZ3cTN21MhyMc7VxIA/e7cG9/D2Qwzso64MCng==} engines: {node: '>=18'} dependencies: - '@inquirer/core': 8.1.0 - '@inquirer/type': 1.3.1 + '@inquirer/core': 8.2.1 + '@inquirer/type': 1.3.2 ansi-escapes: 4.3.2 dev: true - /@inquirer/prompts@5.0.2: - resolution: {integrity: sha512-3OC7tyqa5E1I5Isnua9xfV8TO7y/n5jnNhGLAG8BLBtCu4jCftDewSdfjFJR0ld77trqjPP2udLxv0RbggJn9w==} + /@inquirer/prompts@5.0.4: + resolution: {integrity: sha512-J7gaXH0UoYJbVzoL+1oTXmV1lzIIR5RTGvLTUED0NcVc/B/DA1dvDl7Yz5VvWt9DpIVk0TdxlrgtazbiV3xBjw==} engines: {node: '>=18'} dependencies: - '@inquirer/checkbox': 2.3.2 - '@inquirer/confirm': 3.1.6 - '@inquirer/editor': 2.1.6 - '@inquirer/expand': 2.1.6 - '@inquirer/input': 2.1.6 - '@inquirer/password': 2.1.6 - '@inquirer/rawlist': 2.1.6 - '@inquirer/select': 2.3.2 + '@inquirer/checkbox': 2.3.4 + '@inquirer/confirm': 3.1.8 + '@inquirer/editor': 2.1.8 + '@inquirer/expand': 2.1.8 + '@inquirer/input': 2.1.8 + '@inquirer/password': 2.1.8 + '@inquirer/rawlist': 2.1.8 + '@inquirer/select': 2.3.4 dev: true - /@inquirer/rawlist@2.1.6: - resolution: {integrity: sha512-xnGBfjatdUqyBMqHi1kHHBh4ggQGZz42vYH0kFdQDnOtx4Ouo7baqVZhBRuQfZTL8tAXuOYI9X6r6BXBl8cnqw==} + /@inquirer/rawlist@2.1.8: + resolution: {integrity: sha512-h1NfMVcgR8MC7ckpk2UQsxh2+411iexj5GOFA1Ys9rg//l0N9XAZJQ+FDrza9cxOmf57MZFkJ/WE13Bp8z8IIQ==} engines: {node: '>=18'} dependencies: - '@inquirer/core': 8.1.0 - '@inquirer/type': 1.3.1 + '@inquirer/core': 8.2.1 + '@inquirer/type': 1.3.2 chalk: 4.1.2 dev: true - /@inquirer/select@2.3.2: - resolution: {integrity: sha512-VzLHVpaobBpI3o/CWSG2sCDqrjHZEYAfT1bowbR8Q72fEi0WfBO3Fnh595QqBit9kQhI1uJbVHaaovg1I7eE7Q==} + /@inquirer/select@2.3.4: + resolution: {integrity: sha512-y9HGzHfPPh60QciH7WiKtjtWjgU24jrIsfJnq4Zqmu8k4HVVQPBXxiKKzwzJyJWwdWZcWATm4VDDWGFEjVHvGA==} engines: {node: '>=18'} dependencies: - '@inquirer/core': 8.1.0 - '@inquirer/figures': 1.0.1 - '@inquirer/type': 1.3.1 + '@inquirer/core': 8.2.1 + '@inquirer/figures': 1.0.2 + '@inquirer/type': 1.3.2 ansi-escapes: 4.3.2 chalk: 4.1.2 dev: true - /@inquirer/type@1.3.1: - resolution: {integrity: sha512-Pe3PFccjPVJV1vtlfVvm9OnlbxqdnP5QcscFEFEnK5quChf1ufZtM0r8mR5ToWHMxZOh0s8o/qp9ANGRTo/DAw==} + /@inquirer/type@1.3.2: + resolution: {integrity: sha512-5Frickan9c89QbPkSu6I6y8p+9eR6hZkdPahGmNDsTFX8FHLPAozyzCZMKUeW8FyYwnlCKUjqIEqxY+UctARiw==} engines: {node: '>=18'} dev: true @@ -3183,7 +3186,7 @@ packages: jest-haste-map: 29.7.0 jest-regex-util: 29.6.3 jest-util: 29.7.0 - micromatch: 4.0.5 + micromatch: 4.0.6 pirates: 4.0.6 slash: 3.0.0 write-file-atomic: 4.0.2 @@ -3287,10 +3290,10 @@ packages: tslib: 2.6.2 dev: true - /@libsql/client@0.6.0: - resolution: {integrity: sha512-qhQzTG/y2IEVbL3+9PULDvlQFWJ/RnjFXECr/Nc3nRngGiiMysDaOV5VUzYk7DulUX98EA4wi+z3FspKrUplUA==} + /@libsql/client@0.6.1: + resolution: {integrity: sha512-j32pZMzsuKJ8bWi0rtlszrexXV7mXSxoSA/2C6DfIL7kelI7SHsFgscrQD3wHBJVguitwMklWBe2EuMMRW0img==} dependencies: - '@libsql/core': 0.6.0 + '@libsql/core': 0.6.1 '@libsql/hrana-client': 0.6.0 js-base64: 3.7.5 libsql: 0.3.10 @@ -3298,8 +3301,8 @@ packages: - bufferutil - utf-8-validate - /@libsql/core@0.6.0: - resolution: {integrity: sha512-affAB8vSqQwqI9NBDJ5uJCVaHoOAS2pOpbv1kWConh1SBbmJBnHHd4KG73RAJ2sgd2+NbT9WA+XJBqxgp28YSw==} + /@libsql/core@0.6.1: + resolution: {integrity: sha512-xVV7w4iQcWgkhvmcJ6RZQdImlNvJGIW4Tlx1KJVWh6+l1sdAAz8hNXEXO04rYGAg6oeIXZF1j1E/AW1mwomO1g==} dependencies: js-base64: 3.7.5 @@ -3386,34 +3389,34 @@ packages: nopt: 5.0.0 npmlog: 5.0.1 rimraf: 3.0.2 - semver: 7.6.1 + semver: 7.6.2 tar: 6.1.14 transitivePeerDependencies: - encoding - supports-color dev: true - /@microsoft/api-extractor-model@7.28.15(@types/node@20.12.7): - resolution: {integrity: sha512-kAFX0c1+N+2WpZaiksy8H4RZ1sytJb2ZFVEmil5Rt6IK8UExU80f0/4kegXIs1KF8a/YyRW0Pybc7svlT9j/wQ==} + /@microsoft/api-extractor-model@7.29.2(@types/node@20.12.7): + resolution: {integrity: sha512-hAYajOjQan3uslhKJRwvvHIdLJ+ZByKqdSsJ/dgHFxPtEbdKpzMDO8zuW4K5gkSMYl5D0LbNwxkhxr51P2zsmw==} dependencies: - '@microsoft/tsdoc': 0.14.2 - '@microsoft/tsdoc-config': 0.16.2 - '@rushstack/node-core-library': 4.2.0(@types/node@20.12.7) + '@microsoft/tsdoc': 0.15.0 + '@microsoft/tsdoc-config': 0.17.0 + '@rushstack/node-core-library': 5.4.1(@types/node@20.12.7) transitivePeerDependencies: - '@types/node' dev: true - /@microsoft/api-extractor@7.43.2(@types/node@20.12.7): - resolution: {integrity: sha512-5bVGdT/fHTDnBk6XPrw4I/U54LIvEeicOOTcyMtBWq387fad+m6tRk2cP/Lg9bz8+/gJgEkTVhpI8FXV4d79Ng==} + /@microsoft/api-extractor@7.46.2(@types/node@20.12.7): + resolution: {integrity: sha512-s3HjYoXKMVNmYO5rQl+z7MpRngGg9OugWgmGMIBlAeOaE0Lk7/CKX+UYt7Mk9pihV8DZWg/qCf+4Yega9IZMmQ==} hasBin: true dependencies: - '@microsoft/api-extractor-model': 7.28.15(@types/node@20.12.7) - '@microsoft/tsdoc': 0.14.2 - '@microsoft/tsdoc-config': 0.16.2 - '@rushstack/node-core-library': 4.2.0(@types/node@20.12.7) + '@microsoft/api-extractor-model': 7.29.2(@types/node@20.12.7) + '@microsoft/tsdoc': 0.15.0 + '@microsoft/tsdoc-config': 0.17.0 + '@rushstack/node-core-library': 5.4.1(@types/node@20.12.7) '@rushstack/rig-package': 0.5.2 - '@rushstack/terminal': 0.10.2(@types/node@20.12.7) - '@rushstack/ts-command-line': 4.19.3(@types/node@20.12.7) + '@rushstack/terminal': 0.13.0(@types/node@20.12.7) + '@rushstack/ts-command-line': 4.22.0(@types/node@20.12.7) lodash: 4.17.21 minimatch: 3.0.8 resolve: 1.22.8 @@ -3424,17 +3427,17 @@ packages: - '@types/node' dev: true - /@microsoft/tsdoc-config@0.16.2: - resolution: {integrity: sha512-OGiIzzoBLgWWR0UdRJX98oYO+XKGf7tiK4Zk6tQ/E4IJqGCe7dvkTvgDZV5cFJUzLGDOjeAXrnZoA6QkVySuxw==} + /@microsoft/tsdoc-config@0.17.0: + resolution: {integrity: sha512-v/EYRXnCAIHxOHW+Plb6OWuUoMotxTN0GLatnpOb1xq0KuTNw/WI3pamJx/UbsoJP5k9MCw1QxvvhPcF9pH3Zg==} dependencies: - '@microsoft/tsdoc': 0.14.2 - ajv: 6.12.6 + '@microsoft/tsdoc': 0.15.0 + ajv: 8.12.0 jju: 1.4.0 - resolve: 1.19.0 + resolve: 1.22.8 dev: true - /@microsoft/tsdoc@0.14.2: - resolution: {integrity: sha512-9b8mPpKrfeGRuhFH5iO1iwCLeIIsV6+H1sRfxbkoGXIyQE2BTsPd9zqSqQJ+pv5sJ/hT5M1zvOFL02MnEezFug==} + /@microsoft/tsdoc@0.15.0: + resolution: {integrity: sha512-HZpPoABogPvjeJOdzCOSJsXeL/SMCBgBZMVC3X3d7YYp2gf31MfxhUoYUNwf1ERPJOnQc0wkFn9trqI6ZEdZuA==} dev: true /@mongodb-js/saslprep@1.1.5: @@ -3447,17 +3450,10 @@ packages: resolution: {integrity: sha512-kTPhdZyTQxB+2wpiRcFWrDcejc4JI6tkPuS7UZCG4l6Zvc5kU/gGQ/ozvHTh1XR5tS+UlfAfGuPajjzQjCiHCw==} requiresBuild: true - /@neondatabase/serverless@0.9.1: - resolution: {integrity: sha512-Xi+tVIXuaeB24BHzhr0W/4vcbb9WwIaB6yK0RsMIteLtzNB86+am6EDFovd3rYCYM1ea7rWcwte2dLOrzW7eqA==} - dependencies: - '@types/pg': 8.6.6 - dev: true - /@neondatabase/serverless@0.9.3: resolution: {integrity: sha512-6ZBK8asl2Z3+ADEaELvbaVVGVlmY1oAzkxxZfpmXPKFuJhbDN+5fU3zYBamsahS/Ch1zE+CVWB3R+8QEI2LMSw==} dependencies: '@types/pg': 8.11.6 - dev: false /@nodelib/fs.scandir@2.1.5: resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} @@ -3485,7 +3481,7 @@ packages: requiresBuild: true dependencies: '@gar/promisify': 1.1.3 - semver: 7.6.1 + semver: 7.6.2 dev: true optional: true @@ -3599,8 +3595,8 @@ packages: resolution: {integrity: sha512-t2XdOfrVgcF7AW791FtdPS27NyNqcE1SpoXgk3HpziousvUMsJi4Q6NL3JyOBpsMOrvk94749o8yyonvX5quPw==} engines: {node: '>=16'} - /@prisma/engines-version@5.15.0-7.0af42cb19116c37b029e1f3665681074acb38bb4: - resolution: {integrity: sha512-GRE52hhq2jjEpPwNkUq30AENn7LfJEtcxhjE2APGY73NdHG5dvoSKSCA/2qvbFXJ3YPnhg2B7zXyqF7MSjijng==} + /@prisma/engines-version@5.15.0-24.9ee43833e58f4ec014ce0f45b6ae27ee7e0165fc: + resolution: {integrity: sha512-RVZEOeNAXBV4n/rkoD6HcBBoq6BKTGy88+BxrXvrQ0525CnPSBP3y156rMllAKBmmuZA2lDP6g5c4MDDEoPNLQ==} /@prisma/mini-proxy@0.9.5: resolution: {integrity: sha512-0MLaxUjGbZGJGx9fIy1kbAH65hcZHCP6yes8xCTVcWumo64uzAxuvZdf5l1EPCZrDnj+iZNAy0U364oOAN+gXQ==} @@ -3608,12 +3604,12 @@ packages: hasBin: true dev: true - /@prisma/prisma-schema-wasm@5.15.0-7.0af42cb19116c37b029e1f3665681074acb38bb4: - resolution: {integrity: sha512-HG4+qQHNo9a3JFf801jEkvruKpB2HjQbR8yKgd4vGluevOIOzNMEmLAXxx5V3JpyyHZxsTFQdz4XakqBdJIIug==} + /@prisma/prisma-schema-wasm@5.15.0-24.9ee43833e58f4ec014ce0f45b6ae27ee7e0165fc: + resolution: {integrity: sha512-YnSoS4355Hx6S4LV4GuYrrVUDH2wzRhV8QivuSyixy0RX5dcD6rFrITFU02k1FB/nVXk8jHA6T0uHK+Qq2Tiww==} dev: false - /@prisma/query-engine-wasm@5.15.0-7.0af42cb19116c37b029e1f3665681074acb38bb4: - resolution: {integrity: sha512-B2Icd8w5uQ5vUFpvqGGLVFnjh2i/tWBcrXqPso8D0riH3Dp+qIZPpVT1t1TCozuo+7xazzB38u4yHquWmEelug==} + /@prisma/query-engine-wasm@5.15.0-24.9ee43833e58f4ec014ce0f45b6ae27ee7e0165fc: + resolution: {integrity: sha512-/0D7hrsIFWPqdtN3BE7A5DZY3dxlgFKPj+Zlk1uwOYKiPuFxYJO1VLL2v4aTqG281Q8D01yqURjIAlDbuBK0Ag==} dev: true /@prisma/studio-common@0.500.0: @@ -3663,8 +3659,8 @@ packages: resolution: {integrity: sha512-86kZ00QhvGud8jIQoOGOriwa6kDIMRj5JG6rW88unallBe7t+KbcSb/JmO5F8PIKj5m8VWnJ3xtAmkVFOeiLsQ==} dev: true - /@rushstack/node-core-library@4.2.0(@types/node@20.12.7): - resolution: {integrity: sha512-y2+m9bbkl1Xe5pt+8gouzRXtXoA2r7B2xkGDT4lpSCpiAU7HNHmhmqxOz+vTmoCamuTj1zqQbgyuoZ1z9cGdag==} + /@rushstack/node-core-library@5.4.1(@types/node@20.12.7): + resolution: {integrity: sha512-WNnwdS8r9NZ/2K3u29tNoSRldscFa7SxU0RT+82B6Dy2I4Hl2MeCSKm4EXLXPKeNzLGvJ1cqbUhTLviSF8E6iA==} peerDependencies: '@types/node': '*' peerDependenciesMeta: @@ -3672,12 +3668,14 @@ packages: optional: true dependencies: '@types/node': 20.12.7 + ajv: 8.13.0 + ajv-draft-04: 1.0.0(ajv@8.13.0) + ajv-formats: 3.0.1 fs-extra: 7.0.1 import-lazy: 4.0.0 jju: 1.4.0 resolve: 1.22.8 semver: 7.5.4 - z-schema: 5.0.5 dev: true /@rushstack/rig-package@0.5.2: @@ -3687,23 +3685,23 @@ packages: strip-json-comments: 3.1.1 dev: true - /@rushstack/terminal@0.10.2(@types/node@20.12.7): - resolution: {integrity: sha512-oMN4uoz6WUeLR9yWHSR4gEEii+8vjIJXPLp7U0k6zccgmOCJXYPKBK30FGpWfDRmqrcCIJi828SKV9V5FB1a0Q==} + /@rushstack/terminal@0.13.0(@types/node@20.12.7): + resolution: {integrity: sha512-Ou44Q2s81BqJu3dpYedAX54am9vn245F0HzqVrfJCMQk5pGgoKKOBOjkbfZC9QKcGNaECh6pwH2s5noJt7X6ew==} peerDependencies: '@types/node': '*' peerDependenciesMeta: '@types/node': optional: true dependencies: - '@rushstack/node-core-library': 4.2.0(@types/node@20.12.7) + '@rushstack/node-core-library': 5.4.1(@types/node@20.12.7) '@types/node': 20.12.7 supports-color: 8.1.1 dev: true - /@rushstack/ts-command-line@4.19.3(@types/node@20.12.7): - resolution: {integrity: sha512-gWJPWIlr1VC2byK3ZfXMoPLCNT6fFk4qXAb2x2deVRJpq/LQh03galWqissit8QCOS7mOJPyM42uWmT8f4MKRg==} + /@rushstack/ts-command-line@4.22.0(@types/node@20.12.7): + resolution: {integrity: sha512-Qj28t6MO3HRgAZ72FDeFsrpdE6wBWxF3VENgvrXh7JF2qIT+CrXiOJIesW80VFZB9QwObSpkB1ilx794fGQg6g==} dependencies: - '@rushstack/terminal': 0.10.2(@types/node@20.12.7) + '@rushstack/terminal': 0.13.0(@types/node@20.12.7) '@types/argparse': 1.0.38 argparse: 1.0.10 string-argv: 0.3.2 @@ -3777,25 +3775,25 @@ packages: uuid: 8.3.2 dev: true - /@swc-node/core@1.13.1(@swc/core@1.5.3): + /@swc-node/core@1.13.1(@swc/core@1.5.7): resolution: {integrity: sha512-emB5l2nZsXjUEAuusqjYvWnQMLWZp6K039Mv8aq5SX1rsNM/N7DNhw1i4/DX7AyzNZ0tT+ASWyTvqEURldp5HA==} engines: {node: '>= 10'} peerDependencies: '@swc/core': '>= 1.4.13' '@swc/types': '>= 0.1' dependencies: - '@swc/core': 1.5.3 + '@swc/core': 1.5.7 dev: true - /@swc-node/register@1.9.1(@swc/core@1.5.3)(typescript@5.4.5): + /@swc-node/register@1.9.1(@swc/core@1.5.7)(typescript@5.4.5): resolution: {integrity: sha512-z//TBXJdRWXoISCXlQmVz+NMm8Qm/UvcfKiGC0tSJdfeVYf5EZkGqvk2OiRH4SIJ6OGFfS9T0YrvA2pDKzWtPA==} peerDependencies: '@swc/core': '>= 1.4.13' typescript: '>= 4.3' dependencies: - '@swc-node/core': 1.13.1(@swc/core@1.5.3) + '@swc-node/core': 1.13.1(@swc/core@1.5.7) '@swc-node/sourcemap-support': 0.5.0 - '@swc/core': 1.5.3 + '@swc/core': 1.5.7 colorette: 2.0.20 debug: 4.3.4 pirates: 4.0.6 @@ -3840,8 +3838,8 @@ packages: dev: true optional: true - /@swc/core-darwin-arm64@1.5.3: - resolution: {integrity: sha512-kRmmV2XqWegzGXvJfVVOj10OXhLgaVOOBjaX3p3Aqg7Do5ksg+bY5wi1gAN/Eul7B08Oqf7GG7WJevjDQGWPOg==} + /@swc/core-darwin-arm64@1.5.7: + resolution: {integrity: sha512-bZLVHPTpH3h6yhwVl395k0Mtx8v6CGhq5r4KQdAoPbADU974Mauz1b6ViHAJ74O0IVE5vyy7tD3OpkQxL/vMDQ==} engines: {node: '>=10'} cpu: [arm64] os: [darwin] @@ -3858,8 +3856,8 @@ packages: dev: true optional: true - /@swc/core-darwin-x64@1.5.3: - resolution: {integrity: sha512-EYs0+ovaRw6ZN9GBr2nIeC7gUXWA0q4RYR+Og3Vo0Qgv2Mt/XudF44A2lPK9X7M3JIfu6JjnxnTuvsK1Lqojfw==} + /@swc/core-darwin-x64@1.5.7: + resolution: {integrity: sha512-RpUyu2GsviwTc2qVajPL0l8nf2vKj5wzO3WkLSHAHEJbiUZk83NJrZd1RVbEknIMO7+Uyjh54hEh8R26jSByaw==} engines: {node: '>=10'} cpu: [x64] os: [darwin] @@ -3885,8 +3883,8 @@ packages: dev: true optional: true - /@swc/core-linux-arm-gnueabihf@1.5.3: - resolution: {integrity: sha512-RBVUTidSf4wgPdv98VrgJ4rMzMDN/3LBWdT7l+R7mNFH+mtID7ZAhTON0o/m1HkECgAgi1xcbTOVAw1xgd5KLA==} + /@swc/core-linux-arm-gnueabihf@1.5.7: + resolution: {integrity: sha512-cTZWTnCXLABOuvWiv6nQQM0hP6ZWEkzdgDvztgHI/+u/MvtzJBN5lBQ2lue/9sSFYLMqzqff5EHKlFtrJCA9dQ==} engines: {node: '>=10'} cpu: [arm] os: [linux] @@ -3903,8 +3901,8 @@ packages: dev: true optional: true - /@swc/core-linux-arm64-gnu@1.5.3: - resolution: {integrity: sha512-DCC6El3MiTYfv98CShxz/g2s4Pxn6tV0mldCQ0UdRqaN2ApUn7E+zTrqaj5bk7yII3A43WhE9Mr6wNPbXUeVyg==} + /@swc/core-linux-arm64-gnu@1.5.7: + resolution: {integrity: sha512-hoeTJFBiE/IJP30Be7djWF8Q5KVgkbDtjySmvYLg9P94bHg9TJPSQoC72tXx/oXOgXvElDe/GMybru0UxhKx4g==} engines: {node: '>=10'} cpu: [arm64] os: [linux] @@ -3921,8 +3919,8 @@ packages: dev: true optional: true - /@swc/core-linux-arm64-musl@1.5.3: - resolution: {integrity: sha512-p04ysjYXEyaCGpJvwHm0T0nkPawXtdKBTThWnlh8M5jYULVNVA1YmC9azG2Avs1GDaLgBPVUgodmFYpdSupOYA==} + /@swc/core-linux-arm64-musl@1.5.7: + resolution: {integrity: sha512-+NDhK+IFTiVK1/o7EXdCeF2hEzCiaRSrb9zD7X2Z7inwWlxAntcSuzZW7Y6BRqGQH89KA91qYgwbnjgTQ22PiQ==} engines: {node: '>=10'} cpu: [arm64] os: [linux] @@ -3939,8 +3937,8 @@ packages: dev: true optional: true - /@swc/core-linux-x64-gnu@1.5.3: - resolution: {integrity: sha512-/l4KJu0xwYm6tcVSOvF8RbXrIeIHJAhWnKvuX4ZnYKFkON968kB8Ghx+1yqBQcZf36tMzSuZUC5xBUA9u66lGA==} + /@swc/core-linux-x64-gnu@1.5.7: + resolution: {integrity: sha512-25GXpJmeFxKB+7pbY7YQLhWWjkYlR+kHz5I3j9WRl3Lp4v4UD67OGXwPe+DIcHqcouA1fhLhsgHJWtsaNOMBNg==} engines: {node: '>=10'} cpu: [x64] os: [linux] @@ -3957,8 +3955,8 @@ packages: dev: true optional: true - /@swc/core-linux-x64-musl@1.5.3: - resolution: {integrity: sha512-54DmSnrTXq4fYEKNR0nFAImG3+FxsHlQ6Tol/v3l+rxmg2K0FeeDOpH7wTXeWhMGhFlGrLIyLSnA+SzabfoDIA==} + /@swc/core-linux-x64-musl@1.5.7: + resolution: {integrity: sha512-0VN9Y5EAPBESmSPPsCJzplZHV26akC0sIgd3Hc/7S/1GkSMoeuVL+V9vt+F/cCuzr4VidzSkqftdP3qEIsXSpg==} engines: {node: '>=10'} cpu: [x64] os: [linux] @@ -3975,8 +3973,8 @@ packages: dev: true optional: true - /@swc/core-win32-arm64-msvc@1.5.3: - resolution: {integrity: sha512-piUMqoHNwDXChBfaaFIMzYgoxepfd8Ci1uXXNVEnuiRKz3FiIcNLmvXaBD7lKUwKcnGgVziH/CrndX6SldKQNQ==} + /@swc/core-win32-arm64-msvc@1.5.7: + resolution: {integrity: sha512-RtoNnstBwy5VloNCvmvYNApkTmuCe4sNcoYWpmY7C1+bPR+6SOo8im1G6/FpNem8AR5fcZCmXHWQ+EUmRWJyuA==} engines: {node: '>=10'} cpu: [arm64] os: [win32] @@ -3993,8 +3991,8 @@ packages: dev: true optional: true - /@swc/core-win32-ia32-msvc@1.5.3: - resolution: {integrity: sha512-zV5utPYBUzYhBOomCByAjKAvfVBcOCJtnszx7Zlfz7SAv/cGm8D1QzPDCvv6jDhIlUtLj6KyL8JXeFr+f95Fjw==} + /@swc/core-win32-ia32-msvc@1.5.7: + resolution: {integrity: sha512-Xm0TfvcmmspvQg1s4+USL3x8D+YPAfX2JHygvxAnCJ0EHun8cm2zvfNBcsTlnwYb0ybFWXXY129aq1wgFC9TpQ==} engines: {node: '>=10'} cpu: [ia32] os: [win32] @@ -4011,8 +4009,8 @@ packages: dev: true optional: true - /@swc/core-win32-x64-msvc@1.5.3: - resolution: {integrity: sha512-QmUiXiPIV5gBADfDh8e2jKynEhyRC+dcKP/zF9y5KqDUErYzlhocLd68uYS4uIegP6AylYlmigHgcaktGEE9VQ==} + /@swc/core-win32-x64-msvc@1.5.7: + resolution: {integrity: sha512-tp43WfJLCsKLQKBmjmY/0vv1slVywR5Q4qKjF5OIY8QijaEW7/8VwPyUyVoJZEnDgv9jKtUTG5PzqtIYPZGnyg==} engines: {node: '>=10'} cpu: [x64] os: [win32] @@ -4040,8 +4038,8 @@ packages: '@swc/core-win32-x64-msvc': 1.2.204 dev: true - /@swc/core@1.5.3: - resolution: {integrity: sha512-pSEglypnBGLHBoBcv3aYS7IM2t2LRinubYMyP88UoFIcD2pear2CeB15CbjJ2IzuvERD0ZL/bthM7cDSR9g+aQ==} + /@swc/core@1.5.7: + resolution: {integrity: sha512-U4qJRBefIJNJDRCCiVtkfa/hpiZ7w0R6kASea+/KLp+vkus3zcLSB8Ub8SvKgTIxjWpwsKcZlPf5nrv4ls46SQ==} engines: {node: '>=10'} requiresBuild: true peerDependencies: @@ -4051,18 +4049,18 @@ packages: optional: true dependencies: '@swc/counter': 0.1.3 - '@swc/types': 0.1.5 + '@swc/types': 0.1.7 optionalDependencies: - '@swc/core-darwin-arm64': 1.5.3 - '@swc/core-darwin-x64': 1.5.3 - '@swc/core-linux-arm-gnueabihf': 1.5.3 - '@swc/core-linux-arm64-gnu': 1.5.3 - '@swc/core-linux-arm64-musl': 1.5.3 - '@swc/core-linux-x64-gnu': 1.5.3 - '@swc/core-linux-x64-musl': 1.5.3 - '@swc/core-win32-arm64-msvc': 1.5.3 - '@swc/core-win32-ia32-msvc': 1.5.3 - '@swc/core-win32-x64-msvc': 1.5.3 + '@swc/core-darwin-arm64': 1.5.7 + '@swc/core-darwin-x64': 1.5.7 + '@swc/core-linux-arm-gnueabihf': 1.5.7 + '@swc/core-linux-arm64-gnu': 1.5.7 + '@swc/core-linux-arm64-musl': 1.5.7 + '@swc/core-linux-x64-gnu': 1.5.7 + '@swc/core-linux-x64-musl': 1.5.7 + '@swc/core-win32-arm64-msvc': 1.5.7 + '@swc/core-win32-ia32-msvc': 1.5.7 + '@swc/core-win32-x64-msvc': 1.5.7 dev: true /@swc/counter@0.1.3: @@ -4081,20 +4079,22 @@ packages: jsonc-parser: 3.2.0 dev: true - /@swc/jest@0.2.36(@swc/core@1.5.3): + /@swc/jest@0.2.36(@swc/core@1.5.7): resolution: {integrity: sha512-8X80dp81ugxs4a11z1ka43FPhP+/e+mJNXJSxiNYk8gIX/jPBtY4gQTrKu/KIoco8bzKuPI5lUxjfLiGsfvnlw==} engines: {npm: '>= 7.0.0'} peerDependencies: '@swc/core': '*' dependencies: '@jest/create-cache-key-function': 29.7.0 - '@swc/core': 1.5.3 + '@swc/core': 1.5.7 '@swc/counter': 0.1.3 jsonc-parser: 3.2.0 dev: true - /@swc/types@0.1.5: - resolution: {integrity: sha512-myfUej5naTBWnqOCc/MdVOLVjXUXtIA+NpDrDBKJtLLg2shUjBu3cZmB/85RyitKc55+lUUyl7oRfLOvkr2hsw==} + /@swc/types@0.1.7: + resolution: {integrity: sha512-scHWahbHF0eyj3JsxG9CFJgFdFNaVQCNAimBlT6PzS3n/HptxqREjsm4OH6AN3lYcffZYSPxXW8ua2BEHp0lJQ==} + dependencies: + '@swc/counter': 0.1.3 dev: true /@tediousjs/connection-string@0.5.0: @@ -4329,6 +4329,12 @@ packages: undici-types: 5.26.5 dev: true + /@types/node@20.12.12: + resolution: {integrity: sha512-eWLDGF/FOSPtAvEqeRAQ4C8LSA7M1I7i0ky1I8U7kD1J5ITyW3AsRhQrKVoWf5pFKZ2kILsEGJhsI9r93PYnOw==} + dependencies: + undici-types: 5.26.5 + dev: true + /@types/node@20.12.7: resolution: {integrity: sha512-wq0cICSkRLVaf3UGLMGItu/PtdY7oaXaI/RVU+xliKVOtRna3PRY57ZDfztpDL0n11vfymMUnXv8QwYCO7L1wg==} dependencies: @@ -4338,28 +4344,12 @@ packages: resolution: {integrity: sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA==} dev: true - /@types/pg@8.11.5: - resolution: {integrity: sha512-2xMjVviMxneZHDHX5p5S6tsRRs7TpDHeeK7kTTMe/kAC/mRRNjWHjZg0rkiY+e17jXSZV3zJYDxXV8Cy72/Vuw==} - dependencies: - '@types/node': 20.12.7 - pg-protocol: 1.6.1 - pg-types: 4.0.2 - /@types/pg@8.11.6: resolution: {integrity: sha512-/2WmmBXHLsfRqzfHW7BNZ8SbYzE8OSk7i3WjFYvfgRHj7S1xj+16Je5fUKv3lVdVzk/zn9TXOqf+avFCFIE0yQ==} dependencies: '@types/node': 20.12.7 pg-protocol: 1.6.1 pg-types: 4.0.2 - dev: false - - /@types/pg@8.6.6: - resolution: {integrity: sha512-O2xNmXebtwVekJDD+02udOncjVcMZQuTEQEMpKJ0ZRf5E7/9JJX3izhKUcUifBkyKpljyUM6BTgy2trmviKlpw==} - dependencies: - '@types/node': 20.12.7 - pg-protocol: 1.6.1 - pg-types: 2.2.0 - dev: true /@types/progress@2.0.7: resolution: {integrity: sha512-iadjw02vte8qWx7U0YM++EybBha2CQLPGu9iJ97whVgJUT5Zq9MjAPYUnbfRI2Kpehimf1QjFJYxD0t8nqzu5w==} @@ -4451,8 +4441,8 @@ packages: '@types/yargs-parser': 21.0.0 dev: true - /@typescript-eslint/eslint-plugin@7.9.0(@typescript-eslint/parser@7.9.0)(eslint@8.57.0)(typescript@5.4.5): - resolution: {integrity: sha512-6e+X0X3sFe/G/54aC3jt0txuMTURqLyekmEHViqyA2VnxhLMpvA6nqmcjIy+Cr9tLDHPssA74BP5Mx9HQIxBEA==} + /@typescript-eslint/eslint-plugin@7.11.0(@typescript-eslint/parser@7.11.0)(eslint@8.57.0)(typescript@5.4.5): + resolution: {integrity: sha512-P+qEahbgeHW4JQ/87FuItjBj8O3MYv5gELDzr8QaQ7fsll1gSMTYb6j87MYyxwf3DtD7uGFB9ShwgmCJB5KmaQ==} engines: {node: ^18.18.0 || >=20.0.0} peerDependencies: '@typescript-eslint/parser': ^7.0.0 @@ -4463,11 +4453,11 @@ packages: optional: true dependencies: '@eslint-community/regexpp': 4.10.0 - '@typescript-eslint/parser': 7.9.0(eslint@8.57.0)(typescript@5.4.5) - '@typescript-eslint/scope-manager': 7.9.0 - '@typescript-eslint/type-utils': 7.9.0(eslint@8.57.0)(typescript@5.4.5) - '@typescript-eslint/utils': 7.9.0(eslint@8.57.0)(typescript@5.4.5) - '@typescript-eslint/visitor-keys': 7.9.0 + '@typescript-eslint/parser': 7.11.0(eslint@8.57.0)(typescript@5.4.5) + '@typescript-eslint/scope-manager': 7.11.0 + '@typescript-eslint/type-utils': 7.11.0(eslint@8.57.0)(typescript@5.4.5) + '@typescript-eslint/utils': 7.11.0(eslint@8.57.0)(typescript@5.4.5) + '@typescript-eslint/visitor-keys': 7.11.0 eslint: 8.57.0 graphemer: 1.4.0 ignore: 5.3.1 @@ -4478,8 +4468,8 @@ packages: - supports-color dev: true - /@typescript-eslint/parser@7.9.0(eslint@8.57.0)(typescript@5.4.5): - resolution: {integrity: sha512-qHMJfkL5qvgQB2aLvhUSXxbK7OLnDkwPzFalg458pxQgfxKDfT1ZDbHQM/I6mDIf/svlMkj21kzKuQ2ixJlatQ==} + /@typescript-eslint/parser@7.11.0(eslint@8.57.0)(typescript@5.4.5): + resolution: {integrity: sha512-yimw99teuaXVWsBcPO1Ais02kwJ1jmNA1KxE7ng0aT7ndr1pT1wqj0OJnsYVGKKlc4QJai86l/025L6z8CljOg==} engines: {node: ^18.18.0 || >=20.0.0} peerDependencies: eslint: ^8.56.0 @@ -4488,10 +4478,10 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/scope-manager': 7.9.0 - '@typescript-eslint/types': 7.9.0 - '@typescript-eslint/typescript-estree': 7.9.0(typescript@5.4.5) - '@typescript-eslint/visitor-keys': 7.9.0 + '@typescript-eslint/scope-manager': 7.11.0 + '@typescript-eslint/types': 7.11.0 + '@typescript-eslint/typescript-estree': 7.11.0(typescript@5.4.5) + '@typescript-eslint/visitor-keys': 7.11.0 debug: 4.3.4 eslint: 8.57.0 typescript: 5.4.5 @@ -4499,16 +4489,16 @@ packages: - supports-color dev: true - /@typescript-eslint/scope-manager@7.9.0: - resolution: {integrity: sha512-ZwPK4DeCDxr3GJltRz5iZejPFAAr4Wk3+2WIBaj1L5PYK5RgxExu/Y68FFVclN0y6GGwH8q+KgKRCvaTmFBbgQ==} + /@typescript-eslint/scope-manager@7.11.0: + resolution: {integrity: sha512-27tGdVEiutD4POirLZX4YzT180vevUURJl4wJGmm6TrQoiYwuxTIY98PBp6L2oN+JQxzE0URvYlzJaBHIekXAw==} engines: {node: ^18.18.0 || >=20.0.0} dependencies: - '@typescript-eslint/types': 7.9.0 - '@typescript-eslint/visitor-keys': 7.9.0 + '@typescript-eslint/types': 7.11.0 + '@typescript-eslint/visitor-keys': 7.11.0 dev: true - /@typescript-eslint/type-utils@7.9.0(eslint@8.57.0)(typescript@5.4.5): - resolution: {integrity: sha512-6Qy8dfut0PFrFRAZsGzuLoM4hre4gjzWJB6sUvdunCYZsYemTkzZNwF1rnGea326PHPT3zn5Lmg32M/xfJfByA==} + /@typescript-eslint/type-utils@7.11.0(eslint@8.57.0)(typescript@5.4.5): + resolution: {integrity: sha512-WmppUEgYy+y1NTseNMJ6mCFxt03/7jTOy08bcg7bxJJdsM4nuhnchyBbE8vryveaJUf62noH7LodPSo5Z0WUCg==} engines: {node: ^18.18.0 || >=20.0.0} peerDependencies: eslint: ^8.56.0 @@ -4517,8 +4507,8 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/typescript-estree': 7.9.0(typescript@5.4.5) - '@typescript-eslint/utils': 7.9.0(eslint@8.57.0)(typescript@5.4.5) + '@typescript-eslint/typescript-estree': 7.11.0(typescript@5.4.5) + '@typescript-eslint/utils': 7.11.0(eslint@8.57.0)(typescript@5.4.5) debug: 4.3.4 eslint: 8.57.0 ts-api-utils: 1.3.0(typescript@5.4.5) @@ -4527,13 +4517,13 @@ packages: - supports-color dev: true - /@typescript-eslint/types@7.9.0: - resolution: {integrity: sha512-oZQD9HEWQanl9UfsbGVcZ2cGaR0YT5476xfWE0oE5kQa2sNK2frxOlkeacLOTh9po4AlUT5rtkGyYM5kew0z5w==} + /@typescript-eslint/types@7.11.0: + resolution: {integrity: sha512-MPEsDRZTyCiXkD4vd3zywDCifi7tatc4K37KqTprCvaXptP7Xlpdw0NR2hRJTetG5TxbWDB79Ys4kLmHliEo/w==} engines: {node: ^18.18.0 || >=20.0.0} dev: true - /@typescript-eslint/typescript-estree@7.9.0(typescript@5.4.5): - resolution: {integrity: sha512-zBCMCkrb2YjpKV3LA0ZJubtKCDxLttxfdGmwZvTqqWevUPN0FZvSI26FalGFFUZU/9YQK/A4xcQF9o/VVaCKAg==} + /@typescript-eslint/typescript-estree@7.11.0(typescript@5.4.5): + resolution: {integrity: sha512-cxkhZ2C/iyi3/6U9EPc5y+a6csqHItndvN/CzbNXTNrsC3/ASoYQZEt9uMaEp+xFNjasqQyszp5TumAVKKvJeQ==} engines: {node: ^18.18.0 || >=20.0.0} peerDependencies: typescript: '*' @@ -4541,40 +4531,40 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/types': 7.9.0 - '@typescript-eslint/visitor-keys': 7.9.0 + '@typescript-eslint/types': 7.11.0 + '@typescript-eslint/visitor-keys': 7.11.0 debug: 4.3.4 globby: 11.1.0 is-glob: 4.0.3 minimatch: 9.0.4 - semver: 7.6.1 + semver: 7.6.2 ts-api-utils: 1.3.0(typescript@5.4.5) typescript: 5.4.5 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/utils@7.9.0(eslint@8.57.0)(typescript@5.4.5): - resolution: {integrity: sha512-5KVRQCzZajmT4Ep+NEgjXCvjuypVvYHUW7RHlXzNPuak2oWpVoD1jf5xCP0dPAuNIchjC7uQyvbdaSTFaLqSdA==} + /@typescript-eslint/utils@7.11.0(eslint@8.57.0)(typescript@5.4.5): + resolution: {integrity: sha512-xlAWwPleNRHwF37AhrZurOxA1wyXowW4PqVXZVUNCLjB48CqdPJoJWkrpH2nij9Q3Lb7rtWindtoXwxjxlKKCA==} engines: {node: ^18.18.0 || >=20.0.0} peerDependencies: eslint: ^8.56.0 dependencies: '@eslint-community/eslint-utils': 4.4.0(eslint@8.57.0) - '@typescript-eslint/scope-manager': 7.9.0 - '@typescript-eslint/types': 7.9.0 - '@typescript-eslint/typescript-estree': 7.9.0(typescript@5.4.5) + '@typescript-eslint/scope-manager': 7.11.0 + '@typescript-eslint/types': 7.11.0 + '@typescript-eslint/typescript-estree': 7.11.0(typescript@5.4.5) eslint: 8.57.0 transitivePeerDependencies: - supports-color - typescript dev: true - /@typescript-eslint/visitor-keys@7.9.0: - resolution: {integrity: sha512-iESPx2TNLDNGQLyjKhUvIKprlP49XNEK+MvIf9nIO7ZZaZdbnfWKHnXAgufpxqfA0YryH8XToi4+CjBgVnFTSQ==} + /@typescript-eslint/visitor-keys@7.11.0: + resolution: {integrity: sha512-7syYk4MzjxTEk0g/w3iqtgxnFQspDJfn6QKD36xMuuhTzjcxY7F8EmBLnALjVyaOF1/bVocu3bS/2/F7rXrveQ==} engines: {node: ^18.18.0 || >=20.0.0} dependencies: - '@typescript-eslint/types': 7.9.0 + '@typescript-eslint/types': 7.11.0 eslint-visitor-keys: 3.4.3 dev: true @@ -4787,6 +4777,23 @@ packages: indent-string: 4.0.0 dev: true + /ajv-draft-04@1.0.0(ajv@8.13.0): + resolution: {integrity: sha512-mv00Te6nmYbRp5DCwclxtt7yV/joXJPGS7nM+97GdxvuttCOfgI3K4U25zboyeX0O+myI8ERluxQe5wljMmVIw==} + peerDependencies: + ajv: ^8.5.0 + peerDependenciesMeta: + ajv: + optional: true + dependencies: + ajv: 8.13.0 + dev: true + + /ajv-formats@3.0.1: + resolution: {integrity: sha512-8iUql50EUR+uUcdRQ3HDqa6EVyo3docL8g5WJ3FNcWmu62IbkGUue/pEyLBW8VGKKucTPgqeks4fIU1DA4yowQ==} + dependencies: + ajv: 8.13.0 + dev: true + /ajv-keywords@3.5.2(ajv@6.12.6): resolution: {integrity: sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==} peerDependencies: @@ -4804,6 +4811,24 @@ packages: uri-js: 4.4.1 dev: true + /ajv@8.12.0: + resolution: {integrity: sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==} + dependencies: + fast-deep-equal: 3.1.3 + json-schema-traverse: 1.0.0 + require-from-string: 2.0.2 + uri-js: 4.4.1 + dev: true + + /ajv@8.13.0: + resolution: {integrity: sha512-PRA911Blj99jR5RMeTunVbNXMF6Lp4vZXnk5GQjcnUWUTsrXtekg/pnmFFI2u/I36Y/2bITGS30GZCXei6uNkA==} + dependencies: + fast-deep-equal: 3.1.3 + json-schema-traverse: 1.0.0 + require-from-string: 2.0.2 + uri-js: 4.4.1 + dev: true + /ansi-escapes@4.3.2: resolution: {integrity: sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==} engines: {node: '>=8'} @@ -5211,7 +5236,14 @@ packages: resolution: {integrity: sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==} engines: {node: '>=8'} dependencies: - fill-range: 7.0.1 + fill-range: 7.1.1 + + /braces@3.0.3: + resolution: {integrity: sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==} + engines: {node: '>=8'} + dependencies: + fill-range: 7.1.1 + dev: true /browserslist@4.22.2: resolution: {integrity: sha512-0UgcrvQmBDvZHFGdYUehrCNIazki7/lUP3kkoi/r3YB2amZbFM9J43ZRkJTXBUZK4gmx56+Sqk9+Vs9mwZx9+A==} @@ -5230,8 +5262,8 @@ packages: node-int64: 0.4.0 dev: true - /bson@6.6.0: - resolution: {integrity: sha512-BVINv2SgcMjL4oYbBuCQTpE3/VKOSxrOA8Cj/wQP7izSzlBGVomdm+TcUd0Pzy0ytLSSDweCKQ6X3f5veM5LQA==} + /bson@6.7.0: + resolution: {integrity: sha512-w2IquM5mYzYZv6rs3uN2DZTOBe2a0zXLj53TGDqwF4l6Sz/XsISrisXOJihArF9+BZ6Cq/GjVht7Sjfmri7ytQ==} engines: {node: '>=16.20.1'} dev: true @@ -5543,16 +5575,14 @@ packages: engines: {node: '>=16'} dev: true - /commander@2.20.3: - resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==} + /commander@12.1.0: + resolution: {integrity: sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA==} + engines: {node: '>=18'} dev: true - /commander@9.5.0: - resolution: {integrity: sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==} - engines: {node: ^12.20.0 || >=14} - requiresBuild: true + /commander@2.20.3: + resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==} dev: true - optional: true /common-path-prefix@3.0.0: resolution: {integrity: sha512-QE33hToZseCH3jS0qN96O/bSh3kaw/h+Tq7ngyY9eWDUnTlTNUyqfqvCXioLe5Na5jFsL78ra/wuBU4iuEgd4w==} @@ -6083,13 +6113,13 @@ packages: is-symbol: 1.0.4 dev: true - /esbuild-register@3.5.0(esbuild@0.21.2): + /esbuild-register@3.5.0(esbuild@0.21.4): resolution: {integrity: sha512-+4G/XmakeBAsvJuDugJvtyF1x+XJT4FMocynNpxrvEBViirpfUn2PgNpCHedfWhF4WokNsO/OvMKrmJOIJsI5A==} peerDependencies: esbuild: '>=0.12 <1' dependencies: debug: 4.3.4 - esbuild: 0.21.2 + esbuild: 0.21.4 transitivePeerDependencies: - supports-color dev: true @@ -6154,35 +6184,35 @@ packages: '@esbuild/win32-x64': 0.20.2 dev: true - /esbuild@0.21.2: - resolution: {integrity: sha512-LmHPAa5h4tSxz+g/D8IHY6wCjtIiFx8I7/Q0Aq+NmvtoYvyMnJU0KQJcqB6QH30X9x/W4CemgUtPgQDZFca5SA==} + /esbuild@0.21.4: + resolution: {integrity: sha512-sFMcNNrj+Q0ZDolrp5pDhH0nRPN9hLIM3fRPwgbLYJeSHHgnXSnbV3xYgSVuOeLWH9c73VwmEverVzupIv5xuA==} engines: {node: '>=12'} hasBin: true requiresBuild: true optionalDependencies: - '@esbuild/aix-ppc64': 0.21.2 - '@esbuild/android-arm': 0.21.2 - '@esbuild/android-arm64': 0.21.2 - '@esbuild/android-x64': 0.21.2 - '@esbuild/darwin-arm64': 0.21.2 - '@esbuild/darwin-x64': 0.21.2 - '@esbuild/freebsd-arm64': 0.21.2 - '@esbuild/freebsd-x64': 0.21.2 - '@esbuild/linux-arm': 0.21.2 - '@esbuild/linux-arm64': 0.21.2 - '@esbuild/linux-ia32': 0.21.2 - '@esbuild/linux-loong64': 0.21.2 - '@esbuild/linux-mips64el': 0.21.2 - '@esbuild/linux-ppc64': 0.21.2 - '@esbuild/linux-riscv64': 0.21.2 - '@esbuild/linux-s390x': 0.21.2 - '@esbuild/linux-x64': 0.21.2 - '@esbuild/netbsd-x64': 0.21.2 - '@esbuild/openbsd-x64': 0.21.2 - '@esbuild/sunos-x64': 0.21.2 - '@esbuild/win32-arm64': 0.21.2 - '@esbuild/win32-ia32': 0.21.2 - '@esbuild/win32-x64': 0.21.2 + '@esbuild/aix-ppc64': 0.21.4 + '@esbuild/android-arm': 0.21.4 + '@esbuild/android-arm64': 0.21.4 + '@esbuild/android-x64': 0.21.4 + '@esbuild/darwin-arm64': 0.21.4 + '@esbuild/darwin-x64': 0.21.4 + '@esbuild/freebsd-arm64': 0.21.4 + '@esbuild/freebsd-x64': 0.21.4 + '@esbuild/linux-arm': 0.21.4 + '@esbuild/linux-arm64': 0.21.4 + '@esbuild/linux-ia32': 0.21.4 + '@esbuild/linux-loong64': 0.21.4 + '@esbuild/linux-mips64el': 0.21.4 + '@esbuild/linux-ppc64': 0.21.4 + '@esbuild/linux-riscv64': 0.21.4 + '@esbuild/linux-s390x': 0.21.4 + '@esbuild/linux-x64': 0.21.4 + '@esbuild/netbsd-x64': 0.21.4 + '@esbuild/openbsd-x64': 0.21.4 + '@esbuild/sunos-x64': 0.21.4 + '@esbuild/win32-arm64': 0.21.4 + '@esbuild/win32-ia32': 0.21.4 + '@esbuild/win32-x64': 0.21.4 dev: true /escalade@3.1.1: @@ -6241,7 +6271,7 @@ packages: - supports-color dev: true - /eslint-module-utils@2.8.0(@typescript-eslint/parser@7.9.0)(eslint-import-resolver-node@0.3.9)(eslint@8.57.0): + /eslint-module-utils@2.8.0(@typescript-eslint/parser@7.11.0)(eslint-import-resolver-node@0.3.9)(eslint@8.57.0): resolution: {integrity: sha512-aWajIYfsqCKRDgUfjEXNN/JlrzauMuSEy5sbd7WXbtW3EH6A6MpwEh42c7qD+MqQo9QMJ6fWLAeIJynx0g6OAw==} engines: {node: '>=4'} peerDependencies: @@ -6262,7 +6292,7 @@ packages: eslint-import-resolver-webpack: optional: true dependencies: - '@typescript-eslint/parser': 7.9.0(eslint@8.57.0)(typescript@5.4.5) + '@typescript-eslint/parser': 7.11.0(eslint@8.57.0)(typescript@5.4.5) debug: 3.2.7 eslint: 8.57.0 eslint-import-resolver-node: 0.3.9 @@ -6281,7 +6311,7 @@ packages: ignore: 5.2.4 dev: true - /eslint-plugin-import@2.29.1(@typescript-eslint/parser@7.9.0)(eslint@8.57.0): + /eslint-plugin-import@2.29.1(@typescript-eslint/parser@7.11.0)(eslint@8.57.0): resolution: {integrity: sha512-BbPC0cuExzhiMo4Ff1BTVwHpjjv28C5R+btTOGaCRC7UEz801up0JadwkeSk5Ued6TG34uaczuVuH6qyy5YUxw==} engines: {node: '>=4'} peerDependencies: @@ -6291,7 +6321,7 @@ packages: '@typescript-eslint/parser': optional: true dependencies: - '@typescript-eslint/parser': 7.9.0(eslint@8.57.0)(typescript@5.4.5) + '@typescript-eslint/parser': 7.11.0(eslint@8.57.0)(typescript@5.4.5) array-includes: 3.1.7 array.prototype.findlastindex: 1.2.3 array.prototype.flat: 1.3.2 @@ -6300,7 +6330,7 @@ packages: doctrine: 2.1.0 eslint: 8.57.0 eslint-import-resolver-node: 0.3.9 - eslint-module-utils: 2.8.0(@typescript-eslint/parser@7.9.0)(eslint-import-resolver-node@0.3.9)(eslint@8.57.0) + eslint-module-utils: 2.8.0(@typescript-eslint/parser@7.11.0)(eslint-import-resolver-node@0.3.9)(eslint@8.57.0) hasown: 2.0.0 is-core-module: 2.13.1 is-glob: 4.0.3 @@ -6316,7 +6346,7 @@ packages: - supports-color dev: true - /eslint-plugin-jest@28.5.0(@typescript-eslint/eslint-plugin@7.9.0)(eslint@8.57.0)(typescript@5.4.5): + /eslint-plugin-jest@28.5.0(@typescript-eslint/eslint-plugin@7.11.0)(eslint@8.57.0)(typescript@5.4.5): resolution: {integrity: sha512-6np6DGdmNq/eBbA7HOUNV8fkfL86PYwBfwyb8n23FXgJNTR8+ot3smRHjza9LGsBBZRypK3qyF79vMjohIL8eQ==} engines: {node: ^16.10.0 || ^18.12.0 || >=20.0.0} peerDependencies: @@ -6329,8 +6359,8 @@ packages: jest: optional: true dependencies: - '@typescript-eslint/eslint-plugin': 7.9.0(@typescript-eslint/parser@7.9.0)(eslint@8.57.0)(typescript@5.4.5) - '@typescript-eslint/utils': 7.9.0(eslint@8.57.0)(typescript@5.4.5) + '@typescript-eslint/eslint-plugin': 7.11.0(@typescript-eslint/parser@7.11.0)(eslint@8.57.0)(typescript@5.4.5) + '@typescript-eslint/utils': 7.11.0(eslint@8.57.0)(typescript@5.4.5) eslint: 8.57.0 transitivePeerDependencies: - supports-color @@ -6696,8 +6726,8 @@ packages: flat-cache: 3.0.4 dev: true - /fill-range@7.0.1: - resolution: {integrity: sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==} + /fill-range@7.1.1: + resolution: {integrity: sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==} engines: {node: '>=8'} dependencies: to-regex-range: 5.0.1 @@ -6821,8 +6851,8 @@ packages: engines: {node: '>= 0.6'} dev: true - /fp-ts@2.16.5: - resolution: {integrity: sha512-N8T8PwMSeTKKtkm9lkj/zSTAnPC/aJIIrQhnHxxkL0KLsRCNUPANksJOlMXxcKKCo7H1ORP3No9EMD+fP0tsdA==} + /fp-ts@2.16.6: + resolution: {integrity: sha512-v7w209VPj4L6pPn/ftFRJu31Oa8QagwcVw7BZmLCUWU4AQoc954rX9ogSIahDf67Pg+GjPbkW/Kn9XWnlWJG0g==} dev: true /fresh@0.5.2: @@ -6991,8 +7021,8 @@ packages: get-intrinsic: 1.2.1 dev: true - /get-tsconfig@4.7.3: - resolution: {integrity: sha512-ZvkrzoUA0PQZM6fy6+/Hce561s+faD1rsNwhnO5FelNjyy7EMGJ3Rz1AQ8GYDWjhRs/7dBLOEJvhK8MiEJOAFg==} + /get-tsconfig@4.7.5: + resolution: {integrity: sha512-ZCuZCnlqNzjb4QprAzXKdpp/gh6KTxSJuw3IBsPnV/7fV4NxC9ckB+vPTt8w7fJA0TaSD7c55BR47JD6MEDyDw==} dependencies: resolve-pkg-maps: 1.0.0 dev: true @@ -7096,7 +7126,6 @@ packages: /graceful-fs@4.2.11: resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} - dev: true /graphemer@1.4.0: resolution: {integrity: sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==} @@ -7713,7 +7742,7 @@ packages: '@babel/parser': 7.21.8 '@istanbuljs/schema': 0.1.3 istanbul-lib-coverage: 3.2.0 - semver: 7.6.1 + semver: 7.6.2 transitivePeerDependencies: - supports-color dev: true @@ -7870,7 +7899,7 @@ packages: jest-runner: 29.7.0 jest-util: 29.7.0 jest-validate: 29.7.0 - micromatch: 4.0.5 + micromatch: 4.0.6 parse-json: 5.2.0 pretty-format: 29.7.0 slash: 3.0.0 @@ -7911,7 +7940,7 @@ packages: jest-runner: 29.7.0 jest-util: 29.7.0 jest-validate: 29.7.0 - micromatch: 4.0.5 + micromatch: 4.0.6 parse-json: 5.2.0 pretty-format: 29.7.0 slash: 3.0.0 @@ -8037,7 +8066,7 @@ packages: '@types/stack-utils': 2.0.1 chalk: 4.1.2 graceful-fs: 4.2.11 - micromatch: 4.0.5 + micromatch: 4.0.6 pretty-format: 29.7.0 slash: 3.0.0 stack-utils: 2.0.5 @@ -8340,6 +8369,10 @@ packages: resolution: {integrity: sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==} dev: true + /json-schema-traverse@1.0.0: + resolution: {integrity: sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==} + dev: true + /json-stable-stringify-without-jsonify@1.0.1: resolution: {integrity: sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==} dev: true @@ -8372,7 +8405,7 @@ packages: dependencies: universalify: 2.0.0 optionalDependencies: - graceful-fs: 4.2.10 + graceful-fs: 4.2.11 /jsonwebtoken@8.5.1: resolution: {integrity: sha512-XjwVfRS6jTMsqYs0EsuJ4LGxXV14zQybNd4L2r0UvbVnSF9Af8x7p5MzbJ90Ioz/9TI41/hTCvznF/loiSzn8w==} @@ -8485,8 +8518,8 @@ packages: engines: {node: '>=10'} dev: true - /lilconfig@3.0.0: - resolution: {integrity: sha512-K2U4W2Ff5ibV7j7ydLr+zLAkIg5JJ4lPn1Ltsdt+Tz/IjQ8buJ55pZAxoP34lqIiwtF9iAvtLv3JGv7CAyAg+g==} + /lilconfig@3.1.1: + resolution: {integrity: sha512-O18pf7nyvHTckunPWCV1XUNXU1piu01y2b7ATJ0ppkUkk8ocqVWBrYjJBCwHDjD/ZWcfyrA0P4gKhzWGi5EINQ==} engines: {node: '>=14'} dev: true @@ -8499,34 +8532,34 @@ packages: resolution: {integrity: sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==} dev: true - /lint-staged@15.2.2: - resolution: {integrity: sha512-TiTt93OPh1OZOsb5B7k96A/ATl2AjIZo+vnzFZ6oHK5FuTk63ByDtxGQpHm+kFETjEWqgkF95M8FRXKR/LEBcw==} + /lint-staged@15.2.5: + resolution: {integrity: sha512-j+DfX7W9YUvdzEZl3Rk47FhDF6xwDBV5wwsCPw6BwWZVPYJemusQmvb9bRsW23Sqsaa+vRloAWogbK4BUuU2zA==} engines: {node: '>=18.12.0'} hasBin: true dependencies: chalk: 5.3.0 - commander: 11.1.0 + commander: 12.1.0 debug: 4.3.4 execa: 8.0.1 - lilconfig: 3.0.0 - listr2: 8.0.1 - micromatch: 4.0.5 + lilconfig: 3.1.1 + listr2: 8.2.1 + micromatch: 4.0.7 pidtree: 0.6.0 string-argv: 0.3.2 - yaml: 2.3.4 + yaml: 2.4.2 transitivePeerDependencies: - supports-color dev: true - /listr2@8.0.1: - resolution: {integrity: sha512-ovJXBXkKGfq+CwmKTjluEqFi3p4h8xvkxGQQAQan22YCgef4KZ1mKGjzfGh6PL6AW5Csw0QiQPNuQyH+6Xk3hA==} + /listr2@8.2.1: + resolution: {integrity: sha512-irTfvpib/rNiD637xeevjO2l3Z5loZmuaRi0L0YE5LfijwVY96oyVn0DFD3o/teAok7nfobMG1THvvcHh/BP6g==} engines: {node: '>=18.0.0'} dependencies: cli-truncate: 4.0.0 colorette: 2.0.20 eventemitter3: 5.0.1 log-update: 6.0.0 - rfdc: 1.3.0 + rfdc: 1.3.1 wrap-ansi: 9.0.0 dev: true @@ -8568,10 +8601,6 @@ packages: resolution: {integrity: sha512-m/M1U1f3ddMCs6Hq2tAsYThTBDaAKFDX3dwDo97GEYzamXi9SqUpjWi/Rrj/gf3X2n8ktwgZrlP1z6E3v/IExQ==} dev: true - /lodash.get@4.4.2: - resolution: {integrity: sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==} - dev: true - /lodash.includes@4.3.0: resolution: {integrity: sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==} dev: true @@ -8580,10 +8609,6 @@ packages: resolution: {integrity: sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg==} dev: true - /lodash.isequal@4.5.0: - resolution: {integrity: sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==} - dev: true - /lodash.isinteger@4.0.4: resolution: {integrity: sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA==} dev: true @@ -8679,7 +8704,7 @@ packages: resolution: {integrity: sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==} engines: {node: '>=10'} dependencies: - semver: 7.6.1 + semver: 7.6.2 dev: true /make-error@1.3.6: @@ -8808,6 +8833,22 @@ packages: picomatch: 2.3.1 dev: true + /micromatch@4.0.6: + resolution: {integrity: sha512-Y4Ypn3oujJYxJcMacVgcs92wofTHxp9FzfDpQON4msDefoC0lb3ETvQLOdLcbhSwU1bz8HrL/1sygfBIHudrkQ==} + engines: {node: '>=8.6'} + dependencies: + braces: 3.0.3 + picomatch: 4.0.2 + dev: true + + /micromatch@4.0.7: + resolution: {integrity: sha512-LPP/3KorzCwBxfeUuZmaR6bG2kdeHSbe0P2tY3FLRU4vYrjYz5hI4QZwV0njUx3jeuKe67YukQ1LSPZBKDqO/Q==} + engines: {node: '>=8.6'} + dependencies: + braces: 3.0.3 + picomatch: 2.3.1 + dev: true + /mime-db@1.52.0: resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==} engines: {node: '>= 0.6'} @@ -8846,8 +8887,8 @@ packages: engines: {node: '>=4'} dev: true - /miniflare@3.20240512.0: - resolution: {integrity: sha512-X0PlKR0AROKpxFoJNmRtCMIuJxj+ngEcyTOlEokj2rAQ0TBwUhB4/1uiPvdI6ofW5NugPOD1uomAv+gLjwsLDQ==} + /miniflare@3.20240524.0: + resolution: {integrity: sha512-RQAfpz7spI6gWlczeUYvJBgGyt0gNR2pYoCydgukCYZ+0bGfJl0yAiNFW62uH7uMZli/4juWPpQOBI5m7URoyA==} engines: {node: '>=16.13'} hasBin: true dependencies: @@ -8859,7 +8900,7 @@ packages: glob-to-regexp: 0.4.1 stoppable: 1.1.0 undici: 5.28.4 - workerd: 1.20240512.0 + workerd: 1.20240524.0 ws: 8.14.2 youch: 3.3.3 zod: 3.22.4 @@ -9003,8 +9044,8 @@ packages: whatwg-url: 13.0.0 dev: true - /mongodb@6.5.0: - resolution: {integrity: sha512-Fozq68InT+JKABGLqctgtb8P56pRrJFkbhW0ux+x1mdHeyinor8oNzJqwLjV/t5X5nJGfTlluxfyMnOXNggIUA==} + /mongodb@6.6.2: + resolution: {integrity: sha512-ZF9Ugo2JCG/GfR7DEb4ypfyJJyiKbg5qBYKRintebj8+DNS33CyGMkWbrS9lara+u+h+yEOGSRiLhFO/g1s1aw==} engines: {node: '>=16.20.1'} peerDependencies: '@aws-sdk/credential-providers': ^3.188.0 @@ -9031,17 +9072,17 @@ packages: optional: true dependencies: '@mongodb-js/saslprep': 1.1.5 - bson: 6.6.0 + bson: 6.7.0 mongodb-connection-string-url: 3.0.0 dev: true - /mongoose@8.3.4: - resolution: {integrity: sha512-ckBaBzKgtWgCalW/LPkcBsR3wKCOYEJ9jLFPmYCYV7TLStpETY757ELx8/1stL11+6HxLLVffawBffXzd0Y7YA==} + /mongoose@8.4.0: + resolution: {integrity: sha512-fgqRMwVEP1qgRYfh+tUe2YBBFnPO35FIg2lfFH+w9IhRGg1/ataWGIqvf/MjwM29cZ60D5vSnqtN2b8Qp0sOZA==} engines: {node: '>=16.20.1'} dependencies: - bson: 6.6.0 + bson: 6.7.0 kareem: 2.6.3 - mongodb: 6.5.0 + mongodb: 6.6.2 mpath: 0.9.0 mquery: 5.0.0 ms: 2.1.3 @@ -9202,7 +9243,7 @@ packages: nopt: 5.0.0 npmlog: 6.0.2 rimraf: 3.0.2 - semver: 7.6.1 + semver: 7.6.2 tar: 6.1.14 which: 2.0.2 transitivePeerDependencies: @@ -9242,7 +9283,7 @@ packages: dependencies: hosted-git-info: 4.1.0 is-core-module: 2.13.1 - semver: 7.6.1 + semver: 7.6.2 validate-npm-package-license: 3.0.4 dev: true @@ -9252,7 +9293,7 @@ packages: dependencies: hosted-git-info: 7.0.1 is-core-module: 2.13.1 - semver: 7.6.1 + semver: 7.6.2 validate-npm-package-license: 3.0.4 dev: true @@ -9701,6 +9742,11 @@ packages: resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} engines: {node: '>=8.6'} + /picomatch@4.0.2: + resolution: {integrity: sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==} + engines: {node: '>=12'} + dev: true + /pidtree@0.6.0: resolution: {integrity: sha512-eG2dWTVw5bzqGRztnHExczNxt5VGsE6OwTeCG3fdUf9KBsZzO3R5OIIIzWR+iZA0NtZ+RDVdaoE2dK1cn6jH4g==} engines: {node: '>=0.10'} @@ -10090,6 +10136,11 @@ packages: engines: {node: '>=0.10.0'} dev: true + /require-from-string@2.0.2: + resolution: {integrity: sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==} + engines: {node: '>=0.10.0'} + dev: true + /require-in-the-middle@7.2.0: resolution: {integrity: sha512-3TLx5TGyAY6AOqLBoXmHkNql0HIf2RGbuMgCDT2WO/uGVAPJs6h7Kl+bN6TIZGd9bWhWPwnDnTHGtW8Iu77sdw==} engines: {node: '>=8.6.0'} @@ -10132,13 +10183,6 @@ packages: resolution: {integrity: sha512-X2UW6Nw3n/aMgDVy+0rSqgHlv39WZAlZrXCdnbyEiKm17DSqHX4MmQMaST3FbeWR5FTuRcUwYAziZajji0Y7mg==} engines: {node: '>=10'} - /resolve@1.19.0: - resolution: {integrity: sha512-rArEXAgsBG4UgRGcynxWIWKFvh/XZCcS8UJdHhwy91zwAvCZIbcs+vAbflgBnNjYMs/i/i+/Ux6IZhML1yPvxg==} - dependencies: - is-core-module: 2.13.1 - path-parse: 1.0.7 - dev: true - /resolve@1.22.8: resolution: {integrity: sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==} hasBin: true @@ -10184,6 +10228,10 @@ packages: resolution: {integrity: sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA==} dev: true + /rfdc@1.3.1: + resolution: {integrity: sha512-r5a3l5HzYlIC68TpmYKlxWjmOP6wiPJ1vWv2HeLhNsRZMrCkxeqxiHlQ21oXmQ4F3SiryXBHhAD7JZqvOJjFmg==} + dev: true + /rimraf@3.0.2: resolution: {integrity: sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==} hasBin: true @@ -10293,6 +10341,12 @@ packages: hasBin: true dev: true + /semver@7.6.2: + resolution: {integrity: sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==} + engines: {node: '>=10'} + hasBin: true + dev: true + /send@0.17.2: resolution: {integrity: sha512-UJYB6wFSJE3G00nEivR5rgWp8c2xXvJ3OPWPhmuteU0IKj8nKbG3DrjiOmLwpnHGYWAVwA69zmTm++YG0Hmwww==} engines: {node: '>= 0.8.0'} @@ -10532,7 +10586,7 @@ packages: resolution: {integrity: sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==} dependencies: spdx-expression-parse: 3.0.1 - spdx-license-ids: 3.0.17 + spdx-license-ids: 3.0.18 dev: true /spdx-exceptions@2.5.0: @@ -10543,11 +10597,11 @@ packages: resolution: {integrity: sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==} dependencies: spdx-exceptions: 2.5.0 - spdx-license-ids: 3.0.17 + spdx-license-ids: 3.0.18 dev: true - /spdx-license-ids@3.0.17: - resolution: {integrity: sha512-sh8PWc/ftMqAAdFiBu6Fy6JUOYjqDJBJvIhpfDMyHrr0Rbp5liZqd4TjtQ/RgfLjKFZb+LMx5hpml5qOWy0qvg==} + /spdx-license-ids@3.0.18: + resolution: {integrity: sha512-xxRs31BqRYHwiMzudOrpSiHtZ8i/GeionCBDSilhYRj+9gIcI8wCZTlXZKu9vZIVqViP3dcp9qE5G6AlIaD+TQ==} dev: true /split2@4.1.0: @@ -10889,7 +10943,7 @@ packages: supports-hyperlinks: 2.3.0 dev: true - /terser-webpack-plugin@5.3.10(esbuild@0.21.2)(webpack@5.91.0): + /terser-webpack-plugin@5.3.10(esbuild@0.21.4)(webpack@5.91.0): resolution: {integrity: sha512-BKFPWlPDndPs+NGGCr1U59t0XScL5317Y0UReNrHaw9/FwhPENlq6bfgs+4yPfyP51vqC1bQ4rp1EfXW5ZSH9w==} engines: {node: '>= 10.13.0'} peerDependencies: @@ -10906,12 +10960,12 @@ packages: optional: true dependencies: '@jridgewell/trace-mapping': 0.3.22 - esbuild: 0.21.2 + esbuild: 0.21.4 jest-worker: 27.5.1 schema-utils: 3.3.0 serialize-javascript: 6.0.1 terser: 5.27.0 - webpack: 5.91.0(esbuild@0.21.2) + webpack: 5.91.0(esbuild@0.21.4) dev: true /terser@5.27.0: @@ -11045,7 +11099,7 @@ packages: yn: 3.1.1 dev: true - /ts-node@10.9.2(@swc/core@1.5.3)(@types/node@18.19.31)(typescript@5.4.5): + /ts-node@10.9.2(@swc/core@1.5.7)(@types/node@18.19.31)(typescript@5.4.5): resolution: {integrity: sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==} hasBin: true peerDependencies: @@ -11060,7 +11114,7 @@ packages: optional: true dependencies: '@cspotcode/source-map-support': 0.8.1 - '@swc/core': 1.5.3 + '@swc/core': 1.5.7 '@tsconfig/node10': 1.0.9 '@tsconfig/node12': 1.0.11 '@tsconfig/node14': 1.0.3 @@ -11108,8 +11162,8 @@ packages: yn: 3.1.1 dev: true - /ts-pattern@5.1.1: - resolution: {integrity: sha512-i+owkHr5RYdQxj8olUgRrqpiWH9x27PuWVfXwDmJ/n/CoF/SAa7WW1i2oUpPDMQpJ4U+bGRUcZkVq7i1m3zFCg==} + /ts-pattern@5.1.2: + resolution: {integrity: sha512-u+ElKUIWnqisjpRBhv6Y89yNq7Pmz6xL0v7pTSckrVZ0+5Vf32oh/3jmxWl80rAOGcnbBa7fCyeqNdP4yXzWWg==} dev: true /ts-toolbelt@9.6.0: @@ -11142,13 +11196,13 @@ packages: /tslib@2.6.2: resolution: {integrity: sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==} - /tsx@4.10.1: - resolution: {integrity: sha512-G+CcyTOopwhuI81FU+KpzGN5UBhHgGEDlGt8mHAXKxv8pDGr6WI7hI7aRjTRol5WzFVsSNuzl3ekCZ0eLIJlEQ==} + /tsx@4.11.0: + resolution: {integrity: sha512-vzGGELOgAupsNVssAmZjbUDfdm/pWP4R+Kg8TVdsonxbXk0bEpE1qh0yV6/QxUVXaVlNemgcPajGdJJ82n3stg==} engines: {node: '>=18.0.0'} hasBin: true dependencies: esbuild: 0.20.2 - get-tsconfig: 4.7.3 + get-tsconfig: 4.7.5 optionalDependencies: fsevents: 2.3.3 dev: true @@ -11389,11 +11443,6 @@ packages: spdx-expression-parse: 3.0.1 dev: true - /validator@13.7.0: - resolution: {integrity: sha512-nYXQLCBkpJ8X6ltALua9dRrZDHVYxjJ1wgskNt1lH9fzGjs3tgojGSCBjmEPwkWS1y29+DrizMTW19Pr9uB2nw==} - engines: {node: '>= 0.10'} - dev: true - /vary@1.1.2: resolution: {integrity: sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==} engines: {node: '>= 0.8'} @@ -11446,7 +11495,7 @@ packages: engines: {node: '>=10.13.0'} dev: true - /webpack@5.91.0(esbuild@0.21.2): + /webpack@5.91.0(esbuild@0.21.4): resolution: {integrity: sha512-rzVwlLeBWHJbmgTC/8TvAcu5vpJNII+MelQpylD4jNERPwpBJOE2lEcko1zJX3QJeLjTTAnQxn/OJ8bjDzVQaw==} engines: {node: '>=10.13.0'} hasBin: true @@ -11477,7 +11526,7 @@ packages: neo-async: 2.6.2 schema-utils: 3.3.0 tapable: 2.2.1 - terser-webpack-plugin: 5.3.10(esbuild@0.21.2)(webpack@5.91.0) + terser-webpack-plugin: 5.3.10(esbuild@0.21.4)(webpack@5.91.0) watchpack: 2.4.1 webpack-sources: 3.2.3 transitivePeerDependencies: @@ -11556,36 +11605,36 @@ packages: string-width: 4.2.3 dev: true - /workerd@1.20240512.0: - resolution: {integrity: sha512-VUBmR1PscAPHEE0OF/G2K7/H1gnr9aDWWZzdkIgWfNKkv8dKFCT75H+GJtUHjfwqz3rYCzaNZmatSXOpLGpF8A==} + /workerd@1.20240524.0: + resolution: {integrity: sha512-LWLe5D8PVHBcqturmBbwgI71r7YPpIMYZoVEH6S4G35EqIJ55cb0n3FipoSyraoIfpcCxCFxX1K6WsRHbP3pFA==} engines: {node: '>=16'} hasBin: true requiresBuild: true optionalDependencies: - '@cloudflare/workerd-darwin-64': 1.20240512.0 - '@cloudflare/workerd-darwin-arm64': 1.20240512.0 - '@cloudflare/workerd-linux-64': 1.20240512.0 - '@cloudflare/workerd-linux-arm64': 1.20240512.0 - '@cloudflare/workerd-windows-64': 1.20240512.0 - - /wrangler@3.56.0(@cloudflare/workers-types@4.20240512.0): - resolution: {integrity: sha512-YEUscEmg6F7nVPoNX5uaQ/KT0ztkPLLN4XGOl9uwgLCTHsyilzeh4WvEg6lelDi60EIXhuzWLjf0jBFN4wbnZw==} + '@cloudflare/workerd-darwin-64': 1.20240524.0 + '@cloudflare/workerd-darwin-arm64': 1.20240524.0 + '@cloudflare/workerd-linux-64': 1.20240524.0 + '@cloudflare/workerd-linux-arm64': 1.20240524.0 + '@cloudflare/workerd-windows-64': 1.20240524.0 + + /wrangler@3.57.2(@cloudflare/workers-types@4.20240529.0): + resolution: {integrity: sha512-QegYf0FW+4prlFKE9iHr1EGrCo8ejcGL9gaqEXrzQ0vbTdazykYbY0I5UpHFLNq2dIF9I/ifEoLRKr636tyHEw==} engines: {node: '>=16.17.0'} hasBin: true peerDependencies: - '@cloudflare/workers-types': ^4.20240512.0 + '@cloudflare/workers-types': ^4.20240524.0 peerDependenciesMeta: '@cloudflare/workers-types': optional: true dependencies: '@cloudflare/kv-asset-handler': 0.3.2 - '@cloudflare/workers-types': 4.20240512.0 + '@cloudflare/workers-types': 4.20240529.0 '@esbuild-plugins/node-globals-polyfill': 0.2.3(esbuild@0.17.19) '@esbuild-plugins/node-modules-polyfill': 0.2.2(esbuild@0.17.19) blake3-wasm: 2.1.5 chokidar: 3.6.0 esbuild: 0.17.19 - miniflare: 3.20240512.0 + miniflare: 3.20240524.0 nanoid: 3.3.7 path-to-regexp: 6.2.1 resolve: 1.22.8 @@ -11697,9 +11746,10 @@ packages: engines: {node: '>= 14'} dev: true - /yaml@2.3.4: - resolution: {integrity: sha512-8aAvwVUSHpfEqTQ4w/KMlf3HcRdt50E5ODIQJBw1fQ5RL34xabzxtUlzTXVqc4rkZsPbvrXKWnABCD7kWSmocA==} + /yaml@2.4.2: + resolution: {integrity: sha512-B3VqDZ+JAg1nZpaEmWtTXUlBneoGx6CPM9b0TENK6aoSu5t73dItudwdgmi6tHlIZZId4dZ9skcAQ2UbcyAeVA==} engines: {node: '>= 14'} + hasBin: true dev: true /yargs-parser@20.2.9: @@ -11754,18 +11804,6 @@ packages: mustache: 4.2.0 stacktracey: 2.1.8 - /z-schema@5.0.5: - resolution: {integrity: sha512-D7eujBWkLa3p2sIpJA0d1pr7es+a7m0vFAnZLlCEKq/Ij2k0MLi9Br2UPxoxdYystm5K1yeBGzub0FlYUEWj2Q==} - engines: {node: '>=8.0.0'} - hasBin: true - dependencies: - lodash.get: 4.4.2 - lodash.isequal: 4.5.0 - validator: 13.7.0 - optionalDependencies: - commander: 9.5.0 - dev: true - /zip-stream@5.0.1: resolution: {integrity: sha512-UfZ0oa0C8LI58wJ+moL46BDIMgCQbnsb+2PoiJYtonhBsMh2bq1eRBVkvjfVsqbEHd9/EgKPUuL9saSSsec8OA==} engines: {node: '>= 12.0.0'} diff --git a/sandbox/tracing/otelSetup.ts b/sandbox/tracing/otelSetup.ts index 25517b2e7f99..701ec47b89ba 100644 --- a/sandbox/tracing/otelSetup.ts +++ b/sandbox/tracing/otelSetup.ts @@ -9,7 +9,7 @@ import { SimpleSpanProcessor, TraceIdRatioBasedSampler, } from '@opentelemetry/sdk-trace-base' -import { SemanticResourceAttributes } from '@opentelemetry/semantic-conventions' +import { SEMRESATTRS_SERVICE_NAME, SEMRESATTRS_SERVICE_VERSION } from '@opentelemetry/semantic-conventions' import { PrismaInstrumentation } from '@prisma/instrumentation' /** SETUP */ @@ -32,8 +32,8 @@ export function otelSetup() { const provider = new BasicTracerProvider({ resource: new Resource({ // we can define some metadata about the trace resource - [SemanticResourceAttributes.SERVICE_NAME]: 'basic-service', - [SemanticResourceAttributes.SERVICE_VERSION]: '1.0.0', + [SEMRESATTRS_SERVICE_NAME]: 'basic-service', + [SEMRESATTRS_SERVICE_VERSION]: '1.0.0', }), })