@elastic.io/oih-standard-library
Advanced tools
Comparing version 1.0.0-rc3 to 1.0.0-rc4
@@ -39,14 +39,2 @@ export declare abstract class Delete { | ||
getId(msg: any, cfg: any): any; | ||
/** | ||
* Method must return structure with object to be deleted and number of found objects for provided id. In most cases you will need just id, type and cfg. | ||
* @param id of object to be deleted. | ||
* @param type of object to be deleted. | ||
* @param cfg input configuration, for example with credentials. | ||
* @param msg input message. | ||
* @returns object to be deleted and number of found objects. | ||
*/ | ||
abstract findObjectById(id: any, type: any, cfg: any, msg: any): Promise<{ | ||
object: any; | ||
numberOfObjects: number; | ||
}>; | ||
} | ||
@@ -53,0 +41,0 @@ export declare abstract class DeleteByUniqueCriteria extends Delete { |
@@ -31,14 +31,3 @@ "use strict"; | ||
this.logger.trace('Id: %j and type: %j of object to be deleted', id, type); | ||
const foundObject = await this.findObjectById(id, type, cfg, msg); | ||
if (foundObject.numberOfObjects > 1) { | ||
throw new Error('Found more than 1 object for provided id: ' + JSON.stringify(id) + ' number of objects found: ' + JSON.stringify(foundObject.numberOfObjects)); | ||
} | ||
if (foundObject.numberOfObjects === 0) { | ||
this.logger.trace('No objects for id: %j and type: %j, were found returning empty object', id, type); | ||
this.logger.info('Finished processing deleteById action'); | ||
return {}; | ||
} | ||
const { object } = foundObject; | ||
this.logger.trace('Start deleting object: %j', object); | ||
const deletedId = await this.deleteObject(object, cfg, msg); | ||
const deletedId = await this.deleteObject(id, cfg, msg); | ||
if (deletedId === null) { | ||
@@ -45,0 +34,0 @@ this.logger.trace('Object with ID: %j and type: %j was not deleted or not found. Returning empty object', id, type); |
@@ -53,14 +53,3 @@ import { id, objectType, uniqueCriteria } from '../constants'; | ||
this.logger.trace('Id: %j and type: %j of object to be deleted', id, type); | ||
const foundObject = await this.findObjectById(id, type, cfg, msg); | ||
if (foundObject.numberOfObjects > 1) { | ||
throw new Error('Found more than 1 object for provided id: ' + JSON.stringify(id) + ' number of objects found: ' + JSON.stringify(foundObject.numberOfObjects)); | ||
} | ||
if (foundObject.numberOfObjects === 0) { | ||
this.logger.trace('No objects for id: %j and type: %j, were found returning empty object', id, type); | ||
this.logger.info('Finished processing deleteById action'); | ||
return {}; | ||
} | ||
const { object } = foundObject; | ||
this.logger.trace('Start deleting object: %j', object); | ||
const deletedId = await this.deleteObject(object, cfg, msg); | ||
const deletedId = await this.deleteObject(id, cfg, msg); | ||
if (deletedId === null) { | ||
@@ -92,17 +81,2 @@ this.logger.trace('Object with ID: %j and type: %j was not deleted or not found. Returning empty object', id, type); | ||
} | ||
/** | ||
* Method must return structure with object to be deleted and number of found objects for provided id. In most cases you will need just id, type and cfg. | ||
* @param id of object to be deleted. | ||
* @param type of object to be deleted. | ||
* @param cfg input configuration, for example with credentials. | ||
* @param msg input message. | ||
* @returns object to be deleted and number of found objects. | ||
*/ | ||
public async abstract findObjectById(id: any, type: any, cfg: any, msg: any): Promise<{ | ||
object: any, | ||
numberOfObjects: number, | ||
}>; | ||
} | ||
@@ -109,0 +83,0 @@ |
{ | ||
"name": "@elastic.io/oih-standard-library", | ||
"version": "1.0.0-rc3", | ||
"version": "1.0.0-rc4", | ||
"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
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
39776
330