From db1347a99bc3c3f6f85dd67fdb4364b0086f7f2c Mon Sep 17 00:00:00 2001
From: Dennis Collaris <d.collaris@me.com>
Date: Mon, 24 Mar 2025 17:13:09 +0100
Subject: [PATCH] refactor: vscode problems (auto formatter)

---
 index.ts                                      |  2 +-
 src/index.ts                                  |  4 ++--
 src/readers/diffCheck.ts                      |  5 ++--
 src/readers/insightProcessor.ts               | 16 ++++++-------
 src/readers/queryService.ts                   | 14 +++++------
 src/utils/cypher/converter/logic.ts           |  5 ++--
 .../cypher/converter/queryConverter.test.ts   |  4 ++--
 src/utils/cypher/converter/queryConverter.ts  |  3 +--
 src/utils/cypher/converter/relation.ts        |  3 +--
 src/utils/cypher/queryParser.ts               | 12 ++++------
 src/utils/hashing.ts                          | 24 +++++++++----------
 src/utils/insights.ts                         |  2 +-
 src/utils/lexical.ts                          |  8 +++----
 src/utils/queryPublisher.ts                   |  4 ++--
 src/utils/reactflow/query2backend.ts          |  8 +++----
 src/variables.ts                              |  2 +-
 16 files changed, 54 insertions(+), 62 deletions(-)

diff --git a/index.ts b/index.ts
index f67b2c6..3f2f3f8 100644
--- a/index.ts
+++ b/index.ts
@@ -1 +1 @@
-console.log("Hello via Bun!");
\ No newline at end of file
+console.log('Hello via Bun!');
diff --git a/src/index.ts b/src/index.ts
index 15b50d0..eacb136 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -1,8 +1,8 @@
 import { RabbitMqBroker } from 'ts-common/rabbitMq';
-import { rabbitMq, redis } from './variables';
 import { log } from './logger';
-import { queryServiceReader } from './readers/queryService';
 import { insightProcessor } from './readers/insightProcessor';
