diff --git a/application/apps/indexer/plugins/file_source/Cargo.lock b/application/apps/indexer/plugins/file_source/Cargo.lock index 851c7ac001..8ec10b32f6 100644 --- a/application/apps/indexer/plugins/file_source/Cargo.lock +++ b/application/apps/indexer/plugins/file_source/Cargo.lock @@ -2,24 +2,18 @@ # It is not intended for manual editing. version = 4 -[[package]] -name = "ahash" -version = "0.8.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" -dependencies = [ - "cfg-if", - "once_cell", - "version_check", - "zerocopy", -] - [[package]] name = "anyhow" version = "1.0.93" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c95c10ba0b00a02636238b814946408b1322d5ac4760326e6fb8ec956d85775" +[[package]] +name = "autocfg" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" + [[package]] name = "bitflags" version = "2.6.0" @@ -27,10 +21,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] -name = "cfg-if" -version = "1.0.0" +name = "displaydoc" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] [[package]] name = "equivalent" @@ -46,19 +45,117 @@ dependencies = [ ] [[package]] -name = "hashbrown" -version = "0.14.5" +name = "foldhash" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0d2fde1f7b3d48b8395d5f2de76c18a528bd6a9cdde438df747bfcba3e05d6f" + +[[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 = "futures" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" + +[[package]] +name = "futures-executor" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" + +[[package]] +name = "futures-macro" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "futures-sink" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" + +[[package]] +name = "futures-task" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" + +[[package]] +name = "futures-util" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" dependencies = [ - "ahash", + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", ] [[package]] name = "hashbrown" -version = "0.15.1" +version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a9bfc1af68b1726ea47d3d5109de126281def866b33970e10fbab11b5dafab3" +checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" +dependencies = [ + "foldhash", +] [[package]] name = "heck" @@ -66,20 +163,159 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" +[[package]] +name = "icu_collections" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locid" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_locid_transform" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_locid_transform_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_locid_transform_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdc8ff3388f852bede6b579ad4e978ab004f139284d7b28715f773507b946f6e" + +[[package]] +name = "icu_normalizer" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "utf16_iter", + "utf8_iter", + "write16", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8cafbf7aa791e9b22bec55a167906f9e1215fd475cd22adfcf660e03e989516" + +[[package]] +name = "icu_properties" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93d6020766cfc6302c15dbbc9c8778c37e62c14427cb7f6e601d849e092aeef5" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locid_transform", + "icu_properties_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67a8effbc3dd3e4ba1afa8ad918d5684b8868b3b26500753effea8d2eed19569" + +[[package]] +name = "icu_provider" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_provider_macros", + "stable_deref_trait", + "tinystr", + "writeable", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_provider_macros" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "id-arena" version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "25a2bc672d1148e28034f176e01fffebb08b35768468cc954630da77a1449005" +[[package]] +name = "idna" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daca1df1c957320b2cf139ac61e7bd64fed304c5040df000a745aa1de3b4ef71" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + [[package]] name = "indexmap" -version = "2.6.0" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" +checksum = "8c9c992b02b5b4c94ea26e32fe5bccb7aa7d9f390ab5c1221ff895bc7ea8b652" dependencies = [ "equivalent", - "hashbrown 0.15.1", + "hashbrown", "serde", ] @@ -95,6 +331,12 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" +[[package]] +name = "litemap" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ee93343901ab17bd981295f2cf0026d4ad018c7c31ba84549a4ddbb47a45104" + [[package]] name = "log" version = "0.4.22" @@ -113,6 +355,24 @@ version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" +[[package]] +name = "percent-encoding" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" + +[[package]] +name = "pin-project-lite" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + [[package]] name = "plugins_api" version = "0.1.0" @@ -193,6 +453,15 @@ dependencies = [ "serde", ] +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + [[package]] name = "smallvec" version = "1.13.2" @@ -208,6 +477,12 @@ dependencies = [ "smallvec", ] +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + [[package]] name = "syn" version = "2.0.96" @@ -219,6 +494,27 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "synstructure" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tinystr" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" +dependencies = [ + "displaydoc", + "zerovec", +] + [[package]] name = "unicode-ident" version = "1.0.13" @@ -232,16 +528,33 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" [[package]] -name = "version_check" -version = "0.9.5" +name = "url" +version = "2.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" +checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", +] + +[[package]] +name = "utf16_iter" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" [[package]] name = "wasm-encoder" -version = "0.220.0" +version = "0.223.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebf48234b389415b226a4daef6562933d38c7b28a8b8f64c5c4130dad1561ab7" +checksum = "7e636076193fa68103e937ac951b5f2f587624097017d764b8984d9c0f149464" dependencies = [ "leb128", "wasmparser", @@ -249,9 +562,9 @@ dependencies = [ [[package]] name = "wasm-metadata" -version = "0.220.0" +version = "0.223.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f3e5f5920c5abfc45573c89b07b38efdaae1515ef86f83dad12d60e50ecd62b" +checksum = "5c730c3379d3d20e5a0245b0724b924483e853588ca8fba547c1e21f19e7d735" dependencies = [ "anyhow", "indexmap", @@ -259,28 +572,28 @@ dependencies = [ "serde_derive", "serde_json", "spdx", + "url", "wasm-encoder", "wasmparser", ] [[package]] name = "wasmparser" -version = "0.220.0" +version = "0.223.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e246c2772ce3ebc83f89a2d4487ac5794cad6c309b2071818a88c7db7c36d87b" +checksum = "d5a99faceb1a5a84dd6084ec4bfa4b2ab153b5793b43fd8f58b89232634afc35" dependencies = [ - "ahash", "bitflags", - "hashbrown 0.14.5", + "hashbrown", "indexmap", "semver", ] [[package]] name = "wit-bindgen" -version = "0.36.0" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a2b3e15cd6068f233926e7d8c7c588b2ec4fb7cc7bf3824115e7c7e2a8485a3" +checksum = "9219694564701fa935754f1552ce299154fc74948d6d148134ce55f3504c8bf1" dependencies = [ "wit-bindgen-rt", "wit-bindgen-rust-macro", @@ -288,9 +601,9 @@ dependencies = [ [[package]] name = "wit-bindgen-core" -version = "0.36.0" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b632a5a0fa2409489bd49c9e6d99fcc61bb3d4ce9d1907d44662e75a28c71172" +checksum = "8ba105733ba146c94e067793fb46505265ea8720eb14ceae65b10797c7728a65" dependencies = [ "anyhow", "heck", @@ -299,18 +612,20 @@ dependencies = [ [[package]] name = "wit-bindgen-rt" -version = "0.36.0" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7947d0131c7c9da3f01dfde0ab8bd4c4cf3c5bd49b6dba0ae640f1fa752572ea" +checksum = "fc801b991c56492f87ab3086e786468f75c285a4d73017ab0ebc2fa1aed5d82c" dependencies = [ "bitflags", + "futures", + "once_cell", ] [[package]] name = "wit-bindgen-rust" -version = "0.36.0" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4329de4186ee30e2ef30a0533f9b3c123c019a237a7c82d692807bf1b3ee2697" +checksum = "257e0d217bc06635837d751447c39e77b9901752e052288ff6fe0fdb17850bc5" dependencies = [ "anyhow", "heck", @@ -324,9 +639,9 @@ dependencies = [ [[package]] name = "wit-bindgen-rust-macro" -version = "0.36.0" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "177fb7ee1484d113b4792cc480b1ba57664bbc951b42a4beebe573502135b1fc" +checksum = "8ac98caa9302234687b8e67ce7dfcf31ae5238523f166b93c23988fd0d4e0594" dependencies = [ "anyhow", "prettyplease", @@ -339,9 +654,9 @@ dependencies = [ [[package]] name = "wit-component" -version = "0.220.0" +version = "0.223.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73ccedf54cc65f287da268d64d2bf4f7530d2cfb2296ffbe3ad5f65567e4cf53" +checksum = "c10ed2aeee4c8ec5715875f62f4a3de3608d6987165c116810d8c2908aa9d93b" dependencies = [ "anyhow", "bitflags", @@ -358,9 +673,9 @@ dependencies = [ [[package]] name = "wit-parser" -version = "0.220.0" +version = "0.223.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b7117ce3adc0b4354b46dc1cf3190b00b333e65243d244c613ffcc58bdec84d" +checksum = "92772f4dcacb804b275981eea1d920b12b377993b53307f1e33d87404e080281" dependencies = [ "anyhow", "id-arena", @@ -375,19 +690,78 @@ dependencies = [ ] [[package]] -name = "zerocopy" -version = "0.7.35" +name = "write16" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" + +[[package]] +name = "writeable" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" + +[[package]] +name = "yoke" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "120e6aef9aa629e3d4f52dc8cc43a015c7724194c97dfaf45180d2daf2b77f40" +dependencies = [ + "serde", + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zerofrom" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cff3ee08c995dee1859d998dea82f7374f2826091dd9cd47def953cae446cd2e" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zerovec" +version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +checksum = "aa2b893d79df23bfb12d5461018d408ea19dfafe76c2c7ef6d4eba614f8ff079" dependencies = [ - "zerocopy-derive", + "yoke", + "zerofrom", + "zerovec-derive", ] [[package]] -name = "zerocopy-derive" -version = "0.7.35" +name = "zerovec-derive" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" dependencies = [ "proc-macro2", "quote", diff --git a/application/apps/indexer/plugins/file_source/src/lib.rs b/application/apps/indexer/plugins/file_source/src/lib.rs index b0894566a3..1c07aaa770 100644 --- a/application/apps/indexer/plugins/file_source/src/lib.rs +++ b/application/apps/indexer/plugins/file_source/src/lib.rs @@ -9,11 +9,11 @@ use std::{ }; use plugins_api::{ - bytesource::{ - ByteSource, ConfigItem, ConfigSchemaItem, ConfigSchemaType, ConfigValue, InitError, - SourceConfig, SourceError, Version, - }, + bytesource::{ByteSource, SourceConfig, SourceError}, bytesource_export, log, + shared_types::{ + ConfigItem, ConfigSchemaItem, ConfigSchemaType, ConfigValue, InitError, Version, + }, }; const INPUT_PATH_ID: &str = "input-path"; diff --git a/application/apps/indexer/plugins/string_parser/Cargo.lock b/application/apps/indexer/plugins/string_parser/Cargo.lock index ff127f9574..801d509a2f 100644 --- a/application/apps/indexer/plugins/string_parser/Cargo.lock +++ b/application/apps/indexer/plugins/string_parser/Cargo.lock @@ -2,24 +2,18 @@ # It is not intended for manual editing. version = 4 -[[package]] -name = "ahash" -version = "0.8.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" -dependencies = [ - "cfg-if", - "once_cell", - "version_check", - "zerocopy", -] - [[package]] name = "anyhow" version = "1.0.93" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c95c10ba0b00a02636238b814946408b1322d5ac4760326e6fb8ec956d85775" +[[package]] +name = "autocfg" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" + [[package]] name = "bitflags" version = "2.6.0" @@ -27,10 +21,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] -name = "cfg-if" -version = "1.0.0" +name = "displaydoc" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] [[package]] name = "equivalent" @@ -39,19 +38,117 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] -name = "hashbrown" -version = "0.14.5" +name = "foldhash" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0d2fde1f7b3d48b8395d5f2de76c18a528bd6a9cdde438df747bfcba3e05d6f" + +[[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 = "futures" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" + +[[package]] +name = "futures-executor" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" + +[[package]] +name = "futures-macro" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "futures-sink" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" + +[[package]] +name = "futures-task" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" + +[[package]] +name = "futures-util" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" dependencies = [ - "ahash", + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", ] [[package]] name = "hashbrown" -version = "0.15.1" +version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a9bfc1af68b1726ea47d3d5109de126281def866b33970e10fbab11b5dafab3" +checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" +dependencies = [ + "foldhash", +] [[package]] name = "heck" @@ -59,20 +156,159 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" +[[package]] +name = "icu_collections" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locid" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_locid_transform" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_locid_transform_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_locid_transform_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdc8ff3388f852bede6b579ad4e978ab004f139284d7b28715f773507b946f6e" + +[[package]] +name = "icu_normalizer" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "utf16_iter", + "utf8_iter", + "write16", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8cafbf7aa791e9b22bec55a167906f9e1215fd475cd22adfcf660e03e989516" + +[[package]] +name = "icu_properties" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93d6020766cfc6302c15dbbc9c8778c37e62c14427cb7f6e601d849e092aeef5" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locid_transform", + "icu_properties_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67a8effbc3dd3e4ba1afa8ad918d5684b8868b3b26500753effea8d2eed19569" + +[[package]] +name = "icu_provider" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_provider_macros", + "stable_deref_trait", + "tinystr", + "writeable", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_provider_macros" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "id-arena" version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "25a2bc672d1148e28034f176e01fffebb08b35768468cc954630da77a1449005" +[[package]] +name = "idna" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daca1df1c957320b2cf139ac61e7bd64fed304c5040df000a745aa1de3b4ef71" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + [[package]] name = "indexmap" -version = "2.6.0" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" +checksum = "8c9c992b02b5b4c94ea26e32fe5bccb7aa7d9f390ab5c1221ff895bc7ea8b652" dependencies = [ "equivalent", - "hashbrown 0.15.1", + "hashbrown", "serde", ] @@ -88,6 +324,12 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" +[[package]] +name = "litemap" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ee93343901ab17bd981295f2cf0026d4ad018c7c31ba84549a4ddbb47a45104" + [[package]] name = "log" version = "0.4.22" @@ -106,6 +348,24 @@ version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" +[[package]] +name = "percent-encoding" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" + +[[package]] +name = "pin-project-lite" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + [[package]] name = "plugins_api" version = "0.1.0" @@ -186,6 +446,15 @@ dependencies = [ "serde", ] +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + [[package]] name = "smallvec" version = "1.13.2" @@ -201,6 +470,12 @@ dependencies = [ "smallvec", ] +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + [[package]] name = "string_parser" version = "0.1.0" @@ -220,6 +495,27 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "synstructure" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tinystr" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" +dependencies = [ + "displaydoc", + "zerovec", +] + [[package]] name = "unicode-ident" version = "1.0.13" @@ -233,16 +529,33 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" [[package]] -name = "version_check" -version = "0.9.5" +name = "url" +version = "2.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" +checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", +] + +[[package]] +name = "utf16_iter" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" [[package]] name = "wasm-encoder" -version = "0.220.0" +version = "0.223.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebf48234b389415b226a4daef6562933d38c7b28a8b8f64c5c4130dad1561ab7" +checksum = "7e636076193fa68103e937ac951b5f2f587624097017d764b8984d9c0f149464" dependencies = [ "leb128", "wasmparser", @@ -250,9 +563,9 @@ dependencies = [ [[package]] name = "wasm-metadata" -version = "0.220.0" +version = "0.223.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f3e5f5920c5abfc45573c89b07b38efdaae1515ef86f83dad12d60e50ecd62b" +checksum = "5c730c3379d3d20e5a0245b0724b924483e853588ca8fba547c1e21f19e7d735" dependencies = [ "anyhow", "indexmap", @@ -260,28 +573,28 @@ dependencies = [ "serde_derive", "serde_json", "spdx", + "url", "wasm-encoder", "wasmparser", ] [[package]] name = "wasmparser" -version = "0.220.0" +version = "0.223.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e246c2772ce3ebc83f89a2d4487ac5794cad6c309b2071818a88c7db7c36d87b" +checksum = "d5a99faceb1a5a84dd6084ec4bfa4b2ab153b5793b43fd8f58b89232634afc35" dependencies = [ - "ahash", "bitflags", - "hashbrown 0.14.5", + "hashbrown", "indexmap", "semver", ] [[package]] name = "wit-bindgen" -version = "0.36.0" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a2b3e15cd6068f233926e7d8c7c588b2ec4fb7cc7bf3824115e7c7e2a8485a3" +checksum = "9219694564701fa935754f1552ce299154fc74948d6d148134ce55f3504c8bf1" dependencies = [ "wit-bindgen-rt", "wit-bindgen-rust-macro", @@ -289,9 +602,9 @@ dependencies = [ [[package]] name = "wit-bindgen-core" -version = "0.36.0" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b632a5a0fa2409489bd49c9e6d99fcc61bb3d4ce9d1907d44662e75a28c71172" +checksum = "8ba105733ba146c94e067793fb46505265ea8720eb14ceae65b10797c7728a65" dependencies = [ "anyhow", "heck", @@ -300,18 +613,20 @@ dependencies = [ [[package]] name = "wit-bindgen-rt" -version = "0.36.0" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7947d0131c7c9da3f01dfde0ab8bd4c4cf3c5bd49b6dba0ae640f1fa752572ea" +checksum = "fc801b991c56492f87ab3086e786468f75c285a4d73017ab0ebc2fa1aed5d82c" dependencies = [ "bitflags", + "futures", + "once_cell", ] [[package]] name = "wit-bindgen-rust" -version = "0.36.0" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4329de4186ee30e2ef30a0533f9b3c123c019a237a7c82d692807bf1b3ee2697" +checksum = "257e0d217bc06635837d751447c39e77b9901752e052288ff6fe0fdb17850bc5" dependencies = [ "anyhow", "heck", @@ -325,9 +640,9 @@ dependencies = [ [[package]] name = "wit-bindgen-rust-macro" -version = "0.36.0" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "177fb7ee1484d113b4792cc480b1ba57664bbc951b42a4beebe573502135b1fc" +checksum = "8ac98caa9302234687b8e67ce7dfcf31ae5238523f166b93c23988fd0d4e0594" dependencies = [ "anyhow", "prettyplease", @@ -340,9 +655,9 @@ dependencies = [ [[package]] name = "wit-component" -version = "0.220.0" +version = "0.223.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73ccedf54cc65f287da268d64d2bf4f7530d2cfb2296ffbe3ad5f65567e4cf53" +checksum = "c10ed2aeee4c8ec5715875f62f4a3de3608d6987165c116810d8c2908aa9d93b" dependencies = [ "anyhow", "bitflags", @@ -359,9 +674,9 @@ dependencies = [ [[package]] name = "wit-parser" -version = "0.220.0" +version = "0.223.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b7117ce3adc0b4354b46dc1cf3190b00b333e65243d244c613ffcc58bdec84d" +checksum = "92772f4dcacb804b275981eea1d920b12b377993b53307f1e33d87404e080281" dependencies = [ "anyhow", "id-arena", @@ -376,19 +691,78 @@ dependencies = [ ] [[package]] -name = "zerocopy" -version = "0.7.35" +name = "write16" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" + +[[package]] +name = "writeable" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" + +[[package]] +name = "yoke" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "120e6aef9aa629e3d4f52dc8cc43a015c7724194c97dfaf45180d2daf2b77f40" +dependencies = [ + "serde", + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zerofrom" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cff3ee08c995dee1859d998dea82f7374f2826091dd9cd47def953cae446cd2e" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zerovec" +version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +checksum = "aa2b893d79df23bfb12d5461018d408ea19dfafe76c2c7ef6d4eba614f8ff079" dependencies = [ - "zerocopy-derive", + "yoke", + "zerofrom", + "zerovec-derive", ] [[package]] -name = "zerocopy-derive" -version = "0.7.35" +name = "zerovec-derive" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" dependencies = [ "proc-macro2", "quote", diff --git a/application/apps/indexer/plugins/string_parser/src/lib.rs b/application/apps/indexer/plugins/string_parser/src/lib.rs index cebce47cc0..206650b923 100644 --- a/application/apps/indexer/plugins/string_parser/src/lib.rs +++ b/application/apps/indexer/plugins/string_parser/src/lib.rs @@ -5,11 +5,13 @@ use memchr::memchr; use plugins_api::{ log, parser::{ - ColumnInfo, ColumnsRenderOptions, ConfigItem, ConfigSchemaItem, ConfigSchemaType, - ConfigValue, InitError, ParseError, ParseReturn, ParseYield, ParsedMessage, Parser, - ParserConfig, RenderOptions, Version, + ColumnInfo, ColumnsRenderOptions, ParseError, ParseReturn, ParseYield, ParsedMessage, + Parser, ParserConfig, RenderOptions, }, parser_export, + shared_types::{ + ConfigItem, ConfigSchemaItem, ConfigSchemaType, ConfigValue, InitError, Version, + }, }; const LOSSY_ID: &str = "lossy"; diff --git a/application/apps/indexer/plugins_api/Cargo.toml b/application/apps/indexer/plugins_api/Cargo.toml index 45c7a60202..22933afcbd 100644 --- a/application/apps/indexer/plugins_api/Cargo.toml +++ b/application/apps/indexer/plugins_api/Cargo.toml @@ -7,7 +7,7 @@ edition = "2021" [dependencies] log = "0.4" -wit-bindgen = "0.36" +wit-bindgen = "0.37" [dev-dependencies] trybuild = "1.0" diff --git a/application/apps/indexer/plugins_api/src/bytesource/logging.rs b/application/apps/indexer/plugins_api/src/bytesource/logging.rs deleted file mode 100644 index 9004402009..0000000000 --- a/application/apps/indexer/plugins_api/src/bytesource/logging.rs +++ /dev/null @@ -1,45 +0,0 @@ -//! Module provides logging functions to communicate with the host according to the bytesource world in -//! WIT file. -//! This module is for internal use only. - -use super::Level as WitLogLevel; -use super::__internal_bindings::chipmunk::plugin::logging::log; -use crate::plugin_logger::LogSend; - -use log::Level as LogLevel; - -/// Provides method to send the log messages to WASM host for bytesource plugin. -/// -/// This struct is made for internal use only and it is not part of the crate's public API -/// and is subject to change at any time. -pub struct ByteSourceLogSend; - -impl LogSend for ByteSourceLogSend { - fn send_msg(&self, level: log::Level, msg: &str) { - log(level.into(), msg); - } -} - -impl From<WitLogLevel> for LogLevel { - fn from(value: WitLogLevel) -> Self { - match value { - WitLogLevel::Error => LogLevel::Error, - WitLogLevel::Warn => LogLevel::Warn, - WitLogLevel::Info => LogLevel::Info, - WitLogLevel::Debug => LogLevel::Debug, - WitLogLevel::Trace => LogLevel::Trace, - } - } -} - -impl From<LogLevel> for WitLogLevel { - fn from(value: LogLevel) -> Self { - match value { - LogLevel::Error => WitLogLevel::Error, - LogLevel::Warn => WitLogLevel::Warn, - LogLevel::Info => WitLogLevel::Info, - LogLevel::Debug => WitLogLevel::Debug, - LogLevel::Trace => WitLogLevel::Trace, - } - } -} diff --git a/application/apps/indexer/plugins_api/src/bytesource/mod.rs b/application/apps/indexer/plugins_api/src/bytesource/mod.rs index 889af55530..ce939b3e0e 100644 --- a/application/apps/indexer/plugins_api/src/bytesource/mod.rs +++ b/application/apps/indexer/plugins_api/src/bytesource/mod.rs @@ -1,16 +1,16 @@ //! Provides types, methods and macros to write plugins that provide byte source functionality -mod logging; - -// This is needed to be public because it's used in the export macro -#[doc(hidden)] -pub use logging::ByteSourceLogSend as __ByteSourceLogSend; +use crate::shared_types::{ConfigItem, ConfigSchemaItem, InitError, Version}; #[doc(hidden)] pub mod __internal_bindings { wit_bindgen::generate!({ - path: "wit/v_0.1.0", - world: "bytesource-plugin", + path: "wit/v0.1.0", + world: "chipmunk:bytesource/bytesource", + with: { + "chipmunk:shared/logging@0.1.0": crate::logging, + "chipmunk:shared/shared-types@0.1.0": crate::shared_types, + }, // Export macro is used withing the exported `bytesource_export!` macro and must be public pub_export_macro: true, // Bindings for export macro must be set, because it won't be called from withing the @@ -20,41 +20,7 @@ pub mod __internal_bindings { } // External exports for users -pub use __internal_bindings::chipmunk::plugin::{ - bytesource_types::{SourceConfig, SourceError}, - logging::Level, - shared_types::{ - ConfigItem, ConfigSchemaItem, ConfigSchemaType, ConfigValue, InitError, Version, - }, -}; - -impl ConfigSchemaItem { - /// Creates a new configuration schema item with the given arguments - pub fn new<S: Into<String>>( - id: S, - title: S, - description: Option<S>, - input_type: ConfigSchemaType, - ) -> Self { - Self { - id: id.into(), - title: title.into(), - description: description.map(|d| d.into()), - input_type, - } - } -} - -impl Version { - /// Creates a semantic version instance with the given arguments. - pub fn new(major: u16, minor: u16, patch: u16) -> Self { - Self { - major, - minor, - patch, - } - } -} +pub use __internal_bindings::chipmunk::bytesource::bytesource_types::{SourceConfig, SourceError}; /// Trait representing a bytesource for Chipmunk plugins. Types that need to be /// exported as bytesource plugins for use within Chipmunk must implement this trait. @@ -120,8 +86,9 @@ pub trait ByteSource { /// # Examples /// /// ``` -/// # use plugins_api::bytesource::*; -/// # use plugins_api::*; +/// # use plugins_api::bytesource::{ByteSource, SourceConfig, SourceError}; +/// # use plugins_api::bytesource_export; +/// # use plugins_api::shared_types::{Version, ConfigSchemaItem, ConfigItem, InitError}; /// /// struct CustomByteSoruce; /// @@ -158,34 +125,34 @@ macro_rules! bytesource_export { static mut BYTESOURCE: ::std::option::Option<$par> = ::std::option::Option::None; // Define logger as static field to use it with macro initialization + use $crate::__PluginLogSend; use $crate::__PluginLogger; - use $crate::bytesource::__ByteSourceLogSend; - static LOGGER: __PluginLogger<__ByteSourceLogSend> = __PluginLogger { - sender: __ByteSourceLogSend, + static LOGGER: __PluginLogger<__PluginLogSend> = __PluginLogger { + sender: __PluginLogSend, }; // Name intentionally lengthened to avoid conflict with user's own types struct InternalPluginByteSourceGuest; - impl $crate::bytesource::__internal_bindings::exports::chipmunk::plugin::byte_source::Guest + impl $crate::bytesource::__internal_bindings::exports::chipmunk::bytesource::byte_source::Guest for InternalPluginByteSourceGuest { /// Provides the current semantic version of the plugin. /// This version is for the plugin only and is different from the plugin's API version. - fn get_version() -> $crate::bytesource::Version { + fn get_version() -> $crate::shared_types::Version { <$par as $crate::bytesource::ByteSource>::get_version() } /// Provides the schemas for the configurations needed by the plugin to /// be specified by the users. - fn get_config_schemas() -> ::std::vec::Vec<$crate::bytesource::ConfigSchemaItem> { + fn get_config_schemas() -> ::std::vec::Vec<$crate::shared_types::ConfigSchemaItem> { <$par as $crate::bytesource::ByteSource>::get_config_schemas() } /// Initialize the bytesource with the given configurations fn init( general_configs: $crate::bytesource::SourceConfig, - plugin_configs: ::std::vec::Vec<$crate::bytesource::ConfigItem>, - ) -> ::std::result::Result<(), $crate::bytesource::InitError> { + plugin_configs: ::std::vec::Vec<$crate::shared_types::ConfigItem>, + ) -> ::std::result::Result<(), $crate::shared_types::InitError> { // Logger initialization let level = $crate::log::Level::from(general_configs.log_level); $crate::log::set_logger(&LOGGER) @@ -209,6 +176,7 @@ macro_rules! bytesource_export { fn read( len: u64, ) -> ::std::result::Result<::std::vec::Vec<u8>, $crate::bytesource::SourceError> { + use $crate::bytesource::ByteSource; // SAFETY: Bytesource host implements read trait, which takes a mutable reference // to self when called. Therefor it's not possible to have multiple references on // the static bytesource instance here at once. @@ -230,30 +198,28 @@ macro_rules! bytesource_export { // compiled in all real use cases; #[cfg(test)] mod prototyping { - use super::*; - struct Dummy; - impl ByteSource for Dummy { - fn get_version() -> Version { + impl crate::bytesource::ByteSource for Dummy { + fn get_version() -> crate::shared_types::Version { todo!() } - fn get_config_schemas() -> Vec<ConfigSchemaItem> { + fn get_config_schemas() -> Vec<crate::shared_types::ConfigSchemaItem> { todo!() } fn create( - _general_configs: SourceConfig, - _plugins_configs: Vec<ConfigItem>, - ) -> Result<Self, InitError> + _general_configs: crate::bytesource::SourceConfig, + _plugins_configs: Vec<crate::shared_types::ConfigItem>, + ) -> Result<Self, crate::bytesource::InitError> where Self: Sized, { todo!() } - fn read(&mut self, _len: usize) -> Result<Vec<u8>, SourceError> { + fn read(&mut self, _len: usize) -> Result<Vec<u8>, crate::bytesource::SourceError> { todo!() } } diff --git a/application/apps/indexer/plugins_api/src/lib.rs b/application/apps/indexer/plugins_api/src/lib.rs index 76ede53df9..4a7cd7dc33 100644 --- a/application/apps/indexer/plugins_api/src/lib.rs +++ b/application/apps/indexer/plugins_api/src/lib.rs @@ -13,6 +13,10 @@ //! TODO: This is basic documentation that need a lot of improvements and examples //! +mod shared; +pub use shared::chipmunk::shared::{logging, shared_types}; + +//TODO AAZ: Check if we can remove the features, after moving shared types. // NOTE: Calling generate! Macro multiple time on the same crate causes compilation errors with `cargo // component` in release mode. @@ -27,11 +31,12 @@ pub mod parser; // `log` crate must be reexported because we use it withing our macros pub use log; -mod plugin_logger; - // This is needed to be public because it's used in the export macro #[doc(hidden)] -pub use plugin_logger::{LogSend as __LogSend, PluginLogger as __PluginLogger}; +pub use shared::{ + logging::PluginLogSend as __PluginLogSend, + plugin_logger::{LogSend as __LogSend, PluginLogger as __PluginLogger}, +}; // This is a temporary reminder to include `--all-features` flag with cargo test in CI pipelines. // This code is activated in tests only if no features is activated, since almost all tests are diff --git a/application/apps/indexer/plugins_api/src/parser/mod.rs b/application/apps/indexer/plugins_api/src/parser/mod.rs index 2c7933acab..fd688e867b 100644 --- a/application/apps/indexer/plugins_api/src/parser/mod.rs +++ b/application/apps/indexer/plugins_api/src/parser/mod.rs @@ -1,11 +1,7 @@ //! Provides types, methods and macros to write plugins that provide parser functionality. //! -mod logging; - -// This is needed to be public because it's used in the export macro -#[doc(hidden)] -pub use logging::ParserLogSend as __ParserLogSend; +use crate::shared_types::{ConfigItem, ConfigSchemaItem, InitError, Version}; // Module must be public because the generated types and macros are used within `parser_export!` // macro + macros can't be re-exported via pub use @@ -14,56 +10,27 @@ pub use logging::ParserLogSend as __ParserLogSend; #[doc(hidden)] pub mod __internal_bindings { wit_bindgen::generate!({ - path: "wit/v_0.1.0", - world: "parse-plugin", + path: "wit/v0.1.0", + world: "chipmunk:parser/parse", + with: { + "chipmunk:shared/logging@0.1.0": crate::logging, + "chipmunk:shared/shared-types@0.1.0": crate::shared_types, + }, // Export macro is used withing the exported `parser_export!` macro and must be public pub_export_macro: true, // Bindings for export macro must be set, because it won't be called from withing the // same module where `generate!` is called default_bindings_module: "$crate::parser::__internal_bindings", + }); } // External exports for users -pub use __internal_bindings::chipmunk::plugin::{ - logging::Level, - parse_types::{ - Attachment, ColumnInfo, ColumnsRenderOptions, ParseError, ParseReturn, ParseYield, - ParsedMessage, ParserConfig, RenderOptions, - }, - shared_types::{ - ConfigItem, ConfigSchemaItem, ConfigSchemaType, ConfigValue, InitError, Version, - }, +pub use __internal_bindings::chipmunk::parser::parse_types::{ + Attachment, ColumnInfo, ColumnsRenderOptions, ParseError, ParseReturn, ParseYield, + ParsedMessage, ParserConfig, RenderOptions, }; -impl ConfigSchemaItem { - /// Creates a configuration schema item with the given arguments. - pub fn new<S: Into<String>>( - id: S, - title: S, - description: Option<S>, - input_type: ConfigSchemaType, - ) -> Self { - Self { - id: id.into(), - title: title.into(), - description: description.map(|d| d.into()), - input_type, - } - } -} - -impl Version { - /// Creates a semantic version instance with the given arguments. - pub fn new(major: u16, minor: u16, patch: u16) -> Self { - Self { - major, - minor, - patch, - } - } -} - impl RenderOptions { /// Creates a new instance of render options with the given arguments pub fn new(columns_options: Option<ColumnsRenderOptions>) -> Self { @@ -185,8 +152,9 @@ impl ParseReturn { /// # Examples /// /// ``` -/// # use plugins_api::parser::*; -/// # use plugins_api::*; +/// # use plugins_api::parser::{Parser, RenderOptions, ParserConfig, ParseReturn, ParseError}; +/// # use plugins_api::parser_export; +/// # use plugins_api::shared_types::{Version, ConfigSchemaItem, ConfigItem, InitError}; /// /// struct CustomParser; /// @@ -233,27 +201,27 @@ macro_rules! parser_export { static mut PARSER: ::std::option::Option<$par> = ::std::option::Option::None; // Define logger as static field to use it with macro initialization + use $crate::__PluginLogSend; use $crate::__PluginLogger; - use $crate::parser::__ParserLogSend; - static LOGGER: __PluginLogger<__ParserLogSend> = __PluginLogger { - sender: __ParserLogSend, + static LOGGER: __PluginLogger<__PluginLogSend> = __PluginLogger { + sender: __PluginLogSend, }; // Name intentionally lengthened to avoid conflict with user's own types struct InternalPluginParserGuest; - impl $crate::parser::__internal_bindings::exports::chipmunk::plugin::parser::Guest + impl $crate::parser::__internal_bindings::exports::chipmunk::parser::parser::Guest for InternalPluginParserGuest { /// Provides the current semantic version of the plugin. /// This version is for the plugin only and is different from the plugin's API version. - fn get_version() -> $crate::parser::Version { + fn get_version() -> $crate::shared_types::Version { <$par as $crate::parser::Parser>::get_version() } /// Provides the schemas for the configurations needed by the plugin to /// be specified by the users. - fn get_config_schemas() -> ::std::vec::Vec<$crate::parser::ConfigSchemaItem> { + fn get_config_schemas() -> ::std::vec::Vec<$crate::shared_types::ConfigSchemaItem> { <$par as $crate::parser::Parser>::get_config_schemas() } @@ -264,8 +232,8 @@ macro_rules! parser_export { /// Initialize the parser with the given configurations fn init( general_configs: $crate::parser::ParserConfig, - plugin_configs: ::std::vec::Vec<$crate::parser::ConfigItem>, - ) -> ::std::result::Result<(), $crate::parser::InitError> { + plugin_configs: ::std::vec::Vec<$crate::shared_types::ConfigItem>, + ) -> ::std::result::Result<(), $crate::shared_types::InitError> { // Logger initialization let level = $crate::log::Level::from(general_configs.log_level); $crate::log::set_logger(&LOGGER) @@ -291,6 +259,7 @@ macro_rules! parser_export { ::std::vec::Vec<$crate::parser::ParseReturn>, $crate::parser::ParseError, > { + use $crate::parser::Parser; // SAFETY: Parse method has mutable reference to self and can't be called more than // once on the same time on host //TODO AAZ: Find better way than denying the warning. @@ -310,27 +279,25 @@ macro_rules! parser_export { // compiled in all real use cases; #[cfg(test)] mod prototyping { - use super::*; - struct Dummy; - impl Parser for Dummy { - fn get_version() -> Version { + impl crate::parser::Parser for Dummy { + fn get_version() -> crate::shared_types::Version { todo!() } - fn get_config_schemas() -> Vec<ConfigSchemaItem> { + fn get_config_schemas() -> Vec<crate::shared_types::ConfigSchemaItem> { todo!() } - fn get_render_options() -> RenderOptions { + fn get_render_options() -> crate::parser::RenderOptions { todo!() } fn create( - _general_configs: ParserConfig, - _plugins_configs: Vec<ConfigItem>, - ) -> Result<Self, InitError> + _general_configs: crate::parser::ParserConfig, + _plugins_configs: Vec<crate::shared_types::ConfigItem>, + ) -> Result<Self, crate::shared_types::InitError> where Self: Sized, { @@ -341,10 +308,11 @@ mod prototyping { &mut self, _data: &[u8], _timestamp: Option<u64>, - ) -> Result<impl Iterator<Item = ParseReturn>, ParseError> { + ) -> Result<impl Iterator<Item = crate::parser::ParseReturn>, crate::parser::ParseError> + { Ok(std::iter::empty()) } } - parser_export!(Dummy); + crate::parser_export!(Dummy); } diff --git a/application/apps/indexer/plugins_api/src/parser/logging.rs b/application/apps/indexer/plugins_api/src/shared/logging.rs similarity index 78% rename from application/apps/indexer/plugins_api/src/parser/logging.rs rename to application/apps/indexer/plugins_api/src/shared/logging.rs index 92622fc563..1ed02c07ed 100644 --- a/application/apps/indexer/plugins_api/src/parser/logging.rs +++ b/application/apps/indexer/plugins_api/src/shared/logging.rs @@ -1,20 +1,20 @@ -//! Module provides logging functions to communicate with the host according to the parser world in +//! Module provides logging functions to communicate with the host according to the plugin world in //! WIT file. //! This module is for internal use only. -use super::Level as WitLogLevel; -use super::__internal_bindings::chipmunk::plugin::logging::log; -use crate::plugin_logger::LogSend; +use super::plugin_logger::LogSend; +use crate::logging::log; +use crate::logging::Level as WitLogLevel; use log::Level as LogLevel; -/// Provides method to send the log messages to WASM host for parser plugin. +/// Provides method to send the log messages to WASM host for plugins. /// /// This struct is made for internal use only and it is not part of the crate's public API /// and is subject to change at any time. -pub struct ParserLogSend; +pub struct PluginLogSend; -impl LogSend for ParserLogSend { +impl LogSend for PluginLogSend { fn send_msg(&self, level: log::Level, msg: &str) { log(level.into(), msg); } diff --git a/application/apps/indexer/plugins_api/src/shared/mod.rs b/application/apps/indexer/plugins_api/src/shared/mod.rs new file mode 100644 index 0000000000..dab66fa8e5 --- /dev/null +++ b/application/apps/indexer/plugins_api/src/shared/mod.rs @@ -0,0 +1,39 @@ +//! TODO AAZ: Docs and verify the final pubic API before changing the host. + +pub mod logging; +pub mod plugin_logger; + +wit_bindgen::generate!({ + path: "wit/v0.1.0", + world: "chipmunk:shared/bindings", +}); + +use crate::shared_types::{ConfigSchemaItem, ConfigSchemaType, Version}; + +impl ConfigSchemaItem { + /// Creates a new configuration schema item with the given arguments + pub fn new<S: Into<String>>( + id: S, + title: S, + description: Option<S>, + input_type: ConfigSchemaType, + ) -> Self { + Self { + id: id.into(), + title: title.into(), + description: description.map(|d| d.into()), + input_type, + } + } +} + +impl Version { + /// Creates a semantic version instance with the given arguments. + pub fn new(major: u16, minor: u16, patch: u16) -> Self { + Self { + major, + minor, + patch, + } + } +} diff --git a/application/apps/indexer/plugins_api/src/plugin_logger.rs b/application/apps/indexer/plugins_api/src/shared/plugin_logger.rs similarity index 100% rename from application/apps/indexer/plugins_api/src/plugin_logger.rs rename to application/apps/indexer/plugins_api/src/shared/plugin_logger.rs diff --git a/application/apps/indexer/plugins_api/tests/bytesource_macro/expression_fail.rs b/application/apps/indexer/plugins_api/tests/bytesource_macro/expression_fail.rs index 309e430e71..edc0c4d14d 100644 --- a/application/apps/indexer/plugins_api/tests/bytesource_macro/expression_fail.rs +++ b/application/apps/indexer/plugins_api/tests/bytesource_macro/expression_fail.rs @@ -1,5 +1,3 @@ -use plugins_api::*; - -bytesource_export!(if true { 1 } else { 2 }); +plugins_api::bytesource_export!(if true { 1 } else { 2 }); pub fn main() {} diff --git a/application/apps/indexer/plugins_api/tests/bytesource_macro/extend_trait_pass.rs b/application/apps/indexer/plugins_api/tests/bytesource_macro/extend_trait_pass.rs index 7d7d234aed..3452d57040 100644 --- a/application/apps/indexer/plugins_api/tests/bytesource_macro/extend_trait_pass.rs +++ b/application/apps/indexer/plugins_api/tests/bytesource_macro/extend_trait_pass.rs @@ -1,37 +1,33 @@ -use plugins_api::bytesource::*; -use plugins_api::*; -use std::path::PathBuf; - -trait ExtendTrait: ByteSource {} +trait ExtendTrait: plugins_api::bytesource::ByteSource {} struct Dummy; -impl ByteSource for Dummy { - fn get_version() -> Version { +impl plugins_api::bytesource::ByteSource for Dummy { + fn get_version() -> plugins_api::shared_types::Version { todo!() } - fn get_config_schemas() -> Vec<ConfigSchemaItem> { + fn get_config_schemas() -> Vec<plugins_api::shared_types::ConfigSchemaItem> { todo!() } fn create( - _general_configs: SourceConfig, - _plugins_configs: Vec<ConfigItem>, - ) -> Result<Self, InitError> + _general_configs: plugins_api::bytesource::SourceConfig, + _plugins_configs: Vec<plugins_api::shared_types::ConfigItem>, + ) -> Result<Self, plugins_api::shared_types::InitError> where Self: Sized, { todo!() } - fn read(&mut self, _len: usize) -> Result<Vec<u8>, SourceError> { + fn read(&mut self, _len: usize) -> Result<Vec<u8>, plugins_api::bytesource::SourceError> { todo!() } } impl ExtendTrait for Dummy {} -bytesource_export!(Dummy); +plugins_api::bytesource_export!(Dummy); pub fn main() {} diff --git a/application/apps/indexer/plugins_api/tests/bytesource_macro/imp_bytesource_diff_mod_pass.rs b/application/apps/indexer/plugins_api/tests/bytesource_macro/imp_bytesource_diff_mod_pass.rs index f183f5a70d..e8d03ddbef 100644 --- a/application/apps/indexer/plugins_api/tests/bytesource_macro/imp_bytesource_diff_mod_pass.rs +++ b/application/apps/indexer/plugins_api/tests/bytesource_macro/imp_bytesource_diff_mod_pass.rs @@ -3,29 +3,27 @@ struct Dummy; // Module where `Parser` is implemented mod impl_mod { use super::*; - use plugins_api::bytesource::*; - use std::path::PathBuf; - impl ByteSource for Dummy { - fn get_version() -> Version { + impl plugins_api::bytesource::ByteSource for Dummy { + fn get_version() -> plugins_api::shared_types::Version { todo!() } - fn get_config_schemas() -> Vec<ConfigSchemaItem> { + fn get_config_schemas() -> Vec<plugins_api::shared_types::ConfigSchemaItem> { todo!() } fn create( - _general_configs: SourceConfig, - _plugins_configs: Vec<ConfigItem>, - ) -> Result<Self, InitError> + _general_configs: plugins_api::bytesource::SourceConfig, + _plugins_configs: Vec<plugins_api::shared_types::ConfigItem>, + ) -> Result<Self, plugins_api::shared_types::InitError> where Self: Sized, { todo!() } - fn read(&mut self, _len: usize) -> Result<Vec<u8>, SourceError> { + fn read(&mut self, _len: usize) -> Result<Vec<u8>, plugins_api::bytesource::SourceError> { todo!() } } @@ -37,7 +35,7 @@ mod export_mod { use plugins_api::bytesource::*; use plugins_api::*; - bytesource_export!(Dummy); + plugins_api::bytesource_export!(Dummy); } pub fn main() {} diff --git a/application/apps/indexer/plugins_api/tests/bytesource_macro/imp_bytesource_pass.rs b/application/apps/indexer/plugins_api/tests/bytesource_macro/imp_bytesource_pass.rs index 662a73c320..599363510b 100644 --- a/application/apps/indexer/plugins_api/tests/bytesource_macro/imp_bytesource_pass.rs +++ b/application/apps/indexer/plugins_api/tests/bytesource_macro/imp_bytesource_pass.rs @@ -1,33 +1,29 @@ -use plugins_api::bytesource::*; -use plugins_api::*; -use std::path::PathBuf; - struct Dummy; -impl ByteSource for Dummy { - fn get_version() -> Version { +impl plugins_api::bytesource::ByteSource for Dummy { + fn get_version() -> plugins_api::shared_types::Version { todo!() } - fn get_config_schemas() -> Vec<ConfigSchemaItem> { + fn get_config_schemas() -> Vec<plugins_api::shared_types::ConfigSchemaItem> { todo!() } fn create( - _general_configs: SourceConfig, - _plugins_configs: Vec<ConfigItem>, - ) -> Result<Self, InitError> + _general_configs: plugins_api::bytesource::SourceConfig, + _plugins_configs: Vec<plugins_api::shared_types::ConfigItem>, + ) -> Result<Self, plugins_api::shared_types::InitError> where Self: Sized, { todo!() } - fn read(&mut self, _len: usize) -> Result<Vec<u8>, SourceError> { + fn read(&mut self, _len: usize) -> Result<Vec<u8>, plugins_api::bytesource::SourceError> { todo!() } } -bytesource_export!(Dummy); +plugins_api::bytesource_export!(Dummy); pub fn main() {} diff --git a/application/apps/indexer/plugins_api/tests/bytesource_macro/not_imp_bytesource_fail.rs b/application/apps/indexer/plugins_api/tests/bytesource_macro/not_imp_bytesource_fail.rs index 9439ef2d85..ff20a1d38b 100644 --- a/application/apps/indexer/plugins_api/tests/bytesource_macro/not_imp_bytesource_fail.rs +++ b/application/apps/indexer/plugins_api/tests/bytesource_macro/not_imp_bytesource_fail.rs @@ -1,7 +1,5 @@ -use plugins_api::*; - struct Dummy; -bytesource_export!(Dummy); +plugins_api::bytesource_export!(Dummy); pub fn main() {} diff --git a/application/apps/indexer/plugins_api/tests/parser_macro/expression_fail.rs b/application/apps/indexer/plugins_api/tests/parser_macro/expression_fail.rs index 19b4b85a4b..0cac184512 100644 --- a/application/apps/indexer/plugins_api/tests/parser_macro/expression_fail.rs +++ b/application/apps/indexer/plugins_api/tests/parser_macro/expression_fail.rs @@ -1,5 +1,3 @@ -use plugins_api::*; - -parser_export!(if true { 1 } else { 2 }); +plugins_api::parser_export!(if true { 1 } else { 2 }); pub fn main() {} diff --git a/application/apps/indexer/plugins_api/tests/parser_macro/extend_trait_pass.rs b/application/apps/indexer/plugins_api/tests/parser_macro/extend_trait_pass.rs index aefac870da..816aae0fe2 100644 --- a/application/apps/indexer/plugins_api/tests/parser_macro/extend_trait_pass.rs +++ b/application/apps/indexer/plugins_api/tests/parser_macro/extend_trait_pass.rs @@ -1,27 +1,24 @@ -use plugins_api::parser::*; -use plugins_api::*; - struct Dummy; -trait ExtendParser: crate::parser::Parser {} +trait ExtendParser: plugins_api::parser::Parser {} -impl crate::parser::Parser for Dummy { - fn get_version() -> Version { +impl plugins_api::parser::Parser for Dummy { + fn get_version() -> plugins_api::shared_types::Version { todo!() } - fn get_config_schemas() -> Vec<ConfigSchemaItem> { + fn get_config_schemas() -> Vec<plugins_api::shared_types::ConfigSchemaItem> { todo!() } - fn get_render_options() -> RenderOptions { + fn get_render_options() -> plugins_api::parser::RenderOptions { todo!() } fn create( - _general_configs: ParserConfig, - _plugins_configs: Vec<ConfigItem>, - ) -> Result<Self, InitError> + _general_configs: plugins_api::parser::ParserConfig, + _plugins_configs: Vec<plugins_api::shared_types::ConfigItem>, + ) -> Result<Self, plugins_api::shared_types::InitError> where Self: Sized, { @@ -32,13 +29,16 @@ impl crate::parser::Parser for Dummy { &mut self, _data: &[u8], _timestamp: Option<u64>, - ) -> Result<impl Iterator<Item = ParseReturn>, ParseError> { + ) -> Result< + impl Iterator<Item = plugins_api::parser::ParseReturn>, + plugins_api::parser::ParseError, + > { Ok(std::iter::empty()) } } impl ExtendParser for Dummy {} -parser_export!(Dummy); +plugins_api::parser_export!(Dummy); pub fn main() {} diff --git a/application/apps/indexer/plugins_api/tests/parser_macro/imp_parser_diff_mod_pass.rs b/application/apps/indexer/plugins_api/tests/parser_macro/imp_parser_diff_mod_pass.rs index 5375b09f11..ab406355c2 100644 --- a/application/apps/indexer/plugins_api/tests/parser_macro/imp_parser_diff_mod_pass.rs +++ b/application/apps/indexer/plugins_api/tests/parser_macro/imp_parser_diff_mod_pass.rs @@ -1,29 +1,26 @@ -use plugins_api::parser::*; -use plugins_api::*; - struct Dummy; // Module where `Parser` is implemented mod impl_mod { use super::*; - impl crate::parser::Parser for Dummy { - fn get_version() -> Version { + impl plugins_api::parser::Parser for Dummy { + fn get_version() -> plugins_api::shared_types::Version { todo!() } - fn get_config_schemas() -> Vec<ConfigSchemaItem> { + fn get_config_schemas() -> Vec<plugins_api::shared_types::ConfigSchemaItem> { todo!() } - fn get_render_options() -> RenderOptions { + fn get_render_options() -> plugins_api::parser::RenderOptions { todo!() } fn create( - _general_configs: ParserConfig, - _plugins_configs: Vec<ConfigItem>, - ) -> Result<Self, InitError> + _general_configs: plugins_api::parser::ParserConfig, + _plugins_configs: Vec<plugins_api::shared_types::ConfigItem>, + ) -> Result<Self, plugins_api::shared_types::InitError> where Self: Sized, { @@ -34,7 +31,10 @@ mod impl_mod { &mut self, _data: &[u8], _timestamp: Option<u64>, - ) -> Result<impl Iterator<Item = ParseReturn>, ParseError> { + ) -> Result< + impl Iterator<Item = plugins_api::parser::ParseReturn>, + plugins_api::parser::ParseError, + > { Ok(std::iter::empty()) } } @@ -42,11 +42,7 @@ mod impl_mod { // Module for export macro mod export_mod { - use super::Dummy; - use plugins_api::parser::*; - use plugins_api::*; - - parser_export!(Dummy); + plugins_api::parser_export!(super::Dummy); } pub fn main() {} diff --git a/application/apps/indexer/plugins_api/tests/parser_macro/imp_parser_pass.rs b/application/apps/indexer/plugins_api/tests/parser_macro/imp_parser_pass.rs index 6710c578e5..404c0690eb 100644 --- a/application/apps/indexer/plugins_api/tests/parser_macro/imp_parser_pass.rs +++ b/application/apps/indexer/plugins_api/tests/parser_macro/imp_parser_pass.rs @@ -1,25 +1,22 @@ -use plugins_api::parser::*; -use plugins_api::*; - struct Dummy; -impl crate::parser::Parser for Dummy { - fn get_version() -> Version { +impl plugins_api::parser::Parser for Dummy { + fn get_version() -> plugins_api::shared_types::Version { todo!() } - fn get_config_schemas() -> Vec<ConfigSchemaItem> { + fn get_config_schemas() -> Vec<plugins_api::shared_types::ConfigSchemaItem> { todo!() } - fn get_render_options() -> RenderOptions { + fn get_render_options() -> plugins_api::parser::RenderOptions { todo!() } fn create( - _general_configs: ParserConfig, - _plugins_configs: Vec<ConfigItem>, - ) -> Result<Self, InitError> + _general_configs: plugins_api::parser::ParserConfig, + _plugins_configs: Vec<plugins_api::shared_types::ConfigItem>, + ) -> Result<Self, plugins_api::shared_types::InitError> where Self: Sized, { @@ -30,11 +27,14 @@ impl crate::parser::Parser for Dummy { &mut self, _data: &[u8], _timestamp: Option<u64>, - ) -> Result<impl Iterator<Item = ParseReturn>, ParseError> { + ) -> Result< + impl Iterator<Item = plugins_api::parser::ParseReturn>, + plugins_api::parser::ParseError, + > { Ok(std::iter::empty()) } } -parser_export!(Dummy); +plugins_api::parser_export!(Dummy); pub fn main() {} diff --git a/application/apps/indexer/plugins_api/tests/parser_macro/not_imp_parser_fail.rs b/application/apps/indexer/plugins_api/tests/parser_macro/not_imp_parser_fail.rs index 03d21b8dcd..f4fde1f023 100644 --- a/application/apps/indexer/plugins_api/tests/parser_macro/not_imp_parser_fail.rs +++ b/application/apps/indexer/plugins_api/tests/parser_macro/not_imp_parser_fail.rs @@ -1,8 +1,5 @@ -use plugins_api::parser::*; -use plugins_api::*; - struct Dummy; -parser_export!(Dummy); +plugins_api::parser_export!(Dummy); pub fn main() {} diff --git a/application/apps/indexer/plugins_api/wit/v_0.1.0/bytesource.wit b/application/apps/indexer/plugins_api/wit/v0.1.0/deps/bytesource/bytesource.wit similarity index 61% rename from application/apps/indexer/plugins_api/wit/v_0.1.0/bytesource.wit rename to application/apps/indexer/plugins_api/wit/v0.1.0/deps/bytesource/bytesource.wit index cfb0d3a9fb..ce210ac19c 100644 --- a/application/apps/indexer/plugins_api/wit/v_0.1.0/bytesource.wit +++ b/application/apps/indexer/plugins_api/wit/v0.1.0/deps/bytesource/bytesource.wit @@ -1,29 +1,7 @@ -package chipmunk:plugin@0.1.0; - -interface bytesource-types { - use logging.{level}; - - /// Represents the addresses defining a network socket - record socket-info { - ip: string, - port: u16, - } - - /// Represents the errors while reading bytes in bytesource plugin - variant source-error { - io(string), - unsupported, - other(string), - } - - /// General configurations related to all bytesources - record source-config { - log-level: level, - } -} +package chipmunk:bytesource@0.1.0; interface byte-source { - use shared-types.{version, init-error, config-item, config-schema-item}; + use chipmunk:shared/shared-types@0.1.0.{version, init-error, config-item, config-schema-item}; use bytesource-types.{source-config, source-error}; /// Provides the current semantic version of the plugin. @@ -45,7 +23,3 @@ interface byte-source { read: func(len: u64) -> result<list<u8>, source-error>; } -world bytesource-plugin { - import logging; - export byte-source; -} diff --git a/application/apps/indexer/plugins_api/wit/v0.1.0/deps/bytesource/types.wit b/application/apps/indexer/plugins_api/wit/v0.1.0/deps/bytesource/types.wit new file mode 100644 index 0000000000..8c7545e5a1 --- /dev/null +++ b/application/apps/indexer/plugins_api/wit/v0.1.0/deps/bytesource/types.wit @@ -0,0 +1,23 @@ +package chipmunk:bytesource@0.1.0; + +interface bytesource-types { + use chipmunk:shared/logging@0.1.0.{level}; + + /// Represents the addresses defining a network socket + record socket-info { + ip: string, + port: u16, + } + + /// Represents the errors while reading bytes in bytesource plugin + variant source-error { + io(string), + unsupported, + other(string), + } + + /// General configurations related to all bytesources + record source-config { + log-level: level, + } +} diff --git a/application/apps/indexer/plugins_api/wit/v0.1.0/deps/bytesource/world.wit b/application/apps/indexer/plugins_api/wit/v0.1.0/deps/bytesource/world.wit new file mode 100644 index 0000000000..fcc06465a0 --- /dev/null +++ b/application/apps/indexer/plugins_api/wit/v0.1.0/deps/bytesource/world.wit @@ -0,0 +1,7 @@ +package chipmunk:bytesource@0.1.0; + +world bytesource { + import chipmunk:shared/logging@0.1.0; + + export byte-source; +} diff --git a/application/apps/indexer/plugins_api/wit/v0.1.0/deps/parser/parser.wit b/application/apps/indexer/plugins_api/wit/v0.1.0/deps/parser/parser.wit new file mode 100644 index 0000000000..9315f8f65b --- /dev/null +++ b/application/apps/indexer/plugins_api/wit/v0.1.0/deps/parser/parser.wit @@ -0,0 +1,30 @@ +package chipmunk:parser@0.1.0; + +interface parser { + use chipmunk:shared/shared-types@0.1.0.{version, init-error, config-item, config-schema-item}; + use parse-types.{render-options, parser-config, parse-return, parse-error}; + + /// Provides the current semantic version of the plugin. + /// This version is for the plugin only and is different from the plugin's API version. + get-version: func() -> version; + + /// Provides the schemas for the configurations required by the plugin, which + /// will be specified by the users. + /// + /// These schemas define the expected structure, types, and constraints + /// for plugin-specific configurations. The values of these configurations + /// will be passed to the initializing method of the parser. + get-config-schemas: func() -> list<config-schema-item>; + + /// Provides the custom render options to be rendered in log view, enabling the users to + /// change the visibility on the log columns when provided. + /// This function can be called before initializing the plugin instance. + get-render-options: func() -> render-options; + + /// Initialize the parser with the given configurations + init: func(general-configs: parser-config, plugin-configs: list<config-item>) -> result<_, init-error>; + + /// Parse the given bytes returning a list of parsed items, + /// or parse error if an error occurred and no item has been parsed. + parse: func(data: list<u8>, timestamp: option<u64>) -> result<list<parse-return>, parse-error>; +} diff --git a/application/apps/indexer/plugins_api/wit/v_0.1.0/parser.wit b/application/apps/indexer/plugins_api/wit/v0.1.0/deps/parser/types.wit similarity index 59% rename from application/apps/indexer/plugins_api/wit/v_0.1.0/parser.wit rename to application/apps/indexer/plugins_api/wit/v0.1.0/deps/parser/types.wit index d5b8a9a110..cff4f29dde 100644 --- a/application/apps/indexer/plugins_api/wit/v_0.1.0/parser.wit +++ b/application/apps/indexer/plugins_api/wit/v0.1.0/deps/parser/types.wit @@ -1,7 +1,7 @@ -package chipmunk:plugin@0.1.0; +package chipmunk:parser@0.1.0; interface parse-types { - use logging.{level}; + use chipmunk:shared/logging@0.1.0.{level}; /// General configurations related to all parsers record parser-config { @@ -80,37 +80,3 @@ interface parse-types { } } -interface parser { - use shared-types.{version, init-error, config-item, config-schema-item}; - use parse-types.{render-options, parser-config, parse-return, parse-error}; - - /// Provides the current semantic version of the plugin. - /// This version is for the plugin only and is different from the plugin's API version. - get-version: func() -> version; - - /// Provides the schemas for the configurations required by the plugin, which - /// will be specified by the users. - /// - /// These schemas define the expected structure, types, and constraints - /// for plugin-specific configurations. The values of these configurations - /// will be passed to the initializing method of the parser. - get-config-schemas: func() -> list<config-schema-item>; - - /// Provides the custom render options to be rendered in log view, enabling the users to - /// change the visibility on the log columns when provided. - /// This function can be called before initializing the plugin instance. - get-render-options: func() -> render-options; - - /// Initialize the parser with the given configurations - init: func(general-configs: parser-config, plugin-configs: list<config-item>) -> result<_, init-error>; - - /// Parse the given bytes returning a list of parsed items, - /// or parse error if an error occurred and no item has been parsed. - parse: func(data: list<u8>, timestamp: option<u64>) -> result<list<parse-return>, parse-error>; -} - -world parse-plugin { - import logging; - - export parser; -} diff --git a/application/apps/indexer/plugins_api/wit/v0.1.0/deps/parser/world.wit b/application/apps/indexer/plugins_api/wit/v0.1.0/deps/parser/world.wit new file mode 100644 index 0000000000..354ea36b22 --- /dev/null +++ b/application/apps/indexer/plugins_api/wit/v0.1.0/deps/parser/world.wit @@ -0,0 +1,7 @@ +package chipmunk:parser@0.1.0; + +world parse { + import chipmunk:shared/logging@0.1.0; + + export parser; +} diff --git a/application/apps/indexer/plugins_api/wit/v0.1.0/deps/shared/logging.wit b/application/apps/indexer/plugins_api/wit/v0.1.0/deps/shared/logging.wit new file mode 100644 index 0000000000..7e3055037b --- /dev/null +++ b/application/apps/indexer/plugins_api/wit/v0.1.0/deps/shared/logging.wit @@ -0,0 +1,18 @@ +package chipmunk:shared@0.1.0; + +/// Logging definitions and methods for all plugins +interface logging { + + /// Log Level + enum level { + error, + warn, + info, + debug, + trace, + } + + /// Log the given message with current log level if log level is allowed + log: func(level: level, msg: string); +} + diff --git a/application/apps/indexer/plugins_api/wit/v_0.1.0/shared.wit b/application/apps/indexer/plugins_api/wit/v0.1.0/deps/shared/shared-types.wit similarity index 84% rename from application/apps/indexer/plugins_api/wit/v_0.1.0/shared.wit rename to application/apps/indexer/plugins_api/wit/v0.1.0/deps/shared/shared-types.wit index dc92a84b0f..f9160b77f3 100644 --- a/application/apps/indexer/plugins_api/wit/v_0.1.0/shared.wit +++ b/application/apps/indexer/plugins_api/wit/v0.1.0/deps/shared/shared-types.wit @@ -1,3 +1,5 @@ +package chipmunk:shared@0.1.0; + /// Interface used for shard types among all plugins interface shared-types { @@ -58,19 +60,3 @@ interface shared-types { dropdown(list<string>) } } - -/// Logging definitions and methods for all plugins -interface logging { - - /// Log Level - enum level { - error, - warn, - info, - debug, - trace, - } - - /// Log the given message with current log level if log level is allowed - log: func(level: level, msg: string); -} diff --git a/application/apps/indexer/plugins_api/wit/v0.1.0/deps/shared/world.wit b/application/apps/indexer/plugins_api/wit/v0.1.0/deps/shared/world.wit new file mode 100644 index 0000000000..9690ec483d --- /dev/null +++ b/application/apps/indexer/plugins_api/wit/v0.1.0/deps/shared/world.wit @@ -0,0 +1,6 @@ +package chipmunk:shared@0.1.0; + +world bindings { + import shared-types; + import logging; +} diff --git a/application/apps/indexer/plugins_api/wit/v0.1.0/world.wit b/application/apps/indexer/plugins_api/wit/v0.1.0/world.wit new file mode 100644 index 0000000000..219c05c434 --- /dev/null +++ b/application/apps/indexer/plugins_api/wit/v0.1.0/world.wit @@ -0,0 +1,9 @@ +package chipmunk:plugins; + +world imports { + include chipmunk:shared/bindings@0.1.0; +} + +world bindings { + include imports; +}