mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-14 21:51:56 +00:00
improvements: address feedback
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import { URL } from "url"; // Import the URL class
|
||||
|
||||
export const getDbConnectionHost = (urlString: string) => {
|
||||
export const getDbConnectionHost = (urlString?: string) => {
|
||||
if (!urlString) return null;
|
||||
|
||||
try {
|
||||
const url = new URL(urlString);
|
||||
// Split hostname and port (if provided)
|
||||
|
||||
@@ -2,11 +2,17 @@ import { Knex } from "knex";
|
||||
|
||||
import { UnauthorizedError } from "../errors";
|
||||
|
||||
type TKnexDynamicPrimitiveOperator<T extends object> = {
|
||||
operator: "eq" | "ne" | "startsWith" | "endsWith";
|
||||
value: string;
|
||||
field: Extract<keyof T, string>;
|
||||
};
|
||||
type TKnexDynamicPrimitiveOperator<T extends object> =
|
||||
| {
|
||||
operator: "eq" | "ne" | "startsWith" | "endsWith";
|
||||
value: string;
|
||||
field: Extract<keyof T, string>;
|
||||
}
|
||||
| {
|
||||
operator: "notIn";
|
||||
value: string[];
|
||||
field: Extract<keyof T, string>;
|
||||
};
|
||||
|
||||
type TKnexDynamicInOperator<T extends object> = {
|
||||
operator: "in";
|
||||
@@ -48,6 +54,10 @@ export const buildDynamicKnexQuery = <T extends object>(
|
||||
void queryBuilder.whereILike(filterAst.field, `%${filterAst.value}`);
|
||||
break;
|
||||
}
|
||||
case "notIn": {
|
||||
void queryBuilder.whereNotIn(filterAst.field, filterAst.value);
|
||||
break;
|
||||
}
|
||||
case "and": {
|
||||
filterAst.value.forEach((el) => {
|
||||
void queryBuilder.andWhere((subQueryBuilder) => {
|
||||
|
||||
Reference in New Issue
Block a user