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

think-model

Package Overview
Dependencies
Maintainers
9
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

think-model - npm Package Compare versions

Comparing version 1.2.1 to 1.2.2

mock/increment.js

2

lib/relation/has_many.js

@@ -42,3 +42,3 @@ function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }

case 'UPDATE':
yield model.getSchema();
yield model.db().getSchema();
const { pk } = model;

@@ -45,0 +45,0 @@

@@ -89,3 +89,6 @@ function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }

const promises = Object.keys(_this.relation).map(function (key) {
if (helper.isArray(_this.relationName) && _this.relationName.indexOf(key) === -1) return;
if (helper.isArray(_this.relationName) && _this.relationName.indexOf(key) === -1) {
return;
}
const instance = _this.getRelationInstance(key, data, type);

@@ -149,2 +152,3 @@ if (helper.isEmpty(instance)) return;

if (!type) {
// get relation data
const itemData = helper.isArray(data) ? data[0] : data;

@@ -155,2 +159,7 @@ const relData = itemData[opts.name];

}
} else {
// set relation data
if (type !== 'DELETE' && helper.isEmpty(data[opts.name])) {
return;
}
}

@@ -157,0 +166,0 @@

{
"name": "think-model",
"version": "1.2.1",
"version": "1.2.2",
"description": "An adapter-based ORM for ThinkJS 3.x",

@@ -35,4 +35,3 @@ "scripts": {

"think-helper": "^1.0.22",
"think-model-abstract": "^1.2.0",
"think-mysql": "^1.1.0"
"think-model-abstract": "^1.2.0"
},

@@ -39,0 +38,0 @@ "devDependencies": {

@@ -107,8 +107,8 @@ const {test} = require('ava');

},
getSchema() {
}
};
};
model.getSchema = function() {
};
model.where = function(where) {

@@ -115,0 +115,0 @@ t.deepEqual(where, {user_id: 3});

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