From 034a0da6b255be27c011d423d22bb262d11db704 Mon Sep 17 00:00:00 2001 From: Sebastian Martinez Date: Mon, 23 Sep 2024 15:34:52 +0200 Subject: [PATCH] Move from `ts-rs` to `typescript-type-def` crate Also moves the type definitions into a separate crate away from the tauri functionality, makes the code a bit cleaner. --- .gitignore | 2 + crates/radicle-types/Cargo.lock | 1766 +++++++++++++++++ crates/radicle-types/Cargo.toml | 10 + crates/radicle-types/src/cobs.rs | 42 + crates/radicle-types/src/cobs/issue.rs | 67 + crates/radicle-types/src/cobs/patch.rs | 86 + crates/radicle-types/src/cobs/threads.rs | 63 + crates/radicle-types/src/config.rs | 40 + crates/radicle-types/src/helpers.rs | 14 + .../mod.rs => crates/radicle-types/src/lib.rs | 1 + crates/radicle-types/src/main.rs | 35 + crates/radicle-types/src/repo.rs | 46 + crates/radicle-types/src/repo/project.rs | 95 + eslint.config.js | 1 + package.json | 3 +- src-tauri/Cargo.lock | 87 +- src-tauri/Cargo.toml | 2 +- src-tauri/bindings/Author.ts | 3 - src-tauri/bindings/CobOptions.ts | 3 - src-tauri/bindings/CodeLocation.ts | 9 - src-tauri/bindings/CodeRange.ts | 5 - src-tauri/bindings/Config.ts | 21 - src-tauri/bindings/Issue.ts | 12 - src-tauri/bindings/NewIssueComment.ts | 8 - src-tauri/bindings/NewPatchComment.ts | 11 - src-tauri/bindings/Patch.ts | 28 - src-tauri/bindings/RepoInfo.ts | 15 - src-tauri/bindings/SupportedPayloads.ts | 25 - src-tauri/bindings/serde_json/JsonValue.ts | 7 - src-tauri/src/commands/cobs.rs | 10 +- src-tauri/src/commands/profile.rs | 4 +- src-tauri/src/commands/thread.rs | 13 +- src-tauri/src/error.rs | 4 + src-tauri/src/lib.rs | 49 +- src-tauri/src/types/cobs.rs | 216 -- src-tauri/src/types/config.rs | 23 - src-tauri/src/types/repo.rs | 52 - src/components/IssueTeaser.svelte | 2 +- src/components/PatchTeaser.svelte | 2 +- src/components/RepoCard.svelte | 2 +- src/components/RepoHeader.svelte | 2 +- src/lib/router/definitions.ts | 4 +- src/lib/types.ts | 116 ++ src/views/Home.svelte | 4 +- src/views/repo/Issues.svelte | 6 +- src/views/repo/Layout.svelte | 2 +- src/views/repo/Patches.svelte | 6 +- src/views/repo/router.ts | 8 +- tsconfig.json | 1 - vite.config.ts | 1 - 50 files changed, 2505 insertions(+), 529 deletions(-) create mode 100644 crates/radicle-types/Cargo.lock create mode 100644 crates/radicle-types/Cargo.toml create mode 100644 crates/radicle-types/src/cobs.rs create mode 100644 crates/radicle-types/src/cobs/issue.rs create mode 100644 crates/radicle-types/src/cobs/patch.rs create mode 100644 crates/radicle-types/src/cobs/threads.rs create mode 100644 crates/radicle-types/src/config.rs create mode 100644 crates/radicle-types/src/helpers.rs rename src-tauri/src/types/mod.rs => crates/radicle-types/src/lib.rs (72%) create mode 100644 crates/radicle-types/src/main.rs create mode 100644 crates/radicle-types/src/repo.rs create mode 100644 crates/radicle-types/src/repo/project.rs delete mode 100644 src-tauri/bindings/Author.ts delete mode 100644 src-tauri/bindings/CobOptions.ts delete mode 100644 src-tauri/bindings/CodeLocation.ts delete mode 100644 src-tauri/bindings/CodeRange.ts delete mode 100644 src-tauri/bindings/Config.ts delete mode 100644 src-tauri/bindings/Issue.ts delete mode 100644 src-tauri/bindings/NewIssueComment.ts delete mode 100644 src-tauri/bindings/NewPatchComment.ts delete mode 100644 src-tauri/bindings/Patch.ts delete mode 100644 src-tauri/bindings/RepoInfo.ts delete mode 100644 src-tauri/bindings/SupportedPayloads.ts delete mode 100644 src-tauri/bindings/serde_json/JsonValue.ts delete mode 100644 src-tauri/src/types/cobs.rs delete mode 100644 src-tauri/src/types/config.rs delete mode 100644 src-tauri/src/types/repo.rs create mode 100644 src/lib/types.ts diff --git a/.gitignore b/.gitignore index 2aff8c2..db28ad5 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,8 @@ node_modules/ src-tauri/target src-tauri/gen/schemas +crates/radicle-types/target + # Editor directories and files .vscode .idea diff --git a/crates/radicle-types/Cargo.lock b/crates/radicle-types/Cargo.lock new file mode 100644 index 0000000..db9df42 --- /dev/null +++ b/crates/radicle-types/Cargo.lock @@ -0,0 +1,1766 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "aead" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" +dependencies = [ + "crypto-common", + "generic-array", +] + +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + +[[package]] +name = "aes-gcm" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "831010a0f742e1209b3bcea8fab6a8e149051ba6099432c8cb2cc117dec3ead1" +dependencies = [ + "aead", + "aes", + "cipher", + "ctr", + "ghash", + "subtle", +] + +[[package]] +name = "amplify" +version = "4.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7147b742325842988dd6c793d55f58df3ae36bccf7d9b6e07db10ab035be343d" +dependencies = [ + "amplify_derive", + "amplify_num", + "ascii", + "wasm-bindgen", +] + +[[package]] +name = "amplify_derive" +version = "4.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a6309e6b8d89b36b9f959b7a8fa093583b94922a0f6438a24fb08936de4d428" +dependencies = [ + "amplify_syn", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "amplify_num" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99bcb75a2982047f733547042fc3968c0f460dfcf7d90b90dea3b2744580e9ad" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "amplify_syn" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7736fb8d473c0d83098b5bac44df6a561e20470375cd8bcae30516dc889fd62a" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "anyhow" +version = "1.0.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6" + +[[package]] +name = "ascii" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d92bec98840b8f03a5ff5413de5293bfcd8bf96467cf5452609f939ec6f5de16" + +[[package]] +name = "autocfg" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" + +[[package]] +name = "base-x" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cbbc9d0964165b47557570cce6c952866c2678457aca742aafc9fb771d30270" + +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + +[[package]] +name = "base32" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23ce669cd6c8588f79e15cf450314f9638f967fc5770ff1c7c1deb0925ea7cfa" + +[[package]] +name = "base64" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + +[[package]] +name = "base64ct" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" + +[[package]] +name = "bcrypt-pbkdf" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6aeac2e1fe888769f34f05ac343bbef98b14d1ffb292ab69d4608b3abc86f2a2" +dependencies = [ + "blowfish", + "pbkdf2", + "sha2", +] + +[[package]] +name = "bitflags" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "block-padding" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8894febbff9f758034a5b8e12d87918f56dfc64a8e1fe757d65e29041538d93" +dependencies = [ + "generic-array", +] + +[[package]] +name = "blowfish" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e412e2cd0f2b2d93e02543ceae7917b3c70331573df19ee046bcbc35e45e87d7" +dependencies = [ + "byteorder", + "cipher", +] + +[[package]] +name = "bumpalo" +version = "3.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "cbc" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26b52a9543ae338f279b96b0b9fed9c8093744685043739079ce85cd58f289a6" +dependencies = [ + "cipher", +] + +[[package]] +name = "cc" +version = "1.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07b1695e2c7e8fc85310cde85aeaab7e3097f593c91d209d3f9df76c928100f0" +dependencies = [ + "jobserver", + "libc", + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "chacha20" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", +] + +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + +[[package]] +name = "cpufeatures" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0" +dependencies = [ + "libc", +] + +[[package]] +name = "crossbeam-channel" +version = "0.5.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33480d6946193aa8033910124896ca395333cae7e2d1113d1fef6c3272217df2" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" + +[[package]] +name = "crypto-bigint" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" +dependencies = [ + "generic-array", + "rand_core", + "subtle", + "zeroize", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "ct-codecs" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "026ac6ceace6298d2c557ef5ed798894962296469ec7842288ea64674201a2d1" + +[[package]] +name = "ctr" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" +dependencies = [ + "cipher", +] + +[[package]] +name = "cypheraddr" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba5c54d2ad4ab9941383519471b75d12abc1a7b4779265e233168f2703a730d9" +dependencies = [ + "amplify", + "base32", + "cyphergraphy", + "sha3", +] + +[[package]] +name = "cyphergraphy" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b67c16c8ef5ddcdab57aab83fd8e770540ea3682ccdae09642c63575b0da2184" +dependencies = [ + "amplify", + "ec25519", +] + +[[package]] +name = "cyphernet" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac949369884a7a1d802cc669821269c707be8cec4d65043382e253733d2e62e1" +dependencies = [ + "cypheraddr", + "cyphergraphy", + "socks5-client", +] + +[[package]] +name = "darling" +version = "0.20.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.20.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 2.0.77", +] + +[[package]] +name = "darling_macro" +version = "0.20.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" +dependencies = [ + "darling_core", + "quote", + "syn 2.0.77", +] + +[[package]] +name = "data-encoding" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2" + +[[package]] +name = "data-encoding-macro" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1559b6cba622276d6d63706db152618eeb15b89b3e4041446b05876e352e639" +dependencies = [ + "data-encoding", + "data-encoding-macro-internal", +] + +[[package]] +name = "data-encoding-macro-internal" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "332d754c0af53bc87c108fed664d121ecf59207ec4196041f04d6ab9002ad33f" +dependencies = [ + "data-encoding", + "syn 1.0.109", +] + +[[package]] +name = "der" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" +dependencies = [ + "const-oid", + "zeroize", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "const-oid", + "crypto-common", + "subtle", +] + +[[package]] +name = "ec25519" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdfd533a2fc01178c738c99412ae1f7e1ad2cb37c2e14bfd87e9d4618171c825" +dependencies = [ + "ct-codecs", + "ed25519", + "getrandom", +] + +[[package]] +name = "ecdsa" +version = "0.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" +dependencies = [ + "der", + "digest", + "elliptic-curve", + "rfc6979", + "signature 2.2.0", + "spki", +] + +[[package]] +name = "ed25519" +version = "1.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91cff35c70bba8a626e3185d8cd48cc11b5437e1a5bcd15b9b5fa3c64b6dfee7" +dependencies = [ + "signature 1.6.4", +] + +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "pkcs8", + "rand_core", + "sec1", + "subtle", + "zeroize", +] + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "errno" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "fastrand" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" + +[[package]] +name = "ff" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" +dependencies = [ + "rand_core", + "subtle", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "form_urlencoded" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", + "zeroize", +] + +[[package]] +name = "getrandom" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "ghash" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0d8a4362ccb29cb0b265253fb0a2728f592895ee6854fd9bc13f2ffda266ff1" +dependencies = [ + "opaque-debug", + "polyval", +] + +[[package]] +name = "git-ref-format" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7428e0d6e549a9a613d6f019b839a0f5142c331295b79e119ca8f4faac145da1" +dependencies = [ + "git-ref-format-core", + "git-ref-format-macro", +] + +[[package]] +name = "git-ref-format-core" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbaeb9672a55e9e32cb6d3ef781e7526b25ab97d499fae71615649340b143424" +dependencies = [ + "serde", + "thiserror", +] + +[[package]] +name = "git-ref-format-macro" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b6ca5353accc201f6324dff744ba4660099546d4daf187ba868f07562e36ca4" +dependencies = [ + "git-ref-format-core", + "proc-macro-error", + "quote", + "syn 2.0.77", +] + +[[package]] +name = "git2" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b903b73e45dc0c6c596f2d37eccece7c1c8bb6e4407b001096387c63d0d93724" +dependencies = [ + "bitflags", + "libc", + "libgit2-sys", + "log", + "url", +] + +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core", + "subtle", +] + +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "idna" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "indexmap" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68b900aa2f7301e21c36462b170ee99994de34dff39a4a6a528e80e7376d07e5" +dependencies = [ + "equivalent", + "hashbrown", +] + +[[package]] +name = "inout" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" +dependencies = [ + "block-padding", + "generic-array", +] + +[[package]] +name = "itoa" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" + +[[package]] +name = "jobserver" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0" +dependencies = [ + "libc", +] + +[[package]] +name = "keccak" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" +dependencies = [ + "cpufeatures", +] + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" +dependencies = [ + "spin", +] + +[[package]] +name = "libc" +version = "0.2.158" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" + +[[package]] +name = "libgit2-sys" +version = "0.17.0+1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10472326a8a6477c3c20a64547b0059e4b0d086869eee31e6d7da728a8eb7224" +dependencies = [ + "cc", + "libc", + "libz-sys", + "pkg-config", +] + +[[package]] +name = "libm" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" + +[[package]] +name = "libz-sys" +version = "1.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2d16453e800a8cf6dd2fc3eb4bc99b786a9b90c663b8559a5b1a041bf89e472" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "linux-raw-sys" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" + +[[package]] +name = "localtime" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "016a009e0bb8ba6e3229fb74bf11a8fe6ef24542cc6ef35ef38863ac13f96d87" +dependencies = [ + "serde", +] + +[[package]] +name = "log" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" + +[[package]] +name = "memchr" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + +[[package]] +name = "multibase" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b3539ec3c1f04ac9748a260728e855f261b4977f5c3406612c884564f329404" +dependencies = [ + "base-x", + "data-encoding", + "data-encoding-macro", +] + +[[package]] +name = "nonempty" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "995defdca0a589acfdd1bd2e8e3b896b4d4f7675a31fd14c32611440c7f608e6" +dependencies = [ + "serde", +] + +[[package]] +name = "num-bigint-dig" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc84195820f291c7697304f3cbdadd1cb7199c0efc917ff5eafd71225c136151" +dependencies = [ + "byteorder", + "lazy_static", + "libm", + "num-integer", + "num-iter", + "num-traits", + "rand", + "smallvec", + "zeroize", +] + +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-iter" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", + "libm", +] + +[[package]] +name = "once_cell" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" + +[[package]] +name = "opaque-debug" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" + +[[package]] +name = "p256" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" +dependencies = [ + "ecdsa", + "elliptic-curve", + "primeorder", + "sha2", +] + +[[package]] +name = "p384" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70786f51bcc69f6a4c0360e063a4cac5419ef7c5cd5b3c99ad70f3be5ba79209" +dependencies = [ + "ecdsa", + "elliptic-curve", + "primeorder", + "sha2", +] + +[[package]] +name = "p521" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fc9e2161f1f215afdfce23677034ae137bbd45016a880c2eb3ba8eb95f085b2" +dependencies = [ + "base16ct", + "ecdsa", + "elliptic-curve", + "primeorder", + "rand_core", + "sha2", +] + +[[package]] +name = "pbkdf2" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" +dependencies = [ + "digest", +] + +[[package]] +name = "pem-rfc7468" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412" +dependencies = [ + "base64ct", +] + +[[package]] +name = "percent-encoding" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" + +[[package]] +name = "pkcs1" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8ffb9f10fa047879315e6625af03c164b16962a5368d724ed16323b68ace47f" +dependencies = [ + "der", + "pkcs8", + "spki", +] + +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + +[[package]] +name = "pkg-config" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" + +[[package]] +name = "poly1305" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf" +dependencies = [ + "cpufeatures", + "opaque-debug", + "universal-hash", +] + +[[package]] +name = "polyval" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d1fe60d06143b2430aa532c94cfe9e29783047f06c0d7fd359a9a51b729fa25" +dependencies = [ + "cfg-if", + "cpufeatures", + "opaque-debug", + "universal-hash", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "primeorder" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" +dependencies = [ + "elliptic-curve", +] + +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn 1.0.109", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr2" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96de42df36bb9bba5542fe9f1a054b8cc87e172759a1868aa05c1f3acc89dfc5" +dependencies = [ + "proc-macro2", + "quote", +] + +[[package]] +name = "proc-macro-error2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11ec05c52be0a07b08061f7dd003e7d7092e0472bc731b4af7bb1ef876109802" +dependencies = [ + "proc-macro-error-attr2", + "proc-macro2", + "quote", + "syn 2.0.77", +] + +[[package]] +name = "proc-macro2" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "radicle" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a818569c11f1bac56f38b002d778ce8ec92e312024b9aebcd68bad5dee6a465" +dependencies = [ + "amplify", + "base64", + "crossbeam-channel", + "cyphernet", + "fastrand", + "git2", + "libc", + "localtime", + "log", + "multibase", + "nonempty", + "once_cell", + "radicle-cob", + "radicle-crypto", + "radicle-git-ext", + "radicle-ssh", + "serde", + "serde_json", + "siphasher", + "sqlite", + "tempfile", + "thiserror", + "unicode-normalization", +] + +[[package]] +name = "radicle-cob" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4fac94999d8ffb6e88674bee487b080b69bbc9fb1b439ebfa51481ede1a17b3" +dependencies = [ + "fastrand", + "git2", + "log", + "nonempty", + "once_cell", + "radicle-crypto", + "radicle-dag", + "radicle-git-ext", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "radicle-crypto" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1d6a67969719841ad06049597006368eb4238ca63a02d20207654dfd1d2d6ad" +dependencies = [ + "amplify", + "cyphernet", + "ec25519", + "multibase", + "radicle-git-ext", + "radicle-ssh", + "serde", + "sqlite", + "ssh-key", + "thiserror", + "zeroize", +] + +[[package]] +name = "radicle-dag" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2a678c3049a88ae6a34dd9f52ea9a5f9f066a0af63466b75cf8c48840303067" +dependencies = [ + "fastrand", +] + +[[package]] +name = "radicle-git-ext" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b78c26e67d1712ad5a0c602ae3b236609461372ac04e200bda359fe4a1c6650" +dependencies = [ + "git-ref-format", + "git2", + "percent-encoding", + "radicle-std-ext", + "serde", + "thiserror", +] + +[[package]] +name = "radicle-ssh" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbee758010fb64482be4b18591fbeb3cbc15b16450d143edf4edb5484c7366c6" +dependencies = [ + "byteorder", + "log", + "thiserror", + "zeroize", +] + +[[package]] +name = "radicle-std-ext" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db20136bbc9ae63f3fec8e5a6c369f4902fac2244501b5dfc6d668e43475aaa4" + +[[package]] +name = "radicle-types" +version = "0.1.0" +dependencies = [ + "anyhow", + "radicle", + "serde", + "typescript-type-def", +] + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] + +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac", + "subtle", +] + +[[package]] +name = "rsa" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d0e5124fcb30e76a7e79bfee683a2746db83784b86289f6251b54b7950a0dfc" +dependencies = [ + "const-oid", + "digest", + "num-bigint-dig", + "num-integer", + "num-traits", + "pkcs1", + "pkcs8", + "rand_core", + "sha2", + "signature 2.2.0", + "spki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustix" +version = "0.38.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8acb788b847c24f28525660c4d7758620a7210875711f79e7f663cc152726811" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.52.0", +] + +[[package]] +name = "ryu" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" + +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "pkcs8", + "subtle", + "zeroize", +] + +[[package]] +name = "serde" +version = "1.0.210" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.210" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.77", +] + +[[package]] +name = "serde_json" +version = "1.0.128" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" +dependencies = [ + "indexmap", + "itoa", + "memchr", + "ryu", + "serde", +] + +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sha3" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" +dependencies = [ + "digest", + "keccak", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "signature" +version = "1.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" + +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "digest", + "rand_core", +] + +[[package]] +name = "siphasher" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d" + +[[package]] +name = "smallvec" +version = "1.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" + +[[package]] +name = "socks5-client" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffc7dcf6fab1d65d82d633006a4cc658d76ce436e01cf1a7c71873c0eeba324c" +dependencies = [ + "amplify", + "cypheraddr", +] + +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" + +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] + +[[package]] +name = "sqlite" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03801c10193857d6a4a71ec46cee198a15cbc659622aabe1db0d0bdbefbcf8e6" +dependencies = [ + "libc", + "sqlite3-sys", +] + +[[package]] +name = "sqlite3-src" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfc95a51a1ee38839599371685b9d4a926abb51791f0bc3bf8c3bb7867e6e454" +dependencies = [ + "cc", + "pkg-config", +] + +[[package]] +name = "sqlite3-sys" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2752c669433e40ebb08fde824146f50d9628aa0b66a3b7fc6be34db82a8063b" +dependencies = [ + "libc", + "sqlite3-src", +] + +[[package]] +name = "ssh-cipher" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "caac132742f0d33c3af65bfcde7f6aa8f62f0e991d80db99149eb9d44708784f" +dependencies = [ + "aes", + "aes-gcm", + "cbc", + "chacha20", + "cipher", + "ctr", + "poly1305", + "ssh-encoding", + "subtle", +] + +[[package]] +name = "ssh-encoding" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb9242b9ef4108a78e8cd1a2c98e193ef372437f8c22be363075233321dd4a15" +dependencies = [ + "base64ct", + "pem-rfc7468", + "sha2", +] + +[[package]] +name = "ssh-key" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca9b366a80cf18bb6406f4cf4d10aebfb46140a8c0c33f666a144c5c76ecbafc" +dependencies = [ + "bcrypt-pbkdf", + "p256", + "p384", + "p521", + "rand_core", + "rsa", + "sec1", + "sha2", + "signature 2.2.0", + "ssh-cipher", + "ssh-encoding", + "subtle", + "zeroize", +] + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.77" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "tempfile" +version = "3.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04cbcdd0c794ebb0d4cf35e88edd2f7d2c4c3e9a5a6dab322839b321c6a87a64" +dependencies = [ + "cfg-if", + "fastrand", + "once_cell", + "rustix", + "windows-sys 0.59.0", +] + +[[package]] +name = "thiserror" +version = "1.0.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.77", +] + +[[package]] +name = "tinyvec" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "typenum" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" + +[[package]] +name = "typescript-type-def" +version = "0.5.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c9a1ec7a0e59e03c7ab74e924abef19d2669aa9255b9821e55854b08453eb71" +dependencies = [ + "typescript-type-def-derive", +] + +[[package]] +name = "typescript-type-def-derive" +version = "0.5.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34c1213de2386875250474a109f0985ce83333038c885d2fec4de79d9dfcee8c" +dependencies = [ + "darling", + "ident_case", + "proc-macro-error2", + "proc-macro2", + "quote", + "syn 2.0.77", +] + +[[package]] +name = "unicode-bidi" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" + +[[package]] +name = "unicode-ident" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" + +[[package]] +name = "unicode-normalization" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "universal-hash" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" +dependencies = [ + "crypto-common", + "subtle", +] + +[[package]] +name = "url" +version = "2.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", +] + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasm-bindgen" +version = "0.2.93" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5" +dependencies = [ + "cfg-if", + "once_cell", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.93" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn 2.0.77", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.93" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.93" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.77", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.93" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "zerocopy" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +dependencies = [ + "byteorder", + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.77", +] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" diff --git a/crates/radicle-types/Cargo.toml b/crates/radicle-types/Cargo.toml new file mode 100644 index 0000000..66e5035 --- /dev/null +++ b/crates/radicle-types/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "radicle-types" +version = "0.1.0" +edition = "2021" + +[dependencies] +anyhow = "1.0.89" +radicle = "0.13.0" +serde = "1.0.210" +typescript-type-def = "0.5.12" diff --git a/crates/radicle-types/src/cobs.rs b/crates/radicle-types/src/cobs.rs new file mode 100644 index 0000000..9342156 --- /dev/null +++ b/crates/radicle-types/src/cobs.rs @@ -0,0 +1,42 @@ +pub mod issue; +pub mod patch; +pub mod threads; + +use radicle::node::AliasStore; +use serde::Deserialize; +use serde::Serialize; +use typescript_type_def::TypeDef; + +use radicle::identity; +use radicle::node; + +#[derive(Serialize, TypeDef)] +pub struct Author { + #[type_def(type_of = "String")] + did: identity::Did, + #[serde(skip_serializing_if = "Option::is_none")] + #[type_def(type_of = "Option")] + alias: Option, +} + +impl Author { + pub fn new(did: identity::Did, aliases: &impl AliasStore) -> Self { + Self { + did, + alias: aliases.alias(&did), + } + } +} + +#[derive(TypeDef, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct CobOptions { + #[serde(skip_serializing_if = "Option::is_none")] + announce: Option, +} + +impl CobOptions { + pub fn announce(&self) -> bool { + self.announce.unwrap_or(true) + } +} diff --git a/crates/radicle-types/src/cobs/issue.rs b/crates/radicle-types/src/cobs/issue.rs new file mode 100644 index 0000000..f93d030 --- /dev/null +++ b/crates/radicle-types/src/cobs/issue.rs @@ -0,0 +1,67 @@ +use radicle::node::AliasStore; +use serde::{Deserialize, Serialize}; +use typescript_type_def::type_expr::{Ident, TypeInfo}; +use typescript_type_def::TypeDef; + +use radicle::{cob, issue}; + +use crate::{cobs::Author, helpers::generate_defined_type_info}; + +#[derive(Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct NewIssueComment { + pub id: String, + pub body: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub reply_to: Option, + pub embeds: Vec, +} + +impl TypeDef for NewIssueComment { + const INFO: TypeInfo = generate_defined_type_info( + Ident("NewIssueComment"), + Ident("{ id: string, body: string, replyTo?: string | null, embeds: Embed[] }"), + ); +} + +#[derive(TypeDef, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct Issue { + #[type_def(type_of = "String")] + id: String, + author: Author, + title: String, + state: IssueState, + assignees: Vec, + #[type_def(type_of = "Vec")] + labels: Vec, + #[type_def(type_of = "i64")] + timestamp: cob::Timestamp, +} + +impl Issue { + pub fn new(id: issue::IssueId, issue: issue::Issue, aliases: &impl AliasStore) -> Self { + Self { + id: id.to_string(), + author: Author::new(*issue.author().id(), aliases), + title: issue.title().to_string(), + state: IssueState(*issue.state()), + assignees: issue + .assignees() + .map(|did| Author::new(*did, aliases)) + .collect::>(), + labels: issue.labels().cloned().collect::>(), + timestamp: issue.timestamp(), + } + } +} + +#[derive(Serialize)] +pub struct IssueState(issue::State); + +impl TypeDef for IssueState { + const INFO: TypeInfo = generate_defined_type_info( + Ident("IssueState"), + Ident("{ status: 'closed', reason: 'other' | 'solved' } | { status: 'open' }"), + ); +} diff --git a/crates/radicle-types/src/cobs/patch.rs b/crates/radicle-types/src/cobs/patch.rs new file mode 100644 index 0000000..b0224ce --- /dev/null +++ b/crates/radicle-types/src/cobs/patch.rs @@ -0,0 +1,86 @@ +use radicle::node::AliasStore; +use serde::{Deserialize, Serialize}; +use typescript_type_def::type_expr::{Ident, TypeInfo}; +use typescript_type_def::TypeDef; + +use radicle::{cob, patch}; + +use crate::cobs::Author; +use crate::helpers::generate_defined_type_info; + +#[derive(Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct NewPatchComment { + pub id: String, + pub revision: String, + pub body: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub reply_to: Option, + pub location: Option, + pub embeds: Vec, +} + +impl TypeDef for NewPatchComment { + const INFO: TypeInfo = generate_defined_type_info( + Ident("NewPatchComment"), + Ident( + r#"{ + id: string, + revision: string, + body: string, + replyTo?: string | null, + location: CodeLocation | null, + embeds: Embed[] +}"#, + ), + ); +} + +#[derive(TypeDef, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct Patch { + #[type_def(type_of = "String")] + id: String, + author: Author, + title: String, + state: PatchState, + assignees: Vec, + #[type_def(type_of = "Vec")] + labels: Vec, + #[type_def(type_of = "i64")] + timestamp: cob::Timestamp, + revision_count: usize, +} + +impl Patch { + pub fn new(id: patch::PatchId, patch: patch::Patch, aliases: &impl AliasStore) -> Self { + Self { + id: id.to_string(), + author: Author::new(*patch.author().id(), aliases), + title: patch.title().to_string(), + state: PatchState(patch.state().clone()), + assignees: patch + .assignees() + .map(|did| Author::new(did, aliases)) + .collect::>(), + labels: patch.labels().cloned().collect::>(), + timestamp: patch.timestamp(), + revision_count: patch.revisions().count(), + } + } +} + +#[derive(Serialize)] +pub struct PatchState(patch::State); + +impl TypeDef for PatchState { + const INFO: TypeInfo = generate_defined_type_info( + Ident("PatchState"), + Ident( + r#"{ status: 'draft' } | +{ status: 'open', conflicts?: [string, string][] } | +{ status: 'archived' } | +{ status: 'merged', revision: string, commit: string }"#, + ), + ); +} diff --git a/crates/radicle-types/src/cobs/threads.rs b/crates/radicle-types/src/cobs/threads.rs new file mode 100644 index 0000000..321d835 --- /dev/null +++ b/crates/radicle-types/src/cobs/threads.rs @@ -0,0 +1,63 @@ +use serde::{Deserialize, Serialize}; +use typescript_type_def::type_expr::{Ident, TypeInfo}; +use typescript_type_def::TypeDef; + +use radicle::cob; + +use crate::helpers::generate_defined_type_info; + +#[derive(Serialize, Deserialize)] +pub struct CodeLocation(radicle::cob::CodeLocation); + +impl TypeDef for CodeLocation { + const INFO: TypeInfo = generate_defined_type_info( + Ident("CodeLocation"), + Ident( + r#"{ + commit: string, + path: string, + old: CodeRange | null, + new: CodeRange | null + }"#, + ), + ); +} + +#[derive(Serialize, Deserialize)] +pub struct CodeRange(cob::CodeRange); + +impl TypeDef for CodeRange { + const INFO: TypeInfo = generate_defined_type_info( + Ident("CodeRange"), + Ident( + r#"{ + type: 'lines', + range: { + start: number, + end: number + } +} | { + type: 'chars', + line: number, + range: { + start: number, + end: number + } +}"#, + ), + ); +} + +#[derive(Serialize, Deserialize)] +pub struct Embed(cob::Embed); + +impl Embed { + pub fn new(val: cob::Embed) -> Self { + Self(val) + } +} + +impl TypeDef for Embed { + const INFO: TypeInfo = + generate_defined_type_info(Ident("Embed"), Ident("{ name: string, content: string }")); +} diff --git a/crates/radicle-types/src/config.rs b/crates/radicle-types/src/config.rs new file mode 100644 index 0000000..777288d --- /dev/null +++ b/crates/radicle-types/src/config.rs @@ -0,0 +1,40 @@ +use serde::Serialize; +use typescript_type_def::type_expr::{Ident, TypeInfo}; +use typescript_type_def::TypeDef; + +use radicle::crypto::PublicKey; +use radicle::node::Alias; + +use crate::helpers::generate_defined_type_info; + +#[derive(Serialize)] +#[serde(rename_all = "camelCase")] +pub struct Config { + pub public_key: PublicKey, + pub alias: Alias, + #[serde(default)] + pub seeding_policy: DefaultSeedingPolicy, +} + +impl TypeDef for Config { + const INFO: TypeInfo = generate_defined_type_info( + Ident("Config"), + Ident("{ publicKey: string, alias: string, seedingPolicy: DefaultSeedingPolicy }"), + ); +} + +#[derive(Serialize)] +pub struct DefaultSeedingPolicy(radicle::node::config::DefaultSeedingPolicy); + +impl DefaultSeedingPolicy { + pub fn new(val: radicle::node::config::DefaultSeedingPolicy) -> Self { + Self(val) + } +} + +impl TypeDef for DefaultSeedingPolicy { + const INFO: TypeInfo = generate_defined_type_info( + Ident("DefaultSeedingPolicy"), + Ident("{ default: 'allow', scope: 'followed' | 'all' } | { default: 'block' }"), + ); +} diff --git a/crates/radicle-types/src/helpers.rs b/crates/radicle-types/src/helpers.rs new file mode 100644 index 0000000..349351b --- /dev/null +++ b/crates/radicle-types/src/helpers.rs @@ -0,0 +1,14 @@ +use typescript_type_def::type_expr::{DefinedTypeInfo, Ident, TypeDefinition, TypeExpr, TypeInfo}; + +pub const fn generate_defined_type_info(name: Ident, def: Ident) -> TypeInfo { + TypeInfo::Defined(DefinedTypeInfo { + generic_args: &[], + def: TypeDefinition { + docs: None, + path: &[], + name, + generic_vars: &[], + def: TypeExpr::ident(def), + }, + }) +} diff --git a/src-tauri/src/types/mod.rs b/crates/radicle-types/src/lib.rs similarity index 72% rename from src-tauri/src/types/mod.rs rename to crates/radicle-types/src/lib.rs index d99d20b..0cba2fd 100644 --- a/src-tauri/src/types/mod.rs +++ b/crates/radicle-types/src/lib.rs @@ -1,3 +1,4 @@ pub mod cobs; pub mod config; +pub mod helpers; pub mod repo; diff --git a/crates/radicle-types/src/main.rs b/crates/radicle-types/src/main.rs new file mode 100644 index 0000000..046648b --- /dev/null +++ b/crates/radicle-types/src/main.rs @@ -0,0 +1,35 @@ +use typescript_type_def::{write_definition_file, DefinitionFileOptions}; + +use radicle_types::cobs::{issue, patch, threads}; +use radicle_types::config; +use radicle_types::repo; +use radicle_types::repo::project; + +fn main() { + let file = std::fs::File::create("./src/lib/types.ts").expect("Not able to create file"); + + type ExportTypes = ( + threads::CodeLocation, + threads::CodeRange, + threads::Embed, + patch::NewPatchComment, + patch::Patch, + issue::NewIssueComment, + issue::Issue, + project::Project, + project::ProjectStruct, + repo::SupportedPayloads, + repo::RepoInfo, + config::Config, + config::DefaultSeedingPolicy, + ); + + write_definition_file::<_, ExportTypes>( + file, + DefinitionFileOptions { + header: Some("// AUTO-GENERATED by typescript-type-def\n"), + root_namespace: None, + }, + ) + .unwrap(); +} diff --git a/crates/radicle-types/src/repo.rs b/crates/radicle-types/src/repo.rs new file mode 100644 index 0000000..01ba890 --- /dev/null +++ b/crates/radicle-types/src/repo.rs @@ -0,0 +1,46 @@ +pub mod project; + +use serde::Serialize; +use typescript_type_def::type_expr::{Ident, TypeInfo}; +use typescript_type_def::TypeDef; + +use radicle::identity::RepoId; + +use crate::helpers::generate_defined_type_info; +use crate::repo::project::ProjectStruct; + +use super::cobs::Author; + +#[derive(Serialize, TypeDef)] +pub struct RepoInfo { + pub payloads: SupportedPayloads, + pub delegates: Vec, + pub threshold: usize, + pub visibility: Visibility, + #[type_def(type_of = "String")] + pub rid: RepoId, + pub seeding: usize, +} + +#[derive(Serialize, TypeDef)] +pub struct SupportedPayloads { + #[serde(rename = "xyz.radicle.project")] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub project: Option, +} + +#[derive(Serialize)] +pub struct Visibility(radicle::identity::Visibility); + +impl Visibility { + pub fn new(val: radicle::identity::Visibility) -> Self { + Self(val) + } +} + +impl TypeDef for Visibility { + const INFO: TypeInfo = generate_defined_type_info( + Ident("Visibility"), + Ident("{ type: 'public' } | { type: 'private', allow?: string[] }"), + ); +} diff --git a/crates/radicle-types/src/repo/project.rs b/crates/radicle-types/src/repo/project.rs new file mode 100644 index 0000000..11fcef5 --- /dev/null +++ b/crates/radicle-types/src/repo/project.rs @@ -0,0 +1,95 @@ +use radicle::git::{BranchName, Oid}; +use radicle::identity::project::ProjectName; +use radicle::{issue, patch, prelude}; +use serde::Serialize; +use typescript_type_def::type_expr::{Ident, TypeInfo}; +use typescript_type_def::TypeDef; + +use crate::helpers::generate_defined_type_info; + +#[derive(Serialize)] +pub struct IssueCounts(issue::IssueCounts); +impl IssueCounts { + pub fn new(val: issue::IssueCounts) -> Self { + Self(val) + } +} +impl TypeDef for IssueCounts { + const INFO: TypeInfo = generate_defined_type_info( + Ident("IssueCounts"), + Ident("{ open: number, closed: number }"), + ); +} + +#[derive(Serialize)] +pub struct PatchCounts(patch::PatchCounts); +impl PatchCounts { + pub fn new(val: patch::PatchCounts) -> Self { + Self(val) + } +} +impl TypeDef for PatchCounts { + const INFO: TypeInfo = generate_defined_type_info( + Ident("PatchCounts"), + Ident("{ open: number, draft: number, archived: number, merged: number }"), + ); +} + +#[derive(Serialize, TypeDef)] +pub struct ProjectStruct { + data: Project, + meta: ProjectMeta, +} + +impl ProjectStruct { + pub fn new(data: Project, meta: ProjectMeta) -> Self { + Self { data, meta } + } +} + +#[derive(Serialize, TypeDef)] +#[serde(rename_all = "camelCase")] +pub struct ProjectMeta { + head: String, + issues: IssueCounts, + patches: PatchCounts, + last_commit: i64, +} + +impl ProjectMeta { + pub fn new(head: Oid, issues: IssueCounts, patches: PatchCounts, last_commit: i64) -> Self { + Self { + head: head.to_string(), + issues, + patches, + last_commit, + } + } +} + +#[derive(Serialize)] +#[serde(rename_all = "camelCase")] +pub struct Project { + name: ProjectName, + description: String, + default_branch: BranchName, +} + +impl Project { + pub fn new(val: prelude::Project) -> Self { + let name = ProjectName::try_from(val.name()).unwrap(); + + Self { + name, + description: val.description().to_string(), + default_branch: val.default_branch().clone(), + } + } +} + +impl TypeDef for Project { + const INFO: TypeInfo = generate_defined_type_info( + Ident("Project"), + Ident("{ defaultBranch: string, description: string, name: string }"), + ); +} diff --git a/eslint.config.js b/eslint.config.js index da0c2b1..0fc8400 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -138,6 +138,7 @@ export default [ "isolation/*", "node_modules/**/*", "src-tauri/**/*", + "src/lib/types.ts", "eslint.config.js", ], }, diff --git a/package.json b/package.json index c09555f..c43a805 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,8 @@ "check-js": "scripts/check-js", "check-rs": "scripts/check-rs", "format": "npx prettier '**/*.@(ts|js|svelte|json|css|html|yml)' --write", - "tauri": "npx tauri" + "tauri": "npx tauri", + "generate-types": "cargo run --manifest-path ./crates/radicle-types/Cargo.toml && npx prettier --write ./src/lib/types.ts" }, "engines": { "node": "20.9.0" diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 156f5d7..dc6ad23 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -3515,6 +3515,28 @@ dependencies = [ "version_check", ] +[[package]] +name = "proc-macro-error-attr2" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96de42df36bb9bba5542fe9f1a054b8cc87e172759a1868aa05c1f3acc89dfc5" +dependencies = [ + "proc-macro2", + "quote", +] + +[[package]] +name = "proc-macro-error2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11ec05c52be0a07b08061f7dd003e7d7092e0472bc731b4af7bb1ef876109802" +dependencies = [ + "proc-macro-error-attr2", + "proc-macro2", + "quote", + "syn 2.0.77", +] + [[package]] name = "proc-macro-hack" version = "0.5.20+deprecated" @@ -3675,6 +3697,7 @@ dependencies = [ "log", "radicle", "radicle-surf", + "radicle-types", "serde", "serde_json", "tauri", @@ -3684,7 +3707,6 @@ dependencies = [ "tauri-plugin-shell", "tauri-plugin-window-state", "thiserror", - "ts-rs", ] [[package]] @@ -3738,6 +3760,16 @@ dependencies = [ "url", ] +[[package]] +name = "radicle-types" +version = "0.1.0" +dependencies = [ + "anyhow", + "radicle", + "serde", + "typescript-type-def", +] + [[package]] name = "rand" version = "0.7.3" @@ -5038,15 +5070,6 @@ dependencies = [ "utf-8", ] -[[package]] -name = "termcolor" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" -dependencies = [ - "winapi-util", -] - [[package]] name = "thin-slice" version = "0.1.1" @@ -5460,40 +5483,40 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] -name = "ts-rs" -version = "9.0.1" +name = "typeid" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b44017f9f875786e543595076374b9ef7d13465a518dd93d6ccdbf5b432dde8c" +checksum = "0e13db2e0ccd5e14a544e8a246ba2312cd25223f616442d7f2cb0e3db614236e" + +[[package]] +name = "typenum" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" + +[[package]] +name = "typescript-type-def" +version = "0.5.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c9a1ec7a0e59e03c7ab74e924abef19d2669aa9255b9821e55854b08453eb71" dependencies = [ - "serde_json", - "thiserror", - "ts-rs-macros", + "typescript-type-def-derive", ] [[package]] -name = "ts-rs-macros" -version = "9.0.1" +name = "typescript-type-def-derive" +version = "0.5.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c88cc88fd23b5a04528f3a8436024f20010a16ec18eb23c164b1242f65860130" +checksum = "34c1213de2386875250474a109f0985ce83333038c885d2fec4de79d9dfcee8c" dependencies = [ + "darling", + "ident_case", + "proc-macro-error2", "proc-macro2", "quote", "syn 2.0.77", - "termcolor", ] -[[package]] -name = "typeid" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e13db2e0ccd5e14a544e8a246ba2312cd25223f616442d7f2cb0e3db614236e" - -[[package]] -name = "typenum" -version = "1.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" - [[package]] name = "unic-char-property" version = "0.9.0" diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 7bd75b0..7628394 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -23,6 +23,7 @@ anyhow = { version = "1.0.86" } log = { version = "0.4" } radicle = { version = "0.13.0" } radicle-surf = { version = "0.22.0" } +radicle-types = { version = "0", path = "../crates/radicle-types" } serde = { version = "1.0", features = ["derive"] } serde_json = { version = "1.0" } tauri = { version = "2.0.0-rc.0", features = ["isolation"] } @@ -31,7 +32,6 @@ tauri-plugin-devtools = { version = "2.0.0-rc" } tauri-plugin-shell = { version = "2.0.0-rc.0" } tauri-plugin-window-state = { version = "2.0.0-rc.1" } thiserror = { version = "1.0.63" } -ts-rs = { version = "9.0.1", features = ["serde-json-impl", "no-serde-warnings"] } [features] # by default Tauri runs in production mode diff --git a/src-tauri/bindings/Author.ts b/src-tauri/bindings/Author.ts deleted file mode 100644 index 3784bce..0000000 --- a/src-tauri/bindings/Author.ts +++ /dev/null @@ -1,3 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type Author = { did: string; alias?: string }; diff --git a/src-tauri/bindings/CobOptions.ts b/src-tauri/bindings/CobOptions.ts deleted file mode 100644 index 54405f6..0000000 --- a/src-tauri/bindings/CobOptions.ts +++ /dev/null @@ -1,3 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type CobOptions = { announce?: boolean }; diff --git a/src-tauri/bindings/CodeLocation.ts b/src-tauri/bindings/CodeLocation.ts deleted file mode 100644 index 8a78372..0000000 --- a/src-tauri/bindings/CodeLocation.ts +++ /dev/null @@ -1,9 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { CodeRange } from "./CodeRange"; - -export type CodeLocation = { - commit: string; - path: string; - old: CodeRange | null; - new: CodeRange | null; -}; diff --git a/src-tauri/bindings/CodeRange.ts b/src-tauri/bindings/CodeRange.ts deleted file mode 100644 index 96d19d3..0000000 --- a/src-tauri/bindings/CodeRange.ts +++ /dev/null @@ -1,5 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type CodeRange = - | { type: "lines"; range: { start: number; end: number } } - | { type: "chars"; line: number; range: { start: number; end: number } }; diff --git a/src-tauri/bindings/Config.ts b/src-tauri/bindings/Config.ts deleted file mode 100644 index dbce075..0000000 --- a/src-tauri/bindings/Config.ts +++ /dev/null @@ -1,21 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * Service configuration. - */ -export type Config = { - /** - * Node Public Key in NID format. - */ - publicKey: string; - /** - * Node alias. - */ - alias: string; - /** - * Default seeding policy. - */ - seedingPolicy: - | { default: "allow"; scope: "followed" | "all" } - | { default: "block" }; -}; diff --git a/src-tauri/bindings/Issue.ts b/src-tauri/bindings/Issue.ts deleted file mode 100644 index 5a95bf3..0000000 --- a/src-tauri/bindings/Issue.ts +++ /dev/null @@ -1,12 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { Author } from "./Author"; - -export type Issue = { - id: string; - author: Author; - title: string; - state: { status: "closed"; reason: "other" | "solved" } | { status: "open" }; - assignees: Array; - labels: Array; - timestamp: number; -}; diff --git a/src-tauri/bindings/NewIssueComment.ts b/src-tauri/bindings/NewIssueComment.ts deleted file mode 100644 index ae9dcba..0000000 --- a/src-tauri/bindings/NewIssueComment.ts +++ /dev/null @@ -1,8 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type NewIssueComment = { - id: string; - body: string; - replyTo?: string; - embeds: { name: string; content: string }[]; -}; diff --git a/src-tauri/bindings/NewPatchComment.ts b/src-tauri/bindings/NewPatchComment.ts deleted file mode 100644 index 420cf2d..0000000 --- a/src-tauri/bindings/NewPatchComment.ts +++ /dev/null @@ -1,11 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { CodeLocation } from "./CodeLocation"; - -export type NewPatchComment = { - id: string; - revision: string; - body: string; - replyTo?: string; - location: CodeLocation | null; - embeds: { name: string; content: string }[]; -}; diff --git a/src-tauri/bindings/Patch.ts b/src-tauri/bindings/Patch.ts deleted file mode 100644 index 94dfb70..0000000 --- a/src-tauri/bindings/Patch.ts +++ /dev/null @@ -1,28 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { Author } from "./Author"; - -export type Patch = { - id: string; - author: Author; - title: string; - state: - | { - status: "draft"; - } - | { - status: "open"; - conflicts: [string, string][]; - } - | { - status: "archived"; - } - | { - status: "merged"; - revision: string; - commit: string; - }; - assignees: Array; - labels: Array; - timestamp: number; - revisionCount: number; -}; diff --git a/src-tauri/bindings/RepoInfo.ts b/src-tauri/bindings/RepoInfo.ts deleted file mode 100644 index f67a3cc..0000000 --- a/src-tauri/bindings/RepoInfo.ts +++ /dev/null @@ -1,15 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { Author } from "./Author"; -import type { SupportedPayloads } from "./SupportedPayloads"; - -/** - * Repos info. - */ -export type RepoInfo = { - payloads: SupportedPayloads; - delegates: Array; - threshold: number; - visibility: { type: "public" } | { type: "private"; allow?: string[] }; - rid: string; - seeding: number; -}; diff --git a/src-tauri/bindings/SupportedPayloads.ts b/src-tauri/bindings/SupportedPayloads.ts deleted file mode 100644 index dad9ee1..0000000 --- a/src-tauri/bindings/SupportedPayloads.ts +++ /dev/null @@ -1,25 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type SupportedPayloads = { - "xyz.radicle.project"?: { - data: { - defaultBranch: string; - description: string; - name: string; - }; - meta: { - head: string; - issues: { - open: number; - closed: number; - }; - patches: { - open: number; - draft: number; - archived: number; - merged: number; - }; - lastCommit: number; - }; - }; -}; diff --git a/src-tauri/bindings/serde_json/JsonValue.ts b/src-tauri/bindings/serde_json/JsonValue.ts deleted file mode 100644 index 1431f9a..0000000 --- a/src-tauri/bindings/serde_json/JsonValue.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type JsonValue = - | number - | string - | Array - | { [key: string]: JsonValue }; diff --git a/src-tauri/src/commands/cobs.rs b/src-tauri/src/commands/cobs.rs index eb017d6..503dc65 100644 --- a/src-tauri/src/commands/cobs.rs +++ b/src-tauri/src/commands/cobs.rs @@ -1,9 +1,9 @@ use radicle::identity::RepoId; use radicle::issue::cache::Issues; use radicle::patch::cache::Patches; +use radicle_types as types; use crate::error::Error; -use crate::types::cobs; use crate::AppState; #[tauri::command] @@ -11,7 +11,7 @@ pub fn list_issues( ctx: tauri::State, rid: RepoId, status: query::IssueStatus, -) -> Result, Error> { +) -> Result, Error> { let (repo, _) = ctx.repo(rid)?; let issues = ctx.profile.issues(&repo)?; let mut issues: Vec<_> = issues @@ -26,7 +26,7 @@ pub fn list_issues( let aliases = &ctx.profile.aliases(); let issues = issues .into_iter() - .map(|(id, issue)| cobs::Issue::new(id, issue, aliases)) + .map(|(id, issue)| types::cobs::issue::Issue::new(id, issue, aliases)) .collect::>(); Ok::<_, Error>(issues) @@ -37,7 +37,7 @@ pub fn list_patches( ctx: tauri::State, rid: RepoId, status: query::PatchStatus, -) -> Result, Error> { +) -> Result, Error> { let (repo, _) = ctx.repo(rid)?; let patches = ctx.profile.patches(&repo)?; let mut patches: Vec<_> = patches @@ -52,7 +52,7 @@ pub fn list_patches( let aliases = &ctx.profile.aliases(); let patches = patches .into_iter() - .map(|(id, patch)| cobs::Patch::new(id, patch, aliases)) + .map(|(id, patch)| types::cobs::patch::Patch::new(id, patch, aliases)) .collect::>(); Ok::<_, Error>(patches) diff --git a/src-tauri/src/commands/profile.rs b/src-tauri/src/commands/profile.rs index 5150c10..42680bb 100644 --- a/src-tauri/src/commands/profile.rs +++ b/src-tauri/src/commands/profile.rs @@ -1,3 +1,5 @@ +use radicle_types::config::DefaultSeedingPolicy; + use crate::error::Error; use crate::types::config::Config; use crate::AppState; @@ -8,7 +10,7 @@ pub fn config(ctx: tauri::State) -> Result { let config = Config { public_key: ctx.profile.public_key, alias: ctx.profile.config.node.alias.clone(), - seeding_policy: ctx.profile.config.node.seeding_policy, + seeding_policy: DefaultSeedingPolicy::new(ctx.profile.config.node.seeding_policy), }; Ok::<_, Error>(config) diff --git a/src-tauri/src/commands/thread.rs b/src-tauri/src/commands/thread.rs index 2910e63..4562ac3 100644 --- a/src-tauri/src/commands/thread.rs +++ b/src-tauri/src/commands/thread.rs @@ -8,15 +8,16 @@ use radicle::storage::ReadStorage; use radicle::Node; use crate::error::Error; -use crate::types::cobs::{CobOptions, NewIssueComment, NewPatchComment}; use crate::AppState; +use radicle_types as types; + #[tauri::command] pub fn create_issue_comment( ctx: tauri::State, rid: RepoId, - new: NewIssueComment, - opts: CobOptions, + new: types::cobs::issue::NewIssueComment, + opts: types::cobs::CobOptions, ) -> Result { let mut node = Node::new(ctx.profile.socket()); let signer = ctx.profile.signer()?; @@ -41,8 +42,8 @@ pub fn create_issue_comment( pub fn create_patch_comment( ctx: tauri::State, rid: RepoId, - new: NewPatchComment, - opts: CobOptions, + new: types::cobs::patch::NewPatchComment, + opts: types::cobs::CobOptions, ) -> Result { let mut node = Node::new(ctx.profile.socket()); let signer = ctx.profile.signer()?; @@ -55,7 +56,7 @@ pub fn create_patch_comment( revision_id.into(), new.body, new.reply_to, - new.location.map(|l| l.into()), + new.location, new.embeds, &signer, )?; diff --git a/src-tauri/src/error.rs b/src-tauri/src/error.rs index c0fc388..8282055 100644 --- a/src-tauri/src/error.rs +++ b/src-tauri/src/error.rs @@ -42,6 +42,10 @@ pub enum Error { #[error(transparent)] Routing(#[from] radicle::node::routing::Error), + /// Git error. + #[error(transparent)] + Git(#[from] radicle::git::Error), + /// Git2 error. #[error(transparent)] Git2(#[from] radicle::git::raw::Error), diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index f70343e..2b839b5 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -1,12 +1,9 @@ mod commands; mod error; -mod types; -use serde_json::json; use tauri::Emitter; use tauri::Manager; -use radicle::identity::doc::PayloadId; use radicle::identity::DocAt; use radicle::identity::RepoId; use radicle::issue::cache::Issues; @@ -16,9 +13,9 @@ use radicle::patch::cache::Patches; use radicle::storage::git::Repository; use radicle::storage::{ReadRepository, ReadStorage}; use radicle::Node; +use radicle_types as types; use commands::{auth, cobs, profile, repos, thread}; -use types::repo::SupportedPayloads; struct AppState { profile: radicle::Profile, @@ -36,36 +33,40 @@ impl AppState { let aliases = self.profile.aliases(); let delegates = doc .delegates + .clone() .into_iter() .map(|did| types::cobs::Author::new(did, &aliases)) .collect::>(); let db = &self.profile.database()?; let seeding = db.count(&rid).unwrap_or_default(); - let project = doc.payload.get(&PayloadId::project()).and_then(|payload| { - let (_, head) = repo.head().ok()?; - let commit = repo.commit(head).ok()?; - let patches = self.profile.patches(repo).ok()?; - let patches = patches.counts().ok()?; - let issues = self.profile.issues(repo).ok()?; - let issues = issues.counts().ok()?; - - Some(json!({ - "data": payload, - "meta": { - "issues": issues, - "patches": patches, - "head": head, - "lastCommit": commit.time().seconds() * 1000, - }, - })) - }); + let project = if let Ok(project) = doc.project() { + let (_, head) = repo.head()?; + let commit = repo.commit(head)?; + let patches = self.profile.patches(repo)?; + let patches = patches.counts()?; + let issues = self.profile.issues(repo)?; + let issues = issues.counts()?; + + let meta = types::repo::project::ProjectMeta::new( + head, + types::repo::project::IssueCounts::new(issues), + types::repo::project::PatchCounts::new(patches), + commit.time().seconds() * 1000, + ); + + let project = types::repo::project::Project::new(project); + + Some(types::repo::project::ProjectStruct::new(project, meta)) + } else { + None + }; Ok(types::repo::RepoInfo { - payloads: SupportedPayloads { project }, + payloads: types::repo::SupportedPayloads { project }, delegates, threshold: doc.threshold, - visibility: doc.visibility, + visibility: types::repo::Visibility::new(doc.visibility), rid, seeding, }) diff --git a/src-tauri/src/types/cobs.rs b/src-tauri/src/types/cobs.rs deleted file mode 100644 index 1f8c56f..0000000 --- a/src-tauri/src/types/cobs.rs +++ /dev/null @@ -1,216 +0,0 @@ -use radicle::cob; -use radicle::git; -use radicle::identity; -use radicle::issue; -use radicle::node::{Alias, AliasStore}; -use radicle::patch; -use serde::Deserialize; -use serde::Serialize; -use ts_rs::TS; - -#[derive(Serialize, TS)] -pub(crate) struct Author { - #[ts(as = "String")] - did: identity::Did, - #[serde(skip_serializing_if = "Option::is_none")] - #[ts(as = "Option")] - #[ts(optional)] - alias: Option, -} - -impl Author { - pub fn new(did: identity::Did, aliases: &impl AliasStore) -> Self { - Self { - did, - alias: aliases.alias(&did), - } - } -} - -#[derive(TS, Serialize)] -#[ts(export)] -#[serde(rename_all = "camelCase")] -pub struct Issue { - #[ts(as = "String")] - id: String, - author: Author, - title: String, - #[ts(type = "{ status: 'closed', reason: 'other' | 'solved' } | { status: 'open' } ")] - state: issue::State, - assignees: Vec, - #[ts(as = "Vec")] - labels: Vec, - #[ts(type = "number")] - timestamp: cob::Timestamp, -} - -impl Issue { - pub fn new(id: issue::IssueId, issue: issue::Issue, aliases: &impl AliasStore) -> Self { - Self { - id: id.to_string(), - author: Author::new(*issue.author().id(), aliases), - title: issue.title().to_string(), - state: *issue.state(), - assignees: issue - .assignees() - .map(|did| Author::new(*did, aliases)) - .collect::>(), - labels: issue.labels().cloned().collect::>(), - timestamp: issue.timestamp(), - } - } -} - -#[derive(TS, Serialize)] -#[ts(export)] -#[serde(rename_all = "camelCase")] -pub struct Patch { - #[ts(as = "String")] - id: String, - author: Author, - title: String, - #[ts(type = r#"{ - status: 'draft' -} | { - status: 'open', - conflicts: [string, string][] -} | { - status: 'archived' -} | { - status: 'merged', revision: string, commit: string -} "#)] - state: patch::State, - assignees: Vec, - #[ts(as = "Vec")] - labels: Vec, - #[ts(type = "number")] - timestamp: cob::Timestamp, - revision_count: usize, -} - -impl Patch { - pub fn new(id: patch::PatchId, patch: patch::Patch, aliases: &impl AliasStore) -> Self { - Self { - id: id.to_string(), - author: Author::new(*patch.author().id(), aliases), - title: patch.title().to_string(), - state: patch.state().clone(), - assignees: patch - .assignees() - .map(|did| Author::new(did, aliases)) - .collect::>(), - labels: patch.labels().cloned().collect::>(), - timestamp: patch.timestamp(), - revision_count: patch.revisions().count(), - } - } -} - -#[derive(TS, Serialize, Deserialize)] -#[ts(export)] -#[serde(rename_all = "camelCase")] -pub struct NewPatchComment { - pub id: String, - pub revision: String, - pub body: String, - #[ts(as = "Option")] - #[ts(optional)] - pub reply_to: Option, - pub location: Option, - #[ts(type = "{ name: string, content: string }[]")] - pub embeds: Vec, -} - -#[derive(TS, Serialize, Deserialize)] -#[ts(export)] -#[serde(rename_all = "camelCase")] -pub struct NewIssueComment { - pub id: String, - pub body: String, - #[ts(as = "Option")] - #[ts(optional)] - pub reply_to: Option, - #[ts(type = "{ name: string, content: string }[]")] - pub embeds: Vec, -} - -#[derive(TS, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -#[ts(export)] -pub struct CodeLocation { - #[ts(as = "String")] - commit: git::Oid, - path: std::path::PathBuf, - old: Option, - new: Option, -} - -impl From for CodeLocation { - fn from(val: cob::CodeLocation) -> Self { - Self { - commit: val.commit, - path: val.path, - old: val.old.map(|o| o.into()), - new: val.new.map(|o| o.into()), - } - } -} - -impl From for cob::CodeLocation { - fn from(val: CodeLocation) -> Self { - Self { - commit: val.commit, - path: val.path, - old: val.old.map(|o| o.into()), - new: val.new.map(|o| o.into()), - } - } -} - -#[derive(TS, Serialize, Deserialize)] -#[serde(rename_all = "camelCase", tag = "type")] -#[ts(export)] -pub enum CodeRange { - Lines { - #[ts(type = "{ start: number, end: number }")] - range: std::ops::Range, - }, - Chars { - line: usize, - #[ts(type = "{ start: number, end: number }")] - range: std::ops::Range, - }, -} - -impl From for CodeRange { - fn from(val: cob::CodeRange) -> Self { - match val { - cob::CodeRange::Chars { line, range } => Self::Chars { line, range }, - cob::CodeRange::Lines { range } => Self::Lines { range }, - } - } -} - -impl From for cob::CodeRange { - fn from(val: CodeRange) -> Self { - match val { - CodeRange::Chars { line, range } => Self::Chars { line, range }, - CodeRange::Lines { range } => Self::Lines { range }, - } - } -} - -#[derive(TS, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -#[ts(export)] -pub struct CobOptions { - #[ts(as = "Option")] - #[ts(optional)] - announce: Option, -} - -impl CobOptions { - pub fn announce(&self) -> bool { - self.announce.unwrap_or(true) - } -} diff --git a/src-tauri/src/types/config.rs b/src-tauri/src/types/config.rs deleted file mode 100644 index 0d0e0af..0000000 --- a/src-tauri/src/types/config.rs +++ /dev/null @@ -1,23 +0,0 @@ -use radicle::crypto::PublicKey; -use serde::Serialize; -use ts_rs::TS; - -use radicle::node::config::DefaultSeedingPolicy; -use radicle::node::Alias; - -/// Service configuration. -#[derive(TS, Serialize)] -#[serde(rename_all = "camelCase")] -#[ts(export)] -pub struct Config { - /// Node Public Key in NID format. - #[ts(as = "String")] - pub public_key: PublicKey, - /// Node alias. - #[ts(as = "String")] - pub alias: Alias, - /// Default seeding policy. - #[serde(default)] - #[ts(type = "{ default: 'allow', scope: 'followed' | 'all' } | { default: 'block' }")] - pub seeding_policy: DefaultSeedingPolicy, -} diff --git a/src-tauri/src/types/repo.rs b/src-tauri/src/types/repo.rs deleted file mode 100644 index 4f1925e..0000000 --- a/src-tauri/src/types/repo.rs +++ /dev/null @@ -1,52 +0,0 @@ -use serde::Serialize; -use serde_json::Value; -use ts_rs::TS; - -use radicle::identity::RepoId; - -use super::cobs::Author; - -/// Repos info. -#[derive(Serialize, TS)] -#[ts(export)] -pub struct RepoInfo { - pub payloads: SupportedPayloads, - #[ts(as = "Vec")] - pub delegates: Vec, - pub threshold: usize, - #[ts(type = "{ type: 'public' } | { type: 'private', allow?: string[] }")] - pub visibility: radicle::identity::Visibility, - #[ts(as = "String")] - pub rid: RepoId, - pub seeding: usize, -} - -#[derive(Serialize, TS)] -#[ts(export)] -pub struct SupportedPayloads { - #[serde(rename = "xyz.radicle.project")] - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(optional)] - #[ts(type = r#"{ - data: { - defaultBranch: string, - description: string, - name: string, - }, - meta: { - head: string, - issues: { - open: number, - closed: number, - }, - patches: { - open: number, - draft: number, - archived: number, - merged: number, - } - lastCommit: number, - } -}"#)] - pub project: Option, -} diff --git a/src/components/IssueTeaser.svelte b/src/components/IssueTeaser.svelte index f487031..3323179 100644 --- a/src/components/IssueTeaser.svelte +++ b/src/components/IssueTeaser.svelte @@ -1,5 +1,5 @@