Linting fixes.
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -11,11 +11,11 @@ export interface ActiveBodyshopQueryResult {
|
|||||||
}>;
|
}>;
|
||||||
}
|
}
|
||||||
// No variables needed for this query
|
// No variables needed for this query
|
||||||
interface ActiveBodyshopQueryVariables {}
|
|
||||||
// Transform the string query into a TypedQueryDocumentNode
|
// Transform the string query into a TypedQueryDocumentNode
|
||||||
export const QUERY_ACTIVE_BODYSHOP_TYPED: TypedQueryDocumentNode<
|
export const QUERY_ACTIVE_BODYSHOP_TYPED: TypedQueryDocumentNode<
|
||||||
ActiveBodyshopQueryResult,
|
ActiveBodyshopQueryResult,
|
||||||
ActiveBodyshopQueryVariables
|
Record<never, never>
|
||||||
> = parse(gql`
|
> = parse(gql`
|
||||||
query QUERY_ACTIVE_BODYSHOP {
|
query QUERY_ACTIVE_BODYSHOP {
|
||||||
bodyshops(where: { associations: { active: { _eq: true } } }) {
|
bodyshops(where: { associations: { active: { _eq: true } } }) {
|
||||||
@@ -24,10 +24,7 @@ export const QUERY_ACTIVE_BODYSHOP_TYPED: TypedQueryDocumentNode<
|
|||||||
region_config
|
region_config
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`) as TypedQueryDocumentNode<
|
`) as TypedQueryDocumentNode<ActiveBodyshopQueryResult, Record<never, never>>;
|
||||||
ActiveBodyshopQueryResult,
|
|
||||||
ActiveBodyshopQueryVariables
|
|
||||||
>;
|
|
||||||
|
|
||||||
export interface MasterdataQueryResult {
|
export interface MasterdataQueryResult {
|
||||||
masterdata: Array<{
|
masterdata: Array<{
|
||||||
|
|||||||
@@ -2,15 +2,17 @@ import cors from "cors";
|
|||||||
import { app } from "electron";
|
import { app } from "electron";
|
||||||
import log from "electron-log/main";
|
import log from "electron-log/main";
|
||||||
import express from "express";
|
import express from "express";
|
||||||
import { handleQuickBookRequest } from "../quickbooks-desktop/quickbooks-desktop";
|
import http from "http";
|
||||||
import errorTypeCheck from "../../util/errorTypeCheck";
|
import errorTypeCheck from "../../util/errorTypeCheck";
|
||||||
|
import { handleQuickBookRequest } from "../quickbooks-desktop/quickbooks-desktop";
|
||||||
|
|
||||||
export default class LocalServer {
|
export default class LocalServer {
|
||||||
private app: express.Application;
|
private app: express.Application;
|
||||||
private server: any;
|
private server: http.Server | null;
|
||||||
private PORT = 1337;
|
private PORT = 1337;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
|
this.server = null;
|
||||||
this.app = express();
|
this.app = express();
|
||||||
this.configureMiddleware();
|
this.configureMiddleware();
|
||||||
this.configureRoutes();
|
this.configureRoutes();
|
||||||
@@ -96,10 +98,10 @@ export default class LocalServer {
|
|||||||
|
|
||||||
private configureRoutes(): void {
|
private configureRoutes(): void {
|
||||||
// Basic health check endpoint
|
// Basic health check endpoint
|
||||||
this.app.get("/health", (req: express.Request, res: express.Response) => {
|
this.app.get("/health", (_req: express.Request, res: express.Response) => {
|
||||||
res.status(200).json({ status: "ok" });
|
res.status(200).json({ status: "ok" });
|
||||||
});
|
});
|
||||||
this.app.post("/ping", (req, res) => {
|
this.app.post("/ping", (_req, res) => {
|
||||||
res.status(200).json({
|
res.status(200).json({
|
||||||
appVer: app.getVersion(),
|
appVer: app.getVersion(),
|
||||||
qbPath: app.getPath("userData"), //TODO: Resolve to actual QB file path.
|
qbPath: app.getPath("userData"), //TODO: Resolve to actual QB file path.
|
||||||
@@ -112,9 +114,11 @@ export default class LocalServer {
|
|||||||
|
|
||||||
public start(): void {
|
public start(): void {
|
||||||
try {
|
try {
|
||||||
this.server = this.app.listen(this.PORT, (error: Error) => {
|
this.server = this.app.listen(this.PORT, (error: Error | undefined) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
log.error(`[HTTP Server] Error starting server: ${error}`);
|
log.error(
|
||||||
|
`[HTTP Server] Error starting server: ${errorTypeCheck(error)}`,
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
log.info(
|
log.info(
|
||||||
`[HTTP Server] Local HTTP server running on port ${this.PORT}`,
|
`[HTTP Server] Local HTTP server running on port ${this.PORT}`,
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import {
|
|||||||
removeWatcherPath,
|
removeWatcherPath,
|
||||||
StartWatcher,
|
StartWatcher,
|
||||||
StopWatcher,
|
StopWatcher,
|
||||||
watcher,
|
|
||||||
} from "../watcher/watcher";
|
} from "../watcher/watcher";
|
||||||
|
|
||||||
const SettingsWatchedFilePathsAdd = async (): Promise<string[]> => {
|
const SettingsWatchedFilePathsAdd = async (): Promise<string[]> => {
|
||||||
@@ -31,7 +30,7 @@ const SettingsWatchedFilePathsAdd = async (): Promise<string[]> => {
|
|||||||
return Store.get("settings.filepaths");
|
return Store.get("settings.filepaths");
|
||||||
};
|
};
|
||||||
const SettingsWatchedFilePathsRemove = async (
|
const SettingsWatchedFilePathsRemove = async (
|
||||||
event: IpcMainInvokeEvent,
|
_event: IpcMainInvokeEvent,
|
||||||
path: string,
|
path: string,
|
||||||
): Promise<string[]> => {
|
): Promise<string[]> => {
|
||||||
Store.set(
|
Store.set(
|
||||||
@@ -56,7 +55,7 @@ const SettingsWatcherPollingGet = async (): Promise<{
|
|||||||
return { enabled: pollingEnabled.enabled, interval: pollingEnabled.interval };
|
return { enabled: pollingEnabled.enabled, interval: pollingEnabled.interval };
|
||||||
};
|
};
|
||||||
const SettingsWatcherPollingSet = async (
|
const SettingsWatcherPollingSet = async (
|
||||||
event: IpcMainInvokeEvent,
|
_event: IpcMainInvokeEvent,
|
||||||
pollingSettings: {
|
pollingSettings: {
|
||||||
enabled: boolean;
|
enabled: boolean;
|
||||||
interval: number;
|
interval: number;
|
||||||
|
|||||||
@@ -1,14 +1,15 @@
|
|||||||
import log from "electron-log/main";
|
import log from "electron-log/main";
|
||||||
|
|
||||||
import { Request, Response } from "express";
|
|
||||||
import { UUID } from "crypto";
|
import { UUID } from "crypto";
|
||||||
import errorTypeCheck from "../../util/errorTypeCheck";
|
import { Request, Response } from "express";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import store from "../store/store";
|
import errorTypeCheck from "../../util/errorTypeCheck";
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
let Winax: any; // Declare Winax as any to avoid TypeScript errors on non-Windows platforms
|
let Winax: any; // Declare Winax as any to avoid TypeScript errors on non-Windows platforms
|
||||||
|
|
||||||
if (process.platform === "win32") {
|
if (process.platform === "win32") {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
||||||
Winax = require("winax");
|
Winax = require("winax");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,11 +100,11 @@ export function TestQB(): void {
|
|||||||
let requestProcessor, ticket;
|
let requestProcessor, ticket;
|
||||||
try {
|
try {
|
||||||
requestProcessor = new Winax.Object("QBXMLRP.RequestProcessor.1");
|
requestProcessor = new Winax.Object("QBXMLRP.RequestProcessor.1");
|
||||||
const connection = requestProcessor.OpenConnection("", "ShopPartnerOneoFf");
|
requestProcessor.OpenConnection("", "ShopPartnerOneoFf");
|
||||||
|
|
||||||
ticket = requestProcessor.BeginSession("", 2); //2 indicated qbFileOFpenModeDoNotCare
|
ticket = requestProcessor.BeginSession("", 2); //2 indicated qbFileOOpenModeDoNotCare
|
||||||
|
|
||||||
const qbre = requestProcessor.ProcessRequest(
|
requestProcessor.ProcessRequest(
|
||||||
ticket,
|
ticket,
|
||||||
`<?qbxml version="16.0"?>
|
`<?qbxml version="16.0"?>
|
||||||
<QBXML>
|
<QBXML>
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
/* eslint-disable react/prop-types */
|
||||||
|
//TODO: remove eslint-disable
|
||||||
import { Button, Result } from "antd";
|
import { Button, Result } from "antd";
|
||||||
import { FallbackProps } from "react-error-boundary";
|
import { FallbackProps } from "react-error-boundary";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { auth } from "@renderer/util/firebase";
|
import { auth } from "@renderer/util/firebase";
|
||||||
import type { FormProps } from "antd";
|
import type { FormProps } from "antd";
|
||||||
import { Alert, Button, Checkbox, Form, Input } from "antd";
|
import { Alert, Button, Form, Input } from "antd";
|
||||||
import log from "electron-log/renderer";
|
import log from "electron-log/renderer";
|
||||||
import { signInWithEmailAndPassword } from "firebase/auth";
|
import { signInWithEmailAndPassword } from "firebase/auth";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
//Set up all of the IPC handlers.
|
//Set up all of the IPC handlers.
|
||||||
import {
|
import {
|
||||||
selectWatcherPolling,
|
|
||||||
setWatcherPolling,
|
setWatcherPolling,
|
||||||
updateAvailable,
|
updateAvailable,
|
||||||
updateChecking,
|
updateChecking,
|
||||||
@@ -19,40 +18,29 @@ const dispatch = store.dispatch;
|
|||||||
|
|
||||||
ipcRenderer.on(
|
ipcRenderer.on(
|
||||||
ipcTypes.toRenderer.test,
|
ipcTypes.toRenderer.test,
|
||||||
(event: Electron.IpcRendererEvent, arg) => {
|
(_event: Electron.IpcRendererEvent, arg) => {
|
||||||
console.log("Received test message from main process");
|
console.log("Received test message from main process");
|
||||||
console.log(arg);
|
console.log(arg);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
ipcRenderer.on(
|
ipcRenderer.on(ipcTypes.toRenderer.user.getToken, async () => {
|
||||||
ipcTypes.toRenderer.user.getToken,
|
const token = await auth.currentUser?.getIdToken();
|
||||||
async (event: Electron.IpcRendererEvent, arg) => {
|
ipcRenderer.send(ipcTypes.toMain.user.getTokenResponse, token);
|
||||||
const token = await auth.currentUser?.getIdToken();
|
});
|
||||||
ipcRenderer.send(ipcTypes.toMain.user.getTokenResponse, token);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
ipcRenderer.on(
|
ipcRenderer.on(ipcTypes.toRenderer.watcher.started, () => {
|
||||||
ipcTypes.toRenderer.watcher.started,
|
console.log("Watcher has started");
|
||||||
(event: Electron.IpcRendererEvent, arg) => {
|
dispatch(watcherStarted());
|
||||||
console.log("Watcher has started");
|
});
|
||||||
console.log(arg);
|
|
||||||
dispatch(watcherStarted());
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
ipcRenderer.on(
|
ipcRenderer.on(ipcTypes.toRenderer.watcher.stopped, () => {
|
||||||
ipcTypes.toRenderer.watcher.stopped,
|
console.log("Watcher has stopped");
|
||||||
(event: Electron.IpcRendererEvent, arg) => {
|
dispatch(watcherStopped());
|
||||||
console.log("Watcher has stopped");
|
});
|
||||||
console.log(arg);
|
|
||||||
dispatch(watcherStopped());
|
|
||||||
},
|
|
||||||
);
|
|
||||||
ipcRenderer.on(
|
ipcRenderer.on(
|
||||||
ipcTypes.toRenderer.watcher.error,
|
ipcTypes.toRenderer.watcher.error,
|
||||||
(event: Electron.IpcRendererEvent, error: string) => {
|
(_event: Electron.IpcRendererEvent, error: string) => {
|
||||||
console.log("Watcher has encountered an error");
|
console.log("Watcher has encountered an error");
|
||||||
console.log(error);
|
console.log(error);
|
||||||
dispatch(watcherError(error));
|
dispatch(watcherError(error));
|
||||||
@@ -60,33 +48,29 @@ ipcRenderer.on(
|
|||||||
);
|
);
|
||||||
|
|
||||||
//Update Handlers
|
//Update Handlers
|
||||||
ipcRenderer.on(
|
ipcRenderer.on(ipcTypes.toRenderer.updates.checking, () => {
|
||||||
ipcTypes.toRenderer.updates.checking,
|
console.log("Checking for updates...");
|
||||||
(event: Electron.IpcRendererEvent) => {
|
dispatch(updateChecking());
|
||||||
console.log("Checking for updates...");
|
});
|
||||||
dispatch(updateChecking());
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
ipcRenderer.on(
|
ipcRenderer.on(ipcTypes.toRenderer.updates.available, () => {
|
||||||
ipcTypes.toRenderer.updates.available,
|
dispatch(updateAvailable());
|
||||||
(event: Electron.IpcRendererEvent, arg) => {
|
});
|
||||||
dispatch(updateAvailable());
|
|
||||||
},
|
|
||||||
);
|
|
||||||
ipcRenderer.on(
|
ipcRenderer.on(
|
||||||
ipcTypes.toRenderer.updates.downloading,
|
ipcTypes.toRenderer.updates.downloading,
|
||||||
(event: Electron.IpcRendererEvent, arg) => {
|
(_event: Electron.IpcRendererEvent, arg) => {
|
||||||
dispatch(updateProgress({ progress: arg.progress, speed: arg.speed }));
|
dispatch(updateProgress({ progress: arg.progress, speed: arg.speed }));
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
ipcRenderer.on(ipcTypes.toRenderer.updates.downloaded, () => {
|
||||||
|
dispatch(updateDownloaded());
|
||||||
|
});
|
||||||
|
|
||||||
ipcRenderer.on(
|
ipcRenderer.on(
|
||||||
ipcTypes.toRenderer.updates.downloaded,
|
ipcTypes.toRenderer.watcher.polling,
|
||||||
(event: Electron.IpcRendererEvent, arg) => {
|
(_event: Electron.IpcRendererEvent, arg) => {
|
||||||
dispatch(updateDownloaded());
|
dispatch(
|
||||||
|
setWatcherPolling({ enabled: arg.enabled, interval: arg.interval }),
|
||||||
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
ipcRenderer.on(ipcTypes.toRenderer.watcher.polling, (event, arg) => {
|
|
||||||
dispatch(setWatcherPolling({ enabled: arg.enabled, interval: arg.interval }));
|
|
||||||
});
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// eslint-disable-all
|
||||||
import { createContext, useContext } from "react";
|
import { createContext, useContext } from "react";
|
||||||
import { notification } from "antd";
|
import { notification } from "antd";
|
||||||
|
|
||||||
@@ -10,6 +11,7 @@ const NotificationContext = createContext(null);
|
|||||||
/**
|
/**
|
||||||
* A custom hook to make usage easier in child components.
|
* A custom hook to make usage easier in child components.
|
||||||
*/
|
*/
|
||||||
|
// eslint-disable-next-line react-refresh/only-export-components, @typescript-eslint/explicit-function-return-type
|
||||||
export const useNotification = () => {
|
export const useNotification = () => {
|
||||||
return useContext(NotificationContext);
|
return useContext(NotificationContext);
|
||||||
};
|
};
|
||||||
@@ -20,7 +22,14 @@ export const useNotification = () => {
|
|||||||
* - Render contextHolder somewhere high-level in your app (so the notifications mount properly).
|
* - Render contextHolder somewhere high-level in your app (so the notifications mount properly).
|
||||||
* - Provide `api` via the NotificationContext.
|
* - Provide `api` via the NotificationContext.
|
||||||
*/
|
*/
|
||||||
export const NotificationProvider = ({ children }) => {
|
interface NotificationProviderProps {
|
||||||
|
children?: React.ReactNode | React.ReactNode[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export const NotificationProvider: React.FC<NotificationProviderProps> = ({
|
||||||
|
// eslint-disable-next-line react/prop-types
|
||||||
|
children, //TODO: Unable to resolve this. Adding an eslint disable.
|
||||||
|
}) => {
|
||||||
const [api, contextHolder] = notification.useNotification({
|
const [api, contextHolder] = notification.useNotification({
|
||||||
placement: "bottomRight",
|
placement: "bottomRight",
|
||||||
bottom: 70,
|
bottom: 70,
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
/**
|
/**
|
||||||
* Casts specified properties of an object to the desired types
|
* Casts specified properties of an object to the desired types by specifying keys and their corresponding desired type.
|
||||||
*
|
*
|
||||||
* @param obj The object whose properties need to be cast
|
* @param obj The object whose properties need to be cast
|
||||||
* @param typeMappings An object where keys are property names from the source object
|
* @param typeMappings An object where keys are property names from the source object
|
||||||
|
|||||||
Reference in New Issue
Block a user