diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 35e2b176..ada2cdbf 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -17,6 +17,14 @@ updates: prefix-development: "chore(deps-dev)" rebase-strategy: "auto" versioning-strategy: "auto" + # Elide is bumped by hand: a new revision usually needs code changes, and + # elide-pipeline must move with the elide revision it was built against. + ignore: + - dependency-name: "elide" + - dependency-name: "elide-*" + # A dependency joins the first group it matches, so minor and patch updates + # land in rust-dependencies, and a major update joins the family it has to + # move with (crates that share a trait or type version across the family). groups: rust-dependencies: patterns: @@ -24,6 +32,45 @@ updates: update-types: - "minor" - "patch" + # jiff-diesel ties jiff to diesel, so the two families share a group. + diesel: + patterns: + - "diesel" + - "diesel_migrations" + - "diesel-async" + - "deadpool" + - "pgtrgm" + - "jiff" + - "jiff-diesel" + update-types: + - "major" + axum: + patterns: + - "axum" + - "axum-*" + - "aide" + - "tower" + - "tower-http" + - "http" + - "http-body" + update-types: + - "major" + reqwest: + patterns: + - "reqwest" + - "reqwest-*" + update-types: + - "major" + crypto: + patterns: + - "sha2" + - "hmac" + - "hkdf" + - "chacha20poly1305" + - "aead-stream" + - "argon2" + update-types: + - "major" # Version updates for GitHub Actions - package-ecosystem: "github-actions" diff --git a/Cargo.lock b/Cargo.lock index 1606ebb6..f4cf414c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -54,13 +54,12 @@ dependencies = [ [[package]] name = "ahash" -version = "0.8.13" +version = "0.8.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fca89247609239eeb6915e6991111866b92d7b31025e69302bbf430cc4d2c38" +checksum = "3019c0b8d883a8a17df3129e417ef463c087807d245e8881a31d583dee1c0519" dependencies = [ "cfg-if", "const-random", - "getrandom 0.3.4", "getrandom 0.4.3", "once_cell", "serde", @@ -162,9 +161,9 @@ dependencies = [ [[package]] name = "allocator-api2" -version = "0.2.21" +version = "0.2.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" +checksum = "57b212daf2e827b1ccdd778b7eb48ba433e58cb0e4f27b43cd6b7a608425a014" [[package]] name = "android_system_properties" @@ -211,7 +210,7 @@ version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" dependencies = [ - "windows-sys 0.60.2", + "windows-sys 0.61.2", ] [[package]] @@ -222,7 +221,7 @@ checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" dependencies = [ "anstyle", "once_cell_polyfill", - "windows-sys 0.60.2", + "windows-sys 0.61.2", ] [[package]] @@ -286,9 +285,9 @@ checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb" [[package]] name = "arrayvec" -version = "0.7.8" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3fb67a6e08acf24fdeccbac2cb6ac4305825bd1f117462e0e6f2f193345ad56" +checksum = "47a64a0fd06e123e9e3cf3ad01432af17dcab8185e8023edcf184fe696f9675d" [[package]] name = "arrow" @@ -1064,14 +1063,14 @@ dependencies = [ [[package]] name = "blake3" -version = "1.8.7" +version = "1.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d9e454fc11f76977dc803893aff6304ed33d6a26efae8696573bea74baa27ae" +checksum = "64c0e36294adc8db531500e3f2b8ec75c4af9177271e9c6d33f93609d56e57cd" dependencies = [ "arrayvec", "cc", "cfg-if", - "constant_time_eq 0.4.2", + "constant_time_eq", "cpufeatures 0.3.1", ] @@ -1195,7 +1194,7 @@ checksum = "9071f285ed78f04f37d675abaaef5de7689e2f30a216c8dc6795465d81910a13" dependencies = [ "alloc-no-stdlib 3.0.0", "alloc-stdlib 0.3.0", - "brotli-decompressor 6.4.0", + "brotli-decompressor 6.4.1", ] [[package]] @@ -1210,9 +1209,9 @@ dependencies = [ [[package]] name = "brotli-decompressor" -version = "6.4.0" +version = "6.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "664148598c930650998ef56df301329ffe7b4cdb02d49b2a3fca3bcaf2185bcb" +checksum = "50986a054f56ca3e15382f3c09abee2bf494c00311b238daae118a06bc1c15f1" dependencies = [ "alloc-no-stdlib 3.0.0", "alloc-stdlib 0.3.0", @@ -1330,9 +1329,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.11.3" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02f0e023adb368345ce0ca6cdfc0f24a06554468d0e8503e14a0841de79bfa69" +checksum = "95e45cf2980b2d467be49a9ed942c9179b701063a7ca3d037de7ee9bd67f8d66" dependencies = [ "find-msvc-tools", "jobserver", @@ -1626,15 +1625,9 @@ dependencies = [ [[package]] name = "constant_time_eq" -version = "0.4.2" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d52eff69cd5e647efe296129160853a42795992097e8af39800e1060caeea9b" - -[[package]] -name = "constant_time_eq" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9eb6feb175df65d0a3ccd3e73484e940d0ac664e8034f0519fd49a93db3071d9" +checksum = "144e7f1de087984240b7816d47f698b414979faa6f40839c5b86d6bd47db57b7" dependencies = [ "rustversion", ] @@ -1775,9 +1768,9 @@ checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b" [[package]] name = "croner" -version = "5.0.0" +version = "5.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c0d18af839fad650d1673db4e2e40cfad3288dcb84a13670a9014e8d0978008" +checksum = "ecc2cf2521b1ad228da5c87b135855eb146b4aed7a2da389afc682c540e5d515" dependencies = [ "chrono", "jiff 1.0.3", @@ -2883,18 +2876,6 @@ dependencies = [ "tokio-postgres", ] -[[package]] -name = "diesel-derive-enum" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81c5131a2895ef64741dad1d483f358c2a229a3a2d1b256778cdc5e146db64d4" -dependencies = [ - "heck 0.4.1", - "proc-macro2", - "quote", - "syn 2.0.119", -] - [[package]] name = "diesel_attribute_parser" version = "0.1.0" @@ -2988,7 +2969,7 @@ dependencies = [ "libc", "option-ext", "redox_users", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -3116,7 +3097,7 @@ dependencies = [ "curve25519-dalek 5.1.0", "ed25519 3.0.0", "serde", - "sha2 0.11.1", + "sha2 0.11.3", "signature 3.0.0", "subtle", "zeroize", @@ -3543,7 +3524,7 @@ dependencies = [ "jiff 1.0.3", "schemars 1.2.3", "serde", - "sha2 0.11.1", + "sha2 0.11.3", "tracing", "uuid", "zeroize", @@ -3724,7 +3705,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e35d6e78f4cebb90e51d543db8fe41528851d6deeef6ef21ebd4bfdc1e784776" dependencies = [ "libc", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -3839,9 +3820,9 @@ checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" [[package]] name = "fancy-regex" -version = "0.18.0" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1e1dacd0d2082dfcf1351c4bdd566bbe89a2b263235a2b50058f1e130a47277" +checksum = "0a2e16b9a584b602f1e0e5e22c30ca0906786088c27500653e432d086def8b53" dependencies = [ "bit-set", "regex-automata", @@ -3930,9 +3911,9 @@ checksum = "64cd1e32ddd350061ae6edb1b082d7c54915b5c672c389143b9a63403a109f24" [[package]] name = "find-msvc-tools" -version = "0.1.15" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c66915cc5391097de7a2b0b972e8505aa33c0df401fd3a6811dbdb32881ba48" +checksum = "3e44f110d1777dc6559a51e7d45083945ded4f1bf3305494350f693b6d20b9c8" [[package]] name = "fixedbitset" @@ -4164,14 +4145,12 @@ dependencies = [ [[package]] name = "generator" -version = "0.8.12" +version = "0.8.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea6c6a73cd1aa4f4f00c02b109fa55d3a9d6ecc2fc4f53177b74ed6ee23b0c53" +checksum = "66831419d9074e766421508dff218bf79d99616bc5e56e34599d3b433714a4a4" dependencies = [ - "cc", "libc", "log", - "rustversion", "windows-core 0.100.0", "windows-sys 0.61.2", ] @@ -4485,9 +4464,9 @@ dependencies = [ [[package]] name = "hipstr" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "637f99a632c30b144cb58da2b75a6f7e7f6aa76bf19e5291a154af518fa17aae" +checksum = "0d42596e872057e41dbe529dd9c2ecc77f1cea5a91435b057c45530012f28938" dependencies = [ "loom", "serde", @@ -5006,9 +4985,9 @@ dependencies = [ [[package]] name = "io-uring" -version = "0.7.16" +version = "0.7.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "878c26bc5e45fe089ce2ca25689260c152a87ce1d7de2ca86101efeea6973932" +checksum = "42a8b27af47f173c8ccb750868620435d2afc8190ca314356f9dc29470274123" dependencies = [ "bitflags 2.13.2", "cfg-if", @@ -5017,9 +4996,9 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.12.2" +version = "2.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "791930b43c0d5973160d90a8f3894509f2b273430f5c5c73b668636d0287c5c0" +checksum = "007d6e6b91097094791302ccc6cd0588e0700ddac5c6829035bcd71eff4dc433" dependencies = [ "serde", ] @@ -6168,7 +6147,7 @@ dependencies = [ "nom 8.0.0", "rand 0.10.4", "rangemap", - "sha2 0.11.1", + "sha2 0.11.3", "stringprep", "thiserror 2.0.21", "weezl 0.2.1", @@ -6617,7 +6596,7 @@ version = "0.50.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -6756,7 +6735,7 @@ name = "nvisy-assistant" version = "0.1.0" dependencies = [ "nvisy-core", - "rig 0.47.0", + "rig 0.47.1", "schemars 1.2.3", "serde", "serde_json", @@ -6875,7 +6854,6 @@ dependencies = [ "derive_more", "diesel", "diesel-async", - "diesel-derive-enum", "diesel_migrations", "futures", "ipnet", @@ -6969,7 +6947,7 @@ dependencies = [ "schemars 1.2.3", "serde", "serde_json", - "sha2 0.11.1", + "sha2 0.11.3", "strum 0.28.0", "tempfile", "thiserror 2.0.21", @@ -7000,7 +6978,7 @@ dependencies = [ "schemars 1.2.3", "serde", "serde_json", - "sha2 0.11.1", + "sha2 0.11.3", "tokio", "tracing", "url", @@ -7254,7 +7232,7 @@ dependencies = [ "elliptic-curve", "primefield", "primeorder", - "sha2 0.11.1", + "sha2 0.11.3", ] [[package]] @@ -7268,7 +7246,7 @@ dependencies = [ "fiat-crypto 0.3.0", "primefield", "primeorder", - "sha2 0.11.1", + "sha2 0.11.3", ] [[package]] @@ -7554,7 +7532,7 @@ dependencies = [ "regex-cache", "serde", "serde_derive", - "strum 0.26.3", + "strum 0.27.2", "thiserror 2.0.21", ] @@ -7697,7 +7675,7 @@ dependencies = [ "md-5 0.11.0", "memchr", "rand 0.10.4", - "sha2 0.11.1", + "sha2 0.11.3", "stringprep", ] @@ -7738,9 +7716,9 @@ dependencies = [ [[package]] name = "pq-sys" -version = "0.7.9" +version = "0.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3bc77e8957fcd07d9768dc26486b07e39339693e21d3c5564be908ef6911540" +checksum = "f334fec535bd34b8d39b7881dbcff395ccc2c287765a6a99b94354f75cf18751" dependencies = [ "libc", "pkg-config", @@ -8005,7 +7983,7 @@ dependencies = [ "once_cell", "socket2", "tracing", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -8571,19 +8549,19 @@ dependencies = [ [[package]] name = "rig" -version = "0.47.0" +version = "0.47.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd069b759ade994670fe523be7ef8d10367be387fe848e5c39e8228e2a912bf1" +checksum = "8400c238ea633780bdd0f960eece8863f67e8d45fc01fa9048519447740cc18e" dependencies = [ - "rig-agent 0.47.0", - "rig-cassette 0.47.0", - "rig-core 0.47.0", - "rig-derive 0.47.0", + "rig-agent 0.47.1", + "rig-cassette 0.47.1", + "rig-core 0.47.1", + "rig-derive 0.47.1", "rig-fastembed", "rig-helixdb", "rig-lancedb", "rig-milvus", - "rig-reqwest 0.47.0", + "rig-reqwest 0.47.1", "rig-tungstenite", "rig-typesafeai", "rig-vectorize", @@ -8612,17 +8590,17 @@ dependencies = [ [[package]] name = "rig-agent" -version = "0.47.0" +version = "0.47.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea6b192f9c616fdf289a63419142d9322bd66a3336a4f64f9253064e36f7f3e1" +checksum = "e6ee4a0b71d70a127ee16d53330f3990579de37fb32aaf6c27a5c349f45e3a40" dependencies = [ "async-stream", "futures", "http", "indexmap 2.14.2", - "rig-core 0.47.0", - "rig-derive 0.47.0", - "rig-memory 0.47.0", + "rig-core 0.47.1", + "rig-derive 0.47.1", + "rig-memory 0.47.1", "schemars 1.2.3", "serde", "serde_json", @@ -8647,14 +8625,14 @@ dependencies = [ [[package]] name = "rig-cassette" -version = "0.47.0" +version = "0.47.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06b049dc8e86e018fd31950ef5fb64ce2cff560cb6d74262892e2664f84418b2" +checksum = "f599e922761871fba733234fa3e7d6ce2494e0330cdc19b1ba80d67f92d163c6" dependencies = [ "base64 0.23.1", "futures", - "rig-agent 0.47.0", - "rig-core 0.47.0", + "rig-agent 0.47.1", + "rig-core 0.47.1", "serde", "serde_json", ] @@ -8693,9 +8671,9 @@ dependencies = [ [[package]] name = "rig-core" -version = "0.47.0" +version = "0.47.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5b60ad1761accbb5ef3ef97a038903345d60768d7a5a5a09e01e16dfac0f699" +checksum = "8ea12b6d2a5d2591192636d30af2981ce180b45204e19b7f14ce1347215603c8" dependencies = [ "async-stream", "base64 0.23.1", @@ -8709,15 +8687,15 @@ dependencies = [ "mime", "mime_guess", "ordered-float 5.5.1", - "rig-derive 0.47.0", - "rig-http 0.47.0", - "rig-reqwest 0.47.0", + "rig-derive 0.47.1", + "rig-http 0.47.1", + "rig-reqwest 0.47.1", "rig-tungstenite", "schemars 1.2.3", "serde", "serde_json", "serde_path_to_error", - "sha2 0.11.1", + "sha2 0.11.3", "thiserror 2.0.21", "tracing", "url", @@ -8740,9 +8718,9 @@ dependencies = [ [[package]] name = "rig-derive" -version = "0.47.0" +version = "0.47.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8d640289fad26c93ba4d3f8cf329f27518269a1ceac1213282e87c7e0ef6f6f" +checksum = "44c6574c1c31b6700e6030cee43bdb63eff9b9d555e1b1be3eb571bdc40f5c39" dependencies = [ "convert_case 0.11.0", "proc-macro-crate", @@ -8753,13 +8731,13 @@ dependencies = [ [[package]] name = "rig-fastembed" -version = "0.47.0" +version = "0.47.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0b25fbfc9ca8862489c83e5df59ed5b075b3348e37c3a134729ad20fc34cb41" +checksum = "d5843da4eedc8234fca4aac9c2341ab0121c0318cdcc0303061488378ebc18c2" dependencies = [ "fastembed", "futures", - "rig-core 0.47.0", + "rig-core 0.47.1", ] [[package]] @@ -8770,12 +8748,12 @@ checksum = "983eb19c87bf95dc134163e0c003be8f38b393cdfb18917fafe3baa63d82301c" [[package]] name = "rig-helixdb" -version = "0.47.0" +version = "0.47.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4620a7b6cbcd3930351aeabb64ceb19f18b9ba280409a2dbe552c6f058a1684" +checksum = "691a8970917f7754280f39b8e24a99a8ae84b526d1683cdda365e944cc6c34bf" dependencies = [ "reqwest 0.13.5", - "rig-core 0.47.0", + "rig-core 0.47.1", "serde", "serde_json", "thiserror 2.0.21", @@ -8799,9 +8777,9 @@ dependencies = [ [[package]] name = "rig-http" -version = "0.47.0" +version = "0.47.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "041fa0a6e1d1236cbc502516e3fa71ac3dddbd91c3594a81436c6bee9c8acc41" +checksum = "06e3c63862bb7f08460f95815ee82dc883a59409883c4e60aa19ade0556864a8" dependencies = [ "bytes", "futures", @@ -8815,15 +8793,15 @@ dependencies = [ [[package]] name = "rig-lancedb" -version = "0.47.0" +version = "0.47.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9958c3864fef783dcea21d0abdeed30a2fe3029c11c71b684ba8e340409bdd71" +checksum = "083181de58a0a70327e09150abdde96a94e59cd2b2383031b8ad8eacc229930e" dependencies = [ "arrow-array", "arrow-json", "futures", "lancedb", - "rig-core 0.47.0", + "rig-core 0.47.1", "serde", "serde_json", ] @@ -8845,13 +8823,13 @@ dependencies = [ [[package]] name = "rig-memory" -version = "0.47.0" +version = "0.47.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2f13b53e3b513ebd44e9cb9faf897d3792ec312751052e6788e5f4af7735114" +checksum = "0a29509f0a89f4f865ecaee6296c8ff48fc39ff23ad0769515f95ea65ca0bb7e" dependencies = [ "base64 0.23.1", "memchr", - "rig-core 0.47.0", + "rig-core 0.47.1", "serde", "serde_json", "thiserror 2.0.21", @@ -8859,13 +8837,13 @@ dependencies = [ [[package]] name = "rig-milvus" -version = "0.47.0" +version = "0.47.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3558173091ec6b768c3f3a27c63a69c3b1e34a7d849d2d1972e40232e861fa0b" +checksum = "4ac843b4f1421bbaf06c45c8f90a75b3c61850ab653df01d008cc0fb187574f5" dependencies = [ "reqwest 0.13.5", - "rig-core 0.47.0", - "rig-reqwest 0.47.0", + "rig-core 0.47.1", + "rig-reqwest 0.47.1", "serde", "serde_json", ] @@ -8890,15 +8868,15 @@ dependencies = [ [[package]] name = "rig-reqwest" -version = "0.47.0" +version = "0.47.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dab589224b5831dba19bc22784cd083aa5b7424d7068db515e631878da6f5309" +checksum = "aac938aaebb4c0ab051444da7846c128fec2648c82826dd938ee2af02fbc1963" dependencies = [ "bytes", "futures", "http", "reqwest 0.13.5", - "rig-http 0.47.0", + "rig-http 0.47.1", "thiserror 2.0.21", "tracing", "url", @@ -8907,12 +8885,12 @@ dependencies = [ [[package]] name = "rig-tungstenite" -version = "0.47.0" +version = "0.47.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13cbbd312d5646eb98e129ee39b8bca6adaa5b216f4643dda0e3c18d5fe4dd1c" +checksum = "a75c531f43d4f8783c20158337508004853267288a44bd252dfcbdd362187bd7" dependencies = [ "futures", - "rig-http 0.47.0", + "rig-http 0.47.1", "thiserror 2.0.21", "tokio", "tokio-tungstenite", @@ -8920,25 +8898,25 @@ dependencies = [ [[package]] name = "rig-typesafeai" -version = "0.47.0" +version = "0.47.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "371f6806eca9c2008f3813d3a0bbdf7513f910aab65501370fe6945bff1133e8" +checksum = "c1a1117e7d9f3f3ba9fe79f8f502851b27aa3262dcbd452fb077cacbafe0cd37" dependencies = [ "http", - "rig-core 0.47.0", - "rig-reqwest 0.47.0", + "rig-core 0.47.1", + "rig-reqwest 0.47.1", "serde", "serde_json", ] [[package]] name = "rig-vectorize" -version = "0.47.0" +version = "0.47.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f36c0e239763a3a0f9f0041c84cc814dd74a1aae039c969b14c7c60a3e3af3b" +checksum = "b8d49b0d842fe698b3ecc12aa07be09f3340eb0f6dc4f4e1cd103fa4f8a7d02d" dependencies = [ "reqwest 0.13.5", - "rig-core 0.47.0", + "rig-core 0.47.1", "serde", "serde_json", "thiserror 2.0.21", @@ -9070,7 +9048,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -9129,7 +9107,7 @@ dependencies = [ "security-framework", "security-framework-sys", "webpki-root-certs", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -9554,9 +9532,9 @@ dependencies = [ [[package]] name = "sha2" -version = "0.11.1" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47d7069beb7d6ac7b9acd1039986e73443f24234f41074da099d6f994ac9ad19" +checksum = "820083d430c52864bf834423fc988cbcf61685d6f9d22a765a64e3f6cfe3521c" dependencies = [ "cfg-if", "cpufeatures 0.3.1", @@ -9749,7 +9727,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4" dependencies = [ "libc", - "windows-sys 0.60.2", + "windows-sys 0.61.2", ] [[package]] @@ -9915,6 +9893,9 @@ name = "strum" version = "0.27.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af23d6f6c1a224baef9d3f61e287d2761385a5b88fdab4eb4c6f11aeb54c4bcf" +dependencies = [ + "strum_macros 0.27.2", +] [[package]] name = "strum" @@ -10141,10 +10122,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" dependencies = [ "fastrand", - "getrandom 0.3.4", + "getrandom 0.4.3", "once_cell", "rustix", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -10476,9 +10457,9 @@ dependencies = [ [[package]] name = "toml" -version = "1.2.2+spec-1.1.0" +version = "1.2.3+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5426cb1b964690d913f6c5c1a1ae0b42f428ec506bb4d452876d7a209c9bca3b" +checksum = "26b1f26e9485c1fa43ee89fe76e9f3fb9e2e52bb227f8594b4d687496b83d073" dependencies = [ "indexmap 2.14.2", "serde_core", @@ -10500,9 +10481,9 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.25.20+spec-1.1.0" +version = "0.25.21+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e76360e201d6dbd6583e17795ba71a88f47365a9139c8450a7979c32303b8e73" +checksum = "88497dab46de5bf343ec66b05c251e48c6213f3e9170c70a70a823f7abe886a4" dependencies = [ "indexmap 2.14.2", "toml_datetime", @@ -10512,9 +10493,9 @@ dependencies = [ [[package]] name = "toml_parser" -version = "1.1.6+spec-1.1.0" +version = "1.1.7+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6769c452d71ba30696c6b37770c439a9cc9110f47f7d5cdbeda79840ef5ea31" +checksum = "0bb28d6e049a9766c3bd91a8326e6179f5b132dec87906bb97018ef7a2f3431a" dependencies = [ "winnow", ] @@ -11309,7 +11290,7 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -11717,18 +11698,18 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.8.65" +version = "0.8.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32bc8a75f879cd6fe53a6bedf3c28f0e1b914c77424fc2be9e2ec85d7d25aff5" +checksum = "cba8a86aee14fc8cc6c208af60854b3d4ab7185a9a369a12c648faa2716ff42a" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.65" +version = "0.8.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8bfd2644ea1681f60cf95029ff18aa8ad1cc3f7b8fe37286f8e473bb29f816b" +checksum = "f89bca3b96ceb3cfcb4572790402f977442270d252b9a8504ebc258760c55f94" dependencies = [ "proc-macro2", "quote", @@ -11811,11 +11792,11 @@ dependencies = [ [[package]] name = "zip" -version = "9.8.2" +version = "9.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d8dbe089cf6b0448b78f5fc50139ab5aaa40d08ac07cdc1baf2c13add35fcce" +checksum = "07db37dec4a7c468df4723fba4cadb4822d1d0f10dbea367100b6a6881b2a9c9" dependencies = [ - "constant_time_eq 0.6.1", + "constant_time_eq", "crc32fast", "flate2", "getrandom 0.4.3", @@ -11824,7 +11805,7 @@ dependencies = [ "memchr", "nix", "typed-path", - "windows-sys 0.60.2", + "windows-sys 0.61.2", "zeroize", "zopfli", ] @@ -11901,9 +11882,9 @@ dependencies = [ [[package]] name = "zune-core" -version = "0.5.3" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d56377fd46368984a170bc5aac5567e52ca5da874caa60bea39fcbca78fb658b" +checksum = "c1a65ee146f41cb456b005bc898af3ab1495ded4ee61ac3637103f40ccacac18" [[package]] name = "zune-inflate" @@ -11925,14 +11906,13 @@ dependencies = [ [[package]] name = "zxcvbn" -version = "3.1.1" +version = "3.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9eaee90f4a795d1eb4ba6c51e1c1721d4784d550e8efa7b2600f29c867365e0" +checksum = "9a4c3078ad169d1dd76ffb4558d0ab04fe8768eccd85e58a4b691103f9950a56" dependencies = [ - "chrono", "derive_builder", "fancy-regex", - "itertools 0.14.0", + "itertools 0.15.0", "lazy_static", "regex", "serde", diff --git a/Cargo.toml b/Cargo.toml index 89458603..218febe0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -126,7 +126,6 @@ diesel = { version = "2.4", features = [] } diesel_migrations = { version = "2.4", features = [] } diesel-async = { version = "0.10", features = [] } jiff-diesel = { version = "0.1.4", features = [] } -diesel-derive-enum = { version = "2.1", features = [] } deadpool = { version = "0.13", features = [] } pgtrgm = { version = "0.5", features = [] } diff --git a/Makefile b/Makefile index 0e065805..ec787dc9 100644 --- a/Makefile +++ b/Makefile @@ -8,6 +8,11 @@ endif # PostgreSQL connection URL for diesel CLI. POSTGRES_URL ?= postgresql://postgres:postgres@localhost:5432/postgres +# Diesel CLI version. `print-schema` output depends on it (2.4 marks Postgres +# enum types `#[diesel(enum_type)]`, which the enum derives need), so everyone +# regenerates the schema with the same one. +DIESEL_CLI_VERSION = 2.4.0 + # Generated database schema file (produced by `diesel print-schema`). SCHEMA_OUTPUT = ./crates/nvisy-postgres/src/schema.rs @@ -29,20 +34,24 @@ help: ## Lists the available commands. | sort \ | awk 'BEGIN {FS = ":.*?## "} {printf " \033[36m%-22s\033[0m %s\n", $$1, $$2}' -.PHONY: Install-tools +.PHONY: install-tools install-tools: # Installs tools required for the repo. @$(call log,Checking Diesel CLI...) - @if ! command -v diesel >/dev/null 2>&1; then \ - $(call log,Installing Diesel CLI with PostgreSQL support...); \ - cargo install diesel_cli --no-default-features --features postgres --locked; \ + @installed=$$(diesel --version 2>/dev/null | awk '/Version:/ {print $$2}'); \ + if [ "$$installed" != "$(DIESEL_CLI_VERSION)" ] || ! diesel --version | grep -q postgres; then \ + $(call log,Installing Diesel CLI $(DIESEL_CLI_VERSION) with PostgreSQL support (found: $${installed:-none})...); \ + cargo install diesel_cli --version $(DIESEL_CLI_VERSION) --no-default-features --features postgres --locked --force || exit 1; \ $(call log,Diesel CLI installed successfully.); \ else \ - $(call log,Diesel CLI already available: $$(diesel --version)); \ - $(call log,Verifying PostgreSQL support...); \ - if ! diesel --version | grep -q postgres; then \ - $(call log,Reinstalling Diesel CLI with PostgreSQL support...); \ - cargo install diesel_cli --no-default-features --features postgres --locked --force; \ - fi; \ + $(call log,Diesel CLI $(DIESEL_CLI_VERSION) already available.); \ + fi + +.PHONY: check-diesel +check-diesel: + @installed=$$(diesel --version 2>/dev/null | awk '/Version:/ {print $$2}'); \ + if [ "$$installed" != "$(DIESEL_CLI_VERSION)" ]; then \ + $(call log,Diesel CLI $(DIESEL_CLI_VERSION) is required (found: $${installed:-none}). Run make install-tools.); \ + exit 1; \ fi .PHONY: install-all @@ -79,7 +88,7 @@ generate-keys: ## Generates auth key pair and encryption key. @$(call log,Encryption key generated successfully.) .PHONY: generate-migrations -generate-migrations: ## Regenerates the Postgres migrations and database schema. +generate-migrations: check-diesel ## Regenerates the Postgres migrations and database schema. @$(call log,Deleting a generated database schema file...) @rm -f $(SCHEMA_OUTPUT) @$(call log,Database schema file deleted.) @@ -91,7 +100,7 @@ generate-migrations: ## Regenerates the Postgres migrations and database schema. @$(call log,Schema updated successfully in $(SCHEMA_OUTPUT)) .PHONY: clear-migrations -clear-migrations: ## Reverts all database migrations. +clear-migrations: check-diesel ## Reverts all database migrations. @$(call log,Reverting all migrations...) @while DATABASE_URL=$(POSTGRES_URL) diesel migration list | grep -q "\\[X\\]"; do \ $(call log,Reverting migration...); \ diff --git a/crates/nvisy-postgres/Cargo.toml b/crates/nvisy-postgres/Cargo.toml index ce25f10e..639ad643 100644 --- a/crates/nvisy-postgres/Cargo.toml +++ b/crates/nvisy-postgres/Cargo.toml @@ -63,7 +63,6 @@ base64 = { workspace = true, features = [] } diesel = { workspace = true, features = ["postgres", "uuid", "ipnet-address", "serde_json", "numeric", "64-column-tables"] } diesel_migrations = { workspace = true, features = ["postgres"] } diesel-async = { workspace = true, features = ["postgres", "pool", "deadpool", "async-connection-wrapper"] } -diesel-derive-enum = { workspace = true, features = ["postgres"] } deadpool = { workspace = true, features = ["rt_tokio_1"] } pgtrgm = { workspace = true, features = ["diesel"] } jiff-diesel = { workspace = true, features = ["postgres"] } diff --git a/crates/nvisy-postgres/src/schema.rs b/crates/nvisy-postgres/src/schema.rs index f082143b..d14ebfdc 100644 --- a/crates/nvisy-postgres/src/schema.rs +++ b/crates/nvisy-postgres/src/schema.rs @@ -1,84 +1,104 @@ // @generated automatically by Diesel CLI. pub mod sql_types { - #[derive(diesel::query_builder::QueryId, diesel::sql_types::SqlType)] + #[derive(Clone, diesel::query_builder::QueryId, diesel::sql_types::SqlType)] #[diesel(postgres_type(name = "activity_type"))] + #[diesel(enum_type)] pub struct ActivityType; - #[derive(diesel::query_builder::QueryId, diesel::sql_types::SqlType)] + #[derive(Clone, diesel::query_builder::QueryId, diesel::sql_types::SqlType)] #[diesel(postgres_type(name = "api_token_type"))] + #[diesel(enum_type)] pub struct ApiTokenType; - #[derive(diesel::query_builder::QueryId, diesel::sql_types::SqlType)] + #[derive(Clone, diesel::query_builder::QueryId, diesel::sql_types::SqlType)] #[diesel(postgres_type(name = "connection_type"))] + #[diesel(enum_type)] pub struct ConnectionType; - #[derive(diesel::query_builder::QueryId, diesel::sql_types::SqlType)] + #[derive(Clone, diesel::query_builder::QueryId, diesel::sql_types::SqlType)] #[diesel(postgres_type(name = "detection_status"))] + #[diesel(enum_type)] pub struct DetectionStatus; - #[derive(diesel::query_builder::QueryId, diesel::sql_types::SqlType)] + #[derive(Clone, diesel::query_builder::QueryId, diesel::sql_types::SqlType)] #[diesel(postgres_type(name = "document_kind"))] + #[diesel(enum_type)] pub struct DocumentKind; - #[derive(diesel::query_builder::QueryId, diesel::sql_types::SqlType)] + #[derive(Clone, diesel::query_builder::QueryId, diesel::sql_types::SqlType)] #[diesel(postgres_type(name = "identity_provider"))] + #[diesel(enum_type)] pub struct IdentityProvider; - #[derive(diesel::query_builder::QueryId, diesel::sql_types::SqlType)] + #[derive(Clone, diesel::query_builder::QueryId, diesel::sql_types::SqlType)] #[diesel(postgres_type(name = "invite_status"))] + #[diesel(enum_type)] pub struct InviteStatus; - #[derive(diesel::query_builder::QueryId, diesel::sql_types::SqlType)] + #[derive(Clone, diesel::query_builder::QueryId, diesel::sql_types::SqlType)] #[diesel(postgres_type(name = "notification_event"))] + #[diesel(enum_type)] pub struct NotificationEvent; - #[derive(diesel::query_builder::QueryId, diesel::sql_types::SqlType)] + #[derive(Clone, diesel::query_builder::QueryId, diesel::sql_types::SqlType)] #[diesel(postgres_type(name = "outbox_status"))] + #[diesel(enum_type)] pub struct OutboxStatus; - #[derive(diesel::query_builder::QueryId, diesel::sql_types::SqlType)] + #[derive(Clone, diesel::query_builder::QueryId, diesel::sql_types::SqlType)] #[diesel(postgres_type(name = "policy_kind"))] + #[diesel(enum_type)] pub struct PolicyKind; - #[derive(diesel::query_builder::QueryId, diesel::sql_types::SqlType)] + #[derive(Clone, diesel::query_builder::QueryId, diesel::sql_types::SqlType)] #[diesel(postgres_type(name = "provider_type"))] + #[diesel(enum_type)] pub struct ProviderType; - #[derive(diesel::query_builder::QueryId, diesel::sql_types::SqlType)] + #[derive(Clone, diesel::query_builder::QueryId, diesel::sql_types::SqlType)] #[diesel(postgres_type(name = "review_event_kind"))] + #[diesel(enum_type)] pub struct ReviewEventKind; - #[derive(diesel::query_builder::QueryId, diesel::sql_types::SqlType)] + #[derive(Clone, diesel::query_builder::QueryId, diesel::sql_types::SqlType)] #[diesel(postgres_type(name = "review_status"))] + #[diesel(enum_type)] pub struct ReviewStatus; - #[derive(diesel::query_builder::QueryId, diesel::sql_types::SqlType)] + #[derive(Clone, diesel::query_builder::QueryId, diesel::sql_types::SqlType)] #[diesel(postgres_type(name = "sync_deletion_policy"))] + #[diesel(enum_type)] pub struct SyncDeletionPolicy; - #[derive(diesel::query_builder::QueryId, diesel::sql_types::SqlType)] + #[derive(Clone, diesel::query_builder::QueryId, diesel::sql_types::SqlType)] #[diesel(postgres_type(name = "sync_mode"))] + #[diesel(enum_type)] pub struct SyncMode; - #[derive(diesel::query_builder::QueryId, diesel::sql_types::SqlType)] + #[derive(Clone, diesel::query_builder::QueryId, diesel::sql_types::SqlType)] #[diesel(postgres_type(name = "sync_status"))] + #[diesel(enum_type)] pub struct SyncStatus; - #[derive(diesel::query_builder::QueryId, diesel::sql_types::SqlType)] + #[derive(Clone, diesel::query_builder::QueryId, diesel::sql_types::SqlType)] #[diesel(postgres_type(name = "sync_trigger_type"))] + #[diesel(enum_type)] pub struct SyncTriggerType; - #[derive(diesel::query_builder::QueryId, diesel::sql_types::SqlType)] + #[derive(Clone, diesel::query_builder::QueryId, diesel::sql_types::SqlType)] #[diesel(postgres_type(name = "webhook_event"))] + #[diesel(enum_type)] pub struct WebhookEvent; - #[derive(diesel::query_builder::QueryId, diesel::sql_types::SqlType)] + #[derive(Clone, diesel::query_builder::QueryId, diesel::sql_types::SqlType)] #[diesel(postgres_type(name = "webhook_status"))] + #[diesel(enum_type)] pub struct WebhookStatus; - #[derive(diesel::query_builder::QueryId, diesel::sql_types::SqlType)] + #[derive(Clone, diesel::query_builder::QueryId, diesel::sql_types::SqlType)] #[diesel(postgres_type(name = "workspace_role"))] + #[diesel(enum_type)] pub struct WorkspaceRole; } diff --git a/crates/nvisy-postgres/src/types/enums/activity_type.rs b/crates/nvisy-postgres/src/types/enums/activity_type.rs index 70abafec..27ccc929 100644 --- a/crates/nvisy-postgres/src/types/enums/activity_type.rs +++ b/crates/nvisy-postgres/src/types/enums/activity_type.rs @@ -7,7 +7,7 @@ db_enum! { /// /// Corresponds to the `ACTIVITY_TYPE` `PostgreSQL` enum and categorizes the /// activities that occur within workspaces for a comprehensive audit trail. - pub enum ActivityType = "crate::schema::sql_types::ActivityType" { + pub enum ActivityType { /// Workspace was created. WorkspaceCreated = "workspace.created", /// Workspace settings or metadata were updated. diff --git a/crates/nvisy-postgres/src/types/enums/api_token_type.rs b/crates/nvisy-postgres/src/types/enums/api_token_type.rs index e82bfde5..8716775c 100644 --- a/crates/nvisy-postgres/src/types/enums/api_token_type.rs +++ b/crates/nvisy-postgres/src/types/enums/api_token_type.rs @@ -7,7 +7,7 @@ db_enum! { /// /// Corresponds to the `API_TOKEN_TYPE` `PostgreSQL` enum and categorizes tokens /// by the client type they authenticate. - pub enum ApiTokenType: Default = Web, "crate::schema::sql_types::ApiTokenType" { + pub enum ApiTokenType: Default = Web { /// Web browser token (desktop or mobile browser). Web = "web", /// API client token (programmatic access). diff --git a/crates/nvisy-postgres/src/types/enums/connection_type.rs b/crates/nvisy-postgres/src/types/enums/connection_type.rs index 3cd8ccc5..d3354b11 100644 --- a/crates/nvisy-postgres/src/types/enums/connection_type.rs +++ b/crates/nvisy-postgres/src/types/enums/connection_type.rs @@ -11,7 +11,7 @@ db_enum! { /// transfer-capable — an object store is enumerable and syncs on a timer; a /// file service transfers on demand. Inference services are a separate /// resource (`workspace_providers`), not a connection. - pub enum ConnectionType = "crate::schema::sql_types::ConnectionType" { + pub enum ConnectionType { /// External object storage (s3, azure, gcs, ...). ObjectStore = "object_store", /// External file service (`google_drive`, dropbox, ...). diff --git a/crates/nvisy-postgres/src/types/enums/detection_status.rs b/crates/nvisy-postgres/src/types/enums/detection_status.rs index c662d558..9ecfd38d 100644 --- a/crates/nvisy-postgres/src/types/enums/detection_status.rs +++ b/crates/nvisy-postgres/src/types/enums/detection_status.rs @@ -10,7 +10,7 @@ db_enum! { /// analyzing), then settles into `Complete` (analysis done, ready to redact) /// or `Failed`. Redaction is a separate, repeatable action over a complete /// detection and does not change this status. - pub enum DetectionStatus: Default = Pending, "crate::schema::sql_types::DetectionStatus" { + pub enum DetectionStatus: Default = Pending { /// Enqueued for detection; no worker has picked it up yet. Pending = "pending", /// A worker is actively analyzing the document. diff --git a/crates/nvisy-postgres/src/types/enums/document_kind.rs b/crates/nvisy-postgres/src/types/enums/document_kind.rs index 4bad24d5..b0169b4f 100644 --- a/crates/nvisy-postgres/src/types/enums/document_kind.rs +++ b/crates/nvisy-postgres/src/types/enums/document_kind.rs @@ -8,7 +8,7 @@ db_enum! { /// Corresponds to the `DOCUMENT_KIND` `PostgreSQL` enum. Machine byproducts /// (detection audits, review audits, enrichment intermediates) are not /// documents — they reference blobs directly from their own tables. - pub enum DocumentKind: Default = Original, "crate::schema::sql_types::DocumentKind" { + pub enum DocumentKind: Default = Original { /// Source document, uploaded or imported. Original = "original", /// Redacted output produced by a redaction. diff --git a/crates/nvisy-postgres/src/types/enums/identity_provider.rs b/crates/nvisy-postgres/src/types/enums/identity_provider.rs index 452b2960..4f504111 100644 --- a/crates/nvisy-postgres/src/types/enums/identity_provider.rs +++ b/crates/nvisy-postgres/src/types/enums/identity_provider.rs @@ -10,7 +10,7 @@ db_enum! { /// the provider's subject claim. /// /// [`Password`]: Self::Password - pub enum IdentityProvider: Default = Password, "crate::schema::sql_types::IdentityProvider" { + pub enum IdentityProvider: Default = Password { /// Local password, stored as an Argon2 hash. Password = "password", /// Google (OIDC). diff --git a/crates/nvisy-postgres/src/types/enums/invite_status.rs b/crates/nvisy-postgres/src/types/enums/invite_status.rs index 68bd152d..6df67bb1 100644 --- a/crates/nvisy-postgres/src/types/enums/invite_status.rs +++ b/crates/nvisy-postgres/src/types/enums/invite_status.rs @@ -7,7 +7,7 @@ db_enum! { /// /// Corresponds to the `INVITE_STATUS` `PostgreSQL` enum and tracks the lifecycle /// of an invitation from creation to resolution. - pub enum InviteStatus: Default = Pending, "crate::schema::sql_types::InviteStatus" { + pub enum InviteStatus: Default = Pending { /// Sent and awaiting a response from the invitee. Pending = "pending", /// Accepted; the member has been added to the workspace. diff --git a/crates/nvisy-postgres/src/types/enums/mod.rs b/crates/nvisy-postgres/src/types/enums/mod.rs index c9510048..69d8f9a0 100644 --- a/crates/nvisy-postgres/src/types/enums/mod.rs +++ b/crates/nvisy-postgres/src/types/enums/mod.rs @@ -58,23 +58,26 @@ pub use workspace_role::WorkspaceRole; /// Defines a `PostgreSQL`-backed enum whose wire form is written once per variant. /// -/// A `DbEnum` needs the same string in three places per variant — `db_rename` -/// (the Postgres label), `serde(rename)` (the JSON tag), and `strum(serialize)` -/// (the `Display`/`FromStr`/`Into<&str>` form) — and nothing enforces that they -/// agree. This macro takes each variant's wire string once (`Variant = "wire"`) -/// and expands it into all three, so they cannot drift. The common derives, the +/// Each variant needs the same string in three places — `diesel(rename)` (the +/// Postgres label), `serde(rename)` (the JSON tag), and `strum(serialize)` (the +/// `Display`/`FromStr`/`Into<&str>` form) — and nothing enforces that they agree. +/// This macro takes each variant's wire string once (`Variant = "wire"`) and +/// expands it into all three, so they cannot drift. The common derives, the /// `schema` feature gate on `JsonSchema`, and doc comments are handled here; /// per-enum methods live in a separate `impl` block as usual. /// -/// Name a default variant in the header (`enum X: Default = "sql" { … }`) to also -/// implement `Default`; omit `: Default` for an enum with no default. The default -/// variant must be one of the variants listed. +/// The enum maps to the SQL type of the same name in `schema::sql_types`, which +/// `diesel print-schema` marks `#[diesel(enum_type)]`. +/// +/// Name a default variant in the header (`enum X: Default = Variant { … }`) to +/// also implement `Default`; omit `: Default` for an enum with no default. The +/// default variant must be one of the variants listed. macro_rules! db_enum { - // The shared enum definition: derives, SQL type path, and each variant with - // its wire string fanned out to db_rename / serde / strum. + // The shared enum definition: derives, SQL type, and each variant with its + // wire string fanned out to diesel / serde / strum. (@define $(#[doc = $enum_doc:literal])* - $vis:vis enum $name:ident = $sql_ty:literal { + $vis:vis enum $name:ident { $( $(#[doc = $var_doc:literal])* $variant:ident = $wire:literal @@ -84,13 +87,13 @@ macro_rules! db_enum { $(#[doc = $enum_doc])* #[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)] #[cfg_attr(feature = "schema", derive(::schemars::JsonSchema))] - #[derive(::serde::Serialize, ::serde::Deserialize, ::diesel_derive_enum::DbEnum)] + #[derive(::serde::Serialize, ::serde::Deserialize, ::diesel::types::Enum)] #[derive(::strum::Display, ::strum::EnumIter, ::strum::EnumString, ::strum::IntoStaticStr)] - #[ExistingTypePath = $sql_ty] + #[diesel(sql_type = crate::schema::sql_types::$name)] $vis enum $name { $( $(#[doc = $var_doc])* - #[db_rename = $wire] + #[diesel(rename = $wire)] #[serde(rename = $wire)] #[strum(serialize = $wire)] $variant, @@ -98,22 +101,13 @@ macro_rules! db_enum { } }; - // No default variant. - ( - $(#[doc = $enum_doc:literal])* - $vis:vis enum $name:ident = $sql_ty:literal { $($body:tt)* } - ) => { - $crate::types::enums::db_enum!(@define - $(#[doc = $enum_doc])* $vis enum $name = $sql_ty { $($body)* }); - }; - // A default variant named in the header, implemented directly. ( $(#[doc = $enum_doc:literal])* - $vis:vis enum $name:ident: Default = $default:ident, $sql_ty:literal { $($body:tt)* } + $vis:vis enum $name:ident: Default = $default:ident { $($body:tt)* } ) => { $crate::types::enums::db_enum!(@define - $(#[doc = $enum_doc])* $vis enum $name = $sql_ty { $($body)* }); + $(#[doc = $enum_doc])* $vis enum $name { $($body)* }); impl Default for $name { fn default() -> Self { @@ -121,5 +115,14 @@ macro_rules! db_enum { } } }; + + // No default variant. + ( + $(#[doc = $enum_doc:literal])* + $vis:vis enum $name:ident { $($body:tt)* } + ) => { + $crate::types::enums::db_enum!(@define + $(#[doc = $enum_doc])* $vis enum $name { $($body)* }); + }; } pub(crate) use db_enum; diff --git a/crates/nvisy-postgres/src/types/enums/notification_event.rs b/crates/nvisy-postgres/src/types/enums/notification_event.rs index d2160660..ddd89e83 100644 --- a/crates/nvisy-postgres/src/types/enums/notification_event.rs +++ b/crates/nvisy-postgres/src/types/enums/notification_event.rs @@ -11,7 +11,7 @@ db_enum! { /// channels share. /// /// [`WebhookEvent`]: super::WebhookEvent - pub enum NotificationEvent = "crate::schema::sql_types::NotificationEvent" { + pub enum NotificationEvent { /// A new member joined a workspace. MemberJoined = "member.joined", /// A connection sync completed. diff --git a/crates/nvisy-postgres/src/types/enums/outbox_status.rs b/crates/nvisy-postgres/src/types/enums/outbox_status.rs index 79526e8d..fc9d9dae 100644 --- a/crates/nvisy-postgres/src/types/enums/outbox_status.rs +++ b/crates/nvisy-postgres/src/types/enums/outbox_status.rs @@ -8,7 +8,7 @@ db_enum! { /// Corresponds to the `OUTBOX_STATUS` `PostgreSQL` enum. A row is `Pending` /// until the drainer durably projects it (`Processed`) or gives up on it after /// too many failed attempts (`Failed`, i.e. dead-lettered). - pub enum OutboxStatus: Default = Pending, "crate::schema::sql_types::OutboxStatus" { + pub enum OutboxStatus: Default = Pending { /// Awaiting projection, or deferred for a later retry. Pending = "pending", /// Durably projected to its sinks. diff --git a/crates/nvisy-postgres/src/types/enums/policy_kind.rs b/crates/nvisy-postgres/src/types/enums/policy_kind.rs index 703a260a..8a288d73 100644 --- a/crates/nvisy-postgres/src/types/enums/policy_kind.rs +++ b/crates/nvisy-postgres/src/types/enums/policy_kind.rs @@ -12,7 +12,7 @@ db_enum! { /// A derived policy can be promoted to an authored one, which clears its /// content hash and makes it an editable, reusable policy selectable for /// detections. - pub enum PolicyKind: Default = Authored, "crate::schema::sql_types::PolicyKind" { + pub enum PolicyKind: Default = Authored { /// A normal, editable policy (template or inline definition). Authored = "authored", /// A policy derived from a label list, content-addressed and immutable. diff --git a/crates/nvisy-postgres/src/types/enums/provider_type.rs b/crates/nvisy-postgres/src/types/enums/provider_type.rs index a97fd993..4d429dbd 100644 --- a/crates/nvisy-postgres/src/types/enums/provider_type.rs +++ b/crates/nvisy-postgres/src/types/enums/provider_type.rs @@ -11,7 +11,7 @@ db_enum! { /// extraction. The concrete vendor (the `provider` column, e.g. `openai`) is /// orthogonal and stays open; this type is a stable, closed set used to find a /// workspace's provider of a given type without decrypting its config. - pub enum ProviderType = "crate::schema::sql_types::ProviderType" { + pub enum ProviderType { /// A language model (chat / completion). Llm = "llm", /// A named-entity-recognition model (entity extraction). diff --git a/crates/nvisy-postgres/src/types/enums/review_event_kind.rs b/crates/nvisy-postgres/src/types/enums/review_event_kind.rs index d93fdc33..c2cd7d30 100644 --- a/crates/nvisy-postgres/src/types/enums/review_event_kind.rs +++ b/crates/nvisy-postgres/src/types/enums/review_event_kind.rs @@ -9,7 +9,7 @@ db_enum! { /// interleaves comments (messages) with these events: the lifecycle (opened, /// renamed, submitted, changes requested, approved, reopened) and assignment /// changes. - pub enum ReviewEventKind = "crate::schema::sql_types::ReviewEventKind" { + pub enum ReviewEventKind { /// The review was opened. Opened = "review.opened", /// The review's display name was changed. diff --git a/crates/nvisy-postgres/src/types/enums/review_status.rs b/crates/nvisy-postgres/src/types/enums/review_status.rs index 9a7455b9..663cced3 100644 --- a/crates/nvisy-postgres/src/types/enums/review_status.rs +++ b/crates/nvisy-postgres/src/types/enums/review_status.rs @@ -14,7 +14,7 @@ db_enum! { /// approvals of the same redaction count toward the workspace's required /// number. Requesting changes and reopening clear every approval. Unassigning /// an approver deletes their approval, which can only demote the review. - pub enum ReviewStatus: Default = Draft, "crate::schema::sql_types::ReviewStatus" { + pub enum ReviewStatus: Default = Draft { /// Opened, edits being assembled; `submit` sends it for review. Draft = "draft", /// Submitted and awaiting a reviewer decision. diff --git a/crates/nvisy-postgres/src/types/enums/sync_deletion_policy.rs b/crates/nvisy-postgres/src/types/enums/sync_deletion_policy.rs index c3cbda5e..f010c6bd 100644 --- a/crates/nvisy-postgres/src/types/enums/sync_deletion_policy.rs +++ b/crates/nvisy-postgres/src/types/enums/sync_deletion_policy.rs @@ -13,7 +13,7 @@ db_enum! { /// selected and never reconciles. Deletion is opt-in per connection: the /// default `Ignore` keeps imports strictly additive so a transient listing /// error or a misconfigured root path can never remove files. - pub enum SyncDeletionPolicy: Default = Ignore, "crate::schema::sql_types::SyncDeletionPolicy" { + pub enum SyncDeletionPolicy: Default = Ignore { /// Leave the imported file untouched when its source object is gone. Ignore = "ignore", /// Delete the imported file when its source object is gone: the file row diff --git a/crates/nvisy-postgres/src/types/enums/sync_mode.rs b/crates/nvisy-postgres/src/types/enums/sync_mode.rs index 272bca0e..19fa9eeb 100644 --- a/crates/nvisy-postgres/src/types/enums/sync_mode.rs +++ b/crates/nvisy-postgres/src/types/enums/sync_mode.rs @@ -13,7 +13,7 @@ db_enum! { /// and pulls the whole listing on a timer. A file service is not enumerated on /// a timer — its import is picker-driven and request-time — so only `Export` /// is scheduled for a file service. - pub enum SyncMode = "crate::schema::sql_types::SyncMode" { + pub enum SyncMode { /// Fetch objects from the connection into the workspace. Import = "import", /// Push workspace files out to the connection. diff --git a/crates/nvisy-postgres/src/types/enums/sync_status.rs b/crates/nvisy-postgres/src/types/enums/sync_status.rs index 9ddc651d..899272ba 100644 --- a/crates/nvisy-postgres/src/types/enums/sync_status.rs +++ b/crates/nvisy-postgres/src/types/enums/sync_status.rs @@ -7,7 +7,7 @@ db_enum! { /// /// Corresponds to the `SYNC_STATUS` `PostgreSQL` enum and tracks the state of an /// individual synchronization run. - pub enum SyncStatus: Default = Pending, "crate::schema::sql_types::SyncStatus" { + pub enum SyncStatus: Default = Pending { /// Sync is queued. Pending = "pending", /// Sync is in progress. diff --git a/crates/nvisy-postgres/src/types/enums/sync_trigger_type.rs b/crates/nvisy-postgres/src/types/enums/sync_trigger_type.rs index 5e99164b..28a576eb 100644 --- a/crates/nvisy-postgres/src/types/enums/sync_trigger_type.rs +++ b/crates/nvisy-postgres/src/types/enums/sync_trigger_type.rs @@ -10,7 +10,7 @@ db_enum! { /// user, the SDK, an external automation (Zapier and the like). The latter is /// `OnDemand`, which covers every non-scheduled trigger, not only a human /// click. - pub enum SyncTriggerType: Default = OnDemand, "crate::schema::sql_types::SyncTriggerType" { + pub enum SyncTriggerType: Default = OnDemand { /// Triggered outside the schedule: a user, the SDK, or an external /// automation. OnDemand = "on_demand", diff --git a/crates/nvisy-postgres/src/types/enums/webhook_event.rs b/crates/nvisy-postgres/src/types/enums/webhook_event.rs index 65487bf1..d2247725 100644 --- a/crates/nvisy-postgres/src/types/enums/webhook_event.rs +++ b/crates/nvisy-postgres/src/types/enums/webhook_event.rs @@ -7,7 +7,7 @@ db_enum! { /// /// Corresponds to the `WEBHOOK_EVENT` `PostgreSQL` enum and configures which /// events a webhook receives. - pub enum WebhookEvent = "crate::schema::sql_types::WebhookEvent" { + pub enum WebhookEvent { /// A new document was created. DocumentCreated = "document.created", /// A document was updated. diff --git a/crates/nvisy-postgres/src/types/enums/webhook_status.rs b/crates/nvisy-postgres/src/types/enums/webhook_status.rs index 6f3cc40a..dc1ad7f3 100644 --- a/crates/nvisy-postgres/src/types/enums/webhook_status.rs +++ b/crates/nvisy-postgres/src/types/enums/webhook_status.rs @@ -8,7 +8,7 @@ db_enum! { /// Corresponds to the `WEBHOOK_STATUS` `PostgreSQL` enum. The user controls /// `Enabled` / `Disabled`; `Suspended` is set by the system when a webhook /// fails repeatedly, and the user can re-enable it. - pub enum WebhookStatus: Default = Enabled, "crate::schema::sql_types::WebhookStatus" { + pub enum WebhookStatus: Default = Enabled { /// Webhook is enabled and will receive events. Enabled = "enabled", /// Webhook was disabled by the user. diff --git a/crates/nvisy-postgres/src/types/enums/workspace_role.rs b/crates/nvisy-postgres/src/types/enums/workspace_role.rs index b4c665ad..26a8ff38 100644 --- a/crates/nvisy-postgres/src/types/enums/workspace_role.rs +++ b/crates/nvisy-postgres/src/types/enums/workspace_role.rs @@ -10,7 +10,7 @@ db_enum! { /// Corresponds to the `WORKSPACE_ROLE` `PostgreSQL` enum and provides /// hierarchical access control for workspace members with clearly defined /// capabilities. - pub enum WorkspaceRole: Default = Reviewer, "crate::schema::sql_types::WorkspaceRole" { + pub enum WorkspaceRole: Default = Reviewer { /// Full workspace ownership and management capabilities. Owner = "owner", /// Can manage members, integrations, and settings, but cannot delete the diff --git a/diesel.toml b/diesel.toml index 9b0d632b..429746b4 100644 --- a/diesel.toml +++ b/diesel.toml @@ -3,7 +3,10 @@ [print_schema] file = "./crates/nvisy-postgres/src/schema.rs" import_types = ["diesel::sql_types::*"] -custom_type_derives = ["diesel::query_builder::QueryId"] +custom_type_derives = ["diesel::query_builder::QueryId", "Clone"] +# The Rust enums are hand-written in nvisy-postgres (types::enums), with docs and +# wire names the generated ones cannot carry. +generate_rust_enum_definitions = false [migrations_directory] # The single source of truth for migrations. `embed_migrations!` in