@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.
Files changed (231) hide show
  1. package/README.md +1 -1
  2. package/dist/DatabaseProvider.d.ts +1 -1
  3. package/dist/client/types.js +0 -1
  4. package/dist/client-context.d.ts +3 -2
  5. package/dist/connections/EngineIcon.d.ts +2 -1
  6. package/dist/connections/docker.js +0 -3
  7. package/dist/connections/use-docker-containers.d.ts +2 -1
  8. package/dist/console/DestructiveDialog.d.ts +2 -1
  9. package/dist/console/HistoryPanel.d.ts +2 -1
  10. package/dist/console/QueryConsole.js +0 -3
  11. package/dist/console/SchemaPicker.d.ts +2 -1
  12. package/dist/console/StatementResultView.d.ts +2 -1
  13. package/dist/console/TransactionControls.d.ts +2 -1
  14. package/dist/console/labels.js +0 -1
  15. package/dist/console/useConsoleHistory.d.ts +2 -1
  16. package/dist/ddl/alter-sqlite.js +0 -1
  17. package/dist/ddl/alter.js +0 -1
  18. package/dist/ddl/column.d.ts +2 -1
  19. package/dist/ddl/column.js +0 -1
  20. package/dist/ddl/create.d.ts +2 -1
  21. package/dist/ddl/create.js +0 -2
  22. package/dist/ddl/dialect.js +0 -1
  23. package/dist/ddl/diff.d.ts +4 -3
  24. package/dist/ddl/diff.js +0 -3
  25. package/dist/ddl/draft.js +0 -2
  26. package/dist/ddl/parse.js +0 -4
  27. package/dist/designer/ColumnsEditor.js +0 -1
  28. package/dist/designer/DesignerView.js +0 -1
  29. package/dist/designer/ForeignKeysEditor.d.ts +2 -1
  30. package/dist/designer/NamePicker.d.ts +2 -1
  31. package/dist/designer/SqlPreview.d.ts +2 -1
  32. package/dist/designer/SqlPreview.js +0 -2
  33. package/dist/designer/TableDesigner.js +0 -1
  34. package/dist/designer/edit.js +0 -1
  35. package/dist/designer/plan.js +0 -1
  36. package/dist/explorer/DatabaseExplorer.js +0 -1
  37. package/dist/explorer/RowMenu.d.ts +2 -1
  38. package/dist/explorer/TableDialog.d.ts +2 -1
  39. package/dist/explorer/tree.d.ts +11 -13
  40. package/dist/explorer/tree.js +3 -16
  41. package/dist/explorer/use-explorer-loads.d.ts +2 -1
  42. package/dist/explorer/use-explorer-loads.js +0 -2
  43. package/dist/explorer/use-stored-expansion.d.ts +1 -1
  44. package/dist/grid/CellEditor.d.ts +2 -1
  45. package/dist/grid/CellEditor.js +0 -1
  46. package/dist/grid/CopyAsMenu.d.ts +2 -1
  47. package/dist/grid/DataGrid.js +1 -1
  48. package/dist/grid/EnumPicker.d.ts +2 -1
  49. package/dist/grid/GridHeaderCell.js +0 -3
  50. package/dist/grid/GridRowView.d.ts +3 -2
  51. package/dist/grid/GridRowView.js +1 -0
  52. package/dist/grid/ValueDock.d.ts +2 -3
  53. package/dist/grid/ValueDock.js +2 -3
  54. package/dist/grid/aggregates.d.ts +2 -1
  55. package/dist/grid/cell-range.d.ts +2 -1
  56. package/dist/grid/cell-range.js +0 -2
  57. package/dist/grid/column-layout.d.ts +2 -1
  58. package/dist/grid/column-layout.js +0 -1
  59. package/dist/grid/column-selection.js +0 -1
  60. package/dist/grid/column-view.js +0 -2
  61. package/dist/grid/copy-formats.d.ts +2 -1
  62. package/dist/grid/display.d.ts +3 -2
  63. package/dist/grid/display.js +0 -5
  64. package/dist/grid/edit-value.js +0 -1
  65. package/dist/grid/enum-type.js +0 -1
  66. package/dist/grid/focused-value.js +0 -1
  67. package/dist/grid/layout.d.ts +2 -2
  68. package/dist/grid/layout.js +1 -9
  69. package/dist/grid/navigation.d.ts +2 -1
  70. package/dist/grid/navigation.js +0 -1
  71. package/dist/grid/row-selection.d.ts +3 -2
  72. package/dist/grid/sort.js +0 -2
  73. package/dist/grid/types.js +0 -1
  74. package/dist/grid/whole-cells.d.ts +2 -1
  75. package/dist/host/helper-path.d.ts +1 -0
  76. package/dist/host/helper-path.js +3 -1
  77. package/dist/host/host.js +0 -4
  78. package/dist/host/index.d.ts +1 -1
  79. package/dist/host/index.js +1 -1
  80. package/dist/host/spawn.js +0 -1
  81. package/dist/index.d.ts +1 -1
  82. package/dist/number-notation.d.ts +1 -0
  83. package/dist/number-notation.js +1 -0
  84. package/dist/sql-split.d.ts +3 -2
  85. package/dist/structure/StructureView.js +0 -1
  86. package/dist/table/CommandField.d.ts +2 -1
  87. package/dist/table/ImportDialog.d.ts +2 -1
  88. package/dist/table/ImportDialog.js +0 -3
  89. package/dist/{grid → table}/RecordView.d.ts +3 -2
  90. package/dist/{grid → table}/RecordView.js +5 -6
  91. package/dist/table/TableStatusBar.d.ts +2 -1
  92. package/dist/table/TableStatusBar.js +0 -1
  93. package/dist/table/TableToolbar.d.ts +2 -1
  94. package/dist/table/TableToolbar.js +0 -1
  95. package/dist/table/TableView.d.ts +0 -1
  96. package/dist/table/TableView.js +2 -3
  97. package/dist/table/command-field.d.ts +4 -5
  98. package/dist/table/command-field.js +2 -11
  99. package/dist/table/grid-rows.d.ts +3 -2
  100. package/dist/table/grid-rows.js +0 -1
  101. package/dist/table/import-mapping.js +0 -2
  102. package/dist/table/layout-store.d.ts +0 -1
  103. package/dist/table/layout-store.js +1 -1
  104. package/dist/table/paging.js +0 -1
  105. package/dist/table/pending.d.ts +1 -2
  106. package/dist/table/pending.js +1 -6
  107. package/dist/table/useStoredLayout.d.ts +2 -2
  108. package/dist/table/useStoredLayout.js +1 -1
  109. package/dist/table/useTableTransfer.d.ts +4 -3
  110. package/dist/table/useTableTransfer.js +0 -2
  111. package/dist/testing/fake.js +0 -3
  112. package/dist/value/ValueEditor.d.ts +2 -1
  113. package/dist/value/ValueEditor.js +0 -4
  114. package/dist/value/ValuePanel.js +0 -1
  115. package/dist/value/draft.d.ts +2 -1
  116. package/dist/value/draft.js +0 -1
  117. package/dist/value/hex.d.ts +2 -2
  118. package/dist/value/hex.js +1 -2
  119. package/dist/value/json.d.ts +2 -1
  120. package/dist/value/json.js +0 -1
  121. package/dist/value/views.d.ts +0 -1
  122. package/dist/value/views.js +1 -3
  123. package/dist/workbench/DatabaseWorkbench.js +0 -2
  124. package/dist/workbench/DesignerTab.d.ts +2 -1
  125. package/dist/workbench/TableTab.d.ts +2 -1
  126. package/dist/workbench/tabs.d.ts +3 -2
  127. package/dist/workbench/tabs.js +0 -3
  128. package/package.json +9 -10
  129. package/src/DatabaseProvider.tsx +1 -1
  130. package/src/client/types.ts +0 -2
  131. package/src/client-context.ts +2 -2
  132. package/src/connections/EngineIcon.tsx +1 -1
  133. package/src/connections/docker.ts +0 -3
  134. package/src/connections/use-docker-containers.ts +1 -1
  135. package/src/console/DestructiveDialog.tsx +1 -1
  136. package/src/console/HistoryPanel.tsx +1 -1
  137. package/src/console/QueryConsole.tsx +0 -3
  138. package/src/console/SchemaPicker.tsx +1 -1
  139. package/src/console/StatementResultView.tsx +1 -1
  140. package/src/console/TransactionControls.tsx +1 -1
  141. package/src/console/destructive.ts +0 -1
  142. package/src/console/labels.ts +0 -1
  143. package/src/console/useConsoleHistory.ts +1 -1
  144. package/src/ddl/alter-sqlite.ts +0 -1
  145. package/src/ddl/alter.ts +0 -1
  146. package/src/ddl/column.ts +1 -2
  147. package/src/ddl/create.ts +1 -3
  148. package/src/ddl/dialect.ts +0 -1
  149. package/src/ddl/diff.ts +3 -6
  150. package/src/ddl/draft.ts +0 -2
  151. package/src/ddl/parse.ts +0 -4
  152. package/src/designer/ColumnsEditor.tsx +0 -2
  153. package/src/designer/DesignerView.tsx +0 -5
  154. package/src/designer/ForeignKeysEditor.tsx +1 -1
  155. package/src/designer/NamePicker.tsx +1 -3
  156. package/src/designer/SqlPreview.tsx +1 -3
  157. package/src/designer/TableDesigner.tsx +0 -2
  158. package/src/designer/edit.ts +0 -2
  159. package/src/designer/editor-props.ts +0 -1
  160. package/src/designer/plan.ts +0 -2
  161. package/src/explorer/DatabaseExplorer.tsx +0 -1
  162. package/src/explorer/RowMenu.tsx +1 -1
  163. package/src/explorer/TableDialog.tsx +1 -1
  164. package/src/explorer/expansion.ts +0 -1
  165. package/src/explorer/table-statements.ts +0 -1
  166. package/src/explorer/tree.ts +13 -31
  167. package/src/explorer/use-explorer-loads.ts +1 -4
  168. package/src/explorer/use-stored-expansion.ts +1 -2
  169. package/src/grid/CellEditor.tsx +1 -2
  170. package/src/grid/CopyAsMenu.tsx +1 -1
  171. package/src/grid/DataGrid.tsx +2 -4
  172. package/src/grid/EnumPicker.tsx +1 -2
  173. package/src/grid/GridHeaderCell.tsx +0 -3
  174. package/src/grid/GridRowView.tsx +3 -4
  175. package/src/grid/ValueDock.tsx +3 -6
  176. package/src/grid/aggregates.ts +1 -2
  177. package/src/grid/cell-range.ts +1 -3
  178. package/src/grid/column-layout.ts +1 -2
  179. package/src/grid/column-selection.ts +0 -1
  180. package/src/grid/column-view.ts +0 -2
  181. package/src/grid/copy-formats.ts +1 -2
  182. package/src/grid/display.ts +2 -9
  183. package/src/grid/edit-value.ts +0 -1
  184. package/src/grid/enum-type.ts +0 -1
  185. package/src/grid/focused-value.ts +0 -1
  186. package/src/grid/layout.ts +2 -12
  187. package/src/grid/navigation.ts +1 -3
  188. package/src/grid/row-selection.ts +2 -2
  189. package/src/grid/sort.ts +0 -2
  190. package/src/grid/types.ts +0 -5
  191. package/src/grid/whole-cells.ts +1 -2
  192. package/src/host/helper-path.ts +4 -1
  193. package/src/host/host.ts +0 -6
  194. package/src/host/index.ts +1 -1
  195. package/src/host/spawn.ts +0 -2
  196. package/src/host/types.ts +0 -3
  197. package/src/index.ts +1 -1
  198. package/src/number-notation.ts +2 -0
  199. package/src/protocol/connection.ts +0 -2
  200. package/src/protocol/errors.ts +0 -3
  201. package/src/protocol/messages.ts +0 -1
  202. package/src/protocol/schema.ts +0 -2
  203. package/src/protocol/values.ts +0 -2
  204. package/src/sql-split.ts +2 -2
  205. package/src/structure/StructureView.tsx +0 -1
  206. package/src/table/CommandField.tsx +1 -1
  207. package/src/table/ImportDialog.tsx +1 -7
  208. package/src/{grid → table}/RecordView.tsx +9 -12
  209. package/src/table/TableStatusBar.tsx +1 -3
  210. package/src/table/TableToolbar.tsx +1 -6
  211. package/src/table/TableView.tsx +2 -4
  212. package/src/table/command-field.ts +5 -14
  213. package/src/table/grid-rows.ts +2 -3
  214. package/src/table/import-mapping.ts +0 -2
  215. package/src/table/layout-store.ts +1 -2
  216. package/src/table/paging.ts +0 -1
  217. package/src/table/pending.ts +2 -9
  218. package/src/table/references.ts +0 -1
  219. package/src/table/useStoredLayout.ts +2 -4
  220. package/src/table/useTableTransfer.ts +3 -8
  221. package/src/testing/fake.ts +0 -5
  222. package/src/value/ValueEditor.tsx +1 -5
  223. package/src/value/ValuePanel.tsx +0 -1
  224. package/src/value/draft.ts +1 -2
  225. package/src/value/hex.ts +2 -3
  226. package/src/value/json.ts +1 -2
  227. package/src/value/views.ts +1 -4
  228. package/src/workbench/DatabaseWorkbench.tsx +0 -2
  229. package/src/workbench/DesignerTab.tsx +1 -2
  230. package/src/workbench/TableTab.tsx +1 -1
  231. package/src/workbench/tabs.ts +2 -7
