Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@odata/client

Soontao25.1kMIT2.21.10TypeScript support: included

OData(V2/V4) Client

OData, OData Client, Rest

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

changelog

Changelog

All notable changes to this project will be documented in this file. See standard-version for commit guidelines.

2.21.10 (2024-05-09)

Bug Fixes

  • deps: update dependency @newdash/newdash to v5.22.1 (5419402)

2.21.9 (2024-04-18)

Bug Fixes

  • dep (3f63c67)
  • deps: update dependency @types/node-fetch to v2.6.10 (6ab222a)
  • deps: update dependency @types/node-fetch to v2.6.11 (c59b29f)
  • deps: update dependency @types/node-fetch to v2.6.5 (c0c3ce2)
  • deps: update dependency @types/node-fetch to v2.6.6 (db1a3ca)
  • deps: update dependency @types/node-fetch to v2.6.7 (4166a26)
  • deps: update dependency @types/node-fetch to v2.6.8 (1c5b677)
  • deps: update dependency @types/node-fetch to v2.6.9 (baf7949)
  • deps: update dependency fetch-cookie to v2.2.0 (c0d4d74)
  • deps: update dependency fetch-cookie to v3 (bd595ed)
  • deps: update dependency fetch-cookie to v3.0.1 (8ee27df)
  • deps: update dependency node-fetch to v2.7.0 (360421b)
  • deps: update dependency uuid to v9.0.1 (cf5eb80)

2.21.8 (2023-08-22)

Bug Fixes

  • deps: update dependency node-fetch to v2.6.13 (9ceb6ab)

2.21.7 (2023-07-21)

Bug Fixes

  • deps: update dependency node-fetch to v2.6.12 (12d2e72)

2.21.6 (2023-05-22)

Bug Fixes

  • dep (0f0a78d)
  • deps: update dependency @types/node-fetch to v2.6.4 (58e30c3)
  • deps: update dependency node-fetch to v2.6.10 (0c039a0)
  • deps: update dependency node-fetch to v2.6.11 (013ae21)

2.21.5 (2023-04-23)

