
Security News
CISA Extends MITRE Contract as Crisis Accelerates Alternative CVE Coordination Efforts
CISA extended MITRE’s CVE contract by 11 months, avoiding a shutdown but leaving long-term governance and coordination issues unresolved.
objection-timestamp-edgeruntime
Advanced tools
Objectionjs plugin to update created_at and updated_at columns tweaked to peer dependency on an edge compat build
Automatically modify the created_at
and updated_at
columns on your models.
The basic setup assumes you have the columns created_at
and updated_at
in your table.
let Model = require('objection').Model;
let timestampPlugin = require('objection-timestamps').timestampPlugin;
class Post extends timestampPlugin()(Model) {
static get tableName() {
return 'user';
}
// allow timestamp plugin on this model
static get timestamp() {
return true;
}
}
Post
.query()
.insertAndFetch({
firstName: 'John',
lastName: 'Doe'
})
.then(john => {
console.log(john.created_at); // ISO-8601 Date format: YYYY-MM-DDTHH:mm:ss.sssZ
console.log(john.updated_at); // ISO-8601 Date format: YYYY-MM-DDTHH:mm:ss.sssZ
});
You can pass in an object to override the default settings
let Model = require('objection').Model;
let timestampPlugin = require('objection-timestamps').timestampPlugin;
let plugin = timestampPlugin({
createdAt: 'my_created_at', // change createdAt column name
updatedAt: 'my_updated_at', // change updatedAt column name
genDate: function() {
return 'my date format';
}
});
class Post extends plugin(Model) {
static get tableName() {
return 'user';
}
// allow timestamp plugin on this model
static get timestamp() {
return true;
}
}
Post
.query()
.insertAndFetch({
firstName: 'John',
lastName: 'Doe'
})
.then(john => {
console.log(john.my_created_at); // my date format
console.log(john.my_updated_at); // my date format
});
If you provide custom values plugin won't override them
let Model = require('objection').Model;
let timestampPlugin = require('objection-timestamps').timestampPlugin;
class Post extends timestampPlugin()(Model) {
static get tableName() {
return 'user';
}
// allow timestamp plugin on this model
static get timestamp() {
return true;
}
}
Post
.query()
.insertAndFetch({
firstName: 'John',
lastName: 'Doe',
created_at: 'Foobar',
updated_at: 'Foobiz'
})
.then(john => {
console.log(john.created_at); // Foobar
console.log(john.updated_at); // Foobiz
});
FAQs
Objectionjs plugin to update created_at and updated_at columns tweaked to peer dependency on an edge compat build
The npm package objection-timestamp-edgeruntime receives a total of 0 weekly downloads. As such, objection-timestamp-edgeruntime popularity was classified as not popular.
We found that objection-timestamp-edgeruntime 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.
Security News
CISA extended MITRE’s CVE contract by 11 months, avoiding a shutdown but leaving long-term governance and coordination issues unresolved.
Product
Socket's Rubygems ecosystem support is moving from beta to GA, featuring enhanced security scanning to detect supply chain threats beyond traditional CVEs in your Ruby dependencies.
Research
The Socket Research Team investigates a malicious npm package that appears to be an Advcash integration but triggers a reverse shell during payment success, targeting servers handling transactions.