
Research
/Security News
9 Malicious NuGet Packages Deliver Time-Delayed Destructive Payloads
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.
swint-query
Advanced tools
MySQL query generator for Swint
Warning: This is not the final draft yet, so do not use this until its official version is launched
$ npm install --save swint-query
var manager = swintQuery.Manager({
dir: path.join(__dirname, 'models'),
mysql: {
host: 'myhost.example.com',
database: 'mydb',
user: 'username',
password: 'mypasswd'
}
}, function(err) {
print(manager.models); // Models fetched from DB server
done();
});
var defs = {
name: 'foo',
engine: 'MySQL',
table: 'foos'
},
schema = [
{
field: 'bars',
type: 'RelN:M',
related: 'bar',
joinTable: 'foos_bars',
myKey: 'foo_id',
relKey: 'bar_id'
},
{
field: 'bazs',
type: 'Rel1:N',
related: 'baz',
joinTable: 'bazs',
myKey: 'foo_id'
},
{
field: 'qux',
type: 'RelN:1',
related: 'qux',
relKey: 'qux_id'
}
];
module.exports = function(manager) {
defs.db = manager.mySqlConn;
return swintQuery.Structure(manager, defs, schema);
};
Methods
.query(query, callback)
query: String, the query to be executedcallback: Function.query(preparedQuery, params, callback)
preparedQuery: String, the query to be executedparams: Arraycallback: Function.save(data, callback)
id, or update data if it has.data: Object or Array, If array, it must be the array of objects to be savedcallback: Function.fetch(condition, option, callback)
condition: Object, the key is the name of fieldoption: Object
target: Array, the list of fields to be fetched, can be * or joinedModel.*.join: Array, the list of the names of models to be joinedorder: String or Array, the name of the field to be sorted, can be Array.orderFlag: Boolean or Array, the sorting orderlimit: Number, the number of rows to fetch.queryPromise(query)
query: String, the query to be executed.queryPromise(preparedQuery, params)
preparedQuery: String, the query to be executedparams: Array.savePromise(data)
id, or update data if it has.data: Object or Array, If array, it must be the array of objects to be saved.fetchPromise(condition, option)
condition: Object, the key is the name of fieldoption: Object
target: Array, the list of fields to be fetched, can be * or joinedModel.*.join: Array, the list of the names of models to be joinedorder: String or Array, the name of the field to be sorted, can be Array.orderFlag: Boolean or Array, the sorting orderlimit: Number, the number of rows to fetchUsage
models.foo.fetch({
myColumn: operator.ne('foo')
}, {
target: ['*', 'bar.*'],
join: ['bar'],
order: 'myColumn',
orderFlag: true,
limit: 42
}, function(err, res) {
// ...
});
eq: Equal, { fieldName: eq(42) }ne: Not equal, { fieldName: ne(42) }gt: Greater than, { fieldName: gt(42) }gte: Greater than or equal, { fieldName: gte(42) }lt: Less than, { fieldName: lt(42) }lte: Less than or equal, { fieldName: lte(42) }btn: Between, { fieldName: btn(42, 84) }nbtn: Not between, { fieldName: nbtn(42, 84) }isNull: Is null, { fieldName: isNull() }notNull: Not null, { fieldName: notNull() }FAQs
SQL query generator for Swint
The npm package swint-query receives a total of 18 weekly downloads. As such, swint-query popularity was classified as not popular.
We found that swint-query demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.