# @ambassify/aql-parser

> AQL parser

Latest version **0.7.1** (published 2025-04-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install @ambassify/aql-parser
pnpm add @ambassify/aql-parser
yarn add @ambassify/aql-parser
bun add @ambassify/aql-parser
```

## Health

**Score 40/100 (D)** — status: stable.

Positive: no vulnerabilities; high maintenance score.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 0.7.1 |
| Published | 2025-04-03 |
| First published | 2019-04-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 16 |
| Dependencies | 2 |
| Unpacked size | 43.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Ambassify |
| Maintainers | ambassify |

## Links

- npm: https://www.npmjs.com/package/@ambassify/aql-parser
- Repository: https://github.com/ambassify/aql
- Homepage: https://github.com/ambassify/aql#readme
- Issues: https://github.com/ambassify/aql/issues
- npm.io page: https://npm.io/package/@ambassify/aql-parser

## Dependencies (2)

- [qs](https://npm.io/package/qs.md) ^6.7.0
- [chevrotain](https://npm.io/package/chevrotain.md) ^4.3.2

## Recent versions

- 0.7.1 (latest) — 2025-04-03
- 0.7.0 — 2025-04-03
- 0.6.1 — 2023-09-08
- 0.5.0 — 2021-09-16
- 0.4.0 — 2020-11-06
- 0.3.0 — 2020-10-13
- 0.2.0 — 2019-09-24
- 0.1.1 — 2019-06-12
- 0.0.2 — 2019-04-11
- 0.0.1 — 2019-04-11

## README

# aql-parser

Parsing utility for AQL components.

## Usage

```sh
npm install --save @ambassify/aql-parser
```

```js
const aqlParser = require('@ambassify/aql-parser');

const fields = 'foo,bar,(baz,two)'
const condition = JSON.stringify({ key: 'foo', operator: 'eq', value: 1 });
const order = '-priority,id';
const url = [
    'https://foo.bar/?fiels='
    encodeURIComponent(fields),
    '&condition=',
    encodeURIComponent(condition),
    '&order=',
    encodeURIComponent(order),
].join('');

console.log(aqlParser.fields(fields));
/**
 * {
 *   foo: true,
 *   bar: { baz: true, two: true }
 * }
 */

console.log(aqlParser.condition(condition));
/**
 * { key: 'foo', operator: 'eq', value: 1 }
 *
 * Supports:
 *   - url-encoded JSON string
 *   - JSON string
 *   - url-encoded nested query parameters
 * (see tests for details)
 */

console.log(aqlParser.order(order));
/**
 * [
 *   { key: 'priority', direction: 'descending' },
 *   { key: 'id', direction: 'ascending' }
 * ]
 */

console.log(aqlParser.url(url));
/**
 * {
 *   fields: ...,
 *   condition: ...,
 *   order: ...,
 * }
```

---
_Source: https://npm.io/package/@ambassify/aql-parser · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
