Comparing version 1.4.10 to 1.4.12
{ | ||
"name": "mongot", | ||
"version": "1.4.10", | ||
"version": "1.4.12", | ||
"description": "MongoT is a modern ODM library for MongoDb.", | ||
@@ -34,5 +34,5 @@ "main": "src/index.js", | ||
"dependencies": { | ||
"@types/mongodb": "^2.2.2", | ||
"@types/node": "^7.0.27", | ||
"mongodb": "^2.2.28" | ||
"@types/mongodb": "^2.2.9", | ||
"@types/node": "^7.0.39", | ||
"mongodb": "^2.2.31" | ||
}, | ||
@@ -43,5 +43,5 @@ "devDependencies": { | ||
"source-map-support": "^0.4.6", | ||
"tape": "^4.6.3", | ||
"typescript": "^2.3.4" | ||
"tape": "^4.8.0", | ||
"typescript": "^2.4.2" | ||
} | ||
} |
@@ -231,3 +231,3 @@ import * as MongoDb from 'mongodb'; | ||
dropTarget?: boolean; | ||
}): Promise<MongoDb.Collection>; | ||
}): Promise<MongoDb.Collection<any>>; | ||
/** | ||
@@ -241,3 +241,5 @@ * @TODO Update returns definitions. | ||
*/ | ||
replaceOne(filter: Object, doc: Object, options?: MongoDb.ReplaceOneOptions): Promise<MongoDb.UpdateWriteOpResult>; | ||
replaceOne(filter: Object, doc: Object, options?: MongoDb.ReplaceOneOptions): Promise<MongoDb.UpdateWriteOpResult & { | ||
ops: any[]; | ||
}>; | ||
/** | ||
@@ -244,0 +246,0 @@ * @TODO |
import * as MongoDb from 'mongodb'; | ||
export declare class Connection { | ||
readonly db: MongoDb.Db; | ||
private constructor(db); | ||
private constructor(); | ||
create(name: string, options?: MongoDb.CollectionCreateOptions): Promise<MongoDb.Collection>; | ||
@@ -6,0 +6,0 @@ get(name: string, options?: MongoDb.DbCollectionOptions): Promise<MongoDb.Collection>; |
/// <reference types="node" /> | ||
import * as MongoDb from 'mongodb'; | ||
import { EventEmitter } from "events"; | ||
export interface Cursor<T extends Object> extends EventEmitter { | ||
export interface Cursor<T> extends EventEmitter { | ||
on(event: 'data', listener: (document: T) => void): this; | ||
} | ||
export declare class Cursor<T extends Object> extends EventEmitter { | ||
export interface CastFunction { | ||
<TDoc>(document: Object): TDoc; | ||
} | ||
export declare class Cursor<T> extends EventEmitter { | ||
readonly cursor: MongoDb.Cursor<T>; | ||
@@ -14,3 +17,3 @@ private cast; | ||
*/ | ||
constructor(cursor: MongoDb.Cursor<T>, transform?: <TNewDocument>(document: Object) => TNewDocument); | ||
constructor(cursor: MongoDb.Cursor<T>, transform?: CastFunction); | ||
/** | ||
@@ -32,5 +35,5 @@ * @returns {Cursor<T>} | ||
* @param fields | ||
* @returns {Cursor<T>} | ||
* @returns {Cursor<PT>} | ||
*/ | ||
project(fields: Object | string): this; | ||
project<PT>(fields: Object | string): this; | ||
/** | ||
@@ -37,0 +40,0 @@ * @param value |
@@ -20,3 +20,2 @@ "use strict"; | ||
super(); | ||
this.cast = (document) => document; | ||
if (typeof transform === 'function') { | ||
@@ -53,7 +52,7 @@ this.cast = transform; | ||
* @param fields | ||
* @returns {Cursor<T>} | ||
* @returns {Cursor<PT>} | ||
*/ | ||
project(fields) { | ||
const oldCast = this.cast; | ||
this.cast = row => { | ||
this.cast = (row) => { | ||
const formalized = oldCast(row); | ||
@@ -60,0 +59,0 @@ return document_1.PartialDocumentFragment.factory(Object.assign({}, ...Object.keys(formalized) |
@@ -214,5 +214,5 @@ "use strict"; | ||
if (!Object.getOwnPropertyDescriptor(this, key)) { | ||
// @TODO Add strict checking for skipped properties | ||
// @TODO Add checks for virtual properties and some meta | ||
// throw new Error(`Schema ${this.constructor.name} unknown property: ${key}`); | ||
console.error(`Schema ${this.constructor.name} has unknown property: ${key}`); | ||
// console.error(`Schema ${this.constructor.name} has unknown property: ${key}`); | ||
return; | ||
@@ -219,0 +219,0 @@ } |
import "./reflect"; | ||
import * as MongoDb from 'mongodb'; | ||
import { Collection } from "./collection"; | ||
import { SchemaMetadata } from "./document"; | ||
export interface CollectionDecorator { | ||
(name: string, schema: typeof SchemaMetadata, options?: MongoDb.CollectionCreateOptions | MongoDb.CollectionOptions): (constructor: typeof Collection) => void; | ||
(name: string, schema: typeof SchemaMetadata, options?: MongoDb.CollectionCreateOptions | MongoDb.CollectionOptions): (constructor: any) => void; | ||
} | ||
@@ -12,7 +11,7 @@ export declare type indexSpecType = string | { | ||
export interface IndexDecorator { | ||
(indexOrSpec: indexSpecType, options?: MongoDb.IndexOptions): (constructor: typeof Collection) => void; | ||
(indexOrSpec: indexSpecType, options?: MongoDb.IndexOptions): (constructor: any) => void; | ||
} | ||
export declare const collection: CollectionDecorator; | ||
export declare const index: IndexDecorator; | ||
export declare const indexes: (...specs: ([indexSpecType, MongoDb.IndexOptions] | [indexSpecType])[]) => (target: typeof Collection) => void; | ||
export declare const indexes: (...specs: ([indexSpecType, MongoDb.IndexOptions] | [indexSpecType])[]) => (target: any) => void; | ||
export declare const document: (target: any) => any; | ||
@@ -19,0 +18,0 @@ export declare const fragment: (target: any) => any; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1941
136172
Updated@types/mongodb@^2.2.9
Updated@types/node@^7.0.39
Updatedmongodb@^2.2.31