@elastic.io/oih-standard-library
Advanced tools
Comparing version 0.0.10-dev.11 to 0.0.10-dev.12
export declare abstract class LookupObjects { | ||
protected logger: any; | ||
protected emitter: any; | ||
constructor(logger: any, emitter: any); | ||
protected emit: any; | ||
constructor(logger: any, emit: any); | ||
/** | ||
@@ -6,0 +6,0 @@ * |
@@ -6,7 +6,5 @@ "use strict"; | ||
class LookupObjects { | ||
constructor(logger, emitter) { | ||
constructor(logger, emit) { | ||
this.logger = logger; | ||
this.emitter = { | ||
emit: emitter, | ||
}; | ||
this.emit = emit; | ||
} | ||
@@ -34,3 +32,3 @@ /** | ||
this.logger.info('Finished processing call to lookupObjects action'); | ||
this.emitter.emit('end'); | ||
this.emit('end'); | ||
} | ||
@@ -60,3 +58,3 @@ catch (e) { | ||
} | ||
this.emitter.emit('data', messages.newMessageWithBody({ results })); | ||
await this.emit('data', messages.newMessageWithBody({ results })); | ||
break; | ||
@@ -68,3 +66,3 @@ } | ||
results.forEach((result) => { | ||
this.emitter.emit('data', messages.newMessageWithBody(result)); | ||
this.emit('data', messages.newMessageWithBody(result)); | ||
}); | ||
@@ -83,3 +81,3 @@ break; | ||
results.forEach((result) => { | ||
this.emitter.emit('data', messages.newMessageWithBody(result)); | ||
this.emit('data', messages.newMessageWithBody(result)); | ||
}); | ||
@@ -86,0 +84,0 @@ break; |
@@ -10,9 +10,7 @@ import { | ||
protected emitter; | ||
protected emit; | ||
public constructor(logger: any, emitter: any) { | ||
public constructor(logger: any, emit: any) { | ||
this.logger = logger; | ||
this.emitter = { | ||
emit: emitter, | ||
}; | ||
this.emit = emit; | ||
} | ||
@@ -64,3 +62,3 @@ | ||
this.emitter.emit('end'); | ||
this.emit('end'); | ||
} catch (e) { | ||
@@ -92,3 +90,3 @@ this.logger.error('Unexpected error while processing lookupObjectById call for message: %j, cfg: %j', msg, cfg, e); | ||
} | ||
this.emitter.emit('data', messages.newMessageWithBody({ results })); | ||
await this.emit('data', messages.newMessageWithBody({ results })); | ||
break; | ||
@@ -100,3 +98,3 @@ } | ||
results.forEach((result) => { | ||
this.emitter.emit('data', messages.newMessageWithBody(result)); | ||
this.emit('data', messages.newMessageWithBody(result)); | ||
}); | ||
@@ -119,3 +117,3 @@ break; | ||
results.forEach((result) => { | ||
this.emitter.emit('data', messages.newMessageWithBody(result)); | ||
this.emit('data', messages.newMessageWithBody(result)); | ||
}); | ||
@@ -122,0 +120,0 @@ break; |
export declare abstract class PollingTrigger { | ||
protected logger: any; | ||
protected emitter: any; | ||
constructor(logger: any, emitter: any); | ||
protected emit: any; | ||
constructor(logger: any, emit: any); | ||
/** | ||
@@ -6,0 +6,0 @@ * |
@@ -6,5 +6,5 @@ "use strict"; | ||
class PollingTrigger { | ||
constructor(logger, emitter) { | ||
constructor(logger, emit) { | ||
this.logger = logger; | ||
this.emitter = emitter; | ||
this.emit = emit; | ||
} | ||
@@ -67,5 +67,5 @@ /** | ||
this.logger.trace('Snapshot to be emitted: %j', snapshot); | ||
this.emitter.emit('snapshot', snapshot); | ||
this.emit('snapshot', snapshot); | ||
this.logger.info('Finished processing call to Polling Trigger'); | ||
await this.emitter.emit('end'); | ||
await this.emit('end'); | ||
} | ||
@@ -196,3 +196,3 @@ catch (e) { | ||
this.logger.trace('Emitting new message with body: %j', r); | ||
await this.emitter.emit('data', messages.newMessageWithBody(r)); | ||
await this.emit('data', messages.newMessageWithBody(r)); | ||
} | ||
@@ -206,3 +206,3 @@ } | ||
this.logger.trace('Emitting new message with body: %j', results); | ||
return this.emitter.emit('data', messages.newMessageWithBody(results)); | ||
return this.emit('data', messages.newMessageWithBody(results)); | ||
} | ||
@@ -209,0 +209,0 @@ } |
@@ -10,7 +10,7 @@ import { | ||
protected emitter; | ||
protected emit; | ||
public constructor(logger, emitter) { | ||
public constructor(logger, emit) { | ||
this.logger = logger; | ||
this.emitter = emitter; | ||
this.emit = emit; | ||
} | ||
@@ -74,5 +74,5 @@ | ||
this.logger.trace('Snapshot to be emitted: %j', snapshot); | ||
this.emitter.emit('snapshot', snapshot); | ||
this.emit('snapshot', snapshot); | ||
this.logger.info('Finished processing call to Polling Trigger'); | ||
await this.emitter.emit('end'); | ||
await this.emit('end'); | ||
} catch (e) { | ||
@@ -212,3 +212,3 @@ this.logger.error('Unexpected error while processing Polling Trigger call for cfg: %j', cfg, e); | ||
this.logger.trace('Emitting new message with body: %j', r); | ||
await this.emitter.emit('data', messages.newMessageWithBody(r)); | ||
await this.emit('data', messages.newMessageWithBody(r)); | ||
} | ||
@@ -223,3 +223,3 @@ } | ||
this.logger.trace('Emitting new message with body: %j', results); | ||
return this.emitter.emit('data', messages.newMessageWithBody(results)); | ||
return this.emit('data', messages.newMessageWithBody(results)); | ||
} | ||
@@ -226,0 +226,0 @@ |
{ | ||
"name": "@elastic.io/oih-standard-library", | ||
"version": "0.0.10-dev.11", | ||
"version": "0.0.10-dev.12", | ||
"description": "Library for OIH standards implementation", | ||
@@ -5,0 +5,0 @@ "author": { |
@@ -139,3 +139,3 @@ [![CircleCI](https://circleci.com/gh/elasticio/oih-standard-library.svg?style=svg&circle-token=02f42b98b1e672b7f47ad98d88eb2b4d5155010d)](https://circleci.com/gh/elasticio/oih-standard-library) | ||
async function process(msg, cfg, snapshot = {}) { | ||
const deleteAction = new MyLookupObjects(this.logger, this.emitter); // Sailor version > 2.4.2 | ||
const deleteAction = new MyLookupObjects(this.logger, this.emit); // Sailor version > 2.4.2 | ||
return deleteAction.process(msg, cfg, snapshot); | ||
@@ -264,3 +264,3 @@ } | ||
async function process(cfg, snapshot) { | ||
const trigger = new MyPollingTriggerImpl(this.logger, this.emitter); // Sailor version > 2.4.2 | ||
const trigger = new MyPollingTriggerImpl(this.logger, this.emit); // Sailor version > 2.4.2 | ||
return trigger.process(cfg, snapshot); | ||
@@ -267,0 +267,0 @@ } |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
164282
2414