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
2
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.1-dev.13 to 0.0.1-dev.14

4

out/client.js

@@ -65,4 +65,4 @@ "use strict";

batch.items = batch.items.filter(batchItem => batchItem.id === item.id);
// this.LOG.debug('Starting to check batch: id: %s', batch.id);
// await this.store.checkBatch(batch.id, this.config);
this.LOG.debug('Starting to check batch: id: %s', batch.id);
await this.store.checkBatch(batch.id, this.config);
return batch;

@@ -69,0 +69,0 @@ }

@@ -14,2 +14,3 @@ /**

size: number;
activeBatch: string;
createdAt: number;

@@ -26,7 +27,9 @@ updateAt: number;

* @param retryCount number of times this batch was in status 'FAILED'.
* @param itemsCount actual count if items in the batch
* @param size bytes size of items in batch.
* @param activeBatch identifier of active batch (0 - active)
* @param createdAt timestamp of creation moment
* @param updatedAt timestamp of last update
*/
constructor(id: string | undefined, items: BatchItem[], status: BatchStatus, retryCount?: number, itemsCount?: number, size?: number, createdAt?: number, updatedAt?: number);
constructor(id: string | undefined, items: BatchItem[], status: BatchStatus, retryCount: number | undefined, itemsCount: number | undefined, size: number | undefined, activeBatch: string, createdAt?: number, updatedAt?: number);
}

@@ -33,0 +36,0 @@ /**

@@ -19,7 +19,9 @@ "use strict";

* @param retryCount number of times this batch was in status 'FAILED'.
* @param itemsCount actual count if items in the batch
* @param size bytes size of items in batch.
* @param activeBatch identifier of active batch (0 - active)
* @param createdAt timestamp of creation moment
* @param updatedAt timestamp of last update
*/
constructor(id = '', items, status, retryCount = 0, itemsCount = 0, size = 0, createdAt = 0, updatedAt = 0) {
constructor(id = '', items, status, retryCount = 0, itemsCount = 0, size = 0, activeBatch, createdAt = 0, updatedAt = 0) {
this.id = id;

@@ -31,2 +33,3 @@ this.items = items;

this.size = size;
this.activeBatch = activeBatch;
this.createdAt = createdAt;

@@ -33,0 +36,0 @@ this.updateAt = updatedAt;

@@ -10,2 +10,3 @@ "use strict";

exports.batchSchema = new mongoose_1.Schema({
activeBatch: { type: String, unique: true },
items: [exports.batchItemSchema],

@@ -12,0 +13,0 @@ status: { type: String, required: true, default: 'OPEN', enum: dto_1.batchStatusArr },

@@ -6,2 +6,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const v1_1 = __importDefault(require("uuid/v1"));
const mongoose_1 = __importDefault(require("mongoose"));

@@ -119,2 +120,3 @@ const component_logger_1 = __importDefault(require("@elastic.io/component-logger"));

retryCount: 0,
activeBatch: b.activeBatch,
};

@@ -141,2 +143,3 @@ dbObjects.push(obj);

async addItemToBatch(batchItem, batchConfig) {
let result;
try {

@@ -148,4 +151,5 @@ const conn = await this.openConnection();

this.LOG.trace('BatchConfig %j', batchConfig);
const result = await model.findOneAndUpdate({
result = await model.findOneAndUpdate({
status: 'OPEN',
activeBatch: 0,
$and: [

@@ -164,2 +168,6 @@ { updatedAt: { $gt: new Date(new Date().getTime() - batchConfig.maxWaitTime) } },

catch (e) {
if (e.code === 11000) {
await this.checkBatches(batchConfig);
return this.addItemToBatch(batchItem, batchConfig);
}
this.logUnexpectedError(e);

@@ -184,3 +192,8 @@ throw e;

],
}, { status: 'READY' });
}, {
$set: {
status: 'READY',
activeBatch: v1_1.default(),
},
});
this.LOG.trace('Updating result %j', result);

@@ -210,3 +223,3 @@ return result;

],
}, { $set: { status: 'READY' } }, { new: true });
}, { $set: { status: 'READY', activeBatch: v1_1.default() } }, { new: true });
if (result) {

@@ -512,3 +525,3 @@ this.LOG.trace('Updating result %j', result);

createBatchObjFromModel(model) {
return new dto_1.Batch(model.id, model.items.map(i => new dto_1.BatchItem(i.id, i.item)), model.status, model.retryCount, model.itemsCount, model.size, model.createdAt.getTime(), model.updatedAt.getTime());
return new dto_1.Batch(model.id, model.items.map(i => new dto_1.BatchItem(i.id, i.item)), model.status, model.retryCount, model.itemsCount, model.size, model.activeBatch, model.createdAt.getTime(), model.updatedAt.getTime());
}

@@ -515,0 +528,0 @@ /**

{
"name": "@elastic.io/batching-library",
"version": "0.0.1-dev.13",
"version": "0.0.1-dev.14",
"description": "Library for batching implementation on elastic.io",

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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