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.5-alpha.16 to 0.1.6-alpha.0

init/apps.js

32

config.js
let currentConfig = {
databases: {}
name: 'djorm',
apps: [],
databases: {},
logger: {
level: 'info',
transport: null,
options: {}
}
}
const configure = config => {
currentConfig = config
currentConfig = { ...currentConfig, ...config }
}

@@ -14,13 +21,15 @@

const settings = currentConfig
if (settings.apps) {
require('./init/apps').init(settings)
}
require('./init/logger').init(settings)
if (settings.databases) {
const { Database } = require('./db/Database')
const { configDb } = require('./db/DatabasePool')
Object.entries(settings.databases).map(([dbName, dbConfig]) =>
configDb(Database.resolveDriver(dbConfig), dbName)
)
require('./init/databases').init(settings.databases)
}
}
const shutdown = async () => {}
const shutdown = async () => {
require('./init/apps').shutdown(currentConfig)
require('./init/logger').shutdown()
}

@@ -31,6 +40,3 @@ module.exports = {

shutdown,
getSettings: () => currentConfig,
get settings () {
return currentConfig
}
getSettings: () => currentConfig
}
const { DatabaseMapper } = require('./DatabaseMapper')
const { NotImplemented } = require('../errors')
const { PropModel } = require('./props')
const { debug, trace } = require('../logger')

@@ -26,4 +27,6 @@ class Database extends PropModel {

this.connecting = true
trace(`Connecting to ${this.props.driver} database`)
await this.connectDb()
this.connecting = false
debug(`Connected to ${this.props.driver} database`)
this.resolveQueue()

@@ -58,2 +61,3 @@ }

await this.waitForConnection()
debug(str)
return await this.queryDb(str)

@@ -64,2 +68,3 @@ }

await this.waitForConnection()
debug(str)
return await this.execDb(str)

@@ -66,0 +71,0 @@ }

@@ -137,3 +137,3 @@ const { FieldError } = require('../errors')

return this.constructor.fieldObjects
.filter(([key, field]) => field.db)
.filter(([key, field]) => !field.private)
.reduce(

@@ -171,2 +171,3 @@ (aggr, [key, field]) => ({

static default = new Field()
static private = new Field({ default: false })
static secret = new Field()

@@ -173,0 +174,0 @@ static validator = new Field()

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

async reload () {
const obj = await this.constructor.objects.get({
[this.constructor.pkName]: this.pk
})
const values = obj.serializeDbValues()
return this.setValues(values)
}
async delete () {

@@ -124,0 +132,0 @@ let obj = this.constructor

{
"name": "djorm",
"version": "0.1.5-alpha.16",
"version": "0.1.6-alpha.0",
"description": "Django like ORM framework",

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

"fields",
"init",
"models",

@@ -34,5 +35,6 @@ "*.js"

"camelcase": "^6.2.0",
"moment-timezone": "^0.5.33"
"moment-timezone": "^0.5.33",
"pino": "^6.11.3"
},
"gitHead": "ab57b5a8093139695d9cd8470d571ea3e7c961f3"
"gitHead": "208cedc10ee05f04e30ac1083a92bfe19a85e6f7"
}
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