
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
@vovikilelik/task-queue-js
Advanced tools
Библиотека для организации клиентского API.
git clone http://git.vovikilelik.com/Clu/task-queue-js.git
npm i @vovikilelik/task-queue-js
import { join, all } './task-queue.js';
join(...tasks)
- Агрегатор для последовательных сценариевall(...tasks)
- Агрегатор для параллельных сценариев, как Promise.all()
Каждый агрегатор не вызывает запросы сразу после создания, а только создаёт сценарий, описанный в ...tasks
. Для того, чтобы запрос состоялся, нужно вызвать готовый агрегатор, как функцию:
/* Create scenario */
const scenario = join(task1, task2, task3, ...);
/* Execute scenario with various data */
scenario(initData).then(...).catch(...);
Каждый task
должен быть функцией, которая принимает результат предыдущей task
и возвращает Promise
, где в then
устанавливается часть данных для текущей задачи. Затем, все части данных будут слиты воедино { ...a, ...b, ...n, ... }
.
const task = (prev) => get(`https://${prev.id}`).then(items => ({ items }));
join(task)({ id: 1 }).then(console.log);
> { id: 1, items: [] }
Сценарии и задачи можно комбинировать, а также задавать условия прямо при объявлении аргументов:
join(
all(
join(
all(),
...
),
),
isValid() && task
);
Если нет необходимости в запросах на сервер, можно сразу передавать готовые данные, как в сценариях, так и в задачах или ничего не возвращать:
const task1 = () => ({ one: 'Hello!' });
const task2 = () => false;
const scenario = join(task1, task2, { two: 'Hi!' });
scenario().then(console.log);
> { one: 'Hello!', two: 'Hi!' }
/* An function for make request, do not mind... */
const myFetch = (url) => fetch(`https://${url}`).then(response => response.json());
import { join } './task-queue.js';
/* First task needs to id */
const loadUser = (response) => {
const { id } = response;
return myFetch(`user/${id}`)
.then(json => ({ user: json }));
}
/* Second task needs to wait result of first task */
const loadItems = (response) => {
const { id, user } = response;
return myFetch(`metadata/${id}/${user.id}`)
.then(json => ({ items: json }));
}
/* This tasks will call consistently
and next task will be accept previous result. */
const getMyTask = join(loadUser, loadItems);
/* It able to various requesting */
getMyTask({ id: '1' }).then(setData);
// { id: '1', user: {...}, items: [] }
getMyTask({ id: '2' }).then(setData);
// { id: '2', user: {...}, items: [] }
...
FAQs
The easy way to implement a client-server API
The npm package @vovikilelik/task-queue-js receives a total of 0 weekly downloads. As such, @vovikilelik/task-queue-js popularity was classified as not popular.
We found that @vovikilelik/task-queue-js 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
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.