
Product
Introducing Tier 1 Reachability: Precision CVE Triage for Enterprise Teams
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
@aller/labrador-utils
Advanced tools
yarn add @aller/labrador-utils
or
npm install @aller/labrador-utils
const { api } = require('labrador-utils')
const labApi = api({ base: 'http://api.secret.labrador.api.lol', site_id: 1 })
labApi.getArticleById({ id: 9999999, args... }) // {Article}
labApi.getArticlesByTags({ tags:['test', 'bil'], args... }) // [{Article}...]
labApi.getArticlesByTag({ tag: 'test', args... }) // [{Article}...]
labApi.getArticlesBySection({ section: 'mat', args... }) // [{Article}...]
labApi.getFrontPageById({ id: 9999999, args... }) // { FrontPage }
labApi.getFragment({ id: 9999999, args... }, ?clean) // Returns HTML string. If clean is provided, the resulting HTML is parsed throuhg parse5 to ensure valid markup.
Article-based high level methods also have query-specific options e.g:
labApi.getArticleById({
isFeatured: true,
visibility_status: 'P'
})
labApi.getQuery('/front', { query: 'id:999999', args... }).get() // { result: [{ FrontPage }...] }
labApi.getFrontPage({ query: 'id:9999999', args... }).getResult() // [{ FrontPage }...]
labApi.getArticles({ query: 'tag:test', args... }).getFrist() // { Article }
All base methods have 3 request methods
get() -> { result: [ { ENTITY }...] }
getResult() -> [ {ENTITY }... ]
getFirst() -> { ENTITY }
The base methods use the queryBuilder for parsing of the query-parameter. The queryBuilder takes nested JS objects/arrays as input and generates a query string as output.
labApi.getArticles({
query: [{ tag: ['nyheter', 'bil'] }, { 'review_score': '*' }],
}).getResult()
// query: (tag:(nyheter AND bil) AND review_score:*)
// The underlying queryBuilder method can also be directly accessed:
labApi.queryBuilder([{ tags: ['hello', { wat: ['test1', ['hello', 'hello2'], 'OR'] }] }])
// returns the string: '(tags:(hello AND wat:(test1 OR (hello AND hello2))))'
Concepts:
['nyheter', 'bil'] // -> (nyheter AND bil)
['nyheter', 'bil', 'OR'] // -> (nyheter OR bil), the 'OR' keyword needs to be the last el. of the array.
{ tag: ['nyheter', 'bil', 'OR']} // -> (tag:(nyheter OR bil))
// And any nested combination of these three concepts
All additional args. on all methods, are sent as query params, e.g:
labApi.getArticlesByTags({
tags: ['test', 'bil'],
limit: 5,
start: 5,
order: 'desc',
orderBy: 'published'
})
Defaults are found here
FAQs
Labrador utils
We found that @aller/labrador-utils demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 10 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
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
Research
/Security News
Ongoing npm supply chain attack spreads to DuckDB: multiple packages compromised with the same wallet-drainer malware.
Security News
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.