New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@elastic.io/batching-library

Package Overview
Dependencies
Maintainers
14
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@elastic.io/batching-library - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3-dev.1

CHANGELOG.md

11

lib/client.ts
import { AbstractStore } from './storage/IStore';
import { Batch, BatchConfig, BatchItem, BatchStatus } from './entity/dto' ;
import { Batch, BatchConfig, BatchItem, BatchStatus } from './entity/dto';
import componentLogger from '@elastic.io/component-logger';

@@ -66,2 +66,11 @@

}
/**
* Atomic Delete Batch
* @param batchId batch id
* @return Number of deleted items.
*/
public async deleteBatchById(batchId: string): Promise<number> {
return await this.store.delete(batchId);
}
}

10

out/client.d.ts

@@ -24,3 +24,3 @@ import { AbstractStore } from './storage/IStore';

/**
* Atomic Get 'READY' batches and locks them (set status tu 'LOCKED')
* Atomic Get 'READY' batches and locks them (set status to 'LOCKED')
*/

@@ -38,3 +38,3 @@ getReadyBatches(): Promise<Batch[]>;

* Ensures that item can be added to batch. If cant add to existing create new batch.
* Check batches after insett new item
* Check batches after insert new item
* @param item batch item

@@ -44,3 +44,9 @@ * @return Batch with saved item.

saveItem(item: BatchItem): Promise<Batch>;
/**
* Atomic Delete Batch
* @param batchId batch id
* @return Number of deleted items.
*/
deleteBatchById(batchId: string): Promise<number>;
}
//# sourceMappingURL=client.d.ts.map

@@ -38,3 +38,3 @@ "use strict";

/**
* Atomic Get 'READY' batches and locks them (set status tu 'LOCKED')
* Atomic Get 'READY' batches and locks them (set status to 'LOCKED')
*/

@@ -59,3 +59,3 @@ async getReadyBatches() {

* Ensures that item can be added to batch. If cant add to existing create new batch.
* Check batches after insett new item
* Check batches after insert new item
* @param item batch item

@@ -71,4 +71,12 @@ * @return Batch with saved item.

}
/**
* Atomic Delete Batch
* @param batchId batch id
* @return Number of deleted items.
*/
async deleteBatchById(batchId) {
return await this.store.delete(batchId);
}
}
exports.BatchClient = BatchClient;
//# sourceMappingURL=client.js.map

@@ -105,5 +105,5 @@ /// <reference types="node" />

/**
* @async update batches status by batch Configuration.
* @async update batches status by batch Configuration to READY.
*
* @param batchConfig of batch Configuration.
* @param batchConfig batch Configuration.
* @return number(count) of updated objects.

@@ -110,0 +110,0 @@ */

{
"name": "@elastic.io/batching-library",
"version": "0.0.2",
"version": "0.0.3-dev.1",
"description": "Library for batching implementation on elastic.io",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/elasticio/batching-library#readme",

@@ -216,2 +216,33 @@ import { MongoStore } from '../../lib/storage/impl/MongoStore';

});
describe('delete Batch', () => {
let mgStore;
const options = Object.create(opt);
options.dbName = 'deleteBatch';
before(async () => {
mgStore = new MongoStore('deleteBatch', uri, options);
if (dropDB) {
const db = await mgStore.openConnection();
await db.useDb(options.dbName);
await db.dropDatabase();
}
});
it('should delete batch by id', async () => {
const conf = new BatchConfig(72, 30, 1000);
const client = new BatchClient(mgStore, conf);
const items = [
{ num: { msg: 1 } },
{ num: { msg: 2 } },
];
const batch = await Promise.all(items.map(item => client.saveItem(new BatchItem(item.num.msg.toString(), item))));
const result = await client.deleteBatchById(batch[0].id);
expect(result).to.be.equal(1);
});
after(async () => {
await mgStore.close();
});
});
});

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc