
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
igthorn-request
Advanced tools
Generic API request class that allows to validate query.
Igthorn Request provides two different features:
It's part of Igthorn project.
Typical usage would be to add parsing request as middleware:
var express = require("express");
var app = express();
var RequestMiddleware = require("igthorn-request").RequestMiddleware;
app.all("*", RequestMiddleware.validate);
// after that middleware you can refer to parsed request in following way
get(request, response)
{
let parsedRequest = request.getParsedRequest();
// ...
}
Request can also be used as a standalone class:
var Request = require("igthorn-request");
var request = new Request();
request.inflate({
conditions: {
price: {
"gt" : 15,
"lte": 70
},
"category": [21, 45]
}
});
Request class is capable of handling following params:
"name"
// or
["firstName", "lastName"]
// or
{
"name" : "firstName"
}
"name"
// or
["firstName", "lastName"]
"comments"
{
name: "John"
}
// or
{ // implicit logical and
name: "John",
surname: "Smith"
}
// or
{ // explicit logic and
"and" : [
{name: "John"}
{surname: "Smith"}
]
}
// or
{
"or": [
{ // implicit logical and
name: "John",
surname: "Smith"
},
{
"age" : 20
}
]
}
// or
{ // different operators
"age" : {
"gt" : 20,
"lt" : 25
}
}
| operator | meaning |
|---|---|
| "eq", | Matches values that are exactly the same as the value specified in the query. |
| "gt", | Matches values that are greater than the value specified in the query. |
| "gte", | Matches values that are greater than or equal to the value specified in the query. |
| "lt", | Matches values that are less than the value specified in the query. |
| "lte", | Matches values that are less than or equal to the value specified in the query. |
| "ne", | Matches all values that are not equal to the value specified in the query. |
| "in", | Matches values that do exist in an array specified to the query. |
| "nin", | Matches values that do not exist in an array specified to the query. |
| "regex", | Matches values using a regular expression on the specified query. |
| "like", | Matches values that are matching pattern passed in the value specified in the query. |
| "contains" | Matches one of values in passed key which needs to be array |
"name"
// or
[
"name",
"age"
]
// or
{
"name": "desc",
"age": "asc"
}
Request class implements following methods:
inflate(data:object) : self
parses, validates and inflates request object with passed data object
setFields(fields:string|array|object) : self
sets fields to be queried
setWithout(fields:string|array|object) : self
sets fields to exclude from result
getFields() : object
gets list of fields to be queried
getWithout() : object
gets list to exclude from result
setJoins(joins:string|array) : self
sets list of relationships to be joined to resource, allows for either string or array
getJoins() : array
gets list of relationships to be joined to resource
setConditions(data:object) : self
parses, validates and sets passed conditions
getConditions() : object
gets conditions
appendConditions(data:object) : self
parses, validates and appends passed conditions to current conditions
setOrder(order:string|array|object) : self
parses, validates and sets order
getOrder() : object
gets order
setLimit(limit:int) : self
sets limit of resources to be returned
getLimit() : number
gets limit of resources to be returned
disableLimit() : self
disables limit
setOffset(offset:int|string) : self
sets offset
getOffset() : int
gets offset
setStorage(storage:string) : self
sets storage to be used
getStorage() : string
get storage to be used
enableCount() : self
enables count to be returned only for that query
disableCount() : self
disables count to be returned only for that query
isCountEnabled() : boolean
gets flag is count enabled
getUsedFields() : array
gets list of fields used acros query
export() : object
exports object representation of request
reset() : self
sets request object state to it's defaults
FAQs
Generic API request class that allows to validate/create query
We found that igthorn-request 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
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.