Skip to content

Commit a635a06

Browse files
authored
[feature] Expose all types via type-builder (not just dynamic) (#1893)
<!-- ELLIPSIS_HIDDEN --> > [!IMPORTANT] > Expose all types via `TypeBuilder`, not just dynamic types, in `type_builder.ts` for React, TypeScript, and TypeScript-ESM, adding `ClassViewer` and `EnumViewer` for static types. > > - **Behavior**: > - Expose all types via `TypeBuilder`, not just dynamic types, in `type_builder.ts` for React, TypeScript, and TypeScript-ESM. > - Add `ClassViewer` and `EnumViewer` for static types, allowing access to all class and enum types. > - **Files**: > - Update `type_builder.ts` in `integ-tests/react/baml_client`, `integ-tests/typescript-esm/baml_client`, and `integ-tests/typescript/baml_client` to include all types. > - **Misc**: > - Ensure consistency across different environments by updating type definitions and constructors. > > <sup>This description was created by </sup>[<img alt="Ellipsis" src="https://img.shields.io/badge/Ellipsis-blue?color=175173">](https://www.ellipsis.dev?ref=BoundaryML%2Fbaml&utm_source=github&utm_medium=referral)<sup> for dc8de13. You can [customize](https://app.ellipsis.dev/BoundaryML/settings/summaries) this summary. It will automatically update as commits are pushed.</sup> <!-- ELLIPSIS_HIDDEN -->
1 parent 20d0137 commit a635a06

16 files changed

Lines changed: 7619 additions & 434 deletions

File tree

engine/Cargo.lock

Lines changed: 78 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

engine/baml-runtime/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@ aws-config = "=1.5.3"
160160
# same goes for aws-config.
161161
# Potential migration https://docs.aws.amazon.com/sdk-for-rust/latest/dg/http.html#tlsProviders
162162
aws-sdk-bedrockruntime = { version = "=1.76.0", default-features = false, features = [
163-
164163
] }
165164
axum = "0.7.5"
166165
axum-extra = { version = "0.9.3", features = ["erased-json", "typed-header"] }
@@ -173,6 +172,7 @@ notify-debouncer-full = "0.3.1"
173172
ring = { version = "0.17.4", features = ["std"] }
174173
tokio = { version = "1", features = ["full"] }
175174
reqwest.workspace = true
175+
rustls = "0.23.26"
176176
walkdir = "2.5.0"
177177
which = "6.0.3"
178178
indicatif = "0.17"

engine/baml-runtime/src/lib.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,19 @@ use crate::test_constraints::{evaluate_test_constraints, TestConstraintsResult};
113113
#[cfg(not(target_arch = "wasm32"))]
114114
static TOKIO_SINGLETON: OnceLock<std::io::Result<Arc<tokio::runtime::Runtime>>> = OnceLock::new();
115115

116+
static INIT: std::sync::Once = std::sync::Once::new();
117+
118+
fn setup_crypto_provider() {
119+
#[cfg(not(target_arch = "wasm32"))]
120+
{
121+
use rustls::crypto::CryptoProvider;
122+
INIT.call_once(|| {
123+
let provider = rustls::crypto::ring::default_provider();
124+
CryptoProvider::install_default(provider).expect("failed to install CryptoProvider");
125+
});
126+
}
127+
}
128+
116129
#[derive(Clone)]
117130
pub struct BamlRuntime {
118131
pub inner: InternalBamlRuntime,
@@ -174,6 +187,7 @@ impl BamlRuntime {
174187
path: &std::path::Path,
175188
env_vars: HashMap<T, T>,
176189
) -> Result<Self> {
190+
setup_crypto_provider();
177191
let path = Self::parse_baml_src_path(path)?;
178192

179193
let copy = env_vars
@@ -196,6 +210,7 @@ impl BamlRuntime {
196210
files: &HashMap<T, T>,
197211
env_vars: HashMap<U, U>,
198212
) -> Result<Self> {
213+
setup_crypto_provider();
199214
let copy = env_vars
200215
.iter()
201216
.map(|(k, v)| (k.as_ref().to_string(), v.as_ref().to_string()))

0 commit comments

Comments
 (0)