Skip to content

Commit

Permalink
Add delete method to alertTypeRegistry
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron Caldwell committed Dec 8, 2020
1 parent df20712 commit 0f56aea
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,26 @@ export class TypeRegistry<T extends BaseObjectType> {
return this.objectTypes.get(id)!;
}

/**
* Deletes an object type in the type registry
*/
public delete(id: string): void {
if (!this.has(id)) {
throw new Error(
i18n.translate(
'xpack.triggersActionsUI.typeRegistry.delete.missingActionTypeErrorMessage',
{
defaultMessage: 'Object type "{id}" is not registered.',
values: {
id,
},
}
)
);
}
this.objectTypes.delete(id);
}

public list() {
return Array.from(this.objectTypes).map(([id, objectType]) => objectType);
}
Expand Down

0 comments on commit 0f56aea

Please sign in to comment.