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

@soinlabs/db

Package Overview
Dependencies
Maintainers
0
Versions
140
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@soinlabs/db - npm Package Compare versions

Comparing version 1.2.0-alpha.3 to 1.2.0-alpha.4

.dockerignore

18

lib/common/abstract/AbstractEntity.js

@@ -20,3 +20,3 @@ const AbstractEntityInstance = require('./AbstractEntityInstance')

const data = await this._model.create(values, newOptions)
return this._parseToModelInstance(data, newOptions)
return this.parseToModelInstance(data, newOptions)
}

@@ -27,3 +27,3 @@

const [data, created] = await this._model.upsert(values, newOptions)
return [this._parseToModelInstance(data, newOptions), created]
return [this.parseToModelInstance(data, newOptions), created]
}

@@ -34,3 +34,3 @@

const data = await this._model.bulkCreate(values, newOptions)
return data.map(d => this._parseToModelInstance(d, newOptions))
return data.map(d => this.parseToModelInstance(d, newOptions))
}

@@ -47,5 +47,5 @@

? data[1]
? this._parseToModelInstance(data[1], newOptions)
? this.parseToModelInstance(data[1], newOptions)
: null
: data[1].map(d => this._parseToModelInstance(d, newOptions))
: data[1].map(d => this.parseToModelInstance(d, newOptions))
)

@@ -65,3 +65,3 @@ }

const data = await this._model.findAll(newOptions)
return data.map(d => this._parseToModelInstance(d, newOptions))
return data.map(d => this.parseToModelInstance(d, newOptions))
}

@@ -74,3 +74,3 @@

...data,
rows: data.rows.map(d => this._parseToModelInstance(d, newOptions)),
rows: data.rows.map(d => this.parseToModelInstance(d, newOptions)),
}

@@ -107,3 +107,3 @@ }

const data = await this._model.findOne(newOptions)
return this._parseToModelInstance(data, newOptions)
return this.parseToModelInstance(data, newOptions)
}

@@ -133,3 +133,3 @@

_parseToModelInstance(model, options) {
parseToModelInstance(model, options) {
if (options && options.raw) {

@@ -136,0 +136,0 @@ return model

@@ -10,3 +10,3 @@ const AbstractEntity = require('../abstract/AbstractEntity')

_parseToModelInstance(model, options) {
parseToModelInstance(model, options) {
return model ? new MockEntityInstance(model, options) : model

@@ -13,0 +13,0 @@ }

@@ -13,2 +13,3 @@ /* eslint-disable global-require */

const MockEntity = require('../common/mock/MockEntity')
const SequelizeEntity = require('../sequelize/SequelizeEntity')

@@ -330,4 +331,19 @@ class DbOrm {

}
parseToModelInstance(entityName, values, options) {
const entity = this._entities[entityName]
if (!entity) {
throw new Error(`Entity ${entityName} not found`)
}
return entity.parseToModelInstance(
entity instanceof SequelizeEntity
? entity.getModel().build(values)
: values,
options
)
}
}
module.exports = DbOrm

@@ -11,3 +11,3 @@ const AbstractEntity = require('../common/abstract/AbstractEntity')

_parseToModelInstance(model, options) {
parseToModelInstance(model, options) {
if (options && options.raw) {

@@ -14,0 +14,0 @@ return model

@@ -126,3 +126,3 @@ const AbstractEntity = require('../common/abstract/AbstractEntity')

_parseToModelInstance(model, options) {
parseToModelInstance(model, options) {
if (options && options.raw) {

@@ -129,0 +129,0 @@ return model

@@ -727,3 +727,3 @@ const {

...options,
...(!options.include && { limit: 1 }), // TODO: Change this to buildQueryForFindOneDerivedTable
limit: 1,
fromFindOne: true,

@@ -730,0 +730,0 @@ })

@@ -140,3 +140,3 @@ const _ = require('lodash')

_parseToModelInstance(model, options) {
parseToModelInstance(model, options) {
if (options && options.raw) {

@@ -143,0 +143,0 @@ return model

{
"name": "@soinlabs/db",
"version": "1.2.0-alpha.3",
"version": "1.2.0-alpha.4",
"main": "index.js",

@@ -25,3 +25,3 @@ "repository": "",

"@soinlabs/hawk": "^1.0.0",
"@soinlabs/sybase": "^1.0.1",
"@soinlabs/sybase": "^1.0.2",
"compare-versions": "^6.1.0",

@@ -28,0 +28,0 @@ "inflection": "^3.0.0",

Sorry, the diff of this file is too big to display

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