mirror of
				https://github.com/Fabio286/antares.git
				synced 2025-06-05 21:59:22 +02:00 
			
		
		
		
	refactor: use Record to type objects
This commit is contained in:
		
							
								
								
									
										12
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								README.md
									
									
									
									
									
								
							| @@ -71,17 +71,6 @@ On macOS you can run `.dmg` distribution following [this guide](https://support. | |||||||
| [<img height='56' alt='Download on Flathub' src='https://dl.flathub.org/assets/badges/flathub-badge-en.svg'/>](https://flathub.org/apps/it.fabiodistasio.AntaresSQL) [](https://snapcraft.io/antares) [](https://aur.archlinux.org/packages/antares-sql-bin) [<img src="https://developer.microsoft.com/store/badges/images/English_get-it-from-MS.png" style="height: 56px">](https://www.microsoft.com/p/antares-sql-client/9nhtb9sq51r1?cid=storebadge&ocid=badge&rtc=1&activetab=pivot:overviewtab)   | [<img height='56' alt='Download on Flathub' src='https://dl.flathub.org/assets/badges/flathub-badge-en.svg'/>](https://flathub.org/apps/it.fabiodistasio.AntaresSQL) [](https://snapcraft.io/antares) [](https://aur.archlinux.org/packages/antares-sql-bin) [<img src="https://developer.microsoft.com/store/badges/images/English_get-it-from-MS.png" style="height: 56px">](https://www.microsoft.com/p/antares-sql-client/9nhtb9sq51r1?cid=storebadge&ocid=badge&rtc=1&activetab=pivot:overviewtab)   | ||||||
| 🚀 **[Other Downloads](https://github.com/antares-sql/antares/releases/latest)** | 🚀 **[Other Downloads](https://github.com/antares-sql/antares/releases/latest)** | ||||||
|  |  | ||||||
| ## Coming soon |  | ||||||
|  |  | ||||||
| This is a roadmap with major features will come in near future. |  | ||||||
|  |  | ||||||
| - Database tools. |  | ||||||
| - Users management (add/edit/delete). |  | ||||||
| - More context menu shortcuts. |  | ||||||
| - More keyboard shortcuts. |  | ||||||
| - Support for other databases. |  | ||||||
| - Apple Silicon distribution |  | ||||||
|  |  | ||||||
| ## Currently supported | ## Currently supported | ||||||
|  |  | ||||||
| ### Databases | ### Databases | ||||||
| @@ -90,6 +79,7 @@ This is a roadmap with major features will come in near future. | |||||||
| - [x] PostgreSQL | - [x] PostgreSQL | ||||||
| - [x] SQLite | - [x] SQLite | ||||||
| - [x] Firebird SQL | - [x] Firebird SQL | ||||||
|  | - [ ] DuckDB | ||||||
| - [ ] SQL Server | - [ ] SQL Server | ||||||
| - [ ] More... | - [ ] More... | ||||||
|  |  | ||||||
|   | |||||||
| @@ -363,7 +363,7 @@ export interface QueryBuilderObject { | |||||||
|    offset: number; |    offset: number; | ||||||
|    join: string[]; |    join: string[]; | ||||||
|    update: string[]; |    update: string[]; | ||||||
|    insert: {[key: string]: string | boolean | number }[]; |    insert: Record<string, string | boolean | number>[]; | ||||||
|    delete: boolean; |    delete: boolean; | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -13,7 +13,7 @@ export interface ExportOptions { | |||||||
|       includeContent: boolean; |       includeContent: boolean; | ||||||
|       includeDropStatement: boolean; |       includeDropStatement: boolean; | ||||||
|    }[]; |    }[]; | ||||||
|    includes: {[key: string]: boolean}; |    includes: Record<string, boolean>; | ||||||
|    outputFormat: 'sql' | 'sql.zip'; |    outputFormat: 'sql' | 'sql.zip'; | ||||||
|    outputFile: string; |    outputFile: string; | ||||||
|    sqlInsertAfter: number; |    sqlInsertAfter: number; | ||||||
|   | |||||||
| @@ -18,7 +18,7 @@ export interface TableDeleteParams { | |||||||
|    primary?: string; |    primary?: string; | ||||||
|    field: string; |    field: string; | ||||||
|    // eslint-disable-next-line @typescript-eslint/no-explicit-any |    // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||||||
|    rows: {[key: string]: any}; |    rows: Record<string, any>; | ||||||
| } | } | ||||||
|  |  | ||||||
| export type TableFilterOperator = '=' | '!=' | '>' | '<' | '>=' | '<=' | 'IN' | 'NOT IN' | 'LIKE' | 'NOT LIKE' | 'RLIKE' | 'NOT RLIKE' | 'BETWEEN' | 'IS NULL' | 'IS NOT NULL' | export type TableFilterOperator = '=' | '!=' | '>' | '<' | '>=' | '<=' | 'IN' | 'NOT IN' | 'LIKE' | 'NOT LIKE' | 'RLIKE' | 'NOT RLIKE' | 'BETWEEN' | 'IS NULL' | 'IS NOT NULL' | ||||||
| @@ -35,17 +35,16 @@ export interface InsertRowsParams { | |||||||
|    uid: string; |    uid: string; | ||||||
|    schema: string; |    schema: string; | ||||||
|    table: string; |    table: string; | ||||||
|    row: {[key: string]: { |    row: Record<string, { | ||||||
|          group: string; |       group: string; | ||||||
|          method: string; |       method: string; | ||||||
|          // eslint-disable-next-line @typescript-eslint/no-explicit-any |       // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||||||
|          params: any; |       params: any; | ||||||
|          // eslint-disable-next-line @typescript-eslint/no-explicit-any |       // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||||||
|          value: any; |       value: any; | ||||||
|          length: number; |       length: number; | ||||||
|       }; |    }>; | ||||||
|    }; |  | ||||||
|    repeat: number; |    repeat: number; | ||||||
|    fields: {[key: string]: string}; |    fields: Record<string, string>; | ||||||
|    locale: UsableLocale; |    locale: UsableLocale; | ||||||
| } | } | ||||||
|   | |||||||
| @@ -41,7 +41,7 @@ export const escapeAndQuote = (val: string, client: ClientCode) => { | |||||||
|    const { stringsWrapper: sw } = customizations[client]; |    const { stringsWrapper: sw } = customizations[client]; | ||||||
|    // eslint-disable-next-line no-control-regex |    // eslint-disable-next-line no-control-regex | ||||||
|    const CHARS_TO_ESCAPE = /[\0\b\t\n\r\x1a"'\\]/g; |    const CHARS_TO_ESCAPE = /[\0\b\t\n\r\x1a"'\\]/g; | ||||||
|    const CHARS_ESCAPE_MAP: {[key: string]: string} = { |    const CHARS_ESCAPE_MAP: Record<string, string> = { | ||||||
|       '\0': '\\0', |       '\0': '\\0', | ||||||
|       '\b': '\\b', |       '\b': '\\b', | ||||||
|       '\t': '\\t', |       '\t': '\\t', | ||||||
| @@ -153,9 +153,9 @@ export const valueToSqlString = (args: { | |||||||
| }; | }; | ||||||
|  |  | ||||||
| export const jsonToSqlInsert = (args: { | export const jsonToSqlInsert = (args: { | ||||||
|       json: { [key: string]: any}[]; |       json: Record<string, any>[]; | ||||||
|       client: ClientCode; |       client: ClientCode; | ||||||
|       fields: { [key: string]: {type: string; datePrecision: number}}; |       fields: Record<string, {type: string; datePrecision: number}>; | ||||||
|       table: string; |       table: string; | ||||||
|       options?: {sqlInsertAfter: number; sqlInsertDivider: 'bytes' | 'rows'}; |       options?: {sqlInsertAfter: number; sqlInsertDivider: 'bytes' | 'rows'}; | ||||||
|    }) => { |    }) => { | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| export const shortcutEvents: { [key: string]: { l18n: string; l18nParam?: string | number; context?: 'tab' }} = { | export const shortcutEvents: Record<string, { l18n: string; l18nParam?: string | number; context?: 'tab' }> = { | ||||||
|    'run-or-reload': { l18n: 'application.runOrReload', context: 'tab' }, |    'run-or-reload': { l18n: 'application.runOrReload', context: 'tab' }, | ||||||
|    'open-new-tab': { l18n: 'application.openNewTab', context: 'tab' }, |    'open-new-tab': { l18n: 'application.openNewTab', context: 'tab' }, | ||||||
|    'close-tab': { l18n: 'application.closeTab', context: 'tab' }, |    'close-tab': { l18n: 'application.closeTab', context: 'tab' }, | ||||||
|   | |||||||
| @@ -6,7 +6,7 @@ import { SslOptions } from 'mysql2'; | |||||||
| import { ClientsFactory } from '../libs/ClientsFactory'; | import { ClientsFactory } from '../libs/ClientsFactory'; | ||||||
| import { validateSender } from '../libs/misc/validateSender'; | import { validateSender } from '../libs/misc/validateSender'; | ||||||
|  |  | ||||||
| export default (connections: {[key: string]: antares.Client}) => { | export default (connections: Record<string, antares.Client>) => { | ||||||
|    ipcMain.handle('test-connection', async (event, conn: antares.ConnectionParams) => { |    ipcMain.handle('test-connection', async (event, conn: antares.ConnectionParams) => { | ||||||
|       if (!validateSender(event.senderFrame)) return { status: 'error', response: 'Unauthorized process' }; |       if (!validateSender(event.senderFrame)) return { status: 'error', response: 'Unauthorized process' }; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -3,7 +3,7 @@ import { ipcMain } from 'electron'; | |||||||
|  |  | ||||||
| import { validateSender } from '../libs/misc/validateSender'; | import { validateSender } from '../libs/misc/validateSender'; | ||||||
|  |  | ||||||
| export default (connections: {[key: string]: antares.Client}) => { | export default (connections: Record<string, antares.Client>) => { | ||||||
|    ipcMain.handle('get-databases', async (event, uid) => { |    ipcMain.handle('get-databases', async (event, uid) => { | ||||||
|       if (!validateSender(event.senderFrame)) return { status: 'error', response: 'Unauthorized process' }; |       if (!validateSender(event.senderFrame)) return { status: 'error', response: 'Unauthorized process' }; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -3,7 +3,7 @@ import { ipcMain } from 'electron'; | |||||||
|  |  | ||||||
| import { validateSender } from '../libs/misc/validateSender'; | import { validateSender } from '../libs/misc/validateSender'; | ||||||
|  |  | ||||||
| export default (connections: {[key: string]: antares.Client}) => { | export default (connections: Record<string, antares.Client>) => { | ||||||
|    ipcMain.handle('get-function-informations', async (event, params) => { |    ipcMain.handle('get-function-informations', async (event, params) => { | ||||||
|       if (!validateSender(event.senderFrame)) return { status: 'error', response: 'Unauthorized process' }; |       if (!validateSender(event.senderFrame)) return { status: 'error', response: 'Unauthorized process' }; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -13,7 +13,7 @@ import updates from './updates'; | |||||||
| import users from './users'; | import users from './users'; | ||||||
| import views from './views'; | import views from './views'; | ||||||
|  |  | ||||||
| const connections: {[key: string]: antares.Client} = {}; | const connections: Record<string, antares.Client> = {}; | ||||||
|  |  | ||||||
| export default () => { | export default () => { | ||||||
|    connection(connections); |    connection(connections); | ||||||
|   | |||||||
| @@ -3,7 +3,7 @@ import { ipcMain } from 'electron'; | |||||||
|  |  | ||||||
| import { validateSender } from '../libs/misc/validateSender'; | import { validateSender } from '../libs/misc/validateSender'; | ||||||
|  |  | ||||||
| export default (connections: {[key: string]: antares.Client}) => { | export default (connections: Record<string, antares.Client>) => { | ||||||
|    ipcMain.handle('get-routine-informations', async (event, params) => { |    ipcMain.handle('get-routine-informations', async (event, params) => { | ||||||
|       if (!validateSender(event.senderFrame)) return { status: 'error', response: 'Unauthorized process' }; |       if (!validateSender(event.senderFrame)) return { status: 'error', response: 'Unauthorized process' }; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -3,7 +3,7 @@ import { ipcMain } from 'electron'; | |||||||
|  |  | ||||||
| import { validateSender } from '../libs/misc/validateSender'; | import { validateSender } from '../libs/misc/validateSender'; | ||||||
|  |  | ||||||
| export default (connections: {[key: string]: antares.Client}) => { | export default (connections: Record<string, antares.Client>) => { | ||||||
|    ipcMain.handle('get-scheduler-informations', async (event, params) => { |    ipcMain.handle('get-scheduler-informations', async (event, params) => { | ||||||
|       if (!validateSender(event.senderFrame)) return { status: 'error', response: 'Unauthorized process' }; |       if (!validateSender(event.senderFrame)) return { status: 'error', response: 'Unauthorized process' }; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -6,7 +6,7 @@ import { Worker } from 'worker_threads'; | |||||||
|  |  | ||||||
| import { validateSender } from '../libs/misc/validateSender'; | import { validateSender } from '../libs/misc/validateSender'; | ||||||
|  |  | ||||||
| export default (connections: {[key: string]: antares.Client}) => { | export default (connections: Record<string, antares.Client>) => { | ||||||
|    let exporter: Worker = null; |    let exporter: Worker = null; | ||||||
|    let importer: Worker = null; |    let importer: Worker = null; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -10,7 +10,7 @@ import * as moment from 'moment'; | |||||||
|  |  | ||||||
| import { validateSender } from '../libs/misc/validateSender'; | import { validateSender } from '../libs/misc/validateSender'; | ||||||
|  |  | ||||||
| export default (connections: {[key: string]: antares.Client}) => { | export default (connections: Record<string, antares.Client>) => { | ||||||
|    ipcMain.handle('get-table-columns', async (event, params) => { |    ipcMain.handle('get-table-columns', async (event, params) => { | ||||||
|       if (!validateSender(event.senderFrame)) return { status: 'error', response: 'Unauthorized process' }; |       if (!validateSender(event.senderFrame)) return { status: 'error', response: 'Unauthorized process' }; | ||||||
|  |  | ||||||
| @@ -249,7 +249,7 @@ export default (connections: {[key: string]: antares.Client}) => { | |||||||
|  |  | ||||||
|       if (params.primary) { |       if (params.primary) { | ||||||
|          // eslint-disable-next-line @typescript-eslint/no-explicit-any |          // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||||||
|          const idString = params.rows.map((row: {[key: string]: any}) => { |          const idString = params.rows.map((row: Record<string, any>) => { | ||||||
|             const fieldName = Object.keys(row)[0].includes('.') ? `${params.table}.${params.primary}` : params.primary; |             const fieldName = Object.keys(row)[0].includes('.') ? `${params.table}.${params.primary}` : params.primary; | ||||||
|  |  | ||||||
|             return typeof row[fieldName] === 'string' |             return typeof row[fieldName] === 'string' | ||||||
| @@ -304,10 +304,10 @@ export default (connections: {[key: string]: antares.Client}) => { | |||||||
|       if (!validateSender(event.senderFrame)) return { status: 'error', response: 'Unauthorized process' }; |       if (!validateSender(event.senderFrame)) return { status: 'error', response: 'Unauthorized process' }; | ||||||
|  |  | ||||||
|       try { // TODO: move to client classes |       try { // TODO: move to client classes | ||||||
|          const rows: {[key: string]: string | number | boolean | Date | Buffer}[] = []; |          const rows: Record<string, string | number | boolean | Date | Buffer>[] = []; | ||||||
|  |  | ||||||
|          for (let i = 0; i < +params.repeat; i++) { |          for (let i = 0; i < +params.repeat; i++) { | ||||||
|             const insertObj: {[key: string]: string | number | boolean | Date | Buffer} = {}; |             const insertObj: Record<string, string | number | boolean | Date | Buffer> = {}; | ||||||
|  |  | ||||||
|             for (const key in params.row) { |             for (const key in params.row) { | ||||||
|                const type = params.fields[key]; |                const type = params.fields[key]; | ||||||
| @@ -367,7 +367,7 @@ export default (connections: {[key: string]: antares.Client}) => { | |||||||
|                   insertObj[key] = escapedParam; |                   insertObj[key] = escapedParam; | ||||||
|                } |                } | ||||||
|                else { // Faker value |                else { // Faker value | ||||||
|                   const parsedParams: {[key: string]: string | number | boolean | Date | Buffer} = {}; |                   const parsedParams: Record<string, string | number | boolean | Date | Buffer> = {}; | ||||||
|                   let fakeValue; |                   let fakeValue; | ||||||
|  |  | ||||||
|                   if (params.locale) |                   if (params.locale) | ||||||
| @@ -437,12 +437,12 @@ export default (connections: {[key: string]: antares.Client}) => { | |||||||
|          if (description) |          if (description) | ||||||
|             query.select(`LEFT(${description}, 20) AS foreign_description`); |             query.select(`LEFT(${description}, 20) AS foreign_description`); | ||||||
|  |  | ||||||
|          const results = await query.run<{[key: string]: string}>(); |          const results = await query.run<Record<string, string>>(); | ||||||
|  |  | ||||||
|          const parsedResults: {[key: string]: string}[] = []; |          const parsedResults: Record<string, string>[] = []; | ||||||
|  |  | ||||||
|          for (const row of results.rows) { |          for (const row of results.rows) { | ||||||
|             const remappedRow: {[key: string]: string} = {}; |             const remappedRow: Record<string, string> = {}; | ||||||
|  |  | ||||||
|             for (const key in row) |             for (const key in row) | ||||||
|                remappedRow[key.toLowerCase()] = row[key];// Thanks Firebird -.- |                remappedRow[key.toLowerCase()] = row[key];// Thanks Firebird -.- | ||||||
|   | |||||||
| @@ -3,7 +3,7 @@ import { ipcMain } from 'electron'; | |||||||
|  |  | ||||||
| import { validateSender } from '../libs/misc/validateSender'; | import { validateSender } from '../libs/misc/validateSender'; | ||||||
|  |  | ||||||
| export default (connections: {[key: string]: antares.Client}) => { | export default (connections: Record<string, antares.Client>) => { | ||||||
|    ipcMain.handle('get-trigger-informations', async (event, params) => { |    ipcMain.handle('get-trigger-informations', async (event, params) => { | ||||||
|       if (!validateSender(event.senderFrame)) return { status: 'error', response: 'Unauthorized process' }; |       if (!validateSender(event.senderFrame)) return { status: 'error', response: 'Unauthorized process' }; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -3,7 +3,7 @@ import { ipcMain } from 'electron'; | |||||||
|  |  | ||||||
| import { validateSender } from '../libs/misc/validateSender'; | import { validateSender } from '../libs/misc/validateSender'; | ||||||
|  |  | ||||||
| export default (connections: {[key: string]: antares.Client}) => { | export default (connections: Record<string, antares.Client>) => { | ||||||
|    ipcMain.handle('get-users', async (event, uid) => { |    ipcMain.handle('get-users', async (event, uid) => { | ||||||
|       if (!validateSender(event.senderFrame)) return { status: 'error', response: 'Unauthorized process' }; |       if (!validateSender(event.senderFrame)) return { status: 'error', response: 'Unauthorized process' }; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -3,7 +3,7 @@ import { ipcMain } from 'electron'; | |||||||
|  |  | ||||||
| import { validateSender } from '../libs/misc/validateSender'; | import { validateSender } from '../libs/misc/validateSender'; | ||||||
|  |  | ||||||
| export default (connections: {[key: string]: antares.Client}) => { | export default (connections: Record<string, antares.Client>) => { | ||||||
|    ipcMain.handle('get-view-informations', async (event, params) => { |    ipcMain.handle('get-view-informations', async (event, params) => { | ||||||
|       if (!validateSender(event.senderFrame)) return { status: 'error', response: 'Unauthorized process' }; |       if (!validateSender(event.senderFrame)) return { status: 'error', response: 'Unauthorized process' }; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -136,7 +136,7 @@ export abstract class BaseClient { | |||||||
|    } |    } | ||||||
|  |  | ||||||
|    // eslint-disable-next-line @typescript-eslint/no-explicit-any |    // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||||||
|    insert (arr: {[key: string]: any}[]) { |    insert (arr: Record<string, any>[]) { | ||||||
|       this._query.insert = [...this._query.insert, ...arr]; |       this._query.insert = [...this._query.insert, ...arr]; | ||||||
|       return this; |       return this; | ||||||
|    } |    } | ||||||
|   | |||||||
| @@ -13,7 +13,7 @@ export class FirebirdSQLClient extends BaseClient { | |||||||
|    protected _connection?: firebird.Database | firebird.ConnectionPool; |    protected _connection?: firebird.Database | firebird.ConnectionPool; | ||||||
|    _params: firebird.Options; |    _params: firebird.Options; | ||||||
|  |  | ||||||
|    private _types: {[key: number]: string} ={ |    private _types: Record<number, string> ={ | ||||||
|       452: 'CHAR', // Array of char |       452: 'CHAR', // Array of char | ||||||
|       448: 'VARCHAR', |       448: 'VARCHAR', | ||||||
|       500: 'SMALLINT', |       500: 'SMALLINT', | ||||||
|   | |||||||
| @@ -15,7 +15,7 @@ export class MySQLClient extends BaseClient { | |||||||
|    _connection?: mysql.Connection | mysql.Pool; |    _connection?: mysql.Connection | mysql.Pool; | ||||||
|    _params: mysql.ConnectionOptions & {schema: string; ssl?: mysql.SslOptions; ssh?: SSHConfig; readonly: boolean}; |    _params: mysql.ConnectionOptions & {schema: string; ssl?: mysql.SslOptions; ssh?: SSHConfig; readonly: boolean}; | ||||||
|  |  | ||||||
|    private types: {[key: number]: string} = { |    private types: Record<number, string> = { | ||||||
|       0: 'DECIMAL', |       0: 'DECIMAL', | ||||||
|       1: 'TINYINT', |       1: 'TINYINT', | ||||||
|       2: 'SMALLINT', |       2: 'SMALLINT', | ||||||
| @@ -582,7 +582,7 @@ export class MySQLClient extends BaseClient { | |||||||
|                } |                } | ||||||
|             }) |             }) | ||||||
|             .filter(Boolean) |             .filter(Boolean) | ||||||
|             .reduce((acc: {[key: string]: { name: string; type: string; length: string; default: string}}, curr) => { |             .reduce((acc: Record<string, { name: string; type: string; length: string; default: string}>, curr) => { | ||||||
|                acc[curr.name] = curr; |                acc[curr.name] = curr; | ||||||
|                return acc; |                return acc; | ||||||
|             }, {}); |             }, {}); | ||||||
|   | |||||||
| @@ -88,8 +88,8 @@ export class PostgreSQLClient extends BaseClient { | |||||||
|    private _keepaliveTimer: NodeJS.Timer; |    private _keepaliveTimer: NodeJS.Timer; | ||||||
|    private _keepaliveMs: number; |    private _keepaliveMs: number; | ||||||
|    protected _connection?: pg.Client | pg.Pool; |    protected _connection?: pg.Client | pg.Pool; | ||||||
|    private types: {[key: string]: string} = {}; |    private types: Record<string, string> = {}; | ||||||
|    private _arrayTypes: {[key: string]: string} = { |    private _arrayTypes: Record<string, string> = { | ||||||
|       _int2: 'SMALLINT', |       _int2: 'SMALLINT', | ||||||
|       _int4: 'INTEGER', |       _int4: 'INTEGER', | ||||||
|       _int8: 'BIGINT', |       _int8: 'BIGINT', | ||||||
| @@ -656,7 +656,7 @@ export class PostgreSQLClient extends BaseClient { | |||||||
|       let createSql = ''; |       let createSql = ''; | ||||||
|       const sequences = []; |       const sequences = []; | ||||||
|       const columnsSql = []; |       const columnsSql = []; | ||||||
|       const arrayTypes: {[key: string]: string} = { |       const arrayTypes: Record<string, string> = { | ||||||
|          _int2: 'smallint', |          _int2: 'smallint', | ||||||
|          _int4: 'integer', |          _int4: 'integer', | ||||||
|          _int8: 'bigint', |          _int8: 'bigint', | ||||||
|   | |||||||
| @@ -658,7 +658,7 @@ export class SQLiteClient extends BaseClient { | |||||||
|                let queryAllResult: any[]; |                let queryAllResult: any[]; | ||||||
|                let affectedRows; |                let affectedRows; | ||||||
|                let fields; |                let fields; | ||||||
|                const detectedTypes: {[key: string]: string} = {}; |                const detectedTypes: Record<string, string> = {}; | ||||||
|  |  | ||||||
|                try { |                try { | ||||||
|                   const stmt = connection.prepare(query); |                   const stmt = connection.prepare(query); | ||||||
|   | |||||||
| @@ -354,7 +354,7 @@ CREATE TABLE \`${view.Name}\`( | |||||||
|    escapeAndQuote (val: string) { |    escapeAndQuote (val: string) { | ||||||
|       // eslint-disable-next-line no-control-regex |       // eslint-disable-next-line no-control-regex | ||||||
|       const CHARS_TO_ESCAPE = /[\0\b\t\n\r\x1a"'\\]/g; |       const CHARS_TO_ESCAPE = /[\0\b\t\n\r\x1a"'\\]/g; | ||||||
|       const CHARS_ESCAPE_MAP: {[key: string]: string} = { |       const CHARS_ESCAPE_MAP: Record<string, string> = { | ||||||
|          '\0': '\\0', |          '\0': '\\0', | ||||||
|          '\b': '\\b', |          '\b': '\\b', | ||||||
|          '\t': '\\t', |          '\t': '\\t', | ||||||
|   | |||||||
| @@ -59,7 +59,7 @@ SET row_security = off;\n\n\n`; | |||||||
|       let createSql = ''; |       let createSql = ''; | ||||||
|       const sequences = []; |       const sequences = []; | ||||||
|       const columnsSql = []; |       const columnsSql = []; | ||||||
|       const arrayTypes: {[key: string]: string} = { |       const arrayTypes: Record<string, string> = { | ||||||
|          _int2: 'smallint', |          _int2: 'smallint', | ||||||
|          _int4: 'integer', |          _int4: 'integer', | ||||||
|          _int8: 'bigint', |          _int8: 'bigint', | ||||||
| @@ -440,7 +440,7 @@ SET row_security = off;\n\n\n`; | |||||||
|    escapeAndQuote (val: string) { |    escapeAndQuote (val: string) { | ||||||
|       // eslint-disable-next-line no-control-regex |       // eslint-disable-next-line no-control-regex | ||||||
|       const CHARS_TO_ESCAPE = /[\0\b\t\n\r\x1a"'\\]/g; |       const CHARS_TO_ESCAPE = /[\0\b\t\n\r\x1a"'\\]/g; | ||||||
|       const CHARS_ESCAPE_MAP: {[key: string]: string} = { |       const CHARS_ESCAPE_MAP: Record<string, string> = { | ||||||
|          '\0': '\\0', |          '\0': '\\0', | ||||||
|          '\b': '\\b', |          '\b': '\\b', | ||||||
|          '\t': '\\t', |          '\t': '\\t', | ||||||
|   | |||||||
| @@ -113,7 +113,7 @@ const selectedGroup: Ref<string> = ref('manual'); | |||||||
| const selectedMethod: Ref<string> = ref(''); | const selectedMethod: Ref<string> = ref(''); | ||||||
| const selectedValue: Ref<string> = ref(''); | const selectedValue: Ref<string> = ref(''); | ||||||
| const debounceTimeout: Ref<NodeJS.Timeout> = ref(null); | const debounceTimeout: Ref<NodeJS.Timeout> = ref(null); | ||||||
| const methodParams: Ref<{[key: string]: string}> = ref({}); | const methodParams: Ref<Record<string, string>> = ref({}); | ||||||
| const enumArray: Ref<string[]> = ref(null); | const enumArray: Ref<string[]> = ref(null); | ||||||
|  |  | ||||||
| const fakerGroups = computed(() => { | const fakerGroups = computed(() => { | ||||||
|   | |||||||
| @@ -73,7 +73,7 @@ const props = defineProps({ | |||||||
| const emit = defineEmits(['confirm', 'close']); | const emit = defineEmits(['confirm', 'close']); | ||||||
|  |  | ||||||
| const firstInput: Ref<HTMLInputElement[]> = ref(null); | const firstInput: Ref<HTMLInputElement[]> = ref(null); | ||||||
| const values: Ref<{[key: string]: string}> = ref({}); | const values: Ref<Record<string, string>> = ref({}); | ||||||
|  |  | ||||||
| const inParameters = computed(() => { | const inParameters = computed(() => { | ||||||
|    return props.localRoutine.parameters.filter(param => param.context === 'IN'); |    return props.localRoutine.parameters.filter(param => param.context === 'IN'); | ||||||
|   | |||||||
| @@ -327,7 +327,7 @@ const tables: Ref<{ | |||||||
| }[]> = ref([]); | }[]> = ref([]); | ||||||
| const options: Ref<Partial<ExportOptions>> = ref({ | const options: Ref<Partial<ExportOptions>> = ref({ | ||||||
|    schema: selectedSchema.value, |    schema: selectedSchema.value, | ||||||
|    includes: {} as {[key: string]: boolean}, |    includes: {} as Record<string, boolean>, | ||||||
|    outputFormat: 'sql' as 'sql' | 'sql.zip', |    outputFormat: 'sql' as 'sql' | 'sql.zip', | ||||||
|    sqlInsertAfter: 250, |    sqlInsertAfter: 250, | ||||||
|    sqlInsertDivider: 'bytes' as 'bytes' | 'rows' |    sqlInsertDivider: 'bytes' as 'bytes' | 'rows' | ||||||
|   | |||||||
| @@ -142,7 +142,7 @@ const { getSelected: selectedWorkspace } = storeToRefs(workspacesStore); | |||||||
| const { trapRef } = useFocusTrap({ disableAutofocus: true }); | const { trapRef } = useFocusTrap({ disableAutofocus: true }); | ||||||
|  |  | ||||||
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||||||
| const localRow: Ref<{[key: string]: any}> = ref({}); | const localRow: Ref<Record<string, any>> = ref({}); | ||||||
| const fieldsToExclude = ref([]); | const fieldsToExclude = ref([]); | ||||||
| const nInserts = ref(1); | const nInserts = ref(1); | ||||||
| const isInserting = ref(false); | const isInserting = ref(false); | ||||||
| @@ -225,7 +225,7 @@ const insertRows = async () => { | |||||||
|          delete rowToInsert[key]; |          delete rowToInsert[key]; | ||||||
|    }); |    }); | ||||||
|  |  | ||||||
|    const fieldTypes: {[key: string]: string} = {}; |    const fieldTypes: Record<string, string> = {}; | ||||||
|    props.fields.forEach(field => { |    props.fields.forEach(field => { | ||||||
|       fieldTypes[field.name] = field.type; |       fieldTypes[field.name] = field.type; | ||||||
|    }); |    }); | ||||||
| @@ -290,7 +290,7 @@ onMounted(() => { | |||||||
|       } |       } | ||||||
|    }, 50); |    }, 50); | ||||||
|  |  | ||||||
|    const rowObj: {[key: string]: unknown} = {}; |    const rowObj: Record<string, unknown> = {}; | ||||||
|  |  | ||||||
|    if (!props.rowToDuplicate) { |    if (!props.rowToDuplicate) { | ||||||
|       // Set default values |       // Set default values | ||||||
|   | |||||||
| @@ -67,7 +67,7 @@ const props = defineProps({ | |||||||
|  |  | ||||||
| const emit = defineEmits(['select-row', 'contextmenu', 'stop-refresh']); | const emit = defineEmits(['select-row', 'contextmenu', 'stop-refresh']); | ||||||
|  |  | ||||||
| const isInlineEditor: Ref<{[key: string]: boolean}> = ref({}); | const isInlineEditor: Ref<Record<string, boolean>> = ref({}); | ||||||
| const isInfoModal = ref(false); | const isInfoModal = ref(false); | ||||||
| const editorMode = ref('sql'); | const editorMode = ref('sql'); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -32,7 +32,7 @@ const { removeNotification } = notificationsStore; | |||||||
| const { notifications } = storeToRefs(notificationsStore); | const { notifications } = storeToRefs(notificationsStore); | ||||||
| const { notificationsTimeout } = storeToRefs(settingsStore); | const { notificationsTimeout } = storeToRefs(settingsStore); | ||||||
|  |  | ||||||
| const timeouts: Ref<{[key: string]: NodeJS.Timeout}> = ref({}); | const timeouts: Ref<Record<string, NodeJS.Timeout>> = ref({}); | ||||||
|  |  | ||||||
| const latestNotifications = computed(() => notifications.value.slice(0, 10)); | const latestNotifications = computed(() => notifications.value.slice(0, 10)); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -695,7 +695,7 @@ const openAsPermanentTab = (tab: WorkspaceTab) => { | |||||||
|       routine: 'routine-props', |       routine: 'routine-props', | ||||||
|       procedure: 'routine-props', |       procedure: 'routine-props', | ||||||
|       scheduler: 'scheduler-props' |       scheduler: 'scheduler-props' | ||||||
|    } as {[key: string]: string}; |    } as Record<string, string>; | ||||||
|  |  | ||||||
|    newTab({ |    newTab({ | ||||||
|       uid: props.connection.uid, |       uid: props.connection.uid, | ||||||
|   | |||||||
| @@ -572,11 +572,11 @@ const pathSelection = (event: Event & {target: {files: {path: string}[]}}, name: | |||||||
|    const { files } = event.target; |    const { files } = event.target; | ||||||
|    if (!files.length) return; |    if (!files.length) return; | ||||||
|  |  | ||||||
|    (connection.value as unknown as {[key: string]: string})[name] = files[0].path as string; |    (connection.value as unknown as Record<string, string>)[name] = files[0].path as string; | ||||||
| }; | }; | ||||||
|  |  | ||||||
| const pathClear = (name: keyof ConnectionParams) => { | const pathClear = (name: keyof ConnectionParams) => { | ||||||
|    (connection.value as unknown as {[key: string]: string})[name] = ''; |    (connection.value as unknown as Record<string, string>)[name] = ''; | ||||||
| }; | }; | ||||||
|  |  | ||||||
| setDefaults(); | setDefaults(); | ||||||
|   | |||||||
| @@ -569,11 +569,11 @@ const pathSelection = (event: Event & {target: {files: {path: string}[]}}, name: | |||||||
|    const { files } = event.target; |    const { files } = event.target; | ||||||
|    if (!files.length) return; |    if (!files.length) return; | ||||||
|  |  | ||||||
|    (localConnection.value as unknown as {[key: string]: string})[name] = files[0].path; |    (localConnection.value as unknown as Record<string, string>)[name] = files[0].path; | ||||||
| }; | }; | ||||||
|  |  | ||||||
| const pathClear = (name: keyof ConnectionParams) => { | const pathClear = (name: keyof ConnectionParams) => { | ||||||
|    (localConnection.value as unknown as {[key: string]: string})[name] = ''; |    (localConnection.value as unknown as Record<string, string>)[name] = ''; | ||||||
| }; | }; | ||||||
|  |  | ||||||
| localConnection.value = JSON.parse(JSON.stringify(props.connection)); | localConnection.value = JSON.parse(JSON.stringify(props.connection)); | ||||||
|   | |||||||
| @@ -382,7 +382,7 @@ const getFieldsData = async () => { | |||||||
|       if (status === 'success') { |       if (status === 'success') { | ||||||
|          const indexesObj = response |          const indexesObj = response | ||||||
|             .filter((index: TableIndex) => index.type !== 'FOREIGN KEY') |             .filter((index: TableIndex) => index.type !== 'FOREIGN KEY') | ||||||
|             .reduce((acc: {[key: string]: TableIndex[]}, curr: TableIndex) => { |             .reduce((acc: Record<string, TableIndex[]>, curr: TableIndex) => { | ||||||
|                acc[curr.name] = acc[curr.name] || []; |                acc[curr.name] = acc[curr.name] || []; | ||||||
|                acc[curr.name].push(curr); |                acc[curr.name].push(curr); | ||||||
|                return acc; |                return acc; | ||||||
|   | |||||||
| @@ -258,7 +258,7 @@ const indexesPanel: Ref<HTMLDivElement> = ref(null); | |||||||
| const foreignProxy = ref([]); | const foreignProxy = ref([]); | ||||||
| const selectedForeignID = ref(''); | const selectedForeignID = ref(''); | ||||||
| const modalInnerHeight = ref(400); | const modalInnerHeight = ref(400); | ||||||
| const refFields = ref({} as {[key: string]: TableField[]}); | const refFields = ref({} as Record<string, TableField[]>); | ||||||
|  |  | ||||||
| const foreignActions = computed(() => props.workspace.customizations.foreignActions); | const foreignActions = computed(() => props.workspace.customizations.foreignActions); | ||||||
| const selectedForeignObj = computed(() => foreignProxy.value.find(foreign => foreign._antares_id === selectedForeignID.value)); | const selectedForeignObj = computed(() => foreignProxy.value.find(foreign => foreign._antares_id === selectedForeignID.value)); | ||||||
|   | |||||||
| @@ -28,7 +28,7 @@ export function useFilters () { | |||||||
|       return `(${num})`; |       return `(${num})`; | ||||||
|    }; |    }; | ||||||
|  |  | ||||||
|    const parseKeys = (keys: {[key: number]: string}[]) => { |    const parseKeys = (keys: Record<number, string>[]) => { | ||||||
|       const isMacOS = process.platform === 'darwin'; |       const isMacOS = process.platform === 'darwin'; | ||||||
|       return (keys as string[]).map(k => ( |       return (keys as string[]).map(k => ( | ||||||
|          k.split('+') |          k.split('+') | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| export const localesNames: {[key: string]: string} = { | export const localesNames: Record<string, string> = { | ||||||
|    'en-US': 'English', |    'en-US': 'English', | ||||||
|    'it-IT': 'Italiano', |    'it-IT': 'Italiano', | ||||||
|    'ar-SA': 'العربية', |    'ar-SA': 'العربية', | ||||||
|   | |||||||
| @@ -64,7 +64,7 @@ export default class { | |||||||
|       primary?: string; |       primary?: string; | ||||||
|       field: string; |       field: string; | ||||||
|       // eslint-disable-next-line @typescript-eslint/no-explicit-any |       // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||||||
|       rows: {[key: string]: any}; |       rows: Record<string, any>; | ||||||
|    }): Promise<IpcResponse> { |    }): Promise<IpcResponse> { | ||||||
|       return ipcRenderer.invoke('delete-table-rows', unproxify(params)); |       return ipcRenderer.invoke('delete-table-rows', unproxify(params)); | ||||||
|    } |    } | ||||||
| @@ -73,9 +73,9 @@ export default class { | |||||||
|       uid: string; |       uid: string; | ||||||
|       schema: string; |       schema: string; | ||||||
|       table: string; |       table: string; | ||||||
|       row: {[key: string]: string | number | boolean | Date | Buffer}; |       row: Record<string, string | number | boolean | Date | Buffer>; | ||||||
|       repeat: number; |       repeat: number; | ||||||
|       fields: {[key: string]: string}; |       fields: Record<string, string>; | ||||||
|       locale: string; |       locale: string; | ||||||
|    }): Promise<IpcResponse> { |    }): Promise<IpcResponse> { | ||||||
|       return ipcRenderer.invoke('insert-table-fake-rows', unproxify(params)); |       return ipcRenderer.invoke('insert-table-fake-rows', unproxify(params)); | ||||||
|   | |||||||
| @@ -13,7 +13,7 @@ export interface HistoryRecord { | |||||||
|  |  | ||||||
| export const useHistoryStore = defineStore('history', { | export const useHistoryStore = defineStore('history', { | ||||||
|    state: () => ({ |    state: () => ({ | ||||||
|       history: persistentStore.get('history', {}) as {[key: string]: HistoryRecord[]}, |       history: persistentStore.get('history', {}) as Record<string, HistoryRecord[]>, | ||||||
|       favorites: persistentStore.get('favorites', {}) |       favorites: persistentStore.get('favorites', {}) | ||||||
|    }), |    }), | ||||||
|    getters: { |    getters: { | ||||||
|   | |||||||
| @@ -86,11 +86,11 @@ export interface Workspace { | |||||||
|       arch: string; |       arch: string; | ||||||
|       os: string; |       os: string; | ||||||
|    }; |    }; | ||||||
|    engines?: {[key: string]: string | boolean | number}[]; |    engines?: Record<string, string | boolean | number>[]; | ||||||
| } | } | ||||||
|  |  | ||||||
| const persistentStore = new Store({ name: 'tabs' }); | const persistentStore = new Store({ name: 'tabs' }); | ||||||
| const tabIndex: {[key: string]: number} = {}; | const tabIndex: Record<string, number> = {}; | ||||||
|  |  | ||||||
| export const useWorkspacesStore = defineStore('workspaces', { | export const useWorkspacesStore = defineStore('workspaces', { | ||||||
|    state: () => ({ |    state: () => ({ | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user