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

@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

@oridune/epic-odm - npm Package Compare versions

Comparing version 1.1.8 to 1.1.9

2

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

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

@@ -56,49 +56,54 @@ "use strict";

let Stages = [];
Object.values(ModelOptions.relations).map((relation) => {
// Get Model Options
const RelationModelOptions = (0, model_1.getModelOptions)(relation.reference());
const FieldsListItem = fieldsList === null || fieldsList === void 0 ? void 0 : fieldsList[relation.name];
const FieldAttributes = fieldAttributes === null || fieldAttributes === void 0 ? void 0 : fieldAttributes[relation.name];
Stages = [
...Stages,
// Reference Stage
...(typeof FieldsListItem === "object"
? [
{
$lookup: {
from: RelationModelOptions.getResolvedName(),
localField: relation.name,
foreignField: "_id",
as: relation.name,
pipeline: CreateReferenceStages(relation.reference(), FieldsListItem, FieldAttributes || {}),
let SortingStage = fieldAttributes.sort
? [
{
$sort: (fieldAttributes.sort instanceof Array
? fieldAttributes.sort
: typeof fieldAttributes.sort === "string"
? [fieldAttributes.sort]
: []).reduce((fields, field) => (Object.assign(Object.assign({}, fields), { [field.replace(/^-/, "")]: /^-/.test(field) ? -1 : 1 })), {}),
},
]
: [];
const Relations = Object.values(ModelOptions.relations);
if (!Relations.length)
Stages = SortingStage;
else if (Relations.length)
Relations.map((relation) => {
// Get Model Options
const RelationModelOptions = (0, model_1.getModelOptions)(relation.reference());
const FieldsListItem = fieldsList === null || fieldsList === void 0 ? void 0 : fieldsList[relation.name];
const FieldAttributes = fieldAttributes === null || fieldAttributes === void 0 ? void 0 : fieldAttributes[relation.name];
Stages = [
...Stages,
// Reference Stage
...(typeof FieldsListItem === "object"
? [
{
$lookup: {
from: RelationModelOptions.getResolvedName(),
localField: relation.name,
foreignField: "_id",
as: relation.name,
pipeline: CreateReferenceStages(relation.reference(), FieldsListItem, FieldAttributes || {}),
},
},
},
]
: []),
// Sorting Stage
...(fieldAttributes.sort
? [
{
$sort: (fieldAttributes.sort instanceof Array
? fieldAttributes.sort
: typeof fieldAttributes.sort === "string"
? [fieldAttributes.sort]
: []).reduce((fields, field) => (Object.assign(Object.assign({}, fields), { [field.replace(/^-/, "")]: /^-/.test(field) ? -1 : 1 })), {}),
},
]
: []),
// Unwind Stage
...(typeof FieldsListItem === "object" &&
["OneToOne", "ManyToOne"].includes(relation.type)
? [
{
$unwind: {
path: `$${relation.name}`,
preserveNullAndEmptyArrays: true,
]
: []),
// Sorting Stage
...SortingStage,
// Unwind Stage
...(typeof FieldsListItem === "object" &&
["OneToOne", "ManyToOne"].includes(relation.type)
? [
{
$unwind: {
path: `$${relation.name}`,
preserveNullAndEmptyArrays: true,
},
},
},
]
: []),
];
});
]
: []),
];
});
return Stages;

@@ -105,0 +110,0 @@ };

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