Skip to content

Commit

Permalink
optimize the function name
Browse files Browse the repository at this point in the history
Signed-off-by: yubonluo <[email protected]>
  • Loading branch information
yubonluo committed Nov 21, 2024
1 parent f5ecb4f commit 1d13f30
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class WorkspaceIdConsumerWrapper {

// If the object.workspaces is null/[] (as global object), return it directly.
// If the workspace is specified, validate whether the object exists in the workspace.
private validateObjectExistInWorkspaces<T>(
private formatObjectForWorkspaceValidation<T>(
object: SavedObject<T>,
workspace: string
): SavedObject<T> {
Expand Down Expand Up @@ -160,7 +160,7 @@ export class WorkspaceIdConsumerWrapper {
return {
...objectToBulkGet,
saved_objects: objectToBulkGet.saved_objects.map((object) =>
this.validateObjectExistInWorkspaces(object, workspaces[0])
this.formatObjectForWorkspaceValidation(object, workspaces[0])
),
};
}
Expand All @@ -176,7 +176,10 @@ export class WorkspaceIdConsumerWrapper {
const { workspaces } = this.formatWorkspaceIdParams(wrapperOptions.request, options);

if (workspaces?.length === 1) {
const validatedObject = this.validateObjectExistInWorkspaces(objectToGet, workspaces[0]);
const validatedObject = this.formatObjectForWorkspaceValidation(
objectToGet,
workspaces[0]
);
if (validatedObject.error) {
throw SavedObjectsErrorHelpers.createGenericNotFoundError(type, id);
}
Expand Down

0 comments on commit 1d13f30

Please sign in to comment.