@adecore/database 0.54.2 → 0.54.3

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 (47) hide show
  1. package/dist/client-context.js +1 -1
  2. package/dist/connections/connection-config.js +1 -1
  3. package/dist/console/SqlEditor.js +1 -1
  4. package/dist/ddl/diff.js +1 -1
  5. package/dist/explorer/tree.js +2 -2
  6. package/dist/grid/DataGrid.js +1 -1
  7. package/dist/grid/GridRowView.js +1 -1
  8. package/dist/grid/display.js +1 -1
  9. package/dist/grid/navigation.js +1 -1
  10. package/dist/grid/whole-cells.js +1 -1
  11. package/dist/host/helper-path.js +1 -1
  12. package/dist/sql-split.js +1 -1
  13. package/dist/structure/StructureView.js +1 -1
  14. package/dist/table/TableView.js +1 -1
  15. package/dist/table/import-mapping.js +1 -1
  16. package/dist/table/useLoaded.js +1 -1
  17. package/dist/table/useStoredLayout.js +2 -2
  18. package/dist/testing/fake.js +1 -1
  19. package/dist/workbench/DatabaseWorkbench.js +1 -1
  20. package/package.json +8 -8
  21. package/src/actions.ts +1 -1
  22. package/src/client-context.ts +1 -1
  23. package/src/connections/ConnectionManager.tsx +1 -1
  24. package/src/connections/connection-config.ts +1 -1
  25. package/src/console/QueryConsole.tsx +2 -2
  26. package/src/console/SqlEditor.tsx +1 -1
  27. package/src/console/editor-slot.ts +1 -1
  28. package/src/ddl/diff.ts +1 -1
  29. package/src/ddl/draft.ts +1 -1
  30. package/src/designer/NamePicker.tsx +1 -1
  31. package/src/explorer/tree.ts +2 -2
  32. package/src/grid/DataGrid.tsx +1 -1
  33. package/src/grid/GridRowView.tsx +1 -1
  34. package/src/grid/display.ts +1 -1
  35. package/src/grid/navigation.ts +1 -1
  36. package/src/grid/whole-cells.ts +1 -1
  37. package/src/host/helper-path.ts +1 -1
  38. package/src/protocol/connection.ts +2 -2
  39. package/src/protocol/messages.ts +3 -3
  40. package/src/sql-split.ts +1 -1
  41. package/src/structure/StructureView.tsx +1 -1
  42. package/src/table/TableView.tsx +1 -1
  43. package/src/table/import-mapping.ts +1 -1
  44. package/src/table/useLoaded.ts +1 -1
  45. package/src/table/useStoredLayout.ts +2 -2
  46. package/src/testing/fake.ts +1 -1
  47. package/src/workbench/DatabaseWorkbench.tsx +2 -2
@@ -15,5 +15,5 @@ export const useDatabaseNotice = () => useDatabaseContext().onNotice;
15
15
  export const useDatabaseStorage = () => useDatabaseContext().storage;
16
16
  /* The app's file dialogs; export and import stay hidden without them. */
17
17
  export const useDatabaseFiles = () => useDatabaseContext().files;
18
- /* Read without the guard of the other hooks: a grid drawn on its own, such as in a test, writes numbers as the database does. */
18
+ /* Read without the guard of the other hooks, so a grid drawn on its own, such as in a test, writes numbers as the database does. */
19
19
  export const useNumberNotation = () => use(DatabaseContext)?.numberNotation ?? 'database';
@@ -15,7 +15,7 @@ const sqliteProblems = (config) => {
15
15
  return isAbsolutePath(path) ? {} : { path: 'path-relative' };
16
16
  };
17
17
  const isPort = (port) => Number.isInteger(port) && port >= 1 && port <= 65535;