@@ -9,13 +9,12 @@ import type { Aggregates } from '../grid/aggregates.ts';
9
9
  import { numeralText } from '../grid/display.ts';
10
10
  import type { PageBounds } from './paging.ts';
11
11
 
12
- /* What the selected cells add up to, and which columns they are in. */
13
12
  export interface SelectionFigures {
14
13
  readonly columns: readonly string[];
15
14
  readonly aggregates: Aggregates;
16
15
  }
17
16
 
18
- export interface TableStatusBarProps {
17
+ interface TableStatusBarProps {
19
18
  elapsedMs: number;
20
19
  bounds: PageBounds;
21
20
  counting: boolean;
@@ -28,7 +27,6 @@ export interface TableStatusBarProps {
28
27
  ref?: Ref<HTMLElement>;
29
28
  }
30
29
 
31
- /* Which rows are on the page and how many there are, the way to the other pages, and the figures of the selected cells. */
32
30
  export function TableStatusBar({ elapsedMs, bounds, counting, selection, onCount, onPrevious, onNext, className, ref }: TableStatusBarProps) {
33
31
  const { t } = useTranslation('database');
34
32
 
@@ -25,8 +25,7 @@ import { CommandField } from './CommandField.tsx';
25
25
  import { PAGE_SIZES, type PageBounds } from './paging.ts';
26
26
 
27
27
  /* The menu of export and import; present only when the app can show file dialogs. */
28
- export interface TransferMenu {
29
- /* An export is running. */
28
+ interface TransferMenu {
30
29
  busy: boolean;
31
30
  onExport(format: FileFormat): void;
32
31
  /* Left out where rows cannot be added. */
@@ -40,7 +39,6 @@ export interface TableToolbarProps {
40
39
  /* Why rows cannot be added, changed or deleted, or `null` when they can. */
41
40
  readOnlyReason: string | null;
42
41
  hasSelection: boolean;
43
- /* Whether any selected row has a change to take back. */
44
42
  canRevertSelection: boolean;
45
43
  /* The record view replaces the grid with the focused row as a list of fields. */
46
44
  recordViewOpen?: boolean;
@@ -49,11 +47,9 @@ export interface TableToolbarProps {
49
47
  submitting: boolean;
50
48
  engine: Engine;
51
49
  chips: readonly Chip[];
52
- /* The columns the command field suggests. */
53
50
  columns: readonly CommandColumn[];
54
51
  pageSize: number;
55
52
  bounds: PageBounds;
56
- /* The text input of the command field, for the owner to focus. */
57
53
  commandRef?: Ref<HTMLInputElement>;
58
54
  onChipsChange(next: Chip[]): void;
59
55
  onJumpToColumn(name: string): void;
@@ -73,7 +69,6 @@ export interface TableToolbarProps {
73
69
  ref?: Ref<HTMLDivElement>;
74
70
  }
75
71
 
76
- /* The command field for filtering, sorting and jumping to a column, refresh, add row, the submit of pending changes, and a menu of the rest. */
77
72
  export function TableToolbar({
78
73
  start,
79
74
  refreshing,
@@ -23,7 +23,6 @@ import { useDatabaseAction, useDatabaseClient, useDatabaseFiles, useDatabaseNoti
23
23
  import { DatabaseRequestError, type Connection } from '../client/types.ts';
24
24
  import { aggregateBlock, blockSize, type RangeBlock } from '../grid/aggregates.ts';
25
25
  import { DataGrid } from '../grid/DataGrid.tsx';
26
- import { RecordView } from '../grid/RecordView.tsx';
27
26
  import type { GridSort } from '../grid/sort.ts';
28
27
  import type { ColumnRequest, FocusedCell, FocusRequest, GridMenuContext } from '../grid/types.ts';
29
28
  import { ValueDock } from '../grid/ValueDock.tsx';
@@ -68,6 +67,7 @@ import {
68
67
  type PendingChanges,
69
68
  type RowSelectionRefs
70
69
  } from './pending.ts';
70
+ import { RecordView } from './RecordView.tsx';
71
71
  import { foreignKeyOf, referenceOf, type Reference } from './references.ts';
72
72
  import { TableStatusBar } from './TableStatusBar.tsx';
73
73
  import { TableToolbar } from './TableToolbar.tsx';
@@ -76,7 +76,7 @@ import { useStoredLayout } from './useStoredLayout.ts';
76
76
  import { useTableTransfer, type TransferNotice } from './useTableTransfer.ts';
77
77
 
78
78
  /* Where the width of the record view is kept, in pixels, for every table. */
79
- export const RECORD_WIDTH_KEY = 'database:record-view';
79
+ const RECORD_WIDTH_KEY = 'database:record-view';
80
80
  const RECORD_WIDTH = 360;
81
81
 
82
82
  export interface TableViewProps {
@@ -88,7 +88,6 @@ export interface TableViewProps {
88
88
  /* The filters the view starts with, such as the condition of a jump along a foreign key. They win over the ones remembered. */
89
89
  defaultWhere?: string;
90
90
  defaultOrderBy?: string;
91
- /* Told whether the view holds changes that are not submitted, whenever that changes. */
92
91
  onDirtyChange?(dirty: boolean): void;
93
92
  className?: string;
94
93
  ref?: Ref<HTMLDivElement>;
@@ -117,7 +116,6 @@ const readOnlyReasonOf = (connection: Connection, structure: TableStructure | nu
117
116
  return null;
118
117
  };
119
118
 
120
- /* What the strip over the table, or the app's notice, says of an export or an import. */
121
119
  const transferText = (found: TransferNotice, t: TFunction<'database'>): string => {
122
120
  switch (found.kind) {
123
121
  case 'exporting':
@@ -19,14 +19,14 @@ export interface FilterChip {
19
19
  readonly sql: string;
20
20
  }
21
21
 
22
- export interface SortChip {
22
+ interface SortChip {
23
23
  readonly kind: 'sort';
24
24
  readonly column: string;
25
25
  readonly direction: SortDirection;
26
26
  }
27
27
 
28
28
  /* An ORDER BY that is more than a list of columns, such as one with `NULLS LAST`, kept as it was written. */
29
- export interface OrderChip {
29
+ interface OrderChip {
30
30
  readonly kind: 'order';
31
31
  readonly text: string;
32
32
  }
@@ -45,8 +45,7 @@ export type Suggestion =
45
45
  | { readonly kind: 'filter' | 'sort' | 'jump'; readonly column: CommandColumn }
46
46
  | { readonly kind: 'sql'; readonly chip: FilterChip };
47
47
 
48
- /* How many columns the suggestions list for what is typed. */
49
- export const SUGGESTED_COLUMNS = 4;
48
+ const SUGGESTED_COLUMNS = 4;
50
49
 
51
50
  const OR = /\bor\b/i;
52
51
  const BARE_NAME = /^[A-Za-z_][\w$]*$/;
@@ -60,7 +59,7 @@ const IS_TEST = /^IS\s+(?:NOT\s+)?(?:NULL|TRUE|FALSE)$/i;
60
59
  /* A name being typed, or one that opened a quote. Whitespace after it means an operator is coming. */
61
60
  const NAME_BEING_TYPED = /^\s*(?:[\w$]*|[`"][^`"]*[`"]?)$/;
62
61
 
63
- export const chipKey = (chip: Chip): string => (chip.kind === 'sort' ? `sort:${chip.column}` : `${chip.kind}:${chip.kind === 'filter' ? chip.sql : chip.text}`);
62
+ const chipKey = (chip: Chip): string => (chip.kind === 'sort' ? `sort:${chip.column}` : `${chip.kind}:${chip.kind === 'filter' ? chip.sql : chip.text}`);
64
63
 
65
64
  const isFilter = (chip: Chip): chip is FilterChip => chip.kind === 'filter';
66
65
 
@@ -100,10 +99,8 @@ export const chipsToOrderBy = (engine: Engine, chips: readonly Chip[]): string =
100
99
 
101
100
  export const sortsOf = (chips: readonly Chip[]): ColumnSort[] => chips.filter(isSort).map(({ column, direction }) => ({ column, direction }));
102
101
 
103
- /* The sorts of a header menu replace every sort and raw ORDER BY, keeping the filters where they are. */
104
102
  export const withSorts = (chips: readonly Chip[], sorts: readonly ColumnSort[]): Chip[] => [...chips.filter(isFilter), ...sorts.map(sortChip)];
105
103
 
106
- /* A column that is not sorted joins as ascending; one that is flips its direction where it stands. */
107
104
  export const toggleSort = (chips: readonly Chip[], column: string): Chip[] => {
108
105
  if (!chips.some((chip) => isSort(chip) && chip.column === column)) {
109
106
  return [...chips, { kind: 'sort', column, direction: 'asc' }];
@@ -112,13 +109,11 @@ export const toggleSort = (chips: readonly Chip[], column: string): Chip[] => {
112
109
  return chips.map((chip) => (isSort(chip) && chip.column === column ? { ...chip, direction: chip.direction === 'asc' ? 'desc' : 'asc' } : chip));
113
110
  };
114
111
 
115
- /* The same list when the chip is already in it. */
116
112
  export const addChip = (chips: readonly Chip[], chip: Chip): Chip[] =>
117
113
  chips.some((other) => chipKey(other) === chipKey(chip)) ? [...chips] : [...chips, chip];
118
114
 
119
115
  export const removeChipAt = (chips: readonly Chip[], index: number): Chip[] => chips.filter((_, at) => at !== index);
120
116
 
121
- /* Puts the chip where another stood, dropping it if an equal one is already elsewhere in the list. */
122
117
  export const replaceChipAt = (chips: readonly Chip[], index: number, chip: Chip): Chip[] => {
123
118
  const duplicate = chips.some((other, at) => at !== index && chipKey(other) === chipKey(chip));
124
119
 
@@ -153,7 +148,7 @@ export const sortChipsOf = (engine: Engine, orderBy: string): Chip[] => {
153
148
  return sorts === null ? [{ kind: 'order', text }] : sorts.map(sortChip);
154
149
  };
155
150
 
156
- export interface ChipSource {
151
+ interface ChipSource {
157
152
  readonly where: string;
158
153
  readonly orderBy: string;
159
154
  readonly remembered?: readonly StoredFilter[];
@@ -164,7 +159,6 @@ export const chipsFromQuery = (engine: Engine, { where, orderBy, remembered }: C
164
159
  ...sortChipsOf(engine, orderBy)
165
160
  ];
166
161
 
167
- /* Whether quotes and parentheses close, outside of which an operand would swallow the rest of the text. */
168
162
  const isClosed = (operand: string): boolean => {
169
163
  let quote: string | null = null;
170
164
  let depth = 0;
@@ -190,7 +184,6 @@ const isClosed = (operand: string): boolean => {
190
184
 
191
185
  const upper = (keyword: string): string => keyword.replace(/\s+/g, ' ').toUpperCase();
192
186
 
193
- /* The operator and operands of a condition in the form the chip shows, or `null` when the text does not read as one. */
194
187
  const readOperation = (rest: string): string | null => {
195
188
  const compare = COMPARE.exec(rest);
196
189
 
@@ -246,7 +239,6 @@ export const cellChip = (engine: Engine, column: string, value: LiteralValue, ki
246
239
  return { kind: 'filter', text, sql: exclude ? notEqualsCondition(engine, column, value, kind) : equalsCondition(engine, column, value, kind) };
247
240
  };
248
241
 
249
- /* Cuts a long text for a label, ending in an ellipsis. */
250
242
  export const shorten = (text: string, limit: number): string => (text.length > limit ? `${text.slice(0, limit - 1)}…` : text);
251
243
 
252
244
  /* How well a name matches what is typed: 0 is the name itself, then its start, a word of it, anywhere in it; `null` is no match. */
@@ -268,7 +260,6 @@ const rankOf = (name: string, token: string): number | null => {
268
260
  return lower.includes(token) ? 3 : null;
269
261
  };
270
262
 
271
- /* The columns that match a typed name, the closest first and in table order among equals. */
272
263
  export const matchColumns = (columns: readonly CommandColumn[], typed: string, limit = SUGGESTED_COLUMNS): CommandColumn[] => {
273
264
  const token = typed.trim().replace(/^[`"]/, '').replace(/[`"]$/, '').toLowerCase();
274
265
 
@@ -4,7 +4,7 @@ import { gridColumnOf, type GridColumn, type GridRow } from '../grid/types.ts';
4
4
  import type { EditValue, RowsResult, TableStructure } from '../protocol/index.ts';
5
5
  import { rowKeyOf, type PendingChanges } from './pending.ts';
6
6
 
7
- export type RowRef = { readonly kind: 'loaded'; readonly index: number } | { readonly kind: 'inserted'; readonly id: number };
7
+ type RowRef = { readonly kind: 'loaded'; readonly index: number } | { readonly kind: 'inserted'; readonly id: number };
8
8
 
9
9
  export const loadedRowKey = (index: number): string => `row:${index}`;
10
10
 
@@ -21,7 +21,7 @@ export const buildGridColumns = (loaded: Pick<RowsResult, 'columns'>, structure:
21
21
  return loaded.columns.map((column) => gridColumnOf(column, infoOf(column.name), keys));
22
22
  };
23
23
 
24
- export interface GridRowsInput {
24
+ interface GridRowsInput {
25
25
  readonly structure: TableStructure | null;
26
26
  readonly loaded: Pick<RowsResult, 'columns' | 'rows'>;
27
27
  readonly pending: PendingChanges;
@@ -29,7 +29,6 @@ export interface GridRowsInput {
29
29
  readonly offset: number;
30
30
  }
31
31
 
32
- /* The loaded rows with their pending edits laid over them, then the rows waiting to be inserted. */
33
32
  export const buildGridRows = ({ structure, loaded, pending, offset }: GridRowsInput): GridRow[] => {
34
33
  const rows = loaded.rows.map((cells, index): GridRow => {
35
34
  const edits = pending.edits[index];
@@ -5,7 +5,6 @@ export type ImportFormat = 'csv' | 'tsv';
5
5
  /* The columns an import can fill. The server computes a generated column. */
6
6
  export const importableColumns = (columns: readonly ColumnInfo[]): ColumnInfo[] => columns.filter((column) => !column.generated);
7
7
 
8
- /* CSV or TSV by the extension of the path; CSV when it says neither. */
9
8
  export const formatOfPath = (path: string): ImportFormat => (/\.(tsv|tab)$/i.test(path) ? 'tsv' : 'csv');
10
9
 
11
10
  /*
@@ -37,6 +36,5 @@ export const matchColumns = (fileColumns: readonly string[], tableColumns: reado
37
36
  /* Whether anything is mapped, since an import of nothing is no import. */
38
37
  export const hasMapping = (mapping: readonly (string | null)[]): boolean => mapping.some((column) => column !== null);
39
38
 
40
- /* Maps a file column to a table column, taking the table column from any other file column that had it. */
41
39
  export const mapColumn = (mapping: readonly (string | null)[], fileColumn: number, tableColumn: string | null): (string | null)[] =>
42
40
  mapping.map((current, index) => (index === fileColumn ? tableColumn : tableColumn !== null && current === tableColumn ? null : current));
@@ -7,9 +7,8 @@ import { PAGE_SIZES } from './paging.ts';
7
7
  * Bump when the shape changes; a stored value of another version is ignored rather than migrated. `filters`
8
8
  * came later without a bump, since `where` still says the same thing for a value without it.
9
9
  */
10
- export const LAYOUT_VERSION = 1;
10
+ const LAYOUT_VERSION = 1;
11
11
 
12
- /* What is remembered of one table's view between visits. */
13
12
  export interface StoredLayout extends GridLayout {
14
13
  readonly pageSize: number | null;
15
14
  readonly where: string;
@@ -30,5 +30,4 @@ export const pageBounds = (offset: number, rowCount: number, hasMore: boolean, c
30
30
  };
31
31
  };
32
32
 
33
- /* Where the last page starts, given how many rows the table has. */
34
33
  export const lastPageOffset = (total: number, pageSize: number): number => (total <= 0 ? 0 : Math.floor((total - 1) / pageSize) * pageSize);
@@ -1,9 +1,8 @@
1
1
  import { valueOfCell, type Cell, type EditValue, type RowChange, type RowKey, type RowsResult, type TableStructure, type Value } from '../protocol/index.ts';
2
2
 
3
- export interface InsertedRow {
3
+ interface InsertedRow {
4
4
  /* Unique among the inserted rows; the grid keys the row by it. */
5
5
  readonly id: number;
6
- /* The columns a person filled in; the others take their default. */
7
6
  readonly values: Readonly<Record<string, EditValue>>;
8
7
  }
9
8
 
@@ -26,7 +25,7 @@ export const isPendingEmpty = (pending: PendingChanges): boolean =>
26
25
  export const pendingCount = (pending: PendingChanges): number =>
27
26
  Object.keys(pending.edits).filter((row) => !pending.deletes.has(Number(row))).length + pending.inserts.length + pending.deletes.size;
28
27
 
29
- export const valuesEqual = (left: EditValue | undefined, right: EditValue | undefined): boolean => {
28
+ const valuesEqual = (left: EditValue | undefined, right: EditValue | undefined): boolean => {
30
29
  if (left === undefined || right === undefined) {
31
30
  return false;
32
31
  }
@@ -47,7 +46,6 @@ export const setEdit = (pending: PendingChanges, row: number, column: string, va
47
46
  return { ...pending, edits: Object.keys(next).length === 0 ? others : { ...others, [row]: next } };
48
47
  };
49
48
 
50
- /* A new row to insert, filled in with `values`. */
51
49
  export const addInsertWith = (pending: PendingChanges, values: Readonly<Record<string, EditValue>>): PendingChanges => ({
52
50
  ...pending,
53
51
  inserts: [...pending.inserts, { id: pending.inserts.reduce((highest, row) => Math.max(highest, row.id), 0) + 1, values }]
@@ -67,7 +65,6 @@ export const markDeleted = (pending: PendingChanges, rows: readonly number[]): P
67
65
  deletes: new Set([...pending.deletes, ...rows])
68
66
  });
69
67
 
70
- /* Takes back every change to one loaded row: its edits and its deletion. */
71
68
  export const revertRow = (pending: PendingChanges, row: number): PendingChanges => {
72
69
  const { [row]: _dropped, ...edits } = pending.edits;
73
70
  const deletes = new Set(pending.deletes);
@@ -76,20 +73,17 @@ export const revertRow = (pending: PendingChanges, row: number): PendingChanges
76
73
  return { ...pending, edits, deletes };
77
74
  };
78
75
 
79
- /* Rows of a page, by the index of the loaded ones and the id of the inserted ones. */
80
76
  export interface RowSelectionRefs {
81
77
  readonly loaded: readonly number[];
82
78
  readonly inserted: readonly number[];
83
79
  }
84
80
 
85
- /* Takes back every change to the given rows: the edits and deletion marks of the loaded ones, and the inserted ones altogether. */
86
81
  export const revertRows = (pending: PendingChanges, rows: RowSelectionRefs): PendingChanges => {
87
82
  const reverted = rows.loaded.reduce(revertRow, pending);
88
83
 
89
84
  return { ...reverted, inserts: reverted.inserts.filter((row) => !rows.inserted.includes(row.id)) };
90
85
  };
91
86
 
92
- /* Whether any of the given rows has something to take back. */
93
87
  export const hasRowChanges = (pending: PendingChanges, rows: RowSelectionRefs): boolean =>
94
88
  rows.loaded.some((row) => pending.edits[row] !== undefined || pending.deletes.has(row)) || pending.inserts.some((row) => rows.inserted.includes(row.id));
95
89
 
@@ -159,7 +153,6 @@ const keyValueText = (value: Value): string => {
159
153
  return typeof value === 'string' ? `'${value}'` : String(value);
160
154
  };
161
155
 
162
- /* A key as a person would write it in a WHERE: `id = 5, tenant = 'a'`. */
163
156
  export const describeKey = (key: RowKey): string =>
164
157
  Object.entries(key)
165
158
  .map(([column, value]) => `${column} = ${keyValueText(value)}`)
@@ -3,7 +3,6 @@ import { wholeValueOf } from '../grid/focused-value.ts';
3
3
  import type { Engine, ForeignKeyInfo, ValueKind } from '../protocol/index.ts';
4
4
  import { matchCondition, type ColumnMatch } from '../sql.ts';
5
5
 
6
- /* Where a foreign key points for one row: the referenced table and the condition that picks the row out. */
7
6
  export interface Reference {
8
7
  readonly schema: string;
9
8
  readonly table: string;
@@ -3,12 +3,10 @@ import type { DatabaseStorage } from '../actions.ts';
3
3
  import { EMPTY_LAYOUT, parseStoredLayout, serializeLayout, type StoredLayout } from './layout-store.ts';
4
4
 
5
5
  /* How long a change waits for the next before it is written, so a drag of a column edge is one write. */
6
- export const STORE_DELAY_MS = 500;
6
+ const STORE_DELAY_MS = 500;
7
7
 
8
- export interface StoredLayoutHandle {
9
- /* What was stored when the view mounted, or `null` when nothing usable was. */
8
+ interface StoredLayoutHandle {
10
9
  readonly stored: StoredLayout | null;
11
- /* Merges a change into what is remembered and writes it after a pause. Does nothing without storage. */
12
10
  remember(change: Partial<StoredLayout>): void;
13
11
  }
14
12
 
@@ -6,18 +6,15 @@ import type { FileFormat, TableStructure } from '../protocol/index.ts';
6
6
  import { formatOfPath, importableColumns, mapColumn, matchColumns, type ImportFormat } from './import-mapping.ts';
7
7
  import type { ImportSample } from './ImportDialog.tsx';
8
8
 
9
- /* What the strip over the table says about an export or an import. */
10
9
  export type TransferNotice =
11
10
  | { readonly kind: 'exporting'; readonly format: FileFormat }
12
11
  | { readonly kind: 'exported'; readonly rows: number }
13
12
  | { readonly kind: 'imported'; readonly rows: number }
14
13
  | { readonly kind: 'failed'; readonly during: 'export' | 'import'; readonly message: string };
15
14
 
16
- /* How long a finished export or import stays on the strip. */
17
15
  const NOTICE_MS = 8000;
18
16
 
19
- /* The import a person is setting up. */
20
- export interface ImportDraft {
17
+ interface ImportDraft {
21
18
  readonly path: string;
22
19
  readonly format: ImportFormat;
23
20
  readonly header: boolean;
@@ -28,7 +25,7 @@ export interface ImportDraft {
28
25
  readonly error: string | null;
29
26
  }
30
27
 
31
- export interface TableTransferInput {
28
+ interface TableTransferInput {
32
29
  readonly client: DatabaseClient;
33
30
  readonly session: DatabaseSession;
34
31
  /* Without the app's file dialogs there is no export and no import. */
@@ -39,13 +36,12 @@ export interface TableTransferInput {
39
36
  /* The filters as applied, which an export respects. */
40
37
  readonly where: string;
41
38
  readonly orderBy: string;
42
- /* Rows were added; the table reloads. */
43
39
  readonly onImported: () => void;
44
40
  /* Takes what finished or failed off the strip, for the app to show; the strip keeps only a running export. */
45
41
  readonly report?: (notice: TransferNotice) => void;
46
42
  }
47
43
 
48
- export interface TableTransfer {
44
+ interface TableTransfer {
49
45
  readonly notice: TransferNotice | null;
50
46
  readonly importDraft: ImportDraft | null;
51
47
  exportAs(format: FileFormat): void;
@@ -58,7 +54,6 @@ export interface TableTransfer {
58
54
  closeImport(): void;
59
55
  }
60
56
 
61
- /* Export of the table as filtered, and import of a file into it, with the state both need between the dialogs and the strip. */
62
57
  export function useTableTransfer({ client, session, files, schema, table, structure, where, orderBy, onImported, report }: TableTransferInput): TableTransfer {
63
58
  const [notice, setNotice] = useState<TransferNotice | null>(null);
64
59
  const [importDraft, setImportDraft] = useState<ImportDraft | null>(null);
@@ -28,7 +28,6 @@ export interface FakeTable {
28
28
  readonly columns: readonly ColumnInfo[];
29
29
  /* Also the row key. A table without one is read only. */
30
30
  readonly primaryKey?: readonly string[];
31
- /* One row per entry, its values in the order of `columns`. */
32
31
  readonly rows: readonly (readonly Value[])[];
33
32
  readonly indexes?: readonly IndexInfo[];
34
33
  readonly foreignKeys?: readonly ForeignKeyInfo[];
@@ -50,7 +49,6 @@ export interface FakeDatabaseTransportOptions {
50
49
  readonly latencyMs?: number;
51
50
  /* What every `open` and `test` reports. Derived from the engine when left out. */
52
51
  readonly server?: ServerInfo;
53
- /* What `discover` lists. Nothing when left out. */
54
52
  readonly containers?: readonly DockerContainer[];
55
53
  }
56
54
 
@@ -140,7 +138,6 @@ const findTable = (session: Session, schema: string, name: string): Table => {
140
138
  return table;
141
139
  };
142
140
 
143
- /* The columns that pick out one row: the primary key, or else the first unique index over columns that cannot be null. */
144
141
  const rowKeyOf = (table: Table): string[] | null => {
145
142
  if (table.primaryKey.length > 0) {
146
143
  return table.primaryKey;
@@ -215,7 +212,6 @@ const toRowsResult = (table: Table, rows: readonly (readonly Value[])[], offset:
215
212
  return { columns: toResultColumns(table), rows: page, hasMore: rows.length > offset + limit, elapsedMs: 0 };
216
213
  };
217
214
 
218
- /* Evaluates the default of a column for a row an insert or an update leaves it out of. */
219
215
  const defaultOf = (column: ColumnInfo, table: Table): Value => {
220
216
  if (column.autoIncrement) {
221
217
  const index = table.columns.indexOf(column);
@@ -358,7 +354,6 @@ const runStatement = (session: Session, sql: string, limit: number, cellLimit: n
358
354
  }
359
355
  };
360
356
 
361
- /* Makes a schema the selected one, as a call that names `schema` does. */
362
357
  const selectSchema = (session: Session, schema: string | undefined): void => {
363
358
  if (schema === undefined) {
364
359
  return;
@@ -30,17 +30,13 @@ const WRAPPING_VIEWS: ReadonlySet<ViewId> = new Set(['text', 'formatted', 'utf8'
30
30
  const READING_FRAME = 'flex-1 rounded-lg border border-border bg-surface';
31
31
  const READING = `p-2 ${CODE_TEXT} text-text`;
32
32
 
33
- export interface ValueEditorProps {
33
+ interface ValueEditorProps {
34
34
  column: GridColumn;
35
35
  value: Value;
36
36
  editable: boolean;
37
37
  onCommit?(value: EditValue): void;
38
38
  }
39
39
 
40
- /*
41
- * The whole of one value, to read and change what a cell is too small for: Text, Formatted for JSON, or
42
- * Hex, Text and UUID for binary, with the checks of JSON and hex before a change is taken.
43
- */
44
40
  export function ValueEditor({ column, value, editable, onCommit }: ValueEditorProps) {
45
41
  const { t } = useTranslation('database');
46
42
  const { name, type, kind } = column;
@@ -22,7 +22,6 @@ export interface ValuePanelProps {
22
22
  ref?: Ref<HTMLDivElement>;
23
23
  }
24
24
 
25
- /* The whole value of the focused cell beside the grid, to read and edit what a cell is too small for. */
26
25
  export function ValuePanel({ column, value, loading, editable, onCommit, onClose, className, ref }: ValuePanelProps) {
27
26
  const { t } = useTranslation('database');
28
27
  const ready = column !== null && !loading && value !== undefined;
@@ -22,9 +22,8 @@ export interface Source {
22
22
 
23
23
  export type DraftProblem = { readonly kind: 'json'; readonly reason: string } | { readonly kind: 'hex'; readonly problem: HexProblem };
24
24
 
25
- export type Conversion = { readonly ok: true; readonly value: EditValue } | { readonly ok: false; readonly problem: DraftProblem };
25
+ type Conversion = { readonly ok: true; readonly value: EditValue } | { readonly ok: false; readonly problem: DraftProblem };
26
26
 
27
- /* The text a value is edited as: a binary value as its hex, everything else as it is written. */
28
27
  const textOf = (value: Exclude<Value, null>): string => (typeof value === 'object' ? value.hex : String(value));
29
28
 
30
29
  export const sourceOf = (column: Pick<GridColumn, 'name' | 'type' | 'kind'>, value: Value): Source => {
package/src/value/hex.ts CHANGED
@@ -2,9 +2,9 @@
2
2
 
3
3
  export type HexProblem = 'characters' | 'odd';
4
4
 
5
- export type ParsedHex = { readonly ok: true; readonly hex: string } | { readonly ok: false; readonly problem: HexProblem };
5
+ type ParsedHex = { readonly ok: true; readonly hex: string } | { readonly ok: false; readonly problem: HexProblem };
6
6
 
7
- export const BYTES_PER_LINE = 16;
7
+ const BYTES_PER_LINE = 16;
8
8
 
9
9
  const GROUP = 8;
10
10
  const GROUP_WIDTH = GROUP * 3 - 1;
@@ -36,7 +36,6 @@ export const bytesOf = (hex: string): Uint8Array => {
36
36
  /* Bytes that are not valid UTF-8 become replacement characters rather than an error. */
37
37
  export const decodeUtf8 = (hex: string): string => new TextDecoder('utf-8').decode(bytesOf(hex));
38
38
 
39
- /* A UUID is exactly 16 bytes; anything else has no UUID form. */
40
39
  export const formatUuid = (hex: string): string | null => {
41
40
  if (hex.length !== UUID_BYTES * 2) {
42
41
  return null;
package/src/value/json.ts CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  const INDENT = ' ';
4
4
 
5
- export type JsonCheck = { readonly ok: true } | { readonly ok: false; readonly reason: string };
5
+ type JsonCheck = { readonly ok: true } | { readonly ok: false; readonly reason: string };
6
6
 
7
7
  export const checkJson = (text: string): JsonCheck => {
8
8
  try {
@@ -21,7 +21,6 @@ export const isJsonDocument = (text: string): boolean => {
21
21
  return (start === '{' || start === '[') && checkJson(text).ok;
22
22
  };
23
23
 
24
- /* The text laid out with two spaces per level, or `null` when it is not JSON. */
25
24
  export const prettyJson = (text: string): string | null => {
26
25
  if (!checkJson(text).ok) {
27
26
  return null;
@@ -4,7 +4,6 @@ import { checkJson, prettyJson } from './json.ts';
4
4
 
5
5
  export type ViewId = 'text' | 'formatted' | 'hex' | 'utf8' | 'uuid';
6
6
 
7
- /* The views that make sense for this value, the first being the one it opens in. */
8
7
  export const viewsOf = (source: Source, draft: Draft): ViewId[] => {
9
8
  if (source.binary) {
10
9
  const parsed = parseHex(draft.text);
@@ -16,7 +15,6 @@ export const viewsOf = (source: Source, draft: Draft): ViewId[] => {
16
15
  return source.json ? ['formatted', 'text'] : ['text'];
17
16
  };
18
17
 
19
- /* What a draft is, in bytes for a binary value and in characters for the rest; `null` when there is nothing to measure. */
20
18
  export const sizeOf = (source: Source, draft: Draft): { unit: 'bytes' | 'characters'; count: number } | null => {
21
19
  if (draft.mode !== 'value') {
22
20
  return null;
@@ -32,10 +30,9 @@ export const sizeOf = (source: Source, draft: Draft): { unit: 'bytes' | 'charact
32
30
  };
33
31
 
34
32
  /* A read only view stops its dump here; the text view and a copy are not limited. */
35
- export const DUMP_LIMIT_BYTES = 16 * 1024;
33
+ const DUMP_LIMIT_BYTES = 16 * 1024;
36
34
 
37
35
  export type Rendered =
38
- /* A NULL or a DEFAULT, which has nothing to lay out. */
39
36
  | { readonly kind: 'empty' }
40
37
  | { readonly kind: 'text'; readonly text: string; readonly truncated?: { readonly shown: number; readonly total: number } }
41
38
  | { readonly kind: 'problem'; readonly problem: DraftProblem };
@@ -79,7 +79,6 @@ export function DatabaseWorkbench({ connections, onConnectionsChange, className,
79
79
  const [width, setWidth] = useState(DEFAULT_WIDTH);
80
80
  const [managing, setManaging] = useState(false);
81
81
  const [managed, setManaged] = useState<string | null>(null);
82
- /* Ids of the table tabs that hold changes nobody submitted, and the tab a person asked to close while it does. */
83
82
  const [dirty, setDirty] = useState<ReadonlySet<string>>(() => new Set());
84
83
  const [closing, setClosing] = useState<string | null>(null);
85
84
  const { startResize } = useColumnResize(column, { size: width, min: MIN_WIDTH, from: 'left', max: () => window.innerWidth / 2, onSize: setWidth });
@@ -181,7 +180,6 @@ export function DatabaseWorkbench({ connections, onConnectionsChange, className,
181
180
  setState((current) => closeTab(current, id));
182
181
  }
183
182
 
184
- /* A table tab with changes that are not submitted asks first. */
185
183
  function requestClose(id: string): void {
186
184
  if (dirty.has(id)) {
187
185
  setClosing(id);
@@ -6,10 +6,9 @@ import { TableDesigner } from '../designer/TableDesigner.tsx';
6
6
  import { useStableCallback } from '../use-stable-callback.ts';
7
7
  import type { WorkbenchTab } from './tabs.ts';
8
8
 
9
- export interface DesignerTabProps {
9
+ interface DesignerTabProps {
10
10
  connection: Connection;
11
11
  tab: Extract<WorkbenchTab, { kind: 'designer' }>;
12
- /* The designer saved the table under this name, so the tab is now the designer of that table. */
13
12
  onTableChange(table: string): void;
14
13
  }
15
14
 
@@ -3,7 +3,7 @@ import { StructureView } from '../structure/StructureView.tsx';
3
3
  import { TableView } from '../table/TableView.tsx';
4
4
  import type { WorkbenchTab } from './tabs.ts';
5
5
 
6
- export interface TableTabProps {
6
+ interface TableTabProps {
7
7
  connection: Connection;
8
8
  tab: Extract<WorkbenchTab, { kind: 'table' }>;
9
9
  /* Told whether the data holds changes that are not submitted. The view that switches `tab.view` is the workbench's. */
@@ -1,19 +1,17 @@
1
1
  import type { TableRef } from '../client/types.ts';
2
2
 
3
- export type TableViewMode = 'data' | 'structure';
3
+ type TableViewMode = 'data' | 'structure';
4
4
 
5
5
  export type WorkbenchTab =
6
6
  | { readonly id: string; readonly kind: 'table'; readonly ref: TableRef; readonly view: TableViewMode; readonly where?: string }
7
7
  | { readonly id: string; readonly kind: 'console'; readonly connectionId: string; readonly schema?: string; readonly sql: string; readonly number: number }
8
- /* Without `table` the designer makes a new table. */
9
8
  | { readonly id: string; readonly kind: 'designer'; readonly connectionId: string; readonly schema: string; readonly table?: string };
10
9
 
11
- export interface WorkbenchState {
10
+ interface WorkbenchState {
12
11
  readonly tabs: readonly WorkbenchTab[];
13
12
  readonly activeId: string | null;
14
13
  /* The next number for an id that is not derived from what the tab shows. Never reused, so a restored tab cannot clash with a new one. */
15
14
  readonly serial: number;
16
- /* The number the last console got, for its title. */
17
15
  readonly consoles: number;
18
16
  }
19
17
 
@@ -92,7 +90,6 @@ export const setTableView = (state: WorkbenchState, id: string, view: TableViewM
92
90
  export const setConsoleSql = (state: WorkbenchState, id: string, sql: string): WorkbenchState =>
93
91
  update(state, id, (tab) => (tab.kind === 'console' && tab.sql !== sql ? { ...tab, sql } : tab));
94
92
 
95
- /* The designer of a new table became the designer of that table, in the same tab. Closes any other designer of it. */
96
93
  export const setDesignerTable = (state: WorkbenchState, id: string, table: string): WorkbenchState => {
97
94
  const subject = state.tabs.find((tab) => tab.id === id);
98
95
 
@@ -105,7 +102,6 @@ export const setDesignerTable = (state: WorkbenchState, id: string, table: strin
105
102
  return update({ ...state, tabs }, id, (tab) => (tab.kind === 'designer' ? { ...tab, table } : tab));
106
103
  };
107
104
 
108
- /* The tab next to the closed one comes forward when the closed one was in front. */
109
105
  export const closeTab = (state: WorkbenchState, id: string): WorkbenchState => {
110
106
  const at = state.tabs.findIndex((tab) => tab.id === id);
111
107
 
@@ -118,7 +114,6 @@ export const closeTab = (state: WorkbenchState, id: string): WorkbenchState => {
118
114
  return { ...state, tabs, activeId: state.activeId === id ? (tabs[Math.min(at, tabs.length - 1)]?.id ?? null) : state.activeId };
119
115
  };
120
116
 
121
- /* Drops the tabs of connections that are gone. */
122
117
  export const pruneTabs = (state: WorkbenchState, connectionIds: ReadonlySet<string>): WorkbenchState => {
123
118
  const tabs = state.tabs.filter((tab) => connectionIds.has(connectionIdOf(tab)));
124
119