Registry / database / ts-mysql-autocomplete

ts-mysql-autocomplete

JSON →
library0.0.2jsnpmunverified

A TypeScript-based autocomplete engine for MySQL queries. Current stable version is 0.0.2 (release cadence: low, as it is a minor version). It autocompletes keywords, table names, and column names, supports all MySQL versions, and integrates with database schemas. Differentiators: grammar-complete via ANTLR4, ships TypeScript types, and is part of a suite of related MySQL tools. It does not require a running MySQL server.

npm install ts-mysql-autocomplete
INSTALL
IMPORT
SIG · TS-MYSQL-AUTOCOMPL
T
ts-mysql-autocomplete
databasejavascriptv0.0.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

MySQLAutocomplete
import { MySQLAutocomplete } from 'ts-mysql-autocomplete'
const MySQLAutocomplete = require('ts-mysql-autocomplete').MySQLAutocomplete
ESM only; CommonJS require with destructuring works but is not idiomatic for TypeScript.
default import
import MySQLAutocomplete from 'ts-mysql-autocomplete'
import { MySQLAutocomplete as MySQLAutocomplete } from ...
The package exports both default and named export. Default import works if you are not using named.
MySQLAutocompleteOptions
import { MySQLAutocompleteOptions } from 'ts-mysql-autocomplete'
Type import for configuring autocompleter, available since 0.0.2.

Shows basic instantiation of MySQLAutocomplete and autocomplete calls with and without a schema.

import { MySQLAutocomplete } from 'ts-mysql-autocomplete'; const autocompleter = new MySQLAutocomplete(); // Autocomplete 'SELEC' at cursor position 5 const entries1 = autocompleter.autocomplete('SELEC', 5); console.log(entries1); // [ 'SELECT' ] // Autocomplete with a schema const schema = { tables: [{ name: 'users', columns: ['id', 'name', 'email'] }] }; const autocompleterWithSchema = new MySQLAutocomplete({ schema }); const entries2 = autocompleterWithSchema.autocomplete('SELECT * FROM us', 16); console.log(entries2); // [ 'users' ]
Debug
Known issues
deprecatedPackage is version 0.0.2 indicating pre-1.0 state, expect breaking changes in future releases.
fix
Pin to current version or monitor releases for breaking changes.
affects: <1.0
gotchaMySQLAutocomplete constructor accepts an optional options object with 'schema' property, but if schema is invalid or missing required fields, behavior may be undefined.
fix
Ensure schema object has 'tables' array with 'name' and 'columns' properties.
affects: >=0.0.1
gotchaThe autocomplete method expects cursor position as second argument; omitting or passing null may cause incorrect results.
fix
Always provide a valid number for cursor position (0-indexed).
affects: >=0.0.1
gotchaOnly the first token is considered for autocompletion; partial queries may not return all expected suggestions.
fix
Ensure the query string is complete up to cursor position for accurate suggestions.
affects: >=0.0.1
Errors
Common errors & fixes
Cannot find module 'ts-mysql-autocomplete' or its corresponding type declarations.
TypeScript cannot resolve the package due to missing or incorrect types configuration.
fix
Install the package with npm install ts-mysql-autocomplete and ensure tsconfig.json includes 'node_modules/@types' or 'skipLibCheck' is set to true.
TS2305: Module '"ts-mysql-autocomplete"' has no exported member 'MySQLAutocompleteOptions'
Attempting to import a type that may not be exported in older versions.
fix
Upgrade to version 0.0.2 or later, or avoid using that type if not needed.
TypeError: autocompleter.autocomplete is not a function
The import was done incorrectly, e.g., importing default but using as named.
fix
Use correct import: import { MySQLAutocomplete } from 'ts-mysql-autocomplete'.
Upgrade
Version history
0.0.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
18 hits · last 30 days
node
14
Meta
2
OpenAI (training)
1
Resources
ts-mysql-autocomplete — npm install ts-mysql-autocomplete · libregistry