UNPKG

breeze2-odata4

Version:

Library to allow OData 4 support for breezejs 2

38 lines (37 loc) 1.35 kB
import { EntityQuery, MetadataStore } from 'breeze-client'; export interface UriBuilder { name: string; initialize(): void; buildUri(entityQuery: EntityQuery, metadataStore: MetadataStore): any; } export interface QueryOptionsBase { expand?: ExpandOptions[]; filter?: string; select?: string[]; } export interface QueryOptions extends QueryOptionsBase { count?: boolean; orderby?: string; skip?: number; top?: number; } export interface ExpandOptions extends QueryOptionsBase { name: string; } export declare class OData4UriBuilder implements UriBuilder { name: string; static register(): void; initialize(): void; buildUri(entityQuery: EntityQuery, metadataStore: MetadataStore): string; private getResource(entityQuery); private getQueryOptions(rootOptions, propertyPath); private addExpandOption(entityType, queryOptions, expandClause); private addSelectOption(entityType, queryOptions, selectClause); private toWhereODataFragment(entityType, wherePredicate); private toOrderByODataFragment(entityType, orderByClause); private toQueryOptionsString(queryOptions); private getSelectString(select); private getFilterString(filter); private getExpandString(options); private formatString(format, params); }