diff --git a/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/controls/components/ControlsOverview.tsx b/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/controls/components/ControlsOverview.tsx deleted file mode 100644 index 7ec6644ea5..0000000000 --- a/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/controls/components/ControlsOverview.tsx +++ /dev/null @@ -1,26 +0,0 @@ -"use client"; - -import { useI18n } from "@/locales/client"; -import type { Control } from "@comp/db/types"; -import { ControlsTable } from "./table/ControlsTable"; - -interface ControlsOverviewProps { - controls: (Control & { - artifacts: { - policy: { status: string } | null; - evidence: { published: boolean } | null; - }[]; - requirementsMapped: any[]; - })[]; - organizationId: string; -} - -export function ControlsOverview({ controls }: ControlsOverviewProps) { - const t = useI18n(); - - return ( -
- -
- ); -} diff --git a/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/controls/components/ControlsTableColumns.tsx b/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/controls/components/ControlsTableColumns.tsx deleted file mode 100644 index 185217dcec..0000000000 --- a/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/controls/components/ControlsTableColumns.tsx +++ /dev/null @@ -1,54 +0,0 @@ -"use client"; - -import { DisplayFrameworkStatus } from "@/components/frameworks/framework-status"; -import { useI18n } from "@/locales/client"; -import type { Control } from "@comp/db/types"; -import type { ColumnDef } from "@tanstack/react-table"; -import Link from "next/link"; -import { useParams } from "next/navigation"; -import { getControlStatus } from "../lib/utils"; - -export type ControlTableType = Control & { - artifacts: { - policy: { status: string } | null; - evidence: { published: boolean } | null; - }[]; - requirementsMapped: any[]; -}; - -export function ControlsTableColumns(): ColumnDef[] { - const t = useI18n(); - const params = useParams(); - - return [ - { - accessorKey: "name", - header: t("controls.table.name"), - cell: ({ row }) => { - const control = row.original; - return ( - - {control.name} - - ); - }, - }, - { - accessorKey: "description", - header: t("controls.table.description"), - cell: ({ row }) => row.original.description, - }, - { - accessorKey: "status", - header: t("controls.table.status"), - cell: ({ row }) => { - const control = row.original; - const status = getControlStatus(control); - return ; - }, - }, - ]; -} diff --git a/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/controls/components/controls-table-columns.tsx b/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/controls/components/controls-table-columns.tsx new file mode 100644 index 0000000000..26b2279fd7 --- /dev/null +++ b/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/controls/components/controls-table-columns.tsx @@ -0,0 +1,69 @@ +"use client"; + +import { ColumnDef } from "@tanstack/react-table"; +import { Control, Artifact, Policy, Evidence, RequirementMap } from "@comp/db/types"; +import { DataTableColumnHeader } from "@/components/data-table/data-table-column-header"; +import { DisplayFrameworkStatus } from "@/components/frameworks/framework-status"; +import { getControlStatus } from "../lib/utils"; + +export function getControlColumns(): ColumnDef[] { + return [ + { + id: "name", + accessorKey: "name", + header: ({ column }) => ( + + ), + cell: ({ row }) => { + return ( +
+ + {row.getValue("name")} + +
+ ); + }, + meta: { + label: "Control Name", + placeholder: "Search for a control...", + variant: "text", + }, + enableColumnFilter: true, + }, + { + id: "status", + accessorKey: "status", + header: ({ column }) => ( + + ), + cell: ({ row }) => { + const control = row.original; + const status = getControlStatus(control); + + return ; + }, + meta: { + label: "Status", + placeholder: "Search status...", + variant: "select", + }, + }, + { + id: "mappedRequirements", + accessorKey: "mappedRequirements", + header: ({ column }) => ( + + ), + cell: ({ row }) => { + const control = row.original; + return
{control.requirementsMapped.length}
; + }, + }, + ]; +} diff --git a/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/controls/components/controls-table.tsx b/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/controls/components/controls-table.tsx new file mode 100644 index 0000000000..228fdf2a94 --- /dev/null +++ b/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/controls/components/controls-table.tsx @@ -0,0 +1,50 @@ +"use client"; + +import * as React from "react"; + +import { DataTable } from "@/components/data-table/data-table"; +import { useDataTable } from "@/hooks/use-data-table"; +import { getControls } from "../data/queries"; +import { DataTableSortList } from "@/components/data-table/data-table-sort-list"; +import { getControlColumns } from "./controls-table-columns"; +import { DataTableToolbar } from "@/components/data-table/data-table-toolbar"; +import { CreatePolicySheet } from "@/components/sheets/create-policy-sheet"; + +interface ControlsTableProps { + promises: Promise<[ + Awaited> + ]>; +} + +export function ControlsTable({ promises }: ControlsTableProps) { + const [{ data, pageCount }] = React.use(promises); + + const columns = React.useMemo(() => getControlColumns(), []); + + const { table } = useDataTable({ + data, + columns, + pageCount, + initialState: { + sorting: [{ id: "name", desc: true }], + columnPinning: { right: ["actions"] }, + }, + getRowId: (originalRow) => originalRow.id, + shallow: false, + clearOnDefault: true, + }); + + return ( + <> + row.id} + > + + + + + + + ); +} \ No newline at end of file diff --git a/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/controls/components/table/ControlsTable.tsx b/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/controls/components/table/ControlsTable.tsx deleted file mode 100644 index 37f9740278..0000000000 --- a/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/controls/components/table/ControlsTable.tsx +++ /dev/null @@ -1,74 +0,0 @@ -"use client"; - -import { Loading } from "@/components/tables/risk-tasks/loading"; -import { useI18n } from "@/locales/client"; -import { Table, TableBody, TableCell, TableRow } from "@comp/ui/table"; -import { - flexRender, - getCoreRowModel, - useReactTable, -} from "@tanstack/react-table"; -import { Suspense } from "react"; -import { ControlsTableColumns } from "./ControlsTableColumns"; -import { ControlsTableHeader } from "./ControlsTableHeader"; -import type { Control } from "@comp/db/types"; - -interface DataTableProps { - data: (Control & { - artifacts: { - policy: { status: string } | null; - evidence: { published: boolean } | null; - }[]; - requirementsMapped: any[]; - })[]; -} - -export function ControlsTable({ data }: DataTableProps) { - const t = useI18n(); - const columns = ControlsTableColumns(); - - const table = useReactTable({ - data, - columns, - getCoreRowModel: getCoreRowModel(), - }); - - return ( - }> -
- - - - {table.getRowModel().rows?.length ? ( - table.getRowModel().rows.map((row) => ( - - {row.getVisibleCells().map((cell) => ( - - {flexRender( - cell.column.columnDef.cell, - cell.getContext(), - )} - - ))} - - )) - ) : ( - - - {t("controls.table.no_controls_found")} - - - )} - -
-
-
- ); -} diff --git a/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/controls/components/table/ControlsTableColumns.tsx b/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/controls/components/table/ControlsTableColumns.tsx deleted file mode 100644 index bbbaad1b0f..0000000000 --- a/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/controls/components/table/ControlsTableColumns.tsx +++ /dev/null @@ -1,76 +0,0 @@ -"use client"; - -import { DisplayFrameworkStatus } from "@/components/frameworks/framework-status"; -import { useI18n } from "@/locales/client"; -import type { Control } from "@comp/db/types"; -import type { ColumnDef } from "@tanstack/react-table"; -import Link from "next/link"; -import { useParams } from "next/navigation"; -import { getControlStatus } from "../../lib/utils"; - -export type ControlTableType = Control & { - artifacts: { - policy: { status: string } | null; - evidence: { published: boolean } | null; - }[]; - requirementsMapped: any[]; -}; - -export function ControlsTableColumns(): ColumnDef[] { - const t = useI18n(); - const params = useParams(); - - return [ - { - accessorKey: "name", - header: t("controls.table.name"), - cell: ({ row }) => { - const control = row.original; - return ( -
- - {control.name} - -
- ); - }, - }, - { - accessorKey: "description", - header: t("controls.table.description"), - cell: ({ row }) => ( -
- {row.original.description} -
- ), - }, - { - accessorKey: "status", - header: t("controls.table.status"), - cell: ({ row }) => { - const control = row.original; - const status = getControlStatus(control); - return ( -
- -
- ); - }, - }, - { - accessorKey: "requirementsMapped", - header: t("frameworks.controls.table.requirements"), - cell: ({ row }) => { - const control = row.original; - return ( -
- {control.requirementsMapped.length} -
- ); - }, - }, - ]; -} diff --git a/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/controls/components/table/ControlsTableHeader.tsx b/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/controls/components/table/ControlsTableHeader.tsx deleted file mode 100644 index b60ae3daf9..0000000000 --- a/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/controls/components/table/ControlsTableHeader.tsx +++ /dev/null @@ -1,26 +0,0 @@ -"use client"; - -import { TableHead, TableHeader, TableRow } from "@comp/ui/table"; -import type { Table } from "@tanstack/react-table"; -import type { ControlTableType } from "./ControlsTableColumns"; - -type Props = { - table: Table; -}; - -export function ControlsTableHeader({ table }: Props) { - return ( - - - {table.getAllColumns().map((column) => ( - - {column.columnDef.header as string} - - ))} - - - ); -} diff --git a/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/controls/data/getAllOrganizationControls.ts b/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/controls/data/getAllOrganizationControls.ts index 25d71a132e..49a619c149 100644 --- a/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/controls/data/getAllOrganizationControls.ts +++ b/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/controls/data/getAllOrganizationControls.ts @@ -3,24 +3,20 @@ import { auth } from "@comp/auth"; import { db } from "@comp/db"; import { headers } from "next/headers"; +import { cache } from "react"; -export async function getAllOrganizationControls(params: { - organizationId: string; -}) { +export const getAllOrganizationControls = cache(async () => { const session = await auth.api.getSession({ headers: await headers(), }); - if ( - !session || - session.session.activeOrganizationId !== params.organizationId - ) { + if (!session || !session.session.activeOrganizationId) { throw new Error("Unauthorized"); } const controls = await db.control.findMany({ where: { - organizationId: params.organizationId, + organizationId: session.session.activeOrganizationId, }, include: { artifacts: { @@ -42,4 +38,4 @@ export async function getAllOrganizationControls(params: { }); return controls; -} +}); diff --git a/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/controls/data/queries.ts b/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/controls/data/queries.ts new file mode 100644 index 0000000000..3023d564f5 --- /dev/null +++ b/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/controls/data/queries.ts @@ -0,0 +1,73 @@ +import "server-only"; + +import { db } from "@comp/db"; +import { auth } from "@comp/auth"; +import type { GetControlSchema } from "./validations"; +import { cache } from "react"; +import { headers } from "next/headers"; +import { Prisma } from "@prisma/client"; + +export async function getControls(input: GetControlSchema) { + return await cache(async () => { + try { + const session = await auth.api.getSession({ headers: await headers() }); + const organizationId = session?.session.activeOrganizationId; + + if (!organizationId) { + throw new Error("Organization not found"); + } + + const orderBy = input.sort.map((sort) => ({ + [sort.id]: sort.desc ? "desc" : "asc", + })); + + const where: Prisma.ControlWhereInput = { + organizationId, + ...(input.name && { + name: { + contains: input.name, + mode: Prisma.QueryMode.insensitive, + }, + }), + ...(input.lastUpdated.length > 0 && { + lastUpdated: { + in: input.lastUpdated, + }, + }), + }; + + const controls = await db.control.findMany({ + where, + orderBy: orderBy.length > 0 ? orderBy : [{ name: "asc" }], + skip: (input.page - 1) * input.perPage, + take: input.perPage, + include: { + artifacts: { + include: { + policy: { + select: { + status: true, + }, + }, + evidence: { + select: { + published: true, + }, + }, + }, + }, + requirementsMapped: true, + }, + }); + + const total = await db.control.count({ + where, + }); + + const pageCount = Math.ceil(total / input.perPage); + return { data: controls, pageCount }; + } catch (_err) { + return { data: [], pageCount: 0 }; + } + })(); +} diff --git a/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/controls/data/validations.ts b/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/controls/data/validations.ts new file mode 100644 index 0000000000..6f2a5a7345 --- /dev/null +++ b/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/controls/data/validations.ts @@ -0,0 +1,27 @@ +import { + createSearchParamsCache, + parseAsArrayOf, + parseAsInteger, + parseAsString, + parseAsStringEnum, +} from "nuqs/server"; +import * as z from "zod"; +import { getFiltersStateParser, getSortingStateParser } from "@/lib/parsers"; +import { Control } from "@comp/db/types"; + +export const searchParamsCache = createSearchParamsCache({ + page: parseAsInteger.withDefault(1), + perPage: parseAsInteger.withDefault(10), + sort: getSortingStateParser().withDefault([ + { id: "name", desc: true }, + ]), + name: parseAsString.withDefault(""), + lastUpdated: parseAsArrayOf(z.coerce.date()).withDefault([]), + // advanced filter + filters: getFiltersStateParser().withDefault([]), + joinOperator: parseAsStringEnum(["and", "or"]).withDefault("and"), +}); + +export type GetControlSchema = Awaited< + ReturnType +>; diff --git a/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/controls/layout.tsx b/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/controls/layout.tsx index b39dd37660..e0295acd69 100644 --- a/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/controls/layout.tsx +++ b/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/controls/layout.tsx @@ -1,27 +1,11 @@ -import { auth } from "@comp/auth"; -import { getI18n } from "@/locales/server"; -import { redirect } from "next/navigation"; -import { SecondaryMenu } from "@comp/ui/secondary-menu"; -import { headers } from "next/headers"; - export default async function Layout({ - children, + children, }: { - children: React.ReactNode; + children: React.ReactNode; }) { - const t = await getI18n(); - const session = await auth.api.getSession({ - headers: await headers(), - }); - - if (!session?.session?.activeOrganizationId) { - console.log("Redirect on layout.tsx"); - redirect("/auth"); - } - - return ( -
-
{children}
-
- ); + return ( +
+
{children}
+
+ ); } diff --git a/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/controls/page.tsx b/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/controls/page.tsx index b64b664bbf..e3a989ab54 100644 --- a/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/controls/page.tsx +++ b/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/controls/page.tsx @@ -1,37 +1,74 @@ import { getI18n } from "@/locales/server"; -import { auth } from "@comp/auth"; -import { headers } from "next/headers"; -import { redirect } from "next/navigation"; -import { ControlsOverview } from "./components/ControlsOverview"; -import { getAllOrganizationControls } from "./data/getAllOrganizationControls"; import PageWithBreadcrumb from "@/components/pages/PageWithBreadcrumb"; +import { Metadata } from "next"; +import { setStaticParamsLocale } from "next-international/server"; +import { SearchParams } from "nuqs"; +import { getValidFilters } from "@/lib/data-table"; +import { searchParamsCache } from "./data/validations"; +import { getControls } from "./data/queries"; +import { DataTableSkeleton } from "@/components/data-table/data-table-skeleton"; +import { Suspense } from "react"; +import { ControlsTable } from "./components/controls-table"; -export async function generateMetadata() { - const t = await getI18n(); - - return { - title: t("controls.overview.title"), - }; +interface ControlTableProps { + params: Promise<{ locale: string }>; + searchParams: Promise; } -export default async function ControlsPage() { - const session = await auth.api.getSession({ - headers: await headers(), - }); +export default async function ControlsPage({ + params, + ...props +}: ControlTableProps) { + const { locale } = await params; + const searchParams = await props.searchParams; + const search = searchParamsCache.parse(searchParams); + const validFilters = getValidFilters(search.filters); + setStaticParamsLocale(locale); + + const promises = Promise.all([ + getControls({ + ...search, + filters: validFilters, + }), + ]); - const organizationId = session?.session.activeOrganizationId; + return ( + + + } + > + + + + ); +} - if (!organizationId) { - redirect("/"); - } +export async function generateMetadata({ + params, +}: { + params: Promise<{ locale: string }>; +}): Promise { + const { locale } = await params; - const controls = await getAllOrganizationControls({ - organizationId, - }); + setStaticParamsLocale(locale); + const t = await getI18n(); - return ( - - - - ); -} + return { + title: t("sidebar.policies"), + }; +} \ No newline at end of file diff --git a/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/policies/all/(overview)/components/policies-table.tsx b/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/policies/all/(overview)/components/policies-table.tsx index af3fd5f8ff..611c13df8f 100644 --- a/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/policies/all/(overview)/components/policies-table.tsx +++ b/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/policies/all/(overview)/components/policies-table.tsx @@ -26,7 +26,6 @@ export function PoliciesTable({ promises }: PoliciesTableProps) { columns, pageCount, initialState: { - sorting: [{ id: "createdAt", desc: true }], columnPinning: { right: ["actions"] }, }, getRowId: (originalRow) => originalRow.id, diff --git a/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/policies/all/(overview)/data/validations.ts b/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/policies/all/(overview)/data/validations.ts index 92c1aa184f..b6be812f24 100644 --- a/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/policies/all/(overview)/data/validations.ts +++ b/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/policies/all/(overview)/data/validations.ts @@ -13,12 +13,11 @@ export const searchParamsCache = createSearchParamsCache({ page: parseAsInteger.withDefault(1), perPage: parseAsInteger.withDefault(10), sort: getSortingStateParser().withDefault([ - { id: "createdAt", desc: true }, + { id: "name", desc: false }, ]), name: parseAsString.withDefault(""), status: parseAsArrayOf(z.nativeEnum(PolicyStatus)).withDefault([]), createdAt: parseAsArrayOf(z.coerce.date()).withDefault([]), - updatedAt: parseAsArrayOf(z.coerce.date()).withDefault([]), // advanced filter filters: getFiltersStateParser().withDefault([]), joinOperator: parseAsStringEnum(["and", "or"]).withDefault("and"), diff --git a/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/policies/all/(overview)/page.tsx b/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/policies/all/(overview)/page.tsx index f85bc11be5..5e7ebf9c75 100644 --- a/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/policies/all/(overview)/page.tsx +++ b/apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/policies/all/(overview)/page.tsx @@ -4,7 +4,7 @@ import { setStaticParamsLocale } from "next-international/server"; import { DataTableSkeleton } from "@/components/data-table/data-table-skeleton"; import { Suspense } from "react"; import type { SearchParams } from "@/types"; -import { searchParamsCache } from "@/lib/validations"; +import { searchParamsCache } from "./data/validations"; import { getValidFilters } from "@/lib/data-table"; import { PoliciesTable } from "./components/policies-table"; import { getPolicies } from "./data/queries"; diff --git a/apps/app/src/components/data-table/data-table-pagination.tsx b/apps/app/src/components/data-table/data-table-pagination.tsx index e1e3c30e7e..b187aedcc6 100644 --- a/apps/app/src/components/data-table/data-table-pagination.tsx +++ b/apps/app/src/components/data-table/data-table-pagination.tsx @@ -1,113 +1,113 @@ import type { Table } from "@tanstack/react-table"; import { - ChevronLeft, - ChevronRight, - ChevronsLeft, - ChevronsRight, + ChevronLeft, + ChevronRight, + ChevronsLeft, + ChevronsRight, } from "lucide-react"; import { Button } from "@comp/ui/button"; import { - Select, - SelectContent, - SelectItem, - SelectTrigger, - SelectValue, + Select, + SelectContent, + SelectItem, + SelectTrigger, + SelectValue, } from "@comp/ui/select"; import { cn } from "@comp/ui/cn"; interface DataTablePaginationProps extends React.ComponentProps<"div"> { - table: Table; - pageSizeOptions?: number[]; + table: Table; + pageSizeOptions?: number[]; } export function DataTablePagination({ - table, - pageSizeOptions = [10, 20, 30, 40, 50], - className, - ...props + table, + pageSizeOptions = [10, 20, 30, 40, 50], + className, + ...props }: DataTablePaginationProps) { - return ( -
-
-

- {table.getCoreRowModel().rows.length} items -

-
-
-
-

Rows per page

- -
-
- Page {table.getState().pagination.pageIndex + 1} of{" "} - {table.getPageCount()} -
-
- - - - -
-
-
- ); + return ( +
+
+

+ {table.getCoreRowModel().rows.length} items +

+
+
+
+

Rows per page

+ +
+
+ Page {table.getState().pagination.pageIndex + 1} of{" "} + {table.getPageCount()} +
+
+ + + + +
+
+
+ ); } diff --git a/apps/app/src/components/frameworks/framework-status.tsx b/apps/app/src/components/frameworks/framework-status.tsx index 44ccf8d255..5ed6d0f33c 100644 --- a/apps/app/src/components/frameworks/framework-status.tsx +++ b/apps/app/src/components/frameworks/framework-status.tsx @@ -2,32 +2,32 @@ import { useI18n } from "@/locales/client"; import { cn } from "@comp/ui/cn"; export const STATUS_TYPES = [ - "completed", - "in_progress", - "not_started", + "completed", + "in_progress", + "not_started", ] as const; export type StatusType = Exclude< - (typeof STATUS_TYPES)[number], - "draft" | "published" + (typeof STATUS_TYPES)[number], + "draft" | "published" >; const STATUS_COLORS: Record = { - completed: "#22c55e", - in_progress: "#eab308", - not_started: "#f43f5e", + completed: "#22c55e", + in_progress: "#eab308", + not_started: "#f43f5e", } as const; export function DisplayFrameworkStatus({ status }: { status: StatusType }) { - const t = useI18n(); + const t = useI18n(); - return ( -
-
- {t(`frameworks.controls.statuses.${status}`)} -
- ); + return ( +
+
+ {t(`frameworks.controls.statuses.${status}`)} +
+ ); } diff --git a/packages/data/dist/index.d.mts b/packages/data/dist/index.d.mts index 4f268197a2..523100f576 100644 --- a/packages/data/dist/index.d.mts +++ b/packages/data/dist/index.d.mts @@ -1,20 +1,20 @@ -import { Frequency, Departments } from "@comp/db/types"; +import { Frequency, Departments } from '@comp/db/types'; /** * Represents a training video resource that can be used * for user education and compliance training. */ interface TrainingVideo { - /** Unique identifier for the video */ - id: string; - /** Title of the training video */ - title: string; - /** Detailed description of the video content */ - description: string; - /** YouTube video identifier for embedding */ - youtubeId: string; - /** Full URL to access the video */ - url: string; + /** Unique identifier for the video */ + id: string; + /** Title of the training video */ + title: string; + /** Detailed description of the video content */ + description: string; + /** YouTube video identifier for embedding */ + youtubeId: string; + /** Full URL to access the video */ + url: string; } declare const trainingVideos: readonly TrainingVideo[]; @@ -24,19 +24,19 @@ declare const trainingVideos: readonly TrainingVideo[]; * that defines standards for security, privacy, or data handling. */ interface Framework { - /** Name of the framework */ - name: string; - /** Version number or year of the framework */ - version: string; - /** Brief description of the framework's purpose and scope */ - description: string; + /** Name of the framework */ + name: string; + /** Version number or year of the framework */ + version: string; + /** Brief description of the framework's purpose and scope */ + description: string; } /** * Collection of supported compliance frameworks within the system. */ interface Frameworks { - /** SOC 2 (Service Organization Control 2) framework */ - soc2: Framework; + /** SOC 2 (Service Organization Control 2) framework */ + soc2: Framework; } /** * Valid framework ID strings that can be used to reference specific frameworks. @@ -45,46 +45,28 @@ type FrameworkId = keyof Frameworks; declare const frameworks: Frameworks; -type soc2RequirementIds = - | "CC1" - | "CC2" - | "CC3" - | "CC4" - | "CC5" - | "CC6" - | "CC7" - | "CC8" - | "CC9" - | "A1" - | "C1" - | "PI1" - | "P1"; +type soc2RequirementIds = "CC1" | "CC2" | "CC3" | "CC4" | "CC5" | "CC6" | "CC7" | "CC8" | "CC9" | "A1" | "C1" | "PI1" | "P1"; /** * Represents a specific requirement from a compliance framework * that an organization needs to fulfill. */ interface Requirement { - /** Name of the requirement */ - name: string; - /** Detailed explanation of what this requirement entails */ - description: string; + /** Name of the requirement */ + name: string; + /** Detailed explanation of what this requirement entails */ + description: string; } /** * A mapping of requirement codes to their corresponding Requirement objects. * Used for efficient lookup of requirements. */ -type SingleFrameworkRequirements = Record< - A, - Requirement ->; +type SingleFrameworkRequirements = Record; type AllRequirements = { - [K in FrameworkId]: SingleFrameworkRequirements< - AllRequirementIdsByFramework[K] - >; + [K in FrameworkId]: SingleFrameworkRequirements; }; type AllRequirementIdsByFramework = { - soc2: soc2RequirementIds; + soc2: soc2RequirementIds; }; declare const soc2Requirements: SingleFrameworkRequirements; @@ -96,73 +78,73 @@ declare const requirements: AllRequirements; * This type is compatible with ProseMirror/TipTap document structure. */ type JSONContent = { - [key: string]: any; - type?: string; - attrs?: Record; - content?: JSONContent[]; - marks?: { - type: string; - attrs?: Record; - [key: string]: any; - }[]; - text?: string; + [key: string]: any; + type?: string; + attrs?: Record; + content?: JSONContent[]; + marks?: { + type: string; + attrs?: Record; + [key: string]: any; + }[]; + text?: string; }; /** * Represents the metadata associated with a policy document. */ interface TemplatePolicyMetadata { - id: string; - slug: string; - name: string; - description: string; - frequency: Frequency; - department: Departments; + id: string; + slug: string; + name: string; + description: string; + frequency: Frequency; + department: Departments; } /** * Represents the structure of a policy document, including metadata and content. */ interface TemplatePolicy { - /** - * The main type of the document, typically "doc". - */ - type: "doc"; - /** - * Metadata providing details about the policy. - */ - metadata: TemplatePolicyMetadata; - /** - * The structured content of the policy document. - */ - content: JSONContent[]; + /** + * The main type of the document, typically "doc". + */ + type: "doc"; + /** + * Metadata providing details about the policy. + */ + metadata: TemplatePolicyMetadata; + /** + * The structured content of the policy document. + */ + content: JSONContent[]; } type TemplatePolicies = Record; declare const policies: { - readonly access_control_policy: TemplatePolicy; - readonly application_security_policy: TemplatePolicy; - readonly availability_policy: TemplatePolicy; - readonly business_continuity_policy: TemplatePolicy; - readonly change_management_policy: TemplatePolicy; - readonly classification_policy: TemplatePolicy; - readonly code_of_conduct_policy: TemplatePolicy; - readonly confidentiality_policy: TemplatePolicy; - readonly corporate_governance_policy: TemplatePolicy; - readonly cyber_risk_policy: TemplatePolicy; - readonly data_center_policy: TemplatePolicy; - readonly data_classification_policy: TemplatePolicy; - readonly disaster_recovery_policy: TemplatePolicy; - readonly human_resources_policy: TemplatePolicy; - readonly incident_response_policy: TemplatePolicy; - readonly information_security_policy: TemplatePolicy; - readonly password_policy: TemplatePolicy; - readonly privacy_policy: TemplatePolicy; - readonly risk_assessment_policy: TemplatePolicy; - readonly risk_management_policy: TemplatePolicy; - readonly software_development_policy: TemplatePolicy; - readonly system_change_policy: TemplatePolicy; - readonly third_party_policy: TemplatePolicy; - readonly vendor_risk_management_policy: TemplatePolicy; - readonly workstation_policy: TemplatePolicy; + readonly access_control_policy: TemplatePolicy; + readonly application_security_policy: TemplatePolicy; + readonly availability_policy: TemplatePolicy; + readonly business_continuity_policy: TemplatePolicy; + readonly change_management_policy: TemplatePolicy; + readonly classification_policy: TemplatePolicy; + readonly code_of_conduct_policy: TemplatePolicy; + readonly confidentiality_policy: TemplatePolicy; + readonly corporate_governance_policy: TemplatePolicy; + readonly cyber_risk_policy: TemplatePolicy; + readonly data_center_policy: TemplatePolicy; + readonly data_classification_policy: TemplatePolicy; + readonly disaster_recovery_policy: TemplatePolicy; + readonly human_resources_policy: TemplatePolicy; + readonly incident_response_policy: TemplatePolicy; + readonly information_security_policy: TemplatePolicy; + readonly password_policy: TemplatePolicy; + readonly privacy_policy: TemplatePolicy; + readonly risk_assessment_policy: TemplatePolicy; + readonly risk_management_policy: TemplatePolicy; + readonly software_development_policy: TemplatePolicy; + readonly system_change_policy: TemplatePolicy; + readonly third_party_policy: TemplatePolicy; + readonly vendor_risk_management_policy: TemplatePolicy; + readonly workstation_policy: TemplatePolicy; }; type TemplatePolicyId = keyof typeof policies; @@ -171,72 +153,72 @@ type TemplatePolicyId = keyof typeof policies; * that organizations need to maintain and present during audits. */ interface TemplateEvidence { - /** Unique identifier for the evidence */ - id: string; - /** Display name of the evidence */ - name: string; - /** Detailed explanation of what this evidence entails */ - description: string; - /** How often this evidence needs to be collected or updated (e.g., "monthly", "quarterly", "yearly") */ - frequency: Frequency; - /** The organizational department responsible for maintaining this evidence */ - department: Departments; + /** Unique identifier for the evidence */ + id: string; + /** Display name of the evidence */ + name: string; + /** Detailed explanation of what this evidence entails */ + description: string; + /** How often this evidence needs to be collected or updated (e.g., "monthly", "quarterly", "yearly") */ + frequency: Frequency; + /** The organizational department responsible for maintaining this evidence */ + department: Departments; } /** * A mapping of evidence IDs to their corresponding Evidence objects. * Used for efficient lookup of evidence by ID. */ interface TemplateEvidenceMap { - [key: string]: TemplateEvidence; + [key: string]: TemplateEvidence; } declare const evidence: { - readonly access_control_records: TemplateEvidence; - readonly access_logs: TemplateEvidence; - readonly access_removal_records: TemplateEvidence; - readonly access_review_records: TemplateEvidence; - readonly account_management_records: TemplateEvidence; - readonly authentication_records: TemplateEvidence; - readonly board_meeting_documentation: TemplateEvidence; - readonly business_continuity_and_disaster_recovery_testing_records: TemplateEvidence; - readonly business_continuity_plans: TemplateEvidence; - readonly capacity_reports: TemplateEvidence; - readonly change_management_records: TemplateEvidence; - readonly change_request_logs: TemplateEvidence; - readonly change_risk_documentation: TemplateEvidence; - readonly communication_records: TemplateEvidence; - readonly consent_records: TemplateEvidence; - readonly control_implementation_records: TemplateEvidence; - readonly control_testing_documentation: TemplateEvidence; - readonly data_classification_records: TemplateEvidence; - readonly data_processing_logs: TemplateEvidence; - readonly data_quality_documentation: TemplateEvidence; - readonly data_validation_records: TemplateEvidence; - readonly deficiency_management_records: TemplateEvidence; - readonly disposal_records: TemplateEvidence; - readonly ethics_compliance_documentation: TemplateEvidence; - readonly exception_logs: TemplateEvidence; - readonly external_communication_records: TemplateEvidence; - readonly fraud_risk_documentation: TemplateEvidence; - readonly hr_documentation: TemplateEvidence; - readonly incident_analysis_records: TemplateEvidence; - readonly incident_communication_records: TemplateEvidence; - readonly incident_recovery_records: TemplateEvidence; - readonly incident_response_records: TemplateEvidence; - readonly infrastructure_monitoring_records: TemplateEvidence; - readonly malware_prevention_records: TemplateEvidence; - readonly management_structure_documentation: TemplateEvidence; - readonly personnel_compliance_documentation: TemplateEvidence; - readonly physical_access_records: TemplateEvidence; - readonly policy_implementation_records: TemplateEvidence; - readonly privacy_notice: TemplateEvidence; - readonly recovery_records: TemplateEvidence; - readonly retention_schedules: TemplateEvidence; - readonly risk_assessment_documentation: TemplateEvidence; - readonly risk_identification_records: TemplateEvidence; - readonly technology_control_records: TemplateEvidence; - readonly uptime_reports: TemplateEvidence; - readonly vendor_risk_assessment_records: TemplateEvidence; + readonly access_control_records: TemplateEvidence; + readonly access_logs: TemplateEvidence; + readonly access_removal_records: TemplateEvidence; + readonly access_review_records: TemplateEvidence; + readonly account_management_records: TemplateEvidence; + readonly authentication_records: TemplateEvidence; + readonly board_meeting_documentation: TemplateEvidence; + readonly business_continuity_and_disaster_recovery_testing_records: TemplateEvidence; + readonly business_continuity_plans: TemplateEvidence; + readonly capacity_reports: TemplateEvidence; + readonly change_management_records: TemplateEvidence; + readonly change_request_logs: TemplateEvidence; + readonly change_risk_documentation: TemplateEvidence; + readonly communication_records: TemplateEvidence; + readonly consent_records: TemplateEvidence; + readonly control_implementation_records: TemplateEvidence; + readonly control_testing_documentation: TemplateEvidence; + readonly data_classification_records: TemplateEvidence; + readonly data_processing_logs: TemplateEvidence; + readonly data_quality_documentation: TemplateEvidence; + readonly data_validation_records: TemplateEvidence; + readonly deficiency_management_records: TemplateEvidence; + readonly disposal_records: TemplateEvidence; + readonly ethics_compliance_documentation: TemplateEvidence; + readonly exception_logs: TemplateEvidence; + readonly external_communication_records: TemplateEvidence; + readonly fraud_risk_documentation: TemplateEvidence; + readonly hr_documentation: TemplateEvidence; + readonly incident_analysis_records: TemplateEvidence; + readonly incident_communication_records: TemplateEvidence; + readonly incident_recovery_records: TemplateEvidence; + readonly incident_response_records: TemplateEvidence; + readonly infrastructure_monitoring_records: TemplateEvidence; + readonly malware_prevention_records: TemplateEvidence; + readonly management_structure_documentation: TemplateEvidence; + readonly personnel_compliance_documentation: TemplateEvidence; + readonly physical_access_records: TemplateEvidence; + readonly policy_implementation_records: TemplateEvidence; + readonly privacy_notice: TemplateEvidence; + readonly recovery_records: TemplateEvidence; + readonly retention_schedules: TemplateEvidence; + readonly risk_assessment_documentation: TemplateEvidence; + readonly risk_identification_records: TemplateEvidence; + readonly technology_control_records: TemplateEvidence; + readonly uptime_reports: TemplateEvidence; + readonly vendor_risk_assessment_records: TemplateEvidence; }; type TemplateEvidenceKey = keyof typeof evidence; type TemplateEvidenceId = TemplateEvidenceKey; @@ -245,106 +227,37 @@ type TemplateEvidenceId = TemplateEvidenceKey; * Represents an artifact associated with a control * that can be used to demonstrate compliance. */ -type TemplateArtifact = - | { - type: "policy"; - policyId: TemplatePolicyId; - } - | { - type: "evidence"; - evidenceId: TemplateEvidenceId; - }; +type TemplateArtifact = { + type: "policy"; + policyId: TemplatePolicyId; +} | { + type: "evidence"; + evidenceId: TemplateEvidenceId; +}; /** * Represents a requirement that a control addresses. */ type TemplateRequirement = { - frameworkId: T; - requirementId: AllRequirementIdsByFramework[T]; + frameworkId: T; + requirementId: AllRequirementIdsByFramework[T]; }; /** * Represents a security or compliance control that organizations * implement to address specific requirements. */ interface TemplateControl { - /** Unique identifier for the control */ - id: string; - /** Display name of the control */ - name: string; - /** Detailed explanation of what this control entails */ - description: string; - /** List of artifacts used to demonstrate implementation of this control */ - mappedArtifacts: TemplateArtifact[]; - /** List of requirements this control addresses */ - mappedRequirements: TemplateRequirement[]; + /** Unique identifier for the control */ + id: string; + /** Display name of the control */ + name: string; + /** Detailed explanation of what this control entails */ + description: string; + /** List of artifacts used to demonstrate implementation of this control */ + mappedArtifacts: TemplateArtifact[]; + /** List of requirements this control addresses */ + mappedRequirements: TemplateRequirement[]; } -declare const controls: [ - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, -]; +declare const controls: [TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl]; -export { - type AllRequirementIdsByFramework, - type AllRequirements, - type Framework, - type FrameworkId, - type Frameworks, - type Requirement, - type SingleFrameworkRequirements, - type TemplateArtifact, - type TemplateControl, - type TemplateEvidence, - type TemplateEvidenceId, - type TemplateEvidenceKey, - type TemplateEvidenceMap, - type TemplatePolicies, - type TemplatePolicy, - type TemplatePolicyId, - type TemplatePolicyMetadata, - type TemplateRequirement, - type TrainingVideo, - controls, - evidence, - frameworks, - policies, - requirements, - soc2Requirements, - trainingVideos, -}; +export { type AllRequirementIdsByFramework, type AllRequirements, type Framework, type FrameworkId, type Frameworks, type Requirement, type SingleFrameworkRequirements, type TemplateArtifact, type TemplateControl, type TemplateEvidence, type TemplateEvidenceId, type TemplateEvidenceKey, type TemplateEvidenceMap, type TemplatePolicies, type TemplatePolicy, type TemplatePolicyId, type TemplatePolicyMetadata, type TemplateRequirement, type TrainingVideo, controls, evidence, frameworks, policies, requirements, soc2Requirements, trainingVideos }; diff --git a/packages/data/dist/index.d.ts b/packages/data/dist/index.d.ts index 4f268197a2..523100f576 100644 --- a/packages/data/dist/index.d.ts +++ b/packages/data/dist/index.d.ts @@ -1,20 +1,20 @@ -import { Frequency, Departments } from "@comp/db/types"; +import { Frequency, Departments } from '@comp/db/types'; /** * Represents a training video resource that can be used * for user education and compliance training. */ interface TrainingVideo { - /** Unique identifier for the video */ - id: string; - /** Title of the training video */ - title: string; - /** Detailed description of the video content */ - description: string; - /** YouTube video identifier for embedding */ - youtubeId: string; - /** Full URL to access the video */ - url: string; + /** Unique identifier for the video */ + id: string; + /** Title of the training video */ + title: string; + /** Detailed description of the video content */ + description: string; + /** YouTube video identifier for embedding */ + youtubeId: string; + /** Full URL to access the video */ + url: string; } declare const trainingVideos: readonly TrainingVideo[]; @@ -24,19 +24,19 @@ declare const trainingVideos: readonly TrainingVideo[]; * that defines standards for security, privacy, or data handling. */ interface Framework { - /** Name of the framework */ - name: string; - /** Version number or year of the framework */ - version: string; - /** Brief description of the framework's purpose and scope */ - description: string; + /** Name of the framework */ + name: string; + /** Version number or year of the framework */ + version: string; + /** Brief description of the framework's purpose and scope */ + description: string; } /** * Collection of supported compliance frameworks within the system. */ interface Frameworks { - /** SOC 2 (Service Organization Control 2) framework */ - soc2: Framework; + /** SOC 2 (Service Organization Control 2) framework */ + soc2: Framework; } /** * Valid framework ID strings that can be used to reference specific frameworks. @@ -45,46 +45,28 @@ type FrameworkId = keyof Frameworks; declare const frameworks: Frameworks; -type soc2RequirementIds = - | "CC1" - | "CC2" - | "CC3" - | "CC4" - | "CC5" - | "CC6" - | "CC7" - | "CC8" - | "CC9" - | "A1" - | "C1" - | "PI1" - | "P1"; +type soc2RequirementIds = "CC1" | "CC2" | "CC3" | "CC4" | "CC5" | "CC6" | "CC7" | "CC8" | "CC9" | "A1" | "C1" | "PI1" | "P1"; /** * Represents a specific requirement from a compliance framework * that an organization needs to fulfill. */ interface Requirement { - /** Name of the requirement */ - name: string; - /** Detailed explanation of what this requirement entails */ - description: string; + /** Name of the requirement */ + name: string; + /** Detailed explanation of what this requirement entails */ + description: string; } /** * A mapping of requirement codes to their corresponding Requirement objects. * Used for efficient lookup of requirements. */ -type SingleFrameworkRequirements = Record< - A, - Requirement ->; +type SingleFrameworkRequirements = Record; type AllRequirements = { - [K in FrameworkId]: SingleFrameworkRequirements< - AllRequirementIdsByFramework[K] - >; + [K in FrameworkId]: SingleFrameworkRequirements; }; type AllRequirementIdsByFramework = { - soc2: soc2RequirementIds; + soc2: soc2RequirementIds; }; declare const soc2Requirements: SingleFrameworkRequirements; @@ -96,73 +78,73 @@ declare const requirements: AllRequirements; * This type is compatible with ProseMirror/TipTap document structure. */ type JSONContent = { - [key: string]: any; - type?: string; - attrs?: Record; - content?: JSONContent[]; - marks?: { - type: string; - attrs?: Record; - [key: string]: any; - }[]; - text?: string; + [key: string]: any; + type?: string; + attrs?: Record; + content?: JSONContent[]; + marks?: { + type: string; + attrs?: Record; + [key: string]: any; + }[]; + text?: string; }; /** * Represents the metadata associated with a policy document. */ interface TemplatePolicyMetadata { - id: string; - slug: string; - name: string; - description: string; - frequency: Frequency; - department: Departments; + id: string; + slug: string; + name: string; + description: string; + frequency: Frequency; + department: Departments; } /** * Represents the structure of a policy document, including metadata and content. */ interface TemplatePolicy { - /** - * The main type of the document, typically "doc". - */ - type: "doc"; - /** - * Metadata providing details about the policy. - */ - metadata: TemplatePolicyMetadata; - /** - * The structured content of the policy document. - */ - content: JSONContent[]; + /** + * The main type of the document, typically "doc". + */ + type: "doc"; + /** + * Metadata providing details about the policy. + */ + metadata: TemplatePolicyMetadata; + /** + * The structured content of the policy document. + */ + content: JSONContent[]; } type TemplatePolicies = Record; declare const policies: { - readonly access_control_policy: TemplatePolicy; - readonly application_security_policy: TemplatePolicy; - readonly availability_policy: TemplatePolicy; - readonly business_continuity_policy: TemplatePolicy; - readonly change_management_policy: TemplatePolicy; - readonly classification_policy: TemplatePolicy; - readonly code_of_conduct_policy: TemplatePolicy; - readonly confidentiality_policy: TemplatePolicy; - readonly corporate_governance_policy: TemplatePolicy; - readonly cyber_risk_policy: TemplatePolicy; - readonly data_center_policy: TemplatePolicy; - readonly data_classification_policy: TemplatePolicy; - readonly disaster_recovery_policy: TemplatePolicy; - readonly human_resources_policy: TemplatePolicy; - readonly incident_response_policy: TemplatePolicy; - readonly information_security_policy: TemplatePolicy; - readonly password_policy: TemplatePolicy; - readonly privacy_policy: TemplatePolicy; - readonly risk_assessment_policy: TemplatePolicy; - readonly risk_management_policy: TemplatePolicy; - readonly software_development_policy: TemplatePolicy; - readonly system_change_policy: TemplatePolicy; - readonly third_party_policy: TemplatePolicy; - readonly vendor_risk_management_policy: TemplatePolicy; - readonly workstation_policy: TemplatePolicy; + readonly access_control_policy: TemplatePolicy; + readonly application_security_policy: TemplatePolicy; + readonly availability_policy: TemplatePolicy; + readonly business_continuity_policy: TemplatePolicy; + readonly change_management_policy: TemplatePolicy; + readonly classification_policy: TemplatePolicy; + readonly code_of_conduct_policy: TemplatePolicy; + readonly confidentiality_policy: TemplatePolicy; + readonly corporate_governance_policy: TemplatePolicy; + readonly cyber_risk_policy: TemplatePolicy; + readonly data_center_policy: TemplatePolicy; + readonly data_classification_policy: TemplatePolicy; + readonly disaster_recovery_policy: TemplatePolicy; + readonly human_resources_policy: TemplatePolicy; + readonly incident_response_policy: TemplatePolicy; + readonly information_security_policy: TemplatePolicy; + readonly password_policy: TemplatePolicy; + readonly privacy_policy: TemplatePolicy; + readonly risk_assessment_policy: TemplatePolicy; + readonly risk_management_policy: TemplatePolicy; + readonly software_development_policy: TemplatePolicy; + readonly system_change_policy: TemplatePolicy; + readonly third_party_policy: TemplatePolicy; + readonly vendor_risk_management_policy: TemplatePolicy; + readonly workstation_policy: TemplatePolicy; }; type TemplatePolicyId = keyof typeof policies; @@ -171,72 +153,72 @@ type TemplatePolicyId = keyof typeof policies; * that organizations need to maintain and present during audits. */ interface TemplateEvidence { - /** Unique identifier for the evidence */ - id: string; - /** Display name of the evidence */ - name: string; - /** Detailed explanation of what this evidence entails */ - description: string; - /** How often this evidence needs to be collected or updated (e.g., "monthly", "quarterly", "yearly") */ - frequency: Frequency; - /** The organizational department responsible for maintaining this evidence */ - department: Departments; + /** Unique identifier for the evidence */ + id: string; + /** Display name of the evidence */ + name: string; + /** Detailed explanation of what this evidence entails */ + description: string; + /** How often this evidence needs to be collected or updated (e.g., "monthly", "quarterly", "yearly") */ + frequency: Frequency; + /** The organizational department responsible for maintaining this evidence */ + department: Departments; } /** * A mapping of evidence IDs to their corresponding Evidence objects. * Used for efficient lookup of evidence by ID. */ interface TemplateEvidenceMap { - [key: string]: TemplateEvidence; + [key: string]: TemplateEvidence; } declare const evidence: { - readonly access_control_records: TemplateEvidence; - readonly access_logs: TemplateEvidence; - readonly access_removal_records: TemplateEvidence; - readonly access_review_records: TemplateEvidence; - readonly account_management_records: TemplateEvidence; - readonly authentication_records: TemplateEvidence; - readonly board_meeting_documentation: TemplateEvidence; - readonly business_continuity_and_disaster_recovery_testing_records: TemplateEvidence; - readonly business_continuity_plans: TemplateEvidence; - readonly capacity_reports: TemplateEvidence; - readonly change_management_records: TemplateEvidence; - readonly change_request_logs: TemplateEvidence; - readonly change_risk_documentation: TemplateEvidence; - readonly communication_records: TemplateEvidence; - readonly consent_records: TemplateEvidence; - readonly control_implementation_records: TemplateEvidence; - readonly control_testing_documentation: TemplateEvidence; - readonly data_classification_records: TemplateEvidence; - readonly data_processing_logs: TemplateEvidence; - readonly data_quality_documentation: TemplateEvidence; - readonly data_validation_records: TemplateEvidence; - readonly deficiency_management_records: TemplateEvidence; - readonly disposal_records: TemplateEvidence; - readonly ethics_compliance_documentation: TemplateEvidence; - readonly exception_logs: TemplateEvidence; - readonly external_communication_records: TemplateEvidence; - readonly fraud_risk_documentation: TemplateEvidence; - readonly hr_documentation: TemplateEvidence; - readonly incident_analysis_records: TemplateEvidence; - readonly incident_communication_records: TemplateEvidence; - readonly incident_recovery_records: TemplateEvidence; - readonly incident_response_records: TemplateEvidence; - readonly infrastructure_monitoring_records: TemplateEvidence; - readonly malware_prevention_records: TemplateEvidence; - readonly management_structure_documentation: TemplateEvidence; - readonly personnel_compliance_documentation: TemplateEvidence; - readonly physical_access_records: TemplateEvidence; - readonly policy_implementation_records: TemplateEvidence; - readonly privacy_notice: TemplateEvidence; - readonly recovery_records: TemplateEvidence; - readonly retention_schedules: TemplateEvidence; - readonly risk_assessment_documentation: TemplateEvidence; - readonly risk_identification_records: TemplateEvidence; - readonly technology_control_records: TemplateEvidence; - readonly uptime_reports: TemplateEvidence; - readonly vendor_risk_assessment_records: TemplateEvidence; + readonly access_control_records: TemplateEvidence; + readonly access_logs: TemplateEvidence; + readonly access_removal_records: TemplateEvidence; + readonly access_review_records: TemplateEvidence; + readonly account_management_records: TemplateEvidence; + readonly authentication_records: TemplateEvidence; + readonly board_meeting_documentation: TemplateEvidence; + readonly business_continuity_and_disaster_recovery_testing_records: TemplateEvidence; + readonly business_continuity_plans: TemplateEvidence; + readonly capacity_reports: TemplateEvidence; + readonly change_management_records: TemplateEvidence; + readonly change_request_logs: TemplateEvidence; + readonly change_risk_documentation: TemplateEvidence; + readonly communication_records: TemplateEvidence; + readonly consent_records: TemplateEvidence; + readonly control_implementation_records: TemplateEvidence; + readonly control_testing_documentation: TemplateEvidence; + readonly data_classification_records: TemplateEvidence; + readonly data_processing_logs: TemplateEvidence; + readonly data_quality_documentation: TemplateEvidence; + readonly data_validation_records: TemplateEvidence; + readonly deficiency_management_records: TemplateEvidence; + readonly disposal_records: TemplateEvidence; + readonly ethics_compliance_documentation: TemplateEvidence; + readonly exception_logs: TemplateEvidence; + readonly external_communication_records: TemplateEvidence; + readonly fraud_risk_documentation: TemplateEvidence; + readonly hr_documentation: TemplateEvidence; + readonly incident_analysis_records: TemplateEvidence; + readonly incident_communication_records: TemplateEvidence; + readonly incident_recovery_records: TemplateEvidence; + readonly incident_response_records: TemplateEvidence; + readonly infrastructure_monitoring_records: TemplateEvidence; + readonly malware_prevention_records: TemplateEvidence; + readonly management_structure_documentation: TemplateEvidence; + readonly personnel_compliance_documentation: TemplateEvidence; + readonly physical_access_records: TemplateEvidence; + readonly policy_implementation_records: TemplateEvidence; + readonly privacy_notice: TemplateEvidence; + readonly recovery_records: TemplateEvidence; + readonly retention_schedules: TemplateEvidence; + readonly risk_assessment_documentation: TemplateEvidence; + readonly risk_identification_records: TemplateEvidence; + readonly technology_control_records: TemplateEvidence; + readonly uptime_reports: TemplateEvidence; + readonly vendor_risk_assessment_records: TemplateEvidence; }; type TemplateEvidenceKey = keyof typeof evidence; type TemplateEvidenceId = TemplateEvidenceKey; @@ -245,106 +227,37 @@ type TemplateEvidenceId = TemplateEvidenceKey; * Represents an artifact associated with a control * that can be used to demonstrate compliance. */ -type TemplateArtifact = - | { - type: "policy"; - policyId: TemplatePolicyId; - } - | { - type: "evidence"; - evidenceId: TemplateEvidenceId; - }; +type TemplateArtifact = { + type: "policy"; + policyId: TemplatePolicyId; +} | { + type: "evidence"; + evidenceId: TemplateEvidenceId; +}; /** * Represents a requirement that a control addresses. */ type TemplateRequirement = { - frameworkId: T; - requirementId: AllRequirementIdsByFramework[T]; + frameworkId: T; + requirementId: AllRequirementIdsByFramework[T]; }; /** * Represents a security or compliance control that organizations * implement to address specific requirements. */ interface TemplateControl { - /** Unique identifier for the control */ - id: string; - /** Display name of the control */ - name: string; - /** Detailed explanation of what this control entails */ - description: string; - /** List of artifacts used to demonstrate implementation of this control */ - mappedArtifacts: TemplateArtifact[]; - /** List of requirements this control addresses */ - mappedRequirements: TemplateRequirement[]; + /** Unique identifier for the control */ + id: string; + /** Display name of the control */ + name: string; + /** Detailed explanation of what this control entails */ + description: string; + /** List of artifacts used to demonstrate implementation of this control */ + mappedArtifacts: TemplateArtifact[]; + /** List of requirements this control addresses */ + mappedRequirements: TemplateRequirement[]; } -declare const controls: [ - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, - TemplateControl, -]; +declare const controls: [TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl, TemplateControl]; -export { - type AllRequirementIdsByFramework, - type AllRequirements, - type Framework, - type FrameworkId, - type Frameworks, - type Requirement, - type SingleFrameworkRequirements, - type TemplateArtifact, - type TemplateControl, - type TemplateEvidence, - type TemplateEvidenceId, - type TemplateEvidenceKey, - type TemplateEvidenceMap, - type TemplatePolicies, - type TemplatePolicy, - type TemplatePolicyId, - type TemplatePolicyMetadata, - type TemplateRequirement, - type TrainingVideo, - controls, - evidence, - frameworks, - policies, - requirements, - soc2Requirements, - trainingVideos, -}; +export { type AllRequirementIdsByFramework, type AllRequirements, type Framework, type FrameworkId, type Frameworks, type Requirement, type SingleFrameworkRequirements, type TemplateArtifact, type TemplateControl, type TemplateEvidence, type TemplateEvidenceId, type TemplateEvidenceKey, type TemplateEvidenceMap, type TemplatePolicies, type TemplatePolicy, type TemplatePolicyId, type TemplatePolicyMetadata, type TemplateRequirement, type TrainingVideo, controls, evidence, frameworks, policies, requirements, soc2Requirements, trainingVideos };