diff --git a/src/apps/cli/adapters/NodeVaultAdapter.ts b/src/apps/cli/adapters/NodeVaultAdapter.ts index e313f39..99e8d93 100644 --- a/src/apps/cli/adapters/NodeVaultAdapter.ts +++ b/src/apps/cli/adapters/NodeVaultAdapter.ts @@ -2,7 +2,7 @@ import * as fs from "fs/promises"; import * as path from "path"; import type { UXDataWriteOptions } from "@lib/common/types"; import type { IVaultAdapter } from "@lib/serviceModules/adapters"; -import type { NodeFile, NodeFolder, NodeStat } from "./NodeTypes"; +import type { NodeFile, NodeFolder } from "./NodeTypes"; /** * Vault adapter implementation for Node.js diff --git a/src/apps/cli/testdeno/bench-couchdb.ts b/src/apps/cli/testdeno/bench-couchdb.ts index f419697..6ed6df7 100644 --- a/src/apps/cli/testdeno/bench-couchdb.ts +++ b/src/apps/cli/testdeno/bench-couchdb.ts @@ -3,7 +3,6 @@ import { applyRemoteSyncSettings, initSettingsFile } from "./helpers/settings.ts import { assertFilesEqual, runCliOrFail } from "./helpers/cli.ts"; import { startCouchdb, stopCouchdb } from "./helpers/docker.ts"; import { createDeterministicDataset, type DatasetEntry } from "./helpers/dataset.ts"; -import { compatGlobal } from "@lib/common/coreEnvFunctions.ts"; type BenchmarkConfig = { couchdbBackendUri: string; @@ -138,7 +137,7 @@ function startCouchdbProxy(options: { backendUri: string; proxyUri: string; requ }, }, async (request) => { - await new Promise((resolve) => compatGlobal.setTimeout(resolve, halfDelayMs)); + await new Promise((resolve) => setTimeout(resolve, halfDelayMs)); const targetUrl = new URL(request.url); targetUrl.protocol = backend.protocol; diff --git a/src/apps/cli/testdeno/helpers/backgroundCli.ts b/src/apps/cli/testdeno/helpers/backgroundCli.ts index 52ac46b..f2cbbb4 100644 --- a/src/apps/cli/testdeno/helpers/backgroundCli.ts +++ b/src/apps/cli/testdeno/helpers/backgroundCli.ts @@ -1,6 +1,5 @@ import { CLI_DIR, TEE_ENABLED, formatTeeCommand, createLineTeeWriter } from "./cli.ts"; import { join } from "@std/path"; -import { compatGlobal } from "@lib/common/coreEnvFunctions.ts"; const CLI_DIST = join(CLI_DIR, "dist", "index.cjs"); const VERBOSE_ENABLED = Deno.env.get("LIVESYNC_CLI_VERBOSE") === "1"; @@ -79,7 +78,7 @@ export class BackgroundCliProcess { const status = await Promise.race([ this.child.status.then((s) => ({ type: "status" as const, status: s })), new Promise<{ type: "tick" }>((resolve) => - compatGlobal.setTimeout(() => resolve({ type: "tick" }), 100) + setTimeout(() => resolve({ type: "tick" }), 100) ), ]); if (status.type === "status") { diff --git a/src/apps/cli/testdeno/helpers/cli.ts b/src/apps/cli/testdeno/helpers/cli.ts index aae6b67..c393c26 100644 --- a/src/apps/cli/testdeno/helpers/cli.ts +++ b/src/apps/cli/testdeno/helpers/cli.ts @@ -1,5 +1,4 @@ import { join } from "@std/path"; -import { compatGlobal } from "@lib/common/coreEnvFunctions.ts"; // --------------------------------------------------------------------------- // Path resolution @@ -26,7 +25,7 @@ const VERBOSE_ENABLED = Deno.env.get("LIVESYNC_CLI_VERBOSE") === "1"; const DEBUG_ENABLED = Deno.env.get("LIVESYNC_CLI_DEBUG") === "1"; function sleep(ms: number): Promise { - return new Promise((resolve) => compatGlobal.setTimeout(resolve, ms)); + return new Promise((resolve) => setTimeout(resolve, ms)); } function concatChunks(chunks: Uint8Array[]): Uint8Array { diff --git a/src/apps/cli/testdeno/helpers/docker.ts b/src/apps/cli/testdeno/helpers/docker.ts index 9c5d6bd..3c0e6ce 100644 --- a/src/apps/cli/testdeno/helpers/docker.ts +++ b/src/apps/cli/testdeno/helpers/docker.ts @@ -1,5 +1,3 @@ -import { compatGlobal } from "@lib/common/coreEnvFunctions.ts"; - /** * Docker service management for tests. * @@ -258,7 +256,7 @@ function untrackContainer(container: string): void { } function sleep(ms: number): Promise { - return new Promise((resolve) => compatGlobal.setTimeout(resolve, ms)); + return new Promise((resolve) => setTimeout(resolve, ms)); } async function waitForCouchdbStable(hostname: string, user: string, password: string): Promise { diff --git a/src/apps/cli/testdeno/helpers/net.ts b/src/apps/cli/testdeno/helpers/net.ts index dd8b076..fa5debd 100644 --- a/src/apps/cli/testdeno/helpers/net.ts +++ b/src/apps/cli/testdeno/helpers/net.ts @@ -1,5 +1,3 @@ -import { compatGlobal } from "@lib/common/coreEnvFunctions.ts"; - type WaitForPortOptions = { timeoutMs?: number; intervalMs?: number; @@ -7,7 +5,7 @@ type WaitForPortOptions = { }; function sleep(ms: number): Promise { - return new Promise((resolve) => compatGlobal.setTimeout(resolve, ms)); + return new Promise((resolve) => setTimeout(resolve, ms)); } async function connectWithTimeout(hostname: string, port: number, timeoutMs: number): Promise { @@ -15,13 +13,13 @@ async function connectWithTimeout(hostname: string, port: number, timeoutMs: num try { const connPromise = Deno.connect({ hostname, port }); const timeoutPromise = new Promise((_, reject) => { - timer = compatGlobal.setTimeout(() => reject(new Error(`connect timeout after ${timeoutMs}ms`)), timeoutMs); + timer = setTimeout(() => reject(new Error(`connect timeout after ${timeoutMs}ms`)), timeoutMs); }); const conn = await Promise.race([connPromise, timeoutPromise]); conn.close(); } finally { if (timer !== undefined) { - compatGlobal.clearTimeout(timer); + clearTimeout(timer); } } } diff --git a/src/apps/cli/testdeno/helpers/p2p.ts b/src/apps/cli/testdeno/helpers/p2p.ts index 98d8603..a04b080 100644 --- a/src/apps/cli/testdeno/helpers/p2p.ts +++ b/src/apps/cli/testdeno/helpers/p2p.ts @@ -1,7 +1,6 @@ import { runCli } from "./cli.ts"; import { isLocalP2pRelay, startP2pRelay, stopP2pRelay, startCoturn, stopCoturn } from "./docker.ts"; import { waitForPort } from "./net.ts"; -import { compatGlobal } from "@lib/common/coreEnvFunctions.ts"; export type PeerEntry = { id: string; @@ -9,7 +8,7 @@ export type PeerEntry = { }; function sleep(ms: number): Promise { - return new Promise((resolve) => compatGlobal.setTimeout(resolve, ms)); + return new Promise((resolve) => setTimeout(resolve, ms)); } function parseRelayEndpoint(relay: string): { hostname: string; port: number } { diff --git a/src/apps/cli/testdeno/test-setup-put-cat.ts b/src/apps/cli/testdeno/test-setup-put-cat.ts index f2a7696..e1d99c9 100644 --- a/src/apps/cli/testdeno/test-setup-put-cat.ts +++ b/src/apps/cli/testdeno/test-setup-put-cat.ts @@ -132,7 +132,7 @@ Deno.test("CLI file operations: push / cat / ls / info / rm / resolve / cat-rev assertEquals(data.path, REMOTE_PATH, "info .path mismatch"); assertEquals(data.filename, REMOTE_PATH.split("/").at(-1), "info .filename mismatch"); assert(typeof data.size === "number" && data.size >= 0, `info .size invalid: ${data.size}`); - assert(typeof data.chunks === "number" && (data.chunks as number) >= 1, `info .chunks invalid: ${data.chunks}`); + assert(typeof data.chunks === "number" && (data.chunks) >= 1, `info .chunks invalid: ${data.chunks}`); assertEquals(data.conflicts, "N/A", "info .conflicts should be N/A"); console.log("[PASS] info output format matched"); }); diff --git a/src/apps/cli/testdeno/test-sync-two-local-databases.ts b/src/apps/cli/testdeno/test-sync-two-local-databases.ts index 422d5d0..5717d40 100644 --- a/src/apps/cli/testdeno/test-sync-two-local-databases.ts +++ b/src/apps/cli/testdeno/test-sync-two-local-databases.ts @@ -28,7 +28,6 @@ import { TempDir } from "./helpers/temp.ts"; import { runCliOrFail, jsonFieldIsNa } from "./helpers/cli.ts"; import { applyCouchdbSettings, initSettingsFile } from "./helpers/settings.ts"; import { startCouchdb, stopCouchdb } from "./helpers/docker.ts"; -import { compatGlobal } from "@lib/common/coreEnvFunctions.ts"; // --------------------------------------------------------------------------- // Load configuration @@ -110,7 +109,7 @@ async function runSuite( config: { uri: string; user: string; password: string }, dbname: string ): Promise { - const sleep = (ms: number) => new Promise((resolve) => compatGlobal.setTimeout(resolve, ms)); + const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)); const runWithRetry = async (label: string, fn: () => Promise, retries = SYNC_RETRY): Promise => { let lastErr: unknown; for (let i = 0; i <= retries; i++) {