refactor(core): Move interrelated entities to @n8n/db (#15050)

This commit is contained in:
Iván Ovejero
2025-05-02 12:19:32 +02:00
committed by GitHub
parent 88afd66471
commit 20834abb56
270 changed files with 699 additions and 566 deletions

View File

@@ -0,0 +1,27 @@
import type { ValidationOptions, ValidatorConstraintInterface } from 'class-validator';
import { registerDecorator, ValidatorConstraint } from 'class-validator';
const URL_REGEX = /^(https?:\/\/|www\.)|(\.[\p{L}\d-]+)/iu;
@ValidatorConstraint({ name: 'NoUrl', async: false })
class NoUrlConstraint implements ValidatorConstraintInterface {
validate(value: string) {
return !URL_REGEX.test(value);
}
defaultMessage() {
return 'Potentially malicious string';
}
}
export function NoUrl(options?: ValidationOptions) {
return function (object: object, propertyName: string) {
registerDecorator({
name: 'NoUrl',
target: object.constructor,
propertyName,
options,
validator: NoUrlConstraint,
});
};
}