You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

@oridune/epic-odm

Package Overview
Dependencies
Maintainers
2
Versions
81
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.23 to 1.0.24

2

package.json
{
"name": "@oridune/epic-odm",
"version": "1.0.23",
"version": "1.0.24",
"description": "Install 1 ODM and code once with any database driver.",

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

@@ -100,3 +100,3 @@ "use strict";

.db(ModelOptions.database)
.collection(ModelOptions.name);
.collection(ModelOptions.getResolvedName());
// Create Main Indexes

@@ -123,3 +123,3 @@ await createIndexes(Collection, ModelOptions.indexes);

.db(ModelOptions.database)
.collection(ModelOptions.name)
.collection(ModelOptions.getResolvedName())
.insertMany(items, {

@@ -147,3 +147,3 @@ session: connection,

.db(ParentModelOptions.database)
.collection(ParentModelOptions.name)
.collection(ParentModelOptions.getResolvedName())
.updateOne({ _id: parent._id }, { $set: { [parent.field]: childs._ids[0] } }, { session: connection });

@@ -153,3 +153,3 @@ else if (["OneToMany", "ManyToMany"].includes(type))

.db(ParentModelOptions.database)
.collection(ParentModelOptions.name)
.collection(ParentModelOptions.getResolvedName())
.updateOne({ _id: parent._id }, { $addToSet: { [parent.field]: { $each: childs._ids } } }, { session: connection });

@@ -163,3 +163,3 @@ }

.db(ModelOptions.database)
.collection(ModelOptions.name);
.collection(ModelOptions.getResolvedName());
// Project Resolver Function

@@ -189,3 +189,3 @@ const normalizeProject = (project) => {

$lookup: {
from: RelationModelOptions.name,
from: RelationModelOptions.getResolvedName(),
localField: relation.name,

@@ -275,3 +275,3 @@ foreignField: "_id",

.db(ModelOptions.database)
.collection(ModelOptions.name)
.collection(ModelOptions.getResolvedName())
.updateMany({ _id: { $in: targets.map((_) => _._id) } }, { $set: merge ? utils_1.Utils.transposeObjectToDotNotation(data) : data }, { session: connection });

@@ -286,3 +286,3 @@ return { updatedCount: Results.modifiedCount };

.db(ModelOptions.database)
.collection(ModelOptions.name)
.collection(ModelOptions.getResolvedName())
.deleteMany({ _id: { $in: targets.map((_) => _._id) } }, { session: connection });

@@ -289,0 +289,0 @@ return { deletedCount: Results.deletedCount };

@@ -23,4 +23,7 @@ import { BaseModel } from "../model/base";

}
export declare type CurrentModelOptions<M extends BaseModel = BaseModel> = ModelOptions<M> & {
getResolvedName: () => string;
};
export declare const Model: <T extends BaseModel>(options?: Partial<ModelOptions<T>> | undefined) => (constructor: new (...args: any[]) => T) => void;
export declare const setModelOptions: <T extends BaseModel>(model: new () => BaseModel, options: Partial<ModelOptions<T>> | ((options: ModelOptions<T>) => Partial<ModelOptions<T>>)) => void;
export declare const getModelOptions: <T extends BaseModel>(model: typeof BaseModel | (new () => BaseModel)) => ModelOptions<T>;
export declare const setModelOptions: <T extends BaseModel>(model: new () => BaseModel, options: Partial<ModelOptions<T>> | ((options: CurrentModelOptions<T>) => Partial<ModelOptions<T>>)) => void;
export declare const getModelOptions: <T extends BaseModel>(model: typeof BaseModel | (new () => BaseModel)) => CurrentModelOptions<T>;

@@ -13,6 +13,7 @@ "use strict";

: options;
Reflect.defineMetadata(enums_1.MetaDataKeys.MODEL_OPTIONS, Object.assign(Object.assign(Object.assign({}, ((0, exports.getModelOptions)(model) || {})), Options), { name: (0, utils_1.Pluralize)((Options === null || Options === void 0 ? void 0 : Options.name) || model.name)
// Resolve Name
const Name = (Options === null || Options === void 0 ? void 0 : Options.name) || model.name;
Reflect.defineMetadata(enums_1.MetaDataKeys.MODEL_OPTIONS, Object.assign(Object.assign(Object.assign({}, ((0, exports.getModelOptions)(model) || {})), Options), { name: Name, indexes: (Options === null || Options === void 0 ? void 0 : Options.indexes) || {}, getResolvedName: () => (0, utils_1.Pluralize)(Name.replace(/Model$/, ""))
.replace(/[A-Z]/g, (a) => "-" + a.toLowerCase())
.replace(/^-/, "")
.replace(/-models?$/, ""), indexes: (Options === null || Options === void 0 ? void 0 : Options.indexes) || {} }), model);
.replace(/^-/, "") }), model);
};

@@ -19,0 +20,0 @@ exports.setModelOptions = setModelOptions;

@@ -37,3 +37,3 @@ "use strict";

name: Options.target ||
(0, model_1.getModelOptions)(modelInstance.constructor).name,
(0, model_1.getModelOptions)(modelInstance.constructor).getResolvedName(),
model: Model,

@@ -40,0 +40,0 @@ type: type === "OneToMany"

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc