Comparing version 1.1.1 to 1.1.2
import { ICollection, IMonkManager } from "monk"; | ||
import { ObjectId } from "bson"; | ||
import { ObjectID } from "bson"; | ||
import { CommonOptions, FilterQuery, FindOneAndUpdateOption, FindOneOptions, MongoCountPreferences, UpdateOneOptions, UpdateQuery } from "mongodb"; | ||
export declare type Document = { | ||
_id: ObjectId; | ||
_id: ObjectID; | ||
[key: string]: any; | ||
@@ -30,5 +30,5 @@ }; | ||
}; | ||
export { ObjectId }; | ||
export declare function id(str: null): null; | ||
export declare function id(str: string): ObjectId; | ||
export { ObjectID }; | ||
export declare function idify(str?: null): null; | ||
export declare function idify(str: string): ObjectID; | ||
export declare class Manager { | ||
@@ -45,7 +45,7 @@ manager: IMonkManager; | ||
exists(filter: FilterQuery<TSchema>): Promise<boolean>; | ||
existsById(id: string | ObjectId): Promise<boolean>; | ||
existsById(id: string | ObjectID): Promise<boolean>; | ||
insert(document: OptionalId<TSchema>): Promise<TSchema>; | ||
find(filter: FilterQuery<TSchema>, options?: FindOneOptions | string): Promise<TSchema[]>; | ||
findOne(filter: FilterQuery<TSchema>, options?: FindOneOptions | string): Promise<TSchema | null>; | ||
findById(id: string | ObjectId, options?: FindOneOptions | string): Promise<TSchema | null>; | ||
findById(id: string | ObjectID, options?: FindOneOptions | string): Promise<TSchema | null>; | ||
findLastOne(filter: FilterQuery<TSchema>): Promise<TSchema | null>; | ||
@@ -58,3 +58,3 @@ findAndMap<Key extends string>(filter: FilterQuery<TSchema>, key: Key): Promise<TSchema[Key][]>; | ||
findOneAndUpdate(filter: FilterQuery<TSchema>, update: UpdateQuery<TSchema> | TSchema, options?: FindOneAndUpdateOption | string): Promise<TSchema | null>; | ||
findByIdAndSet(id: string | ObjectId, $set: UpdateQuery<TSchema>["$set"], options?: FindOneAndUpdateOption | string): Promise<TSchema | null>; | ||
findByIdAndSet(id: string | ObjectID, $set: UpdateQuery<TSchema>["$set"], options?: FindOneAndUpdateOption | string): Promise<TSchema | null>; | ||
remove(filter: FilterQuery<TSchema>, options?: CommonOptions & { | ||
@@ -64,5 +64,5 @@ multi?: boolean; | ||
findOneAndDelete(filter: FilterQuery<TSchema>, options?: FindOneOptions | string): Promise<TSchema | null>; | ||
findByIdAndDelete(id: string | ObjectId, options?: FindOneOptions | string): Promise<TSchema | null>; | ||
findByIdAndDelete(id: string | ObjectID, options?: FindOneOptions | string): Promise<TSchema | null>; | ||
} | ||
declare const _default: (uri: string) => Manager; | ||
export default _default; |
@@ -59,9 +59,9 @@ "use strict"; | ||
var bson_1 = require("bson"); | ||
exports.ObjectId = bson_1.ObjectId; | ||
function id(str) { | ||
return str && bson_1.ObjectId.isValid(str) | ||
? bson_1.ObjectId.createFromHexString(str) | ||
exports.ObjectID = bson_1.ObjectID; | ||
function idify(str) { | ||
return str && bson_1.ObjectID.isValid(str) | ||
? bson_1.ObjectID.createFromHexString(str) | ||
: null; | ||
} | ||
exports.id = id; | ||
exports.idify = idify; | ||
var Manager = /** @class */ (function () { | ||
@@ -68,0 +68,0 @@ function Manager(uri) { |
{ | ||
"name": "minimonk", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "A tiny wrapper around monk", | ||
@@ -5,0 +5,0 @@ "main": "lib/minimonk.js", |
import monk, { ICollection, IMonkManager } from "monk"; | ||
import { ObjectId } from "bson"; | ||
import { ObjectID } from "bson"; | ||
import { | ||
@@ -14,3 +14,3 @@ CommonOptions, | ||
export type Document = { | ||
_id: ObjectId; | ||
_id: ObjectID; | ||
[key: string]: any; | ||
@@ -46,11 +46,11 @@ }; | ||
export { ObjectId }; | ||
export { ObjectID }; | ||
export function id(str: null): null; | ||
export function idify(str?: null): null; | ||
export function id(str: string): ObjectId; | ||
export function idify(str: string): ObjectID; | ||
export function id(str: string | null): ObjectId | null { | ||
return str && ObjectId.isValid(str) | ||
? ObjectId.createFromHexString(str) | ||
export function idify(str?: string | null): ObjectID | null { | ||
return str && ObjectID.isValid(str) | ||
? ObjectID.createFromHexString(str) | ||
: null; | ||
@@ -93,3 +93,3 @@ } | ||
existsById(id: string | ObjectId): Promise<boolean> { | ||
existsById(id: string | ObjectID): Promise<boolean> { | ||
return this.collection | ||
@@ -119,3 +119,3 @@ .count({ _id: id }, { limit: 1 }) | ||
findById( | ||
id: string | ObjectId, | ||
id: string | ObjectID, | ||
options?: FindOneOptions | string | ||
@@ -186,3 +186,3 @@ ): Promise<TSchema | null> { | ||
findByIdAndSet( | ||
id: string | ObjectId, | ||
id: string | ObjectID, | ||
$set: UpdateQuery<TSchema>["$set"], | ||
@@ -213,3 +213,3 @@ options?: FindOneAndUpdateOption | string | ||
findByIdAndDelete( | ||
id: string | ObjectId, | ||
id: string | ObjectID, | ||
options?: FindOneOptions | string | ||
@@ -216,0 +216,0 @@ ): Promise<TSchema | null> { |
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
17514