diff --git a/orientjs/orientjs-tests.ts b/orientjs/orientjs-tests.ts
new file mode 100644
index 0000000000..1802f86ece
--- /dev/null
+++ b/orientjs/orientjs-tests.ts
@@ -0,0 +1,17 @@
+///
+///
+
+import * as orientjs from 'orientjs';
+
+let dbserver = orientjs({
+ host: 'localhost',
+ port: 2424,
+ username: 'root',
+ password: 'root'
+ });
+let db = dbserver.use({
+ name: 'mytestdb',
+ username: 'root',
+ password: 'root'
+ });
+
diff --git a/orientjs/orientjs.d.ts b/orientjs/orientjs.d.ts
new file mode 100644
index 0000000000..b75a3ab581
--- /dev/null
+++ b/orientjs/orientjs.d.ts
@@ -0,0 +1,500 @@
+// Type definitions for orientjs v2.1.0
+// Project: https://github.com/orientechnologies/orientjs
+// Definitions by: Saeed Tabrizi
+// Definitions: https://github.com/borisyankov/DefinitelyTyped
+// Developed with love in www.nowcando.com
+
+///
+///
+
+/* =================== USAGE ===================
+
+ import orientjs = require('orientjs');
+ var dbserver = orientjs({
+ host: 'localhost',
+ port: 2424,
+ username: 'root',
+ password: 'root'
+ });
+ var db = dbserver.use({
+ name: 'mytestdb',
+ username: 'root',
+ password: 'root'
+ });
+
+ =============================================== */
+
+declare module "orientjs" {
+ import events = require('events');
+ import Promise = require('bluebird');
+ function ojs(config: any): ojs.OrientJs;
+
+ module ojs {
+
+ module errors {
+ interface BaseError {
+ name: string;
+ init(name: string): void;
+ }
+ interface OperationError extends BaseError {
+ message: string;
+ date: any;
+ }
+ interface RequestError extends OperationError { }
+ }
+
+ module Migration {
+ function Manager(config: any): void ;
+ interface Migration {
+ name: string;
+ server: Server;
+ db: Db;
+ configure(config?: any): void;
+ up(): Promise;
+ down(): Promise;
+
+
+ }
+
+ class MigrationManager {
+
+ constructor(config?: any);
+ name: string;
+ server: Server;
+ db: Db;
+ dir: string;
+ className: string;
+ create(param: string): Promise;
+ generateMigration(config: any): string;
+ list(): Promise;
+ listAvailable(): Promise;
+ ensureStructure: Promise;
+ listApplied(): Promise;
+ up(limit?: number): Promise;
+ down(limit?: number): Promise;
+ loadMigration(name: string): Migration;
+ applyMigration(name: string): Promise;
+ revertMigration(name: string): Promise;
+ }
+ }
+
+ enum DataTypes {
+ Boolean = 0,
+ Integer = 1,
+ Short = 2,
+ Long = 3,
+ Float = 4,
+ Double = 5,
+ Datetime = 6,
+ String = 7,
+ Binary = 8,
+ Embedded = 9,
+ EmbeddedList = 10,
+ EmbeddedSet = 11,
+ EmbeddedMap = 12,
+ Link = 13,
+ LinkList = 14,
+ LinkSet = 15,
+ LinkMap = 16,
+ Byte = 17,
+ Transient = 18,
+ Date = 19,
+ Custom = 20,
+ Decimal = 21,
+ LinkBag = 22,
+
+ }
+
+ interface Logger {
+ error?: Function;
+ log?: Function;
+ debug?: Function;
+ }
+
+ interface RID extends String {
+ cluster?: number;
+ position?: number;
+
+ valueOf(): string;
+ isValid?(): boolean;
+ equals?(rid: string): boolean;
+ equals?(rid: RID): boolean;
+ parse?(input: string): boolean;
+ parse?(input: string): RID;
+ parse?(input: string): RID[];
+ isValid?(input: string): boolean;
+ isValid?(input: RID): boolean;
+ isValid?(input: any): boolean;
+ toRid?(cluster: number, position: number):any;
+ }
+
+ interface Property {
+
+ class: Class;
+ name: string;
+ originalName: string;
+ type: any;
+ mandatory: boolean;
+ readonly: boolean;
+ notNull: boolean;
+ collate: string;
+ linkedClass: Class;
+ regexp: RegExp;
+ min: any;
+ max: any;
+
+ configure(config?: any): void;
+ reload(): Promise;
+ rename(newName: string): Promise;
+ list(): Promise & Promise;
+ create(config: string, reload?: boolean): Promise & Promise;
+ create(config?: any, reload?: boolean): Promise & Promise;
+ create(...config: any[]): Promise & Promise;
+ get(name: string): Promise & Promise;
+ update(config: any, reload?: boolean): Promise & Promise;
+ drop(name: string): Promise;
+ alter(name: string, setting?: any): Promise & Promise;
+ rename(oldName: string, newName: string): Promise;
+ }
+
+ interface Class {
+
+ db: Db;
+ name: string;
+ shortName: string;
+ defaultClusterId: any;
+ superClass: string;
+ originalName: string;
+ clusterIds: number[];
+
+ configure(config?: any): void;
+ list(limit: number, offset: number): Promise & Promise & Promise;
+ list(config: any): Promise & Promise & Promise;
+ list(refresh: boolean): Promise & Promise & Promise;
+ find(attributes: any, limit: number, offset: number): Promise;
+ create(record: Record): Promise & Promise;
+ create(name: string, parentName?: string, cluster?: string, isAbstract?: boolean): Promise & Promise;
+ update(cls: any, reload: boolean): Promise & Promise;
+ reload(): Promise;
+ drop(name: string): Promise;
+ get(name: string, refresh?: boolean): Promise & Promise;
+ cacheData(classes: Class[] & any[]): Db;
+ property: Property;
+
+ }
+
+ interface Cluster {
+ name: string;
+ location: string;
+ list(refresh?: boolean): Promise;
+ create(name: string, location?: string): Promise & Promise;
+ get(nameOrId: string, refresh?: boolean): Promise & Promise;
+ get(nameOrId: number, refresh?: boolean): Promise & Promise;
+ getByName(name: string, refresh?: boolean): Promise & Promise;
+ getById(id: string, refresh?: boolean): Promise & Promise;
+ drop(name: string): Promise;
+ count(name: string): Promise;
+ range(name: string): Promise;
+ cacheData(clusters: Cluster[] & any[]): Db;
+
+ }
+
+ interface RecordMeta {
+ "@rid": string|RID;
+ "@version": string|number;
+
+ }
+
+ interface Record {
+ rid: RID;
+ create(record: any, options?: any): Promise ;
+ get(record: Record & any, options?: any): Promise;
+ resolveReferences(records: Record[] & any[]): any;
+ meta(record: Record & any, options?: any): Promise ;
+ update(): Promise & Promise;
+ update(record: Record & any, options?: any): Promise ;
+ delete(): Promise & Promise;
+ delete(record: Record & any, options?: any): Promise ;
+ delete(record: RID, options?: any): Promise ;
+ delete(record: string, options?: any): Promise ;
+
+ }
+
+ interface Index {
+ cached: boolean;
+ db: Db;
+ name: string;
+ algorithm: string;
+ clusters: Cluster[];
+ type: string;
+
+ configure(config: any): void;
+ add(args: any): Promise;
+ add(args: any[]): Promise;
+ get(key: string): Promise;
+ set(key: string, value: string): Promise;
+ set(key: string, value: RID): Promise;
+ delete(name: string): Promise;
+ select(): Statement;
+ list(refresh?: boolean): Promise;
+ create(config: any): Promise;
+ drop(name: string): Promise;
+ get(name: string, refresh?: boolean): Promise;
+ cacheData(indices: any[]): Promise;
+
+ }
+
+ interface Statement extends Query {
+ select(param: string): Statement;
+ select(params: string[]): Statement;
+ traverse(param: string): Statement;
+ traverse(param: string[]): Statement;
+
+ strategy(param: string): Statement;
+ insert(param: string): Statement;
+ insert(param: string[]): Statement;
+ insert(param: any): Statement;
+ update(param: string): Statement;
+ update(param: string[]): Statement;
+ update(param: any): Statement;
+ delete(param: string): Statement;
+ delete(param: string[]): Statement;
+ delete(param: any): Statement;
+ into(param: string): Statement;
+ into(param: string[]): Statement;
+ into(param: any): Statement;
+ create(paramtype: string, paramname: string): Statement;
+ from(param: string): Statement;
+ from(param: string[]): Statement;
+ from(param: any): Statement;
+ from(param: Function): Statement;
+ to(param: string): Statement;
+ to(param: any): Statement;
+ to(param: Function): Statement;
+ set(param: string): Statement;
+ set(param: string[]): Statement;
+ set(param: any): Statement;
+ content(param: string): Statement;
+ content(param: any): Statement;
+ increment(property: string, value: any): Statement;
+ add(property: string, value: any): Statement;
+ remove(property: string, value: any): Statement;
+ put(property: string, keysValues: any): Statement;
+ upsert(condition?: string, params?: any, comparisonOperator?: string): Statement;
+ upsert(condition?: any, params?: any, comparisonOperator?: string): Statement;
+ where(param: string): Statement;
+ where(param: string[]): Statement;
+ where(params: any): Statement;
+ while(param: string): Statement;
+ while(param: string[]): Statement;
+ while(param: any): Statement;
+
+ containsText(param: any): Statement;
+ and(param: string): Statement;
+ and(param: string[]): Statement;
+ and(param: any): Statement;
+ or(param: string): Statement;
+ or(param: string[]): Statement;
+ or(param: any): Statement;
+ group(param: string): Statement;
+ group(param: string[]): Statement;
+ group(param: any): Statement;
+ order(param: string): Statement;
+ order(param: string[]): Statement;
+ order(param: any): Statement;
+ skip(value: number): Statement;
+ offset(value: number): Statement;
+ limit(value: number): Statement;
+ fetch(param: string): Statement;
+ fetch(param: any): Statement;
+ let(name: string, value: string): Statement;
+ let(name: string, value: Statement): Statement;
+ lock(param: string): Statement;
+ lock(param: any): Statement;
+ commit(retryLimit?: number): Statement;
+ retry(retryLimit?: number): Statement;
+ wait(waitLimit: number): Statement;
+ return(value: string): Statement;
+ lucene(property: string, luceneQuery: string): Statement;
+ lucene(property: any, luceneQuery: string): Statement;
+ near(latitudeProperty: string, longitudeProperty: string, longitude: number, latitude: number, maxDistanceInKms: number): Statement;
+ near(prop: any, maxDistanceInKms: number, longitude: number, latitude: number): Statement;
+
+ within(latitudeProperty: string, longitudeProperty: string, box: Array): Statement;
+
+ addParams(key: string, value: any): Statement;
+ addParams(value: any): Statement;
+ token(value: any): Statement;
+ buildStatement(): string;
+
+ }
+
+ interface Query {
+
+ transform(transformer: any): Query;
+ transform(transformer: Function): Query;
+ column(name: string): Query;
+ defaults(defaults: any): Query;
+ one(params?: any): Promise ;
+ all(params?: any): Promise ;
+ scalar(params?: any): Promise;
+ exec(params?: any): Promise;
+ one(params?: any): Promise;
+ all(params?: any): Promise;
+ scalar(params?: any): Promise;
+ exec(params?: any): Promise;
+ }
+
+ interface Transaction {
+ db: Db;
+ id: number;
+
+ commit(): Promise;
+ create(record: any): Transaction;
+ update(record: any): Transaction;
+ delete(record: string): Transaction;
+ delete(record: RID): Transaction;
+ delete(record: any): Transaction;
+
+ }
+
+ interface DbConnectionConfig {
+
+ useToken: boolean;
+ name: string;
+ username: string;
+ password: string;
+ sessionId: number;
+ forcePrepare: boolean;
+ server: Server;
+ type: string;
+ storage: string;
+ token: any;
+ transformers: any;
+ }
+
+ interface DbConfig {
+ name: string;
+ type: string;
+ storage: string;
+ }
+
+ interface Db extends events.EventEmitter {
+ sessionId: number;
+ forcePrepare: boolean;
+ name: string;
+ server: Server;
+ type: string;
+ storage: string;
+ token: any;
+ dataSegments: any[];
+ transactionId: number;
+ transformers: any;
+ transformerFunctions: any;
+
+ class: Class;
+ cluster: Cluster;
+ record: Record;
+ index: Index;
+
+
+ configure(config: DbConfig): Db;
+ init(): void;
+ open(): Promise;
+ close(): Promise;
+ send(operation: number, data: any): Promise;
+ reload(): Promise;
+ begin(): Transaction;
+ exec(query: string, options?: any): Promise;
+ query(command: string, options?: any): Promise;
+ liveQuery(command: string, options?: any): Promise;
+ normalizeResult(result: any): any;
+ normalizeResultContent(content: any): any;
+ registerTransformer(className: string, transformer: Function): Db;
+ transformDocument(document: any): any;
+ createQuery(): Statement;
+ create(params?: any): Statement;
+ create(paramtype: string, paramname: string): Statement;
+ select(params?: any): Statement;
+ select(param: string): Statement;
+ select(params: string[]): Statement;
+
+ traverse(params?: any): Statement;
+ traverse(param: string): Statement;
+ traverse(param: string[]): Statement;
+
+ insert(params?: any): Statement;
+
+ update(params?: any): Statement;
+
+ delete(params?: any): Statement;
+
+ let(params?: any): Statement;
+ insert(param: string): Statement;
+ insert(param: string[]): Statement;
+ update(param: string): Statement;
+ update(param: string[]): Statement;
+ delete(param: string): Statement;
+ delete(param: string[]): Statement;
+ let(name: string, value: string): Statement;
+ let(name: string, value: Statement): Statement;
+
+ escape(input: string): string;
+ createUserContext(token: any): any;
+ createFn(name: string, fn: Function, options?: any): Promise;
+ createFn(fn: Function, options?: any): Promise;
+
+ }
+
+ interface ServerConfig {
+ constructor(config?: any):ServerConfig;
+ useToken: boolean;
+ host: string;
+ port: number;
+ username: string;
+ password: string;
+
+
+ // new(host: string, port: number, username: string, password: string, useToken): ServerConfig;
+ }
+
+ interface ServerConfiguration {
+
+ get(name: string): string;
+ set(key: string, value: string): string;
+ list(): any;
+ }
+
+ interface Server {
+
+ config: ServerConfiguration;
+ logger: Logger;
+ init(): void;
+ configure(): Server;
+ configureLogger(logger: Logger): Server;
+ send(operation: number, options: any): any;
+ close(): Server;
+ use(config: string): Db;
+ use(config?: any): Db;
+ create(config: string): Promise;
+ create(config: DbConfig): Promise;
+ create(config: any): Promise;
+ drop(config: string): Promise;
+ drop(config: DbConfig): Promise;
+ list(): Promise;
+ exists(name: string, storageType?: string): Promise;
+ freeze(name: string, storageType?: string): any;
+ release(name: string, storageType?: string): any;
+ }
+
+
+ interface OrientJs extends Server {
+
+
+ }
+
+ }
+
+ export = ojs;
+
+}
\ No newline at end of file