Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

typemongoose

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typemongoose - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

lib/BaseRepo.d.ts

3

lib/index.d.ts
import * as BaseModel from "./BaseModel";
import * as BasicRepo from "./BasicRepo";
import * as Decorators from "./Decorators";
import * as ModelRepo from "./ModelRepo";
export { BaseModel, Decorators, ModelRepo };
export { BaseModel, BasicRepo, Decorators, ModelRepo };

@@ -5,2 +5,4 @@ "use strict";

exports.BaseModel = BaseModel;
var BasicRepo = require("./BasicRepo");
exports.BasicRepo = BasicRepo;
var Decorators = require("./Decorators");

@@ -7,0 +9,0 @@ exports.Decorators = Decorators;

/// <reference types="mongoose" />
import * as mongoose from "mongoose";
declare abstract class ModelRepo<T extends mongoose.Document> {
mName: string;
query: mongoose.Model<T>;
constructor();
constructor(model: {
prototype: T;
name: string;
});
create(options: object): Promise<T>;
protected abstract getModelName(): string;
}
export default ModelRepo;

@@ -40,4 +40,5 @@ "use strict";

var ModelRepo = (function () {
function ModelRepo() {
this.query = mongoose.model(this.getModelName());
function ModelRepo(model) {
this.mName = model.name;
this.query = mongoose.model(this.mName);
}

@@ -44,0 +45,0 @@ ModelRepo.prototype.create = function (options) {

import BaseModel from "../../BaseModel";
import ModelRepo from "../../ModelRepo";
import BasicRepo from "../../BasicRepo";
import { User } from "./User";

@@ -11,6 +11,3 @@ export declare abstract class Book extends BaseModel {

}
export declare class RBook extends ModelRepo<Book> {
protected getModelName(): string;
}
declare const BookRepo: RBook;
export default BookRepo;
declare var _default: BasicRepo<Book>;
export default _default;

@@ -59,4 +59,4 @@ "use strict";

var BaseModel_1 = require("../../BaseModel");
var BasicRepo_1 = require("../../BasicRepo");
var Decorators_1 = require("../../Decorators");
var ModelRepo_1 = require("../../ModelRepo");
var Book = (function (_super) {

@@ -106,15 +106,3 @@ __extends(Book, _super);

exports.Book = Book;
var RBook = (function (_super) {
__extends(RBook, _super);
function RBook() {
return _super !== null && _super.apply(this, arguments) || this;
}
RBook.prototype.getModelName = function () {
return "Book";
};
return RBook;
}(ModelRepo_1.default));
exports.RBook = RBook;
var BookRepo = new RBook();
exports.default = BookRepo;
exports.default = new BasicRepo_1.default(Book);
//# sourceMappingURL=Book.js.map

@@ -12,5 +12,4 @@ import BaseModel from "../../BaseModel";

getAllObjects(): Promise<User[]>;
protected getModelName(): string;
}
declare const UserRepo: RUser;
export default UserRepo;
declare var _default: RUser;
export default _default;

@@ -124,10 +124,6 @@ "use strict";

};
RUser.prototype.getModelName = function () {
return "User";
};
return RUser;
}(ModelRepo_1.default));
exports.RUser = RUser;
var UserRepo = new RUser();
exports.default = UserRepo;
exports.default = new RUser(User);
//# sourceMappingURL=User.js.map
{
"name": "typemongoose",
"version": "1.1.0",
"version": "1.2.0",
"description": "Typescript ORM for mongoose",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -88,2 +88,8 @@ # typemongoose

- You can define hooks as explained above. Hooke type can be `HookTypes.pre` or `HookTypes.post` and hooks can be `Hooks.init`, `Hooks.remove`, `Hooks.save`, `Hooks.update` and `Hooks.validate`
- If you do not want to have new repo for the model, you can use ```BasicRepo``` as explained below
```
import { BasicRepo } from "typemongoose";
class Book extends ... {...};
const BookRepo = new BasicRepo(Book);
```

@@ -90,0 +96,0 @@ Here you have two type of objects

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc