
Research
/Security News
Toptal’s GitHub Organization Hijacked: 10 Malicious Packages Published
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
mobx-blocks
Advanced tools
react-query wannabe for people who like MobX or keeping their logic and view layers separate
MobX classes designed for solving common problems encountered when building dashboard-style web applications. With 100% test coverage.
Given an async fetch function like:
type Product = { id: string }
type FetchFn = (params: Record<string, any>) => Promise<{ data: Product[] }>
We can pass it to a new Collection to let it manage the following:
const products = new Collection({ fetchFn })
console.log(c.data) // type Product[] inferred from fetchFn return
const products = new Collection({
fetchFn,
sortBy: "id" as "id" | "title",
})
products.sorting.sort("id") // fetchFn call (triggered automatically by reaction)
products.sorting.toggleDirection() // fetchFn call
products.sorting.setKey("title") // fetchFn call
products.sorting.setAscending(true) // fetchFn call
const products = new Collection({
fetchFn,
initialFilters: { title: "Foo", valid: false } as ProductQueryParams,
})
products.filters.set("title", "Bar") // fetchFn call
products.filters.get("title")
products.filters.merge({ title: "Bar" }) // valid: false persists, fetchFn call
products.filters.replace({ title: "Bar" }) // valid:false gets removed, fetchFn call
products.filters.reset() // reset to initialFilters, fetchFn call
const products = new Collection({ fetchFn })
await products.fetch()
products.selection.select(products.data.?[0]) // added to selection
products.selection.select(products.data.?[0]) // removed from selection
products.selection.set(products.data) // select all products
import { Cache, Collection } from "mobx-blocks"
// The Cache will be our source of truth so we create it first and pass it to the Collection
const productsCache = new Cache({ ttl: 3 }) // in minutes
const products = new Collection({ fetchFn, fetchOne, cache: productsCache })
await products.fetch({ sortBy: "title", ascending: false }) // fetchFn call
await products.fetch({ sortBy: "title", ascending: false }) // called with same params -> result returned from Cache
await products.fetchOne("id") // given this id exists in cache no fetchOne call will be made
await products.fetchOne("id", { useCache: false }) // we can bypass this behaviour if the fetchOne returns more detailed data
const products = new Collection({
fetchFn,
sortBy: "title",
initialFilters: { foo: "foo", bar: "bar" },
syncParamsToUrl: true, // TODO: pass filter function
})
products.fetch()
// ...URL now contains ?sortBy=title&sortAscending=true&foo=foo&bar=bar
const products = new Collection({
fetchFn,
sortBy: null as null | "title",
initialFilters: { foo: "", bar: "" },
})
products.init({ queryString: "?sortBy=title&sortAscending=true&foo=foo&bar=bar" })
console.log(products.sorting.params) // { sortBy: "title", ascending: true }
console.log(products.filters.active) // { foo: "foo", bar: "bar" }
[TODO] Manages caching of list/detail queries
[TODO] Manages pagination
[TODO] Manages filters
[TODO] Manages filters
[TODO] Manages notifications
[TODO] Manages modals
FAQs
react-query wannabe for people who like MobX or keeping their logic and view layers separate
The npm package mobx-blocks receives a total of 0 weekly downloads. As such, mobx-blocks popularity was classified as not popular.
We found that mobx-blocks 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.
Research
/Security News
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
Research
/Security News
Socket researchers investigate 4 malicious npm and PyPI packages with 56,000+ downloads that install surveillance malware.
Security News
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.