Explorar o código

modulo de presupuestos iniciado por el modulo de clientes

robert2206 %!s(int64=8) %!d(string=hai) anos
pai
achega
2e17ed7621

+ 1 - 0
package.json

@@ -33,6 +33,7 @@
     "pouchdb-adapter-websql-core": "^6.0.7",
     "pouchdb-core": "^6.0.7",
     "pouchdb-upsert": "^2.0.2",
+    "reflect-metadata": "^0.1.8",
     "relational-pouch": "^1.4.4",
     "rollup-plugin-node-builtins": "^2.0.0",
     "rollup-plugin-node-globals": "^1.0.9",

+ 8 - 1
src/app/app.component.ts

@@ -6,6 +6,7 @@ import { LoginPage } from '../pages/login/login';
 import { HomePage } from '../pages/home/home';
 
 import { CustomerListPage } from '../pages/customer-list/customer-list';
+import { BudgetListPage } from '../pages/budget-list/budget-list';
 import { ProductListPage } from '../pages/product-list/product-list';
 import { LeadListPage } from '../pages/lead-list/lead-list';
 import { OpportunityListPage } from '../pages/opportunity-list/opportunity-list';
@@ -38,11 +39,17 @@ export class OdooMobileApp {
                 title: "Ventas",
                 pages: [
                     {
-                        visible: false,
+                        visible: true,
                         title: "Clientes",
                         icon: "people",
                         component: CustomerListPage
                     },
+                    {
+                        visible: true,
+                        title: "Presupuestos",
+                        icon: "basket",
+                        component: BudgetListPage 
+                    },
                     {
                         visible: true,
                         title: 'Productos',

+ 3 - 0
src/app/app.module.ts

@@ -7,6 +7,7 @@ import { HallPage } from '../pages/hall/hall';
 import { HomePage } from '../pages/home/home';
 
 import { CustomerListPage } from '../pages/customer-list/customer-list';
+import { BudgetListPage } from '../pages/budget-list/budget-list';
 import { ProductListPage } from '../pages/product-list/product-list';
 import { ProductOptions } from '../pages/product-list/product-options';
 import { ProductDetailsPage } from '../pages/product-details/product-details';
@@ -46,6 +47,7 @@ import { ChartModule } from 'ng2-chartjs2';
         HallPage,
         HomePage,
         CustomerListPage,
+        BudgetListPage,
         ProductListPage,
         ProductOptions,
         ProductDetailsPage,
@@ -73,6 +75,7 @@ import { ChartModule } from 'ng2-chartjs2';
         HallPage,
         HomePage,
         CustomerListPage,
+        BudgetListPage,
         ProductListPage,
         ProductOptions,
         ProductDetailsPage,

+ 6 - 4
src/decorators/document-type.ts

@@ -1,6 +1,8 @@
-function type(name: string) {
-    return (target: Function) => {
-        console.log(target + " called");
-        
+/**
+ *
+ */
+export function Document(type: string) {
+    return function (target: Function) {
+        Reflect.defineMetadata("document", type, target);        
     }
 }

+ 8 - 0
src/decorators/entrypoint.ts

@@ -0,0 +1,8 @@
+/**
+ *
+ */
+export function Entrypoint(name: string) {
+    return function (target: Function) {
+        Reflect.defineMetadata("entrypoint", name, target);
+    }
+}

+ 5 - 0
src/models/product.ts

@@ -1,3 +1,8 @@
+import { Document } from '../decorators/document-type';
+import { Entrypoint } from '../decorators/entrypoint';
+
+@Document("product")
+@Entrypoint("product_product")    
 export class Product {
 
     public default_code: string;

+ 11 - 0
src/pages/budget-details/budget-details.html

@@ -0,0 +1,11 @@
+<ion-header>
+    <ion-navbar>
+        <ion-title>Presupuesto</ion-title>
+    </ion-navbar>
+
+</ion-header>
+
+
+<ion-content padding>
+
+</ion-content>

+ 3 - 0
src/pages/budget-details/budget-details.scss

@@ -0,0 +1,3 @@
+page-budget-details {
+
+}

+ 22 - 0
src/pages/budget-details/budget-details.ts

@@ -0,0 +1,22 @@
+import { Component } from '@angular/core';
+import { NavController } from 'ionic-angular';
+
+/*
+  Generated class for the BudgetDetails page.
+
+  See http://ionicframework.com/docs/v2/components/#navigation for more info on
+  Ionic pages and navigation.
+*/
+@Component({
+  selector: 'page-budget-details',
+  templateUrl: 'budget-details.html'
+})
+export class BudgetDetailsPage {
+
+  constructor(public navCtrl: NavController) {}
+
+  ionViewDidLoad() {
+    console.log('Hello BudgetDetailsPage Page');
+  }
+
+}

+ 20 - 0
src/pages/budget-list/budget-list.html

@@ -0,0 +1,20 @@
+<ion-header>
+
+    <ion-navbar color="primary">
+        <button ion-button menuToggle>
+            <ion-icon name="menu"></ion-icon>
+        </button>
+
+        <ion-title>Presupuestos</ion-title>
+    </ion-navbar>
+
+</ion-header>
+
+<ion-content>
+
+     <ion-fab right bottom>
+        <button ion-fab color="yellow" (click)="goToPage(null)">
+            <ion-icon name="add" color="light"></ion-icon>
+        </button>
+    </ion-fab>    
+</ion-content>

+ 3 - 0
src/pages/budget-list/budget-list.scss

@@ -0,0 +1,3 @@
+page-budget-list {
+
+}

+ 16 - 0
src/pages/budget-list/budget-list.ts

@@ -0,0 +1,16 @@
+import { Component } from '@angular/core';
+import { NavController } from 'ionic-angular';
+
+@Component({
+    selector: 'page-budget-list',
+    templateUrl: 'budget-list.html'
+})
+export class BudgetListPage {
+
+  constructor(public navCtrl: NavController) {}
+
+  ionViewDidLoad() {
+    console.log('Hello BudgetListPage Page');
+  }
+
+}

+ 2 - 0
src/pages/product-details/product-details.ts

@@ -6,6 +6,8 @@ import { ProductListPage } from '../product-list/product-list';
 import { DataProvider } from '../../providers/data-provider'
 import { CameraProvider } from '../../providers/camera-provider';
 import { PreferencesProvider } from '../../providers/preferences-provider';
+// import 'reflect-metadata';
+
 
 @Component({
     selector: 'page-product-details',

+ 70 - 0
src/providers/base-sync-provider.ts

@@ -0,0 +1,70 @@
+import { Observable } from 'rxjs/Observable';
+import { OdooProvider } from './odoo-provider';
+import { DataProvider } from './data-provider';
+import 'rxjs/add/observable/concat';
+
+export abstract class BaseSyncProvider<T> {
+
+    constructor(
+        public data: DataProvider,
+        public odoo: OdooProvider
+    ) { }
+    
+    /**
+     *
+     */
+    doSync(): Observable<T> {
+        // return Observable.concat(this.toCreate(), this.toUpdate(), this.toDelete(), this.toSave());
+        return Observable.concat(this.toCreate());
+    }
+
+    /**
+     *
+     */
+    toCreate(): Observable<T> {
+        return new Observable(observer => { 
+            
+        });
+    }
+
+    /**
+     *
+     */
+    toUpdate(): Observable<T> {
+        return new Observable(observer => { 
+
+        });
+    }
+
+    /**
+     *
+     */
+    toDelete(): Observable<T> {
+        return new Observable(observer => {
+
+        });
+    }
+
+    /**
+     *
+     */
+    toSave(): Observable<T> {
+        return new Observable(observer => { 
+
+        });
+    }
+
+    /**
+     *
+     */
+    private getDocumentType(): string {
+        return Reflect.getMetadata("document", this);
+    }
+    
+    /**
+     *
+     */
+    private getRestEntrypoint(): string {
+        return Reflect.getMetadata("entrypoint", this);
+    }
+}

+ 1 - 0
src/providers/data-provider.ts

@@ -12,6 +12,7 @@ PouchDB.plugin(PouchRelational).plugin(PouchUpsert).plugin(PouchSqlite);
 export class DataProvider {
 
     public static readonly DOCS = {
+        PARTNER: 'partner',
         PRODUCT_TEMPLATE: 'product.template',
         PRODUCT_ATTRIBUTE: 'product.attribute',
         PRODUCT_ATTRIBUTE_LINE: 'product.attribute.line',

+ 126 - 0
src/providers/sync/partner-sync.provider.ts

@@ -0,0 +1,126 @@
+import { Injectable } from '@angular/core';
+import { DataProvider } from '../data-provider';
+import { OdooProvider } from '../odoo-provider';
+
+@Injectable()
+export class PartnerSyncProvider {
+
+    constructor(
+        public dataProvider: DataProvider,
+        public odooProvider: OdooProvider
+    ) { }
+
+    /**
+     *
+     */
+    doSync(): Promise<any> {
+        return new Promise((resolve, reject) => {
+            return new Promise((resolve, reject) => {
+                this.getCreatedPartners().then(partners => {
+                return partners;
+            }).then(partners => {
+                return this.odooProvider.post("partner", partners);
+            }).then(() => {
+                console.log('partners: new partners sended');    
+                return this.getUpdatedPartners();
+            }).then(partners => {
+                return this.odooProvider.put("partner", partners);
+            }).then(response => {
+                console.log('partner: modified partners sended');   
+                return this.getDeletedPartners();
+            }).then(partners => {
+                return this.odooProvider.delete("partner", partners);
+            }).then(() => {
+                console.log('partner: deleted partners sended');
+                return this.odooProvider.get("partner");
+            }).then(partners => {
+                return this.storePartners(partners);
+            }).then(() => {
+                console.log('partner: partners downloaded');
+                resolve(true);    
+            }).catch(e => { 
+                reject(e);
+            });
+        });
+        });
+    }
+
+    /**
+     *
+     */
+    private getCreatedPartners(): Promise<any> {
+        return new Promise((resolve, reject) => {
+            this.dataProvider.getAll(DataProvider.DOCS.PARTNER).then(partners => {
+                resolve(partners.filter(item => {
+                    return item.doc_state === "created" || (item.doc_state === "updated" && !item.remote_id);
+                }));
+            }).catch(e => {
+                reject(e);
+            });
+        });
+    }
+
+    /**
+     *
+     */
+    private getUpdatedPartners(): Promise<any> {
+        return new Promise((resolve, reject) => {
+            this.dataProvider.getAll(DataProvider.DOCS.PARTNER).then(partners => {
+            
+                resolve(partners.filter(item => {
+                    return item.doc_state === "updated" && item.remote_id;
+                }).map(item => {
+                    delete item.id;
+                    return item;
+                }));
+                
+            }).catch(e => {
+                reject(e);
+            });
+        });
+    }
+
+    /**
+     *
+     */
+    private getDeletedPartners(): Promise<any> {
+        return new Promise((resolve, reject) => { 
+            this.dataProvider.getAll(DataProvider.DOCS.PARTNER).then(partners => {
+            
+                resolve(partners.filter(item => { 
+                    return item.doc_state === "deleted";
+                }).map(item => {
+                    delete item.id;
+                    return item;
+                }));
+                
+            }).catch(e => { 
+                reject(e);
+            });
+        });
+    }
+
+    /**
+     *
+     */
+    private storePartners(partners: Array<any>): Promise<any> {
+        return new Promise((resolve, reject) => {
+            this.dataProvider.deleteAll(DataProvider.DOCS.PRODUCT_TEMPLATE).then(() => {
+                return;
+            }).then(() => {
+                return this.dataProvider.save(DataProvider.DOCS.PRODUCT_TEMPLATE, partners.map(item => {
+                    item.remote_id = item.id;
+                    item.doc_state = "sync";
+                    delete item.id;
+
+                    return item;
+                }));
+            }).then(() => { 
+                resolve();
+            }).catch(e => { 
+                reject(e);    
+            });
+        });
+    }
+
+}

+ 0 - 0
src/providers/sync/sale-line-sync-provider.ts


+ 0 - 0
src/providers/sync/sale-sync-provider.ts


+ 1 - 1
tslint.json

@@ -2,7 +2,7 @@
     "rules": {
         "no-duplicate-variable": true,
         "no-unused-variable": [
-            true
+            false
         ]
     },
     "rulesDirectory": [

+ 477 - 0
typings/globals/reflect-metadata/index.d.ts

@@ -0,0 +1,477 @@
+// Generated by typings
+// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/9cfb866c9f912174c8c6d15a2dc24399cfd71f37/reflect-metadata/reflect-metadata.d.ts
+declare module "reflect-metadata" {
+    // The "reflect-metadata" module has no imports or exports, but can be used by modules to load the polyfill.
+}
+
+declare namespace Reflect {
+    /**
+      * Applies a set of decorators to a target object.
+      * @param decorators An array of decorators.
+      * @param target The target object.
+      * @returns The result of applying the provided decorators.
+      * @remarks Decorators are applied in reverse order of their positions in the array.
+      * @example
+      *
+      *     class C { }
+      *
+      *     // constructor
+      *     C = Reflect.decorate(decoratorsArray, C);
+      *
+      */
+    function decorate(decorators: ClassDecorator[], target: Function): Function;
+    /**
+      * Applies a set of decorators to a property of a target object.
+      * @param decorators An array of decorators.
+      * @param target The target object.
+      * @param targetKey The property key to decorate.
+      * @param descriptor A property descriptor
+      * @remarks Decorators are applied in reverse order.
+      * @example
+      *
+      *     class C {
+      *         // property declarations are not part of ES6, though they are valid in TypeScript:
+      *         // static staticProperty;
+      *         // property;
+      *
+      *         static staticMethod() { }
+      *         method() { }
+      *     }
+      *
+      *     // property (on constructor)
+      *     Reflect.decorate(decoratorsArray, C, "staticProperty");
+      *
+      *     // property (on prototype)
+      *     Reflect.decorate(decoratorsArray, C.prototype, "property");
+      *
+      *     // method (on constructor)
+      *     Object.defineProperty(C, "staticMethod",
+      *         Reflect.decorate(decoratorsArray, C, "staticMethod",
+      *             Object.getOwnPropertyDescriptor(C, "staticMethod")));
+      *
+      *     // method (on prototype)
+      *     Object.defineProperty(C.prototype, "method",
+      *         Reflect.decorate(decoratorsArray, C.prototype, "method",
+      *             Object.getOwnPropertyDescriptor(C.prototype, "method")));
+      *
+      */
+    function decorate(decorators: (PropertyDecorator | MethodDecorator)[], target: Object, targetKey: string | symbol, descriptor?: PropertyDescriptor): PropertyDescriptor;
+    /**
+      * A default metadata decorator factory that can be used on a class, class member, or parameter.
+      * @param metadataKey The key for the metadata entry.
+      * @param metadataValue The value for the metadata entry.
+      * @returns A decorator function.
+      * @remarks
+      * If `metadataKey` is already defined for the target and target key, the
+      * metadataValue for that key will be overwritten.
+      * @example
+      *
+      *     // constructor
+      *     @Reflect.metadata(key, value)
+      *     class C {
+      *     }
+      *
+      *     // property (on constructor, TypeScript only)
+      *     class C {
+      *         @Reflect.metadata(key, value)
+      *         static staticProperty;
+      *     }
+      *
+      *     // property (on prototype, TypeScript only)
+      *     class C {
+      *         @Reflect.metadata(key, value)
+      *         property;
+      *     }
+      *
+      *     // method (on constructor)
+      *     class C {
+      *         @Reflect.metadata(key, value)
+      *         static staticMethod() { }
+      *     }
+      *
+      *     // method (on prototype)
+      *     class C {
+      *         @Reflect.metadata(key, value)
+      *         method() { }
+      *     }
+      *
+      */
+    function metadata(metadataKey: any, metadataValue: any): {
+        (target: Function): void;
+        (target: Object, propertyKey: string | symbol): void;
+    };
+    /**
+      * Define a unique metadata entry on the target.
+      * @param metadataKey A key used to store and retrieve metadata.
+      * @param metadataValue A value that contains attached metadata.
+      * @param target The target object on which to define metadata.
+      * @example
+      *
+      *     class C {
+      *     }
+      *
+      *     // constructor
+      *     Reflect.defineMetadata("custom:annotation", options, C);
+      *
+      *     // decorator factory as metadata-producing annotation.
+      *     function MyAnnotation(options): ClassDecorator {
+      *         return target => Reflect.defineMetadata("custom:annotation", options, target);
+      *     }
+      *
+      */
+    function defineMetadata(metadataKey: any, metadataValue: any, target: Object): void;
+    /**
+      * Define a unique metadata entry on the target.
+      * @param metadataKey A key used to store and retrieve metadata.
+      * @param metadataValue A value that contains attached metadata.
+      * @param target The target object on which to define metadata.
+      * @param targetKey The property key for the target.
+      * @example
+      *
+      *     class C {
+      *         // property declarations are not part of ES6, though they are valid in TypeScript:
+      *         // static staticProperty;
+      *         // property;
+      *
+      *         static staticMethod(p) { }
+      *         method(p) { }
+      *     }
+      *
+      *     // property (on constructor)
+      *     Reflect.defineMetadata("custom:annotation", Number, C, "staticProperty");
+      *
+      *     // property (on prototype)
+      *     Reflect.defineMetadata("custom:annotation", Number, C.prototype, "property");
+      *
+      *     // method (on constructor)
+      *     Reflect.defineMetadata("custom:annotation", Number, C, "staticMethod");
+      *
+      *     // method (on prototype)
+      *     Reflect.defineMetadata("custom:annotation", Number, C.prototype, "method");
+      *
+      *     // decorator factory as metadata-producing annotation.
+      *     function MyAnnotation(options): PropertyDecorator {
+      *         return (target, key) => Reflect.defineMetadata("custom:annotation", options, target, key);
+      *     }
+      *
+      */
+    function defineMetadata(metadataKey: any, metadataValue: any, target: Object, targetKey: string | symbol): void;
+    /**
+      * Gets a value indicating whether the target object or its prototype chain has the provided metadata key defined.
+      * @param metadataKey A key used to store and retrieve metadata.
+      * @param target The target object on which the metadata is defined.
+      * @returns `true` if the metadata key was defined on the target object or its prototype chain; otherwise, `false`.
+      * @example
+      *
+      *     class C {
+      *     }
+      *
+      *     // constructor
+      *     result = Reflect.hasMetadata("custom:annotation", C);
+      *
+      */
+    function hasMetadata(metadataKey: any, target: Object): boolean;
+    /**
+      * Gets a value indicating whether the target object or its prototype chain has the provided metadata key defined.
+      * @param metadataKey A key used to store and retrieve metadata.
+      * @param target The target object on which the metadata is defined.
+      * @param targetKey The property key for the target.
+      * @returns `true` if the metadata key was defined on the target object or its prototype chain; otherwise, `false`.
+      * @example
+      *
+      *     class C {
+      *         // property declarations are not part of ES6, though they are valid in TypeScript:
+      *         // static staticProperty;
+      *         // property;
+      *
+      *         static staticMethod(p) { }
+      *         method(p) { }
+      *     }
+      *
+      *     // property (on constructor)
+      *     result = Reflect.hasMetadata("custom:annotation", C, "staticProperty");
+      *
+      *     // property (on prototype)
+      *     result = Reflect.hasMetadata("custom:annotation", C.prototype, "property");
+      *
+      *     // method (on constructor)
+      *     result = Reflect.hasMetadata("custom:annotation", C, "staticMethod");
+      *
+      *     // method (on prototype)
+      *     result = Reflect.hasMetadata("custom:annotation", C.prototype, "method");
+      *
+      */
+    function hasMetadata(metadataKey: any, target: Object, targetKey: string | symbol): boolean;
+    /**
+      * Gets a value indicating whether the target object has the provided metadata key defined.
+      * @param metadataKey A key used to store and retrieve metadata.
+      * @param target The target object on which the metadata is defined.
+      * @returns `true` if the metadata key was defined on the target object; otherwise, `false`.
+      * @example
+      *
+      *     class C {
+      *     }
+      *
+      *     // constructor
+      *     result = Reflect.hasOwnMetadata("custom:annotation", C);
+      *
+      */
+    function hasOwnMetadata(metadataKey: any, target: Object): boolean;
+    /**
+      * Gets a value indicating whether the target object has the provided metadata key defined.
+      * @param metadataKey A key used to store and retrieve metadata.
+      * @param target The target object on which the metadata is defined.
+      * @param targetKey The property key for the target.
+      * @returns `true` if the metadata key was defined on the target object; otherwise, `false`.
+      * @example
+      *
+      *     class C {
+      *         // property declarations are not part of ES6, though they are valid in TypeScript:
+      *         // static staticProperty;
+      *         // property;
+      *
+      *         static staticMethod(p) { }
+      *         method(p) { }
+      *     }
+      *
+      *     // property (on constructor)
+      *     result = Reflect.hasOwnMetadata("custom:annotation", C, "staticProperty");
+      *
+      *     // property (on prototype)
+      *     result = Reflect.hasOwnMetadata("custom:annotation", C.prototype, "property");
+      *
+      *     // method (on constructor)
+      *     result = Reflect.hasOwnMetadata("custom:annotation", C, "staticMethod");
+      *
+      *     // method (on prototype)
+      *     result = Reflect.hasOwnMetadata("custom:annotation", C.prototype, "method");
+      *
+      */
+    function hasOwnMetadata(metadataKey: any, target: Object, targetKey: string | symbol): boolean;
+    /**
+      * Gets the metadata value for the provided metadata key on the target object or its prototype chain.
+      * @param metadataKey A key used to store and retrieve metadata.
+      * @param target The target object on which the metadata is defined.
+      * @returns The metadata value for the metadata key if found; otherwise, `undefined`.
+      * @example
+      *
+      *     class C {
+      *     }
+      *
+      *     // constructor
+      *     result = Reflect.getMetadata("custom:annotation", C);
+      *
+      */
+    function getMetadata(metadataKey: any, target: Object): any;
+    /**
+      * Gets the metadata value for the provided metadata key on the target object or its prototype chain.
+      * @param metadataKey A key used to store and retrieve metadata.
+      * @param target The target object on which the metadata is defined.
+      * @param targetKey The property key for the target.
+      * @returns The metadata value for the metadata key if found; otherwise, `undefined`.
+      * @example
+      *
+      *     class C {
+      *         // property declarations are not part of ES6, though they are valid in TypeScript:
+      *         // static staticProperty;
+      *         // property;
+      *
+      *         static staticMethod(p) { }
+      *         method(p) { }
+      *     }
+      *
+      *     // property (on constructor)
+      *     result = Reflect.getMetadata("custom:annotation", C, "staticProperty");
+      *
+      *     // property (on prototype)
+      *     result = Reflect.getMetadata("custom:annotation", C.prototype, "property");
+      *
+      *     // method (on constructor)
+      *     result = Reflect.getMetadata("custom:annotation", C, "staticMethod");
+      *
+      *     // method (on prototype)
+      *     result = Reflect.getMetadata("custom:annotation", C.prototype, "method");
+      *
+      */
+    function getMetadata(metadataKey: any, target: Object, targetKey: string | symbol): any;
+    /**
+      * Gets the metadata value for the provided metadata key on the target object.
+      * @param metadataKey A key used to store and retrieve metadata.
+      * @param target The target object on which the metadata is defined.
+      * @returns The metadata value for the metadata key if found; otherwise, `undefined`.
+      * @example
+      *
+      *     class C {
+      *     }
+      *
+      *     // constructor
+      *     result = Reflect.getOwnMetadata("custom:annotation", C);
+      *
+      */
+    function getOwnMetadata(metadataKey: any, target: Object): any;
+    /**
+      * Gets the metadata value for the provided metadata key on the target object.
+      * @param metadataKey A key used to store and retrieve metadata.
+      * @param target The target object on which the metadata is defined.
+      * @param targetKey The property key for the target.
+      * @returns The metadata value for the metadata key if found; otherwise, `undefined`.
+      * @example
+      *
+      *     class C {
+      *         // property declarations are not part of ES6, though they are valid in TypeScript:
+      *         // static staticProperty;
+      *         // property;
+      *
+      *         static staticMethod(p) { }
+      *         method(p) { }
+      *     }
+      *
+      *     // property (on constructor)
+      *     result = Reflect.getOwnMetadata("custom:annotation", C, "staticProperty");
+      *
+      *     // property (on prototype)
+      *     result = Reflect.getOwnMetadata("custom:annotation", C.prototype, "property");
+      *
+      *     // method (on constructor)
+      *     result = Reflect.getOwnMetadata("custom:annotation", C, "staticMethod");
+      *
+      *     // method (on prototype)
+      *     result = Reflect.getOwnMetadata("custom:annotation", C.prototype, "method");
+      *
+      */
+    function getOwnMetadata(metadataKey: any, target: Object, targetKey: string | symbol): any;
+    /**
+      * Gets the metadata keys defined on the target object or its prototype chain.
+      * @param target The target object on which the metadata is defined.
+      * @returns An array of unique metadata keys.
+      * @example
+      *
+      *     class C {
+      *     }
+      *
+      *     // constructor
+      *     result = Reflect.getMetadataKeys(C);
+      *
+      */
+    function getMetadataKeys(target: Object): any[];
+    /**
+      * Gets the metadata keys defined on the target object or its prototype chain.
+      * @param target The target object on which the metadata is defined.
+      * @param targetKey The property key for the target.
+      * @returns An array of unique metadata keys.
+      * @example
+      *
+      *     class C {
+      *         // property declarations are not part of ES6, though they are valid in TypeScript:
+      *         // static staticProperty;
+      *         // property;
+      *
+      *         static staticMethod(p) { }
+      *         method(p) { }
+      *     }
+      *
+      *     // property (on constructor)
+      *     result = Reflect.getMetadataKeys(C, "staticProperty");
+      *
+      *     // property (on prototype)
+      *     result = Reflect.getMetadataKeys(C.prototype, "property");
+      *
+      *     // method (on constructor)
+      *     result = Reflect.getMetadataKeys(C, "staticMethod");
+      *
+      *     // method (on prototype)
+      *     result = Reflect.getMetadataKeys(C.prototype, "method");
+      *
+      */
+    function getMetadataKeys(target: Object, targetKey: string | symbol): any[];
+    /**
+      * Gets the unique metadata keys defined on the target object.
+      * @param target The target object on which the metadata is defined.
+      * @returns An array of unique metadata keys.
+      * @example
+      *
+      *     class C {
+      *     }
+      *
+      *     // constructor
+      *     result = Reflect.getOwnMetadataKeys(C);
+      *
+      */
+    function getOwnMetadataKeys(target: Object): any[];
+    /**
+      * Gets the unique metadata keys defined on the target object.
+      * @param target The target object on which the metadata is defined.
+      * @param targetKey The property key for the target.
+      * @returns An array of unique metadata keys.
+      * @example
+      *
+      *     class C {
+      *         // property declarations are not part of ES6, though they are valid in TypeScript:
+      *         // static staticProperty;
+      *         // property;
+      *
+      *         static staticMethod(p) { }
+      *         method(p) { }
+      *     }
+      *
+      *     // property (on constructor)
+      *     result = Reflect.getOwnMetadataKeys(C, "staticProperty");
+      *
+      *     // property (on prototype)
+      *     result = Reflect.getOwnMetadataKeys(C.prototype, "property");
+      *
+      *     // method (on constructor)
+      *     result = Reflect.getOwnMetadataKeys(C, "staticMethod");
+      *
+      *     // method (on prototype)
+      *     result = Reflect.getOwnMetadataKeys(C.prototype, "method");
+      *
+      */
+    function getOwnMetadataKeys(target: Object, targetKey: string | symbol): any[];
+    /**
+      * Deletes the metadata entry from the target object with the provided key.
+      * @param metadataKey A key used to store and retrieve metadata.
+      * @param target The target object on which the metadata is defined.
+      * @returns `true` if the metadata entry was found and deleted; otherwise, false.
+      * @example
+      *
+      *     class C {
+      *     }
+      *
+      *     // constructor
+      *     result = Reflect.deleteMetadata("custom:annotation", C);
+      *
+      */
+    function deleteMetadata(metadataKey: any, target: Object): boolean;
+    /**
+      * Deletes the metadata entry from the target object with the provided key.
+      * @param metadataKey A key used to store and retrieve metadata.
+      * @param target The target object on which the metadata is defined.
+      * @param targetKey The property key for the target.
+      * @returns `true` if the metadata entry was found and deleted; otherwise, false.
+      * @example
+      *
+      *     class C {
+      *         // property declarations are not part of ES6, though they are valid in TypeScript:
+      *         // static staticProperty;
+      *         // property;
+      *
+      *         static staticMethod(p) { }
+      *         method(p) { }
+      *     }
+      *
+      *     // property (on constructor)
+      *     result = Reflect.deleteMetadata("custom:annotation", C, "staticProperty");
+      *
+      *     // property (on prototype)
+      *     result = Reflect.deleteMetadata("custom:annotation", C.prototype, "property");
+      *
+      *     // method (on constructor)
+      *     result = Reflect.deleteMetadata("custom:annotation", C, "staticMethod");
+      *
+      *     // method (on prototype)
+      *     result = Reflect.deleteMetadata("custom:annotation", C.prototype, "method");
+      *
+      */
+    function deleteMetadata(metadataKey: any, target: Object, targetKey: string | symbol): boolean;
+}

+ 8 - 0
typings/globals/reflect-metadata/typings.json

@@ -0,0 +1,8 @@
+{
+  "resolution": "main",
+  "tree": {
+    "src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/9cfb866c9f912174c8c6d15a2dc24399cfd71f37/reflect-metadata/reflect-metadata.d.ts",
+    "raw": "registry:dt/reflect-metadata#0.0.0+20160630155503",
+    "typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/9cfb866c9f912174c8c6d15a2dc24399cfd71f37/reflect-metadata/reflect-metadata.d.ts"
+  }
+}

+ 1 - 0
typings/index.d.ts

@@ -1,3 +1,4 @@
 /// <reference path="globals/pouchdb-core/index.d.ts" />
 /// <reference path="globals/pouchdb/index.d.ts" />
+/// <reference path="globals/reflect-metadata/index.d.ts" />
 /// <reference path="modules/async/index.d.ts" />