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

sequelize-temporal

Package Overview
Dependencies
Maintainers
2
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sequelize-temporal - npm Package Compare versions

Comparing version 1.0.8 to 2.0.0

.github/workflows/node.js.yml

7

index.d.ts

@@ -1,5 +0,6 @@

declare module 'sequelize-temporal' {
interface Options {
declare module 'sequelize-temporal' {
interface Options {
blocking?:boolean,
full?:boolean
full?:boolean,
skipIfSilent?:boolean
}

@@ -6,0 +7,0 @@

@@ -7,3 +7,4 @@ var _ = require('lodash');

blocking: true,
full: false
full: false,
skipIfSilent: false
};

@@ -69,4 +70,9 @@

var insertHook = function(obj, options){
if (options.silent && temporalOptions.skipIfSilent) {
return;
}
var dataValues = (!temporalOptions.full && obj._previousDataValues) || obj.dataValues;
var historyRecord = modelHistory.create(dataValues, {transaction: options.transaction});
if(temporalOptions.blocking){

@@ -78,2 +84,6 @@ return historyRecord;

if(!options.individualHooks){
if (options.silent && temporalOptions.skipIfSilent) {
return;
}
var queryAll = model.findAll({where: options.where, transaction: options.transaction}).then(function(hits){

@@ -85,2 +95,3 @@ if(hits){

});
if(temporalOptions.blocking){

@@ -87,0 +98,0 @@ return queryAll;

{
"name": "sequelize-temporal",
"version": "1.0.8",
"version": "2.0.0",
"description": "Temporal tables for Sequelize",

@@ -10,3 +10,3 @@ "main": "index.js",

"scripts": {
"test": "./node_modules/mocha/bin/mocha"
"test": "mocha"
},

@@ -27,2 +27,8 @@ "repository": {

"author": "greenify <greenify@notsharingmy.info> (https://github.com/greenify)",
"contributors": [
{
"name": "David DOLCIMASCOLO",
"url": "https://github.com/ddolcimascolo"
}
],
"license": "MIT",

@@ -33,12 +39,15 @@ "bugs": {

"homepage": "https://github.com/bonaval/sequelize-temporal#readme",
"engines": {
"node": ">= 18"
},
"dependencies": {
"lodash": "^4.17.15"
"lodash": "4.17.21"
},
"devDependencies": {
"chai": "^4.2.0",
"chai-as-promised": "^7.1.1",
"mocha": "^6.2.1",
"sequelize": "^5.19.5",
"sqlite3": "^4.1.0"
"chai": "4.4.1",
"chai-as-promised": "7.1.1",
"mocha": "10.3.0",
"sequelize": "6.37.1",
"sqlite3": "5.1.7"
}
}

@@ -13,15 +13,11 @@ var Temporal = require('../');

function freshDB(){
// overwrites the old SQLite DB
sequelize = new Sequelize('', '', '', {
dialect: 'sqlite',
storage: __dirname + '/.test.sqlite'
});
User = Temporal(sequelize.define('User', {
name: Sequelize.TEXT
}), sequelize);
UserHistory = sequelize.models.UserHistory;
return sequelize.sync({ force: true });
return freshDBWithOptions();
}
function freshDBWithFullModeAndParanoid() {
return freshDBWithOptions({ paranoid: true }, { full: true });
}
function freshDBWithOptions(modelOptions, temporalOptions){
// overwrites the old SQLite DB
sequelize = new Sequelize('', '', '', {

@@ -33,5 +29,4 @@ dialect: 'sqlite',

name: Sequelize.TEXT
}, { paranoid: true }), sequelize, { full: true });
}, modelOptions), sequelize, temporalOptions);
UserHistory = sequelize.models.UserHistory;
return sequelize.sync({ force: true });

@@ -337,2 +332,46 @@ }

describe('silent mode', function(){
it('onUpdate: should save to the historyDB if silent option is true but skipIfSilent is not set' , async function(){
await freshDB();
return User.create()
.then(assertCount(UserHistory,0))
.then(function(user){
user.name = "foo";
return user.save({ silent: true });
}).then(assertCount(UserHistory,1))
.then(function(user){
return user.destroy();
}).then(assertCount(UserHistory,2))
});
it('onUpdate: should not save to the historyDB if silent option is true and skipIfSilent is true' , async function(){
await freshDBWithOptions(undefined, { skipIfSilent: true });
return User.create()
.then(assertCount(UserHistory,0))
.then(function(user){
user.name = "foo";
return user.save({ silent: true });
}).then(assertCount(UserHistory,0))
.then(function(user){
return user.destroy();
}).then(assertCount(UserHistory,1))
});
it('bulkUpdate: should not save to the historyDB if silent is true and skipIfSilent is true' , async function(){
await freshDBWithOptions(undefined, { skipIfSilent: true });
return User.bulkCreate([
{name: "foo1"},
{name: "foo2"},
]).then(assertCount(UserHistory,0))
.then(function(){
return User.update({ name: 'updated-foo' }, { where: {}, silent: true });
}).then(assertCount(UserHistory,0))
});
});
});

Sorry, the diff of this file is not supported yet

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