Registry / serialization / odata-parser

odata-parser

JSON →
library1.4.1jsnpmunverified

odata-parser is an abandoned Node.js library designed to parse OData query strings into an Abstract Syntax Tree (AST). It is based on PEG.js for its parsing grammar. The package currently sits at version 1.4.1, with its last update over a decade ago (April 2016) and its GitHub repository archived by Auth0 in April 2019, rendering it read-only. This indicates a complete cessation of development, maintenance, and security updates. Due to its age, it primarily supports older OData specifications (likely v2 or v3) and lacks support for modern OData v4 features. Key differentiators at the time of its development included providing a straightforward way to process OData query syntax for Node.js applications, but it has been superseded by more modern and actively maintained OData parsers that support current specifications and module systems.

npm install odata-parser
INSTALL
IMPORT
SIG · ODATA-PARSER
O
odata-parser
serializationjavascriptv1.4.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

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

parser
const parser = require('odata-parser');
import parser from 'odata-parser';
This package is CommonJS-only (published 2016); direct ES Module imports using `import` syntax are not supported and will result in runtime errors.
parse
const { parse } = require('odata-parser');
import { parse } from 'odata-parser';
While the primary usage is `parser.parse()`, `parse` is the only directly exposed function if one were to destructure the default export. Still CommonJS-only.

Demonstrates parsing various OData query strings including basic options, logical filters, and function calls.

const parser = require('odata-parser'); const util = require('util'); // Basic query options let ast1 = parser.parse("$top=10&$skip=5&$select=foo"); console.log("Basic Query AST:"); console.log(util.inspect(ast1, { depth: null })); // Filter with logical operators let ast2 = parser.parse("$filter=Name eq 'John' and LastName lt 'Doe'"); console.log("\nFilter with logical operators AST:"); console.log(util.inspect(ast2, { depth: null })); // Filter with functions let ast3 = parser.parse("$filter=substringof('nginx', Servers)"); console.log("\nFilter with functions AST:"); console.log(util.inspect(ast3, { depth: null }));
Debug
Known issues
breakingThe `odata-parser` package is entirely unmaintained, with its last update over 10 years ago and its GitHub repository archived in 2019. It does not support modern OData v4 syntax or features, and will likely fail to parse queries conforming to the latest OData specifications.
fix
Consider migrating to an actively maintained OData parser, such as `@jwstott/odata-v4-parser` or `@odata/parser`, which explicitly support OData v4 and are regularly updated.
affects: >=1.0.0
gotchaThis package is CommonJS-only and does not provide ES Module exports. Attempting to `import` it in a modern Node.js or browser environment configured for ESM will result in a runtime error (e.g., `ERR_MODULE_NOT_FOUND`).
fix
Ensure you are using `require('odata-parser')` for CommonJS environments. For ES Module projects, you might need to use dynamic `import()` or switch to a different OData parser that offers ESM support.
affects: >=1.0.0
gotchaAs an abandoned project, `odata-parser` will not receive any security updates. Using it in production environments may expose your application to potential vulnerabilities if issues are discovered in the parser itself or its underlying dependencies (like PEG.js).
fix
Audit your dependencies regularly for security vulnerabilities. Prioritize replacing this package with a maintained alternative, especially for applications handling sensitive data or public-facing APIs. The Auth0 Responsible Disclosure Program for `node-odata-parser` is no longer active.
affects: >=1.0.0
gotchaThe parser has known limitations and bugs, particularly with specific number formats and advanced filtering operations, which were reported in old GitHub issues and might remain unfixed due to lack of maintenance.
fix
Thoroughly test parsing of all expected OData query patterns. Be aware that complex filters or certain data types might be incorrectly parsed or throw unexpected errors.
affects: >=1.0.0
Errors
Common errors & fixes
ERR_MODULE_NOT_FOUND: Cannot find package 'odata-parser' imported from <your-file.mjs>
Attempting to import the CommonJS-only `odata-parser` package using ES Module `import` syntax in an ESM project.
fix
Change your import statement to `const parser = require('odata-parser');` if your project supports CommonJS. If you are strictly in an ESM environment, you may need to use a dynamic import: `const parser = await import('odata-parser');` (though this might not work seamlessly given the package's structure) or migrate to an ESM-compatible OData parser.
SyntaxError: Expected " " or "&" but "..." found.
The OData query string contains syntax that the parser does not understand or that is part of a newer OData specification (e.g., OData v4) not supported by this old parser.
fix
Verify that your OData query conforms to older OData specifications (likely v2 or v3). For OData v4 queries, use a modern, actively maintained OData v4 parser. Inspect the exact position indicated in the error message for malformed syntax.
TypeError: Cannot read properties of undefined (reading 'parse')
The `odata-parser` package was imported incorrectly, or `require('odata-parser')` did not return the expected object with a `parse` method.
fix
Ensure you are using `const parser = require('odata-parser');`. The `parser` object should be the direct export containing the `parse` method. If using a different import style, verify the default export structure.
Upgrade
Version history
1.4.1latest on npm
Audit
Dependencies
pegjsrequiredCore parsing engine for the OData grammar.
Agent activity
2 hits · last 30 days
node
2
Resources