Docs

SDK Reference

This is a compact reference for the public SDKs.

Rust SDK

Crate:

[dependencies]
tauri-watch-sdk = "0.1.0"
tauri-watch-types = "0.1.0"

Initialize:

use tauri_watch_sdk::{bridge_log_crate, init, Config};

init(Config {
    app_id: "my-tauri-app".into(),
    api_key: "YOUR_TAURIWATCH_API_KEY".into(),
    endpoint: "https://tauri-watch.cloud.alkkmia.com".into(),
    environment: "production".into(),
    release_version: env!("CARGO_PKG_VERSION").into(),
    app_version: Some(env!("CARGO_PKG_VERSION").into()),
    tauri_version: Some("2".into()),
    enabled: true,
    batch_size: 20,
    flush_interval_ms: 3000,
    retry_attempts: 3,
    queue_file_path: None,
});

let _ = bridge_log_crate(log::LevelFilter::Info);

Functions:

  • init(config)
  • bridge_log_crate(level_filter)
  • capture_log(level, message, metadata)
  • capture_error(message, stacktrace, source, severity, handled, metadata)
  • capture_panic(message, file, line, backtrace, thread, metadata)
  • capture_performance(command_name, duration_ms, success, error_message, metadata)
  • measure_command(command_name, metadata, async_fn)
  • flush()

Performance wrapper:

use serde_json::json;
use tauri_watch_sdk::measure_command;

#[tauri::command]
async fn sync_data() -> Result<(), String> {
    measure_command("sync_data", json!({"source": "tauri_command"}), || async {
        do_sync().await
    }).await
}

JavaScript SDK

Package:

npm install @alkkmia/tauri-watch-sdk

Initialize:

import { initTauriWatch } from "@alkkmia/tauri-watch-sdk";

initTauriWatch({
  appId: "my-tauri-app",
  apiKey: "YOUR_TAURIWATCH_API_KEY",
  endpoint: "https://tauri-watch.cloud.alkkmia.com",
  environment: "production",
  releaseVersion: "1.0.0",
  appVersion: "1.0.0",
  tauriVersion: "2",
  batchSize: 20,
  flushIntervalMs: 3000,
  retryAttempts: 3,
  persistentQueueKey: "tauriwatch:my-tauri-app:queue",
  sessionReplay: {
    enabled: true,
    maxEvents: 8000,
    flushOnStop: true,
    snapshotIntervalMs: 15000,
  },
});

Functions:

  • initTauriWatch(config)
  • installGlobalHandlers()
  • captureError(error, metadata)
  • logInfo(message, metadata)
  • logWarn(message, metadata)
  • logError(message, metadata)
  • capturePerformance(commandName, durationMs, success, errorMessage, metadata)
  • measure(commandName, asyncFn, metadata)
  • startSessionReplay()
  • stopSessionReplay()
  • flushReplay()
  • flush()

Session replay privacy defaults:

  • Inputs are masked.
  • Elements with [data-tauriwatch-mask] or [data-private] are masked.
  • Elements with class tauriwatch-mask or private are blocked.
  • Elements with class tauriwatch-ignore are ignored.

Plugin JS API

Package:

npm install @alkkmia/tauri-plugin-tauri-watch-api

Functions:

  • initialize(config)
  • installGlobalHandlers()
  • captureError(error, options)
  • logInfo(message, metadata)
  • logWarn(message, metadata)
  • logError(message, metadata)
  • flush()

Use this package together with tauri-plugin-tauri-watch.