From 3d5e8bba36d8d3bead39d2ec85dddfe09f242bc7 Mon Sep 17 00:00:00 2001 From: Miles Johnson Date: Fri, 31 May 2024 17:11:13 -0700 Subject: [PATCH] new: Support aliases/versions in config. (#25) --- .github/workflows/ci.yml | 2 +- CHANGELOG.md | 7 + Cargo.lock | 290 ++++++++++++++++++++------------------- Cargo.toml | 16 +-- src/proto.rs | 51 +++---- src/schema.rs | 6 +- 6 files changed, 194 insertions(+), 178 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3508016..db64511 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,7 +40,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-latest, macos-13, windows-latest] + os: [ubuntu-latest, macos-latest, windows-latest] fail-fast: false steps: - uses: actions/checkout@v4 diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e513ee..45db779 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## 0.13.0 + +#### 🚀 Updates + +- Added `resolve.aliases` and `resolve.versions` settings, allowing an explicit list of aliases and versions to be defined. The versions list will be merged with other git/manifest extracted versions. +- Updated to support proto v0.36 release. + ## 0.12.0 #### 🚀 Updates diff --git a/Cargo.lock b/Cargo.lock index c20f7d7..a819b6c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -68,9 +68,9 @@ checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b" [[package]] name = "anyhow" -version = "1.0.82" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f538837af36e6f6a9be0faa67f9a314f8119e4e4b5867c6ab40ed60360142519" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] name = "arbitrary" @@ -119,7 +119,7 @@ checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.66", ] [[package]] @@ -233,9 +233,9 @@ checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" [[package]] name = "cached" -version = "0.51.1" +version = "0.51.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "827444961d1a2335221ca1f6026127ab6f767bcec3bf88d19b18204265c595c3" +checksum = "dd93a9f06ec296ca66b4c26fafa9ed63f32c473d7a708a5f28563ee64c948515" dependencies = [ "ahash", "cached_proc_macro", @@ -255,7 +255,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.66", ] [[package]] @@ -644,9 +644,9 @@ dependencies = [ [[package]] name = "darling" -version = "0.20.8" +version = "0.20.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54e36fcd13ed84ffdfda6f5be89b31287cbb80c439841fe69e04841435464391" +checksum = "83b2eb4d90d12bdda5ed17de686c2acb4c57914f8f921b8da7e112b5a36f3fe1" dependencies = [ "darling_core", "darling_macro", @@ -654,27 +654,27 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.20.8" +version = "0.20.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c2cf1c23a687a1feeb728783b993c4e1ad83d99f351801977dd809b48d0a70f" +checksum = "622687fe0bac72a04e5599029151f5796111b90f1baaa9b544d807a5e31cd120" dependencies = [ "fnv", "ident_case", "proc-macro2", "quote", "strsim", - "syn 2.0.60", + "syn 2.0.66", ] [[package]] name = "darling_macro" -version = "0.20.8" +version = "0.20.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a668eda54683121533a393014d8692171709ff57a7d61f187b6e782719f8933f" +checksum = "733cabb43482b1a1b53eee8583c2b9e8684d592215ea83efd305dd31bc2f0178" dependencies = [ "darling_core", "quote", - "syn 2.0.60", + "syn 2.0.66", ] [[package]] @@ -694,7 +694,7 @@ checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.66", ] [[package]] @@ -789,7 +789,7 @@ checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.66", ] [[package]] @@ -850,7 +850,7 @@ dependencies = [ "serde", "serde_json", "sha2", - "toml 0.8.12", + "toml 0.8.13", "tracing", "tracing-subscriber", "ureq", @@ -886,7 +886,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.66", ] [[package]] @@ -902,12 +902,12 @@ dependencies = [ [[package]] name = "extism-pdk" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f9a87d636d30b75e697642dd4f6cff2054db5a7a5d69d6601041a76265bb681" +checksum = "c26a361aeddab8ebbb6157eeed9a8341358d6843c5f5a53677466caf5f0b5eaf" dependencies = [ "anyhow", - "base64 0.21.7", + "base64 0.22.1", "extism-convert", "extism-manifest", "extism-pdk-derive", @@ -917,13 +917,13 @@ dependencies = [ [[package]] name = "extism-pdk-derive" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d83995c2023720a0fd5ef2a349c89c1670efb37a979228b0218705f5ddb50d4b" +checksum = "3a024b0f20295098d1d19ad443fad077c1d8c1d81d09a2c20f0618ebd201517e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.66", ] [[package]] @@ -1008,9 +1008,9 @@ dependencies = [ [[package]] name = "fs4" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21dabded2e32cd57ded879041205c60a4a4c4bab47bd0fd2fa8b01f30849f02b" +checksum = "73969b81e8bc90a3828d913dd3973d80771bfb9d7fbe1a78a79122aad456af15" dependencies = [ "rustix", "windows-sys 0.52.0", @@ -1121,7 +1121,7 @@ dependencies = [ "proc-macro2", "quote", "regex", - "syn 2.0.60", + "syn 2.0.66", ] [[package]] @@ -1429,9 +1429,9 @@ dependencies = [ [[package]] name = "insta" -version = "1.38.0" +version = "1.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3eab73f58e59ca6526037208f0e98851159ec1633cf17b6cd2e1f2c3fd5d53cc" +checksum = "810ae6042d48e2c9e9215043563a58a80b877bc863228a74cf10c49d4620a6f5" dependencies = [ "console", "lazy_static", @@ -1603,6 +1603,12 @@ dependencies = [ "scopeguard", ] +[[package]] +name = "lockfree-object-pool" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9374ef4228402d4b7e403e5838cb880d9ee663314b0a900d5a6aabf0c213552e" + [[package]] name = "log" version = "0.4.21" @@ -1638,7 +1644,7 @@ dependencies = [ "manyhow-macros", "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.66", ] [[package]] @@ -1711,7 +1717,7 @@ checksum = "dcf09caffaac8068c346b6df2a7fc27a177fd20b39421a39ce0a211bde679a6c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.66", ] [[package]] @@ -1808,27 +1814,6 @@ dependencies = [ "libc", ] -[[package]] -name = "num_enum" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02339744ee7253741199f897151b38e72257d13802d4ee837285cc2990a90845" -dependencies = [ - "num_enum_derive", -] - -[[package]] -name = "num_enum_derive" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "681030a937600a36906c185595136d26abfebb4aa9c65701cefcaf8578bb982b" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn 2.0.60", -] - [[package]] name = "object" version = "0.32.2" @@ -1849,9 +1834,9 @@ checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "once_map" -version = "0.4.17" +version = "0.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a05092df80cfce3eca08e79881dd82c9c369ba7abb6405c2377689b74649b4aa" +checksum = "aa7085055bbe9c8edbd982048dbcf8181794d4a81cb04a11931673e63cc18dc6" dependencies = [ "ahash", "hashbrown 0.14.5", @@ -1935,7 +1920,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.66", ] [[package]] @@ -2033,9 +2018,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.81" +version = "1.0.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d1597b0c024618f09a9c3b8655b7e430397a36d23fdafec26d6965e9eec3eba" +checksum = "ec96c6a92621310b51366f1e28d05ef11489516e93be030060e5fc12024a49d6" dependencies = [ "unicode-ident", ] @@ -2060,17 +2045,16 @@ dependencies = [ "itertools 0.12.1", "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.66", ] [[package]] name = "proto_core" -version = "0.35.0" +version = "0.35.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4f2b10e3da2c7c3f84a4337b5e4fec22a8ea085b34a72875a400c51cc7249b3" +checksum = "8fdc7d78d8c60dac75d9c16b84a509b3f3cbbd802ea40c66d976fcf1030abcdd" dependencies = [ "cached", - "human-sort", "indexmap 2.2.6", "miette", "minisign-verify", @@ -2090,7 +2074,6 @@ dependencies = [ "starbase_events", "starbase_styles", "starbase_utils", - "system_env", "thiserror", "tracing", "url", @@ -2101,9 +2084,9 @@ dependencies = [ [[package]] name = "proto_pdk" -version = "0.18.0" +version = "0.19.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14625e6a19b3904f616d5d0041b30e16a922ada09e5b4e7b32d6622ebdee0e9b" +checksum = "aa2a041abb22474f6fa8bf105ec1fb8f8ca547b8ae954e743e1af214307505a7" dependencies = [ "extism-pdk", "proto_pdk_api", @@ -2114,9 +2097,9 @@ dependencies = [ [[package]] name = "proto_pdk_api" -version = "0.18.0" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a919534a8bbb6b667a5c866e26bc442194d58c9b5a3d6f946d98c73dd29437ed" +checksum = "5d710e1938a488cc46ca0ed82ebbb308d6c753e4325b3b67c9a983ff83f43466" dependencies = [ "rustc-hash", "semver", @@ -2130,25 +2113,24 @@ dependencies = [ [[package]] name = "proto_pdk_test_utils" -version = "0.22.0" +version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16b1c9e7b55e456f629ae32e84d3fe03ed7ab5bcea15c39c52c1f99644cba663" +checksum = "cbb08c0b0ce7f7d7a0628388bf5667080634c533af90483e294dd2be1acca1b4" dependencies = [ - "extism", "proto_core", "proto_pdk_api", "serde", "serde_json", "starbase_sandbox", - "toml 0.8.12", + "toml 0.8.13", "warpgate", ] [[package]] name = "proto_shim" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69eb6a333b2bd4d69293128571e1bdc3f12845ad2d51f668e21429a0fa6e9783" +checksum = "2b9bcdc4ca89c9f457eae2c50e03154ddd6deb7b40593b7456786ba7d4935954" dependencies = [ "command-group", "dirs 5.0.1", @@ -2508,7 +2490,7 @@ dependencies = [ [[package]] name = "schema_plugin" -version = "0.12.0" +version = "0.13.0" dependencies = [ "extism-pdk", "proto_pdk", @@ -2522,9 +2504,9 @@ dependencies = [ [[package]] name = "schematic" -version = "0.15.2" +version = "0.16.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edb426f2d2532207066880373c8ce4563d6081aba7f5f0fe0238ca472da77497" +checksum = "a2a97356d9a387d6963940ab05de6ac9dbee0c3c97090247954c3d4c2ddc5b8d" dependencies = [ "garde", "indexmap 2.2.6", @@ -2535,32 +2517,32 @@ dependencies = [ "serde_path_to_error", "starbase_styles", "thiserror", - "toml 0.8.12", + "toml 0.8.13", "tracing", ] [[package]] name = "schematic_macros" -version = "0.15.1" +version = "0.16.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0a7224975c12290c2e152c0554cfbb936018de66b480e82067fc7eaf0153652" +checksum = "906eff11b3963e20f5d33fb6dfc67d84351769917970c0d7ebf86e1782d869b5" dependencies = [ "convert_case", "darling", "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.66", ] [[package]] name = "schematic_types" -version = "0.7.0" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c881455700a86164b6c578b4cbbef17eac2fbcc0cb51c4473edda11161f8efd" +checksum = "788660c0972a2aab386e2b4b8bd304e0b21c21751e2722cead28d059597d3dad" dependencies = [ "indexmap 2.2.6", "serde_json", - "toml 0.8.12", + "toml 0.8.13", ] [[package]] @@ -2594,38 +2576,38 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.22" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca" +checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" dependencies = [ "serde", ] [[package]] name = "serde" -version = "1.0.200" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddc6f9cc94d67c0e21aaf7eda3a010fd3af78ebf6e096aa6e2e13c79749cce4f" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.200" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "856f046b9400cee3c8c94ed572ecdb752444c24528c035cd35882aad6f492bcb" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.66", ] [[package]] name = "serde_json" -version = "1.0.116" +version = "1.0.117" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e17db7126d17feb94eb3fad46bf1a96b034e8aacbc2e775fe81505f8b0b2813" +checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3" dependencies = [ "itoa", "ryu", @@ -2644,9 +2626,9 @@ dependencies = [ [[package]] name = "serde_spanned" -version = "0.6.5" +version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb3622f419d1296904700073ea6cc23ad690adbd66f13ea683df73298736f0c1" +checksum = "79e674e01f999af37c49f70a6ede167a8a60b2503e56c5599532a65baa5969a0" dependencies = [ "serde", ] @@ -2707,6 +2689,12 @@ dependencies = [ "libc", ] +[[package]] +name = "simd-adler32" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" + [[package]] name = "similar" version = "2.5.0" @@ -2764,9 +2752,9 @@ checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" [[package]] name = "starbase_archive" -version = "0.7.0" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09f93b74e21c0a0898b34801b248aa59c12af6cb28e1acd9255387b1d4e7f024" +checksum = "f6c534fa921df0a5ee7d59029a53fa9f91db6dadfaf4e8cfd15785079e1ec7cb" dependencies = [ "binstall-tar", "flate2", @@ -2802,14 +2790,14 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.66", ] [[package]] name = "starbase_sandbox" -version = "0.6.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4527717975a09f1eea17706fe771e76de32e55632bcb67b871b5f389dc5b6f21" +checksum = "0e87bd5565afbfbe20f19efa79db83d714a93fc21557dbdb4ccd8b02c08b295a" dependencies = [ "assert_cmd", "assert_fs", @@ -2834,9 +2822,9 @@ dependencies = [ [[package]] name = "starbase_utils" -version = "0.7.0" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5828b9cf2a404efd876ea5999eb600b93dccc751368427cc4a08c2c7ab48860b" +checksum = "dc87e39c8390c2bf72ba24c38d1776f1a77745e7c756eea3c0d5d7c5a6798b4d" dependencies = [ "dirs 5.0.1", "fs4", @@ -2850,7 +2838,7 @@ dependencies = [ "starbase_styles", "thiserror", "tokio", - "toml 0.8.12", + "toml 0.8.13", "tracing", "url", "wax", @@ -2864,9 +2852,9 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "strsim" -version = "0.10.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "subtle" @@ -2896,9 +2884,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.60" +version = "2.0.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "909518bc7b1c9b779f1bbf07f2929d35af9f0f37e47c6e9ef7f9dddc1e1821f3" +checksum = "c42f3f41a2de00b01c0aaad383c5a45241efc8b2d1eda5661812fda5f3cdcff5" dependencies = [ "proc-macro2", "quote", @@ -2950,9 +2938,9 @@ dependencies = [ [[package]] name = "system_env" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f5ebaa3f28bef9be9e986a72937103a9fb4659e8da6170706936a9a80d1a304" +checksum = "2c064041fa3a15e81801a7853412a5188d0796e7638b0a9578dd72a52d03304d" dependencies = [ "schematic", "serde", @@ -2987,22 +2975,22 @@ checksum = "3369f5ac52d5eb6ab48c6b4ffdc8efbcad6b89c765749064ba298f2c68a16a76" [[package]] name = "thiserror" -version = "1.0.59" +version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0126ad08bff79f29fc3ae6a55cc72352056dfff61e3ff8bb7129476d44b23aa" +checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.59" +version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1cd413b5d558b4c5bf3680e324a6fa5014e7b7c067a51e69dbdf47eb7148b66" +checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.66", ] [[package]] @@ -3032,9 +3020,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.37.0" +version = "1.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787" +checksum = "ba4f4a02a7a80d6f274636f0aa95c7e383b912d41fe721a31f29e29698585a4a" dependencies = [ "backtrace", "bytes", @@ -3051,13 +3039,13 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" +checksum = "5f5ae998a069d4b5aba8ee9dad856af7d520c3699e6159b185c2acd48155d39a" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.66", ] [[package]] @@ -3095,21 +3083,21 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.12" +version = "0.8.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9dd1545e8208b4a5af1aa9bbd0b4cf7e9ea08fabc5d0a5c67fcaafa17433aa3" +checksum = "a4e43f8cc456c9704c851ae29c67e17ef65d2c30017c17a9765b89c382dc8bba" dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.22.12", + "toml_edit 0.22.13", ] [[package]] name = "toml_datetime" -version = "0.6.5" +version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" +checksum = "4badfd56924ae69bcc9039335b2e017639ce3f9b001c393c1b2d1ef846ce2cbf" dependencies = [ "serde", ] @@ -3127,9 +3115,9 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.22.12" +version = "0.22.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3328d4f68a705b2a4498da1d580585d39a6510f98318a2cec3018a7ec61ddef" +checksum = "c127785850e8c20836d49732ae6abfa47616e60bf9d9f57c43c250361a9db96c" dependencies = [ "indexmap 2.2.6", "serde", @@ -3186,7 +3174,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.66", ] [[package]] @@ -3336,9 +3324,9 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "version_spec" -version = "0.4.0" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfd5948fd42878c5fcaf8afe91cd7ee22ca36da7b99a61fdf9123fe60b898a69" +checksum = "5cb928fc92912272002d6cc0c484d345867936785dec98ee16aae18429793550" dependencies = [ "human-sort", "regex", @@ -3377,9 +3365,9 @@ dependencies = [ [[package]] name = "warpgate" -version = "0.13.0" +version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70a7c6ef5c29ba1cee1d7616da20415471e03816ea1bb6e1907705fbe2294797" +checksum = "480cc4652553f5dda75b1e4e805f913398b6ac3c256857743eb80909f145daa9" dependencies = [ "extism", "miette", @@ -3387,7 +3375,6 @@ dependencies = [ "once_map", "regex", "reqwest", - "rustc-hash", "schematic", "serde", "serde_json", @@ -3403,9 +3390,9 @@ dependencies = [ [[package]] name = "warpgate_api" -version = "0.6.0" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bdd9d3f91f9c38b90c34fb9c893ce656383f5465bce3ea6c56825df0f3afd45" +checksum = "9d4116026e64f9abe6ea132ee8fb535833a5faab2bad22041e5915ca2f5fae82" dependencies = [ "anyhow", "rustc-hash", @@ -3418,9 +3405,9 @@ dependencies = [ [[package]] name = "warpgate_pdk" -version = "0.4.0" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f1b738dbd3be1d299c162ea57dbae8c5af345fc2df0f76886975f559981f507" +checksum = "e00d87bf603d9de74fff69cf19e477a17dcc0b09ef77ef71270ea4f5825a2ff5" dependencies = [ "extism-pdk", "serde", @@ -3497,7 +3484,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.66", "wasm-bindgen-shared", ] @@ -3531,7 +3518,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.66", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -3668,7 +3655,7 @@ dependencies = [ "anyhow", "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.66", "wasmtime-component-util", "wasmtime-wit-bindgen", "wit-parser", @@ -3860,7 +3847,7 @@ checksum = "e04682ce587aa8fa9311d3c95148381f08a1db274ad6bcd3553f7c97c8c2debb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.66", ] [[package]] @@ -4024,7 +4011,7 @@ dependencies = [ "proc-macro2", "quote", "shellexpand", - "syn 2.0.60", + "syn 2.0.66", "witx", ] @@ -4036,7 +4023,7 @@ checksum = "4a781d29bfd788595f4a392a6f606699e59577b7f4b2858da2ae4068f4d757c8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.66", "wiggle-generate", ] @@ -4343,7 +4330,7 @@ checksum = "6f4b6c273f496d8fd4eaf18853e6b448760225dc030ff2c485a786859aea6393" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.66", ] [[package]] @@ -4354,9 +4341,9 @@ checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" [[package]] name = "zip" -version = "1.1.4" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cc23c04387f4da0374be4533ad1208cbb091d5c11d070dfef13676ad6497164" +checksum = "1dd56a4d5921bc2f99947ac5b3abe5f510b1be7376fdc5e9fce4a23c6a93e87c" dependencies = [ "arbitrary", "crc32fast", @@ -4364,8 +4351,23 @@ dependencies = [ "displaydoc", "flate2", "indexmap 2.2.6", - "num_enum", + "memchr", "thiserror", + "zopfli", +] + +[[package]] +name = "zopfli" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5019f391bac5cf252e93bbcc53d039ffd62c7bfb7c150414d61369afe57e946" +dependencies = [ + "bumpalo", + "crc32fast", + "lockfree-object-pool", + "log", + "once_cell", + "simd-adler32", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index cca620a..33a63c6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "schema_plugin" -version = "0.12.0" +version = "0.13.0" edition = "2021" license = "MIT" publish = false @@ -9,21 +9,21 @@ publish = false crate-type = ['cdylib'] [dependencies] -extism-pdk = "1.1.0" -proto_pdk = { version = "0.18.0" } #, path = "../../proto/crates/pdk" } +extism-pdk = "1.2.0" +proto_pdk = { version = "0.19.2" } #, path = "../../proto/crates/pdk" } regex = { version = "1.10.4", default-features = false, features = [ "std", "unicode-perl", ] } -serde = "1.0.200" -serde_json = "1.0.116" +serde = "1.0.203" +serde_json = "1.0.117" [dev-dependencies] -proto_pdk_test_utils = { version = "0.22.0", features = [ +proto_pdk_test_utils = { version = "0.23.1", features = [ "schema", ] } #, path = "../../proto/crates/pdk-test-utils" } -starbase_sandbox = "0.6.0" -tokio = { version = "1.37.0", features = ["full"] } +starbase_sandbox = "0.6.1" +tokio = { version = "1.38.0", features = ["full"] } [features] default = ["wasm"] diff --git a/src/proto.rs b/src/proto.rs index 019740b..ab1eb24 100644 --- a/src/proto.rs +++ b/src/proto.rs @@ -3,7 +3,7 @@ use extism_pdk::*; use proto_pdk::*; use regex::Captures; use serde_json::Value as JsonValue; -use std::collections::HashMap; +use std::collections::{HashMap, HashSet}; use std::path::PathBuf; #[host_fn] @@ -102,7 +102,9 @@ fn create_version(cap: Captures) -> String { #[plugin_fn] pub fn load_versions(Json(_): Json) -> FnResult> { let schema = get_schema()?; + let mut versions: HashSet = HashSet::from_iter(schema.resolve.versions); + // Git tags if let Some(repository) = schema.resolve.git_url { let pattern = regex::Regex::new( schema @@ -112,48 +114,49 @@ pub fn load_versions(Json(_): Json) -> FnResult>(); - - return Ok(Json(LoadVersionsOutput::from(tags)?)); + for tag in load_git_tags(repository)? { + if let Some(cap) = pattern.captures(&tag) { + versions.insert(Version::parse(&create_version(cap))?); + } + } } - - if let Some(endpoint) = schema.resolve.manifest_url { + // URL endpoint + else if let Some(endpoint) = schema.resolve.manifest_url { let pattern = regex::Regex::new(&schema.resolve.version_pattern)?; let version_key = &schema.resolve.manifest_version_key; - let response: Vec = fetch_url(endpoint)?; - let mut versions = vec![]; - let mut push_version = |v: &str| { - if let Some(cap) = pattern.captures(v) { - versions.push(create_version(cap)); - } - }; + let response: Vec = fetch_url(endpoint)?; for row in response { match row { JsonValue::String(v) => { - push_version(&v); + if let Some(cap) = pattern.captures(&v) { + versions.insert(Version::parse(&create_version(cap))?); + } } JsonValue::Object(o) => { if let Some(JsonValue::String(v)) = o.get(version_key) { - push_version(v); + if let Some(cap) = pattern.captures(v) { + versions.insert(Version::parse(&create_version(cap))?); + } } } _ => {} } } + } - return Ok(Json(LoadVersionsOutput::from(versions)?)); + let mut output = LoadVersionsOutput::from_versions(versions.into_iter().collect()); + output.aliases.extend(schema.resolve.aliases); + + if output.versions.is_empty() { + return Err(plugin_err!( + "Unable to resolve versions for {}. Schema either requires a resolve.git_url or resolve.manifest_url.", + schema.name + )); } - Err(plugin_err!( - "Unable to resolve versions for {}. Schema either requires a resolve.git_url or resolve.manifest_url.", - schema.name - )) + Ok(Json(output)) } #[plugin_fn] diff --git a/src/schema.rs b/src/schema.rs index c9d7573..891b14a 100644 --- a/src/schema.rs +++ b/src/schema.rs @@ -1,4 +1,4 @@ -use proto_pdk::{HostArch, HostLibc, HostOS}; +use proto_pdk::{HostArch, HostLibc, HostOS, Version}; use serde::Deserialize; use std::collections::HashMap; use std::path::PathBuf; @@ -64,6 +64,8 @@ pub struct PackagesSchema { #[derive(Debug, Deserialize)] #[serde(default, rename_all = "kebab-case")] pub struct ResolveSchema { + pub aliases: HashMap, + pub versions: Vec, pub version_pattern: String, // Manifest pub manifest_url: Option, @@ -76,10 +78,12 @@ pub struct ResolveSchema { impl Default for ResolveSchema { fn default() -> Self { ResolveSchema { + aliases: HashMap::new(), manifest_url: None, manifest_version_key: "version".to_string(), git_url: None, git_tag_pattern: None, + versions: vec![], version_pattern: r"^v?((?[0-9]+)\.(?[0-9]+)\.(?[0-9]+)(?
-[0-9a-zA-Z\.]+)?(?\+[-0-9a-zA-Z\.]+)?)$"
                     .to_string(),