diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f9926fb..ed098c7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -53,9 +53,27 @@ jobs: - name: Checkout Code uses: actions/checkout@v5 + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@stable + + - name: Cache cargo registry + uses: actions/cache@v4 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo- + + - name: Build project + run: cargo run bundle --path ../definitions --out ../bundles + working-directory: "./cli" + - name: Archive definitions folder run: | - zip -r definitions.zip definitions + zip -r bundles.zip bundles - name: Create GitHub Release uses: softprops/action-gh-release@v2 @@ -63,7 +81,7 @@ jobs: tag_name: ${{ github.ref_name }} name: Release ${{ github.ref_name }} files: | - definitions.zip + bundles.zip generate_release_notes: true make_latest: true env: diff --git a/.gitignore b/.gitignore index 23de227..6796352 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,6 @@ **/node_modules .idea reader/ts/src/*.js -reader/ts/build \ No newline at end of file +reader/ts/build +bundles +reader/**/*.js \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index c122177..e1a4f76 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -287,6 +287,7 @@ dependencies = [ "colored", "futures", "notify", + "prost", "reqwest", "serde", "serde_json", diff --git a/Cargo.toml b/Cargo.toml index 7be6c53..b39880a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,4 +19,5 @@ tokio = "1.47.0" futures = "0.3.31" zip = "6.0.0" bytes = "1.10.1" +prost = "0.14.1" code0-definition-reader= "0.0.13" \ No newline at end of file diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 9a7a128..95ccdd3 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -22,3 +22,4 @@ tokio = { workspace = true, features = ["rt", "rt-multi-thread", "macros"] } futures = { workspace = true } zip = { workspace = true } bytes = { workspace = true } +prost = {workspace = true} \ No newline at end of file diff --git a/cli/src/command/bundle.rs b/cli/src/command/bundle.rs new file mode 100644 index 0000000..6ac29f9 --- /dev/null +++ b/cli/src/command/bundle.rs @@ -0,0 +1,75 @@ +use code0_definition_reader::parser::Parser; +use prost::Message; +use std::fs; +use std::io::Write; + +pub fn bundle(path: Option, out: Option) { + let dir_path = path.unwrap_or_else(|| "./definitions".to_string()); + let out_path = out.unwrap_or_else(|| "./bundles".to_string()); + match fs::create_dir_all(&out_path) { + Ok(_) => {} + Err(err) => { + panic!("Error creating output directory: {:?}", err); + } + } + + let parser = match Parser::from_path(dir_path.as_str()) { + Some(reader) => reader, + None => { + panic!("Error reading definitions"); + } + }; + + for feature in parser.features { + feature.data_types.iter().for_each(|data_type| { + let mut buf = Vec::new(); + if let Ok(_) = data_type.encode(&mut buf) { + let path = format!( + "{}/{}_{}_{}.pb", + &out_path, + feature.name, + "data_type", + data_type.identifier.to_lowercase() + ); + fs::File::create(&path) + .expect("abc") + .write_all(&buf) + .expect("a"); + } + }); + + feature.flow_types.iter().for_each(|flow_type| { + let mut buf = Vec::new(); + if let Ok(_) = flow_type.encode(&mut buf) { + let path = format!( + "{}/{}_{}_{}.pb", + &out_path, + feature.name, + "flow_type", + flow_type.identifier.to_lowercase() + ); + fs::File::create(&path) + .expect("abc") + .write_all(&buf) + .expect("a"); + } + }); + + feature.runtime_functions.iter().for_each(|function| { + let mut buf = Vec::new(); + if let Ok(_) = function.encode(&mut buf) { + let path = format!( + "{}/{}_{}_{}.pb", + &out_path, + feature.name, + "function", + function.runtime_name.to_lowercase() + ); + fs::File::create(&path) + .expect("abc") + .write_all(&buf) + .expect("a"); + } + }); + } +} diff --git a/cli/src/command/definition.rs b/cli/src/command/definition.rs index b04a8cc..cf52423 100644 --- a/cli/src/command/definition.rs +++ b/cli/src/command/definition.rs @@ -1,6 +1,8 @@ use crate::formatter::{info, success}; use code0_definition_reader::parser::Parser; use colored::Colorize; +use prost::Message; +use tucana::shared::DefinitionDataType; pub fn search_definition(name: String, path: Option) { let dir_path = path.unwrap_or_else(|| "./definitions".to_string()); diff --git a/cli/src/command/mod.rs b/cli/src/command/mod.rs index 351e876..98036f8 100644 --- a/cli/src/command/mod.rs +++ b/cli/src/command/mod.rs @@ -1,3 +1,4 @@ +pub mod bundle; pub mod definition; pub mod download; pub mod feature; diff --git a/cli/src/main.rs b/cli/src/main.rs index 787d4ae..a4e185e 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -53,6 +53,12 @@ enum Commands { #[clap(short, long, value_parser, num_args = 1.., value_delimiter = ' ')] features: Option>, }, + Bundle { + #[arg(short, long)] + path: Option, + #[arg(short, long)] + out: Option, + }, } #[tokio::main] @@ -60,6 +66,7 @@ async fn main() { let cli = Cli::parse(); match cli.command { + Commands::Bundle { path, out } => command::bundle::bundle(path, out), Commands::Report { path } => command::report::report_errors(path), Commands::Feature { name, path } => command::feature::search_feature(name, path), Commands::Definition { name, path } => command::definition::search_definition(name, path), diff --git a/definitions/http/flow_type/http.json b/definitions/http/flow_type/http.json index 5c59274..0ececf3 100644 --- a/definitions/http/flow_type/http.json +++ b/definitions/http/flow_type/http.json @@ -40,7 +40,7 @@ { "identifier": "HTTP_HOST", "unique": false, - "data_type_identifier": "HTTP_HOST", + "data_type_identifier": "TEXT", "default_value": null, "name": [ { diff --git a/definitions/standard/runtime_definition/array/std_array_at.json b/definitions/standard/runtime_definition/array/std_array_at.json index 46b50e3..d390d5c 100644 --- a/definitions/standard/runtime_definition/array/std_array_at.json +++ b/definitions/standard/runtime_definition/array/std_array_at.json @@ -45,7 +45,9 @@ }, { "data_type_identifier": { - "type": null + "type": { + "DataTypeIdentifier": "NUMBER" + } }, "runtime_name": "index", "default_value": null, @@ -70,7 +72,9 @@ } ], "return_type_identifier": { - "type": null + "type": { + "GenericKey": "R" + } }, "throws_error": false, "generic_keys": [ diff --git a/definitions/standard/runtime_definition/array/std_array_index_of.json b/definitions/standard/runtime_definition/array/std_array_index_of.json index 2518a3e..eeb6ecc 100644 --- a/definitions/standard/runtime_definition/array/std_array_index_of.json +++ b/definitions/standard/runtime_definition/array/std_array_index_of.json @@ -45,7 +45,9 @@ }, { "data_type_identifier": { - "type": null + "type": { + "GenericKey": "R" + } }, "runtime_name": "item", "default_value": null, diff --git a/reader/ts/index.ts b/reader/ts/index.ts index 89a7fe1..1070ffa 100644 --- a/reader/ts/index.ts +++ b/reader/ts/index.ts @@ -1,2 +1,2 @@ -export { Definition } from './src/parser.js'; -export type { Feature, MetaType, Meta } from './src/types.js'; \ No newline at end of file +export { Definition } from './src/parser.ts'; +export type { Feature } from './src/types.ts'; diff --git a/reader/ts/package-lock.json b/reader/ts/package-lock.json index ecb728e..128b047 100644 --- a/reader/ts/package-lock.json +++ b/reader/ts/package-lock.json @@ -7,32 +7,1017 @@ "": { "name": "@code0-tech/definition-reader", "version": "0.0.0", + "dependencies": { + "@code0-tech/sagittarius-graphql-types": "^0.0.0-3bdab57d324cfeb2abf2cf60a801039b45de746d", + "@code0-tech/tucana": "^0.0.37", + "@protobuf-ts/runtime": "^2.11.1" + }, "devDependencies": { - "@code0-tech/sagittarius-graphql-types": "^0.0.0-4b2e73eae302fe499001bf42fdb3a6bcc5be78aa ", "@types/node": "^24.1.0", - "typescript": "^5.8.3" + "typescript": "^5.8.3", + "vite": "^7.1.11" } }, "node_modules/@code0-tech/sagittarius-graphql-types": { - "version": "0.0.0-f91466f0f343596ad170e7e5c5316a70b072594d", - "resolved": "https://registry.npmjs.org/@code0-tech/sagittarius-graphql-types/-/sagittarius-graphql-types-0.0.0-f91466f0f343596ad170e7e5c5316a70b072594d.tgz", - "integrity": "sha512-vXnbsCw1n3KhWX0ZutKR9xmspEyg9/cZspSMPTPyD8sSTDcPooei1967GlsfpPKfsJGPLzrMKxMRUS/ANXlATg==", - "dev": true + "version": "0.0.0-3bdab57d324cfeb2abf2cf60a801039b45de746d", + "resolved": "https://registry.npmjs.org/@code0-tech/sagittarius-graphql-types/-/sagittarius-graphql-types-0.0.0-3bdab57d324cfeb2abf2cf60a801039b45de746d.tgz", + "integrity": "sha512-UzB9ugIJmOTH1t5t7u4+ZdbNbW8W1HlOCRagWKKiCSUkOS9FeQomiLmKT7LU0qxmzkHW0RoJg2dn4YrsA1i+zA==" + }, + "node_modules/@code0-tech/tucana": { + "version": "0.0.37", + "resolved": "https://registry.npmjs.org/@code0-tech/tucana/-/tucana-0.0.37.tgz", + "integrity": "sha512-eluuVkN3z4sJ6W6j11VD0OEq/jZPG+kMGMDTr3mRaiHUxGt90lfsBlqyzfLBIUXV8Q4vYTh9G1HuhpGoyRSH1Q==", + "license": "Apache-2.0" + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.25.11", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.11.tgz", + "integrity": "sha512-Xt1dOL13m8u0WE8iplx9Ibbm+hFAO0GsU2P34UNoDGvZYkY8ifSiy6Zuc1lYxfG7svWE2fzqCUmFp5HCn51gJg==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.25.11", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.11.tgz", + "integrity": "sha512-uoa7dU+Dt3HYsethkJ1k6Z9YdcHjTrSb5NUy66ZfZaSV8hEYGD5ZHbEMXnqLFlbBflLsl89Zke7CAdDJ4JI+Gg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.25.11", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.11.tgz", + "integrity": "sha512-9slpyFBc4FPPz48+f6jyiXOx/Y4v34TUeDDXJpZqAWQn/08lKGeD8aDp9TMn9jDz2CiEuHwfhRmGBvpnd/PWIQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.25.11", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.11.tgz", + "integrity": "sha512-Sgiab4xBjPU1QoPEIqS3Xx+R2lezu0LKIEcYe6pftr56PqPygbB7+szVnzoShbx64MUupqoE0KyRlN7gezbl8g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.25.11", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.11.tgz", + "integrity": "sha512-VekY0PBCukppoQrycFxUqkCojnTQhdec0vevUL/EDOCnXd9LKWqD/bHwMPzigIJXPhC59Vd1WFIL57SKs2mg4w==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.25.11", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.11.tgz", + "integrity": "sha512-+hfp3yfBalNEpTGp9loYgbknjR695HkqtY3d3/JjSRUyPg/xd6q+mQqIb5qdywnDxRZykIHs3axEqU6l1+oWEQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.25.11", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.11.tgz", + "integrity": "sha512-CmKjrnayyTJF2eVuO//uSjl/K3KsMIeYeyN7FyDBjsR3lnSJHaXlVoAK8DZa7lXWChbuOk7NjAc7ygAwrnPBhA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.25.11", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.11.tgz", + "integrity": "sha512-Dyq+5oscTJvMaYPvW3x3FLpi2+gSZTCE/1ffdwuM6G1ARang/mb3jvjxs0mw6n3Lsw84ocfo9CrNMqc5lTfGOw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.25.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.11.tgz", + "integrity": "sha512-TBMv6B4kCfrGJ8cUPo7vd6NECZH/8hPpBHHlYI3qzoYFvWu2AdTvZNuU/7hsbKWqu/COU7NIK12dHAAqBLLXgw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.25.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.11.tgz", + "integrity": "sha512-Qr8AzcplUhGvdyUF08A1kHU3Vr2O88xxP0Tm8GcdVOUm25XYcMPp2YqSVHbLuXzYQMf9Bh/iKx7YPqECs6ffLA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.25.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.11.tgz", + "integrity": "sha512-TmnJg8BMGPehs5JKrCLqyWTVAvielc615jbkOirATQvWWB1NMXY77oLMzsUjRLa0+ngecEmDGqt5jiDC6bfvOw==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.25.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.11.tgz", + "integrity": "sha512-DIGXL2+gvDaXlaq8xruNXUJdT5tF+SBbJQKbWy/0J7OhU8gOHOzKmGIlfTTl6nHaCOoipxQbuJi7O++ldrxgMw==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.25.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.11.tgz", + "integrity": "sha512-Osx1nALUJu4pU43o9OyjSCXokFkFbyzjXb6VhGIJZQ5JZi8ylCQ9/LFagolPsHtgw6himDSyb5ETSfmp4rpiKQ==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.25.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.11.tgz", + "integrity": "sha512-nbLFgsQQEsBa8XSgSTSlrnBSrpoWh7ioFDUmwo158gIm5NNP+17IYmNWzaIzWmgCxq56vfr34xGkOcZ7jX6CPw==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.25.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.11.tgz", + "integrity": "sha512-HfyAmqZi9uBAbgKYP1yGuI7tSREXwIb438q0nqvlpxAOs3XnZ8RsisRfmVsgV486NdjD7Mw2UrFSw51lzUk1ww==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.25.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.11.tgz", + "integrity": "sha512-HjLqVgSSYnVXRisyfmzsH6mXqyvj0SA7pG5g+9W7ESgwA70AXYNpfKBqh1KbTxmQVaYxpzA/SvlB9oclGPbApw==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.25.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.11.tgz", + "integrity": "sha512-HSFAT4+WYjIhrHxKBwGmOOSpphjYkcswF449j6EjsjbinTZbp8PJtjsVK1XFJStdzXdy/jaddAep2FGY+wyFAQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.25.11", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.11.tgz", + "integrity": "sha512-hr9Oxj1Fa4r04dNpWr3P8QKVVsjQhqrMSUzZzf+LZcYjZNqhA3IAfPQdEh1FLVUJSiu6sgAwp3OmwBfbFgG2Xg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.25.11", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.11.tgz", + "integrity": "sha512-u7tKA+qbzBydyj0vgpu+5h5AeudxOAGncb8N6C9Kh1N4n7wU1Xw1JDApsRjpShRpXRQlJLb9wY28ELpwdPcZ7A==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.25.11", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.11.tgz", + "integrity": "sha512-Qq6YHhayieor3DxFOoYM1q0q1uMFYb7cSpLD2qzDSvK1NAvqFi8Xgivv0cFC6J+hWVw2teCYltyy9/m/14ryHg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.25.11", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.11.tgz", + "integrity": "sha512-CN+7c++kkbrckTOz5hrehxWN7uIhFFlmS/hqziSFVWpAzpWrQoAG4chH+nN3Be+Kzv/uuo7zhX716x3Sn2Jduw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openharmony-arm64": { + "version": "0.25.11", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.25.11.tgz", + "integrity": "sha512-rOREuNIQgaiR+9QuNkbkxubbp8MSO9rONmwP5nKncnWJ9v5jQ4JxFnLu4zDSRPf3x4u+2VN4pM4RdyIzDty/wQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.25.11", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.11.tgz", + "integrity": "sha512-nq2xdYaWxyg9DcIyXkZhcYulC6pQ2FuCgem3LI92IwMgIZ69KHeY8T4Y88pcwoLIjbed8n36CyKoYRDygNSGhA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.25.11", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.11.tgz", + "integrity": "sha512-3XxECOWJq1qMZ3MN8srCJ/QfoLpL+VaxD/WfNRm1O3B4+AZ/BnLVgFbUV3eiRYDMXetciH16dwPbbHqwe1uU0Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.25.11", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.11.tgz", + "integrity": "sha512-3ukss6gb9XZ8TlRyJlgLn17ecsK4NSQTmdIXRASVsiS2sQ6zPPZklNJT5GR5tE/MUarymmy8kCEf5xPCNCqVOA==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.25.11", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.11.tgz", + "integrity": "sha512-D7Hpz6A2L4hzsRpPaCYkQnGOotdUpDzSGRIv9I+1ITdHROSFUWW95ZPZWQmGka1Fg7W3zFJowyn9WGwMJ0+KPA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@protobuf-ts/runtime": { + "version": "2.11.1", + "resolved": "https://registry.npmjs.org/@protobuf-ts/runtime/-/runtime-2.11.1.tgz", + "integrity": "sha512-KuDaT1IfHkugM2pyz+FwiY80ejWrkH1pAtOBOZFuR6SXEFTsnb/jiQWQ1rCIrcKx2BtyxnxW6BWwsVSA/Ie+WQ==", + "license": "(Apache-2.0 AND BSD-3-Clause)" + }, + "node_modules/@rollup/rollup-android-arm-eabi": { + "version": "4.52.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.52.5.tgz", + "integrity": "sha512-8c1vW4ocv3UOMp9K+gToY5zL2XiiVw3k7f1ksf4yO1FlDFQ1C2u72iACFnSOceJFsWskc2WZNqeRhFRPzv+wtQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-android-arm64": { + "version": "4.52.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.52.5.tgz", + "integrity": "sha512-mQGfsIEFcu21mvqkEKKu2dYmtuSZOBMmAl5CFlPGLY94Vlcm+zWApK7F/eocsNzp8tKmbeBP8yXyAbx0XHsFNA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-darwin-arm64": { + "version": "4.52.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.52.5.tgz", + "integrity": "sha512-takF3CR71mCAGA+v794QUZ0b6ZSrgJkArC+gUiG6LB6TQty9T0Mqh3m2ImRBOxS2IeYBo4lKWIieSvnEk2OQWA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-darwin-x64": { + "version": "4.52.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.52.5.tgz", + "integrity": "sha512-W901Pla8Ya95WpxDn//VF9K9u2JbocwV/v75TE0YIHNTbhqUTv9w4VuQ9MaWlNOkkEfFwkdNhXgcLqPSmHy0fA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-freebsd-arm64": { + "version": "4.52.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.52.5.tgz", + "integrity": "sha512-QofO7i7JycsYOWxe0GFqhLmF6l1TqBswJMvICnRUjqCx8b47MTo46W8AoeQwiokAx3zVryVnxtBMcGcnX12LvA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-freebsd-x64": { + "version": "4.52.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.52.5.tgz", + "integrity": "sha512-jr21b/99ew8ujZubPo9skbrItHEIE50WdV86cdSoRkKtmWa+DDr6fu2c/xyRT0F/WazZpam6kk7IHBerSL7LDQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-linux-arm-gnueabihf": { + "version": "4.52.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.52.5.tgz", + "integrity": "sha512-PsNAbcyv9CcecAUagQefwX8fQn9LQ4nZkpDboBOttmyffnInRy8R8dSg6hxxl2Re5QhHBf6FYIDhIj5v982ATQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm-musleabihf": { + "version": "4.52.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.52.5.tgz", + "integrity": "sha512-Fw4tysRutyQc/wwkmcyoqFtJhh0u31K+Q6jYjeicsGJJ7bbEq8LwPWV/w0cnzOqR2m694/Af6hpFayLJZkG2VQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-gnu": { + "version": "4.52.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.52.5.tgz", + "integrity": "sha512-a+3wVnAYdQClOTlyapKmyI6BLPAFYs0JM8HRpgYZQO02rMR09ZcV9LbQB+NL6sljzG38869YqThrRnfPMCDtZg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-musl": { + "version": "4.52.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.52.5.tgz", + "integrity": "sha512-AvttBOMwO9Pcuuf7m9PkC1PUIKsfaAJ4AYhy944qeTJgQOqJYJ9oVl2nYgY7Rk0mkbsuOpCAYSs6wLYB2Xiw0Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loong64-gnu": { + "version": "4.52.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.52.5.tgz", + "integrity": "sha512-DkDk8pmXQV2wVrF6oq5tONK6UHLz/XcEVow4JTTerdeV1uqPeHxwcg7aFsfnSm9L+OO8WJsWotKM2JJPMWrQtA==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-ppc64-gnu": { + "version": "4.52.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.52.5.tgz", + "integrity": "sha512-W/b9ZN/U9+hPQVvlGwjzi+Wy4xdoH2I8EjaCkMvzpI7wJUs8sWJ03Rq96jRnHkSrcHTpQe8h5Tg3ZzUPGauvAw==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-gnu": { + "version": "4.52.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.52.5.tgz", + "integrity": "sha512-sjQLr9BW7R/ZiXnQiWPkErNfLMkkWIoCz7YMn27HldKsADEKa5WYdobaa1hmN6slu9oWQbB6/jFpJ+P2IkVrmw==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-musl": { + "version": "4.52.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.52.5.tgz", + "integrity": "sha512-hq3jU/kGyjXWTvAh2awn8oHroCbrPm8JqM7RUpKjalIRWWXE01CQOf/tUNWNHjmbMHg/hmNCwc/Pz3k1T/j/Lg==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-s390x-gnu": { + "version": "4.52.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.52.5.tgz", + "integrity": "sha512-gn8kHOrku8D4NGHMK1Y7NA7INQTRdVOntt1OCYypZPRt6skGbddska44K8iocdpxHTMMNui5oH4elPH4QOLrFQ==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-gnu": { + "version": "4.52.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.52.5.tgz", + "integrity": "sha512-hXGLYpdhiNElzN770+H2nlx+jRog8TyynpTVzdlc6bndktjKWyZyiCsuDAlpd+j+W+WNqfcyAWz9HxxIGfZm1Q==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-musl": { + "version": "4.52.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.52.5.tgz", + "integrity": "sha512-arCGIcuNKjBoKAXD+y7XomR9gY6Mw7HnFBv5Rw7wQRvwYLR7gBAgV7Mb2QTyjXfTveBNFAtPt46/36vV9STLNg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-openharmony-arm64": { + "version": "4.52.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.52.5.tgz", + "integrity": "sha512-QoFqB6+/9Rly/RiPjaomPLmR/13cgkIGfA40LHly9zcH1S0bN2HVFYk3a1eAyHQyjs3ZJYlXvIGtcCs5tko9Cw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ] + }, + "node_modules/@rollup/rollup-win32-arm64-msvc": { + "version": "4.52.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.52.5.tgz", + "integrity": "sha512-w0cDWVR6MlTstla1cIfOGyl8+qb93FlAVutcor14Gf5Md5ap5ySfQ7R9S/NjNaMLSFdUnKGEasmVnu3lCMqB7w==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-ia32-msvc": { + "version": "4.52.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.52.5.tgz", + "integrity": "sha512-Aufdpzp7DpOTULJCuvzqcItSGDH73pF3ko/f+ckJhxQyHtp67rHw3HMNxoIdDMUITJESNE6a8uh4Lo4SLouOUg==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-gnu": { + "version": "4.52.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.52.5.tgz", + "integrity": "sha512-UGBUGPFp1vkj6p8wCRraqNhqwX/4kNQPS57BCFc8wYh0g94iVIW33wJtQAx3G7vrjjNtRaxiMUylM0ktp/TRSQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-msvc": { + "version": "4.52.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.52.5.tgz", + "integrity": "sha512-TAcgQh2sSkykPRWLrdyy2AiceMckNf5loITqXxFI5VuQjS5tSuw3WlwdN8qv8vzjLAUTvYaH/mVjSFpbkFbpTg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@types/estree": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", + "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==", + "dev": true, + "license": "MIT" }, "node_modules/@types/node": { - "version": "24.3.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-24.3.0.tgz", - "integrity": "sha512-aPTXCrfwnDLj4VvXrm+UUCQjNEvJgNA8s5F1cvwQU+3KNltTOkBm1j30uNLyqqPNe7gE3KFzImYoZEfLhp4Yow==", + "version": "24.9.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-24.9.1.tgz", + "integrity": "sha512-QoiaXANRkSXK6p0Duvt56W208du4P9Uye9hWLWgGMDTEoKPhuenzNcC4vGUmrNkiOKTlIrBoyNQYNpSwfEZXSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~7.16.0" + } + }, + "node_modules/esbuild": { + "version": "0.25.11", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.11.tgz", + "integrity": "sha512-KohQwyzrKTQmhXDW1PjCv3Tyspn9n5GcY2RTDqeORIdIJY8yKIF7sTSopFmn/wpMPW4rdPXI0UE5LJLuq3bx0Q==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.25.11", + "@esbuild/android-arm": "0.25.11", + "@esbuild/android-arm64": "0.25.11", + "@esbuild/android-x64": "0.25.11", + "@esbuild/darwin-arm64": "0.25.11", + "@esbuild/darwin-x64": "0.25.11", + "@esbuild/freebsd-arm64": "0.25.11", + "@esbuild/freebsd-x64": "0.25.11", + "@esbuild/linux-arm": "0.25.11", + "@esbuild/linux-arm64": "0.25.11", + "@esbuild/linux-ia32": "0.25.11", + "@esbuild/linux-loong64": "0.25.11", + "@esbuild/linux-mips64el": "0.25.11", + "@esbuild/linux-ppc64": "0.25.11", + "@esbuild/linux-riscv64": "0.25.11", + "@esbuild/linux-s390x": "0.25.11", + "@esbuild/linux-x64": "0.25.11", + "@esbuild/netbsd-arm64": "0.25.11", + "@esbuild/netbsd-x64": "0.25.11", + "@esbuild/openbsd-arm64": "0.25.11", + "@esbuild/openbsd-x64": "0.25.11", + "@esbuild/openharmony-arm64": "0.25.11", + "@esbuild/sunos-x64": "0.25.11", + "@esbuild/win32-arm64": "0.25.11", + "@esbuild/win32-ia32": "0.25.11", + "@esbuild/win32-x64": "0.25.11" + } + }, + "node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/nanoid": { + "version": "3.3.11", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz", + "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true, + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", + "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/postcss": { + "version": "8.5.6", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.6.tgz", + "integrity": "sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "nanoid": "^3.3.11", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/rollup": { + "version": "4.52.5", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.52.5.tgz", + "integrity": "sha512-3GuObel8h7Kqdjt0gxkEzaifHTqLVW56Y/bjN7PSQtkKr0w3V/QYSdt6QWYtd7A1xUtYQigtdUfgj1RvWVtorw==", "dev": true, "license": "MIT", "dependencies": { - "undici-types": "~7.10.0" + "@types/estree": "1.0.8" + }, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=18.0.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "@rollup/rollup-android-arm-eabi": "4.52.5", + "@rollup/rollup-android-arm64": "4.52.5", + "@rollup/rollup-darwin-arm64": "4.52.5", + "@rollup/rollup-darwin-x64": "4.52.5", + "@rollup/rollup-freebsd-arm64": "4.52.5", + "@rollup/rollup-freebsd-x64": "4.52.5", + "@rollup/rollup-linux-arm-gnueabihf": "4.52.5", + "@rollup/rollup-linux-arm-musleabihf": "4.52.5", + "@rollup/rollup-linux-arm64-gnu": "4.52.5", + "@rollup/rollup-linux-arm64-musl": "4.52.5", + "@rollup/rollup-linux-loong64-gnu": "4.52.5", + "@rollup/rollup-linux-ppc64-gnu": "4.52.5", + "@rollup/rollup-linux-riscv64-gnu": "4.52.5", + "@rollup/rollup-linux-riscv64-musl": "4.52.5", + "@rollup/rollup-linux-s390x-gnu": "4.52.5", + "@rollup/rollup-linux-x64-gnu": "4.52.5", + "@rollup/rollup-linux-x64-musl": "4.52.5", + "@rollup/rollup-openharmony-arm64": "4.52.5", + "@rollup/rollup-win32-arm64-msvc": "4.52.5", + "@rollup/rollup-win32-ia32-msvc": "4.52.5", + "@rollup/rollup-win32-x64-gnu": "4.52.5", + "@rollup/rollup-win32-x64-msvc": "4.52.5", + "fsevents": "~2.3.2" + } + }, + "node_modules/source-map-js": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/tinyglobby": { + "version": "0.2.15", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.15.tgz", + "integrity": "sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "fdir": "^6.5.0", + "picomatch": "^4.0.3" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" } }, "node_modules/typescript": { - "version": "5.9.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.2.tgz", - "integrity": "sha512-CWBzXQrc/qOkhidw1OzBTQuYRbfyxDXJMVJ1XNwUHGROVmuaeiEm3OslpZ1RV96d7SKKjZKrSJu3+t/xlw3R9A==", + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", "dev": true, "license": "Apache-2.0", "bin": { @@ -44,11 +1029,86 @@ } }, "node_modules/undici-types": { - "version": "7.10.0", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.10.0.tgz", - "integrity": "sha512-t5Fy/nfn+14LuOc2KNYg75vZqClpAiqscVvMygNnlsHBFpSXdJaYtXMcdNLpl/Qvc3P2cB3s6lOV51nqsFq4ag==", + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.16.0.tgz", + "integrity": "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==", "dev": true, "license": "MIT" + }, + "node_modules/vite": { + "version": "7.1.12", + "resolved": "https://registry.npmjs.org/vite/-/vite-7.1.12.tgz", + "integrity": "sha512-ZWyE8YXEXqJrrSLvYgrRP7p62OziLW7xI5HYGWFzOvupfAlrLvURSzv/FyGyy0eidogEM3ujU+kUG1zuHgb6Ug==", + "dev": true, + "license": "MIT", + "dependencies": { + "esbuild": "^0.25.0", + "fdir": "^6.5.0", + "picomatch": "^4.0.3", + "postcss": "^8.5.6", + "rollup": "^4.43.0", + "tinyglobby": "^0.2.15" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^20.19.0 || >=22.12.0", + "jiti": ">=1.21.0", + "less": "^4.0.0", + "lightningcss": "^1.21.0", + "sass": "^1.70.0", + "sass-embedded": "^1.70.0", + "stylus": ">=0.54.8", + "sugarss": "^5.0.0", + "terser": "^5.16.0", + "tsx": "^4.8.1", + "yaml": "^2.4.2" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "jiti": { + "optional": true + }, + "less": { + "optional": true + }, + "lightningcss": { + "optional": true + }, + "sass": { + "optional": true + }, + "sass-embedded": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + }, + "tsx": { + "optional": true + }, + "yaml": { + "optional": true + } + } } } } diff --git a/reader/ts/package.json b/reader/ts/package.json index 8e0a379..624d4bf 100644 --- a/reader/ts/package.json +++ b/reader/ts/package.json @@ -12,14 +12,14 @@ }, "type": "module", "scripts": { - "build": "tsc" + "build": "npx vite build && node dist/definition-reader.js" }, "author": "", "license": "", "devDependencies": { - "@code0-tech/sagittarius-graphql-types": "^0.0.0-4b2e73eae302fe499001bf42fdb3a6bcc5be78aa ", "@types/node": "^24.1.0", - "typescript": "^5.8.3" + "typescript": "^5.8.3", + "vite": "^7.1.11" }, "repository": { "type": "git", @@ -30,5 +30,10 @@ ], "publishConfig": { "access": "public" + }, + "dependencies": { + "@code0-tech/sagittarius-graphql-types": "^0.0.0-3bdab57d324cfeb2abf2cf60a801039b45de746d", + "@code0-tech/tucana": "^0.0.37", + "@protobuf-ts/runtime": "^2.11.1" } } diff --git a/reader/ts/src/mapper/dataTypeMapper.ts b/reader/ts/src/mapper/dataTypeMapper.ts new file mode 100644 index 0000000..81e7b88 --- /dev/null +++ b/reader/ts/src/mapper/dataTypeMapper.ts @@ -0,0 +1,227 @@ +import { + DataType, + DataTypeIdentifier, DataTypeRule, + DataTypeRuleConnection, DataTypeRulesContainsKeyConfig, DataTypeRulesContainsTypeConfig, + DataTypeRulesInputTypeConfig, + DataTypeRulesInputTypesConfig, + DataTypeRulesItemOfCollectionConfig, DataTypeRulesNumberRangeConfig, + DataTypeRulesParentTypeConfig, DataTypeRulesRegexConfig, DataTypeRulesVariant, DataTypeVariant, + GenericCombinationStrategyType, +} from "@code0-tech/sagittarius-graphql-types"; +import { + DataTypeIdentifier as TucanaDataTypeIdentifier, + DefinitionDataType_Variant, DefinitionDataTypeRule, GenericMapper_GenericCombinationStrategy +} from "@code0-tech/tucana/pb/shared.data_type_pb.ts" +import {GenericMapper as TucanaGenericMapper} from "@code0-tech/tucana/pb/shared.data_type_pb.ts" +import {ConstructedDataTypes, getID} from "../parser.ts"; +import {getTranslationConnection} from "./translation.ts"; + +function getDataType(identifier: string, constructedDataTypes: ConstructedDataTypes): DataType | null { + const dataType = constructedDataTypes.constructedDataTypes.find(dt => dt.identifier === identifier) + if (dataType == undefined) { + const tucanaDataType = constructedDataTypes.scannedTucanaTypes.find(dt => dt.identifier === identifier) + if (tucanaDataType == undefined) { + console.error("Skipping Identifier because it can't be identified:" + identifier) + return null + } + const constructed: DataType = { + id: `gid://sagittarius/DataType/${getID(constructedDataTypes)}`, + genericKeys: tucanaDataType.genericKeys, + identifier: tucanaDataType.identifier, + name: getTranslationConnection(tucanaDataType.name), + rules: createRules(tucanaDataType.rules, constructedDataTypes), + variant: getDataTypeVariant(tucanaDataType.variant), + } + + constructedDataTypes.constructedDataTypes.push(constructed) + return constructed; + } + return dataType; +} + +function createRules(rule: DefinitionDataTypeRule[], constructedDataTypes: ConstructedDataTypes) : DataTypeRuleConnection { + return { + count: rule.length, + nodes: rule.map(r => { + switch (r.config.oneofKind) { + case "containsType": { + const ruleConfig: DataTypeRulesContainsTypeConfig = { + dataTypeIdentifier: getDataTypeIdentifier(r.config.containsType.dataTypeIdentifier, constructedDataTypes), + } + const rule: DataTypeRule = { + variant: DataTypeRulesVariant.ContainsType, + config: ruleConfig + } + return rule; + } + case "containsKey": { + const ruleConfig: DataTypeRulesContainsKeyConfig = { + dataTypeIdentifier: getDataTypeIdentifier(r.config.containsKey.dataTypeIdentifier, constructedDataTypes), + key: r.config.containsKey.key, + } + const rule: DataTypeRule = { + variant: DataTypeRulesVariant.ContainsKey, + config: ruleConfig + } + return rule; + } + case "itemOfCollection": { + const ruleConfig: DataTypeRulesItemOfCollectionConfig = { + items: r.config.itemOfCollection.items, //TODO: This needs to be checked + } + const rule: DataTypeRule = { + variant: DataTypeRulesVariant.ItemOfCollection, + config: ruleConfig + } + return rule; + } + case "numberRange": { + const ruleConfig: DataTypeRulesNumberRangeConfig = { + from: Number(r.config.numberRange.from), + steps: r.config.numberRange.steps ? Number(r.config.numberRange.steps) : undefined, + to: Number(r.config.numberRange.to), + } + const rule : DataTypeRule = { + variant: DataTypeRulesVariant.NumberRange, + config: ruleConfig + } + return rule; + } + case "regex": { + const ruleConfig: DataTypeRulesRegexConfig = { + pattern: r.config.regex.pattern, + } + const rule : DataTypeRule = { + variant: DataTypeRulesVariant.Regex, + config: ruleConfig + } + return rule; + } + case "inputTypes": { + const ruleConfig: DataTypeRulesInputTypesConfig = { + inputTypes: r.config.inputTypes.inputTypes.map(i => { + console.log("AF: " + i.inputIdentifier) + const input: DataTypeRulesInputTypeConfig = { + dataTypeIdentifier: getDataTypeIdentifier(i.dataTypeIdentifier, constructedDataTypes), + inputIdentifier: i.inputIdentifier, + } + return input; + }), + } + const rule : DataTypeRule = { + variant: DataTypeRulesVariant.InputType, + config: ruleConfig + } + return rule; + } + + case "returnType": { + const ruleConfig: DataTypeRulesParentTypeConfig = { + dataTypeIdentifier: getDataTypeIdentifier(r.config.returnType.dataTypeIdentifier, constructedDataTypes), + } + const rule : DataTypeRule = { + variant: DataTypeRulesVariant.ReturnType, + config: ruleConfig + } + return rule; + } + + case "parentType": { + const ruleConfig: DataTypeRulesParentTypeConfig = { + dataTypeIdentifier: getDataTypeIdentifier(r.config.parentType.parentType, constructedDataTypes), + } + const rule : DataTypeRule = { + variant: DataTypeRulesVariant.ParentType, + config: ruleConfig + } + return rule; + } + } + throw new Error(`Unknown rule: ${rule}`) + } + ) + } +} + +function getDataTypeVariant(variant: DefinitionDataType_Variant): DataTypeVariant { + switch (variant) { + case DefinitionDataType_Variant.ARRAY: + return DataTypeVariant.Array + case DefinitionDataType_Variant.DATATYPE: + return DataTypeVariant.DataType; + case DefinitionDataType_Variant.ERROR: + return DataTypeVariant.Error; + case DefinitionDataType_Variant.NODE: + return DataTypeVariant.Node; + case DefinitionDataType_Variant.OBJECT: + return DataTypeVariant.Object; + case DefinitionDataType_Variant.PRIMITIVE: + return DataTypeVariant.Primitive; + case DefinitionDataType_Variant.TYPE: + return DataTypeVariant.Type; + default: + throw new Error(`Unknown variant: ${variant}`); + } +} + +function getDataTypeIdentifier(identifier: TucanaDataTypeIdentifier | undefined, constructedDataTypes: ConstructedDataTypes): DataTypeIdentifier | null { + if (identifier == undefined) { + return null + } + + switch (identifier.type.oneofKind) { + case "genericType": { + return { + id: `gid://sagittarius/DataTypeIdentifier/${getID(constructedDataTypes)}`, + genericType: { + id: `gid://sagittarius/GenericType/${getID(constructedDataTypes)}`, + dataType: getDataType(identifier.type.genericType.dataTypeIdentifier, constructedDataTypes), + genericMappers: identifier.type.genericType.genericMappers.map((mapper: TucanaGenericMapper) => { + return { + genericCombinationStrategies: mapper.genericCombinations.map(m => { + let type = undefined + switch (m) { + case GenericMapper_GenericCombinationStrategy.AND: + type = GenericCombinationStrategyType.And + break + case GenericMapper_GenericCombinationStrategy.OR: + type = GenericCombinationStrategyType.Or + break + default: + throw new Error("GenericCombinationStrategy was Unknown"); + } + return { + id: `gid://sagittarius/GenericCombinationStrategy/${getID(constructedDataTypes)}`, + type: type + } + }), + sources: mapper.source.map(id => + getDataTypeIdentifier(id, constructedDataTypes) + ).filter(id => id != null), + target: mapper.target, + id: `gid://sagittarius/GenericMapper/${getID(constructedDataTypes)}`, + } + }), + } + } + } + + case "dataTypeIdentifier": { + return { + id: `gid://sagittarius/DataTypeIdentifier/${getID(constructedDataTypes)}`, + dataType: getDataType(identifier.type.dataTypeIdentifier, constructedDataTypes) + } + } + + case "genericKey": { + return { + id: `gid://sagittarius/DataTypeIdentifier/${getID(constructedDataTypes)}`, + genericKey: identifier.type.genericKey, + } + } + } + + return null; +} + +export {getDataType, getDataTypeIdentifier} \ No newline at end of file diff --git a/reader/ts/src/mapper/flowTypeMapper.ts b/reader/ts/src/mapper/flowTypeMapper.ts new file mode 100644 index 0000000..e93d0f5 --- /dev/null +++ b/reader/ts/src/mapper/flowTypeMapper.ts @@ -0,0 +1,35 @@ +import {FlowType as TucanaFlowType, FlowTypeSetting as TucanaFlowTypeSetting} from "@code0-tech/tucana/pb/shared.flow_definition_pb.ts" +import {FlowType, FlowTypeSetting} from "@code0-tech/sagittarius-graphql-types"; +import {getDataType} from "./dataTypeMapper.ts"; +import {ConstructedDataTypes, getID} from "../parser.ts"; +import {getTranslationConnection} from "./translation.js"; + +function mapFlowType(flowType: TucanaFlowType, constructed: ConstructedDataTypes): FlowType | null { + return { + id: `gid://sagittarius/TypesFlowType/${getID(constructed)}`, + identifier: flowType.identifier, + inputType: getDataType(flowType.inputTypeIdentifier!!, constructed), + returnType: getDataType(flowType.returnTypeIdentifier!!, constructed), + flowTypeSettings: createFlowTypeSetting(flowType.settings, constructed), + names: getTranslationConnection(flowType.name), + descriptions: getTranslationConnection(flowType.description), + editable: flowType.editable + } +} + +function createFlowTypeSetting(settings: TucanaFlowTypeSetting[], constructed: ConstructedDataTypes): FlowTypeSetting[] { + return settings.map(setting => { + const flowSetting: FlowTypeSetting = { + id: `gid://sagittarius/FlowTypeSetting/${getID(constructed)}`, + names: getTranslationConnection(setting.name), + descriptions: getTranslationConnection(setting.description), + dataType: getDataType(setting.dataTypeIdentifier, constructed), + identifier: setting.identifier, + unique: setting.unique + } + + return flowSetting; + }) +} + +export {mapFlowType} \ No newline at end of file diff --git a/reader/ts/src/mapper/functionMapper.ts b/reader/ts/src/mapper/functionMapper.ts new file mode 100644 index 0000000..f16cdc1 --- /dev/null +++ b/reader/ts/src/mapper/functionMapper.ts @@ -0,0 +1,39 @@ +import {FunctionDefinition, ParameterDefinitionConnection} from "@code0-tech/sagittarius-graphql-types"; +import { + RuntimeFunctionDefinition as TucanaFunction, + RuntimeParameterDefinition +} from "@code0-tech/tucana/pb/shared.runtime_function_pb.ts"; +import {getDataTypeIdentifier} from "./dataTypeMapper.ts"; +import {ConstructedDataTypes, getID} from "../parser.ts"; +import {getTranslationConnection} from "./translation.js"; + +function mapFunction(func: TucanaFunction, constructed: ConstructedDataTypes): FunctionDefinition | null { + return { + id: `gid://sagittarius/FunctionDefinition/${getID(constructed)}`, + genericKeys: func.genericKeys, + names: getTranslationConnection(func.name), + descriptions: getTranslationConnection(func.description), + documentations: getTranslationConnection(func.documentation), + deprecationMessages: getTranslationConnection(func.deprecationMessage), + throwsError: func.throwsError, + returnType: getDataTypeIdentifier(func.returnTypeIdentifier, constructed), + parameterDefinitions: getParameterDefinitionConnection(func.runtimeParameterDefinitions, constructed), + } +} + +function getParameterDefinitionConnection(def: RuntimeParameterDefinition[], constructed: ConstructedDataTypes): ParameterDefinitionConnection { + return { + count: def.length, + nodes: def.map(node => { + return { + id: `gid://sagittarius/ParameterDefinition/${getID(constructed)}`, + names: getTranslationConnection(node.name), + descriptions: getTranslationConnection(node.description), + documentations: getTranslationConnection(node.documentation), + dataType: getDataTypeIdentifier(node.dataTypeIdentifier, constructed) + } + }) + } +} + +export {mapFunction} \ No newline at end of file diff --git a/reader/ts/src/mapper/translation.ts b/reader/ts/src/mapper/translation.ts new file mode 100644 index 0000000..fecd963 --- /dev/null +++ b/reader/ts/src/mapper/translation.ts @@ -0,0 +1,9 @@ +import {Translation} from "@code0-tech/tucana/pb/shared.translation_pb.js"; +import {TranslationConnection} from "@code0-tech/sagittarius-graphql-types"; + +export function getTranslationConnection(translation: Translation[]): TranslationConnection { + return { + count: translation.length, + nodes: translation, + } +} diff --git a/reader/ts/src/parser.ts b/reader/ts/src/parser.ts index 91c87a4..39e51e7 100644 --- a/reader/ts/src/parser.ts +++ b/reader/ts/src/parser.ts @@ -1,53 +1,131 @@ -import {Reader} from './reader.js'; -import {DataType, FlowType, RuntimeFunctionDefinition} from "@code0-tech/sagittarius-graphql-types"; -import {Feature, Meta, MetaType} from "./types.js"; +import {DefinitionDataType as TucanaDataType} from "@code0-tech/tucana/pb/shared.data_type_pb.ts"; +import {Feature} from "./types.ts"; +import {readdirSync, readFileSync} from "node:fs"; +import {FlowType as TucanaFlowType} from "@code0-tech/tucana/pb/shared.flow_definition_pb.ts"; +import {RuntimeFunctionDefinition as TucanaFunction} from "@code0-tech/tucana/pb/shared.runtime_function_pb.ts"; +import path from "node:path"; +import {mapFlowType} from "./mapper/flowTypeMapper.ts"; +import {mapFunction} from "./mapper/functionMapper.ts"; +import {DataType} from "@code0-tech/sagittarius-graphql-types"; +import {DefinitionDataType} from "@code0-tech/tucana/pb/shared.data_type_pb.ts"; +import {getDataType} from "./mapper/dataTypeMapper.ts"; + +export interface ConstructedDataTypes { + scannedTucanaTypes: DefinitionDataType[] + constructedDataTypes: DataType[] + id: number +} + +export function getID(constructedDataTypes: ConstructedDataTypes) { + const last = constructedDataTypes.id + constructedDataTypes.id += 1 + return last +} export const Definition = (rootPath: string): Feature[] => { - const meta = Reader(rootPath); - if (!meta) return []; - const features: Feature[] = []; - - for (const m of meta) { - let feature = features.find((f) => f.name === m.name); - - if (feature) { - appendMeta(feature, m); - } else { - feature = { - name: m.name, - dataTypes: [], - flowTypes: [], - runtimeFunctions: [], - }; - appendMeta(feature, m); - features.push(feature); + const dataTypes: {feature: string, type: TucanaDataType}[] = [] + const runtimeFunctions: {feature: string, func: TucanaFunction}[] = []; + const flowTypes: {feature: string, flow: TucanaFlowType}[] = []; + + readdirSync(rootPath, { withFileTypes: true }).forEach(file => { + const featureName = file.name.split("_")[0] + if (featureName == null) { + throw new Error("Feature name is null") + } + + const filePath = path.join(file.parentPath, file.name) + + const content = readFileSync(filePath); + if (file.name.includes("data_type")) { + const decoded = TucanaDataType.fromBinary(content); + dataTypes.push( + { + feature: featureName, + type: decoded, + } + ) } + + if (file.name.includes("function")) { + const decoded = TucanaFunction.fromBinary(content); + runtimeFunctions.push( + { + feature: featureName, + func: decoded, + } + ) + } + + if (file.name.includes("flow_type")) { + const decoded = TucanaFlowType.fromBinary(content); + flowTypes.push( + { + feature: featureName, + flow: decoded, + } + ) + } + }) + + const features: Feature[] = [] + const constructed: ConstructedDataTypes = { + scannedTucanaTypes: dataTypes.map(f => f.type), + constructedDataTypes: [], + id: 0 } - return features; -} + function getFeature(name:string): Feature { + const feature = features.find((f) => f.name === name); + if (feature != undefined) { + return feature; + } + + const newFeature = { + name: name, + dataTypes: [], + flowTypes: [], + runtimeFunctions: [], + }; -function appendMeta(feature: Feature, meta: Meta): void { - const definition = meta.data; - try { - switch (meta.type) { - case MetaType.DataType: { - const parsed = JSON.parse(definition) as DataType; - feature.dataTypes.push(parsed); - break; - } - case MetaType.FlowType: { - const parsed = JSON.parse(definition) as FlowType; - feature.flowTypes.push(parsed); - break; - } - case MetaType.RuntimeFunction: { - const parsed = JSON.parse(definition) as RuntimeFunctionDefinition; - feature.runtimeFunctions.push(parsed); - break; - } - } - } catch (err: any) { - console.error(`Error parsing ${meta.type} ${meta.name} ${definition}:`, err); + features.push(newFeature); + return newFeature; } -} \ No newline at end of file + + dataTypes.map(f => { + return { + name: f.feature, + type: getDataType(f.type.identifier, constructed) + } + }).forEach(dt => { + if (dt.type != null) { + const feature = getFeature(dt.name) + feature.dataTypes.push(dt.type) + } + }) + + runtimeFunctions.map(f => { + return { + name: f.feature, + type: mapFunction(f.func, constructed) + } + }).forEach(dt => { + if (dt.type != null) { + const feature = getFeature(dt.name) + feature.runtimeFunctions.push(dt.type) + } + }) + + flowTypes.map(f => { + return { + name: f.feature, + type: mapFlowType(f.flow, constructed) + } + }).forEach(dt => { + if (dt.type != null) { + const feature = getFeature(dt.name) + feature.flowTypes.push(dt.type) + } + }) + + return features; +} diff --git a/reader/ts/src/reader.ts b/reader/ts/src/reader.ts deleted file mode 100644 index fe321ae..0000000 --- a/reader/ts/src/reader.ts +++ /dev/null @@ -1,80 +0,0 @@ -import * as fs from 'fs'; -import * as path from 'path'; -import {Meta, MetaType} from "./types.js"; - -export const Reader = (rootPath: string): Meta[] => { - const result: Meta[] = []; - - try { - const features = fs.readdirSync(rootPath, { withFileTypes: true }); - - for (const featureDirent of features) { - if (!featureDirent.isDirectory()) continue; - - const featurePath = path.join(rootPath, featureDirent.name); - const featureName = featureDirent.name; - - const typeDirs = fs.readdirSync(featurePath, { withFileTypes: true }); - - for (const typeDirent of typeDirs) { - if (!typeDirent.isDirectory()) continue; - - const metaType = matchMetaType(typeDirent.name); - if (!metaType) continue; - - const typePath = path.join(featurePath, typeDirent.name); - const definitions = fs.readdirSync(typePath, { withFileTypes: true }); - - for (const def of definitions) { - const defPath = path.join(typePath, def.name); - - if (def.isFile()) { - if (!defPath.endsWith('.json')) continue; - try { - const content = fs.readFileSync(defPath, 'utf-8'); - const meta: Meta = {name: featureName, type: metaType, data: content}; - result.push(meta); - } catch (err) { - console.error(`Error reading file: ${defPath}`, err); - } - } else if (def.isDirectory()) { - const subDefinitions = fs.readdirSync(defPath, { withFileTypes: true }); - - for (const subDef of subDefinitions) { - const subPath = path.join(defPath, subDef.name); - - if (!subPath.endsWith('.json')) continue; - if (!subDef.isFile()) continue; - - try { - const content = fs.readFileSync(subPath, 'utf-8'); - const meta: Meta = {name: featureName, type: metaType, data: content}; - result.push(meta); - } catch (err) { - console.error(`Error reading file: ${subPath}`, err); - } - } - } - } - } - } - - return result - } catch (err) { - console.error(`Error reading path ${rootPath}:`, err); - return []; - } -} - -function matchMetaType(name: string): MetaType | null { - switch (name) { - case 'flow_type': - return MetaType.FlowType; - case 'data_type': - return MetaType.DataType; - case 'runtime_definition': - return MetaType.RuntimeFunction; - default: - return null; - } -} diff --git a/reader/ts/src/types.ts b/reader/ts/src/types.ts index a9bbc31..f68d5e8 100644 --- a/reader/ts/src/types.ts +++ b/reader/ts/src/types.ts @@ -1,20 +1,8 @@ -import {DataType, FlowType, RuntimeFunctionDefinition} from "@code0-tech/sagittarius-graphql-types"; - -export enum MetaType { - FlowType = 'FlowType', - DataType = 'DataType', - RuntimeFunction = 'RuntimeFunction', -} - -export interface Meta { - name: string; - type: MetaType; - data: string; -} +import {DataType, FlowType, FunctionDefinition} from "@code0-tech/sagittarius-graphql-types"; export interface Feature { name: string; dataTypes: DataType[]; flowTypes: FlowType[]; - runtimeFunctions: RuntimeFunctionDefinition[]; + runtimeFunctions: FunctionDefinition[]; } \ No newline at end of file diff --git a/reader/ts/tsconfig.json b/reader/ts/tsconfig.json index e2c781f..78520bf 100644 --- a/reader/ts/tsconfig.json +++ b/reader/ts/tsconfig.json @@ -1,5 +1,6 @@ { "exclude": ["node_modules", "build"], + "include": ["index.ts", "src/**/*.ts", "node_modules/@code0-tech/tucana/pb/**/*.ts"], "compilerOptions": { "lib": ["ESNext"], "module": "NodeNext", @@ -10,6 +11,9 @@ "strict": true, "moduleResolution": "nodenext", "declaration": true, - "emitDeclarationOnly": false + "emitDeclarationOnly": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "allowImportingTsExtensions": true } } diff --git a/reader/ts/vite.config.ts b/reader/ts/vite.config.ts new file mode 100644 index 0000000..1d8213f --- /dev/null +++ b/reader/ts/vite.config.ts @@ -0,0 +1,14 @@ +import { defineConfig } from 'vite'; + +export default defineConfig({ + build: { + lib: { + entry: './index.ts', // your entry file + formats: ['es'], // Node ESM + }, + outDir: 'dist', // output folder + rollupOptions: { + external: [/^node:.*$/], // Node built-ins + }, + }, +}); \ No newline at end of file