diff --git a/Cargo.lock b/Cargo.lock index 8166394f8c89..35eff530999a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -870,29 +870,26 @@ dependencies = [ [[package]] name = "cuid" version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51294db11d38eb763c92936c5c88425d0090e27dce21dd15748134af9e53e739" +source = "git+https://github.com/prisma/cuid-rust?branch=wasm32-support#81309f9a11f70d178bb545971d51ceb7da692c52" dependencies = [ "base36", "cuid-util", "cuid2", - "hostname", "num", "once_cell", "rand 0.8.5", + "sha3", ] [[package]] name = "cuid-util" version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ea2bfe0336ff1b7ca74819b2df8dfae9afea358aff6b1688baa5c181d8c3713" +source = "git+https://github.com/prisma/cuid-rust?branch=wasm32-support#81309f9a11f70d178bb545971d51ceb7da692c52" [[package]] name = "cuid2" version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47d99cacd52fd67db7490ad051c8c1973fb75520174d69aabbae08c534c9d0e8" +source = "git+https://github.com/prisma/cuid-rust?branch=wasm32-support#81309f9a11f70d178bb545971d51ceb7da692c52" dependencies = [ "cuid-util", "num", @@ -1557,8 +1554,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" dependencies = [ "cfg-if", + "js-sys", "libc", "wasi 0.11.0+wasi-snapshot-preview1", + "wasm-bindgen", ] [[package]] @@ -3353,6 +3352,7 @@ dependencies = [ "bigdecimal", "chrono", "cuid", + "getrandom 0.2.10", "itertools", "nanoid", "prisma-value", diff --git a/query-engine/connectors/mongodb-query-connector/Cargo.toml b/query-engine/connectors/mongodb-query-connector/Cargo.toml index d41210342107..c4a02eaa8643 100644 --- a/query-engine/connectors/mongodb-query-connector/Cargo.toml +++ b/query-engine/connectors/mongodb-query-connector/Cargo.toml @@ -22,6 +22,7 @@ tracing-futures = "0.2" uuid.workspace = true indexmap = "1.7" query-engine-metrics = {path = "../../metrics"} +cuid = { git = "https://github.com/prisma/cuid-rust", branch = "wasm32-support" } [dependencies.prisma-models] path = "../../prisma-models" @@ -46,9 +47,6 @@ workspace = true [dependencies.serde] workspace = true -[dependencies.cuid] -version = "1.2" - [dependencies.user-facing-errors] features = ["sql"] workspace = true diff --git a/query-engine/connectors/sql-query-connector/Cargo.toml b/query-engine/connectors/sql-query-connector/Cargo.toml index 5fe3052f2e8d..62d0be640761 100644 --- a/query-engine/connectors/sql-query-connector/Cargo.toml +++ b/query-engine/connectors/sql-query-connector/Cargo.toml @@ -25,6 +25,7 @@ uuid.workspace = true opentelemetry = { version = "0.17", features = ["tokio"] } tracing-opentelemetry = "0.17.3" quaint.workspace = true +cuid = { git = "https://github.com/prisma/cuid-rust", branch = "wasm32-support" } [dependencies.connector-interface] package = "query-connector" @@ -44,9 +45,6 @@ version = "0.4" features = ["derive"] version = "1.0" -[dependencies.cuid] -version = "1.2" - [dependencies.user-facing-errors] features = ["sql"] path = "../../../libs/user-facing-errors" diff --git a/query-engine/core/Cargo.toml b/query-engine/core/Cargo.toml index c9700bb85f19..caadf6cdba00 100644 --- a/query-engine/core/Cargo.toml +++ b/query-engine/core/Cargo.toml @@ -29,7 +29,7 @@ tracing-subscriber = { version = "0.3", features = ["env-filter"] } tracing-opentelemetry = "0.17.4" user-facing-errors = { path = "../../libs/user-facing-errors" } uuid = "1" -cuid = "1.2" +cuid = { git = "https://github.com/prisma/cuid-rust", branch = "wasm32-support" } schema = { path = "../schema" } lru = "0.7.7" enumflags2 = "0.7" diff --git a/query-engine/dmmf/Cargo.toml b/query-engine/dmmf/Cargo.toml index f4a8bfb6e6f2..cc92c914d4e6 100644 --- a/query-engine/dmmf/Cargo.toml +++ b/query-engine/dmmf/Cargo.toml @@ -10,7 +10,7 @@ serde.workspace = true serde_json.workspace = true schema = { path = "../schema" } indexmap = { version = "1.7", features = ["serde-1"] } -prisma-models = { path = "../prisma-models" } +prisma-models = { path = "../prisma-models", features = ["default_generators"] } [dev-dependencies] expect-test = "1.2.2" diff --git a/query-engine/prisma-models/Cargo.toml b/query-engine/prisma-models/Cargo.toml index c7e012afebfb..0becd1fdea70 100644 --- a/query-engine/prisma-models/Cargo.toml +++ b/query-engine/prisma-models/Cargo.toml @@ -10,13 +10,16 @@ prisma-value = { path = "../../libs/prisma-value" } bigdecimal = "0.3" thiserror = "1.0" +getrandom = { version = "0.2" } uuid = { workspace = true, optional = true } -cuid = { version = "1.2", optional = true } +cuid = { git = "https://github.com/prisma/cuid-rust", branch = "wasm32-support", optional = true } nanoid = { version = "0.4.0", optional = true } chrono = { version = "0.4.6", features = ["serde"] } +[target.'cfg(target_arch = "wasm32")'.dependencies.getrandom] +version = "0.2" +features = ["js"] + [features] -# Support for generating default UUID, CUID, nanoid and datetime values. This -# implies random number generation works, so it won't compile on targets like -# wasm32. +# Support for generating default UUID, CUID, nanoid and datetime values. default_generators = ["uuid/v4", "cuid", "nanoid"]