@elastic.io/oih-standard-library
Advanced tools
Comparing version 1.1.2 to 1.1.3
@@ -1,2 +0,4 @@ | ||
# 1.1.2 | ||
# 1.1.3(October 20,2020) | ||
* Annual audit of the component code to check if it exposes a sensitive data in the logs | ||
# 1.1.2(September 17,2020) | ||
Don't log sensitive data | ||
@@ -3,0 +5,0 @@ Update dependencies |
@@ -17,11 +17,9 @@ "use strict"; | ||
*/ | ||
// @ts-ignore | ||
async process(msg, cfg, snapshot) { | ||
try { | ||
this.logger.info('Starting processing createObject action'); | ||
this.logger.trace('Incoming configuration: %j', cfg); | ||
this.logger.trace('Incoming message: %j', msg); | ||
this.logger.trace('Incoming snapshot: %j', snapshot); | ||
const type = this.getType(cfg, msg); | ||
const object = this.getObjectFromMessage(msg, cfg); | ||
this.logger.trace('Structure: %j and type: %j of object to be created', object, type); | ||
this.logger.debug('Object with type: %s to be created', type); | ||
const resultObject = await this.createObject(object, cfg, msg); | ||
@@ -32,3 +30,3 @@ if (!resultObject || resultObject === null) { | ||
} | ||
this.logger.trace('Successfully process create call for object: %j and type: %j', resultObject, type); | ||
this.logger.debug('Successfully process create call for object type: %s', type); | ||
this.logger.info('Finished processing create action'); | ||
@@ -38,3 +36,3 @@ return messages.newMessageWithBody(resultObject); | ||
catch (e) { | ||
this.logger.error('Unexpected error while processing create call for incoming message', e); | ||
this.logger.error('Unexpected error while processing create call for incoming message'); | ||
throw e; | ||
@@ -41,0 +39,0 @@ } |
@@ -19,11 +19,9 @@ import { OBJECT_TYPE } from '../constants'; | ||
*/ | ||
// @ts-ignore | ||
public async process(msg, cfg, snapshot): Promise<any> { | ||
try { | ||
this.logger.info('Starting processing createObject action'); | ||
this.logger.trace('Incoming configuration: %j', cfg); | ||
this.logger.trace('Incoming message: %j', msg); | ||
this.logger.trace('Incoming snapshot: %j', snapshot); | ||
const type = this.getType(cfg, msg); | ||
const object = this.getObjectFromMessage(msg, cfg); | ||
this.logger.trace('Structure: %j and type: %j of object to be created', object, type); | ||
this.logger.debug('Object with type: %s to be created', type); | ||
const resultObject = await this.createObject(object, cfg, msg); | ||
@@ -34,7 +32,7 @@ if (!resultObject || resultObject === null) { | ||
} | ||
this.logger.trace('Successfully process create call for object: %j and type: %j', resultObject, type); | ||
this.logger.debug('Successfully process create call for object type: %s', type); | ||
this.logger.info('Finished processing create action'); | ||
return messages.newMessageWithBody(resultObject); | ||
} catch (e) { | ||
this.logger.error('Unexpected error while processing create call for incoming message', e); | ||
this.logger.error('Unexpected error while processing create call for incoming message'); | ||
throw e; | ||
@@ -41,0 +39,0 @@ } |
@@ -28,4 +28,2 @@ "use strict"; | ||
this.logger.info('Starting processing deleteById action'); | ||
this.logger.trace('Incoming configuration: %j', cfg); | ||
this.logger.trace('Incoming message: %j', msg); | ||
const id = this.getId(msg, cfg); | ||
@@ -45,3 +43,3 @@ const type = this.getType(cfg, msg); | ||
catch (e) { | ||
this.logger.error('Unexpected error while processing delete call for incoming message', e); | ||
this.logger.error('Unexpected error while processing delete call for incoming message'); | ||
throw e; | ||
@@ -64,11 +62,9 @@ } | ||
class DeleteByUniqueCriteria extends Delete { | ||
// @ts-ignore | ||
async process(msg, cfg, snapshot) { | ||
try { | ||
this.logger.info('Start processing deleteByUniqueCriteria action'); | ||
this.logger.trace('Incoming configuration: %j', cfg); | ||
this.logger.trace('Incoming message: %j', msg); | ||
this.logger.trace('Incoming snapshot: %j', snapshot); | ||
const criteria = await this.getCriteria(msg, cfg); | ||
const type = this.getType(cfg, msg); | ||
this.logger.trace('Start deleting object with criteria: %j and type: %j', criteria, type); | ||
this.logger.debug('Start deleting object with type: %j', type); | ||
const foundObject = await this.findObjectByCriteria(criteria, type, cfg, msg); | ||
@@ -79,3 +75,3 @@ if (foundObject.numberOfObjects > 1) { | ||
if (foundObject.numberOfObjects === 0) { | ||
this.logger.trace('No objects for criteria: %j and type: %j, were found returning empty object', criteria, type); | ||
this.logger.debug('No objects for specified criteria and type: %j were found, returning empty object', type); | ||
this.logger.info('Finished processing deleteByUniqueCriteria action'); | ||
@@ -85,10 +81,10 @@ return {}; | ||
const { object } = foundObject; | ||
this.logger.trace('Start deleting object: %j', object); | ||
this.logger.debug('Start deleting object...'); | ||
const result = await this.deleteObject(object, cfg, msg); | ||
if (result === null) { | ||
this.logger.trace('Object with unique criteria: %j and type: %j was not deleted or not found. Returning empty object', criteria, type); | ||
this.logger.debug('Object with specified criteria and type: %j was not deleted or not found. Returning empty object', type); | ||
this.logger.info('Finished processing deleteByUniqueCriteria action'); | ||
return messages.newEmptyMessage(); | ||
} | ||
this.logger.trace('Successfully process delete call for criteria: %j and type: %j', criteria, type); | ||
this.logger.debug('Successfully process delete call for specified criteria and type: %j', type); | ||
this.logger.info('Finished processing deleteByUniqueCriteria action'); | ||
@@ -98,3 +94,3 @@ return messages.newMessageWithBody({ result }); | ||
catch (e) { | ||
this.logger.error('Unexpected error while processing delete call for incoming message', e); | ||
this.logger.error('Unexpected error while processing delete call for incoming message'); | ||
throw e; | ||
@@ -101,0 +97,0 @@ } |
@@ -48,4 +48,2 @@ import { ID, OBJECT_TYPE, UNIQUE_CRITERIA } from '../constants'; | ||
this.logger.info('Starting processing deleteById action'); | ||
this.logger.trace('Incoming configuration: %j', cfg); | ||
this.logger.trace('Incoming message: %j', msg); | ||
const id = this.getId(msg, cfg); | ||
@@ -64,3 +62,3 @@ const type = this.getType(cfg, msg); | ||
} catch (e) { | ||
this.logger.error('Unexpected error while processing delete call for incoming message', e); | ||
this.logger.error('Unexpected error while processing delete call for incoming message'); | ||
throw e; | ||
@@ -84,11 +82,9 @@ } | ||
export abstract class DeleteByUniqueCriteria extends Delete { | ||
// @ts-ignore | ||
public async process(msg, cfg, snapshot): Promise<any> { | ||
try { | ||
this.logger.info('Start processing deleteByUniqueCriteria action'); | ||
this.logger.trace('Incoming configuration: %j', cfg); | ||
this.logger.trace('Incoming message: %j', msg); | ||
this.logger.trace('Incoming snapshot: %j', snapshot); | ||
const criteria = await this.getCriteria(msg, cfg); | ||
const type = this.getType(cfg, msg); | ||
this.logger.trace('Start deleting object with criteria: %j and type: %j', criteria, type); | ||
this.logger.debug('Start deleting object with type: %j', type); | ||
const foundObject = await this.findObjectByCriteria(criteria, type, cfg, msg); | ||
@@ -99,3 +95,3 @@ if (foundObject.numberOfObjects > 1) { | ||
if (foundObject.numberOfObjects === 0) { | ||
this.logger.trace('No objects for criteria: %j and type: %j, were found returning empty object', criteria, type); | ||
this.logger.debug('No objects for specified criteria and type: %j were found, returning empty object', type); | ||
this.logger.info('Finished processing deleteByUniqueCriteria action'); | ||
@@ -105,14 +101,14 @@ return {}; | ||
const { object } = foundObject; | ||
this.logger.trace('Start deleting object: %j', object); | ||
this.logger.debug('Start deleting object...'); | ||
const result = await this.deleteObject(object, cfg, msg); | ||
if (result === null) { | ||
this.logger.trace('Object with unique criteria: %j and type: %j was not deleted or not found. Returning empty object', criteria, type); | ||
this.logger.debug('Object with specified criteria and type: %j was not deleted or not found. Returning empty object', type); | ||
this.logger.info('Finished processing deleteByUniqueCriteria action'); | ||
return messages.newEmptyMessage(); | ||
} | ||
this.logger.trace('Successfully process delete call for criteria: %j and type: %j', criteria, type); | ||
this.logger.debug('Successfully process delete call for specified criteria and type: %j', type); | ||
this.logger.info('Finished processing deleteByUniqueCriteria action'); | ||
return messages.newMessageWithBody({ result }); | ||
} catch (e) { | ||
this.logger.error('Unexpected error while processing delete call for incoming message', e); | ||
this.logger.error('Unexpected error while processing delete call for incoming message'); | ||
throw e; | ||
@@ -119,0 +115,0 @@ } |
@@ -55,30 +55,28 @@ "use strict"; | ||
class LookupObjectById extends LookupObject { | ||
// @ts-ignore | ||
async process(msg, cfg, snapshot) { | ||
try { | ||
this.logger.info('Starting processing lookupObjectById action'); | ||
this.logger.trace('Incoming configuration: %j', cfg); | ||
this.logger.trace('Incoming message: %j', msg); | ||
this.logger.trace('Incoming snapshot: %j', snapshot); | ||
const id = this.getId(msg, cfg); | ||
const objectType = this.getType(cfg, msg); | ||
if (id === undefined || id === null) { | ||
this.logger.trace('Id is empty'); | ||
this.logger.debug('Id is empty'); | ||
if (this.isOmittedCriteriaAllowed(cfg, msg)) { | ||
this.logger.trace('Empty Id allowed, returning empty object'); | ||
this.logger.debug('Empty Id allowed, returning empty object'); | ||
this.logger.info('Finished processing lookupObjectById action'); | ||
return messages.newEmptyMessage(); | ||
} | ||
this.logger.trace('Empty Id is not allowed throwing error'); | ||
this.logger.debug('Empty Id is not allowed throwing error'); | ||
throw new Error('Empty id is not allowed.'); | ||
} | ||
const result = await this.lookupObject(id, objectType, cfg, msg); | ||
this.logger.trace('Result of lookup: %j', result); | ||
this.logger.debug('Result of lookup is received'); | ||
if (result === null) { | ||
this.logger.trace('Object not found for id: %j', id); | ||
if (this.isEmptyResultAllowed(cfg, msg)) { | ||
this.logger.trace('Empty result allowed, returning empty object'); | ||
this.logger.debug('Empty result allowed, returning empty object'); | ||
this.logger.info('Finished processing lookupObjectById action'); | ||
return messages.newEmptyMessage(); | ||
} | ||
this.logger.trace('Empty result not allowed, throwing error'); | ||
this.logger.debug('Empty result not allowed, throwing error'); | ||
throw new Error('Object with provided id not found. Empty result is not allowed.'); | ||
@@ -90,3 +88,3 @@ } | ||
catch (e) { | ||
this.logger.error('Unexpected error while processing lookupObjectById call for incoming message', e); | ||
this.logger.error('Unexpected error while processing lookupObjectById call for incoming message'); | ||
throw e; | ||
@@ -109,34 +107,32 @@ } | ||
class LookupObjectByUniqueCriteria extends LookupObject { | ||
// @ts-ignore | ||
async process(msg, cfg, snapshot) { | ||
try { | ||
this.logger.info('Starting processing lookupObjectByCriteria action'); | ||
this.logger.trace('Incoming configuration: %j', cfg); | ||
this.logger.trace('Incoming message: %j', msg); | ||
this.logger.trace('Incoming snapshot: %j', snapshot); | ||
const criteria = await this.getCriteria(msg, cfg); | ||
const objectType = this.getType(cfg, msg); | ||
if (criteria === undefined || criteria === null) { | ||
this.logger.trace('Criteria is empty'); | ||
this.logger.debug('Criteria is empty'); | ||
if (this.isOmittedCriteriaAllowed(cfg, msg)) { | ||
this.logger.trace('Empty criteria allowed, returning empty object'); | ||
this.logger.debug('Empty criteria allowed, returning empty object'); | ||
this.logger.info('Finished processing lookupObjectByCriteria action'); | ||
return messages.newEmptyMessage(); | ||
} | ||
this.logger.trace('Empty criteria is not allowed throwing error'); | ||
this.logger.debug('Empty criteria is not allowed throwing error'); | ||
throw new Error('Empty criteria is not allowed.'); | ||
} | ||
const result = await this.lookupObject(criteria, objectType, cfg, msg); | ||
this.logger.trace('Result of lookup: %j', result); | ||
this.logger.debug('Result of lookup is received'); | ||
if (result === null) { | ||
this.logger.trace('Object not found for criteria: %j', criteria); | ||
this.logger.debug('Object not found for specified criteria'); | ||
if (this.isEmptyResultAllowed(cfg, msg)) { | ||
this.logger.trace('Empty result allowed, returning empty object'); | ||
this.logger.debug('Empty result allowed, returning empty object'); | ||
this.logger.info('Finished processing lookupObjectByCriteria action'); | ||
return messages.newEmptyMessage(); | ||
} | ||
this.logger.trace('Empty result not allowed, throwing error'); | ||
this.logger.debug('Empty result not allowed, throwing error'); | ||
throw new Error('Object with provided criteria not found. Empty result is not allowed.'); | ||
} | ||
if (result instanceof Array && result.length > 1) { | ||
this.logger.trace('Found more than 1 object for criteria: %j, throwing error', criteria); | ||
this.logger.debug('Found more than 1 object for specified criteria, throwing error'); | ||
throw new Error('Found more than 1 object for the provided criteria'); | ||
@@ -148,3 +144,3 @@ } | ||
catch (e) { | ||
this.logger.error('Unexpected error while processing lookupObjectByCriteria call for incoming message', e); | ||
this.logger.error('Unexpected error while processing lookupObjectByCriteria call for incoming message'); | ||
throw e; | ||
@@ -151,0 +147,0 @@ } |
@@ -79,30 +79,28 @@ import { | ||
export abstract class LookupObjectById extends LookupObject { | ||
// @ts-ignore | ||
public async process(msg, cfg, snapshot): Promise<any> { | ||
try { | ||
this.logger.info('Starting processing lookupObjectById action'); | ||
this.logger.trace('Incoming configuration: %j', cfg); | ||
this.logger.trace('Incoming message: %j', msg); | ||
this.logger.trace('Incoming snapshot: %j', snapshot); | ||
const id = this.getId(msg, cfg); | ||
const objectType = this.getType(cfg, msg); | ||
if (id === undefined || id === null) { | ||
this.logger.trace('Id is empty'); | ||
this.logger.debug('Id is empty'); | ||
if (this.isOmittedCriteriaAllowed(cfg, msg)) { | ||
this.logger.trace('Empty Id allowed, returning empty object'); | ||
this.logger.debug('Empty Id allowed, returning empty object'); | ||
this.logger.info('Finished processing lookupObjectById action'); | ||
return messages.newEmptyMessage(); | ||
} | ||
this.logger.trace('Empty Id is not allowed throwing error'); | ||
this.logger.debug('Empty Id is not allowed throwing error'); | ||
throw new Error('Empty id is not allowed.'); | ||
} | ||
const result = await this.lookupObject(id, objectType, cfg, msg); | ||
this.logger.trace('Result of lookup: %j', result); | ||
this.logger.debug('Result of lookup is received'); | ||
if (result === null) { | ||
this.logger.trace('Object not found for id: %j', id); | ||
if (this.isEmptyResultAllowed(cfg, msg)) { | ||
this.logger.trace('Empty result allowed, returning empty object'); | ||
this.logger.debug('Empty result allowed, returning empty object'); | ||
this.logger.info('Finished processing lookupObjectById action'); | ||
return messages.newEmptyMessage(); | ||
} | ||
this.logger.trace('Empty result not allowed, throwing error'); | ||
this.logger.debug('Empty result not allowed, throwing error'); | ||
throw new Error('Object with provided id not found. Empty result is not allowed.'); | ||
@@ -113,3 +111,3 @@ } | ||
} catch (e) { | ||
this.logger.error('Unexpected error while processing lookupObjectById call for incoming message', e); | ||
this.logger.error('Unexpected error while processing lookupObjectById call for incoming message'); | ||
throw e; | ||
@@ -133,34 +131,32 @@ } | ||
export abstract class LookupObjectByUniqueCriteria extends LookupObject { | ||
// @ts-ignore | ||
public async process(msg, cfg, snapshot): Promise<any> { | ||
try { | ||
this.logger.info('Starting processing lookupObjectByCriteria action'); | ||
this.logger.trace('Incoming configuration: %j', cfg); | ||
this.logger.trace('Incoming message: %j', msg); | ||
this.logger.trace('Incoming snapshot: %j', snapshot); | ||
const criteria = await this.getCriteria(msg, cfg); | ||
const objectType = this.getType(cfg, msg); | ||
if (criteria === undefined || criteria === null) { | ||
this.logger.trace('Criteria is empty'); | ||
this.logger.debug('Criteria is empty'); | ||
if (this.isOmittedCriteriaAllowed(cfg, msg)) { | ||
this.logger.trace('Empty criteria allowed, returning empty object'); | ||
this.logger.debug('Empty criteria allowed, returning empty object'); | ||
this.logger.info('Finished processing lookupObjectByCriteria action'); | ||
return messages.newEmptyMessage(); | ||
} | ||
this.logger.trace('Empty criteria is not allowed throwing error'); | ||
this.logger.debug('Empty criteria is not allowed throwing error'); | ||
throw new Error('Empty criteria is not allowed.'); | ||
} | ||
const result = await this.lookupObject(criteria, objectType, cfg, msg); | ||
this.logger.trace('Result of lookup: %j', result); | ||
this.logger.debug('Result of lookup is received'); | ||
if (result === null) { | ||
this.logger.trace('Object not found for criteria: %j', criteria); | ||
this.logger.debug('Object not found for specified criteria'); | ||
if (this.isEmptyResultAllowed(cfg, msg)) { | ||
this.logger.trace('Empty result allowed, returning empty object'); | ||
this.logger.debug('Empty result allowed, returning empty object'); | ||
this.logger.info('Finished processing lookupObjectByCriteria action'); | ||
return messages.newEmptyMessage(); | ||
} | ||
this.logger.trace('Empty result not allowed, throwing error'); | ||
this.logger.debug('Empty result not allowed, throwing error'); | ||
throw new Error('Object with provided criteria not found. Empty result is not allowed.'); | ||
} | ||
if (result instanceof Array && result.length > 1) { | ||
this.logger.trace('Found more than 1 object for criteria: %j, throwing error', criteria); | ||
this.logger.debug('Found more than 1 object for specified criteria, throwing error'); | ||
throw new Error('Found more than 1 object for the provided criteria'); | ||
@@ -171,3 +167,3 @@ } | ||
} catch (e) { | ||
this.logger.error('Unexpected error while processing lookupObjectByCriteria call for incoming message', e); | ||
this.logger.error('Unexpected error while processing lookupObjectByCriteria call for incoming message'); | ||
throw e; | ||
@@ -174,0 +170,0 @@ } |
@@ -26,9 +26,6 @@ "use strict"; | ||
this.logger.info('Starting processing lookupObjects action'); | ||
this.logger.trace('Incoming configuration: %j', cfg); | ||
this.logger.trace('Incoming message: %j', msg); | ||
this.logger.trace('Incoming snapshot: %j', snapshot); | ||
const objectType = this.getObjectType(cfg, msg); | ||
this.logger.trace('Object type: %j', objectType); | ||
const criteria = this.getCriteria(msg, cfg); | ||
this.logger.trace('Search criteria: %j', criteria); | ||
this.logger.debug('Search criteria is received'); | ||
await this.lookupObjects(objectType, criteria, msg, cfg); | ||
@@ -38,3 +35,3 @@ this.logger.info('Finished processing call to lookupObjects action'); | ||
catch (e) { | ||
this.logger.error('Unexpected error while processing lookupObjects call for incoming message', e); | ||
this.logger.error('Unexpected error while processing lookupObjects call for incoming message'); | ||
throw e; | ||
@@ -57,3 +54,3 @@ } | ||
const results = await this.getObjectsByCriteria(objectType, criteria, msg, cfg); | ||
this.logger.trace('Results from lookup: %j', results); | ||
this.logger.debug('Results from lookup are received'); | ||
if (results.length > maxResultSize) { | ||
@@ -67,3 +64,3 @@ throw new Error('Too many results'); | ||
const results = await this.getObjectsByCriteria(objectType, criteria, msg, cfg); | ||
this.logger.trace('Results from lookup: %j', results); | ||
this.logger.debug('Results from lookup are received'); | ||
for (const result of results) { | ||
@@ -82,3 +79,3 @@ await this.context.emit('data', this.wrapToMessageEmitIndividually(result)); | ||
const results = await this.getPageOfObjectsByCriteria(objectType, criteria, msg, cfg, { pageSize, start: pageSize * pageNumber, orderBy: orderByTerms }); | ||
this.logger.trace('Results from lookup: %j', results); | ||
this.logger.debug('Results from lookup are received'); | ||
for (const result of results) { | ||
@@ -336,3 +333,3 @@ await this.context.emit('data', this.wrapToMessageFetchPage(result)); | ||
} | ||
this.logger.trace('Generated input metadata: %j', inMetadata); | ||
this.logger.debug('Input metadata is generated'); | ||
return inMetadata; | ||
@@ -339,0 +336,0 @@ } |
@@ -102,5 +102,2 @@ /* eslint-disable no-param-reassign */ | ||
this.logger.info('Starting processing lookupObjects action'); | ||
this.logger.trace('Incoming configuration: %j', cfg); | ||
this.logger.trace('Incoming message: %j', msg); | ||
this.logger.trace('Incoming snapshot: %j', snapshot); | ||
@@ -111,7 +108,7 @@ const objectType = this.getObjectType(cfg, msg); | ||
const criteria = this.getCriteria(msg, cfg); | ||
this.logger.trace('Search criteria: %j', criteria); | ||
this.logger.debug('Search criteria is received'); | ||
await this.lookupObjects(objectType, criteria, msg, cfg); | ||
this.logger.info('Finished processing call to lookupObjects action'); | ||
} catch (e) { | ||
this.logger.error('Unexpected error while processing lookupObjects call for incoming message', e); | ||
this.logger.error('Unexpected error while processing lookupObjects call for incoming message'); | ||
throw e; | ||
@@ -136,3 +133,3 @@ } | ||
const results = await this.getObjectsByCriteria(objectType, criteria, msg, cfg); | ||
this.logger.trace('Results from lookup: %j', results); | ||
this.logger.debug('Results from lookup are received'); | ||
@@ -147,3 +144,3 @@ if (results.length > maxResultSize) { | ||
const results = await this.getObjectsByCriteria(objectType, criteria, msg, cfg); | ||
this.logger.trace('Results from lookup: %j', results); | ||
this.logger.debug('Results from lookup are received'); | ||
for (const result of results) { | ||
@@ -165,3 +162,3 @@ await this.context.emit('data', this.wrapToMessageEmitIndividually(result)); | ||
const results = await this.getPageOfObjectsByCriteria(objectType, criteria, msg, cfg, { pageSize, start: pageSize * pageNumber, orderBy: orderByTerms }); | ||
this.logger.trace('Results from lookup: %j', results); | ||
this.logger.debug('Results from lookup are received'); | ||
@@ -432,5 +429,5 @@ for (const result of results) { | ||
} | ||
this.logger.trace('Generated input metadata: %j', inMetadata); | ||
this.logger.debug('Input metadata is generated'); | ||
return inMetadata; | ||
} | ||
} |
@@ -40,8 +40,6 @@ "use strict"; | ||
class LookupSetOfObjectsSingleField extends LookupSetOfObjects { | ||
// @ts-ignore | ||
async process(msg, cfg, snapshot) { | ||
try { | ||
this.logger.info('Starting processing LookupSetOfObjects - Single Field action'); | ||
this.logger.trace('Incoming configuration: %j', cfg); | ||
this.logger.trace('Incoming message: %j', msg); | ||
this.logger.trace('Incoming snapshot: %j', snapshot); | ||
const objectType = this.getType(cfg, msg); | ||
@@ -62,3 +60,2 @@ const criteriaFieldName = this.getCriteriaFieldName(msg, cfg); | ||
this.logger.info(`Will lookup ${itemsToLookup.length} unique items from an incoming set of ${duplicatedItemsToLookup.length}`); | ||
this.logger.debug(`Will lookup the following values: ${JSON.stringify(itemsToLookup)}`); | ||
const searchResults = await this.lookupSetOfObjects(criteriaFieldName, objectType, itemsToLookup, cfg, msg); | ||
@@ -100,3 +97,3 @@ const itemsWithoutMatchingResults = []; | ||
catch (e) { | ||
this.logger.error('Unexpected error while processing LookupSetOfObjects call for incoming message', e); | ||
this.logger.error('Unexpected error while processing LookupSetOfObjects call for incoming message'); | ||
throw e; | ||
@@ -103,0 +100,0 @@ } |
@@ -67,8 +67,6 @@ import { | ||
export abstract class LookupSetOfObjectsSingleField extends LookupSetOfObjects { | ||
// @ts-ignore | ||
public async process(msg, cfg, snapshot): Promise<any> { | ||
try { | ||
this.logger.info('Starting processing LookupSetOfObjects - Single Field action'); | ||
this.logger.trace('Incoming configuration: %j', cfg); | ||
this.logger.trace('Incoming message: %j', msg); | ||
this.logger.trace('Incoming snapshot: %j', snapshot); | ||
@@ -95,3 +93,2 @@ const objectType = this.getType(cfg, msg); | ||
this.logger.info(`Will lookup ${itemsToLookup.length} unique items from an incoming set of ${duplicatedItemsToLookup.length}`); | ||
this.logger.debug(`Will lookup the following values: ${JSON.stringify(itemsToLookup)}`); | ||
@@ -139,3 +136,3 @@ const searchResults = await this.lookupSetOfObjects(criteriaFieldName, objectType, itemsToLookup, cfg, msg); | ||
} catch (e) { | ||
this.logger.error('Unexpected error while processing LookupSetOfObjects call for incoming message', e); | ||
this.logger.error('Unexpected error while processing LookupSetOfObjects call for incoming message'); | ||
throw e; | ||
@@ -142,0 +139,0 @@ } |
@@ -15,8 +15,6 @@ "use strict"; | ||
*/ | ||
// @ts-ignore | ||
async process(msg, cfg, snapshot) { | ||
try { | ||
this.logger.info('Starting processing Upsert object action'); | ||
this.logger.trace('Incoming configuration: %j', cfg); | ||
this.logger.trace('Incoming message: %j', msg); | ||
this.logger.trace('Incoming snapshot: %j', snapshot); | ||
const type = await this.getType(cfg, msg); | ||
@@ -37,6 +35,5 @@ this.logger.info('Object type: %j is found', type); | ||
const object = await this.getObjectFromMessage(msg, cfg); | ||
this.logger.trace('The object for an upsert', object); | ||
this.logger.debug('The object for an upsert are received'); | ||
if (existingObject) { | ||
this.logger.info('The object has already existed, starting the update'); | ||
this.logger.trace('The existing object: %j', existingObject); | ||
resultObject = await this.updateObject(criteria, type, object, cfg, msg, existingObject); | ||
@@ -52,3 +49,3 @@ } | ||
} | ||
this.logger.trace('Successfully process upsert call for object: %j and type: %j', resultObject, type); | ||
this.logger.debug('Successfully process upsert call for object with type: %j', type); | ||
this.logger.info('Finished processing upsert object action'); | ||
@@ -58,3 +55,3 @@ return messages.newMessageWithBody(resultObject); | ||
catch (e) { | ||
this.logger.error('Unexpected error while processing create call for incoming message', e); | ||
this.logger.error('Unexpected error while processing create call for incoming message'); | ||
throw e; | ||
@@ -61,0 +58,0 @@ } |
@@ -14,8 +14,6 @@ import { ID, UNIQUE_CRITERIA } from '../constants'; | ||
*/ | ||
// @ts-ignore | ||
public async process(msg, cfg, snapshot): Promise<any> { | ||
try { | ||
this.logger.info('Starting processing Upsert object action'); | ||
this.logger.trace('Incoming configuration: %j', cfg); | ||
this.logger.trace('Incoming message: %j', msg); | ||
this.logger.trace('Incoming snapshot: %j', snapshot); | ||
const type = await this.getType(cfg, msg); | ||
@@ -35,6 +33,5 @@ this.logger.info('Object type: %j is found', type); | ||
const object = await this.getObjectFromMessage(msg, cfg); | ||
this.logger.trace('The object for an upsert', object); | ||
this.logger.debug('The object for an upsert are received'); | ||
if (existingObject) { | ||
this.logger.info('The object has already existed, starting the update'); | ||
this.logger.trace('The existing object: %j', existingObject); | ||
resultObject = await this.updateObject(criteria, type, object, cfg, msg, existingObject); | ||
@@ -50,7 +47,7 @@ } else { | ||
} | ||
this.logger.trace('Successfully process upsert call for object: %j and type: %j', resultObject, type); | ||
this.logger.debug('Successfully process upsert call for object with type: %j', type); | ||
this.logger.info('Finished processing upsert object action'); | ||
return messages.newMessageWithBody(resultObject); | ||
} catch (e) { | ||
this.logger.error('Unexpected error while processing create call for incoming message', e); | ||
this.logger.error('Unexpected error while processing create call for incoming message'); | ||
throw e; | ||
@@ -57,0 +54,0 @@ } |
@@ -20,4 +20,2 @@ "use strict"; | ||
this.logger.info('Starting processing Polling trigger'); | ||
this.logger.trace('Incoming configuration: %j', cfg); | ||
this.logger.trace('Incoming snapshot: %j', snapshot); | ||
const startTime = this.getStartTime(cfg, snapshot); | ||
@@ -32,3 +30,2 @@ const endTime = this.getEndTime(cfg); | ||
this.logger.debug('Finish object polling'); | ||
this.logger.trace('Polled objects: %j', result); | ||
if (result === undefined || result === null || result.length === 0) { | ||
@@ -47,3 +44,2 @@ this.logger.debug('No new or updated objects was found'); | ||
this.logger.debug('Finish object polling'); | ||
this.logger.trace('Polled objects: %j', result); | ||
if (result === undefined || result === null || result.length === 0) { | ||
@@ -88,3 +84,2 @@ this.logger.debug('No new or updated objects was found'); | ||
this.logger.debug('Start emitting snapshot'); | ||
this.logger.trace('Snapshot to be emitted: %j', snapshot); | ||
this.context.emit('snapshot', snapshot); | ||
@@ -95,3 +90,3 @@ this.logger.debug('Finish emitting snapshot'); | ||
catch (e) { | ||
this.logger.error('Unexpected error while processing Polling Trigger call', e); | ||
this.logger.error('Unexpected error while processing Polling Trigger call'); | ||
throw e; | ||
@@ -209,3 +204,2 @@ } | ||
this.logger.debug('Finish object polling for page'); | ||
this.logger.trace('Polled next page and objects: %j', result); | ||
const { objects } = result; | ||
@@ -225,6 +219,6 @@ await this.emitAll(objects); | ||
if (r === null || r === undefined) { | ||
this.logger.trace('Not emitting result with empty body, result was: %j', r); | ||
this.logger.debug('Not emitting result with empty body'); | ||
} | ||
else { | ||
this.logger.trace('Emitting new message with body: %j', r); | ||
this.logger.debug('Emitting new message'); | ||
await this.context.emit('data', messages.newMessageWithBody(r)); | ||
@@ -242,6 +236,6 @@ } | ||
if (results === null || results === undefined || results.length === 0) { | ||
this.logger.trace('Not emitting result with empty body, results was: %j', results); | ||
this.logger.debug('Not emitting result with empty body'); | ||
return; | ||
} | ||
this.logger.trace('Emitting new message with body: %j', results); | ||
this.logger.debug('Emitting new message'); | ||
await this.context.emit('data', messages.newMessageWithBody({ results })); | ||
@@ -248,0 +242,0 @@ this.logger.debug('Finished emitting data'); |
@@ -26,4 +26,2 @@ import { | ||
this.logger.info('Starting processing Polling trigger'); | ||
this.logger.trace('Incoming configuration: %j', cfg); | ||
this.logger.trace('Incoming snapshot: %j', snapshot); | ||
const startTime = this.getStartTime(cfg, snapshot); | ||
@@ -38,3 +36,2 @@ const endTime = this.getEndTime(cfg); | ||
this.logger.debug('Finish object polling'); | ||
this.logger.trace('Polled objects: %j', result); | ||
if (result === undefined || result === null || result.length === 0) { | ||
@@ -53,3 +50,2 @@ this.logger.debug('No new or updated objects was found'); | ||
this.logger.debug('Finish object polling'); | ||
this.logger.trace('Polled objects: %j', result); | ||
if (result === undefined || result === null || result.length === 0) { | ||
@@ -94,3 +90,2 @@ this.logger.debug('No new or updated objects was found'); | ||
this.logger.debug('Start emitting snapshot'); | ||
this.logger.trace('Snapshot to be emitted: %j', snapshot); | ||
this.context.emit('snapshot', snapshot); | ||
@@ -100,3 +95,3 @@ this.logger.debug('Finish emitting snapshot'); | ||
} catch (e) { | ||
this.logger.error('Unexpected error while processing Polling Trigger call', e); | ||
this.logger.error('Unexpected error while processing Polling Trigger call'); | ||
throw e; | ||
@@ -223,3 +218,2 @@ } | ||
this.logger.debug('Finish object polling for page'); | ||
this.logger.trace('Polled next page and objects: %j', result); | ||
const { objects } = result; | ||
@@ -240,5 +234,5 @@ await this.emitAll(objects); | ||
if (r === null || r === undefined) { | ||
this.logger.trace('Not emitting result with empty body, result was: %j', r); | ||
this.logger.debug('Not emitting result with empty body'); | ||
} else { | ||
this.logger.trace('Emitting new message with body: %j', r); | ||
this.logger.debug('Emitting new message'); | ||
await this.context.emit('data', messages.newMessageWithBody(r)); | ||
@@ -257,6 +251,6 @@ } | ||
if (results === null || results === undefined || results.length === 0) { | ||
this.logger.trace('Not emitting result with empty body, results was: %j', results); | ||
this.logger.debug('Not emitting result with empty body'); | ||
return; | ||
} | ||
this.logger.trace('Emitting new message with body: %j', results); | ||
this.logger.debug('Emitting new message'); | ||
await this.context.emit('data', messages.newMessageWithBody({ results })); | ||
@@ -263,0 +257,0 @@ this.logger.debug('Finished emitting data'); |
@@ -20,7 +20,5 @@ "use strict"; | ||
*/ | ||
// @ts-ignore | ||
async process(msg, cfg, snapshot) { | ||
this.logger.info('Starting processing webhook message'); | ||
this.logger.trace('Incoming configuration: %j', cfg); | ||
this.logger.trace('Incoming message: %j', msg); | ||
this.logger.trace('Incoming snapshot: %j', snapshot); | ||
return elasticio_node_1.messages.newMessageWithBody(msg.body); | ||
@@ -37,3 +35,2 @@ } | ||
log.info('Startup hook started'); | ||
log.trace('Input configuration: %j', cfg); | ||
const result = await this.handleWebhookSubscriptionStrategy.subscribe(cfg); | ||
@@ -53,4 +50,2 @@ log.info('Startup hook finished'); | ||
log.info('Shutdown hook started'); | ||
log.trace('Input configuration: %j', cfg); | ||
log.trace('Data from startup hook: %j', startupData); | ||
await this.handleWebhookSubscriptionStrategy.unsubscribe(cfg, startupData); | ||
@@ -68,7 +63,5 @@ log.info('Shutdown hook finished'); | ||
*/ | ||
// @ts-ignore | ||
async function defaultProcessWebhook(msg, cfg, snapshot) { | ||
this.logger.info('Starting processing webhook message'); | ||
this.logger.trace('Incoming configuration: %j', cfg); | ||
this.logger.trace('Incoming message: %j', msg); | ||
this.logger.trace('Incoming snapshot: %j', snapshot); | ||
return elasticio_node_1.messages.newMessageWithBody(msg.body); | ||
@@ -75,0 +68,0 @@ } |
@@ -54,7 +54,5 @@ // eslint-disable-next-line max-classes-per-file | ||
*/ | ||
// @ts-ignore | ||
public async process(msg, cfg, snapshot): Promise<any> { | ||
this.logger.info('Starting processing webhook message'); | ||
this.logger.trace('Incoming configuration: %j', cfg); | ||
this.logger.trace('Incoming message: %j', msg); | ||
this.logger.trace('Incoming snapshot: %j', snapshot); | ||
return messages.newMessageWithBody(msg.body); | ||
@@ -72,3 +70,2 @@ } | ||
log.info('Startup hook started'); | ||
log.trace('Input configuration: %j', cfg); | ||
const result = await this.handleWebhookSubscriptionStrategy.subscribe(cfg); | ||
@@ -89,4 +86,2 @@ log.info('Startup hook finished'); | ||
log.info('Shutdown hook started'); | ||
log.trace('Input configuration: %j', cfg); | ||
log.trace('Data from startup hook: %j', startupData); | ||
await this.handleWebhookSubscriptionStrategy.unsubscribe(cfg, startupData); | ||
@@ -104,7 +99,5 @@ log.info('Shutdown hook finished'); | ||
*/ | ||
// @ts-ignore | ||
export async function defaultProcessWebhook(msg, cfg, snapshot): Promise<any> { | ||
this.logger.info('Starting processing webhook message'); | ||
this.logger.trace('Incoming configuration: %j', cfg); | ||
this.logger.trace('Incoming message: %j', msg); | ||
this.logger.trace('Incoming snapshot: %j', snapshot); | ||
return messages.newMessageWithBody(msg.body); | ||
@@ -111,0 +104,0 @@ } |
{ | ||
"name": "@elastic.io/oih-standard-library", | ||
"version": "1.1.2", | ||
"version": "1.1.3", | ||
"description": "Library for OIH standards implementation", | ||
@@ -5,0 +5,0 @@ "author": { |
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
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
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
219541
3340