18
- /* The mode is in the config: a socket means the socket mode, even while its path is still empty, and a tunnel names its own. */
18
+ /* The mode is in the config. A socket means the socket mode, even while its path is still empty, and a tunnel names its own. */
19
19
  export const modeOf = (config) => {
20
20
  if (config.tunnel !== undefined) {
21
21
  return config.tunnel.kind;
@@ -17,7 +17,7 @@ export function SqlEditor({ ref, value, onValueChange, run, label, placeholder,
17
17
  if (autoFocus) {
18
18
  area.current?.focus();
19
19
  }
20
- // Only on mount: a console that later becomes active keeps the focus where the person put it.
20
+ // Only on mount, so a console that later becomes active keeps the focus where the person put it.
21
21
  // eslint-disable-next-line react/exhaustive-deps
22
22
  }, []);
23
23
  useEffect(() => {
package/dist/ddl/diff.js CHANGED
@@ -1,6 +1,6 @@
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: those columns can stay where they are. */
3
+ /* The positions of a longest run that already is in order, whose columns can stay where they are. */
4
4
  const longestRun = (positions) => {
5
5
  const length = [];
6
6
  const previous = [];
@@ -71,7 +71,7 @@ export const isSelectable = (row) => row.kind === 'connection' || row.kind === '
71
71
  /* The statement behind New console here on a table: every row, as the engine quotes it. */
72
72
  export const selectAllSql = (engine, ref) => `SELECT * FROM ${qualifiedName({ engine, schema: ref.schema, table: ref.table })}`;
73
73
  export const visibleSchemas = (schemas, showSystemSchemas) => showSystemSchemas ? schemas : schemas.filter((schema) => !schema.system);
74
- /* One schema is no level worth a row: its folders hang straight under the connection. */
74
+ /* One schema is no level worth a row, so its folders hang straight under the connection. */
75
75
  const soleSchema = (visible) => (visible.length === 1 ? visible[0].name : null);
76
76
  /* Gives the drafts of one parent their place among each other, and lays them out depth first. */
77
77
  const settle = (drafts) => drafts.flatMap((draft, i) => [draft.make({ posInSet: i + 1, setSize: drafts.length }), ...draft.below]);
@@ -294,7 +294,7 @@ export const flattenTree = (input) => {
294
294
  else if (open && !filtering) {
295
295
  children = [pendingDraft(load, { connectionId: connection.id }, 2, key)];
296
296
  }
297
- // Behind a status row too: what the app keeps of a connection does not wait on its server.
297
+ // Behind a status row too, since what the app keeps of a connection does not wait on its server.
298
298
  children = [...children, ...(open ? appFolders : [])];
299
299
  if (filtering && children.length === 0) {
300
300
  return null;
@@ -34,7 +34,7 @@ const textOf = (view) => (view.suffix === undefined ? view.text : `${view.text}
34
34
  const columnTexts = (column, index, rows, notation) => rows.map((row) => textOf(cellView(row.cells[index] ?? null, column.kind, columnNotation(column, notation))));
35
35
  const estimateWidths = (columns, rows, notation) => columns.map((column, index) => estimateColumnWidth(column.name, columnTexts(column, index, rows.slice(0, 50), notation), column.primaryKey === true));
36
36
  /*
37
- * The table of the table view and of the console, and of any rows an app has on its own: it needs no
37
+ * The table of the table view and of the console, and of any rows an app has on its own. It needs no
38
38
  * `DatabaseProvider`, only the `UIProvider` of `@adecore/ui`. Only the rows in view are drawn, at a fixed
39
39
  * height, inside a box as tall as all of them; the header and the row-number gutter stick to the edges
40
40
  * of the scroll box. Focus stays on that box and points at the cell with `aria-activedescendant`, so
@@ -11,7 +11,7 @@ import { EnumPicker } from './EnumPicker.js';
11
11
  import { ROW_HEIGHT } from './layout.js';
12
12
  /*
13
13
  * The gutter and the pinned columns stick as one block, so the edge of one can never drift from the next, at any
14
- * zoom. Each part paints its background under its own line as well: the line is an alpha, and what scrolls beneath
14
+ * zoom. Each part paints its background under its own line as well, because the line is an alpha and what scrolls beneath
15
15
  * the block would otherwise show through it.
16
16
  */
17
17
  export const PINNED_GROUP = 'sticky left-0 z-10 flex shrink-0';
@@ -1,6 +1,6 @@
1
1
  import { formatBytes, formatNumeral } from '@adecore/ui/format';
2
2
  import { isNumericKind } from '../sql.js';
3
- /* A cell never draws more than this, however long the text: the DOM stays small and the cell is one line anyway. */
3
+ /* A cell never draws more than this, however long the text, so the DOM stays small. The cell is one line anyway. */
4
4
  export const DISPLAY_LIMIT = 200;
5
5
  /* How many bytes of a binary value the cell spells out. */
6
6
  export const BINARY_PREVIEW_BYTES = 8;
@@ -3,7 +3,7 @@ const ENTERING_KEYS = new Set(['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'
3
3
  const clamp = (value, max) => Math.max(0, Math.min(value, max - 1));
4
4
  /*
5
5
  * Where a navigation key takes the focus, or `null` when the key moves nothing and the browser should
6
- * keep it: that is also how Tab leaves the grid at its first and last cell.
6
+ * keep it. That is also how Tab leaves the grid at its first and last cell.
7
7
  */
8
8
  export const moveFocus = (from, input, size) => {
9
9
  if (size.rows === 0 || size.columns === 0) {
@@ -1,5 +1,5 @@
1
1
  import { isPreview, shownOfEdit } from './display.js';
2
- /* Characters of whole values one copy fetches at most, a byte of a binary value counting as two: past it the copy would hold the clipboard and the session for too long. */
2
+ /* Characters of whole values one copy fetches at most, a byte of a binary value counting as two. Past it the copy would hold the clipboard and the session for too long. */
3
3
  export const WHOLE_COPY_LIMIT = 16 * 1024 * 1024;
4
4
  /* The helper runs the requests of a session one after another, so more at once would only wait in its queue. */
5
5
  const PARALLEL_LOADS = 4;
@@ -14,7 +14,7 @@ import { fileURLToPath } from 'node:url';
14
14
  */
15
15
  export const helperPath = ({ platform = process.platform, arch = process.arch, env = process.env, resolve = (specifier) => createRequire(import.meta.url).resolve(specifier), exists = existsSync } = {}) => {
16
16
  const override = env.ADECORE_DATABASE_HELPER;
17
- // Not checked for existence: a wrong override fails loudly at spawn instead of quietly running another helper.
17
+ // Not checked for existence, so a wrong override fails loudly at spawn instead of quietly running another helper.
18
18
  if (override) {
19
19
  return override;
20
20
  }
package/dist/sql-split.js CHANGED
@@ -38,7 +38,7 @@ const quotedEnd = (text, at, engine) => {
38
38
  }
39
39
  return text.length;
40
40
  };
41
- /* Reads SQL the way the helper's splitter does: quotes, comments and escapes decide what a semicolon is. */
41
+ /* Reads SQL the way the helper's splitter does. Quotes, comments and escapes decide what a semicolon is. */
42
42
  export const tokenize = (text, engine) => {
43
43
  const tokens = [];
44
44
  let i = 0;
@@ -16,7 +16,7 @@ export function StructureView({ connection, schema, table, toolbarStart, classNa
16
16
  const client = useDatabaseClient();
17
17
  const [answer, setAnswer] = useState(null);
18
18
  const [attempt, setAttempt] = useState(0);
19
- // A schema change reloads in place: the old answer stays on screen until the new one arrives.
19
+ // A schema change reloads in place. The old answer stays on screen until the new one arrives.
20
20
  const [reloads, setReloads] = useState(0);
21
21
  const answered = answer !== null && answer.connection === connection && answer.schema === schema && answer.table === table && answer.attempt === attempt;
22
22
  const load = answered ? answer.load : { status: 'loading' };
@@ -447,7 +447,7 @@ function TableBody({ connection, schema, table, toolbarStart, defaultWhere, defa
447
447
  }
448
448
  };
449
449
  const handleKeyDown = (event) => {
450
- // A dialog opened from here is a portal: its events reach this handler through React, not through the DOM.
450
+ // A dialog opened from here is a portal, so its events reach this handler through React, not through the DOM.
451
451
  if (!event.nativeEvent.isComposing &&
452
452
  event.currentTarget.contains(event.target) &&
453
453
  matchesShortcut(FOCUS_COMMAND, event.nativeEvent, isApplePlatform())) {
@@ -1,4 +1,4 @@
1
- /* The columns an import can fill: a generated column is computed by the server. */
1
+ /* The columns an import can fill. The server computes a generated column. */
2
2
  export const importableColumns = (columns) => columns.filter((column) => !column.generated);
3
3
  /* CSV or TSV by the extension of the path; CSV when it says neither. */
4
4
  export const formatOfPath = (path) => (/\.(tsv|tab)$/i.test(path) ? 'tsv' : 'csv');
@@ -8,7 +8,7 @@ import { useEffect, useRef, useState } from 'react';
8
8
  export function useLoaded(load, key) {
9
9
  const loader = useRef(load);
10
10
  const [version, setVersion] = useState(0);
11
- // Loading is not a state of its own: it is that the last answer is not for this key and this version.
11
+ // Loading is not a state of its own. It means the last answer is not for this key and this version.
12
12
  const [state, setState] = useState({ key: '', version: -1, value: null, error: null });
13
13
  useEffect(() => {
14
14
  loader.current = load;
@@ -3,8 +3,8 @@ import { EMPTY_LAYOUT, parseStoredLayout, serializeLayout } from './layout-store
3
3
  /* How long a change waits for the next before it is written, so a drag of a column edge is one write. */
4
4
  export const STORE_DELAY_MS = 500;
5
5
  /*
6
- * The layout of one table's view in the app's storage. It is read once, on mount, and written back
7
- * in the background: the last change is still written when the view unmounts.
6
+ * The layout of one table's view in the app's storage. The hook reads it once, on mount, and writes it
7
+ * back in the background, the last change included when the view unmounts.
8
8
  */
9
9
  export function useStoredLayout(storage, key) {
10
10
  const [stored] = useState(() => (storage === undefined ? null : parseStoredLayout(storage.get(key))));
@@ -212,7 +212,7 @@ const selectSchema = (session, schema) => {
212
212
  * `rows` and `count` return every row in stored order; `execute` and `page` run `SELECT * FROM <table>`
213
213
  * on the selected schema (the first one until a call names another) and answer every other statement
214
214
  * with an `unsupported` error; and, as in the protocol, the first failed statement ends the list.
215
- * `transaction` only raises a flag that `execute` reports: a rollback does not undo a change. There
215
+ * `transaction` only raises a flag that `execute` reports, and a rollback does not undo a change. There
216
216
  * are no files, so `export`, `import` and `sample` answer `unsupported`.
217
217
  */
218
218
  export const fakeDatabaseTransport = (options) => {
@@ -101,7 +101,7 @@ export function DatabaseWorkbench({ connections, onConnectionsChange, className,
101
101
  return first === undefined ? null : { connectionId: first.id };
102
102
  }
103
103
  function onKeyDown(e) {
104
- // A dialog opened from here is a portal: its events reach this handler through React, not through the DOM.
104
+ // A dialog opened from here is a portal, so its events reach this handler through React, not through the DOM.
105
105
  if (active !== null &&
106
106
  e.currentTarget.contains(e.target) &&
107
107
  !e.nativeEvent.isComposing &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adecore/database",
3
- "version": "0.54.2",
3
+ "version": "0.54.3",
4
4
  "description": "Browse, query and edit SQLite and MySQL databases: React views for the page, a host for the backend and a native helper that talks to the server.",
5
5
  "license": "FSL-1.1-MIT",
6
6
  "author": "Bas Milius",
@@ -56,26 +56,26 @@
56
56
  "helper:test": "cargo test --locked --manifest-path helper/Cargo.toml"
57
57
  },
58
58
  "dependencies": {
59
- "@adecore/utils": "0.54.2",
59
+ "@adecore/utils": "0.54.3",
60
60
  "@base-ui/react": "^1.9.0",
61
61
  "clsx": "^2.1.1",
62
62
  "lucide-react": "^1.65.0"
63
63
  },
64
64
  "optionalDependencies": {
65
- "@adecore/database-darwin-arm64": "0.54.2",
66
- "@adecore/database-linux-arm64": "0.54.2",
67
- "@adecore/database-linux-x64": "0.54.2",
68
- "@adecore/database-win32-x64": "0.54.2"
65
+ "@adecore/database-darwin-arm64": "0.54.3",
66
+ "@adecore/database-linux-arm64": "0.54.3",
67
+ "@adecore/database-linux-x64": "0.54.3",
68
+ "@adecore/database-win32-x64": "0.54.3"
69
69
  },
70
70
  "peerDependencies": {
71
- "@adecore/ui": "^0.54.2",
71
+ "@adecore/ui": "^0.54.3",
72
72
  "i18next": "^26.4.2",
73
73
  "react": "^19.3.0",
74
74
  "react-dom": "^19.3.0",
75
75
  "react-i18next": "^17.0.15"
76
76
  },
77
77
  "devDependencies": {
78
- "@adecore/ui": "0.54.2",
78
+ "@adecore/ui": "0.54.3",
79
79
  "@happy-dom/global-registrator": "^21.0.4",
80
80
  "@types/bun": "^1.4.4",
81
81
  "@types/node": "^26.6.6",
package/src/actions.ts CHANGED
@@ -2,7 +2,7 @@ import type { TableRef } from './client/types.ts';
2
2
  import type { TableKind } from './protocol/index.ts';
3
3
 
4
4
  /*
5
- * Something a view asks the app to open. The views draw no tabs and no windows of their own: the app
5
+ * Something a view asks the app to open. The views draw no tabs and no windows of their own. The app
6
6
  * decides where a table, a console or the designer lands, such as a tab beside its file tabs.
7
7
  */
8
8
  export type DatabaseAction =
@@ -37,5 +37,5 @@ export const useDatabaseStorage = (): DatabaseStorage | undefined => useDatabase
37
37
  /* The app's file dialogs; export and import stay hidden without them. */
38
38
  export const useDatabaseFiles = (): DatabaseFiles | undefined => useDatabaseContext().files;
39
39
 
40
- /* Read without the guard of the other hooks: a grid drawn on its own, such as in a test, writes numbers as the database does. */
40
+ /* Read without the guard of the other hooks, so a grid drawn on its own, such as in a test, writes numbers as the database does. */
41
41
  export const useNumberNotation = (): NumberNotation => use(DatabaseContext)?.numberNotation ?? 'database';
@@ -18,7 +18,7 @@ const ENGINES: readonly Engine[] = ['sqlite', 'mysql'];
18
18
 
19
19
  export interface ConnectionManagerProps {
20
20
  value: readonly Connection[];
21
- /* Saving is the app's: every add, edit and delete goes out whole through here. */
21
+ /* Saving is the app's. Every add, edit and delete goes out whole through here. */
22
22
  onValueChange(next: readonly Connection[]): void;
23
23
  /* The id of the connection in the detail. Without it the manager keeps the selection itself; `null` is none. */
24
24
  selected?: string | null;
@@ -44,7 +44,7 @@ const sqliteProblems = (config: SqliteConnectionConfig): ConfigProblems => {
44
44
 
45
45
  const isPort = (port: number): boolean => Number.isInteger(port) && port >= 1 && port <= 65535;
46
46
 
47
- /* The mode is in the config: a socket means the socket mode, even while its path is still empty, and a tunnel names its own. */
47
+ /* The mode is in the config. A socket means the socket mode, even while its path is still empty, and a tunnel names its own. */
48
48
  export const modeOf = (config: MysqlConnectionConfig): ConnectMode => {
49
49
  if (config.tunnel !== undefined) {
50
50
  return config.tunnel.kind;
@@ -31,7 +31,7 @@ export interface QueryConsoleProps {
31
31
  connection?: Connection;
32
32
  /* The schema the statements run in. Without `onSchemaChange` the picker starts from it, and a new one resets the pick. */
33
33
  schema?: string;
34
- /* Makes the schema the app's: the picker shows `schema` and asks for another through this. */
34
+ /* Makes the schema the app's. The picker shows `schema` and asks for another through this. */
35
35
  onSchemaChange?(schema: string): void;
36
36
  /* The SQL, when the app keeps it (a tab that survives a reload). Without it the console keeps the text itself, starting from `defaultValue`. */
37
37
  value?: string;
@@ -59,7 +59,7 @@ type Run =
59
59
  interface PageState {
60
60
  readonly offset: number;
61
61
  readonly rows: RowsResult;
62
- /* Where each page before this one started: a page the byte limit cut short holds fewer rows than `PAGE_SIZE`. */
62
+ /* Where each page before this one started, since a page the byte limit cut short holds fewer rows than `PAGE_SIZE`. */
63
63
  readonly before: readonly number[];
64
64
  }
65
65
 
@@ -20,7 +20,7 @@ export function SqlEditor({ ref, value, onValueChange, run, label, placeholder,
20
20
  if (autoFocus) {
21
21
  area.current?.focus();
22
22
  }
23
- // Only on mount: a console that later becomes active keeps the focus where the person put it.
23
+ // Only on mount, so a console that later becomes active keeps the focus where the person put it.
24
24
  // eslint-disable-next-line react/exhaustive-deps
25
25
  }, []);
26
26
 
@@ -22,6 +22,6 @@ export interface QueryConsoleEditorProps {
22
22
  /* The accessible name of the editor and its placeholder, in the person's language. */
23
23
  label: string;
24
24
  placeholder: string;
25
- /* The console was opened just now: the editor takes the caret once it is there. */
25
+ /* The console was opened just now, so the editor takes the caret once it is there. */
26
26
  autoFocus: boolean;
27
27
  }
package/src/ddl/diff.ts CHANGED
@@ -42,7 +42,7 @@ export interface TableDiff {
42
42
  readonly optionsChanged: boolean;
43
43
  }
44
44
 
45
- /* The positions of a longest run that already is in order: those columns can stay where they are. */
45
+ /* The positions of a longest run that already is in order, whose columns can stay where they are. */
46
46
  const longestRun = (positions: readonly number[]): ReadonlySet<number> => {
47
47
  const length: number[] = [];
48
48
  const previous: number[] = [];
package/src/ddl/draft.ts CHANGED
@@ -18,7 +18,7 @@ export interface ColumnDraft {
18
18
  readonly autoIncrement: boolean;
19
19
  /* Empty for no comment. */
20
20
  readonly comment: string;
21
- /* A column the server computes. It is read only here: its clause travels along unchanged. */
21
+ /* A column the server computes. It is read only here, and its clause travels along unchanged. */
22
22
  readonly generated: boolean;
23
23
  /* `GENERATED ALWAYS AS (...) STORED` as the table's DDL says it; `null` when the DDL did not show it. */
24
24
  readonly generatedClause: string | null;
@@ -7,7 +7,7 @@ import { useTranslation } from 'react-i18next';
7
7
  export interface NamePickerProps {
8
8
  /* Every name that can be picked, in the order to show them. */
9
9
  options: readonly string[];
10
- /* The names picked, in the order they were picked: for a key that order is the order of its columns. */
10
+ /* The names picked, in the order they were picked. For a key that order is the order of its columns. */
11
11
  value: readonly string[];
12
12
  onToggle(name: string): void;
13
13
  /* The accessible name of the group. */
@@ -278,7 +278,7 @@ export interface TreeInput {
278
278
  export const visibleSchemas = (schemas: readonly SchemaInfo[], showSystemSchemas: boolean): readonly SchemaInfo[] =>
279
279
  showSystemSchemas ? schemas : schemas.filter((schema) => !schema.system);
280
280
 
281
- /* One schema is no level worth a row: its folders hang straight under the connection. */
281
+ /* One schema is no level worth a row, so its folders hang straight under the connection. */
282
282
  const soleSchema = (visible: readonly SchemaInfo[]): string | null => (visible.length === 1 ? visible[0]!.name : null);
283
283
 
284
284
  interface Place {
@@ -563,7 +563,7 @@ export const flattenTree = (input: TreeInput): TreeRow[] => {
563
563
  children = [pendingDraft(load, { connectionId: connection.id }, 2, key)];
564
564
  }
565
565
 
566
- // Behind a status row too: what the app keeps of a connection does not wait on its server.
566
+ // Behind a status row too, since what the app keeps of a connection does not wait on its server.
567
567
  children = [...children, ...(open ? appFolders : [])];
568
568
 
569
569
  if (filtering && children.length === 0) {
@@ -140,7 +140,7 @@ const estimateWidths = (columns: readonly GridColumn[], rows: readonly GridRow[]
140
140
  columns.map((column, index) => estimateColumnWidth(column.name, columnTexts(column, index, rows.slice(0, 50), notation), column.primaryKey === true));
141
141
 
142
142
  /*
143
- * The table of the table view and of the console, and of any rows an app has on its own: it needs no
143
+ * The table of the table view and of the console, and of any rows an app has on its own. It needs no
144
144
  * `DatabaseProvider`, only the `UIProvider` of `@adecore/ui`. Only the rows in view are drawn, at a fixed
145
145
  * height, inside a box as tall as all of them; the header and the row-number gutter stick to the edges
146
146
  * of the scroll box. Focus stays on that box and points at the cell with `aria-activedescendant`, so
@@ -14,7 +14,7 @@ import type { GridColumn, GridRow } from './types.ts';
14
14
 
15
15
  /*
16
16
  * The gutter and the pinned columns stick as one block, so the edge of one can never drift from the next, at any
17
- * zoom. Each part paints its background under its own line as well: the line is an alpha, and what scrolls beneath
17
+ * zoom. Each part paints its background under its own line as well, because the line is an alpha and what scrolls beneath
18
18
  * the block would otherwise show through it.
19
19
  */
20
20
  export const PINNED_GROUP = 'sticky left-0 z-10 flex shrink-0';
@@ -19,7 +19,7 @@ export interface CellView {
19
19
  /* How a numeric cell is drawn: as the server wrote it, or in the notation of the person's region. */
20
20
  export type NumberNotation = 'database' | 'region';
21
21
 
22
- /* A cell never draws more than this, however long the text: the DOM stays small and the cell is one line anyway. */
22
+ /* A cell never draws more than this, however long the text, so the DOM stays small. The cell is one line anyway. */
23
23
  export const DISPLAY_LIMIT = 200;
24
24
 
25
25
  /* How many bytes of a binary value the cell spells out. */
@@ -24,7 +24,7 @@ const clamp = (value: number, max: number): number => Math.max(0, Math.min(value
24
24
 
25
25
  /*
26
26
  * Where a navigation key takes the focus, or `null` when the key moves nothing and the browser should
27
- * keep it: that is also how Tab leaves the grid at its first and last cell.
27
+ * keep it. That is also how Tab leaves the grid at its first and last cell.
28
28
  */
29
29
  export const moveFocus = (from: CellPosition | null, input: NavigationKey, size: GridSize): CellPosition | null => {
30
30
  if (size.rows === 0 || size.columns === 0) {
@@ -1,7 +1,7 @@
1
1
  import type { Value } from '../protocol/index.ts';
2
2
  import { isPreview, shownOfEdit, type Shown } from './display.ts';
3
3
 
4
- /* Characters of whole values one copy fetches at most, a byte of a binary value counting as two: past it the copy would hold the clipboard and the session for too long. */
4
+ /* Characters of whole values one copy fetches at most, a byte of a binary value counting as two. Past it the copy would hold the clipboard and the session for too long. */
5
5
  export const WHOLE_COPY_LIMIT = 16 * 1024 * 1024;
6
6
 
7
7
  /* The helper runs the requests of a session one after another, so more at once would only wait in its queue. */
@@ -34,7 +34,7 @@ export const helperPath = ({
34
34
  }: HelperPathOptions = {}): string | null => {
35
35
  const override = env.ADECORE_DATABASE_HELPER;
36
36
 
37
- // Not checked for existence: a wrong override fails loudly at spawn instead of quietly running another helper.
37
+ // Not checked for existence, so a wrong override fails loudly at spawn instead of quietly running another helper.
38
38
  if (override) {
39
39
  return override;
40
40
  }
@@ -13,7 +13,7 @@ export type MysqlTlsMode = 'disable' | 'prefer' | 'require' | 'verify';
13
13
  /*
14
14
  * A server reached through a host the helper can SSH into. The helper runs the system's `ssh -W` for
15
15
  * every connection, so `~/.ssh/config`, the agent and `ProxyJump` apply, and it never asks for a
16
- * password: a key or the agent has to answer.
16
+ * password. A key or the agent has to answer.
17
17
  */
18
18
  export interface SshTunnel {
19
19
  readonly kind: 'ssh';
@@ -62,7 +62,7 @@ export type ConnectionConfig = SqliteConnectionConfig | MysqlConnectionConfig;
62
62
 
63
63
  export type Engine = ConnectionConfig['engine'];
64
64
 
65
- /* What answered: one engine can be served by more than one product, which differ in SQL. */
65
+ /* What answered. More than one product can serve one engine, and they differ in SQL. */
66
66
  export interface ServerInfo {
67
67
  readonly flavor: 'sqlite' | 'mysql' | 'mariadb';
68
68
  /* The version as the server reports it, such as `11.4.2-MariaDB`. */
@@ -18,7 +18,7 @@ export interface RowsResult {
18
18
  readonly rows: readonly (readonly Cell[])[];
19
19
  /*
20
20
  * Whether a row exists past this page, which the helper learns by reading one row more than the limit. Also true
21
- * when the rows stopped at `maxBytes` before the limit: the next page then starts after the rows that came.
21
+ * when the rows stopped at `maxBytes` before the limit. The next page then starts after the rows that came.
22
22
  */
23
23
  readonly hasMore: boolean;
24
24
  readonly elapsedMs: number;
@@ -33,7 +33,7 @@ export type StatementResult =
33
33
  | { readonly kind: 'done'; readonly sql: string; readonly affected: number; readonly lastInsertId: number | string | null; readonly elapsedMs: number }
34
34
  | { readonly kind: 'error'; readonly sql: string; readonly error: DatabaseError; readonly elapsedMs: number };
35
35
 
36
- /* A file format for `export` and `import`. JSON and SQL only export: an import reads delimited text. */
36
+ /* A file format for `export` and `import`. JSON and SQL only export, since an import reads delimited text. */
37
37
  export type FileFormat = 'csv' | 'tsv' | 'json' | 'sql';
38
38
 
39
39
  /* What an export writes: a table, filtered and ordered as a table view shows it, or the rows of one statement. */
@@ -156,7 +156,7 @@ export interface DatabaseMethods {
156
156
  discover: { params: { readonly kind: 'docker'; readonly context?: string }; result: { readonly containers: readonly DockerContainer[] } };
157
157
  /*
158
158
  * Stops the request with this id. Answers whether it was still running. The request itself fails with
159
- * `cancelled`, except an `execute` that had begun: it answers with what ran before the cancel.
159
+ * `cancelled`, except an `execute` that had begun, which answers with what ran before the cancel.
160
160
  */
161
161
  cancel: { params: { readonly request: string }; result: { readonly cancelled: boolean } };
162
162
  }
package/src/sql-split.ts CHANGED
@@ -64,7 +64,7 @@ const quotedEnd = (text: string, at: number, engine: Engine): number => {
64
64
  return text.length;
65
65
  };
66
66
 
67
- /* Reads SQL the way the helper's splitter does: quotes, comments and escapes decide what a semicolon is. */
67
+ /* Reads SQL the way the helper's splitter does. Quotes, comments and escapes decide what a semicolon is. */
68
68
  export const tokenize = (text: string, engine: Engine): SqlToken[] => {
69
69
  const tokens: SqlToken[] = [];
70
70
  let i = 0;
@@ -43,7 +43,7 @@ export function StructureView({ connection, schema, table, toolbarStart, classNa
43
43
  const client = useDatabaseClient();
44
44
  const [answer, setAnswer] = useState<Answer | null>(null);
45
45
  const [attempt, setAttempt] = useState(0);
46
- // A schema change reloads in place: the old answer stays on screen until the new one arrives.
46
+ // A schema change reloads in place. The old answer stays on screen until the new one arrives.
47
47
  const [reloads, setReloads] = useState(0);
48
48
  const answered = answer !== null && answer.connection === connection && answer.schema === schema && answer.table === table && answer.attempt === attempt;
49
49
  const load: Load = answered ? answer.load : { status: 'loading' };
@@ -680,7 +680,7 @@ function TableBody({ connection, schema, table, toolbarStart, defaultWhere, defa
680
680
  };
681
681
 
682
682
  const handleKeyDown = (event: KeyboardEvent<HTMLDivElement>): void => {
683
- // A dialog opened from here is a portal: its events reach this handler through React, not through the DOM.
683
+ // A dialog opened from here is a portal, so its events reach this handler through React, not through the DOM.
684
684
  if (
685
685
  !event.nativeEvent.isComposing &&
686
686
  event.currentTarget.contains(event.target as Node) &&
@@ -2,7 +2,7 @@ import type { ColumnInfo } from '../protocol/index.ts';
2
2
 
3
3
  export type ImportFormat = 'csv' | 'tsv';
4
4
 
5
- /* The columns an import can fill: a generated column is computed by the server. */
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
8
  /* CSV or TSV by the extension of the path; CSV when it says neither. */
@@ -24,7 +24,7 @@ interface State<T> {
24
24
  export function useLoaded<T>(load: (signal: AbortSignal) => Promise<T>, key: string): Loaded<T> {
25
25
  const loader = useRef(load);
26
26
  const [version, setVersion] = useState(0);
27
- // Loading is not a state of its own: it is that the last answer is not for this key and this version.
27
+ // Loading is not a state of its own. It means the last answer is not for this key and this version.
28
28
  const [state, setState] = useState<State<T>>({ key: '', version: -1, value: null, error: null });
29
29
 
30
30
  useEffect(() => {
@@ -13,8 +13,8 @@ export interface StoredLayoutHandle {
13
13
  }
14
14
 
15
15
  /*
16
- * The layout of one table's view in the app's storage. It is read once, on mount, and written back
17
- * in the background: the last change is still written when the view unmounts.
16
+ * The layout of one table's view in the app's storage. The hook reads it once, on mount, and writes it
17
+ * back in the background, the last change included when the view unmounts.
18
18
  */
19
19
  export function useStoredLayout(storage: DatabaseStorage | undefined, key: string): StoredLayoutHandle {
20
20
  const [stored] = useState(() => (storage === undefined ? null : parseStoredLayout(storage.get(key))));
@@ -376,7 +376,7 @@ type Handlers = { readonly [M in DatabaseMethod]: (params: DatabaseParams<M>) =>
376
376
  * `rows` and `count` return every row in stored order; `execute` and `page` run `SELECT * FROM <table>`
377
377
  * on the selected schema (the first one until a call names another) and answer every other statement
378
378
  * with an `unsupported` error; and, as in the protocol, the first failed statement ends the list.
379
- * `transaction` only raises a flag that `execute` reports: a rollback does not undo a change. There
379
+ * `transaction` only raises a flag that `execute` reports, and a rollback does not undo a change. There
380
380
  * are no files, so `export`, `import` and `sample` answer `unsupported`.
381
381
  */
382
382
  export const fakeDatabaseTransport = (options: FakeDatabaseTransportOptions): DatabaseTransport => {
@@ -48,7 +48,7 @@ import {
48
48
 
49
49
  export interface DatabaseWorkbenchProps {
50
50
  connections: readonly Connection[];
51
- /* Saving is the app's. Without it the connections are fixed: there is no way to manage them from here. */
51
+ /* Saving is the app's. Without it the connections are fixed, with no way to manage them from here. */
52
52
  onConnectionsChange?(next: readonly Connection[]): void;
53
53
  className?: string;
54
54
  ref?: Ref<HTMLDivElement>;
@@ -165,7 +165,7 @@ export function DatabaseWorkbench({ connections, onConnectionsChange, className,
165
165
  }
166
166
 
167
167
  function onKeyDown(e: KeyboardEvent<HTMLDivElement>): void {
168
- // A dialog opened from here is a portal: its events reach this handler through React, not through the DOM.
168
+ // A dialog opened from here is a portal, so its events reach this handler through React, not through the DOM.
169
169
  if (
170
170
  active !== null &&
171
171
  e.currentTarget.contains(e.target as Node) &&