Skip to content

Commit

Permalink
First public release
Browse files Browse the repository at this point in the history
  • Loading branch information
frankabbruzzese committed May 23, 2017
1 parent cefb8db commit fdac242
Show file tree
Hide file tree
Showing 20 changed files with 790 additions and 98 deletions.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,24 @@ many-to-one relations.
2. res1, res2, ... may be just properties of the main destination object (the object used to return all results of the grouping).
3. op1, op2, .., are one of: countdistinct, average, sum, min, max.

# Public Api
The distribution contains .js and TypeScript declaration files (d.ts) for three environments, namely:
1. umd distribution that covers both AMD and Node.js commonjs modules.
2. ES6 distribution suitable for both ES6 modules and WebPack. This distribution doesnt require full es6 but just ES6 modules, so it may be succesfully used also with previous JavaScript versions bundled with WebPack 2 that supports ES6 modules.
3. mvcct.odata global namespace.

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.

## QueryDescription class
*Under construction*
## Building filters
*Under construction*
## building free search
*Under construction*
## building sorting
*Under construction*
## Grouping and aggregations
*Under construction*



Expand Down
13 changes: 11 additions & 2 deletions dest/es6/mvcct.odata.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ export interface IAggregation {
}
export declare abstract class QueryNode {
encodeProperty(name: string): string;
decodeProperty(name: string): string;
abstract toString(): string | null;
getProperty(o: any, p: string): any;
static getProperty(o: any, p: string): any;
}
export declare abstract class QueryFilterClause extends QueryNode {
abstract toQuery(): ((o: any) => boolean) | null;
Expand All @@ -37,7 +39,7 @@ export declare class QueryFilterBooleanOperator extends QueryFilterClause implem
child1: QueryFilterBooleanOperator;
child2: QueryFilterBooleanOperator;
constructor(origin: IQueryFilterBooleanOperator);
constructor(operator: number, a1: QueryValue | QueryFilterBooleanOperator, a2?: QueryValue | QueryFilterBooleanOperator);
constructor(operator: number, a1: QueryFilterClause, a2?: QueryFilterClause);
toString(): string | null;
toQuery(): ((o: any) => boolean) | null;
}
Expand Down Expand Up @@ -65,6 +67,7 @@ export declare class QueryValue extends QueryFilterClause implements IQueryValue
setBoolean(x: boolean | null): void;
setNumber(x: number | null): void;
setString(x: string | null): void;
setNotDateTime(x: any): void;
getValue(): any;
toString(): string | null;
toQuery(): ((o: any) => boolean) | null;
Expand All @@ -85,6 +88,7 @@ export declare class QueryFilterCondition extends QueryValue implements IQueryFi
static readonly endswith: string;
static readonly contains: string;
private static readonly dict;
static fromModelAndName(dateTimeType: number, property: string, o: any, op?: string, inv?: boolean): QueryFilterCondition | null;
operator: string | null;
property: string | null;
inv: boolean;
Expand Down Expand Up @@ -142,10 +146,12 @@ export declare class QueryAggregation extends QueryNode implements IQueryAggrega
export interface IQueryGrouping {
keys: Array<string>;
aggregations: Array<IQueryAggregation>;
dateTimeTypes: Array<number>;
}
export declare class QueryGrouping extends QueryNode implements IQueryGrouping {
keys: Array<string>;
aggregations: Array<QueryAggregation>;
dateTimeTypes: Array<number>;
constructor(origin?: IQueryGrouping);
private encodeGroups();
private encodeAggrgates();
Expand All @@ -165,8 +171,9 @@ export declare class Endpoint implements IEndpoint {
accpetsJson: boolean;
returnsJson: boolean;
bearerToken: string | null;
ajaxId: string | null;
constructor(x: IEndpoint);
constructor(baseUrl: string, verb: string, accpetsJson?: boolean, returnsJson?: boolean, bearerToken?: string | null);
constructor(baseUrl: string, verb: string, accpetsJson?: boolean, returnsJson?: boolean, bearerToken?: string | null, ajaxId?: string | null);
}
export interface IQueryDescription {
skip: number | null;
Expand Down Expand Up @@ -197,6 +204,8 @@ export declare class QueryDescription implements IQueryDescription {
attachedTo: Endpoint;
static fromJson(x: string): QueryDescription;
constructor(origin: IQueryDescription);
addFilterCondition(filter: QueryFilterClause | null, useOr?: boolean): void;
getGroupDetailQuery(o: any): QueryDescription | null;
queryString(): string | null;
addToUrl(url: string | null): string | null;
toString(): string | null;
Expand Down
102 changes: 93 additions & 9 deletions dest/es6/mvcct.odata.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dest/es6/mvcct.odata.js.map

Large diffs are not rendered by default.

13 changes: 11 additions & 2 deletions dest/global/mvcct.odata.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ declare namespace mvcct {
}
abstract class QueryNode {
encodeProperty(name: string): string;
decodeProperty(name: string): string;
abstract toString(): string | null;
getProperty(o: any, p: string): any;
static getProperty(o: any, p: string): any;
}
abstract class QueryFilterClause extends QueryNode {
abstract toQuery(): ((o: any) => boolean) | null;
Expand All @@ -39,7 +41,7 @@ declare namespace mvcct {
child1: QueryFilterBooleanOperator;
child2: QueryFilterBooleanOperator;
constructor(origin: IQueryFilterBooleanOperator);
constructor(operator: number, a1: QueryValue | QueryFilterBooleanOperator, a2?: QueryValue | QueryFilterBooleanOperator);
constructor(operator: number, a1: QueryFilterClause, a2?: QueryFilterClause);
toString(): string | null;
toQuery(): ((o: any) => boolean) | null;
}
Expand Down Expand Up @@ -67,6 +69,7 @@ declare namespace mvcct {
setBoolean(x: boolean | null): void;
setNumber(x: number | null): void;
setString(x: string | null): void;
setNotDateTime(x: any): void;
getValue(): any;
toString(): string | null;
toQuery(): ((o: any) => boolean) | null;
Expand All @@ -87,6 +90,7 @@ declare namespace mvcct {
static readonly endswith: string;
static readonly contains: string;
private static readonly dict;
static fromModelAndName(dateTimeType: number, property: string, o: any, op?: string, inv?: boolean): QueryFilterCondition | null;
operator: string | null;
property: string | null;
inv: boolean;
Expand Down Expand Up @@ -144,10 +148,12 @@ declare namespace mvcct {
interface IQueryGrouping {
keys: Array<string>;
aggregations: Array<IQueryAggregation>;
dateTimeTypes: Array<number>;
}
class QueryGrouping extends QueryNode implements IQueryGrouping {
keys: Array<string>;
aggregations: Array<QueryAggregation>;
dateTimeTypes: Array<number>;
constructor(origin?: IQueryGrouping);
private encodeGroups();
private encodeAggrgates();
Expand All @@ -167,8 +173,9 @@ declare namespace mvcct {
accpetsJson: boolean;
returnsJson: boolean;
bearerToken: string | null;
ajaxId: string | null;
constructor(x: IEndpoint);
constructor(baseUrl: string, verb: string, accpetsJson?: boolean, returnsJson?: boolean, bearerToken?: string | null);
constructor(baseUrl: string, verb: string, accpetsJson?: boolean, returnsJson?: boolean, bearerToken?: string | null, ajaxId?: string | null);
}
interface IQueryDescription {
skip: number | null;
Expand Down Expand Up @@ -199,6 +206,8 @@ declare namespace mvcct {
attachedTo: Endpoint;
static fromJson(x: string): QueryDescription;
constructor(origin: IQueryDescription);
addFilterCondition(filter: QueryFilterClause | null, useOr?: boolean): void;
getGroupDetailQuery(o: any): QueryDescription | null;
queryString(): string | null;
addToUrl(url: string | null): string | null;
toString(): string | null;
Expand Down
Loading

0 comments on commit fdac242

Please sign in to comment.