@routstr/sdk 0.3.11 → 0.3.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -89,15 +89,28 @@ const currentMode = client.getMode(); // Returns the active mode
89
89
 
90
90
  ## Tests
91
91
 
92
- SDK unit tests live in `sdk/__tests__` and are run with Vitest.
92
+ SDK tests live in `tests/` and are run with Vitest.
93
93
 
94
- - `sdk/__tests__/storageStore.test.ts` covers baseUrl normalization and token storage behaviors.
95
- - `sdk/__tests__/providerManagerPricing.test.ts` covers provider price ranking and model id normalization.
96
- - `sdk/__tests__/cashuSpender.test.ts` covers validation, token reuse, and insufficient balance handling.
97
- - `sdk/__tests__/balanceManager.test.ts` covers refund/top-up validation and early returns.
94
+ ```
95
+ tests/
96
+ ├── unit/ # Fast, isolated tests with mocks
97
+ │ ├── storage.normalization.test.ts # baseUrl normalization (most basic storage test)
98
+ │ ├── cashuSpender.validation.test.ts # input validation (most basic wallet test)
99
+ │ ├── providerManager.pricing.test.ts # price ranking (most basic client test)
100
+ │ ├── balanceManager.test.ts # refund/top-up validation and collision guards
101
+ │ ├── cashuSpender.test.ts # token reuse and insufficient balance handling
102
+ │ ├── providerManagerPricing.test.ts # provider price ranking and onion filtering
103
+ │ ├── shardedDiscoveryAdapter.test.ts # discovery adapter migration and persistence
104
+ │ ├── sse.test.ts # SSE stream parsing
105
+ │ ├── storageStore.test.ts # xcashu token storage behaviors
106
+ │ └── usageTrackingDriver.test.ts # usage tracking CRUD and aggregates
107
+ └── integration/ # Multi-module or network tests (future)
108
+ ```
98
109
 
99
110
  Run:
100
111
 
101
112
  ```bash
102
- npm run test:sdk
113
+ npm run test:sdk # all unit tests
114
+ npm run test:sdk:unit # unit tests only
115
+ npm run test:sdk:integration # integration tests only
103
116
  ```
package/dist/bun.js CHANGED
@@ -6421,6 +6421,8 @@ async function createBunSqliteDriver(dbPath, options) {
6421
6421
  const logger = (options?.logger ?? consoleLogger).child("BunSqliteDriver");
6422
6422
  const SQLite = (await import('bun:sqlite')).default;
6423
6423
  const db = new SQLite(dbPath);
6424
+ db.run("PRAGMA journal_mode = WAL");
6425
+ db.run("PRAGMA busy_timeout = 5000");
6424
6426
  db.run(`
6425
6427
  CREATE TABLE IF NOT EXISTS sdk_storage (
6426
6428
  key TEXT PRIMARY KEY,
@@ -6533,6 +6535,8 @@ var createBunSqliteUsageTrackingDriver = (options = {}) => {
6533
6535
  );
6534
6536
  }
6535
6537
  const db = new SQLiteDatabase(dbPath);
6538
+ db.run("PRAGMA journal_mode = WAL");
6539
+ db.run("PRAGMA busy_timeout = 5000");
6536
6540
  db.run(`
6537
6541
  CREATE TABLE IF NOT EXISTS ${tableName} (
6538
6542
  id TEXT PRIMARY KEY,