From 563da0bd117a7ec5e4b898270469417078b56338 Mon Sep 17 00:00:00 2001 From: Dimitri Date: Fri, 13 Dec 2024 16:14:38 +0700 Subject: [PATCH] feat: camelCase for ParsedEmail wasm bindings --- Cargo.lock | 4 ++-- Cargo.toml | 3 ++- package.json | 4 +++- src/parse_email.rs | 1 + ts_tests/circuit_intput.ts | 22 +++++++++++----------- 5 files changed, 19 insertions(+), 15 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e15b9cb..eef08e6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4798,8 +4798,8 @@ dependencies = [ [[package]] name = "zk-regex-apis" -version = "2.3.0" -source = "git+https://github.com/zkemail/zk-regex.git#f5f70b96c215659ebf38d4ed0ae9082b085842a5" +version = "2.3.1" +source = "git+https://github.com/zkemail/zk-regex.git?branch=dimidumo%2Fzk-802-consistent-casing-everywhere#5b357f2c7aa4643964534d88ebe5db3512048a71" dependencies = [ "fancy-regex", "itertools 0.13.0", diff --git a/Cargo.toml b/Cargo.toml index ef89835..c972144 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,8 @@ crate-type = ["rlib", "cdylib"] itertools = "0.10.3" serde_json = "1.0.95" serde = { version = "1.0.159", features = ["derive"] } -zk-regex-apis = { version = "2.1.1", git = "https://github.com/zkemail/zk-regex.git" } +# zk-regex-apis = { version = "2.1.1", git = "https://github.com/zkemail/zk-regex.git" } +zk-regex-apis = { git = "https://github.com/zkemail/zk-regex.git", branch = "dimidumo/zk-802-consistent-casing-everywhere" } hex = "0.4.3" anyhow = "1.0.75" poseidon-rs = { git = "https://github.com/zkemail/poseidon-rs.git", version = "1.0.0" } diff --git a/package.json b/package.json index fb7f124..f08dc3c 100644 --- a/package.json +++ b/package.json @@ -3,12 +3,14 @@ "module": "index.ts", "scripts": { "publish-npm": "cd pkg && npm publish --access public && cd ..", + "publish-npm-nightly": "cd pkg && npm publish --access public --tag nightly && cd ..", "publish": "bun run build && bun run publish-npm", + "publish-nightly": "bun run build && bun run publish-npm-nightly", "wasm:build": "wasm-pack build --target bundler --out-dir pkg", "wasm:postbuild": "node build.js", "build": "npm run wasm:build && npm run wasm:postbuild" }, - "version": "0.4.55", + "version": "0.4.59.0", "devDependencies": { "@types/bun": "latest", "prettier": "^3.3.3" diff --git a/src/parse_email.rs b/src/parse_email.rs index c3ff085..b72b9d5 100644 --- a/src/parse_email.rs +++ b/src/parse_email.rs @@ -23,6 +23,7 @@ use zk_regex_apis::extract_substrs::{ /// `ParsedEmail` holds the canonicalized parts of an email along with its signature and public key. #[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] pub struct ParsedEmail { /// The canonicalized email header. pub canonicalized_header: String, diff --git a/ts_tests/circuit_intput.ts b/ts_tests/circuit_intput.ts index 73dea6c..bd09b80 100644 --- a/ts_tests/circuit_intput.ts +++ b/ts_tests/circuit_intput.ts @@ -12,12 +12,12 @@ describe("generateCircuitInputsWithDecomposedRegexesAndExternalInputs test suite { parts: [ { - is_public: true, - regex_def: "Hi", + isPublic: true, + regexDef: "Hi", }, { - is_public: true, - regex_def: "!", + isPublic: true, + regexDef: "!", }, ], name: "hi", @@ -49,12 +49,12 @@ describe("generateCircuitInputsWithDecomposedRegexesAndExternalInputs test suite { parts: [ { - is_public: true, - regex_def: "Hi", + isPublic: true, + regexDef: "Hi", }, { - is_public: true, - regex_def: "!", + isPublic: true, + regexDef: "!", }, ], name: "hi", @@ -67,9 +67,9 @@ describe("generateCircuitInputsWithDecomposedRegexesAndExternalInputs test suite { name: "address", maxLength: 64, - value: "tester@zkemail.com" - } - ] + value: "tester@zkemail.com", + }, + ]; const params = { maxHeaderLength: 2816,