Registry / data / jql2sql

jql2sql

JSON →
library0.0.14jsnpmunverified

JQL2SQL (v0.0.14) transpiles JQL (Jira Query Language) into parameterized SQL queries for safe, flexible searching. It uses a custom parser built with nearley to convert JQL to an AST, then transpiles to SQL WHERE clauses. This package is in early development with irregular releases. Key differentiators: focused solely on JQL-to-SQL conversion, no query execution, and aims for SQL injection safety by generating parameterized queries. Alternatives like jql-parser or custom lexers require more boilerplate.

npm install jql2sql
INSTALL
IMPORT
SIG · JQL2SQL
J
jql2sql
datajavascriptv0.0.14
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.

default
import jql2sql from 'jql2sql';
const jql2sql = require('jql2sql');
Package exports a default function. ESM is preferred; CommonJS require works but may not be fully supported.
{ transpile }
import { transpile } from 'jql2sql';
import transpile from 'jql2sql';
Named export is available (undocumented). Ensure correct destructured import.
JQLParser
import JQLParser from 'jql2sql/parser';
import { JQLParser } from 'jql2sql';
The parser is exported as a separate entry point. Not part of main export.

Transpile a JQL string into a parameterized SQL WHERE clause and parameters array.

import jql2sql from 'jql2sql'; const jql = "(item is 'good' or item is 'so so') and date < now()"; const { sql, params } = jql2sql(jql); console.log(sql); // Output: (ITEM LIKE ? OR ITEM LIKE ?) AND DATE < NOW() console.log(params); // Output: ['%good%', '%so so%'] // Use with parameterized query in DB driver: // db.query(sql, params).then(rows => ...);
Debug
Known issues
breakingVersion 0.x: API may change without notice; breaking changes expected.
fix
Pin to exact version and test upgrades thoroughly.
affects: <1.0.0
deprecatedFunction 'myfunction(arg1, arg2)' in JQL is documented but not yet supported; trying to use it will throw an error.
fix
Avoid custom functions or wait for future release.
affects: <=0.0.14
gotchaThe `is` operator maps to SQL LIKE with wildcards, not `=`. For exact match use `field = 'value'`.
fix
Use `=` for exact match, `is` for partial match (adds %).
affects: *
gotchaField names and values are case-insensitive? Check actual behavior: `select count(*) from items where ${sql}` may need quote handling.
fix
Verify SQL dialect compatibility; test against your DB.
affects: *
Errors
Common errors & fixes
TypeError: jql2sql is not a function
Attempted to use CommonJS require on an ESM-only package or incorrect import.
fix
Use `import jql2sql from 'jql2sql'` or in CommonJS: `const { default: jql2sql } = require('jql2sql');`
SyntaxError: Unexpected token: operator 'does'
JQL operator 'does' is not supported. Only 'is', '=', '!=', '<', '>', etc.
fix
Replace 'does' with 'is' or '=' depending on intended meaning.
Error: Unsupported function: myfunction
Extended functions are not yet implemented.
fix
Remove custom functions from JQL string or wait for feature update.
Upgrade
Version history
0.0.14latest on npm
Audit
Dependencies
nearleyoptionalUsed internally for JQL parser generation; not a runtime dependency but required at build time.
Agent activity
6 hits · last 30 days
node
6
Resources
jql2sql — npm install jql2sql · libregistry