@elastic.io/oih-standard-library
Advanced tools
Comparing version 1.1.1 to 1.1.2-pre1
@@ -0,1 +1,4 @@ | ||
# 1.1.2 | ||
Don't log sensitive data | ||
Update dependencies | ||
# 1.1.1 (July 3,2020) | ||
@@ -2,0 +5,0 @@ Pass the existing object to update object |
@@ -28,3 +28,3 @@ "use strict"; | ||
if (!resultObject || resultObject === null) { | ||
this.logger.error('Got empty object on create call for message: %j', msg); | ||
this.logger.error('Got empty object on create call for incoming message'); | ||
throw new Error('Got empty object on create'); | ||
@@ -37,3 +37,3 @@ } | ||
catch (e) { | ||
this.logger.error('Unexpected error while processing create call for message: %j', msg, e); | ||
this.logger.error('Unexpected error while processing create call for incoming message', e); | ||
throw e; | ||
@@ -40,0 +40,0 @@ } |
@@ -30,3 +30,3 @@ import { OBJECT_TYPE } from '../constants'; | ||
if (!resultObject || resultObject === null) { | ||
this.logger.error('Got empty object on create call for message: %j', msg); | ||
this.logger.error('Got empty object on create call for incoming message'); | ||
throw new Error('Got empty object on create'); | ||
@@ -38,3 +38,3 @@ } | ||
} catch (e) { | ||
this.logger.error('Unexpected error while processing create call for message: %j', msg, e); | ||
this.logger.error('Unexpected error while processing create call for incoming message', e); | ||
throw e; | ||
@@ -41,0 +41,0 @@ } |
@@ -44,3 +44,3 @@ "use strict"; | ||
catch (e) { | ||
this.logger.error('Unexpected error while processing delete call for message: %j', msg, e); | ||
this.logger.error('Unexpected error while processing delete call for incoming message', e); | ||
throw e; | ||
@@ -74,3 +74,3 @@ } | ||
if (foundObject.numberOfObjects > 1) { | ||
throw new Error(`Found more than 1 object for provided criteria: ${JSON.stringify(criteria)}`); | ||
throw new Error('Found more than 1 object for provided criteria.'); | ||
} | ||
@@ -95,3 +95,3 @@ if (foundObject.numberOfObjects === 0) { | ||
catch (e) { | ||
this.logger.error('Unexpected error while processing delete call for message: %j', msg, e); | ||
this.logger.error('Unexpected error while processing delete call for incoming message', e); | ||
throw e; | ||
@@ -98,0 +98,0 @@ } |
@@ -63,3 +63,3 @@ import { ID, OBJECT_TYPE, UNIQUE_CRITERIA } from '../constants'; | ||
} catch (e) { | ||
this.logger.error('Unexpected error while processing delete call for message: %j', msg, e); | ||
this.logger.error('Unexpected error while processing delete call for incoming message', e); | ||
throw e; | ||
@@ -94,3 +94,3 @@ } | ||
if (foundObject.numberOfObjects > 1) { | ||
throw new Error(`Found more than 1 object for provided criteria: ${JSON.stringify(criteria)}`); | ||
throw new Error('Found more than 1 object for provided criteria.'); | ||
} | ||
@@ -114,3 +114,3 @@ if (foundObject.numberOfObjects === 0) { | ||
} catch (e) { | ||
this.logger.error('Unexpected error while processing delete call for message: %j', msg, e); | ||
this.logger.error('Unexpected error while processing delete call for incoming message', e); | ||
throw e; | ||
@@ -117,0 +117,0 @@ } |
@@ -83,3 +83,3 @@ "use strict"; | ||
this.logger.trace('Empty result not allowed, throwing error'); | ||
throw new Error(`Object with id: ${JSON.stringify(id)} not found. Empty result is not allowed.`); | ||
throw new Error('Object with provided id not found. Empty result is not allowed.'); | ||
} | ||
@@ -90,3 +90,3 @@ this.logger.info('Finished processing lookupObjectById action'); | ||
catch (e) { | ||
this.logger.error('Unexpected error while processing lookupObjectById call for message: %j, cfg: %j', msg, cfg, e); | ||
this.logger.error('Unexpected error while processing lookupObjectById call for incoming message', e); | ||
throw e; | ||
@@ -137,7 +137,7 @@ } | ||
this.logger.trace('Empty result not allowed, throwing error'); | ||
throw new Error(`Object with criteria: ${JSON.stringify(criteria)} not found. Empty result is not allowed.`); | ||
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); | ||
throw new Error(`Found more than 1 object for criteria: ${JSON.stringify(criteria)}`); | ||
throw new Error('Found more than 1 object for the provided criteria'); | ||
} | ||
@@ -148,3 +148,3 @@ this.logger.info('Finished processing lookupObjectByCriteria action'); | ||
catch (e) { | ||
this.logger.error('Unexpected error while processing lookupObjectByCriteria call for message: %j, cfg: %j', msg, cfg, e); | ||
this.logger.error('Unexpected error while processing lookupObjectByCriteria call for incoming message', e); | ||
throw e; | ||
@@ -151,0 +151,0 @@ } |
@@ -107,3 +107,3 @@ import { | ||
this.logger.trace('Empty result not allowed, throwing error'); | ||
throw new Error(`Object with id: ${JSON.stringify(id)} not found. Empty result is not allowed.`); | ||
throw new Error('Object with provided id not found. Empty result is not allowed.'); | ||
} | ||
@@ -113,3 +113,3 @@ this.logger.info('Finished processing lookupObjectById action'); | ||
} catch (e) { | ||
this.logger.error('Unexpected error while processing lookupObjectById call for message: %j, cfg: %j', msg, cfg, e); | ||
this.logger.error('Unexpected error while processing lookupObjectById call for incoming message', e); | ||
throw e; | ||
@@ -161,7 +161,7 @@ } | ||
this.logger.trace('Empty result not allowed, throwing error'); | ||
throw new Error(`Object with criteria: ${JSON.stringify(criteria)} not found. Empty result is not allowed.`); | ||
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); | ||
throw new Error(`Found more than 1 object for criteria: ${JSON.stringify(criteria)}`); | ||
throw new Error('Found more than 1 object for the provided criteria'); | ||
} | ||
@@ -171,3 +171,3 @@ this.logger.info('Finished processing lookupObjectByCriteria action'); | ||
} catch (e) { | ||
this.logger.error('Unexpected error while processing lookupObjectByCriteria call for message: %j, cfg: %j', msg, cfg, e); | ||
this.logger.error('Unexpected error while processing lookupObjectByCriteria call for incoming message', e); | ||
throw e; | ||
@@ -174,0 +174,0 @@ } |
@@ -37,3 +37,3 @@ "use strict"; | ||
catch (e) { | ||
this.logger.error('Unexpected error while processing lookupObjects call for message: %j, cfg: %j', msg, cfg, e); | ||
this.logger.error('Unexpected error while processing lookupObjects call for incoming message', e); | ||
throw e; | ||
@@ -40,0 +40,0 @@ } |
@@ -114,3 +114,3 @@ /* eslint-disable no-param-reassign */ | ||
} catch (e) { | ||
this.logger.error('Unexpected error while processing lookupObjects call for message: %j, cfg: %j', msg, cfg, e); | ||
this.logger.error('Unexpected error while processing lookupObjects call for incoming message', e); | ||
throw e; | ||
@@ -117,0 +117,0 @@ } |
@@ -82,13 +82,13 @@ "use strict"; | ||
if (itemsWithoutMatchingResults.length > 0) { | ||
const missingItemList = itemsWithoutMatchingResults.join(', '); | ||
const missingItemListSize = itemsWithoutMatchingResults.length; | ||
if (cfg[constants_1.WAIT_FOR_OBJECT_TO_EXIST]) { | ||
this.logger.info(`No matching item found for ${missingItemList} Emitting rebound...`); | ||
this.emitter.emit('rebound', new Error(`No matching item found for ${missingItemList}`)); | ||
this.logger.info(`No matching item found for ${missingItemListSize} item(s). Emitting rebound...`); | ||
this.emitter.emit('rebound', new Error(`No matching item found for ${missingItemListSize} item(s).`)); | ||
return; | ||
} | ||
this.logger.info(`No matching item found for ${missingItemList} Rebound behavior not set.`); | ||
throw new Error(`No matching item found for ${missingItemList}`); | ||
this.logger.info(`No matching item found for ${missingItemListSize} item(s). Rebound behavior not set.`); | ||
throw new Error(`No matching item found for ${missingItemListSize} item(s).`); | ||
} | ||
if (itemsWithDoubleResults.length > 0) { | ||
throw new Error(`More than one matching item found for ${itemsWithDoubleResults.join(', ')}`); | ||
throw new Error(`More than one matching item found for ${itemsWithDoubleResults.length} item(s).`); | ||
} | ||
@@ -99,3 +99,3 @@ this.logger.info('Finished processing LookupSetOfObjects action'); | ||
catch (e) { | ||
this.logger.error('Unexpected error while processing LookupSetOfObjects call for message: %j, cfg: %j', msg, cfg, e); | ||
this.logger.error('Unexpected error while processing LookupSetOfObjects call for incoming message', e); | ||
throw e; | ||
@@ -102,0 +102,0 @@ } |
@@ -120,14 +120,14 @@ import { | ||
if (itemsWithoutMatchingResults.length > 0) { | ||
const missingItemList = itemsWithoutMatchingResults.join(', '); | ||
const missingItemListSize = itemsWithoutMatchingResults.length; | ||
if (cfg[WAIT_FOR_OBJECT_TO_EXIST]) { | ||
this.logger.info(`No matching item found for ${missingItemList} Emitting rebound...`); | ||
this.emitter.emit('rebound', new Error(`No matching item found for ${missingItemList}`)); | ||
this.logger.info(`No matching item found for ${missingItemListSize} item(s). Emitting rebound...`); | ||
this.emitter.emit('rebound', new Error(`No matching item found for ${missingItemListSize} item(s).`)); | ||
return; | ||
} | ||
this.logger.info(`No matching item found for ${missingItemList} Rebound behavior not set.`); | ||
throw new Error(`No matching item found for ${missingItemList}`); | ||
this.logger.info(`No matching item found for ${missingItemListSize} item(s). Rebound behavior not set.`); | ||
throw new Error(`No matching item found for ${missingItemListSize} item(s).`); | ||
} | ||
if (itemsWithDoubleResults.length > 0) { | ||
throw new Error(`More than one matching item found for ${itemsWithDoubleResults.join(', ')}`); | ||
throw new Error(`More than one matching item found for ${itemsWithDoubleResults.length} item(s).`); | ||
} | ||
@@ -138,3 +138,3 @@ | ||
} catch (e) { | ||
this.logger.error('Unexpected error while processing LookupSetOfObjects call for message: %j, cfg: %j', msg, cfg, e); | ||
this.logger.error('Unexpected error while processing LookupSetOfObjects call for incoming message', e); | ||
throw e; | ||
@@ -141,0 +141,0 @@ } |
@@ -27,3 +27,3 @@ "use strict"; | ||
if (criteria) { | ||
this.logger.info('Found search criteria: %j, starting to lookup object by this criteria', criteria); | ||
this.logger.info('Found search criteria: Starting to lookup object by this criteria'); | ||
existingObject = await this.lookupObject(criteria, type, cfg, msg); | ||
@@ -48,3 +48,3 @@ } | ||
if (resultObject === null || !resultObject) { | ||
this.logger.error('Got empty object on upsert call for message: %j', msg); | ||
this.logger.error('Got empty object on upsert call for incoming message'); | ||
throw new Error('Got empty object on upsert'); | ||
@@ -57,3 +57,3 @@ } | ||
catch (e) { | ||
this.logger.error('Unexpected error while processing create call for message: %j', msg, e); | ||
this.logger.error('Unexpected error while processing create call for incoming message', e); | ||
throw e; | ||
@@ -60,0 +60,0 @@ } |
@@ -26,3 +26,3 @@ import { ID, UNIQUE_CRITERIA } from '../constants'; | ||
if (criteria) { | ||
this.logger.info('Found search criteria: %j, starting to lookup object by this criteria', criteria); | ||
this.logger.info('Found search criteria: Starting to lookup object by this criteria'); | ||
existingObject = await this.lookupObject(criteria, type, cfg, msg); | ||
@@ -46,3 +46,3 @@ } else { | ||
if (resultObject === null || !resultObject) { | ||
this.logger.error('Got empty object on upsert call for message: %j', msg); | ||
this.logger.error('Got empty object on upsert call for incoming message'); | ||
throw new Error('Got empty object on upsert'); | ||
@@ -54,3 +54,3 @@ } | ||
} catch (e) { | ||
this.logger.error('Unexpected error while processing create call for message: %j', msg, e); | ||
this.logger.error('Unexpected error while processing create call for incoming message', e); | ||
throw e; | ||
@@ -57,0 +57,0 @@ } |
@@ -91,3 +91,3 @@ "use strict"; | ||
catch (e) { | ||
this.logger.error('Unexpected error while processing Polling Trigger call for cfg: %j', cfg, e); | ||
this.logger.error('Unexpected error while processing Polling Trigger call', e); | ||
throw e; | ||
@@ -94,0 +94,0 @@ } |
@@ -96,3 +96,3 @@ import { | ||
} catch (e) { | ||
this.logger.error('Unexpected error while processing Polling Trigger call for cfg: %j', cfg, e); | ||
this.logger.error('Unexpected error while processing Polling Trigger call', e); | ||
throw e; | ||
@@ -99,0 +99,0 @@ } |
@@ -0,1 +1,23 @@ | ||
/** | ||
* The HandleSWebhookSubscriptionAbstractStrategy interface declares operations | ||
* to subscribe/unsubscribe to some webhook | ||
* | ||
* The Context uses this interface to call the algorithm defined by Concrete | ||
* Strategies. | ||
*/ | ||
export interface HandleSWebhookSubscriptionAbstractStrategy { | ||
/** | ||
* Subscribe to webhook of destination system | ||
* @param cfg incoming configuration | ||
* @returns {Promise<any>} must return promise | ||
*/ | ||
subscribe(cfg: any): Promise<any>; | ||
/** | ||
* Unsubscribe to webhook of destination system | ||
* @param cfg incoming configuration | ||
* @param startupResult result from the startup | ||
* @returns {Promise<void>} must return promise | ||
*/ | ||
unsubscribe(cfg: any, startupResult: any): Promise<void>; | ||
} | ||
export declare class Webhook { | ||
@@ -41,24 +63,2 @@ protected logger: any; | ||
/** | ||
* The HandleSWebhookSubscriptionAbstractStrategy interface declares operations | ||
* to subscribe/unsubscribe to some webhook | ||
* | ||
* The Context uses this interface to call the algorithm defined by Concrete | ||
* Strategies. | ||
*/ | ||
export interface HandleSWebhookSubscriptionAbstractStrategy { | ||
/** | ||
* Subscribe to webhook of destination system | ||
* @param cfg incoming configuration | ||
* @returns {Promise<any>} must return promise | ||
*/ | ||
subscribe(cfg: any): Promise<any>; | ||
/** | ||
* Unsubscribe to webhook of destination system | ||
* @param cfg incoming configuration | ||
* @param startupResult result from the startup | ||
* @returns {Promise<void>} must return promise | ||
*/ | ||
unsubscribe(cfg: any, startupResult: any): Promise<void>; | ||
} | ||
/** | ||
* HandleWebhookSubscriptionByIdAbstractStrategy implements algorithm of subscription management by webhook Id | ||
@@ -65,0 +65,0 @@ */ |
@@ -7,2 +7,27 @@ // eslint-disable-next-line max-classes-per-file | ||
/** | ||
* The HandleSWebhookSubscriptionAbstractStrategy interface declares operations | ||
* to subscribe/unsubscribe to some webhook | ||
* | ||
* The Context uses this interface to call the algorithm defined by Concrete | ||
* Strategies. | ||
*/ | ||
export interface HandleSWebhookSubscriptionAbstractStrategy { | ||
/** | ||
* Subscribe to webhook of destination system | ||
* @param cfg incoming configuration | ||
* @returns {Promise<any>} must return promise | ||
*/ | ||
subscribe(cfg): Promise<any>; | ||
/** | ||
* Unsubscribe to webhook of destination system | ||
* @param cfg incoming configuration | ||
* @param startupResult result from the startup | ||
* @returns {Promise<void>} must return promise | ||
*/ | ||
unsubscribe(cfg, startupResult): Promise<void>; | ||
} | ||
export class Webhook { | ||
@@ -86,27 +111,2 @@ protected logger; | ||
/** | ||
* The HandleSWebhookSubscriptionAbstractStrategy interface declares operations | ||
* to subscribe/unsubscribe to some webhook | ||
* | ||
* The Context uses this interface to call the algorithm defined by Concrete | ||
* Strategies. | ||
*/ | ||
export interface HandleSWebhookSubscriptionAbstractStrategy { | ||
/** | ||
* Subscribe to webhook of destination system | ||
* @param cfg incoming configuration | ||
* @returns {Promise<any>} must return promise | ||
*/ | ||
subscribe(cfg): Promise<any>; | ||
/** | ||
* Unsubscribe to webhook of destination system | ||
* @param cfg incoming configuration | ||
* @param startupResult result from the startup | ||
* @returns {Promise<void>} must return promise | ||
*/ | ||
unsubscribe(cfg, startupResult): Promise<void>; | ||
} | ||
/** | ||
* HandleWebhookSubscriptionByIdAbstractStrategy implements algorithm of subscription management by webhook Id | ||
@@ -113,0 +113,0 @@ */ |
{ | ||
"name": "@elastic.io/oih-standard-library", | ||
"version": "1.1.1", | ||
"version": "1.1.2-pre1", | ||
"description": "Library for OIH standards implementation", | ||
@@ -33,21 +33,21 @@ "author": { | ||
"@elastic.io/component-logger": "0.0.1", | ||
"@types/node": "14.0.13", | ||
"@types/node": "14.10.1", | ||
"elasticio-node": "0.0.9", | ||
"elasticio-rest-node": "1.2.6", | ||
"typescript": "3.9.5" | ||
"typescript": "4.0.2" | ||
}, | ||
"devDependencies": { | ||
"@types/mocha": "7.0.2", | ||
"@typescript-eslint/eslint-plugin": "3.2.0", | ||
"@typescript-eslint/parser": "3.2.0", | ||
"@types/mocha": "8.0.3", | ||
"@typescript-eslint/eslint-plugin": "4.1.0", | ||
"@typescript-eslint/parser": "4.1.0", | ||
"chai": "4.2.0", | ||
"chai-as-promised": "7.1.1", | ||
"eslint": "7.2.0", | ||
"eslint-config-airbnb": "18.1.0", | ||
"eslint": "7.9.0", | ||
"eslint-config-airbnb": "18.2.0", | ||
"eslint-config-airbnb-base": "14.2.0", | ||
"eslint-plugin-chai-friendly": "0.6.0", | ||
"eslint-plugin-import": "2.21.2", | ||
"mocha": "8.0.1", | ||
"sinon": "9.0.2", | ||
"ts-node": "8.10.2" | ||
"eslint-plugin-import": "2.22.0", | ||
"mocha": "8.1.3", | ||
"sinon": "9.0.3", | ||
"ts-node": "9.0.0" | ||
}, | ||
@@ -54,0 +54,0 @@ "repository": "elasticio/component-commons-library", |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
227313
2
+ Added@types/node@14.10.1(transitive)
+ Addedtypescript@4.0.2(transitive)
- Removed@types/node@14.0.13(transitive)
- Removedtypescript@3.9.5(transitive)
Updated@types/node@14.10.1
Updatedtypescript@4.0.2