@adecore/database 0.62.1 → 0.63.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/DatabaseProvider.d.ts +1 -1
- package/dist/client/types.js +0 -1
- package/dist/client-context.d.ts +3 -2
- package/dist/connections/EngineIcon.d.ts +2 -1
- package/dist/connections/docker.js +0 -3
- package/dist/connections/use-docker-containers.d.ts +2 -1
- package/dist/console/DestructiveDialog.d.ts +2 -1
- package/dist/console/HistoryPanel.d.ts +2 -1
- package/dist/console/QueryConsole.js +0 -3
- package/dist/console/SchemaPicker.d.ts +2 -1
- package/dist/console/StatementResultView.d.ts +2 -1
- package/dist/console/TransactionControls.d.ts +2 -1
- package/dist/console/labels.js +0 -1
- package/dist/console/useConsoleHistory.d.ts +2 -1
- package/dist/ddl/alter-sqlite.js +0 -1
- package/dist/ddl/alter.js +0 -1
- package/dist/ddl/column.d.ts +2 -1
- package/dist/ddl/column.js +0 -1
- package/dist/ddl/create.d.ts +2 -1
- package/dist/ddl/create.js +0 -2
- package/dist/ddl/dialect.js +0 -1
- package/dist/ddl/diff.d.ts +4 -3
- package/dist/ddl/diff.js +0 -3
- package/dist/ddl/draft.js +0 -2
- package/dist/ddl/parse.js +0 -4
- package/dist/designer/ColumnsEditor.js +0 -1
- package/dist/designer/DesignerView.js +0 -1
- package/dist/designer/ForeignKeysEditor.d.ts +2 -1
- package/dist/designer/NamePicker.d.ts +2 -1
- package/dist/designer/SqlPreview.d.ts +2 -1
- package/dist/designer/SqlPreview.js +0 -2
- package/dist/designer/TableDesigner.js +0 -1
- package/dist/designer/edit.js +0 -1
- package/dist/designer/plan.js +0 -1
- package/dist/explorer/DatabaseExplorer.js +0 -1
- package/dist/explorer/RowMenu.d.ts +2 -1
- package/dist/explorer/TableDialog.d.ts +2 -1
- package/dist/explorer/tree.d.ts +11 -13
- package/dist/explorer/tree.js +3 -16
- package/dist/explorer/use-explorer-loads.d.ts +2 -1
- package/dist/explorer/use-explorer-loads.js +0 -2
- package/dist/explorer/use-stored-expansion.d.ts +1 -1
- package/dist/grid/CellEditor.d.ts +2 -1
- package/dist/grid/CellEditor.js +0 -1
- package/dist/grid/CopyAsMenu.d.ts +2 -1
- package/dist/grid/DataGrid.js +1 -1
- package/dist/grid/EnumPicker.d.ts +2 -1
- package/dist/grid/GridHeaderCell.js +0 -3
- package/dist/grid/GridRowView.d.ts +3 -2
- package/dist/grid/GridRowView.js +1 -0
- package/dist/grid/ValueDock.d.ts +2 -3
- package/dist/grid/ValueDock.js +2 -3
- package/dist/grid/aggregates.d.ts +2 -1
- package/dist/grid/cell-range.d.ts +2 -1
- package/dist/grid/cell-range.js +0 -2
- package/dist/grid/column-layout.d.ts +2 -1
- package/dist/grid/column-layout.js +0 -1
- package/dist/grid/column-selection.js +0 -1
- package/dist/grid/column-view.js +0 -2
- package/dist/grid/copy-formats.d.ts +2 -1
- package/dist/grid/display.d.ts +3 -2
- package/dist/grid/display.js +0 -5
- package/dist/grid/edit-value.js +0 -1
- package/dist/grid/enum-type.js +0 -1
- package/dist/grid/focused-value.js +0 -1
- package/dist/grid/layout.d.ts +2 -2
- package/dist/grid/layout.js +1 -9
- package/dist/grid/navigation.d.ts +2 -1
- package/dist/grid/navigation.js +0 -1
- package/dist/grid/row-selection.d.ts +3 -2
- package/dist/grid/sort.js +0 -2
- package/dist/grid/types.js +0 -1
- package/dist/grid/whole-cells.d.ts +2 -1
- package/dist/host/helper-path.d.ts +1 -0
- package/dist/host/helper-path.js +3 -1
- package/dist/host/host.js +0 -4
- package/dist/host/index.d.ts +1 -1
- package/dist/host/index.js +1 -1
- package/dist/host/spawn.js +0 -1
- package/dist/index.d.ts +1 -1
- package/dist/number-notation.d.ts +1 -0
- package/dist/number-notation.js +1 -0
- package/dist/sql-split.d.ts +3 -2
- package/dist/structure/StructureView.js +0 -1
- package/dist/table/CommandField.d.ts +2 -1
- package/dist/table/ImportDialog.d.ts +2 -1
- package/dist/table/ImportDialog.js +0 -3
- package/dist/{grid → table}/RecordView.d.ts +3 -2
- package/dist/{grid → table}/RecordView.js +5 -6
- package/dist/table/TableStatusBar.d.ts +2 -1
- package/dist/table/TableStatusBar.js +0 -1
- package/dist/table/TableToolbar.d.ts +2 -1
- package/dist/table/TableToolbar.js +0 -1
- package/dist/table/TableView.d.ts +0 -1
- package/dist/table/TableView.js +2 -3
- package/dist/table/command-field.d.ts +4 -5
- package/dist/table/command-field.js +2 -11
- package/dist/table/grid-rows.d.ts +3 -2
- package/dist/table/grid-rows.js +0 -1
- package/dist/table/import-mapping.js +0 -2
- package/dist/table/layout-store.d.ts +0 -1
- package/dist/table/layout-store.js +1 -1
- package/dist/table/paging.js +0 -1
- package/dist/table/pending.d.ts +1 -2
- package/dist/table/pending.js +1 -6
- package/dist/table/useStoredLayout.d.ts +2 -2
- package/dist/table/useStoredLayout.js +1 -1
- package/dist/table/useTableTransfer.d.ts +4 -3
- package/dist/table/useTableTransfer.js +0 -2
- package/dist/testing/fake.js +0 -3
- package/dist/value/ValueEditor.d.ts +2 -1
- package/dist/value/ValueEditor.js +0 -4
- package/dist/value/ValuePanel.js +0 -1
- package/dist/value/draft.d.ts +2 -1
- package/dist/value/draft.js +0 -1
- package/dist/value/hex.d.ts +2 -2
- package/dist/value/hex.js +1 -2
- package/dist/value/json.d.ts +2 -1
- package/dist/value/json.js +0 -1
- package/dist/value/views.d.ts +0 -1
- package/dist/value/views.js +1 -3
- package/dist/workbench/DatabaseWorkbench.js +0 -2
- package/dist/workbench/DesignerTab.d.ts +2 -1
- package/dist/workbench/TableTab.d.ts +2 -1
- package/dist/workbench/tabs.d.ts +3 -2
- package/dist/workbench/tabs.js +0 -3
- package/package.json +9 -10
- package/src/DatabaseProvider.tsx +1 -1
- package/src/client/types.ts +0 -2
- package/src/client-context.ts +2 -2
- package/src/connections/EngineIcon.tsx +1 -1
- package/src/connections/docker.ts +0 -3
- package/src/connections/use-docker-containers.ts +1 -1
- package/src/console/DestructiveDialog.tsx +1 -1
- package/src/console/HistoryPanel.tsx +1 -1
- package/src/console/QueryConsole.tsx +0 -3
- package/src/console/SchemaPicker.tsx +1 -1
- package/src/console/StatementResultView.tsx +1 -1
- package/src/console/TransactionControls.tsx +1 -1
- package/src/console/destructive.ts +0 -1
- package/src/console/labels.ts +0 -1
- package/src/console/useConsoleHistory.ts +1 -1
- package/src/ddl/alter-sqlite.ts +0 -1
- package/src/ddl/alter.ts +0 -1
- package/src/ddl/column.ts +1 -2
- package/src/ddl/create.ts +1 -3
- package/src/ddl/dialect.ts +0 -1
- package/src/ddl/diff.ts +3 -6
- package/src/ddl/draft.ts +0 -2
- package/src/ddl/parse.ts +0 -4
- package/src/designer/ColumnsEditor.tsx +0 -2
- package/src/designer/DesignerView.tsx +0 -5
- package/src/designer/ForeignKeysEditor.tsx +1 -1
- package/src/designer/NamePicker.tsx +1 -3
- package/src/designer/SqlPreview.tsx +1 -3
- package/src/designer/TableDesigner.tsx +0 -2
- package/src/designer/edit.ts +0 -2
- package/src/designer/editor-props.ts +0 -1
- package/src/designer/plan.ts +0 -2
- package/src/explorer/DatabaseExplorer.tsx +0 -1
- package/src/explorer/RowMenu.tsx +1 -1
- package/src/explorer/TableDialog.tsx +1 -1
- package/src/explorer/expansion.ts +0 -1
- package/src/explorer/table-statements.ts +0 -1
- package/src/explorer/tree.ts +13 -31
- package/src/explorer/use-explorer-loads.ts +1 -4
- package/src/explorer/use-stored-expansion.ts +1 -2
- package/src/grid/CellEditor.tsx +1 -2
- package/src/grid/CopyAsMenu.tsx +1 -1
- package/src/grid/DataGrid.tsx +2 -4
- package/src/grid/EnumPicker.tsx +1 -2
- package/src/grid/GridHeaderCell.tsx +0 -3
- package/src/grid/GridRowView.tsx +3 -4
- package/src/grid/ValueDock.tsx +3 -6
- package/src/grid/aggregates.ts +1 -2
- package/src/grid/cell-range.ts +1 -3
- package/src/grid/column-layout.ts +1 -2
- package/src/grid/column-selection.ts +0 -1
- package/src/grid/column-view.ts +0 -2
- package/src/grid/copy-formats.ts +1 -2
- package/src/grid/display.ts +2 -9
- package/src/grid/edit-value.ts +0 -1
- package/src/grid/enum-type.ts +0 -1
- package/src/grid/focused-value.ts +0 -1
- package/src/grid/layout.ts +2 -12
- package/src/grid/navigation.ts +1 -3
- package/src/grid/row-selection.ts +2 -2
- package/src/grid/sort.ts +0 -2
- package/src/grid/types.ts +0 -5
- package/src/grid/whole-cells.ts +1 -2
- package/src/host/helper-path.ts +4 -1
- package/src/host/host.ts +0 -6
- package/src/host/index.ts +1 -1
- package/src/host/spawn.ts +0 -2
- package/src/host/types.ts +0 -3
- package/src/index.ts +1 -1
- package/src/number-notation.ts +2 -0
- package/src/protocol/connection.ts +0 -2
- package/src/protocol/errors.ts +0 -3
- package/src/protocol/messages.ts +0 -1
- package/src/protocol/schema.ts +0 -2
- package/src/protocol/values.ts +0 -2
- package/src/sql-split.ts +2 -2
- package/src/structure/StructureView.tsx +0 -1
- package/src/table/CommandField.tsx +1 -1
- package/src/table/ImportDialog.tsx +1 -7
- package/src/{grid → table}/RecordView.tsx +9 -12
- package/src/table/TableStatusBar.tsx +1 -3
- package/src/table/TableToolbar.tsx +1 -6
- package/src/table/TableView.tsx +2 -4
- package/src/table/command-field.ts +5 -14
- package/src/table/grid-rows.ts +2 -3
- package/src/table/import-mapping.ts +0 -2
- package/src/table/layout-store.ts +1 -2
- package/src/table/paging.ts +0 -1
- package/src/table/pending.ts +2 -9
- package/src/table/references.ts +0 -1
- package/src/table/useStoredLayout.ts +2 -4
- package/src/table/useTableTransfer.ts +3 -8
- package/src/testing/fake.ts +0 -5
- package/src/value/ValueEditor.tsx +1 -5
- package/src/value/ValuePanel.tsx +0 -1
- package/src/value/draft.ts +1 -2
- package/src/value/hex.ts +2 -3
- package/src/value/json.ts +1 -2
- package/src/value/views.ts +1 -4
- package/src/workbench/DatabaseWorkbench.tsx +0 -2
- package/src/workbench/DesignerTab.tsx +1 -2
- package/src/workbench/TableTab.tsx +1 -1
- package/src/workbench/tabs.ts +2 -7
package/README.md
CHANGED
|
@@ -70,7 +70,7 @@ import { createDatabaseClient, DatabaseProvider, TableView } from '@adecore/data
|
|
|
70
70
|
const client = createDatabaseClient((request) => window.database.request(request));
|
|
71
71
|
|
|
72
72
|
createRoot(root).render(
|
|
73
|
-
<UIProvider i18n={i18next}
|
|
73
|
+
<UIProvider i18n={i18next}>
|
|
74
74
|
<DatabaseProvider client={client}>
|
|
75
75
|
<TableView connection={connection} schema="main" table="customers" className="h-full" />
|
|
76
76
|
</DatabaseProvider>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
2
|
import type { DatabaseAction, DatabaseFiles, DatabaseNotice, DatabaseStorage } from './actions.ts';
|
|
3
3
|
import type { DatabaseClient } from './client/types.ts';
|
|
4
|
-
import type { NumberNotation } from './
|
|
4
|
+
import type { NumberNotation } from './number-notation.ts';
|
|
5
5
|
export interface DatabaseProviderProps {
|
|
6
6
|
client?: DatabaseClient;
|
|
7
7
|
onAction?(action: DatabaseAction): void;
|
package/dist/client/types.js
CHANGED
package/dist/client-context.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { DatabaseAction, DatabaseFiles, DatabaseNotice, DatabaseStorage } from './actions.ts';
|
|
2
2
|
import type { DatabaseClient } from './client/types.ts';
|
|
3
|
-
import type { NumberNotation } from './
|
|
4
|
-
|
|
3
|
+
import type { NumberNotation } from './number-notation.ts';
|
|
4
|
+
interface DatabaseContextValue {
|
|
5
5
|
readonly client: DatabaseClient;
|
|
6
6
|
readonly onAction: ((action: DatabaseAction) => void) | undefined;
|
|
7
7
|
readonly onNotice: ((notice: DatabaseNotice) => void) | undefined;
|
|
@@ -16,3 +16,4 @@ export declare const useDatabaseNotice: () => ((notice: DatabaseNotice) => void)
|
|
|
16
16
|
export declare const useDatabaseStorage: () => DatabaseStorage | undefined;
|
|
17
17
|
export declare const useDatabaseFiles: () => DatabaseFiles | undefined;
|
|
18
18
|
export declare const useNumberNotation: () => NumberNotation;
|
|
19
|
+
export {};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { Ref } from 'react';
|
|
2
2
|
import type { Engine } from '../protocol/index.ts';
|
|
3
|
-
|
|
3
|
+
interface EngineIconProps {
|
|
4
4
|
engine: Engine;
|
|
5
5
|
size?: number;
|
|
6
6
|
className?: string;
|
|
7
7
|
ref?: Ref<SVGSVGElement>;
|
|
8
8
|
}
|
|
9
9
|
export declare function EngineIcon({ engine, size, className, ref }: EngineIconProps): import("react").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import { DEFAULT_MYSQL_PORT, defaultConfig, withMode } from './connection-config.js';
|
|
2
2
|
/* A container a MySQL connection can point at: what `discover` found, minus a file engine, which no container serves. */
|
|
3
3
|
export const isMysqlContainer = (container) => container.engine !== 'sqlite';
|
|
4
|
-
/* The Compose `project/service` of a container, when it has both. */
|
|
5
4
|
export const composeNameOf = (container) => container.project !== null && container.service !== null ? `${container.project}/${container.service}` : null;
|
|
6
|
-
/* What names a container to a person: its Compose name, else its own. */
|
|
7
5
|
export const containerTitle = (container) => composeNameOf(container) ?? container.name;
|
|
8
6
|
/* The port to connect to inside the container: MySQL's own when the container lists it or lists nothing, else the first it lists. */
|
|
9
7
|
export const containerPortOf = (container) => {
|
|
10
8
|
const ports = container.ports.map((entry) => entry.container);
|
|
11
9
|
return ports.length === 0 || ports.includes(DEFAULT_MYSQL_PORT) ? DEFAULT_MYSQL_PORT : ports[0];
|
|
12
10
|
};
|
|
13
|
-
/* The host port a container publishes a port on, or `null` when it does not. */
|
|
14
11
|
export const publishedPortOf = (container, port) => container.ports.find((entry) => entry.container === port)?.host ?? null;
|
|
15
12
|
const isEmpty = (text) => text === undefined || text === '';
|
|
16
13
|
/* Points a config at a container. The user, the password and the database come from the container's environment only where the config has none. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DockerContainer } from '../protocol/index.ts';
|
|
2
|
-
|
|
2
|
+
type DockerState = {
|
|
3
3
|
readonly status: 'loading';
|
|
4
4
|
} | {
|
|
5
5
|
readonly status: 'ready';
|
|
@@ -15,3 +15,4 @@ export declare function useDockerContainers(): {
|
|
|
15
15
|
readonly state: DockerState;
|
|
16
16
|
reload(): void;
|
|
17
17
|
};
|
|
18
|
+
export {};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { Ref } from 'react';
|
|
2
2
|
import type { DestructiveStatement } from './destructive.ts';
|
|
3
|
-
|
|
3
|
+
interface DestructiveDialogProps {
|
|
4
4
|
statements: readonly DestructiveStatement[];
|
|
5
5
|
onConfirm(): void;
|
|
6
6
|
onCancel(): void;
|
|
7
7
|
ref?: Ref<HTMLDivElement>;
|
|
8
8
|
}
|
|
9
9
|
export declare function DestructiveDialog({ statements, onConfirm, onCancel, ref }: DestructiveDialogProps): import("react").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Ref } from 'react';
|
|
2
2
|
import { type HistoryEntry } from './history.ts';
|
|
3
|
-
|
|
3
|
+
interface HistoryPanelProps {
|
|
4
4
|
entries: readonly HistoryEntry[];
|
|
5
5
|
onPick(entry: HistoryEntry, run: boolean): void;
|
|
6
6
|
onClear(): void;
|
|
@@ -8,3 +8,4 @@ export interface HistoryPanelProps {
|
|
|
8
8
|
ref?: Ref<HTMLElement>;
|
|
9
9
|
}
|
|
10
10
|
export declare function HistoryPanel({ entries, onPick, onClear, className, ref }: HistoryPanelProps): import("react").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -22,9 +22,7 @@ import { SqlEditor } from './SqlEditor.js';
|
|
|
22
22
|
import { StatementResultView } from './StatementResultView.js';
|
|
23
23
|
import { TransactionControls } from './TransactionControls.js';
|
|
24
24
|
import { useConsoleHistory } from './useConsoleHistory.js';
|
|
25
|
-
/* Rows in the first page of a result, and in every page after it. */
|
|
26
25
|
const PAGE_SIZE = 500;
|
|
27
|
-
/* Where the height of the results is kept, in pixels, for every console. */
|
|
28
26
|
export const RESULTS_HEIGHT_KEY = 'database:console-results';
|
|
29
27
|
/* The results and the editor never shrink below these; the results start at half the console. */
|
|
30
28
|
const MIN_RESULTS_HEIGHT = 96;
|
|
@@ -129,7 +127,6 @@ export function QueryConsole({ connection, schema, onSchemaChange, value, defaul
|
|
|
129
127
|
}
|
|
130
128
|
onValueChange?.(next);
|
|
131
129
|
};
|
|
132
|
-
/* The SQL a run of the scope sends, or null when there is nothing to run. */
|
|
133
130
|
const targetOf = (scope) => {
|
|
134
131
|
if (engine === undefined) {
|
|
135
132
|
return null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Ref } from 'react';
|
|
2
2
|
import type { SchemaInfo } from '../protocol/index.ts';
|
|
3
|
-
|
|
3
|
+
interface SchemaPickerProps {
|
|
4
4
|
schemas: readonly SchemaInfo[];
|
|
5
5
|
value: string | null;
|
|
6
6
|
onValueChange(schema: string): void;
|
|
@@ -9,3 +9,4 @@ export interface SchemaPickerProps {
|
|
|
9
9
|
ref?: Ref<HTMLButtonElement>;
|
|
10
10
|
}
|
|
11
11
|
export declare function SchemaPicker({ schemas, value, onValueChange, disabled, className, ref }: SchemaPickerProps): import("react").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -8,7 +8,7 @@ export interface ResultPager {
|
|
|
8
8
|
onPrevious(): void;
|
|
9
9
|
onNext(): void;
|
|
10
10
|
}
|
|
11
|
-
|
|
11
|
+
interface StatementResultViewProps {
|
|
12
12
|
result: StatementResult;
|
|
13
13
|
offset?: number;
|
|
14
14
|
pager?: ResultPager;
|
|
@@ -22,3 +22,4 @@ export interface StatementResultViewProps {
|
|
|
22
22
|
onNotice?(notice: DatabaseNotice): void;
|
|
23
23
|
}
|
|
24
24
|
export declare function StatementResultView({ result, offset, pager, onExport, exporting, engine, valuePanelOpen, onValuePanelOpenChange, keys, onFollowReference, onNotice }: StatementResultViewProps): import("react").JSX.Element;
|
|
25
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Ref } from 'react';
|
|
2
2
|
export type TransactionMode = 'auto' | 'manual';
|
|
3
|
-
|
|
3
|
+
interface TransactionControlsProps {
|
|
4
4
|
mode: TransactionMode;
|
|
5
5
|
onModeChange(mode: TransactionMode): void;
|
|
6
6
|
open: boolean;
|
|
@@ -11,3 +11,4 @@ export interface TransactionControlsProps {
|
|
|
11
11
|
ref?: Ref<HTMLDivElement>;
|
|
12
12
|
}
|
|
13
13
|
export declare function TransactionControls({ mode, onModeChange, open, busy, onCommit, onRollback, className, ref }: TransactionControlsProps): import("react").JSX.Element;
|
|
14
|
+
export {};
|
package/dist/console/labels.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
const LABEL_LENGTH = 32;
|
|
2
|
-
/* The tab of a statement: its SQL on one line, cut where it gets long. */
|
|
3
2
|
export const statementLabel = (sql) => {
|
|
4
3
|
const line = sql.replace(/\s+/g, ' ').trim();
|
|
5
4
|
return line.length > LABEL_LENGTH ? `${line.slice(0, LABEL_LENGTH - 1).trimEnd()}…` : line;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { type HistoryEntry } from './history.ts';
|
|
2
|
-
|
|
2
|
+
interface ConsoleHistory {
|
|
3
3
|
readonly entries: readonly HistoryEntry[];
|
|
4
4
|
record(entry: HistoryEntry): void;
|
|
5
5
|
clear(): void;
|
|
6
6
|
}
|
|
7
7
|
export declare function useConsoleHistory(connectionId: string): ConsoleHistory;
|
|
8
|
+
export {};
|
package/dist/ddl/alter-sqlite.js
CHANGED
|
@@ -51,7 +51,6 @@ const rebuildSql = (dialect, schema, original, draft, diff) => {
|
|
|
51
51
|
statements.push(`DROP TABLE ${tableName(dialect, schema, original.name)}`, `ALTER TABLE ${tableName(dialect, schema, temporary)} RENAME TO ${quote(dialect, draft.name)}`, ...indexes.map((index) => createIndexSql(dialect, schema, draft.name, index)), 'PRAGMA foreign_key_check', 'COMMIT', 'PRAGMA foreign_keys=ON');
|
|
52
52
|
return statements;
|
|
53
53
|
};
|
|
54
|
-
/* `ALTER TABLE` where SQLite has one, a rebuild of the table for every other change. */
|
|
55
54
|
export const sqliteAlterSql = (dialect, schema, original, draft, diff) => {
|
|
56
55
|
if (needsRebuild(dialect, original, diff)) {
|
|
57
56
|
return rebuildSql(dialect, schema, original, draft, diff);
|
package/dist/ddl/alter.js
CHANGED
|
@@ -13,7 +13,6 @@ const unchanged = (diff) => !diff.renamed &&
|
|
|
13
13
|
diff.renamedIndexes.length === 0 &&
|
|
14
14
|
diff.droppedForeignKeys.length === 0 &&
|
|
15
15
|
diff.addedForeignKeys.length === 0;
|
|
16
|
-
/* The fewest statements that turn the table of `structure` into the draft; none when the draft changes nothing. */
|
|
17
16
|
export const alterTableSql = (dialect, schema, structure, draft) => {
|
|
18
17
|
const original = draftOf(structure);
|
|
19
18
|
const diff = diffOf(dialect, original, draft);
|
package/dist/ddl/column.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { type Dialect } from './dialect.ts';
|
|
2
2
|
import type { ColumnDraft } from './draft.ts';
|
|
3
3
|
export declare const defaultClause: (expression: string) => string;
|
|
4
|
-
|
|
4
|
+
interface ColumnSqlOptions {
|
|
5
5
|
readonly inlinePrimaryKey?: boolean;
|
|
6
6
|
}
|
|
7
7
|
export declare const columnSpecSql: (dialect: Dialect, column: ColumnDraft, { inlinePrimaryKey }?: ColumnSqlOptions) => string;
|
|
8
8
|
export declare const columnSql: (dialect: Dialect, column: ColumnDraft, options?: ColumnSqlOptions) => string;
|
|
9
9
|
export declare const sameDefinition: (dialect: Dialect, left: ColumnDraft, right: ColumnDraft) => boolean;
|
|
10
|
+
export {};
|
package/dist/ddl/column.js
CHANGED
|
@@ -13,7 +13,6 @@ export const defaultClause = (expression) => {
|
|
|
13
13
|
}
|
|
14
14
|
return text.startsWith('(') && text.endsWith(')') ? text : `(${text})`;
|
|
15
15
|
};
|
|
16
|
-
/* A column's definition without its name: `varchar(255) NOT NULL DEFAULT 'x'`. */
|
|
17
16
|
export const columnSpecSql = (dialect, column, { inlinePrimaryKey = false } = {}) => {
|
|
18
17
|
const mysql = dialect.engine === 'mysql';
|
|
19
18
|
const parts = [];
|
package/dist/ddl/create.d.ts
CHANGED
|
@@ -5,9 +5,10 @@ export declare const foreignKeySql: (dialect: Dialect, schema: string, foreignKe
|
|
|
5
5
|
export declare const mysqlOptionsSql: (options: TableOptions, against?: TableOptions) => string[];
|
|
6
6
|
export declare const inlineIndexSql: (dialect: Dialect, index: IndexDraft) => string;
|
|
7
7
|
export declare const createIndexSql: (dialect: Dialect, schema: string, table: string, index: Pick<IndexDraft, 'name' | 'columns' | 'unique'>) => string;
|
|
8
|
-
|
|
8
|
+
interface CreateParts {
|
|
9
9
|
readonly table: string;
|
|
10
10
|
readonly indexes: readonly IndexDraft[];
|
|
11
11
|
}
|
|
12
12
|
export declare const createTableParts: (dialect: Dialect, schema: string, draft: TableDraft, name: string) => CreateParts;
|
|
13
13
|
export declare const createTableSql: (dialect: Dialect, schema: string, draft: TableDraft) => string[];
|
|
14
|
+
export {};
|
package/dist/ddl/create.js
CHANGED
|
@@ -3,7 +3,6 @@ import { columnSql } from './column.js';
|
|
|
3
3
|
import { columnList, quote, sqliteSchemaPrefix, tableName } from './dialect.js';
|
|
4
4
|
import { isAutoIndex } from './draft.js';
|
|
5
5
|
const INDENT = ' ';
|
|
6
|
-
/* `CONSTRAINT name FOREIGN KEY (...) REFERENCES t (...) ON UPDATE .. ON DELETE ..`, shared by a create and an `ADD`. */
|
|
7
6
|
export const foreignKeySql = (dialect, schema, foreignKey) => {
|
|
8
7
|
const sqlite = dialect.engine === 'sqlite';
|
|
9
8
|
// SQLite cannot name another schema in a reference, and MySQL needs one only for another database.
|
|
@@ -36,7 +35,6 @@ export const mysqlOptionsSql = (options, against) => {
|
|
|
36
35
|
};
|
|
37
36
|
const sqliteOptionsSql = (options) => [...(options.strict ? ['STRICT'] : []), ...(options.withoutRowid ? ['WITHOUT ROWID'] : [])];
|
|
38
37
|
export const inlineIndexSql = (dialect, index) => [index.unique ? 'UNIQUE INDEX' : 'INDEX', ...(index.name === '' ? [] : [quote(dialect, index.name)]), `(${columnList(dialect, index.columns)})`].join(' ');
|
|
39
|
-
/* `CREATE [UNIQUE] INDEX name ON table (columns)`. */
|
|
40
38
|
export const createIndexSql = (dialect, schema, table, index) => `CREATE ${index.unique ? 'UNIQUE ' : ''}INDEX ${dialect.engine === 'sqlite' ? sqliteSchemaPrefix(dialect, schema) : ''}${quote(dialect, index.name)} ON ${tableName(dialect, dialect.engine === 'sqlite' ? '' : schema, table)} (${columnList(dialect, index.columns)})`;
|
|
41
39
|
/* The `CREATE TABLE` of a draft under a name of the caller's choosing, which a rebuild uses for the table it fills before the swap. */
|
|
42
40
|
export const createTableParts = (dialect, schema, draft, name) => {
|
package/dist/ddl/dialect.js
CHANGED
|
@@ -24,7 +24,6 @@ export const atLeast = (dialect, ...wanted) => {
|
|
|
24
24
|
export const quote = (dialect, name) => quoteIdentifier(dialect.engine, name);
|
|
25
25
|
/* SQLite reads an unqualified name as `main`, so only an attached schema is spelled out. */
|
|
26
26
|
const schemaOf = (dialect, schema) => schema === '' || (dialect.engine === 'sqlite' && schema === 'main') ? undefined : schema;
|
|
27
|
-
/* A table with its schema in front, when the statement needs one. */
|
|
28
27
|
export const tableName = (dialect, schema, table) => qualifiedName({ engine: dialect.engine, table, schema: schemaOf(dialect, schema) });
|
|
29
28
|
/* SQLite puts the schema in front of the name of an index, where MySQL names the table it is on. */
|
|
30
29
|
export const sqliteSchemaPrefix = (dialect, schema) => {
|
package/dist/ddl/diff.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Dialect } from './dialect.ts';
|
|
2
2
|
import type { ColumnDraft, ForeignKeyDraft, IndexDraft, TableDraft } from './draft.ts';
|
|
3
|
-
|
|
3
|
+
interface KeptColumn {
|
|
4
4
|
readonly original: ColumnDraft;
|
|
5
5
|
readonly column: ColumnDraft;
|
|
6
6
|
readonly renamed: boolean;
|
|
@@ -8,12 +8,12 @@ export interface KeptColumn {
|
|
|
8
8
|
readonly moved: boolean;
|
|
9
9
|
readonly after: string | null;
|
|
10
10
|
}
|
|
11
|
-
|
|
11
|
+
interface AddedColumn {
|
|
12
12
|
readonly column: ColumnDraft;
|
|
13
13
|
readonly placed: boolean;
|
|
14
14
|
readonly after: string | null;
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
interface RenamedIndex {
|
|
17
17
|
readonly from: IndexDraft;
|
|
18
18
|
readonly to: IndexDraft;
|
|
19
19
|
}
|
|
@@ -32,3 +32,4 @@ export interface TableDiff {
|
|
|
32
32
|
}
|
|
33
33
|
export declare const diffOf: (dialect: Dialect, original: TableDraft, draft: TableDraft) => TableDiff;
|
|
34
34
|
export declare const dropsColumns: (original: TableDraft, draft: TableDraft) => boolean;
|
|
35
|
+
export {};
|
package/dist/ddl/diff.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { sameList } from '../same-list.js';
|
|
2
2
|
import { sameDefinition } from './column.js';
|
|
3
|
-
/* The positions of a longest run that already is in order, whose columns can stay where they are. */
|
|
4
3
|
const longestRun = (positions) => {
|
|
5
4
|
const length = [];
|
|
6
5
|
const previous = [];
|
|
@@ -96,7 +95,6 @@ const foreignKeyChanges = (original, draft, project) => {
|
|
|
96
95
|
}
|
|
97
96
|
return { droppedForeignKeys, addedForeignKeys };
|
|
98
97
|
};
|
|
99
|
-
/* What a draft changes in the table it came from, told apart by the names items kept. */
|
|
100
98
|
export const diffOf = (dialect, original, draft) => {
|
|
101
99
|
const renames = new Map(draft.columns.filter((column) => column.originalName !== null).map((column) => [column.originalName, column.name]));
|
|
102
100
|
const project = (names) => names.map((name) => renames.get(name) ?? name);
|
|
@@ -109,5 +107,4 @@ export const diffOf = (dialect, original, draft) => {
|
|
|
109
107
|
optionsChanged: OPTION_FIELDS.some((field) => original.options[field] !== draft.options[field])
|
|
110
108
|
};
|
|
111
109
|
};
|
|
112
|
-
/* Whether applying the draft removes a column, and with it the data in it. */
|
|
113
110
|
export const dropsColumns = (original, draft) => original.columns.some((column) => !draft.columns.some((kept) => kept.originalName === column.name));
|
package/dist/ddl/draft.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { generatedClausesOf, NO_OPTIONS, optionsOf } from './parse.js';
|
|
2
2
|
let counter = 0;
|
|
3
|
-
/* A key no other item of this page has. */
|
|
4
3
|
export const nextKey = () => `new-${++counter}`;
|
|
5
4
|
export const emptyColumn = (name = '') => ({
|
|
6
5
|
key: nextKey(),
|
|
@@ -36,7 +35,6 @@ const foreignKeyDraftOf = (foreignKey, at) => ({
|
|
|
36
35
|
onUpdate: foreignKey.onUpdate,
|
|
37
36
|
onDelete: foreignKey.onDelete
|
|
38
37
|
});
|
|
39
|
-
/* The draft that changes nothing: what a structure already says. */
|
|
40
38
|
export const draftOf = (structure) => {
|
|
41
39
|
const clauses = generatedClausesOf(structure.ddl);
|
|
42
40
|
return {
|
package/dist/ddl/parse.js
CHANGED
|
@@ -32,7 +32,6 @@ function* unquoted(text, backslash) {
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
/* Splits a `CREATE TABLE` into its definitions and its table options, or `null` when it holds no parenthesis. */
|
|
36
35
|
export const definitionOf = (ddl) => {
|
|
37
36
|
if (ddl === null) {
|
|
38
37
|
return null;
|
|
@@ -66,7 +65,6 @@ export const definitionOf = (ddl) => {
|
|
|
66
65
|
tail: ddl.slice(close + 1)
|
|
67
66
|
};
|
|
68
67
|
};
|
|
69
|
-
/* The name a definition starts with, unquoted. */
|
|
70
68
|
const leadingName = (item) => {
|
|
71
69
|
const mark = item[0];
|
|
72
70
|
if (mark === '`' || mark === '"') {
|
|
@@ -81,7 +79,6 @@ const leadingName = (item) => {
|
|
|
81
79
|
};
|
|
82
80
|
const AS_OPEN = /\b(?:GENERATED\s+ALWAYS\s+)?AS\s*\(/i;
|
|
83
81
|
const AS_SUFFIX = /^\s*(?:VIRTUAL|STORED|PERSISTENT)\b/i;
|
|
84
|
-
/* The `GENERATED ALWAYS AS (...) STORED` clause of a column definition, or `null` when it has none. */
|
|
85
82
|
const generatedClauseOf = (item) => {
|
|
86
83
|
// A default or a comment may hold the words, so the strings are blanked before the search.
|
|
87
84
|
const masked = item.replace(/'(?:[^']|'')*'/g, (text) => ' '.repeat(text.length));
|
|
@@ -103,7 +100,6 @@ const generatedClauseOf = (item) => {
|
|
|
103
100
|
const suffix = AS_SUFFIX.exec(masked.slice(end));
|
|
104
101
|
return item.slice(start.index, end + (suffix?.[0].length ?? 0)).trim();
|
|
105
102
|
};
|
|
106
|
-
/* The generated clause of every generated column in a table's DDL, by column name. */
|
|
107
103
|
export const generatedClausesOf = (ddl) => {
|
|
108
104
|
const clauses = new Map();
|
|
109
105
|
for (const item of definitionOf(ddl)?.items ?? []) {
|
|
@@ -9,7 +9,6 @@ import { typeSuggestionsOf } from '../ddl/index.js';
|
|
|
9
9
|
import { addColumn, moveColumn, patchColumn, removeColumn, togglePrimaryKey } from './edit.js';
|
|
10
10
|
const TH = 'sticky top-0 z-10 h-7 bg-surface px-2 text-left text-xs font-medium whitespace-nowrap text-text-faint';
|
|
11
11
|
const TD = 'border-t border-border-soft px-2 py-1 align-middle';
|
|
12
|
-
/* The columns of the table as rows to edit: name, type, null, default, key, comment and where each one sits. */
|
|
13
12
|
export function ColumnsEditor({ draft, dialect, disabled, onChange, className, ref }) {
|
|
14
13
|
const { t } = useTranslation('database');
|
|
15
14
|
const listId = useId();
|
|
@@ -13,7 +13,6 @@ import { OptionsEditor } from './OptionsEditor.js';
|
|
|
13
13
|
import { scriptOf } from './plan.js';
|
|
14
14
|
import { SqlPreview } from './SqlPreview.js';
|
|
15
15
|
const APPLY_SHORTCUT = /* @__PURE__ */ shortcut('Mod+S');
|
|
16
|
-
/* The designer with everything it needs handed in: the name, the four tabs, what Apply would run and the confirmation before it does. */
|
|
17
16
|
export function DesignerView({ dialect, schema, draft, isNew, changed, tables, plan, readOnlyReason, failure, confirming, referenceColumns, onChange, onRequestApply, onConfirm, onCancelConfirm, onRevert, onDismissFailure, toolbarStart, className, ref }) {
|
|
18
17
|
const { t } = useTranslation('database');
|
|
19
18
|
const disabled = readOnlyReason !== null;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { EditorProps } from './editor-props.ts';
|
|
2
|
-
|
|
2
|
+
interface ForeignKeysEditorProps extends EditorProps {
|
|
3
3
|
schema: string;
|
|
4
4
|
tables: readonly string[];
|
|
5
5
|
referenceColumns(table: string): readonly string[] | null;
|
|
6
6
|
}
|
|
7
7
|
export declare function ForeignKeysEditor({ draft, schema, tables, referenceColumns, disabled, onChange, className, ref }: ForeignKeysEditorProps): import("react").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Ref } from 'react';
|
|
2
|
-
|
|
2
|
+
interface NamePickerProps {
|
|
3
3
|
options: readonly string[];
|
|
4
4
|
value: readonly string[];
|
|
5
5
|
onToggle(name: string): void;
|
|
@@ -9,3 +9,4 @@ export interface NamePickerProps {
|
|
|
9
9
|
ref?: Ref<HTMLDivElement>;
|
|
10
10
|
}
|
|
11
11
|
export declare function NamePicker({ options, value, onToggle, label, disabled, className, ref }: NamePickerProps): import("react").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { Ref } from 'react';
|
|
2
2
|
import { type Plan } from './plan.ts';
|
|
3
|
-
|
|
3
|
+
interface SqlPreviewProps {
|
|
4
4
|
plan: Plan;
|
|
5
5
|
className?: string;
|
|
6
6
|
ref?: Ref<HTMLDivElement>;
|
|
7
7
|
}
|
|
8
8
|
export declare function SqlPreview({ plan, className, ref }: SqlPreviewProps): import("react").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -5,12 +5,10 @@ import { Copy } from 'lucide-react';
|
|
|
5
5
|
import { useTranslation } from 'react-i18next';
|
|
6
6
|
import { CODE_TEXT } from '../code-text.js';
|
|
7
7
|
import { scriptOf } from './plan.js';
|
|
8
|
-
/* The sentence a problem of the draft is read as. */
|
|
9
8
|
function ProblemText({ problem }) {
|
|
10
9
|
const { t } = useTranslation('database');
|
|
11
10
|
return _jsx(_Fragment, { children: t(`ddl.problem.${problem.code}`, { subject: problem.subject }) });
|
|
12
11
|
}
|
|
13
|
-
/* What Apply would run, as a person reads it: monospace, read only, and copyable. */
|
|
14
12
|
export function SqlPreview({ plan, className, ref }) {
|
|
15
13
|
const { t } = useTranslation('database');
|
|
16
14
|
const script = scriptOf(plan.statements);
|
|
@@ -48,7 +48,6 @@ export function TableDesigner({ connection, schema, table, toolbarStart, classNa
|
|
|
48
48
|
setShapeChanged(true);
|
|
49
49
|
}
|
|
50
50
|
});
|
|
51
|
-
// A new snapshot, after a load or an apply, starts a fresh draft.
|
|
52
51
|
if (snapshot !== null && editing.snapshot !== snapshot) {
|
|
53
52
|
const baseline = snapshot.structure === null ? emptyDraft() : draftOf(snapshot.structure);
|
|
54
53
|
setEditing({ snapshot, baseline, draft: baseline });
|
package/dist/designer/edit.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { emptyColumn, nextKey } from '../ddl/index.js';
|
|
2
|
-
/* The editing steps of a draft. Each returns a new draft and leaves the one it was given alone. */
|
|
3
2
|
const replaceAt = (items, key, change) => items.map((item) => (item.key === key ? change(item) : item));
|
|
4
3
|
const toggled = (names, name) => names.includes(name) ? names.filter((candidate) => candidate !== name) : [...names, name];
|
|
5
4
|
export const renameTable = (draft, name) => ({ ...draft, name });
|
package/dist/designer/plan.js
CHANGED
|
@@ -9,5 +9,4 @@ export const planOf = (dialect, schema, structure, draft) => {
|
|
|
9
9
|
}
|
|
10
10
|
return { problems, statements: alterTableSql(dialect, schema, structure, draft), destructive: dropsColumns(draftOf(structure), draft) };
|
|
11
11
|
};
|
|
12
|
-
/* The statements as a person reads them and as a script runs them. */
|
|
13
12
|
export const scriptOf = (statements) => statements.map((statement) => `${statement};`).join('\n');
|
|
@@ -278,7 +278,6 @@ function ColumnIcon(keys) {
|
|
|
278
278
|
}
|
|
279
279
|
return (_jsx(Tooltip, { label: t(keyLabelOf(keys)), children: _jsx("span", { className: ENTRY_ICON_SLOT, children: _jsx(KeyIcon, { ...keys, size: 14 }) }) }));
|
|
280
280
|
}
|
|
281
|
-
/* A key, a foreign key, an index, a check or a trigger of a table: its name, and what it covers in the quiet color of a column's type. */
|
|
282
281
|
function EntryContent({ row }) {
|
|
283
282
|
const { t } = useTranslation('database');
|
|
284
283
|
const { entry } = row;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Connection } from '../client/types.ts';
|
|
2
2
|
import type { TableRequest } from './TableDialog.tsx';
|
|
3
3
|
import { type LoadTarget, type TreeRow } from './tree.ts';
|
|
4
|
-
|
|
4
|
+
interface RowMenuProps {
|
|
5
5
|
row: TreeRow;
|
|
6
6
|
connection: Connection;
|
|
7
7
|
onRefresh(target: LoadTarget): void;
|
|
@@ -9,3 +9,4 @@ export interface RowMenuProps {
|
|
|
9
9
|
onRequest(request: TableRequest): void;
|
|
10
10
|
}
|
|
11
11
|
export declare function RowMenu({ row, connection, onRefresh, onDisconnect, onRequest }: RowMenuProps): import("react").JSX.Element[];
|
|
12
|
+
export {};
|
|
@@ -7,9 +7,10 @@ export interface TableRequest {
|
|
|
7
7
|
readonly ref: TableRef;
|
|
8
8
|
readonly kind: TableKind;
|
|
9
9
|
}
|
|
10
|
-
|
|
10
|
+
interface TableDialogProps {
|
|
11
11
|
request: TableRequest;
|
|
12
12
|
onClose(): void;
|
|
13
13
|
onDone(request: TableRequest, to: string | undefined): void;
|
|
14
14
|
}
|
|
15
15
|
export declare function TableDialog({ request, onClose, onDone }: TableDialogProps): import("react").JSX.Element;
|
|
16
|
+
export {};
|
package/dist/explorer/tree.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ export declare const connectionKey: (connectionId: string) => string;
|
|
|
23
23
|
export declare const schemaKey: (connectionId: string, schema: string) => string;
|
|
24
24
|
export declare const folderKey: (connectionId: string, schema: string, group: TableKind) => string;
|
|
25
25
|
export declare const tableKey: (ref: TableRef) => string;
|
|
26
|
-
|
|
26
|
+
declare const PARTS: readonly ['columns', 'keys', 'foreignKeys', 'indexes', 'checks', 'triggers'];
|
|
27
27
|
export type TablePart = (typeof PARTS)[number];
|
|
28
28
|
export declare const partKey: (ref: TableRef, part: TablePart) => string;
|
|
29
29
|
export declare const startsOpen: (key: string) => boolean;
|
|
@@ -40,7 +40,7 @@ interface RowBase {
|
|
|
40
40
|
readonly setSize: number;
|
|
41
41
|
readonly focusable: boolean;
|
|
42
42
|
}
|
|
43
|
-
|
|
43
|
+
interface ConnectionRow extends RowBase {
|
|
44
44
|
readonly kind: 'connection';
|
|
45
45
|
readonly connection: Connection;
|
|
46
46
|
readonly expanded: boolean;
|
|
@@ -50,13 +50,13 @@ export interface ConnectionRow extends RowBase {
|
|
|
50
50
|
readonly total: number;
|
|
51
51
|
} | null;
|
|
52
52
|
}
|
|
53
|
-
|
|
53
|
+
interface SchemaRow extends RowBase {
|
|
54
54
|
readonly kind: 'schema';
|
|
55
55
|
readonly connection: Connection;
|
|
56
56
|
readonly schema: string;
|
|
57
57
|
readonly expanded: boolean;
|
|
58
58
|
}
|
|
59
|
-
|
|
59
|
+
interface FolderRow extends RowBase {
|
|
60
60
|
readonly kind: 'folder';
|
|
61
61
|
readonly connection: Connection;
|
|
62
62
|
readonly schema: string;
|
|
@@ -77,14 +77,14 @@ export interface ColumnRow extends RowBase {
|
|
|
77
77
|
readonly primaryKey: boolean;
|
|
78
78
|
readonly foreignKey: boolean;
|
|
79
79
|
}
|
|
80
|
-
|
|
80
|
+
interface PartRow extends RowBase {
|
|
81
81
|
readonly kind: 'part';
|
|
82
82
|
readonly ref: TableRef;
|
|
83
83
|
readonly part: TablePart;
|
|
84
84
|
readonly expanded: boolean;
|
|
85
85
|
readonly count: number;
|
|
86
86
|
}
|
|
87
|
-
|
|
87
|
+
type TableEntry = {
|
|
88
88
|
readonly type: 'key';
|
|
89
89
|
readonly name: string | null;
|
|
90
90
|
readonly columns: readonly string[];
|
|
@@ -107,7 +107,7 @@ export interface EntryRow extends RowBase {
|
|
|
107
107
|
readonly ref: TableRef;
|
|
108
108
|
readonly entry: TableEntry;
|
|
109
109
|
}
|
|
110
|
-
|
|
110
|
+
interface LoadingRow extends RowBase {
|
|
111
111
|
readonly kind: 'loading';
|
|
112
112
|
}
|
|
113
113
|
export interface ErrorRow extends RowBase {
|
|
@@ -115,19 +115,19 @@ export interface ErrorRow extends RowBase {
|
|
|
115
115
|
readonly message: string;
|
|
116
116
|
readonly retry: LoadTarget;
|
|
117
117
|
}
|
|
118
|
-
|
|
118
|
+
interface AppFolderRow extends RowBase {
|
|
119
119
|
readonly kind: 'appFolder';
|
|
120
120
|
readonly connection: Connection;
|
|
121
121
|
readonly folder: ExplorerFolder;
|
|
122
122
|
readonly expanded: boolean;
|
|
123
123
|
readonly count: number;
|
|
124
124
|
}
|
|
125
|
-
|
|
125
|
+
interface AppItemRow extends RowBase {
|
|
126
126
|
readonly kind: 'appItem';
|
|
127
127
|
readonly connection: Connection;
|
|
128
128
|
readonly item: ExplorerItem;
|
|
129
129
|
}
|
|
130
|
-
|
|
130
|
+
interface EmptyRow extends RowBase {
|
|
131
131
|
readonly kind: 'empty';
|
|
132
132
|
readonly of: 'schemas' | 'tables' | 'columns';
|
|
133
133
|
}
|
|
@@ -154,11 +154,9 @@ export interface TreeInput {
|
|
|
154
154
|
versions(connectionId: string): string | null;
|
|
155
155
|
folders?(connectionId: string): readonly ExplorerFolder[];
|
|
156
156
|
}
|
|
157
|
-
export declare const visibleSchemas: (schemas: readonly SchemaInfo[], showSystemSchemas: boolean) => readonly SchemaInfo[];
|
|
158
|
-
export declare const tableEntries: (structure: TableStructure) => Readonly<Record<Exclude<TablePart, 'columns'>, readonly TableEntry[]>>;
|
|
159
157
|
export declare const flattenTree: (input: TreeInput) => TreeRow[];
|
|
160
158
|
export declare const neededLoads: (input: Omit<TreeInput, 'filter'>) => LoadTarget[];
|
|
161
|
-
|
|
159
|
+
type TreeAction = {
|
|
162
160
|
readonly type: 'focus';
|
|
163
161
|
readonly key: string;
|
|
164
162
|
} | {
|