modality-kit 0.14.14 → 0.14.15

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/dist/index.js CHANGED
@@ -149,7 +149,10 @@ class ModalityLogger {
149
149
  return now.toISOString();
150
150
  }
151
151
  initLogLevel() {
152
- const processEnvLogLevel = process.env.MODALITY_LOG_LEVEL;
152
+ let processEnvLogLevel = null;
153
+ if (typeof process !== "undefined") {
154
+ processEnvLogLevel = process.env.MODALITY_LOG_LEVEL;
155
+ }
153
156
  this.logLevel = levels.indexOf(processEnvLogLevel) !== -1 ? processEnvLogLevel : "info";
154
157
  }
155
158
  shouldLog(level) {
@@ -5696,8 +5699,6 @@ class JSONRPCManager extends JSONRPCCall {
5696
5699
  this.methods.clear();
5697
5700
  }
5698
5701
  }
5699
- // src/util_tests/isTestEnvironment.ts
5700
- var isTestEnvironment = globalThis.Bun?.main?.includes?.("test");
5701
5702
  // src/websocket-client.ts
5702
5703
  var logger3 = getLoggerInstance("WebSocket-Client");
5703
5704
 
@@ -6026,7 +6027,6 @@ export {
6026
6027
  withErrorHandling,
6027
6028
  mergeResponsesContent,
6028
6029
  loadVersion,
6029
- isTestEnvironment,
6030
6030
  getLoggerInstance,
6031
6031
  formatSuccessResponse,
6032
6032
  formatErrorResponse,
@@ -18,10 +18,6 @@ export { JSONRPCErrorCode } from "./schemas/jsonrpc";
18
18
  export type { JSONRPCManagerEvents, JSONRPCManagerConfig, } from "./jsonrpc-manager";
19
19
  export type { JSONRPCMessage, JSONRPCRequest, JSONRPCNotification, JSONRPCResponse, JSONRPCBatchRequest, JSONRPCBatchResponse, JSONRPCErrorResponse, JSONRPCValidationResult, JSONRPCError, JSONRPCParams, CommandExecuteParams, NotificationSendParams, } from "./schemas/jsonrpc";
20
20
  export { ERROR_METHOD_NOT_FOUND } from "./jsonrpc-manager";
21
- /**
22
- * For test tool
23
- */
24
- export { isTestEnvironment } from "./util_tests/isTestEnvironment";
25
21
  export { WebSocketClient } from "./websocket-client";
26
22
  export { LruCache } from "./lruCache";
27
23
  export { SimpleCache } from "./simple-cache";
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.14.14",
2
+ "version": "0.14.15",
3
3
  "name": "modality-kit",
4
4
  "repository": {
5
5
  "type": "git",
@@ -12,8 +12,7 @@
12
12
  "license": "ISC",
13
13
  "devDependencies": {
14
14
  "@modelcontextprotocol/sdk": "^1.24.2",
15
- "@types/bun": "^1.2.23",
16
- "typescript": "^5.9.2",
15
+ "modality-bun-kit": "^0.0.1",
17
16
  "zod": "^3.25.76"
18
17
  },
19
18
  "exports": {
@@ -25,7 +24,6 @@
25
24
  "main": "./dist/index.js",
26
25
  "module": "./dist/index.js",
27
26
  "scripts": {
28
- "update-compile-sh": "yo reshow:compile-sh",
29
27
  "build:clean": "find ./dist -name '*.*' | xargs rm -rf",
30
28
  "build:types": "bun tsc -p ./",
31
29
  "build:src": "bun build src/index.ts --outdir dist",
@@ -1,85 +0,0 @@
1
- /**
2
- * Timer Mock Utilities
3
- *
4
- * These utilities provide centralized timer mocking for tests that need to control time.
5
- * This ensures consistent behavior across all tests that use setTimeout, setInterval, etc.
6
- */
7
- /**
8
- * Centralized timer mock manager for controlling time in tests
9
- *
10
- * Features:
11
- * - Mock setTimeout with virtual clock advancement
12
- * - Mock Math.random for deterministic jitter elimination
13
- * - Track virtual time progression
14
- * - Immediate callback execution for fast tests
15
- *
16
- * Usage:
17
- * ```typescript
18
- * import { TimerMockManager } from "../util_tests/TimerMockManager.js";
19
- *
20
- * let timerMock: TimerMockManager;
21
- *
22
- * beforeEach(() => {
23
- * timerMock = new TimerMockManager();
24
- * timerMock.setup();
25
- * });
26
- *
27
- * afterEach(() => {
28
- * timerMock.restore();
29
- * });
30
- * ```
31
- */
32
- export declare class TimerMockManager {
33
- private originalSetTimeout?;
34
- private originalClearTimeout?;
35
- private originalMathRandom?;
36
- private mockSetTimeout?;
37
- private mockClearTimeout?;
38
- private activeTimers;
39
- private timerIdCounter;
40
- private virtualClock;
41
- private isDestroyed;
42
- private suppressTimeouts;
43
- /**
44
- * Setup timer mocks
45
- * @param executeImmediately - Whether to execute callbacks immediately (default: true for fast tests)
46
- * @param mockRandomValue - Fixed value for Math.random (default: 0 to eliminate jitter)
47
- */
48
- setup(executeImmediately?: boolean, mockRandomValue?: number): void;
49
- /**
50
- * Restore original timer functions
51
- */
52
- restore(): void;
53
- /**
54
- * Get the current virtual clock time
55
- */
56
- getVirtualClock(): number;
57
- /**
58
- * Reset virtual clock to zero
59
- */
60
- resetClock(): void;
61
- /**
62
- * Get the mock setTimeout function for assertions
63
- */
64
- getMockSetTimeout(): any;
65
- /**
66
- * Clear all active timers
67
- */
68
- clearAllActiveTimers(): void;
69
- /**
70
- * Get the number of active timers
71
- */
72
- getActiveTimerCount(): number;
73
- /**
74
- * Suppress timeout execution temporarily
75
- */
76
- suppressTimeoutExecution(): void;
77
- /**
78
- * Resume timeout execution
79
- */
80
- resumeTimeoutExecution(): void;
81
- /**
82
- * Verify that setTimeout was called with expected parameters
83
- */
84
- expectSetTimeoutCalled(times: number, delay?: number): void;
85
- }
@@ -1,49 +0,0 @@
1
- /**
2
- * Console Mock Utility
3
- *
4
- * Provides utilities for mocking console output during testing to keep test output clean.
5
- * Can be used across multiple test files for consistent console mocking.
6
- */
7
- export declare class ConsoleMock {
8
- private originalMethods;
9
- private isMocked;
10
- /**
11
- * Mock all console methods to prevent output during tests
12
- */
13
- mock(): void;
14
- /**
15
- * Restore original console methods
16
- */
17
- restore(): void;
18
- /**
19
- * Check if console is currently mocked
20
- */
21
- get isActive(): boolean;
22
- /**
23
- * Temporarily restore console methods for debugging purposes
24
- * Returns a function to re-mock console methods
25
- */
26
- temporaryRestore(): () => void;
27
- }
28
- export declare const consoleMock: ConsoleMock;
29
- /**
30
- * Convenience functions for common usage patterns
31
- */
32
- /**
33
- * Setup console mocking for a test suite (use in beforeAll)
34
- */
35
- export declare function setupConsoleMock(): void;
36
- /**
37
- * Cleanup console mocking for a test suite (use in afterAll)
38
- */
39
- export declare function cleanupConsoleMock(): void;
40
- /**
41
- * Higher-order function to run a function with console temporarily restored
42
- * Useful for debugging specific tests
43
- */
44
- export declare function withConsole<T>(fn: () => T): T;
45
- /**
46
- * Higher-order function to run an async function with console temporarily restored
47
- * Useful for debugging specific async tests
48
- */
49
- export declare function withConsoleAsync<T>(fn: () => Promise<T>): Promise<T>;
@@ -1 +0,0 @@
1
- export declare const isTestEnvironment: boolean;