+import { queryServiceReader } from './readers/queryService';
+import { rabbitMq, redis } from './variables';
 
 async function main() {
   log.info('Starting query-service...');
diff --git a/src/readers/diffCheck.ts b/src/readers/diffCheck.ts
index ba3dd09..8206ef6 100644
--- a/src/readers/diffCheck.ts
+++ b/src/readers/diffCheck.ts
@@ -1,9 +1,8 @@
-import type { SaveState } from 'ts-common';
+import type { InsightModel, SaveState } from 'ts-common';
+import type { GraphQueryResultMetaFromBackend } from 'ts-common/src/model/webSocket/graphResult';
 import { log } from '../logger';
 import { hashDictionary, hashIsEqual } from '../utils/hashing';
-import type { GraphQueryResultMetaFromBackend } from 'ts-common/src/model/webSocket/graphResult';
 import { ums } from '../variables';
-import type { InsightModel } from 'ts-common';
 
 export const diffCheck = async (
   insight: InsightModel,
diff --git a/src/readers/insightProcessor.ts b/src/readers/insightProcessor.ts
index d8fdc09..18f43a4 100644
--- a/src/readers/insightProcessor.ts
+++ b/src/readers/insightProcessor.ts
@@ -1,17 +1,17 @@
-import { rabbitMq, ums, mail, SMTP_USER, DEBUG_EMAIL } from '../variables';
-import { log } from '../logger';
-import { type InsightModel } from 'ts-common';
 import { createHeadlessEditor } from '@lexical/headless';
 import { $generateHtmlFromNodes } from '@lexical/html';
 import { JSDOM } from 'jsdom';
-import { Query2BackendQuery } from '../utils/reactflow/query2backend';
+import { type InsightModel } from 'ts-common';
+import { RabbitMqBroker } from 'ts-common/rabbitMq';
+import { log } from '../logger';
 import { query2Cypher } from '../utils/cypher/converter';
+import { populateTemplate } from '../utils/insights';
+import { VariableNode } from '../utils/lexical';
+import { Query2BackendQuery } from '../utils/reactflow/query2backend';
+import { DEBUG_EMAIL, mail, rabbitMq, SMTP_USER, ums } from '../variables';
+import { diffCheck } from './diffCheck';
 import { queryService } from './queryService';
 import { statCheck } from './statCheck';
-import { diffCheck } from './diffCheck';
-import { VariableNode } from '../utils/lexical';
-import { populateTemplate } from '../utils/insights';
-import { RabbitMqBroker } from 'ts-common/rabbitMq';
 
 const dom = new JSDOM();
 function setUpDom() {
diff --git a/src/readers/queryService.ts b/src/readers/queryService.ts
index d2e384f..a083d05 100644
--- a/src/readers/queryService.ts
+++ b/src/readers/queryService.ts
@@ -1,16 +1,16 @@
 import { AbortedError, getGraphStatistics, GPError, graphQueryBackend2graphQuery, type DbConnection, type QueryRequest } from 'ts-common';
 
-import { QUERY_CACHE_DURATION, rabbitMq, redis, ums, type QueryExecutionTypes } from '../variables';
+import { Neo4jError } from 'neo4j-driver';
+import { Neo4jConnection } from 'ts-common/neo4j';
+import { RabbitMqBroker } from 'ts-common/rabbitMq';
+import { formatTimeDifference } from 'ts-common/src/logger/logger';
+import type { GraphQueryCountResultFromBackend, GraphQueryResultMetaFromBackend } from 'ts-common/src/model/webSocket/graphResult';
 import { log } from '../logger';
-import { QueryPublisher } from '../utils/queryPublisher';
 import { query2Cypher } from '../utils/cypher/converter';
 import { parseCountCypherQuery, parseCypherQuery } from '../utils/cypher/queryParser';
-import { formatTimeDifference } from 'ts-common/src/logger/logger';
+import { QueryPublisher } from '../utils/queryPublisher';
 import { Query2BackendQuery } from '../utils/reactflow/query2backend';
-import type { GraphQueryCountResultFromBackend, GraphQueryResultMetaFromBackend } from 'ts-common/src/model/webSocket/graphResult';
-import { RabbitMqBroker } from 'ts-common/rabbitMq';
-import { Neo4jConnection } from 'ts-common/neo4j';
-import { Neo4jError } from 'neo4j-driver';
+import { QUERY_CACHE_DURATION, rabbitMq, redis, ums, type QueryExecutionTypes } from '../variables';
 
 async function cacheCheck<T>(cacheKey: string): Promise<T | undefined> {
   log.debug('Checking cache for query, with cache ttl', QUERY_CACHE_DURATION, 'seconds');
diff --git a/src/utils/cypher/converter/logic.ts b/src/utils/cypher/converter/logic.ts
index 4ef8a20..d1cf770 100644
--- a/src/utils/cypher/converter/logic.ts
+++ b/src/utils/cypher/converter/logic.ts
@@ -1,6 +1,5 @@
-import { StringFilterTypes, type AnyStatement } from 'ts-common/src/model/query/logic/general';
+import { type AnyStatement } from 'ts-common/src/model/query/logic/general';
 import type { QueryCacheData } from './model';
-import { log } from 'ts-common/src/logger/logger';
 
 export function createWhereLogic(
   op: string,
@@ -32,7 +31,7 @@ export function extractLogicCypher(logicQuery: AnyStatement, cacheData: QueryCac
     case 'object':
       if (Array.isArray(logicQuery)) {
         let op = logicQuery[0].replace('_', '').toLowerCase();
-        let right = logicQuery?.[2];
+        const right = logicQuery?.[2];
         const { logic: left, where: whereLogic } = extractLogicCypher(logicQuery[1], cacheData);
 
         switch (op) {
diff --git a/src/utils/cypher/converter/queryConverter.test.ts b/src/utils/cypher/converter/queryConverter.test.ts
index 5227c6c..04f0137 100644
--- a/src/utils/cypher/converter/queryConverter.test.ts
+++ b/src/utils/cypher/converter/queryConverter.test.ts
@@ -1,6 +1,6 @@
-import { query2Cypher } from './queryConverter';
+import { describe, expect, it } from 'bun:test';
 import { StringFilterTypes, type BackendQueryFormat } from 'ts-common';
-import { expect, test, describe, it } from 'bun:test';
+import { query2Cypher } from './queryConverter';
 
 function fixCypherSpaces(cypher?: string | null): string {
   if (!cypher) {
diff --git a/src/utils/cypher/converter/queryConverter.ts b/src/utils/cypher/converter/queryConverter.ts
index b4b2634..12cd918 100644
--- a/src/utils/cypher/converter/queryConverter.ts
+++ b/src/utils/cypher/converter/queryConverter.ts
@@ -4,11 +4,10 @@
 */
 
 import type { BackendQueryFormat } from 'ts-common';
-import { extractLogicCypher } from './logic';
 import { extractExportCypher } from './export';
+import { extractLogicCypher } from './logic';
 import type { QueryCacheData } from './model';
 import { getNodeCypher } from './node';
-import { log } from 'ts-common/src/logger/logger';
 
 export type QueryCypher = {
   query: string;
diff --git a/src/utils/cypher/converter/relation.ts b/src/utils/cypher/converter/relation.ts
index 2912225..e097790 100644
--- a/src/utils/cypher/converter/relation.ts
+++ b/src/utils/cypher/converter/relation.ts
@@ -1,7 +1,6 @@
 import type { RelationStruct } from 'ts-common';
-import { getNodeCypher } from './node';
 import type { QueryCacheData } from './model';
-import { log } from 'ts-common/src/logger/logger';
+import { getNodeCypher } from './node';
 
 export const NoNodeError = new Error('relation must have a node');
 
diff --git a/src/utils/cypher/queryParser.ts b/src/utils/cypher/queryParser.ts
index bb5c9bc..c7f6637 100644
--- a/src/utils/cypher/queryParser.ts
+++ b/src/utils/cypher/queryParser.ts
@@ -1,20 +1,18 @@
 import {
-  Record,
+  Integer,
   Node,
-  Relationship,
   Path,
   PathSegment,
-  isRelationship,
+  Record,
+  Relationship,
   isNode,
   isPath,
   isPathSegment,
-  Integer,
-  isUnboundRelationship,
+  isRelationship,
   type RecordShape,
 } from 'neo4j-driver';
+import type { CountQueryResultFromBackend, EdgeQueryResult, GraphQueryResultFromBackend, NodeAttributes, NodeQueryResult } from 'ts-common';
 import { log } from '../../logger';
-import type { CountQueryResultFromBackend, EdgeQueryResult, NodeAttributes, NodeQueryResult } from 'ts-common';
-import type { GraphQueryResultFromBackend } from 'ts-common';
 
 export function parseCypherQuery(result: RecordShape[], returnType: 'nodelink' | 'table' = 'nodelink'): GraphQueryResultFromBackend {
   try {
diff --git a/src/utils/hashing.ts b/src/utils/hashing.ts
index ea21957..7afb2b0 100644
--- a/src/utils/hashing.ts
+++ b/src/utils/hashing.ts
@@ -1,20 +1,20 @@
 const FNV_OFFSET_BASIS = 2166136261;
 
-export const hashDictionary = (dictionary: Record<"nodes" | "edges", string[]>): string => {
-    // Convert the dictionary into a consistent string format
-    const jsonString = JSON.stringify(dictionary, Object.keys(dictionary).sort());
+export const hashDictionary = (dictionary: Record<'nodes' | 'edges', string[]>): string => {
+  // Convert the dictionary into a consistent string format
+  const jsonString = JSON.stringify(dictionary, Object.keys(dictionary).sort());
 
-    // FNV-1a hash implementation
-    let hash = FNV_OFFSET_BASIS; // FNV offset basis
-    for (let i = 0; i < jsonString.length; i++) {
-        hash ^= jsonString.charCodeAt(i);
-        hash += (hash << 1) + (hash << 4) + (hash << 7) + (hash << 8) + (hash << 24); // FNV prime
-    }
+  // FNV-1a hash implementation
+  let hash = FNV_OFFSET_BASIS; // FNV offset basis
+  for (let i = 0; i < jsonString.length; i++) {
+    hash ^= jsonString.charCodeAt(i);
+    hash += (hash << 1) + (hash << 4) + (hash << 7) + (hash << 8) + (hash << 24); // FNV prime
+  }
 
-    // Convert hash to a hexadecimal string
-    return (hash >>> 0).toString(16); // Ensure unsigned integer representation
+  // Convert hash to a hexadecimal string
+  return (hash >>> 0).toString(16); // Ensure unsigned integer representation
 };
 
 export const hashIsEqual = (hash1: string, hash2: string): boolean => {
-    return hash1 === hash2;
+  return hash1 === hash2;
 };
diff --git a/src/utils/insights.ts b/src/utils/insights.ts
index 7d91960..77dbd36 100644
--- a/src/utils/insights.ts
+++ b/src/utils/insights.ts
@@ -1,7 +1,7 @@
+import 'canvas';
 import { scaleOrdinal, scaleQuantize } from 'd3';
 import { JSDOM } from 'jsdom';
 import svg2img from 'svg2img';
-import 'canvas';
 import { visualizationColors, type GraphQueryResultFromBackend, type GraphQueryResultMetaFromBackend } from 'ts-common';
 
 import { type PlotType } from 'plotly.js';
diff --git a/src/utils/lexical.ts b/src/utils/lexical.ts
index 41acc78..1a9c8e0 100644
--- a/src/utils/lexical.ts
+++ b/src/utils/lexical.ts
@@ -1,7 +1,5 @@
-import type { NodeKey, LexicalEditor, DOMExportOutput, SerializedLexicalNode, Spread, EditorConfig } from 'lexical';
+import type { DOMExportOutput, EditorConfig, LexicalEditor, NodeKey, SerializedLexicalNode, Spread } from 'lexical';
 import { DecoratorNode } from 'lexical';
-import type { GraphQueryResultMetaFromBackend } from 'ts-common/src/model/webSocket';
-
 
 export enum VariableType {
   statistic = 'statistic',
@@ -10,8 +8,8 @@ export enum VariableType {
 
 export type SerializedVariableNode = Spread<
   {
-    name: string,
-    variableType: VariableType
+    name: string;
+    variableType: VariableType;
   },
   SerializedLexicalNode
 >;
diff --git a/src/utils/queryPublisher.ts b/src/utils/queryPublisher.ts
index 94bec42..645b958 100644
--- a/src/utils/queryPublisher.ts
+++ b/src/utils/queryPublisher.ts
@@ -1,11 +1,11 @@
 import { GPError, wsReturnKey, type BackendMessageHeader, type MachineLearning, type ToMLMessage } from 'ts-common';
-import { log } from '../logger';
+import type { RabbitMqBroker } from 'ts-common/rabbitMq';
 import type {
   GraphQueryCountResultFromBackend,
   GraphQueryResultFromBackend,
   GraphQueryResultMetaFromBackend,
 } from 'ts-common/src/model/webSocket/graphResult';
-import type { RabbitMqBroker } from 'ts-common/rabbitMq';
+import { log } from '../logger';
 
 export class QueryPublisher {
   private frontendPublisher: RabbitMqBroker;
diff --git a/src/utils/reactflow/query2backend.ts b/src/utils/reactflow/query2backend.ts
index ef71c5c..02c7ed7 100644
--- a/src/utils/reactflow/query2backend.ts
+++ b/src/utils/reactflow/query2backend.ts
@@ -1,20 +1,20 @@
-import type { SerializedNode } from 'graphology-types';
-import { hasCycle } from 'graphology-dag';
 import Graph from 'graphology';
+import { hasCycle } from 'graphology-dag';
 import { allSimplePaths } from 'graphology-simple-path';
+import type { SerializedNode } from 'graphology-types';
 import type { BackendQueryFormat, NodeStruct, QueryStruct, RelationStruct } from 'ts-common';
 import type { MachineLearning } from 'ts-common/src/model/query/queryRequestModel';
 
 import type {
-  QueryMultiGraph,
   EntityNodeAttributes,
   LogicNodeAttributes,
   QueryGraphNodes,
+  QueryMultiGraph,
   RelationNodeAttributes,
 } from 'ts-common/src/model/graphology';
 import type { AllLogicStatement } from 'ts-common/src/model/query/logic/general';
-import { QueryElementTypes } from 'ts-common/src/model/reactflow';
 import { type QueryBuilderSettings, QueryRelationDirection, QueryUnionType } from 'ts-common/src/model/query/queryBuilderModel';
+import { QueryElementTypes } from 'ts-common/src/model/reactflow';
 import { log } from '../../logger';
 
 // Chunk extraction: traverse graph to find all paths of logic between relations and entities
diff --git a/src/variables.ts b/src/variables.ts
index e7f3f4a..1c54072 100644
--- a/src/variables.ts
+++ b/src/variables.ts
@@ -1,6 +1,6 @@
+import nodemailer from 'nodemailer';
 import { UMSApi } from 'ts-common';
 import { RabbitMqConnection } from 'ts-common/rabbitMq';
-import nodemailer from 'nodemailer';
 import { RedisConnector } from 'ts-common/redis';
 
 export type QueryExecutionTypes = 'neo4j';
-- 
GitLab