MCPcopy Index your code
hub / github.com/Soontao/light-odata

github.com/Soontao/light-odata @v2.21.10

Chat with this repo
repository ↗ · DeepWiki ↗ · release v2.21.10 ↗ · + Follow
251 symbols 584 edges 32 files 84 documented · 33% updated 3d ago★ 448 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

OData Client

npm (scoped) NPM npm unittest codecov

npm bundle size (scoped) node-lts (scoped with tag) Maintainability Rating Technical Debt DeepScan grade

Javascript OData Client for OData (v2/v4) Service.

Installation

npm i -S @odata/client

Alternative, in native browser environment, just add unpkg or jsdeliver umd link to your page, and the OData object will be available in window.

<script src="https://cdn.jsdelivr.net/npm/@odata/client/lib/odata-client-umd.js"></script>

ODataClient

How to use @odata/client

Start with a simple query, following code start a GET http request, and asks the server to respond to all customers which phone number equals 030-0074321

import { OData } from "@odata/client"
// import "@odata/client/lib/polyfill" // server side polyfill

// odata.org sample odata service
const serviceEndpoint = "https://services.odata.org/V2/Northwind/Northwind.svc/"
const client = OData.New({ serviceEndpoint })

const runner = async () => {

  // Query by filter
  //
  // GET /Customers?$format=json&$filter=Phone eq '030-0074321'
  const filter = client.newFilter().property("Phone").eq("030-0074321");

  // just an example, suggest to use the EntitySet API
  const result = await client.newRequest({ // ODataRequest object
    collection: "Customers", // entity set
    params: client.newParam().filter(filter) // odata param
  })

}
// OData V4 client
const client = OData.New4({ serviceEndpoint: "https://odata-v4-demo-001.herokuapp.com/odata/" })

SystemQueryOption

use SystemQueryOption to control response size, element projection and order

go to the document

ODataFilter

use the ODataFilter to filter data

go to the document

EntitySet

use EntitySet to perform CRUD on a specific entity

go to the document

Batch requests

use odata $batch api for operating multi entities in single HTTP request, it will save a lot of time between client & server (In the case of processing a large number of requests).

go to the document

Advanced

some advanced topics

  • literal in uri
  • request interpreter
  • server side polyfill

go to the document

CHANGELOG

LICENSE

Thanks JetBrains

Extension points exported contracts — how you extend this code

Core symbols most depended-on inside this repo

Shape

Method 139
Class 42
Function 32
Interface 32
Enum 6

Languages

TypeScript100%

Modules by API surface

src/filter.ts43 symbols
src/types.ts38 symbols
src/odata.ts27 symbols
src/params.ts22 symbols
src/types_v4.ts20 symbols
src/entityset.ts18 symbols
src/tranformation.ts17 symbols
tests/demo_service_types.ts14 symbols
src/errors.ts12 symbols
src/base64.ts10 symbols
src/util.ts9 symbols
src/batch.ts9 symbols

For agents

$ claude mcp add light-odata \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page