1
1
mirror of https://github.com/Fabio286/antares.git synced 2025-06-05 21:59:22 +02:00

Compare commits

..

9 Commits

Author SHA1 Message Date
dependabot[bot]
6fd14da52f chore(deps): bump @faker-js/faker from 6.1.2 to 9.7.0
Bumps [@faker-js/faker](https://github.com/faker-js/faker) from 6.1.2 to 9.7.0.
- [Release notes](https://github.com/faker-js/faker/releases)
- [Changelog](https://github.com/faker-js/faker/blob/next/CHANGELOG.md)
- [Commits](https://github.com/faker-js/faker/compare/v6.1.2...v9.7.0)

---
updated-dependencies:
- dependency-name: "@faker-js/faker"
  dependency-version: 9.7.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-05-01 19:17:02 +00:00
d93ae90373 chore(release): 0.7.35-beta.1 2025-04-28 11:23:30 +02:00
86f50521d0 fix(MySQL): handle absence of CHECK_CONSTRAINTS table, fixes #981 2025-04-28 11:03:18 +02:00
c966cc4266 Merge pull request #982 from bagusindrayana/fix_undefined_send
fix : Cannot read properties of undefined (reading 'send') in mac os
2025-04-28 09:51:27 +02:00
85e516dec0 chore: move dmg-license to optionalDependencies 2025-04-28 09:44:24 +02:00
Bagus Indrayana
0b07ee1a87 refactor: update logic to find webcontents that have send function 2025-04-28 14:44:54 +08:00
Bagus Indrayana
838810981c chore: audit fix, dmg-license to build mac 2025-04-28 11:52:26 +08:00
Bagus Indrayana
b3cf20101b fix: if webcontents with id 1 not found use first webcontents 2025-04-28 11:47:20 +08:00
994aa69fd0 fix: improve SQL parameter escaping in update-table-cell, ensuring correct handling of id types 2025-04-14 10:04:55 +02:00
7 changed files with 1617 additions and 507 deletions

View File

@@ -2,6 +2,16 @@
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
### [0.7.35-beta.1](https://github.com/antares-sql/antares/compare/v0.7.35-beta.0...v0.7.35-beta.1) (2025-04-28)
### Bug Fixes
* handle id type correctly in update-table-cell where clause, fixes [#974](https://github.com/antares-sql/antares/issues/974) ([8f84892](https://github.com/antares-sql/antares/commit/8f84892f079e5eb56c69170eb4f7bbbebd1fda72))
* if webcontents with id 1 not found use first webcontents ([b3cf201](https://github.com/antares-sql/antares/commit/b3cf20101b938a4b47c454c7a94b32b3820bce8e))
* improve SQL parameter escaping in update-table-cell, ensuring correct handling of id types ([994aa69](https://github.com/antares-sql/antares/commit/994aa69fd00afc7e24e593b1a6c6667535e090c2))
* **MySQL:** handle absence of CHECK_CONSTRAINTS table, fixes [#981](https://github.com/antares-sql/antares/issues/981) ([86f5052](https://github.com/antares-sql/antares/commit/86f50521d05da0afdc9506d74e6ab007e2ae0a84))
### [0.7.35-beta.0](https://github.com/antares-sql/antares/compare/v0.7.34...v0.7.35-beta.0) (2025-04-04)

1984
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,7 @@
{
"name": "antares",
"productName": "Antares",
"version": "0.7.35-beta.0",
"version": "0.7.35-beta.1",
"description": "A modern, fast and productivity driven SQL client with a focus in UX.",
"license": "MIT",
"repository": "https://github.com/antares-sql/antares.git",
@@ -121,7 +121,7 @@
"dependencies": {
"@electron/remote": "~2.1.2",
"@fabio286/ssh2-promise": "~1.0.4-b",
"@faker-js/faker": "~6.1.2",
"@faker-js/faker": "~9.7.0",
"@jamescoyle/vue-icon": "~0.1.2",
"@mdi/js": "~7.2.96",
"@turf/helpers": "~6.5.0",
@@ -214,5 +214,8 @@
"vue-eslint-parser": "~8.3.0",
"webpack-dev-server": "~4.11.1",
"xvfb-maybe": "~0.2.1"
},
"optionalDependencies": {
"dmg-license": "~1.0.11"
}
}

View File

@@ -135,7 +135,7 @@ export default (connections: Record<string, antares.Client>) => {
try { // TODO: move to client classes
let escapedParam;
let reload = false;
const id = typeof params.id === 'number' ? params.id : `${sw}${params.id}${sw}`;
const id = typeof params.id === 'number' ? params.id : `${sw}${sqlEscaper(params.id)}${sw}`;
if ([...NUMBER, ...FLOAT].includes(params.type))
escapedParam = params.content;
@@ -221,7 +221,7 @@ export default (connections: Record<string, antares.Client>) => {
.update({ [params.field]: `= ${escapedParam}` })
.schema(params.schema)
.from(params.table)
.where({ [params.primary]: `= ${typeof id === 'string' ? sqlEscaper(id) : id}` })
.where({ [params.primary]: `= ${id}` })
.limit(1)
.run();
}

View File

@@ -696,7 +696,12 @@ export class MySQLClient extends BaseClient {
return rows.length ? rows[0].count : 0;
}
async getTableChecks ({ schema, table }: { schema: string; table: string }): Promise<antares.TableCheck[]> {
async getTableChecks ({ schema, table }: { schema: string; table: string }): Promise<antares.TableCheck[] | false> {
const { rows: checkTableExists } = await this.raw('SELECT table_name FROM information_schema.tables WHERE table_schema = "information_schema" AND table_name = "CHECK_CONSTRAINTS"');
if (!checkTableExists.length)// check if CHECK_CONSTRAINTS table exists
return false;
const { rows } = await this.raw(`
SELECT
CONSTRAINT_NAME as name,

View File

@@ -3,7 +3,13 @@ export type LoggerLevel = 'query' | 'error'
export const ipcLogger = ({ content, cUid, level }: {content: string; cUid: string; level: LoggerLevel}) => {
if (level === 'error') {
if (process.type !== undefined) {
const mainWindow = require('electron').webContents.fromId(1);
const contents = require('electron').webContents.getAllWebContents();
let mainWindow = require('electron').webContents.fromId(1);
contents.forEach(content => {
if (content.send && mainWindow === undefined) {
mainWindow = content;
}
});
mainWindow.send('non-blocking-exception', { cUid, message: content, date: new Date() });
}
if (process.env.NODE_ENV === 'development' && process.type === 'browser') console.log(content);
@@ -12,7 +18,13 @@ export const ipcLogger = ({ content, cUid, level }: {content: string; cUid: stri
// Remove comments, newlines and multiple spaces
const escapedSql = content.replace(/(\/\*(.|[\r\n])*?\*\/)|(--(.*|[\r\n]))/gm, '').replace(/\s\s+/g, ' ');
if (process.type !== undefined) {
const mainWindow = require('electron').webContents.fromId(1);
const contents = require('electron').webContents.getAllWebContents();
let mainWindow = require('electron').webContents.fromId(1);
contents.forEach(content => {
if (content.send && mainWindow === undefined) {
mainWindow = content;
}
});
mainWindow.send('query-log', { cUid, sql: escapedSql, date: new Date() });
}
if (process.env.NODE_ENV === 'development' && process.type === 'browser') console.log(escapedSql);

View File

@@ -73,7 +73,7 @@
<span>{{ t('database.foreignKeys') }}</span>
</button>
<button
v-if="workspace.customizations.tableCheck"
v-if="workspace.customizations.tableCheck && originalTableChecks !== false"
class="btn btn-dark btn-sm ml-2 mr-0"
:disabled="isSaving"
:title="t('database.manageTableChecks')"
@@ -234,7 +234,7 @@
/>
<WorkspaceTabPropsTableChecksModal
v-if="isTableChecksModal"
:local-checks="localTableChecks"
:local-checks="localTableChecks || []"
:table="table"
:workspace="workspace"
@hide="hideTableChecksModal"
@@ -305,8 +305,8 @@ const originalKeyUsage: Ref<TableForeign[]> = ref([]);
const localKeyUsage: Ref<TableForeign[]> = ref([]);
const originalIndexes: Ref<TableIndex[]> = ref([]);
const localIndexes: Ref<TableIndex[]> = ref([]);
const originalTableChecks: Ref<TableCheck[]> = ref([]);
const localTableChecks: Ref<TableCheck[]> = ref([]);
const originalTableChecks: Ref<TableCheck[] | false> = ref([]);
const localTableChecks: Ref<TableCheck[] | false> = ref(false);
const tableOptions: Ref<TableOptions> = ref(null);
const localOptions: Ref<TableOptions> = ref({} as TableOptions);
const lastTable = ref(null);
@@ -465,13 +465,19 @@ const getFieldsData = async () => {
const { status, response } = await Tables.getTableChecks(params);
if (status === 'success') {
originalTableChecks.value = response.map((check: TableCheck) => {
return {
_antares_id: uidGen(),
...check
};
});
localTableChecks.value = JSON.parse(JSON.stringify(originalTableChecks.value));
if (response === false) {
originalTableChecks.value = false;
localTableChecks.value = false;
}
else {
originalTableChecks.value = response.map((check: TableCheck) => {
return {
_antares_id: uidGen(),
...check
};
});
localTableChecks.value = JSON.parse(JSON.stringify(originalTableChecks.value));
}
}
else
addNotification({ status: 'error', message: response });
@@ -576,32 +582,68 @@ const saveChanges = async () => {
// Foreigns Deletions
foreignChanges.deletions = originalKeyUsage.value.filter(foreign => !localForeignIDs.includes(foreign._antares_id));
// CHECKS
if (originalTableChecks.value !== false && localTableChecks.value !== false) {
const checkChanges = {
additions: [] as TableCheck[],
changes: [] as TableCheck[],
deletions: [] as TableCheck[]
};
const originalCheckIDs = originalTableChecks.value.reduce((acc, curr) => [...acc, curr._antares_id], []);
const localCheckIDs = localTableChecks.value.reduce((acc, curr) => [...acc, curr._antares_id], []);
// Check Additions
checkChanges.additions = localTableChecks.value.filter(check => !originalCheckIDs.includes(check._antares_id));
// Check Changes
originalTableChecks.value.forEach(originalCheck => {
const lI = Array.isArray(localTableChecks.value)
? localTableChecks.value.findIndex(localCheck => localCheck._antares_id === originalCheck._antares_id)
: -1;
if (Array.isArray(localTableChecks.value) && JSON.stringify(originalCheck) !== JSON.stringify(localTableChecks.value[lI])) {
if (localTableChecks.value[lI]) {
checkChanges.changes.push({
...localTableChecks.value[lI]
});
}
}
});
// Check Deletions
checkChanges.deletions = originalTableChecks.value.filter(check => !localCheckIDs.includes(check._antares_id));
}
// CHECKS
const checkChanges = {
additions: [] as TableCheck[],
changes: [] as TableCheck[],
deletions: [] as TableCheck[]
};
const originalCheckIDs = originalTableChecks.value.reduce((acc, curr) => [...acc, curr._antares_id], []);
const localCheckIDs = localTableChecks.value.reduce((acc, curr) => [...acc, curr._antares_id], []);
// Check Additions
checkChanges.additions = localTableChecks.value.filter(check => !originalCheckIDs.includes(check._antares_id));
if (originalTableChecks.value !== false && localTableChecks.value !== false) {
const originalCheckIDs = originalTableChecks.value.reduce((acc, curr) => [...acc, curr._antares_id], []);
const localCheckIDs = localTableChecks.value.reduce((acc, curr) => [...acc, curr._antares_id], []);
// Check Changes
originalTableChecks.value.forEach(originalCheck => {
const lI = localTableChecks.value.findIndex(localCheck => localCheck._antares_id === originalCheck._antares_id);
if (JSON.stringify(originalCheck) !== JSON.stringify(localTableChecks.value[lI])) {
if (localTableChecks.value[lI]) {
checkChanges.changes.push({
...localTableChecks.value[lI]
});
// Check Additions
checkChanges.additions = localTableChecks.value.filter(check => !originalCheckIDs.includes(check._antares_id));
// Check Changes
originalTableChecks.value.forEach(originalCheck => {
const lI = Array.isArray(localTableChecks.value)
? localTableChecks.value.findIndex(localCheck => localCheck._antares_id === originalCheck._antares_id)
: -1;
if (Array.isArray(localTableChecks.value) && JSON.stringify(originalCheck) !== JSON.stringify(localTableChecks.value[lI])) {
if (localTableChecks.value[lI]) {
checkChanges.changes.push({
...localTableChecks.value[lI]
});
}
}
}
});
});
// Check Deletions
checkChanges.deletions = originalTableChecks.value.filter(check => !localCheckIDs.includes(check._antares_id));
// Check Deletions
checkChanges.deletions = originalTableChecks.value.filter(check => !localCheckIDs.includes(check._antares_id));
}
// ALTER
const params = {