<commit_before>import { PipeTransform, Injectable, BadRequestException } from '@nestjs/common';
import { Types } from 'mongoose';

@Injectable()
export class ParseObjectIdPipe implements PipeTransform<any, Types.ObjectId> {
	transform(value: any): Types.ObjectId {
		const validObjectId = Types.ObjectId.isValid(value);

		if (!validObjectId) {
			throw new BadRequestException('Invalid ObjectId');
		}

		return value;
	}
}<commit_msg>expect value to be a string<commit_after>import { PipeTransform, Injectable, BadRequestException } from '@nestjs/common';
import { Types } from 'mongoose';
import { EntityId } from '@shared/domain';

@Injectable()
export class ParseObjectIdPipe implements PipeTransform<string, EntityId> {
	transform(value: string): string {
		const validObjectId = Types.ObjectId.isValid(value);

		if (!validObjectId) {
			throw new BadRequestException('Invalid ObjectId');
		}

		return value;
	}
}
{'fraction_non_alphanumeric': 0.11400651465798045, 'fraction_numerical': 0.0, 'mean_word_length': 5.82962962962963, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5994951', 'n_tokens_mistral': 289, 'n_tokens_neox': 275, 'n_words': 71}