mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-23 17:18:32 +02:00
Biome tweaks
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
// biome-ignore-all lint/suspicious/noExplicitAny: too flexible for strict types
|
||||
import type { PartialImportResources } from '@yaakapp/api';
|
||||
import { convertId, convertTemplateSyntax, isJSObject } from './common';
|
||||
|
||||
// biome-ignore lint/suspicious/noExplicitAny: none
|
||||
export function convertInsomniaV4(parsed: any) {
|
||||
if (!Array.isArray(parsed.resources)) return null;
|
||||
|
||||
@@ -16,7 +16,6 @@ export function convertInsomniaV4(parsed: any) {
|
||||
|
||||
// Import workspaces
|
||||
const workspacesToImport = parsed.resources.filter(
|
||||
// biome-ignore lint/suspicious/noExplicitAny: none
|
||||
(r: any) => isJSObject(r) && r._type === 'workspace',
|
||||
);
|
||||
for (const w of workspacesToImport) {
|
||||
@@ -29,16 +28,13 @@ export function convertInsomniaV4(parsed: any) {
|
||||
description: w.description || undefined,
|
||||
});
|
||||
const environmentsToImport = parsed.resources.filter(
|
||||
// biome-ignore lint/suspicious/noExplicitAny: none
|
||||
(r: any) => isJSObject(r) && r._type === 'environment',
|
||||
);
|
||||
resources.environments.push(
|
||||
// biome-ignore lint/suspicious/noExplicitAny: none
|
||||
...environmentsToImport.map((r: any) => importEnvironment(r, w._id)),
|
||||
);
|
||||
|
||||
const nextFolder = (parentId: string) => {
|
||||
// biome-ignore lint/suspicious/noExplicitAny: none
|
||||
const children = parsed.resources.filter((r: any) => r.parentId === parentId);
|
||||
for (const child of children) {
|
||||
if (!isJSObject(child)) continue;
|
||||
@@ -67,7 +63,6 @@ export function convertInsomniaV4(parsed: any) {
|
||||
return { resources: convertTemplateSyntax(resources) };
|
||||
}
|
||||
|
||||
// biome-ignore lint/suspicious/noExplicitAny: none
|
||||
function importHttpRequest(r: any, workspaceId: string): PartialImportResources['httpRequests'][0] {
|
||||
let bodyType: string | null = null;
|
||||
let body = {};
|
||||
@@ -77,7 +72,6 @@ function importHttpRequest(r: any, workspaceId: string): PartialImportResources[
|
||||
} else if (r.body?.mimeType === 'application/x-www-form-urlencoded') {
|
||||
bodyType = 'application/x-www-form-urlencoded';
|
||||
body = {
|
||||
// biome-ignore lint/suspicious/noExplicitAny: none
|
||||
form: (r.body.params ?? []).map((p: any) => ({
|
||||
enabled: !p.disabled,
|
||||
name: p.name ?? '',
|
||||
@@ -87,7 +81,6 @@ function importHttpRequest(r: any, workspaceId: string): PartialImportResources[
|
||||
} else if (r.body?.mimeType === 'multipart/form-data') {
|
||||
bodyType = 'multipart/form-data';
|
||||
body = {
|
||||
// biome-ignore lint/suspicious/noExplicitAny: none
|
||||
form: (r.body.params ?? []).map((p: any) => ({
|
||||
enabled: !p.disabled,
|
||||
name: p.name ?? '',
|
||||
@@ -129,7 +122,6 @@ function importHttpRequest(r: any, workspaceId: string): PartialImportResources[
|
||||
name: r.name,
|
||||
description: r.description || undefined,
|
||||
url: r.url,
|
||||
// biome-ignore lint/suspicious/noExplicitAny: none
|
||||
urlParameters: (r.parameters ?? []).map((p: any) => ({
|
||||
enabled: !p.disabled,
|
||||
name: p.name ?? '',
|
||||
@@ -141,20 +133,16 @@ function importHttpRequest(r: any, workspaceId: string): PartialImportResources[
|
||||
authenticationType,
|
||||
method: r.method,
|
||||
headers: (r.headers ?? [])
|
||||
// biome-ignore lint/suspicious/noExplicitAny: none
|
||||
.map((h: any) => ({
|
||||
enabled: !h.disabled,
|
||||
name: h.name ?? '',
|
||||
value: h.value ?? '',
|
||||
}))
|
||||
// biome-ignore lint/suspicious/noExplicitAny: none
|
||||
.filter(({ name, value }: any) => name !== '' || value !== ''),
|
||||
};
|
||||
}
|
||||
|
||||
// biome-ignore lint/suspicious/noExplicitAny: none
|
||||
function importGrpcRequest(r: any, workspaceId: string): PartialImportResources['grpcRequests'][0] {
|
||||
// biome-ignore lint/suspicious/noExplicitAny: none
|
||||
const parts = r.protoMethodName.split('/').filter((p: any) => p !== '');
|
||||
const service = parts[0] ?? null;
|
||||
const method = parts[1] ?? null;
|
||||
@@ -174,18 +162,15 @@ function importGrpcRequest(r: any, workspaceId: string): PartialImportResources[
|
||||
method,
|
||||
message: r.body?.text ?? '',
|
||||
metadata: (r.metadata ?? [])
|
||||
// biome-ignore lint/suspicious/noExplicitAny: none
|
||||
.map((h: any) => ({
|
||||
enabled: !h.disabled,
|
||||
name: h.name ?? '',
|
||||
value: h.value ?? '',
|
||||
}))
|
||||
// biome-ignore lint/suspicious/noExplicitAny: none
|
||||
.filter(({ name, value }: any) => name !== '' || value !== ''),
|
||||
};
|
||||
}
|
||||
|
||||
// biome-ignore lint/suspicious/noExplicitAny: none
|
||||
function importFolder(f: any, workspaceId: string): PartialImportResources['folders'][0] {
|
||||
return {
|
||||
id: convertId(f._id),
|
||||
@@ -200,7 +185,6 @@ function importFolder(f: any, workspaceId: string): PartialImportResources['fold
|
||||
}
|
||||
|
||||
function importEnvironment(
|
||||
// biome-ignore lint/suspicious/noExplicitAny: none
|
||||
e: any,
|
||||
workspaceId: string,
|
||||
isParentOg?: boolean,
|
||||
|
||||
Reference in New Issue
Block a user