
Research
Security News
Malicious PyPI Package Exploits Deezer API for Coordinated Music Piracy
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
@elastic.io/batching-library
Advanced tools
Library for batching in elastic.io. Batching allows users to combine several calls to API in one big call.
BatchClient represents client that works with batches. It contains logic for creating, updating statuses and storing batches.
new BatchClient(store, config)
BatchClient constructor expects three parameters:
import { MongoStore, IStore } from '@elastic.io/batching-library';
import { BatchClient } from '@elastic.io/batching-library';
import { BatchConfig } from '@elastic.io/batching-library';
import { ConnectionOptions } from 'mongoose';
const maxSize = 1000;
const maxItemsNumber = 10;
const maxWaitTime = 1000;
const maxEmitRate = 1;
const maxRetry = 0;
const uri: string = 'url_to_mongo';
const collection = 'collection_name';
const connectionOpt: ConnectionOptions = {
user: 'user',
pass: 'password',
};
const mgStore: IStore = new MongoStore(collection, uri, connectionOpt);
const config = new BatchConfig(maxSize, maxItemsNumber, maxWaitTime, maxEmitRate, maxRetry);
const client = new BatchClient(mgStore, config);
saveItem(item)
Save provided item to batch, returns batch with saved item (without another Batch items).
Parameter | Type | Required | Description |
---|---|---|---|
id | string | false | If not specified - uuid v1 will be generated |
item | string | true | Body of the Batch Item |
const batch: Batch = await client.saveItem({ id: 0, item: {}});
getReadyBatches()
Using provided emitter emit batches with status 'READY'
const batches: Batch[] = await client.getReadyBatches();
await Promise.all(batches.map(async (batch) => {
try {
// process batch implementation
await client.updateBatchStatusById(batch.id, 'SUCCESS'); // batch was successfully processed
} catch (e) {
log.error('Error: %o', e);
await client.updateBatchStatusById(batch.id, 'FAILED'); // batch processed with error
}
}));
For reference implementation example take a look at MongoStore
Name | Mandatory | Description | Values |
---|---|---|---|
LOG_OUTPUT_MODE | Yes | Log record view format | short long simple json bunyan |
LOG_LEVEL | Yes | Log Level | fatal error warn info debug trace |
MONGO_URL | No | URL of mongo db used during integration tests | url to mongo db |
MONGO_USER | No | Username of mongo db user, used during integration tests | username |
MONGO_PASSWORD | No | Password for connecting to mongo db, used during integration tests | password |
MONGO_DB | No | Database of mongo db used during integration tests | database name |
MONGO_DROP_DB | No | If 1 drop database each test integration test if 0 dont | 1 0 |
MongoStore:
Supported Mongo database versions: 4.0 and higher.
Retries do not implemented.
Emit rate not implemented.
Library is not guarantee sequence processing of batch item
MaesterStore:
FAQs
Library for batching implementation on elastic.io
We found that @elastic.io/batching-library demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 12 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.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.
Security News
Newly introduced telemetry in devenv 1.4 sparked a backlash over privacy concerns, leading to the removal of its AI-powered feature after strong community pushback.