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

djorm

Package Overview
Dependencies
Maintainers
1
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

djorm - npm Package Compare versions

Comparing version 0.1.10-alpha.0 to 0.1.10-alpha.1

fields/__tests__/ForeignKey.js

1

db/__tests__/Database.js

@@ -6,2 +6,3 @@ const { Database } = require('../Database')

connectDb = jest.fn()
disconnectDb = jest.fn()
queryDb = jest.fn()

@@ -8,0 +9,0 @@ execDb = jest.fn()

15

fields/ForeignKey.js

@@ -55,10 +55,13 @@ const camelCase = require('camelcase')

parsed = Model.from(parsed)
} else {
throw new ValueError(
`Value must be instance of "${getModelName(
Model
)}" or null, but "${parsed}" was given`
)
}
throw new ValueError(
`Value must be instance of "${getModelName(
Model
)}" or null, but "${parsed}" was given`
)
}
inst[this.keyField] = parsed.pk
if (parsed) {
inst.set(this.keyField, parsed.pk)
}
return parsed

@@ -65,0 +68,0 @@ }

@@ -210,2 +210,10 @@ const { DatabaseModelBase } = require('./DatabaseModelBase')

}
static toString () {
return getModelName(this)
}
toString () {
return `${this.constructor}#${this.pk || JSON.stringify(this.toJson())}`
}
}

@@ -212,0 +220,0 @@

@@ -7,4 +7,15 @@ const { ModelError } = require('../errors')

const getModelName = model =>
model.meta && model.meta.modelName ? model.meta.modelName : model.name
const getModelName = model => {
const modelName =
(model.meta && model.meta.modelName) ||
(typeof model.name === 'string' && model.name)
if (!modelName) {
throw new ModelError(
`Following model has class name overriden: ${Object.getOwnPropertyNames(
model
)}. Perhaps you will need to define a Meta class with \`modelName\` in it.`
)
}
return modelName
}

@@ -11,0 +22,0 @@ const getModels = () => models

{
"name": "djorm",
"version": "0.1.10-alpha.0",
"version": "0.1.10-alpha.1",
"description": "Django like ORM framework",

@@ -39,3 +39,3 @@ "author": "Pavel Žák <pavel@zak.global>",

},
"gitHead": "e3bc0f06ea74de2c501e5349187ea7787acef321"
"gitHead": "ea20f264c199001c15b02b35f1129b42430f27c5"
}
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