feat(infisical-pg): completed webhook and integration trigger queue

This commit is contained in:
Akhil Mohan
2024-01-27 12:38:23 +05:30
parent aed94ff5bb
commit 0bf658e501
19 changed files with 5281 additions and 68 deletions
+1
View File
@@ -3,3 +3,4 @@
// Code taken to keep in in house and to adjust somethings for our needs
export * from "./array";
export * from "./object";
export * from "./string";
+5
View File
@@ -0,0 +1,5 @@
import path from "path";
// given two paths irrespective of ending with / or not
// this will return true if its equal
export const isSamePath = async (from: string, to: string) => !path.relative(from, to);
+7 -4
View File
@@ -117,13 +117,13 @@ export const ormify = <DbOps extends object, Tname extends keyof Tables>(
}
},
update: async (
filter: Partial<Tables[Tname]["base"]>,
filter: TFindFilter<Tables[Tname]["base"]>,
data: Tables[Tname]["update"],
tx?: Knex
) => {
try {
const res = await (tx || db)(tableName)
.where(filter)
.where(buildFindFilter(filter))
.update(data as any)
.returning("*");
return res;
@@ -142,9 +142,12 @@ export const ormify = <DbOps extends object, Tname extends keyof Tables>(
throw new DatabaseError({ error, name: "Delete by id" });
}
},
delete: async (filter: Partial<Tables[Tname]["base"]>, tx?: Knex) => {
delete: async (filter: TFindFilter<Tables[Tname]["base"]>, tx?: Knex) => {
try {
const res = await (tx || db)(tableName).where(filter).delete().returning("*");
const res = await (tx || db)(tableName)
.where(buildFindFilter(filter))
.delete()
.returning("*");
return res;
} catch (error) {
throw new DatabaseError({ error, name: "Delete" });