JavaScript OData client
mvcct-odata is a alightweight JavaScript OData client. It supports just queries, with filter or free search,
sorting, and gtouping+aggregation.
Queries are represented as nested objects with JavasCript methods to get their corresponding OData string representation.
This way queries are easily built and modified by adding, removing substituting and editing plain JavaScript objects.
OData objects with all they methods can be easily extracted from their Json representations,
so queries can be easily exchanged with the server and stored in all browser storage types
(cookies, local storage, etc.).
Json representation is compatible with the query representation of the MvcControlsToolkit.Core.OData
Asp.net core package.
Filter conditions may contain main entity properties and properties of entities directly or indirectly connected with the main entity through a chain of one-to-one or
many-to-one relations.
Conditions may be nested not/and/or combinations of “leaf conditions” containing a relation between a property
and a constant. The following relations are supported:
,<, >=, <=, ==, !=, startsWith, endsWith, contains.
No limitation.
Any sorting involving main entity properties and properties of entities directly or indirectly connected with the main entity through a chain of one-to-one or
many-to-one relations is supported.
The library supports grouping of the type (see here for more infos on OData aggregations):
apply=groupby((properti1, property2, ...),
aggregate(aproperty1 with <operator1> as res1, aproperty2 with <operator2> as res2,...))
Where:
The distribution contains .js and TypeScript declaration files (d.ts) for three environments, namely:
Queries are prepared by building an object tree rooted in a QueryDescription
instance. Then one may call QueryDescription methods like toString()
to get the whole ODATA compatible Url of the server request, or toQuery
that returns a funtion from an array to a an array that executes the query on the JavaScript input array.