mirror of
https://github.com/Fabio286/antares.git
synced 2025-06-05 21:59:22 +02:00
refactor: ts on ipc api
This commit is contained in:
@ -1,17 +0,0 @@
|
||||
'use strict';
|
||||
import { ipcRenderer } from 'electron';
|
||||
import { unproxify } from '../libs/unproxify';
|
||||
|
||||
export default class {
|
||||
static getKey (params) {
|
||||
return ipcRenderer.sendSync('get-key', unproxify(params));
|
||||
}
|
||||
|
||||
static showOpenDialog (options) {
|
||||
return ipcRenderer.invoke('show-open-dialog', unproxify(options));
|
||||
}
|
||||
|
||||
static getDownloadPathDirectory () {
|
||||
return ipcRenderer.invoke('get-download-dir-path');
|
||||
}
|
||||
}
|
12
src/renderer/ipc-api/Application.ts
Normal file
12
src/renderer/ipc-api/Application.ts
Normal file
@ -0,0 +1,12 @@
|
||||
import { ipcRenderer, OpenDialogOptions, OpenDialogReturnValue } from 'electron';
|
||||
import { unproxify } from '../libs/unproxify';
|
||||
|
||||
export default class {
|
||||
static showOpenDialog (options: OpenDialogOptions): Promise<OpenDialogReturnValue> {
|
||||
return ipcRenderer.invoke('show-open-dialog', unproxify(options));
|
||||
}
|
||||
|
||||
static getDownloadPathDirectory (): Promise<string> {
|
||||
return ipcRenderer.invoke('get-download-dir-path');
|
||||
}
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
'use strict';
|
||||
import { ipcRenderer } from 'electron';
|
||||
import connStringConstruct from '../libs/connStringDecode';
|
||||
import { unproxify } from '../libs/unproxify';
|
||||
|
||||
export default class {
|
||||
static makeTest (params) {
|
||||
params = connStringConstruct(params);
|
||||
return ipcRenderer.invoke('test-connection', unproxify(params));
|
||||
}
|
||||
|
||||
static connect (params) {
|
||||
params = connStringConstruct(params);
|
||||
return ipcRenderer.invoke('connect', unproxify(params));
|
||||
}
|
||||
|
||||
static checkConnection (uid) {
|
||||
return ipcRenderer.invoke('check-connection', uid);
|
||||
}
|
||||
|
||||
static disconnect (uid) {
|
||||
return ipcRenderer.invoke('disconnect', uid);
|
||||
}
|
||||
}
|
24
src/renderer/ipc-api/Connection.ts
Normal file
24
src/renderer/ipc-api/Connection.ts
Normal file
@ -0,0 +1,24 @@
|
||||
import { ConnectionParams, IpcResponse } from 'common/interfaces/antares';
|
||||
import { ipcRenderer } from 'electron';
|
||||
import connStringConstruct from '../libs/connStringDecode';
|
||||
import { unproxify } from '../libs/unproxify';
|
||||
|
||||
export default class {
|
||||
static makeTest (params: ConnectionParams & { pgConnString: string }): Promise<IpcResponse> {
|
||||
const newParams = connStringConstruct(params) as ConnectionParams;
|
||||
return ipcRenderer.invoke('test-connection', unproxify(newParams));
|
||||
}
|
||||
|
||||
static connect (params: ConnectionParams & { pgConnString: string }): Promise<IpcResponse> {
|
||||
const newParams = connStringConstruct(params) as ConnectionParams;
|
||||
return ipcRenderer.invoke('connect', unproxify(newParams));
|
||||
}
|
||||
|
||||
static checkConnection (uid: string): Promise<boolean> {
|
||||
return ipcRenderer.invoke('check-connection', uid);
|
||||
}
|
||||
|
||||
static disconnect (uid: string): Promise<void> {
|
||||
return ipcRenderer.invoke('disconnect', uid);
|
||||
}
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
'use strict';
|
||||
import { ipcRenderer } from 'electron';
|
||||
import { unproxify } from '../libs/unproxify';
|
||||
|
||||
export default class {
|
||||
static getFunctionInformations (params) {
|
||||
return ipcRenderer.invoke('get-function-informations', unproxify(params));
|
||||
}
|
||||
|
||||
static dropFunction (params) {
|
||||
return ipcRenderer.invoke('drop-function', unproxify(params));
|
||||
}
|
||||
|
||||
static alterFunction (params) {
|
||||
return ipcRenderer.invoke('alter-function', unproxify(params));
|
||||
}
|
||||
|
||||
static alterTriggerFunction (params) {
|
||||
return ipcRenderer.invoke('alter-trigger-function', unproxify(params));
|
||||
}
|
||||
|
||||
static createFunction (params) {
|
||||
return ipcRenderer.invoke('create-function', unproxify(params));
|
||||
}
|
||||
|
||||
static createTriggerFunction (params) {
|
||||
return ipcRenderer.invoke('create-trigger-function', unproxify(params));
|
||||
}
|
||||
}
|
29
src/renderer/ipc-api/Functions.ts
Normal file
29
src/renderer/ipc-api/Functions.ts
Normal file
@ -0,0 +1,29 @@
|
||||
import { AlterFunctionParams, CreateFunctionParams, FunctionInfos, IpcResponse } from 'common/interfaces/antares';
|
||||
import { ipcRenderer } from 'electron';
|
||||
import { unproxify } from '../libs/unproxify';
|
||||
|
||||
export default class {
|
||||
static getFunctionInformations (params: { uid: string; schema: string; func: string}): Promise<IpcResponse<FunctionInfos>> {
|
||||
return ipcRenderer.invoke('get-function-informations', unproxify(params));
|
||||
}
|
||||
|
||||
static dropFunction (params: { uid: string; schema: string; func: string}): Promise<IpcResponse> {
|
||||
return ipcRenderer.invoke('drop-function', unproxify(params));
|
||||
}
|
||||
|
||||
static alterFunction (params: { func: AlterFunctionParams }): Promise<IpcResponse> {
|
||||
return ipcRenderer.invoke('alter-function', unproxify(params));
|
||||
}
|
||||
|
||||
static alterTriggerFunction (params: {func: CreateFunctionParams & { uid: string }}): Promise<IpcResponse> {
|
||||
return ipcRenderer.invoke('alter-trigger-function', unproxify(params));
|
||||
}
|
||||
|
||||
static createFunction (params: CreateFunctionParams & { uid: string }): Promise<IpcResponse> {
|
||||
return ipcRenderer.invoke('create-function', unproxify(params));
|
||||
}
|
||||
|
||||
static createTriggerFunction (params: CreateFunctionParams & { uid: string }): Promise<IpcResponse> {
|
||||
return ipcRenderer.invoke('create-trigger-function', unproxify(params));
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
'use strict';
|
||||
import { ipcRenderer } from 'electron';
|
||||
import { unproxify } from '../libs/unproxify';
|
||||
|
||||
export default class {
|
||||
static getRoutineInformations (params) {
|
||||
return ipcRenderer.invoke('get-routine-informations', unproxify(params));
|
||||
}
|
||||
|
||||
static dropRoutine (params) {
|
||||
return ipcRenderer.invoke('drop-routine', unproxify(params));
|
||||
}
|
||||
|
||||
static alterRoutine (params) {
|
||||
return ipcRenderer.invoke('alter-routine', unproxify(params));
|
||||
}
|
||||
|
||||
static createRoutine (params) {
|
||||
return ipcRenderer.invoke('create-routine', unproxify(params));
|
||||
}
|
||||
}
|
21
src/renderer/ipc-api/Routines.ts
Normal file
21
src/renderer/ipc-api/Routines.ts
Normal file
@ -0,0 +1,21 @@
|
||||
import { ipcRenderer } from 'electron';
|
||||
import { unproxify } from '../libs/unproxify';
|
||||
import { AlterRoutineParams, CreateRoutineParams, IpcResponse, RoutineInfos } from 'common/interfaces/antares';
|
||||
|
||||
export default class {
|
||||
static getRoutineInformations (params: { uid: string; schema: string; routine: string}): Promise<IpcResponse<RoutineInfos>> {
|
||||
return ipcRenderer.invoke('get-routine-informations', unproxify(params));
|
||||
}
|
||||
|
||||
static dropRoutine (params: { uid: string; schema: string; routine: string}): Promise<IpcResponse> {
|
||||
return ipcRenderer.invoke('drop-routine', unproxify(params));
|
||||
}
|
||||
|
||||
static alterRoutine (params: { routine: AlterRoutineParams & { uid: string } }): Promise<IpcResponse> {
|
||||
return ipcRenderer.invoke('alter-routine', unproxify(params));
|
||||
}
|
||||
|
||||
static createRoutine (params: { routine: CreateRoutineParams & { uid: string } }): Promise<IpcResponse> {
|
||||
return ipcRenderer.invoke('create-routine', unproxify(params));
|
||||
}
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
'use strict';
|
||||
import { ipcRenderer } from 'electron';
|
||||
import { unproxify } from '../libs/unproxify';
|
||||
export default class {
|
||||
static getSchedulerInformations (params) {
|
||||
return ipcRenderer.invoke('get-scheduler-informations', unproxify(params));
|
||||
}
|
||||
|
||||
static dropScheduler (params) {
|
||||
return ipcRenderer.invoke('drop-scheduler', unproxify(params));
|
||||
}
|
||||
|
||||
static alterScheduler (params) {
|
||||
return ipcRenderer.invoke('alter-scheduler', unproxify(params));
|
||||
}
|
||||
|
||||
static createScheduler (params) {
|
||||
return ipcRenderer.invoke('create-scheduler', unproxify(params));
|
||||
}
|
||||
|
||||
static toggleScheduler (params) {
|
||||
return ipcRenderer.invoke('toggle-scheduler', unproxify(params));
|
||||
}
|
||||
}
|
25
src/renderer/ipc-api/Schedulers.ts
Normal file
25
src/renderer/ipc-api/Schedulers.ts
Normal file
@ -0,0 +1,25 @@
|
||||
import { ipcRenderer } from 'electron';
|
||||
import { unproxify } from '../libs/unproxify';
|
||||
import { AlterEventParams, CreateEventParams, EventInfos, IpcResponse } from 'common/interfaces/antares';
|
||||
|
||||
export default class {
|
||||
static getSchedulerInformations (params: { uid: string; schema: string; scheduler: string}): Promise<IpcResponse<EventInfos>> {
|
||||
return ipcRenderer.invoke('get-scheduler-informations', unproxify(params));
|
||||
}
|
||||
|
||||
static dropScheduler (params: { uid: string; schema: string; scheduler: string}): Promise<IpcResponse> {
|
||||
return ipcRenderer.invoke('drop-scheduler', unproxify(params));
|
||||
}
|
||||
|
||||
static alterScheduler (params: { scheduler: AlterEventParams & { uid: string } }): Promise<IpcResponse> {
|
||||
return ipcRenderer.invoke('alter-scheduler', unproxify(params));
|
||||
}
|
||||
|
||||
static createScheduler (params: CreateEventParams & { uid: string }): Promise<IpcResponse> {
|
||||
return ipcRenderer.invoke('create-scheduler', unproxify(params));
|
||||
}
|
||||
|
||||
static toggleScheduler (params: { uid: string; schema: string; scheduler: string}): Promise<IpcResponse> {
|
||||
return ipcRenderer.invoke('toggle-scheduler', unproxify(params));
|
||||
}
|
||||
}
|
@ -1,89 +0,0 @@
|
||||
'use strict';
|
||||
import { ipcRenderer } from 'electron';
|
||||
import { unproxify } from '../libs/unproxify';
|
||||
|
||||
export default class {
|
||||
static createSchema (params) {
|
||||
return ipcRenderer.invoke('create-schema', unproxify(params));
|
||||
}
|
||||
|
||||
static updateSchema (params) {
|
||||
return ipcRenderer.invoke('update-schema', unproxify(params));
|
||||
}
|
||||
|
||||
static getDatabaseCollation (params) {
|
||||
return ipcRenderer.invoke('get-schema-collation', unproxify(params));
|
||||
}
|
||||
|
||||
static deleteSchema (params) {
|
||||
return ipcRenderer.invoke('delete-schema', unproxify(params));
|
||||
}
|
||||
|
||||
static getStructure (params) {
|
||||
return ipcRenderer.invoke('get-structure', unproxify(params, false));
|
||||
}
|
||||
|
||||
static getCollations (uid) {
|
||||
return ipcRenderer.invoke('get-collations', uid);
|
||||
}
|
||||
|
||||
static getVariables (uid) {
|
||||
return ipcRenderer.invoke('get-variables', uid);
|
||||
}
|
||||
|
||||
static getEngines (uid) {
|
||||
return ipcRenderer.invoke('get-engines', uid);
|
||||
}
|
||||
|
||||
static getVersion (uid) {
|
||||
return ipcRenderer.invoke('get-version', uid);
|
||||
}
|
||||
|
||||
static getProcesses (uid) {
|
||||
return ipcRenderer.invoke('get-processes', uid);
|
||||
}
|
||||
|
||||
static killProcess (params) {
|
||||
return ipcRenderer.invoke('kill-process', unproxify(params));
|
||||
}
|
||||
|
||||
static killTabQuery (params) {
|
||||
return ipcRenderer.invoke('kill-tab-query', unproxify(params));
|
||||
}
|
||||
|
||||
static commitTab (params) {
|
||||
return ipcRenderer.invoke('commit-tab', unproxify(params));
|
||||
}
|
||||
|
||||
static rollbackTab (params) {
|
||||
return ipcRenderer.invoke('rollback-tab', unproxify(params));
|
||||
}
|
||||
|
||||
static destroyConnectionToCommit (params) {
|
||||
return ipcRenderer.invoke('destroy-connection-to-commit', unproxify(params));
|
||||
}
|
||||
|
||||
static useSchema (params) {
|
||||
return ipcRenderer.invoke('use-schema', unproxify(params));
|
||||
}
|
||||
|
||||
static rawQuery (params) {
|
||||
return ipcRenderer.invoke('raw-query', unproxify(params));
|
||||
}
|
||||
|
||||
static export (params) {
|
||||
return ipcRenderer.invoke('export', unproxify(params));
|
||||
}
|
||||
|
||||
static abortExport () {
|
||||
return ipcRenderer.invoke('abort-export');
|
||||
}
|
||||
|
||||
static import (params) {
|
||||
return ipcRenderer.invoke('import-sql', unproxify(params));
|
||||
}
|
||||
|
||||
static abortImport () {
|
||||
return ipcRenderer.invoke('abort-import-sql');
|
||||
}
|
||||
}
|
128
src/renderer/ipc-api/Schema.ts
Normal file
128
src/renderer/ipc-api/Schema.ts
Normal file
@ -0,0 +1,128 @@
|
||||
import { ipcRenderer } from 'electron';
|
||||
import { unproxify } from '../libs/unproxify';
|
||||
import { IpcResponse/*, EventInfos, QueryResult, RoutineInfos, TableInfos, TriggerInfos */ } from 'common/interfaces/antares';
|
||||
import { ExportOptions } from 'common/interfaces/exporter';
|
||||
import { ImportOptions } from 'common/interfaces/importer';
|
||||
|
||||
export default class {
|
||||
static createSchema (params: { uid: string; name: string; collation?: string }): Promise<IpcResponse> {
|
||||
return ipcRenderer.invoke('create-schema', unproxify(params));
|
||||
}
|
||||
|
||||
static updateSchema (params: { uid: string; name: string; collation?: string }): Promise<IpcResponse> {
|
||||
return ipcRenderer.invoke('update-schema', unproxify(params));
|
||||
}
|
||||
|
||||
static getDatabaseCollation (params: { uid: string; database: string }) {
|
||||
return ipcRenderer.invoke('get-schema-collation', unproxify(params));
|
||||
}
|
||||
|
||||
static deleteSchema (params: { uid: string; database: string }): Promise<IpcResponse> {
|
||||
return ipcRenderer.invoke('delete-schema', unproxify(params));
|
||||
}
|
||||
|
||||
static getStructure (params: { uid: string; schemas: Set<string> }): Promise<IpcResponse/* <{
|
||||
name: string;
|
||||
size: number;
|
||||
tables: TableInfos[];
|
||||
functions: RoutineInfos[];
|
||||
procedures: RoutineInfos[];
|
||||
triggers: TriggerInfos[];
|
||||
schedulers: EventInfos[];
|
||||
}[]> */> {
|
||||
return ipcRenderer.invoke('get-structure', unproxify(params, false));
|
||||
}
|
||||
|
||||
static getCollations (uid: string): Promise<IpcResponse/* <{
|
||||
charset: string;
|
||||
collation: string;
|
||||
compiled: boolean;
|
||||
default: boolean;
|
||||
id: number;
|
||||
sortLen: number;
|
||||
}[]> */> {
|
||||
return ipcRenderer.invoke('get-collations', uid);
|
||||
}
|
||||
|
||||
static getVariables (uid: string): Promise<IpcResponse/* <{ name: string; value: string }[]> */> {
|
||||
return ipcRenderer.invoke('get-variables', uid);
|
||||
}
|
||||
|
||||
static getEngines (uid: string): Promise<IpcResponse/* <{
|
||||
name: string;
|
||||
support: string;
|
||||
comment: string;
|
||||
transactions: string;
|
||||
xa: string;
|
||||
savepoints: string;
|
||||
isDefault: boolean;
|
||||
}[]> */> {
|
||||
return ipcRenderer.invoke('get-engines', uid);
|
||||
}
|
||||
|
||||
static getVersion (uid: string): Promise<IpcResponse/* <{
|
||||
number: string;
|
||||
name: string;
|
||||
arch: string;
|
||||
os: string;
|
||||
}> */> {
|
||||
return ipcRenderer.invoke('get-version', uid);
|
||||
}
|
||||
|
||||
static getProcesses (uid: string): Promise<IpcResponse/* <{
|
||||
id: number;
|
||||
user: string;
|
||||
host: string;
|
||||
db: string;
|
||||
command: string;
|
||||
time: number;
|
||||
state: string;
|
||||
info: string;
|
||||
}[]> */> {
|
||||
return ipcRenderer.invoke('get-processes', uid);
|
||||
}
|
||||
|
||||
static killProcess (params: { uid: string; pid: string }): Promise<IpcResponse> {
|
||||
return ipcRenderer.invoke('kill-process', unproxify(params));
|
||||
}
|
||||
|
||||
static killTabQuery (params: { uid: string; tabUid: string }): Promise<IpcResponse> {
|
||||
return ipcRenderer.invoke('kill-tab-query', unproxify(params));
|
||||
}
|
||||
|
||||
static commitTab (params: { uid: string; tabUid: string }): Promise<IpcResponse> {
|
||||
return ipcRenderer.invoke('commit-tab', unproxify(params));
|
||||
}
|
||||
|
||||
static rollbackTab (params: { uid: string; tabUid: string }): Promise<IpcResponse> {
|
||||
return ipcRenderer.invoke('rollback-tab', unproxify(params));
|
||||
}
|
||||
|
||||
static destroyConnectionToCommit (params: { uid: string; tabUid: string }): Promise<IpcResponse> {
|
||||
return ipcRenderer.invoke('destroy-connection-to-commit', unproxify(params));
|
||||
}
|
||||
|
||||
static useSchema (params: { uid: string; schema: string }): Promise<IpcResponse> {
|
||||
return ipcRenderer.invoke('use-schema', unproxify(params));
|
||||
}
|
||||
|
||||
static rawQuery (params: { uid: string; query: string; schema: string; tabUid: string; autocommit?: boolean }): Promise<IpcResponse/* <QueryResult> */> {
|
||||
return ipcRenderer.invoke('raw-query', unproxify(params));
|
||||
}
|
||||
|
||||
static export (params: { uid: string; type: string; tables: string; options: ExportOptions }): Promise<IpcResponse> {
|
||||
return ipcRenderer.invoke('export', unproxify(params));
|
||||
}
|
||||
|
||||
static abortExport (): Promise<IpcResponse> {
|
||||
return ipcRenderer.invoke('abort-export');
|
||||
}
|
||||
|
||||
static import (params: ImportOptions): Promise<IpcResponse> {
|
||||
return ipcRenderer.invoke('import-sql', unproxify(params));
|
||||
}
|
||||
|
||||
static abortImport (): Promise<IpcResponse> {
|
||||
return ipcRenderer.invoke('abort-import-sql');
|
||||
}
|
||||
}
|
@ -1,69 +0,0 @@
|
||||
'use strict';
|
||||
import { ipcRenderer } from 'electron';
|
||||
import { unproxify } from '../libs/unproxify';
|
||||
|
||||
export default class {
|
||||
static getTableColumns (params) {
|
||||
return ipcRenderer.invoke('get-table-columns', unproxify(params));
|
||||
}
|
||||
|
||||
static getTableData (params) {
|
||||
return ipcRenderer.invoke('get-table-data', unproxify(params));
|
||||
}
|
||||
|
||||
static getTableApproximateCount (params) {
|
||||
return ipcRenderer.invoke('get-table-count', unproxify(params));
|
||||
}
|
||||
|
||||
static getTableOptions (params) {
|
||||
return ipcRenderer.invoke('get-table-options', unproxify(params));
|
||||
}
|
||||
|
||||
static getTableIndexes (params) {
|
||||
return ipcRenderer.invoke('get-table-indexes', unproxify(params));
|
||||
}
|
||||
|
||||
static getKeyUsage (params) {
|
||||
return ipcRenderer.invoke('get-key-usage', unproxify(params));
|
||||
}
|
||||
|
||||
static updateTableCell (params) {
|
||||
return ipcRenderer.invoke('update-table-cell', unproxify(params));
|
||||
}
|
||||
|
||||
static deleteTableRows (params) {
|
||||
return ipcRenderer.invoke('delete-table-rows', unproxify(params));
|
||||
}
|
||||
|
||||
static insertTableRows (params) {
|
||||
return ipcRenderer.invoke('insert-table-rows', unproxify(params));
|
||||
}
|
||||
|
||||
static insertTableFakeRows (params) {
|
||||
return ipcRenderer.invoke('insert-table-fake-rows', unproxify(params));
|
||||
}
|
||||
|
||||
static getForeignList (params) {
|
||||
return ipcRenderer.invoke('get-foreign-list', unproxify(params));
|
||||
}
|
||||
|
||||
static createTable (params) {
|
||||
return ipcRenderer.invoke('create-table', unproxify(params));
|
||||
}
|
||||
|
||||
static alterTable (params) {
|
||||
return ipcRenderer.invoke('alter-table', unproxify(params));
|
||||
}
|
||||
|
||||
static duplicateTable (params) {
|
||||
return ipcRenderer.invoke('duplicate-table', unproxify(params));
|
||||
}
|
||||
|
||||
static truncateTable (params) {
|
||||
return ipcRenderer.invoke('truncate-table', unproxify(params));
|
||||
}
|
||||
|
||||
static dropTable (params) {
|
||||
return ipcRenderer.invoke('drop-table', unproxify(params));
|
||||
}
|
||||
}
|
108
src/renderer/ipc-api/Tables.ts
Normal file
108
src/renderer/ipc-api/Tables.ts
Normal file
@ -0,0 +1,108 @@
|
||||
import { ipcRenderer } from 'electron';
|
||||
import { unproxify } from '../libs/unproxify';
|
||||
import { AlterTableParams, CreateTableParams, IpcResponse, TableForeign, TableIndex, TableInfos } from 'common/interfaces/antares';
|
||||
|
||||
export default class {
|
||||
static getTableColumns (params: {schema: string; table: string }): Promise<IpcResponse> {
|
||||
return ipcRenderer.invoke('get-table-columns', unproxify(params));
|
||||
}
|
||||
|
||||
static getTableData (params: {
|
||||
uid: string;
|
||||
schema: string;
|
||||
table: string;
|
||||
limit: number;
|
||||
page: number;
|
||||
sortParams: {
|
||||
field: string;
|
||||
dir: 'asc' | 'desc' ;
|
||||
};
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
where: any;
|
||||
}): Promise<IpcResponse> {
|
||||
return ipcRenderer.invoke('get-table-data', unproxify(params));
|
||||
}
|
||||
|
||||
static getTableApproximateCount (params: { uid: string; schema: string; table: string }): Promise<IpcResponse<number>> {
|
||||
return ipcRenderer.invoke('get-table-count', unproxify(params));
|
||||
}
|
||||
|
||||
static getTableOptions (params: { uid: string; schema: string; table: string }): Promise<IpcResponse<TableInfos>> {
|
||||
return ipcRenderer.invoke('get-table-options', unproxify(params));
|
||||
}
|
||||
|
||||
static getTableIndexes (params: { uid: string; schema: string; table: string }): Promise<IpcResponse<TableIndex[]>> {
|
||||
return ipcRenderer.invoke('get-table-indexes', unproxify(params));
|
||||
}
|
||||
|
||||
static getKeyUsage (params: { uid: string; schema: string; table: string }): Promise<IpcResponse<TableForeign[]>> {
|
||||
return ipcRenderer.invoke('get-key-usage', unproxify(params));
|
||||
}
|
||||
|
||||
static updateTableCell (params: {
|
||||
uid: string;
|
||||
schema: string;
|
||||
table: string;
|
||||
primary?: string;
|
||||
id: number | string;
|
||||
content: number | string | boolean | Date | Blob | null;
|
||||
type: string;
|
||||
field: string;
|
||||
}): Promise<IpcResponse> {
|
||||
return ipcRenderer.invoke('update-table-cell', unproxify(params));
|
||||
}
|
||||
|
||||
static deleteTableRows (params: {
|
||||
uid: string;
|
||||
schema: string;
|
||||
table: string;
|
||||
primary?: string;
|
||||
field: string;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
rows: {[key: string]: any};
|
||||
}): Promise<IpcResponse> {
|
||||
return ipcRenderer.invoke('delete-table-rows', unproxify(params));
|
||||
}
|
||||
|
||||
static insertTableFakeRows (params: {
|
||||
uid: string;
|
||||
schema: string;
|
||||
table: string;
|
||||
row: {[key: string]: string | number | boolean | Date | Buffer};
|
||||
repeat: number;
|
||||
fields: {[key: string]: string};
|
||||
locale: string;
|
||||
}): Promise<IpcResponse> {
|
||||
return ipcRenderer.invoke('insert-table-fake-rows', unproxify(params));
|
||||
}
|
||||
|
||||
static getForeignList (params: {
|
||||
uid: string;
|
||||
schema: string;
|
||||
table: string;
|
||||
column: string;
|
||||
description: string | false;
|
||||
}): Promise<IpcResponse> {
|
||||
return ipcRenderer.invoke('get-foreign-list', unproxify(params));
|
||||
}
|
||||
|
||||
static createTable (params: CreateTableParams): Promise<IpcResponse> {
|
||||
return ipcRenderer.invoke('create-table', unproxify(params));
|
||||
}
|
||||
|
||||
static alterTable (params: AlterTableParams): Promise<IpcResponse> {
|
||||
return ipcRenderer.invoke('alter-table', unproxify(params));
|
||||
}
|
||||
|
||||
static duplicateTable (params: { uid: string; schema: string; table: string }): Promise<IpcResponse> {
|
||||
return ipcRenderer.invoke('duplicate-table', unproxify(params));
|
||||
}
|
||||
|
||||
static truncateTable (params: { uid: string; schema: string; table: string }): Promise<IpcResponse> {
|
||||
return ipcRenderer.invoke('truncate-table', unproxify(params));
|
||||
}
|
||||
|
||||
static dropTable (params: { uid: string; schema: string; table: string }): Promise<IpcResponse> {
|
||||
return ipcRenderer.invoke('drop-table', unproxify(params));
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
'use strict';
|
||||
import { ipcRenderer } from 'electron';
|
||||
import { unproxify } from '../libs/unproxify';
|
||||
|
||||
export default class {
|
||||
static getTriggerInformations (params) {
|
||||
return ipcRenderer.invoke('get-trigger-informations', unproxify(params));
|
||||
}
|
||||
|
||||
static dropTrigger (params) {
|
||||
return ipcRenderer.invoke('drop-trigger', unproxify(params));
|
||||
}
|
||||
|
||||
static alterTrigger (params) {
|
||||
return ipcRenderer.invoke('alter-trigger', unproxify(params));
|
||||
}
|
||||
|
||||
static createTrigger (params) {
|
||||
return ipcRenderer.invoke('create-trigger', unproxify(params));
|
||||
}
|
||||
|
||||
static toggleTrigger (params) {
|
||||
return ipcRenderer.invoke('toggle-trigger', unproxify(params));
|
||||
}
|
||||
}
|
25
src/renderer/ipc-api/Triggers.ts
Normal file
25
src/renderer/ipc-api/Triggers.ts
Normal file
@ -0,0 +1,25 @@
|
||||
import { ipcRenderer } from 'electron';
|
||||
import { unproxify } from '../libs/unproxify';
|
||||
import { AlterTriggerParams, CreateTriggerParams, IpcResponse } from 'common/interfaces/antares';
|
||||
|
||||
export default class {
|
||||
static getTriggerInformations (params: { uid: string; schema: string; trigger: string }): Promise<IpcResponse> {
|
||||
return ipcRenderer.invoke('get-trigger-informations', unproxify(params));
|
||||
}
|
||||
|
||||
static dropTrigger (params: { schema: string; trigger: string }): Promise<IpcResponse> {
|
||||
return ipcRenderer.invoke('drop-trigger', unproxify(params));
|
||||
}
|
||||
|
||||
static alterTrigger (params: { trigger: AlterTriggerParams & { uid: string }}): Promise<IpcResponse> {
|
||||
return ipcRenderer.invoke('alter-trigger', unproxify(params));
|
||||
}
|
||||
|
||||
static createTrigger (params: CreateTriggerParams & { uid: string }): Promise<IpcResponse> {
|
||||
return ipcRenderer.invoke('create-trigger', unproxify(params));
|
||||
}
|
||||
|
||||
static toggleTrigger (params: { uid: string; schema: string; trigger: string }): Promise<IpcResponse> {
|
||||
return ipcRenderer.invoke('toggle-trigger', unproxify(params));
|
||||
}
|
||||
}
|
@ -1,9 +1,9 @@
|
||||
'use strict';
|
||||
import { ipcRenderer } from 'electron';
|
||||
import { unproxify } from '../libs/unproxify';
|
||||
import { IpcResponse } from 'common/interfaces/antares';
|
||||
|
||||
export default class {
|
||||
static getUsers (params) {
|
||||
static getUsers (params: string): Promise<IpcResponse> {
|
||||
return ipcRenderer.invoke('get-users', unproxify(params));
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
'use strict';
|
||||
import { ipcRenderer } from 'electron';
|
||||
import { unproxify } from '../libs/unproxify';
|
||||
|
||||
export default class {
|
||||
static getViewInformations (params) {
|
||||
return ipcRenderer.invoke('get-view-informations', unproxify(params));
|
||||
}
|
||||
|
||||
static dropView (params) {
|
||||
return ipcRenderer.invoke('drop-view', unproxify(params));
|
||||
}
|
||||
|
||||
static alterView (params) {
|
||||
return ipcRenderer.invoke('alter-view', unproxify(params));
|
||||
}
|
||||
|
||||
static createView (params) {
|
||||
return ipcRenderer.invoke('create-view', unproxify(params));
|
||||
}
|
||||
}
|
21
src/renderer/ipc-api/Views.ts
Normal file
21
src/renderer/ipc-api/Views.ts
Normal file
@ -0,0 +1,21 @@
|
||||
import { ipcRenderer } from 'electron';
|
||||
import { unproxify } from '../libs/unproxify';
|
||||
import { AlterViewParams, CreateViewParams, IpcResponse } from 'common/interfaces/antares';
|
||||
|
||||
export default class {
|
||||
static getViewInformations (params: { uid: string; schema: string; view: string }): Promise<IpcResponse> {
|
||||
return ipcRenderer.invoke('get-view-informations', unproxify(params));
|
||||
}
|
||||
|
||||
static dropView (params: { uid: string; schema: string; view: string }): Promise<IpcResponse> {
|
||||
return ipcRenderer.invoke('drop-view', unproxify(params));
|
||||
}
|
||||
|
||||
static alterView (params: { view: AlterViewParams & { uid: string }}): Promise<IpcResponse> {
|
||||
return ipcRenderer.invoke('alter-view', unproxify(params));
|
||||
}
|
||||
|
||||
static createView (params: CreateViewParams & { uid: string }): Promise<IpcResponse> {
|
||||
return ipcRenderer.invoke('create-view', unproxify(params));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user