Merge pull request #1 from dbgate/master

update
This commit is contained in:
Quentin Laffont 2022-11-04 08:08:05 +01:00 committed by GitHub
commit 8c051ff5f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
56 changed files with 65 additions and 77 deletions

View File

@ -9,7 +9,7 @@ import {
AllowIdentityInsert,
Expression,
} from 'dbgate-sqltree';
import { NamedObjectInfo, DatabaseInfo } from 'dbgate-types';
import type { NamedObjectInfo, DatabaseInfo } from 'dbgate-types';
export interface ChangeSetItem {
pureName: string;

View File

@ -1,6 +1,6 @@
import _ from 'lodash';
import { GridDisplay, ChangeCacheFunc, ChangeConfigFunc, DisplayColumn } from './GridDisplay';
import { EngineDriver, ViewInfo, ColumnInfo, CollectionInfo } from 'dbgate-types';
import type { EngineDriver, ViewInfo, ColumnInfo, CollectionInfo } from 'dbgate-types';
import { GridConfig, GridCache } from './GridConfig';
function getObjectKeys(obj) {

View File

@ -1,6 +1,6 @@
import _ from 'lodash';
import { GridConfig, GridCache, GridConfigColumns, createGridCache, GroupFunc } from './GridConfig';
import { TableInfo, EngineDriver, DatabaseInfo, SqlDialect } from 'dbgate-types';
import type { TableInfo, EngineDriver, DatabaseInfo, SqlDialect } from 'dbgate-types';
import { getFilterValueExpression } from 'dbgate-filterparser';
import { ChangeCacheFunc, ChangeConfigFunc, DisplayColumn } from './GridDisplay';

View File

@ -1,5 +1,5 @@
import _ from 'lodash';
import { EngineDriver, ViewInfo, ColumnInfo } from 'dbgate-types';
import type { EngineDriver, ViewInfo, ColumnInfo } from 'dbgate-types';
import { GridDisplay, ChangeCacheFunc, ChangeConfigFunc } from './GridDisplay';
import { GridConfig, GridCache } from './GridConfig';
import { FreeTableModel } from './FreeTableModel';

View File

@ -1,4 +1,4 @@
import { TableInfo } from 'dbgate-types';
import type { TableInfo } from 'dbgate-types';
export interface FreeTableModel {
structure: TableInfo;

View File

@ -1,6 +1,3 @@
import { DisplayColumn } from './GridDisplay';
import { TableInfo } from 'dbgate-types';
export interface GridConfigColumns {
hiddenColumns: string[];
expandedColumns: string[];

View File

@ -1,6 +1,6 @@
import _ from 'lodash';
import { GridConfig, GridCache, GridConfigColumns, createGridCache, GroupFunc, createGridConfig } from './GridConfig';
import {
import type {
ForeignKeyInfo,
TableInfo,
ColumnInfo,

View File

@ -1,6 +1,5 @@
import _ from 'lodash';
import { GridDisplay, ChangeCacheFunc, ChangeConfigFunc } from './GridDisplay';
import { QueryResultColumn } from 'dbgate-types';
import { GridConfig, GridCache } from './GridConfig';
import { analyseCollectionDisplayColumns } from './CollectionGridDisplay';

View File

@ -1,4 +1,3 @@
import { RangeDefinition } from 'dbgate-types';
import { PerspectiveDataLoadProps } from './PerspectiveDataProvider';
import _pick from 'lodash/pick';
import _zip from 'lodash/zip';

View File

@ -1,4 +1,4 @@
import { DatabaseInfo, ForeignKeyInfo, NamedObjectInfo, TableInfo } from 'dbgate-types';
import type { DatabaseInfo, ForeignKeyInfo, NamedObjectInfo, TableInfo } from 'dbgate-types';
import uuidv1 from 'uuid/v1';
// export interface PerspectiveConfigColumns {

View File

@ -1,6 +1,6 @@
import debug from 'debug';
import { Condition } from 'dbgate-sqltree';
import { RangeDefinition } from 'dbgate-types';
import type { RangeDefinition } from 'dbgate-types';
import { PerspectiveBindingGroup, PerspectiveCache } from './PerspectiveCache';
import { PerspectiveDataLoader } from './PerspectiveDataLoader';
import { PerspectiveDataPatternDict } from './PerspectiveDataPattern';

View File

@ -1,4 +1,4 @@
import {
import type {
CollectionInfo,
ColumnInfo,
DatabaseInfo,

View File

@ -1,7 +1,7 @@
import { FormViewDisplay } from './FormViewDisplay';
import _ from 'lodash';
import { ChangeCacheFunc, DisplayColumn, ChangeConfigFunc } from './GridDisplay';
import { EngineDriver, NamedObjectInfo, DatabaseInfo } from 'dbgate-types';
import type { EngineDriver, NamedObjectInfo, DatabaseInfo } from 'dbgate-types';
import { GridConfig, GridCache } from './GridConfig';
import { mergeConditions, Condition, OrderByExpression } from 'dbgate-sqltree';
import { TableGridDisplay } from './TableGridDisplay';

View File

@ -1,7 +1,7 @@
import _ from 'lodash';
import { filterName, isTableColumnUnique } from 'dbgate-tools';
import { GridDisplay, ChangeCacheFunc, DisplayColumn, DisplayedColumnInfo, ChangeConfigFunc } from './GridDisplay';
import {
import type {
TableInfo,
EngineDriver,
ViewInfo,

View File

@ -1,6 +1,6 @@
import _ from 'lodash';
import { GridDisplay, ChangeCacheFunc, ChangeConfigFunc } from './GridDisplay';
import { EngineDriver, ViewInfo, ColumnInfo } from 'dbgate-types';
import type { EngineDriver, ViewInfo, ColumnInfo } from 'dbgate-types';
import { GridConfig, GridCache } from './GridConfig';
export class ViewGridDisplay extends GridDisplay {

View File

@ -1,6 +1,6 @@
import _ from 'lodash';
import { Command, Insert, Update, Delete, UpdateField, Condition, AllowIdentityInsert } from 'dbgate-sqltree';
import { NamedObjectInfo, DatabaseInfo, ForeignKeyInfo, TableInfo } from 'dbgate-types';
import type { NamedObjectInfo, DatabaseInfo, ForeignKeyInfo, TableInfo } from 'dbgate-types';
import { ChangeSet, ChangeSetItem, extractChangeSetCondition } from './ChangeSet';
export interface ChangeSetDeleteCascade {

View File

@ -1,5 +1,5 @@
import { findForeignKeyForColumn } from 'dbgate-tools';
import { DatabaseInfo, TableInfo, ViewInfo } from 'dbgate-types';
import type { DatabaseInfo, TableInfo, ViewInfo } from 'dbgate-types';
import { createPerspectiveNodeConfig, MultipleDatabaseInfo, PerspectiveConfig } from './PerspectiveConfig';
import { PerspectiveDataPattern, PerspectiveDataPatternDict } from './PerspectiveDataPattern';
import { PerspectiveTableNode } from './PerspectiveTreeNode';

View File

@ -1,4 +1,4 @@
import { DatabaseInfo } from 'dbgate-types';
import type { DatabaseInfo } from 'dbgate-types';
export const chinookDbInfo: DatabaseInfo = {
tables: [

View File

@ -2,7 +2,7 @@ import P from 'parsimmon';
import moment from 'moment';
import { FilterType } from './types';
import { Condition } from 'dbgate-sqltree';
import { TransformType } from 'dbgate-types';
import type { TransformType } from 'dbgate-types';
import { interpretEscapes, token, word, whitespace } from './common';
const compoudCondition = conditionType => conditions => {

View File

@ -2,7 +2,6 @@ import P from 'parsimmon';
import moment from 'moment';
import { FilterType } from './types';
import { Condition } from 'dbgate-sqltree';
import { TransformType } from 'dbgate-types';
import { interpretEscapes, token, word, whitespace } from './common';
import { mongoParser } from './mongoParser';
import { datetimeParser } from './datetimeParser';

View File

@ -1,4 +1,4 @@
import { SqlDumper } from 'dbgate-types';
import type { SqlDumper } from 'dbgate-types';
import { Command, Select, Update, Delete, Insert } from './types';
import { dumpSqlExpression } from './dumpSqlExpression';
import { dumpSqlFromDefinition, dumpSqlSourceRef } from './dumpSqlSource';

View File

@ -1,4 +1,4 @@
import { SqlDumper } from 'dbgate-types';
import type { SqlDumper } from 'dbgate-types';
import { Condition, BinaryCondition } from './types';
import { dumpSqlExpression } from './dumpSqlExpression';
import { dumpSqlSelect } from './dumpSqlCommand';

View File

@ -1,5 +1,5 @@
import _ from 'lodash';
import { SqlDumper } from 'dbgate-types';
import type { SqlDumper } from 'dbgate-types';
import { Expression, ColumnRefExpression } from './types';
import { dumpSqlSourceRef } from './dumpSqlSource';

View File

@ -1,5 +1,5 @@
import { Source, FromDefinition, Relation } from './types';
import { SqlDumper } from 'dbgate-types';
import type { SqlDumper } from 'dbgate-types';
import { dumpSqlSelect } from './dumpSqlCommand';
import { dumpSqlCondition } from './dumpSqlCondition';

View File

@ -1,10 +1,6 @@
import { SqlDumper } from 'dbgate-types';
import _ from 'lodash';
import { Condition, BinaryCondition } from './types';
import { dumpSqlExpression } from './dumpSqlExpression';
import { link } from 'fs';
import { evaluateExpression } from './evaluateExpression';
import { cond } from 'lodash';
function isEmpty(value) {
if (value == null) return true;

View File

@ -1,4 +1,4 @@
import { NamedObjectInfo, RangeDefinition, TransformType } from 'dbgate-types';
import type { NamedObjectInfo, RangeDefinition, TransformType } from 'dbgate-types';
// export interface Command {
// }

View File

@ -1,4 +1,4 @@
import { EngineDriver, SqlDumper } from 'dbgate-types';
import type { EngineDriver, SqlDumper } from 'dbgate-types';
import { Command, Condition } from './types';
import { dumpSqlCommand } from './dumpSqlCommand';

View File

@ -1,5 +1,5 @@
import _ from 'lodash';
import {
import type {
ColumnInfo,
ConstraintInfo,
EngineDriver,

View File

@ -1,4 +1,4 @@
import {
import type {
DatabaseInfo,
EngineDriver,
FunctionInfo,

View File

@ -1,5 +1,5 @@
import { DbDiffOptions, testEqualColumns, testEqualTables, testEqualSqlObjects } from './diffTools';
import { DatabaseInfo, EngineDriver, SqlObjectInfo, TableInfo } from 'dbgate-types';
import type { DatabaseInfo, EngineDriver, SqlObjectInfo, TableInfo } from 'dbgate-types';
import _ from 'lodash';
export function computeDiffRowsCore(sourceList, targetList, testEqual) {

View File

@ -1,4 +1,3 @@
import { EngineDriver } from 'dbgate-types';
import _intersection from 'lodash/intersection';
import { prepareTableForImport } from './tableTransforms';

View File

@ -1,4 +1,4 @@
import {
import type {
ColumnInfo,
ConstraintInfo,
DatabaseInfo,

View File

@ -1,6 +1,6 @@
import _cloneDeep from 'lodash/cloneDeep';
import _isString from 'lodash/isString';
import {
import type {
ColumnInfo,
ColumnReference,
DatabaseInfo,

View File

@ -1,4 +1,4 @@
import { EngineDriver, ExtensionsDirectory } from 'dbgate-types';
import type { EngineDriver, ExtensionsDirectory } from 'dbgate-types';
import _camelCase from 'lodash/camelCase';
import _isString from 'lodash/isString';
import _isPlainObject from 'lodash/isPlainObject';

View File

@ -1,5 +1,5 @@
import _ from 'lodash';
import { DatabaseInfo, EngineDriver } from 'dbgate-types';
import type { DatabaseInfo, EngineDriver } from 'dbgate-types';
export async function enrichWithPreloadedRows(
dbModel: DatabaseInfo,

View File

@ -1,6 +1,6 @@
import uuidv1 from 'uuid/v1';
import _omit from 'lodash/omit';
import {
import type {
ColumnInfo,
ConstraintInfo,
ForeignKeyInfo,

View File

@ -1,4 +1,4 @@
import { DatabaseInfo, TableInfo, ApplicationDefinition, ViewInfo, CollectionInfo } from 'dbgate-types';
import type { DatabaseInfo, TableInfo, ApplicationDefinition, ViewInfo, CollectionInfo } from 'dbgate-types';
import _flatten from 'lodash/flatten';
export function addTableDependencies(db: DatabaseInfo): DatabaseInfo {

View File

@ -1,4 +1,4 @@
import { TableInfo } from 'dbgate-types';
import type { TableInfo } from 'dbgate-types';
import _cloneDeep from 'lodash/cloneDeep';
import _fromPairs from 'lodash/fromPairs';
import _get from 'lodash/get';

View File

@ -29,7 +29,7 @@
$: currentThemeType = $currentThemeDefinition?.themeType == 'dark' ? 'theme-type-dark' : 'theme-type-light';
$: themeStyle = `<style id="themePlugin">${$currentThemeDefinition?.themeCss}</style>`;
$: themeStyle = `<st` + `yle id="themePlugin">${$currentThemeDefinition?.themeCss}</st` + `yle>`;
const isElectron = !!getElectron();
</script>

View File

@ -16,7 +16,7 @@
tabComponent,
tooltip,
props: {
savedFile:fileName + '.' + fileType,
savedFile: fileName + '.' + fileType,
savedFolder: 'app:' + folderName,
savedFormat: 'text',
appFolder: folderName,
@ -28,7 +28,10 @@
}
export const extractKey = data => data.fileName;
export const createMatcher = ({ fileName }) => filter => filterName(filter, fileName);
export const createMatcher =
({ fileName }) =>
filter =>
filterName(filter, fileName);
const APP_ICONS = {
'config.json': 'img json',
'command.sql': 'img app-command',
@ -50,7 +53,6 @@
import InputTextModal from '../modals/InputTextModal.svelte';
import ConfirmModal from '../modals/ConfirmModal.svelte';
import { apiCall } from '../utility/api';
import { currentDatabase, currentDatabase } from '../stores';
export let data;

View File

@ -1,5 +1,5 @@
import { dumpSqlSelect, Select } from 'dbgate-sqltree';
import { EngineDriver } from 'dbgate-types';
import type { Select } from 'dbgate-sqltree';
import type { EngineDriver } from 'dbgate-types';
import _ from 'lodash';
import { apiCall } from '../utility/api';

View File

@ -1,6 +1,6 @@
import { tick } from 'svelte';
import { commands } from '../stores';
import { GlobalCommand } from './registerCommand';
import type { GlobalCommand } from './registerCommand';
let isInvalidated = false;

View File

@ -1,7 +1,5 @@
import _ from 'lodash';
import { dumpSqlSelect, Select, JoinType, Condition, Relation, mergeConditions, Source } from 'dbgate-sqltree';
import { EngineDriver } from 'dbgate-types';
import { DesignerInfo, DesignerTableInfo, DesignerReferenceInfo, DesignerJoinType } from './types';
import type { DesignerInfo, DesignerTableInfo, DesignerReferenceInfo, DesignerJoinType } from './types';
import { findPrimaryTable, findConnectingReference, referenceIsJoin, referenceIsExists } from './designerTools';
export class DesignerComponent {

View File

@ -10,7 +10,6 @@ import {
ResultField,
Expression,
} from 'dbgate-sqltree';
import { EngineDriver } from 'dbgate-types';
import { DesignerInfo, DesignerTableInfo, DesignerReferenceInfo, DesignerJoinType } from './types';
import { DesignerComponent } from './DesignerComponentCreator';
import {

View File

@ -1,7 +1,8 @@
import _ from 'lodash';
import { dumpSqlSelect, Select, JoinType, Condition, Relation, mergeConditions, Source } from 'dbgate-sqltree';
import { EngineDriver } from 'dbgate-types';
import { DesignerInfo, DesignerTableInfo, DesignerReferenceInfo, DesignerJoinType } from './types';
import type { Select, Condition, Source } from 'dbgate-sqltree';
import { dumpSqlSelect, mergeConditions } from 'dbgate-sqltree';
import type { EngineDriver } from 'dbgate-types';
import type { DesignerInfo, DesignerTableInfo, DesignerReferenceInfo, DesignerJoinType } from './types';
import { DesignerComponentCreator } from './DesignerComponentCreator';
import { DesignerQueryDumper } from './DesignerQueryDumper';
import { getFilterType } from 'dbgate-filterparser';

View File

@ -1,5 +1,5 @@
import { JoinType } from 'dbgate-sqltree';
import { TableInfo } from 'dbgate-types';
import type { JoinType } from 'dbgate-sqltree';
import type { TableInfo } from 'dbgate-types';
export type DesignerTableInfo = TableInfo & {
designerId: string;

View File

@ -23,7 +23,7 @@
{:else}
<span class="null"> (no image)</span>
{/if}
{:else if !value.$oid && (_.isArray(value) || _.isPlainObject(value))}
{:else if !value?.$oid && (_.isArray(value) || _.isPlainObject(value))}
<JSONTree {value} slicedKeyCount={1} disableContextMenu />
{:else}
<CellValue {rowData} {value} />

View File

@ -8,7 +8,7 @@
PerspectiveTreeNode,
switchPerspectiveReferenceDirection,
} from 'dbgate-datalib';
import { CollectionInfo } from 'dbgate-types';
import type { CollectionInfo } from 'dbgate-types';
import _ from 'lodash';
import { tick } from 'svelte';
import runCommand from '../commands/runCommand';

View File

@ -1,4 +1,4 @@
import { FileFormatDefinition, QuickExportDefinition } from 'dbgate-types';
import type { FileFormatDefinition, QuickExportDefinition } from 'dbgate-types';
const jsonlFormat = {
storageType: 'jsonl',

View File

@ -1,5 +1,5 @@
<script lang="ts">
import { ThemeDefinition } from 'dbgate-types';
import type { ThemeDefinition } from 'dbgate-types';
import FontIcon from '../icons/FontIcon.svelte';
import { currentTheme } from '../stores';
import _ from 'lodash';

View File

@ -1,5 +1,5 @@
import { writable, derived, readable } from 'svelte/store';
import { ExtensionsDirectory } from 'dbgate-types';
import type { ExtensionsDirectory } from 'dbgate-types';
import invalidateCommands from './commands/invalidateCommands';
import getElectron from './utility/getElectron';
import { getSettings, useConfig, useSettings } from './utility/metadataLoaders';

View File

@ -1,4 +1,4 @@
import { ApplicationDefinition, StoredConnection } from 'dbgate-types';
import type { ApplicationDefinition, StoredConnection } from 'dbgate-types';
import { apiCall } from '../utility/api';
export async function saveDbToApp(conid: string, database: string, app: string) {

View File

@ -1,4 +1,4 @@
import { QuickExportDefinition } from 'dbgate-types';
import type { QuickExportDefinition } from 'dbgate-types';
import { getExtensions } from '../stores';
export function createQuickExportMenuItems(handler: (fmt: QuickExportDefinition) => Function, advancedExportMenuItem) {

View File

@ -1,5 +1,5 @@
import { DictionaryDescription } from 'dbgate-datalib';
import { ApplicationDefinition, TableInfo } from 'dbgate-types';
import type { ApplicationDefinition, TableInfo } from 'dbgate-types';
import _ from 'lodash';
import { apiCall } from './api';
import { filterAppsForDatabase, saveDbToApp } from './appTools';

View File

@ -1,8 +1,6 @@
import _ from 'lodash';
import { loadCachedValue, subscribeCacheChange, unsubscribeCacheChange } from './cache';
import stableStringify from 'json-stable-stringify';
import getAsArray from './getAsArray';
import { DatabaseInfo } from 'dbgate-types';
import { derived } from 'svelte/store';
import { extendDatabaseInfo } from 'dbgate-tools';
import { setLocalStorage } from '../utility/storageCache';

View File

@ -48,16 +48,17 @@ const driver = {
...driverBase,
analyserClass: Analyser,
async connect({ server, port, user, password, database, useDatabaseUrl, databaseUrl, ssl }) {
// let mongoUrl = databaseUrl;
// if (!useDatabaseUrl) {
// mongoUrl = user ? `mongodb://${user}:${password}@${server}:${port}` : `mongodb://${server}:${port}`;
// if (database) mongoUrl += '/' + database;
// }
const mongoUrl = useDatabaseUrl
? databaseUrl
: user
let mongoUrl;
if (useDatabaseUrl) {
// change port to ssh tunnel port
const url = new URL(databaseUrl);
url.port = port;
mongoUrl = url.href;
} else {
mongoUrl = user
? `mongodb://${user}:${password}@${server}:${port}`
: `mongodb://${server}:${port}`;
}
const options = {
useUnifiedTopology: true,