chore: formatting updates

This commit is contained in:
James George
2026-07-30 17:15:31 +05:30
parent c52d5da3fd
commit 1855faabbc
12 changed files with 64 additions and 71 deletions
@@ -25,7 +25,11 @@ import {
import { getSettingSubject, settingsStore } from "~/newstore/settings"
import { getSyncInitFunction, StoreSyncDefinitionOf } from ".."
import { createMapper } from "../mapper"
import { applyDuplicatedCollectionResult, moveOrReorderRequests, ensurePathSynced } from "./sync"
import {
applyDuplicatedCollectionResult,
moveOrReorderRequests,
ensurePathSynced,
} from "./sync"
import { ReqType } from "~/helpers/backend/graphql"
import { stripClientLocalValuesForWire } from "~/helpers/clientLocalVariables"
@@ -385,7 +385,10 @@ async function loadUserCollections(collectionType: "REST" | "GQL") {
? restCollectionStore.value.state
: graphqlCollectionStore.value.state
const mergedCollections = mergeCollections(localCollections, fetchedCollections)
const mergedCollections = mergeCollections(
localCollections,
fetchedCollections
)
runDispatchWithOutSyncing(() => {
collectionType == "REST"
@@ -435,7 +435,10 @@ export async function ensurePathSynced(
if (path === null || path === undefined || path === "") return true
const collections = collectionStore.value.state
const pathIndexes = typeof path === "number" ? [path] : path.split("/").map((index) => parseInt(index))
const pathIndexes =
typeof path === "number"
? [path]
: path.split("/").map((index) => parseInt(index))
let highestUnsyncedPath: number[] | null = null
let parentID: string | undefined = undefined
@@ -454,14 +457,20 @@ export async function ensurePathSynced(
}
if (highestUnsyncedPath) {
const collectionToSync = navigateToFolderWithIndexPath(collections, highestUnsyncedPath)
const collectionToSync = navigateToFolderWithIndexPath(
collections,
highestUnsyncedPath
)
if (collectionToSync) {
await recursivelySyncFn(
collectionToSync,
highestUnsyncedPath.join("/"),
parentID
)
const targetCollection = navigateToFolderWithIndexPath(collections, pathIndexes)
const targetCollection = navigateToFolderWithIndexPath(
collections,
pathIndexes
)
return !!targetCollection?.id
}
}
@@ -652,12 +661,13 @@ export const storeSyncDefinition: StoreSyncDefinitionOf<
collections,
newSourcePath.split("/").map((index) => parseInt(index))
)
const destCollection = destinationPath && newDestinationPath
? navigateToFolderWithIndexPath(
collections,
newDestinationPath.split("/").map((index) => parseInt(index))
)
: null
const destCollection =
destinationPath && newDestinationPath
? navigateToFolderWithIndexPath(
collections,
newDestinationPath.split("/").map((index) => parseInt(index))
)
: null
const wasSourceSynced = !!sourceCollection?.id
const wasDestSynced = destinationPath ? !!destCollection?.id : true
@@ -87,7 +87,7 @@ function setupSubscriptions() {
}
function mergeHistoryEntries<
T extends { id?: string; updatedOn?: Date | string | null }
T extends { id?: string; updatedOn?: Date | string | null },
>(local: T[], fetched: T[]): T[] {
const fetchedMap = new Map<string, T>()
for (const entry of fetched) {
@@ -880,9 +880,14 @@ describe("PersistenceService", () => {
// 3. Malformed stringified responseMeta (non-numeric duration/statusCode) should fail and fall back to catch values
const entryWithMalformedStr = {
...REST_HISTORY_MOCK[0],
responseMeta: JSON.stringify({ duration: "invalid", statusCode: 200 }),
responseMeta: JSON.stringify({
duration: "invalid",
statusCode: 200,
}),
}
const parseResult = REST_HISTORY_ENTRY_SCHEMA.safeParse(entryWithMalformedStr)
const parseResult = REST_HISTORY_ENTRY_SCHEMA.safeParse(
entryWithMalformedStr
)
expect(parseResult.success).toBe(true)
expect(parseResult.data?.responseMeta).toEqual({
duration: null,
@@ -541,7 +541,10 @@ export class PersistenceService extends Service {
const translatedData = result.data.map(translateToNewRESTHistory)
setRESTHistoryEntries(translatedData)
} else {
console.error(`Failed parsing persisted REST_HISTORY:`, result.error.message)
console.error(
`Failed parsing persisted REST_HISTORY:`,
result.error.message
)
this.showErrorToast(STORE_KEYS.REST_HISTORY)
await Store.set(
STORE_NAMESPACE,
+2 -6
View File
@@ -24,14 +24,10 @@ export type OpenExternalLinkOptions = {
}
export type SaveFileResponse =
| { type: "unknown" }
| { type: "cancelled" }
| { type: "saved"; path: string }
{ type: "unknown" } | { type: "cancelled" } | { type: "saved"; path: string }
export type OpenExternalLinkResponse =
| { type: "unknown" }
| { type: "cancelled" }
| { type: "opened" }
{ type: "unknown" } | { type: "cancelled" } | { type: "opened" }
export interface IoV1 {
saveFileWithDialog: (
@@ -21,8 +21,7 @@ const FLUSH_INTERVAL_MS = 500
// lazy-loaded Tauri invoke. loaded once, shared across all instances
let invoke:
| (<T>(cmd: string, args?: Record<string, unknown>) => Promise<T>)
| null = null
(<T>(cmd: string, args?: Record<string, unknown>) => Promise<T>) | null = null
let invokePromise: Promise<void> | null = null
const ensureInvoke = async () => {
+3 -19
View File
@@ -209,12 +209,7 @@ export interface RelayRequestEvents {
}
stateChange: {
state:
| "preparing"
| "connecting"
| "sending"
| "waiting"
| "receiving"
| "done"
"preparing" | "connecting" | "sending" | "waiting" | "receiving" | "done"
}
authChallenge: {
type: "basic" | "digest" | "oauth2"
@@ -272,14 +267,7 @@ export type ContentCapability =
| "compression"
export type AuthCapability =
| "none"
| "basic"
| "bearer"
| "digest"
| "oauth2"
| "apikey"
| "aws"
| "mtls"
"none" | "basic" | "bearer" | "digest" | "oauth2" | "apikey" | "aws" | "mtls"
export type SecurityCapability =
| "clientcertificates"
@@ -289,11 +277,7 @@ export type SecurityCapability =
| "peerverification"
export type ProxyCapability =
| "http"
| "https"
| "socks"
| "authentication"
| "certificates"
"http" | "https" | "socks" | "authentication" | "certificates"
export type AdvancedCapability =
| "retry"
@@ -55,9 +55,7 @@ const DeviceTokenResponse = z.object({
})
type FlowStates =
| { type: "loading" }
| { type: "waiting"; openURL: string }
| { type: "error" }
{ type: "loading" } | { type: "waiting"; openURL: string } | { type: "error" }
const authFlowState = ref<FlowStates>({ type: "loading" })
const copyIcon = refAutoReset(IconLink, 1000)
@@ -16,8 +16,7 @@ let cachedStorePath: string | undefined
// For more context, take a look at how `hoppscotch-kernel/.../store/v1/` works
// and how the `web` mode store kernel ignores the first file directory input.
let invoke:
| (<T>(cmd: string, args?: Record<string, unknown>) => Promise<T>)
| undefined
(<T>(cmd: string, args?: Record<string, unknown>) => Promise<T>) | undefined
let join: ((...paths: string[]) => Promise<string>) | undefined
// Single init promise to avoid multiple imports and race conditions
@@ -1124,12 +1124,10 @@ export class DesktopInstanceService
TE.chainFirst(() =>
this.removeFromRecentInstancesTE(instance.serverUrl)
),
TE.map(
(): OperationResult => ({
success: true,
message: `Successfully removed ${instance.displayName}`,
})
)
TE.map((): OperationResult => ({
success: true,
message: `Successfully removed ${instance.displayName}`,
}))
)
)
)
@@ -1148,12 +1146,10 @@ export class DesktopInstanceService
const instancesToKeep = vendoredInstance ? [vendoredInstance] : []
return this.setRecentInstances(instancesToKeep)
}),
TE.map(
(): OperationResult => ({
success: true,
message: "Cache cleared successfully",
})
)
TE.map((): OperationResult => ({
success: true,
message: "Cache cleared successfully",
}))
)
}
@@ -1230,12 +1226,10 @@ export class DesktopInstanceService
pipe(
this.createOrGetInstanceTE(normalizedUrl, instanceKind, displayName),
TE.chain((instance) => this.loadInstanceTE(instance, options)),
TE.map(
(): OperationResult => ({
success: true,
message: `Successfully connected to ${displayName || serverUrl}`,
})
)
TE.map((): OperationResult => ({
success: true,
message: `Successfully connected to ${displayName || serverUrl}`,
}))
)
)
)
@@ -1294,12 +1288,10 @@ export class DesktopInstanceService
return pipe(
this.performCloseTE(),
TE.chain((response) => this.validateCloseResponseTE(response)),
TE.map(
(): OperationResult => ({
success: true,
message: "Disconnected successfully",
})
),
TE.map((): OperationResult => ({
success: true,
message: "Disconnected successfully",
})),
TE.orElse((error) => {
if (error.includes("Cannot close main window")) {
console.log(