From cabc3bb55d6450997e7b9340b02024a143b22258 Mon Sep 17 00:00:00 2001 From: EthanShoeDev <13422990+EthanShoeDev@users.noreply.github.com> Date: Sat, 4 Oct 2025 16:53:08 -0400 Subject: [PATCH] fmt --- apps/mobile/src/lib/logger.ts | 44 +++++++++++++------------- apps/mobile/src/lib/query-fns.ts | 16 +++++----- apps/mobile/src/lib/secrets-manager.ts | 24 ++++++++++---- apps/mobile/src/lib/utils.ts | 3 +- 4 files changed, 48 insertions(+), 39 deletions(-) diff --git a/apps/mobile/src/lib/logger.ts b/apps/mobile/src/lib/logger.ts index 66ef4d7..ee1c9ea 100644 --- a/apps/mobile/src/lib/logger.ts +++ b/apps/mobile/src/lib/logger.ts @@ -1,25 +1,25 @@ -import { logger, consoleTransport } from "react-native-logs"; +import { logger, consoleTransport } from 'react-native-logs'; export const rootLogger = logger.createLogger({ - levels: { - debug: 0, - info: 1, - warn: 2, - error: 3, - }, - severity: "debug", - transport: consoleTransport, - transportOptions: { - colors: { - info: "blueBright", - warn: "yellowBright", - error: "redBright", - }, - }, - async: true, - dateFormat: "time", - printLevel: true, - printDate: true, - fixedExtLvlLength: false, - enabled: true, + levels: { + debug: 0, + info: 1, + warn: 2, + error: 3, + }, + severity: 'debug', + transport: consoleTransport, + transportOptions: { + colors: { + info: 'blueBright', + warn: 'yellowBright', + error: 'redBright', + }, + }, + async: true, + dateFormat: 'time', + printLevel: true, + printDate: true, + fixedExtLvlLength: false, + enabled: true, }); diff --git a/apps/mobile/src/lib/query-fns.ts b/apps/mobile/src/lib/query-fns.ts index 90c2bea..7f91982 100644 --- a/apps/mobile/src/lib/query-fns.ts +++ b/apps/mobile/src/lib/query-fns.ts @@ -22,15 +22,15 @@ export const useSshConnMutation = (opts?: { const security = connectionDetails.security.type === 'password' ? { - type: 'password' as const, - password: connectionDetails.security.password, - } + type: 'password' as const, + password: connectionDetails.security.password, + } : { - type: 'key' as const, - privateKey: await secretsManager.keys.utils - .getPrivateKey(connectionDetails.security.keyId) - .then((e) => e.value), - }; + type: 'key' as const, + privateKey: await secretsManager.keys.utils + .getPrivateKey(connectionDetails.security.keyId) + .then((e) => e.value), + }; const sshConnection = await connect({ host: connectionDetails.host, diff --git a/apps/mobile/src/lib/secrets-manager.ts b/apps/mobile/src/lib/secrets-manager.ts index 5a688a7..4861517 100644 --- a/apps/mobile/src/lib/secrets-manager.ts +++ b/apps/mobile/src/lib/secrets-manager.ts @@ -78,9 +78,9 @@ function makeBetterSecureStore< const unsafedRootManifest: unknown = rawRootManifestString ? JSON.parse(rawRootManifestString) : { - manifestVersion: rootManifestVersion, - manifestChunksIds: [], - }; + manifestVersion: rootManifestVersion, + manifestChunksIds: [], + }; const rootManifest = rootManifestSchema.parse(unsafedRootManifest); const manifestChunks = await Promise.all( rootManifest.manifestChunksIds.map(async (manifestChunkId) => { @@ -202,7 +202,10 @@ function makeBetterSecureStore< (mChunk) => mChunk.manifestChunk.entries.length === 0, ); if (emptyManifestChunks.length > 0) { - logger.debug('removing empty manifest chunks', emptyManifestChunks.length); + logger.debug( + 'removing empty manifest chunks', + emptyManifestChunks.length, + ); manifest.rootManifest.manifestChunksIds = manifest.rootManifest.manifestChunksIds.filter( (mChunkId) => @@ -247,7 +250,10 @@ function makeBetterSecureStore< const existingManifestChunkWithRoom = manifest.manifestChunks.find( (mChunk) => sizeLimit > mChunk.manifestChunkSize + newManifestEntrySize, ); - logger.debug('existingManifestChunkWithRoom', existingManifestChunkWithRoom); + logger.debug( + 'existingManifestChunkWithRoom', + existingManifestChunkWithRoom, + ); const manifestChunkWithRoom = existingManifestChunkWithRoom ?? (await (async () => { @@ -259,7 +265,9 @@ function makeBetterSecureStore< manifestChunkId: Crypto.randomUUID(), manifestChunkSize: 0, } satisfies NonNullable<(typeof manifest.manifestChunks)[number]>; - logger.info(`Adding new manifest chunk ${newManifestChunk.manifestChunkId}`); + logger.info( + `Adding new manifest chunk ${newManifestChunk.manifestChunkId}`, + ); manifest.rootManifest.manifestChunksIds.push( newManifestChunk.manifestChunkId, ); @@ -336,7 +344,9 @@ async function upsertPrivateKey(params: { throw new Error('Invalid private key', { cause: validateKeyResult.error }); } const keyId = params.keyId ?? `key_${Crypto.randomUUID()}`; - logger.info(`${params.keyId ? 'Upserting' : 'Creating'} private key ${keyId}`); + logger.info( + `${params.keyId ? 'Upserting' : 'Creating'} private key ${keyId}`, + ); // Preserve createdAtMs if the entry already exists const existing = await betterKeyStorage .getEntry(keyId) diff --git a/apps/mobile/src/lib/utils.ts b/apps/mobile/src/lib/utils.ts index 2d0abea..468b41e 100644 --- a/apps/mobile/src/lib/utils.ts +++ b/apps/mobile/src/lib/utils.ts @@ -15,11 +15,10 @@ export const AbortSignalTimeout = (timeout: number) => { return controller.signal; }; - export const useContextSafe = (context: Context) => { const contextValue = use(context); if (!contextValue) { throw new Error('Context not found'); } return contextValue; -}; \ No newline at end of file +};