Security News
New Python Packaging Proposal Aims to Solve Phantom Dependency Problem with SBOMs
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
@lighthouse/sdk
Advanced tools
SDK for communicating with the Lighthouse API, built with Redux.
import { getModule } from '@lighthouse/sdk'
const listId = 'all' // optional, defaults to 'default' in all module methods
const location = getModule('location')
@connect(
mapStateToProps,
mapDispatchToProps,
)
export default class MyComponent extends Component {
// build component...
}
// React Redux
function mapStateToProps(state) {
const listOpts = { /* sort options etc. */ }
const locationSelectors = location.selectors(state)
return {
// returns an array of location resources
locations: locationSelectors(listId).list(listOptions),
// returns the current location resrouce
currentLocation: locationSelectors.current(),
}
}
function mapDispatchToProps(dispatch) {
const { query, save, findById, remove } = location
return {
fetch: params => dispatch(query(listId, params)),
save: (params, payload, id) => dispatch(save(params, payload, id)),
findById: id => dispatch(findById(id)),
remove: id => dispatch(remove(id)),
}
}
You can use the optimistic
option to specify the new entities or updates to entities should be stored in the cache as soon as the request is sent. This improves the experience of the UX in some situations, resulting in a perceived performance increase and instant feedback.
It is particular useful for a chat interface where waiting for new messages to be persisted to the API hampers the experience (loading spinners). Whereas more often than not you can be sure that a send message request will be successful, so you can treat it as sent as soon as it is created and if it does fail, retry the request.
To make an optimistic update to save
requests, pass the optimistic
option to the params option, e.g:
// assuming we have setup messages module...
const params = {
optimistic: true
}
const payload = {
body: 'Hi Friend!'
}
// message will be available in cache as soon as request is made
message.save(params, payload)
You can follow an offline-first workflow using the optimistic option as above. Here's how the offline-first flow works:
id
value_id
) returned in the responserolled-back
so we can retry it if we want. We can identify these items in the cache via their state value of rolled-back
and (if it was a new document) the fact it doesn't have an _id
value in it's entity
dataThere's some things to keep in mind when working in an offline manner:
Most of our resources follow a RESTful CRUD pattern, so it's easy to add new modules to the sdk. To add a new CRUD module:
/modules
. The simplest way is to clone an existing CRUD module, e.g. 'zone' and update the references in the index file and the test./module/index.js
along with with the other modules/module/test/index.test.js
which ensures the correct modules are correctly exportedFAQs
Lighthouse.io SDK for JavaScript applications
The npm package @lighthouse/sdk receives a total of 98 weekly downloads. As such, @lighthouse/sdk popularity was classified as not popular.
We found that @lighthouse/sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
Security News
Socket CEO Feross Aboukhadijeh discusses open source security challenges, including zero-day attacks and supply chain risks, on the Cyber Security Council podcast.
Security News
Research
Socket researchers uncover how threat actors weaponize Out-of-Band Application Security Testing (OAST) techniques across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.