
Product
Introducing Webhook Events for Alert Changes
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.
larvitorder
Advanced tools
Generic order module for nodejs.
order data structure:
{
"uuid": "string",
"fields": {
"field1": [
"value1",
"value2"
],
"field2": [
"value3"
]
},
"rows": [
{
"uuid": "string", <-- special field
"field1": [394],
"field2": ["nisse", 20]
}
]
}
npm i --save larvitorder
All below instructions require the loading of libraries like something below (db is an instance of larvitdb and log an instance of winston or larvitutils.Log):
const OrderLib = require('larvitorder');
const orderLib = new OrderLib({ db, log })
await orderLib.runDbMigrations();
const order = new orderLib.Order({db});
order.created = '2022-12-01T13:37:00Z'; // Must be ISO-8601
order.fields = {'firstname': 'GĂĽnter', 'lastname': ['Edelweiss', 'Schloffs']};
order.rows = [{'price': 399, 'name': 'Screw'}, {'price': 34, 'name': 'teh_foo', 'tags': ['foo', 'bar']}];
await order.save();
const order = new orderLib.Order({uuid: 'uuid-on-existing-order-in-db', db});
await order.loadFromDb();
// Now order.fields and order.rows is loaded from database
const order = new orderLib.Order({uuid: 'uuid-on-existing-order-in-db', db});
await order.rm();
// order is now removed from DB
const ordersCtx = new orderLib.Orders({db});
const {orders, hits} = await ordersCtx.get();
const ordersCtx = new orderLib.Orders({db});
// Filter and limit order hits
orders.limit = 10; // Only return 10 orders
orders.offset = 5; // Skip the 5 first orders
orders.uuids = ['1ebe346e-c05a-11e6-a4a6-cec0c932ce01']; // Only return orders with these uuids
orders.matchAllFields = {'firstname': 'Abraham', 'lastname': 'Lincoln'}; // Only return orders that have both the fields firstname and lastname that matches
orders.matchAllRowFields = {'productName': 'A4 paper'}; // Only return orders that have rows matching both the row fieldname "productName" and the value "A4 paper"
// Return order fields
orders.returnFields = ['firstname', 'lastname', 'status']; // Only return the order fields listed. IMPORTANT! Will return no order fields if not supplied! Because performance.
// Return order row fields
orders.returnRowFields = ['productName', 'price']; // Only return the order row fields listed. IMPORTANT! Will return no order row fields if not supplied! Because performance.
const {orders, hits} = await ordersCtx.get();
FAQs
Generic order system
We found that larvitorder demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 8 open source maintainers 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.

Product
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.

Security News
ENISA has become a CVE Program Root, giving the EU a central authority for coordinating vulnerability reporting, disclosure, and cross-border response.

Product
Socket now scans OpenVSX extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.