mirror of
https://github.com/Infisical/infisical.git
synced 2025-03-25 14:05:03 +00:00
misc: improved knex import
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
// weird commonjs-related error in the CI requires us to use this kind of import
|
||||
import * as kx from "knex";
|
||||
// weird commonjs-related error in the CI requires us to do the import like this
|
||||
import knex from "knex";
|
||||
|
||||
import { TDbClient } from "@app/db";
|
||||
import { TableName } from "@app/db/schemas";
|
||||
@ -47,7 +47,7 @@ export const auditLogDALFactory = (db: TDbClient) => {
|
||||
eventType?: EventType[];
|
||||
eventMetadata?: Record<string, string>;
|
||||
},
|
||||
tx?: kx.Knex
|
||||
tx?: knex.Knex
|
||||
) => {
|
||||
if (!orgId && !projectId) {
|
||||
throw new Error("Either orgId or projectId must be provided");
|
||||
@ -111,7 +111,7 @@ export const auditLogDALFactory = (db: TDbClient) => {
|
||||
|
||||
return docs;
|
||||
} catch (error) {
|
||||
if (error instanceof kx.KnexTimeoutError) {
|
||||
if (error instanceof knex.KnexTimeoutError) {
|
||||
throw new BadRequestError({
|
||||
error,
|
||||
message: "Failed to fetch audit logs due to timeout. Add more search filters."
|
||||
@ -123,7 +123,7 @@ export const auditLogDALFactory = (db: TDbClient) => {
|
||||
};
|
||||
|
||||
// delete all audit log that have expired
|
||||
const pruneAuditLog = async (tx?: kx.Knex) => {
|
||||
const pruneAuditLog = async (tx?: knex.Knex) => {
|
||||
const AUDIT_LOG_PRUNE_BATCH_SIZE = 10000;
|
||||
const MAX_RETRY_ON_FAILURE = 3;
|
||||
|
||||
|
Reference in New Issue
Block a user