Socket
Book a DemoInstallSign in
Socket

@dotglitch/odatav4

Package Overview
Dependencies
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dotglitch/odatav4

Maintained ODataV4 adapter. Supports SurrealDB.

latest
npmnpm
Version
0.0.11
Version published
Maintainers
2
Created
Source

:attn: This project is a fork of these repositories with added support for SurrealDB. https://github.com/jaystack/odata-v4-sql https://github.com/jaystack/odata-v4-parser

OData V4 Service modules - SQL Connector

Service OData v4 requests from an SQL data store.

Synopsis

The OData V4 SQL Connector provides functionality to convert the various types of OData segments into SQL query statements, that you can execute over an SQL database.

Potential usage scenarios

  • Create high speed, standard compliant data sharing APIs

Usage as server - TypeScript

import { createFilter } from 'odata-v4-sql'

//example request:  GET /api/Users?$filter=Id eq 42
app.get("/api/Users", (req: Request, res: Response) => {
    const filter = createFilter(req.query.$filter);
    // request instance from mssql module
    request.query(`SELECT * FROM Users WHERE ${filter.where}`, function(err, data){
        res.json({
        	'@odata.context': req.protocol + '://' + req.get('host') + '/api/$metadata#Users',
        	value: data
        });
    });
});

Advanced TypeScript example available here.

Supported OData segments

  • $filter
  • $select
  • $skip
  • $top
  • $orderby
  • $expand

FAQs

Package last updated on 07 May 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts