Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

remove dead code

Thiago Araujo da Silva1b9c1fe9d011
diff --git a/backend/src/services/alert/alert-channel-dal.ts b/backend/src/services/alert/alert-channel-dal.ts
index c52d3cfbb4..7038693e81 100644
--- a/backend/src/services/alert/alert-channel-dal.ts
+++ b/backend/src/services/alert/alert-channel-dal.ts
@@ -61,22 +61,6 @@ export const alertChannelDALFactory = (db: TDbClient) => {
}
};
- const findByIdsInScope = async (
- ids: string[],
- { orgId, projectId }: { orgId: string; projectId?: string | null },
- tx?: Knex
- ): Promise<TAlertChannels[]> => {
- try {
- if (!ids.length) return [];
- const query = (tx || db.replicaNode())(TableName.AlertChannel).whereIn(`${TableName.AlertChannel}.id`, ids);
- scopeFilter(query, orgId, projectId);
- const channels = await query.select(selectAllTableCols(TableName.AlertChannel));
- return channels as TAlertChannels[];
- } catch (error) {
- throw new DatabaseError({ error, name: "FindByIdsInScope" });
- }
- };
-
const findByNameInScope = async (
name: string,
{ orgId, projectId }: { orgId: string; projectId?: string | null },
@@ -135,7 +119,6 @@ export const alertChannelDALFactory = (db: TDbClient) => {
...alertChannelOrm,
findWithUsageByScope,
findActiveById,
- findByIdsInScope,
findByNameInScope,
findByAlertId,
findByAlertIds
diff --git a/backend/src/services/alert/alert-channel-membership-dal.ts b/backend/src/services/alert/alert-channel-membership-dal.ts
index c4aaef1e41..ceab6005c7 100644
--- a/backend/src/services/alert/alert-channel-membership-dal.ts
+++ b/backend/src/services/alert/alert-channel-membership-dal.ts
@@ -1,37 +1,15 @@
import { Knex } from "knex";
import { TDbClient } from "@app/db";
-import { TableName, TAlertChannelMemberships } from "@app/db/schemas";
+import { TableName } from "@app/db/schemas";
import { DatabaseError } from "@app/lib/errors";
-import { ormify, selectAllTableCols } from "@app/lib/knex";
+import { ormify } from "@app/lib/knex";
export type TAlertChannelMembershipDALFactory = ReturnType<typeof alertChannelMembershipDALFactory>;
export const alertChannelMembershipDALFactory = (db: TDbClient) => {
const alertChannelMembershipOrm = ormify(db, TableName.AlertChannelMembership);
- const findByAlertId = async (alertId: string, tx?: Knex): Promise<TAlertChannelMemberships[]> => {
- try {
- const memberships = await (tx || db.replicaNode())(TableName.AlertChannelMembership)
- .where(`${TableName.AlertChannelMembership}.alertId`, alertId)
- .select(selectAllTableCols(TableName.AlertChannelMembership));
-
- return memberships as TAlertChannelMemberships[];
- } catch (error) {
- throw new DatabaseError({ error, name: "FindByAlertId" });
- }
- };
-
- const deleteByAlertId = async (alertId: string, tx?: Knex): Promise<number> => {
- try {
- return await (tx || db)(TableName.AlertChannelMembership)
- .where(`${TableName.AlertChannelMembership}.alertId`, alertId)
- .del();
- } catch (error) {
- throw new DatabaseError({ error, name: "DeleteByAlertId" });
- }
- };
-
const countByChannelId = async (channelId: string, tx?: Knex): Promise<number> => {
try {
const [row] = await (tx || db.replicaNode())(TableName.AlertChannelMembership)
@@ -45,8 +23,6 @@ export const alertChannelMembershipDALFactory = (db: TDbClient) => {
return {
...alertChannelMembershipOrm,
- findByAlertId,
- deleteByAlertId,
countByChannelId
};
};
diff --git a/backend/src/services/alert/alert-channel-service-types.ts b/backend/src/services/alert/alert-channel-service-types.ts
index d3887198a5..54d01cf2ab 100644
--- a/backend/src/services/alert/alert-channel-service-types.ts
+++ b/backend/src/services/alert/alert-channel-service-types.ts
@@ -46,14 +46,6 @@ export type TAlertChannelDetail = {
updatedAt: Date;
};
-export type TAlertChannelSummary = {
- id: string;
- name: string;
- channelType: string;
- directed: boolean;
- enabled: boolean;
-};
-
export type TAlertChannelEmbedded = {
id: string;
name: string;
@@ -72,5 +64,3 @@ export type TAlertChannelInput = {
enabled?: boolean;
recipients?: TChannelRecipientInput[];
};
-
-export type { AlertChannelType };
diff --git a/backend/src/services/alert/alert-service.test.ts b/backend/src/services/alert/alert-service.test.ts
index a112008ac0..74446d3c25 100644
--- a/backend/src/services/alert/alert-service.test.ts
+++ b/backend/src/services/alert/alert-service.test.ts
@@ -60,9 +60,6 @@ const buildService = (opts?: {
const memberships = new Map<string, string[]>(); // alertId -> channelIds
const findFilters: Array<Record<string, unknown>> = [];
- const inScope = (c: TChannelRow, scope: { orgId: string; projectId?: string | null }) =>
- c.orgId === scope.orgId && (c.projectId ?? null) === (scope.projectId ?? null);
-
const service = alertServiceFactory({
alertDAL: {
transaction: async (cb: (tx: unknown) => unknown) => cb({}),
@@ -94,8 +91,6 @@ const buildService = (opts?: {
deleteById: async (id: string) => alerts.delete(id)
},
alertChannelDAL: {
- findByIdsInScope: async (ids: string[], scope: { orgId: string; projectId?: string | null }) =>
- ids.map((id) => channelStore.get(id)).filter((c): c is TChannelRow => Boolean(c) && inScope(c!, scope)),
findByAlertId: async (alertId: string) =>
(memberships.get(alertId) ?? []).map((id) => channelStore.get(id)).filter(Boolean),
findByAlertIds: async (alertIds: string[]) =>
@@ -112,10 +107,6 @@ const buildService = (opts?: {
memberships.set(alertId, [...(memberships.get(alertId) ?? []), channelId])
);
return data;
- },
- deleteByAlertId: async (alertId: string) => {
- memberships.delete(alertId);
- return 0;
}
},
alertProviderRegistry: registry
diff --git a/backend/src/services/alert/alert-types.ts b/backend/src/services/alert/alert-types.ts
index 44de6edb75..45cc9d65dd 100644
--- a/backend/src/services/alert/alert-types.ts
+++ b/backend/src/services/alert/alert-types.ts
@@ -10,8 +10,7 @@ export enum AlertPrincipalType {
}
export enum AlertTriggerType {
- Scheduled = "scheduled",
- Event = "event"
+ Scheduled = "scheduled"
}
export enum AlertRunStatus {
diff --git a/frontend/src/hooks/api/alertChannels/index.ts b/frontend/src/hooks/api/alertChannels/index.ts
deleted file mode 100644
index 2c1906d369..0000000000
--- a/frontend/src/hooks/api/alertChannels/index.ts
+++ /dev/null
@@ -1,2 +0,0 @@
-export * from "./queries";
-export * from "./types";
diff --git a/frontend/src/hooks/api/alertChannels/queries.ts b/frontend/src/hooks/api/alertChannels/queries.ts
deleted file mode 100644
index b1bfc3a89a..0000000000
--- a/frontend/src/hooks/api/alertChannels/queries.ts
+++ /dev/null
@@ -1,36 +0,0 @@
-import { useQuery, UseQueryOptions } from "@tanstack/react-query";
-
-import { apiRequest } from "@app/config/request";
-
-import { TAlertChannel, TListAlertChannelsDTO } from "./types";
-
-export const alertChannelKeys = {
- all: ["alert-channels"] as const,
- list: (filters: TListAlertChannelsDTO) => [...alertChannelKeys.all, "list", filters] as const,
- byId: (channelId: string) => [...alertChannelKeys.all, channelId] as const
-};
-
-const fetchAlertChannels = async (filters: TListAlertChannelsDTO) => {
- const { data } = await apiRequest.get<{ channels: TAlertChannel[] }>("/api/v1/alert-channels", {
- params: filters
- });
- return data.channels;
-};
-
-export const useListAlertChannels = (
- filters: TListAlertChannelsDTO,
- options?: Omit<
- UseQueryOptions<
- TAlertChannel[],
- unknown,
- TAlertChannel[],
- ReturnType<typeof alertChannelKeys.list>
- >,
- "queryKey" | "queryFn"
- >
-) =>
- useQuery({
- queryKey: alertChannelKeys.list(filters),
- queryFn: () => fetchAlertChannels(filters),
- ...options
- });
diff --git a/frontend/src/hooks/api/alertChannels/types.ts b/frontend/src/hooks/api/alertChannels/types.ts
deleted file mode 100644
index 872a776784..0000000000
--- a/frontend/src/hooks/api/alertChannels/types.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import { AlertChannelType, AlertPrincipalType } from "../alerts/types";
-
-export type TAlertChannelRecipient = {
- principalType: AlertPrincipalType;
- principalId: string;
-};
-
-export type TAlertChannel = {
- id: string;
- name: string;
- channelType: AlertChannelType;
- directed: boolean;
- config: Record<string, unknown>;
- enabled: boolean;
- recipients: TAlertChannelRecipient[];
- usageCount: number;
- orgId: string;
- projectId: string | null;
- createdAt: string;
- updatedAt: string;
-};
-
-export type TListAlertChannelsDTO = {
- projectId?: string;
-};
diff --git a/frontend/src/hooks/api/index.tsx b/frontend/src/hooks/api/index.tsx
index 640f7f2b0c..29928cc34d 100644
--- a/frontend/src/hooks/api/index.tsx
+++ b/frontend/src/hooks/api/index.tsx
@@ -4,7 +4,6 @@ export * from "./admin";
export * from "./aiMcpActivityLogs";
export * from "./aiMcpEndpoints";
export * from "./aiMcpServers";
-export * from "./alertChannels";
export * from "./alerts";
export * from "./approvalGrants";
export * from "./approvalPolicies";