Bug Fixes

  • deps: update dependency @newdash/newdash to v5.22.0 (8a05dc2)
  • deps: update dependency @odata/parser to v0.2.14 (#643) (828f111)
  • deps: update dependency @types/node-fetch to v2.6.3 (bda005f)
  • deps: update dependency node-fetch to v2.6.9 (9715441)

2.21.4 (2023-01-07)

Bug Fixes

2.21.3 (2023-01-07)

Bug Fixes

2.21.2 (2022-12-16)

Bug Fixes

2.21.1 (2022-11-03)

2.21.0 (2022-11-03)

Features

2.21.0-beta.0 (2022-09-24)

Bug Fixes

2.21.0-alpha.0 (2022-09-24)

Features

Bug Fixes

2.20.2 (2022-08-16)

Bug Fixes

2.20.1 (2022-07-19)

2.20.0 (2022-07-07)

Features

2.19.5 (2022-06-26)

2.19.4 (2022-05-25)

Features

2.19.3 (2022-05-20)

2.19.2 (2022-04-11)

2.19.1 (2022-03-08)

2.19.0 (2022-03-08)

2.19.0-beta.3 (2022-02-25)

Features

  • support Edm type with payload (3429d72)

Bug Fixes

2.19.0-beta.2 (2022-02-24)

Features

  • enhance params.filter (80c8d90)
  • support uri encoded for datetime (3b42137)

Bug Fixes

2.19.0-beta.1 (2022-02-24)

2.19.0-beta.0 (2022-02-23)

Features

2.19.0-alpha.1 (2022-02-17)

2.19.0-alpha.0 (2022-02-16)

Features

  • change the oauth implementation (592e0c8)

Bug Fixes

2.18.0 (2022-01-26)

2.18.0-alpha.0 (2022-01-25)

Features

  • change visibility for getCsrfToken (de7c107)
  • force retrieving csrf token (9f8e101)

Bug Fixes

2.17.1 (2021-12-15)

Bug Fixes

  • negative value for v2 datetime (cffe859)

2.17.0 (2021-12-14)

Features

  • add new variant for sap-gateway (bac1d59)
  • adjust the search parameter (80909f7)

Bug Fixes

2.16.3 (2021-12-14)

Bug Fixes

2.16.2 (2021-08-19)

2.16.1 (2021-07-02)

Bug Fixes

2.16.0 (2021-06-19)

Features

  • actionImport/functionImport (e246e66)

Bug Fixes

2.15.2 (2021-04-13)

Bug Fixes

2.15.1 (2021-04-13)

2.15.0 (2021-04-13)

Features

Bug Fixes

2.14.1 (2021-03-17)

Bug Fixes

2.14.0 (2021-02-20)

Features

  • add filter.proprety method (93fe889)

Bug Fixes

2.13.0 (2021-02-09)

Features

2.12.0 (2020-12-29)

Features

2.11.4 (2020-12-11)

2.11.3 (2020-10-12)

Bug Fixes

  • entityset result parsing (9fba99b)

2.11.2 (2020-10-12)

2.11.1 (2020-10-01)

Bug Fixes

2.11.0 (2020-10-01)

Features

  • support atom & dependsOn in execBatchJson (cb7ee75)

Bug Fixes

2.10.3 (2020-09-22)

2.10.2 (2020-09-03)

2.10.1 (2020-08-26)

Bug Fixes

  • filter throw error when given bool (a07a137)

2.10.0 (2020-08-10)

Features

2.9.0 (2020-08-05)

Features

  • #29, odata bounded action/function support (0ced34a)

2.8.1 (2020-08-02)

2.8.0 (2020-08-01)

Features

2.7.0 (2020-07-31)

Features

  • support parameter on retrieve (e08d025)

2.6.0 (2020-07-29)

Features

Bug Fixes

2.5.3 (2020-07-17)

2.5.2 (2020-07-10)

Bug Fixes

2.5.1 (2020-06-29)

2.5.0 (2020-06-29)

Features

2.4.1 (2020-06-29)

Bug Fixes

2.4.0 (2020-06-29)

Features

Bug Fixes

2.3.0 (2020-06-01)

Features

  • reduce release package size (3cd8d8f)

Bug Fixes

2.2.0 (2020-05-29)

Features

  • improve code quality (e02d671)
  • reduce release size & remove lodash (f02d9e2)
  • remove generator (4a902e9)

Bug Fixes

  • upgrade buffer from 5.4.3 to 5.5.0 (968e588)
  • upgrade uuid from 3.3.3 to 3.4.0 (ec00889)

2.1.0 (2020-03-06)

Features

1.4.4 (2020-01-06)

Bug Fixes

  • security issue of dependency (712fec1)

1.4.3 (2019-10-29)

1.4.2 (2019-09-09)

Bug Fixes

1.4.1 (2019-06-14)

1.4.0 (2019-05-31)

Features

  • retrive: by compound key (f317e72)

1.3.8 (2019-04-08)

Bug Fixes

1.3.7 (2018-11-06)

Bug Fixes

1.3.6 (2018-11-03)

Bug Fixes

  • batch: Read-Write in single batch works now (ad880cd)

1.3.5 (2018-11-02)

Bug Fixes

  • improvement: doc & code (be649ab)

1.3.4 (2018-11-01)

1.3.3 (2018-10-31)

1.3.2 (2018-10-26)

Bug Fixes

1.3.1 (2018-10-26)

Bug Fixes

  • doc: update & Field functions (49a6a02)

1.3.0 (2018-10-25)

Features

  • field: new method & doc update (e42dcd0)

1.2.1 (2018-10-25)

Bug Fixes

1.2.0 (2018-10-25)

Features

1.1.3 (2018-08-28)

Bug Fixes

1.1.2 (2018-08-27)

1.1.1 (2018-08-27)

Bug Fixes

1.1.0 (2018-08-27)

Features

  • refactor: suppose user's operator & document (034bd6b)

1.0.60 (2018-08-20)

1.0.59 (2018-08-09)

1.0.58 (2018-08-03)

1.0.57 (2018-08-03)

1.0.56 (2018-08-03)

1.0.55 (2018-08-01)

1.0.54 (2018-07-19)

1.0.53 (2018-07-16)

1.0.52 (2018-07-04)

1.0.50 (2018-07-01)

1.0.49 (2018-07-01)

1.0.48 (2018-07-01)

1.0.47 (2018-07-01)

1.0.46 (2018-07-01)

1.0.45 (2018-07-01)