| Name |
- Status |
-
- Review Date
- |
+ Review Date |
Actions
|
@@ -1093,17 +1100,6 @@ export function Control({
)}
-
-
- {policy.status}
-
- |
{policy.reviewDate
? new Date(
@@ -1137,7 +1133,7 @@ export function Control({
handleLinkPolicy(policy.id)
}
disabled={isLinkingPolicy}
- className="text-xs h-7 text-info border-info-b hover:bg-h-info-bg"
+ className="text-xs h-7 text-info border-info-b hover:bg-h-info-bg"
>
{isLinkingPolicy ? (
@@ -1193,7 +1189,6 @@ export function Control({
| Name |
- Status |
Review Date |
Actions
@@ -1214,17 +1209,6 @@ export function Control({
)}
- |
-
- {policy.status}
-
- |
{policy.reviewDate
? new Date(policy.reviewDate).toLocaleDateString()
diff --git a/apps/console/src/pages/organizations/frameworks/controls/__generated__/ControlLinkedPoliciesQuery.graphql.ts b/apps/console/src/pages/organizations/frameworks/controls/__generated__/ControlLinkedPoliciesQuery.graphql.ts
index c31c8654e..dcca1dfbb 100644
--- a/apps/console/src/pages/organizations/frameworks/controls/__generated__/ControlLinkedPoliciesQuery.graphql.ts
+++ b/apps/console/src/pages/organizations/frameworks/controls/__generated__/ControlLinkedPoliciesQuery.graphql.ts
@@ -1,5 +1,5 @@
/**
- * @generated SignedSource<<9bddb18bf52f14881a85995793bdc1ca>>
+ * @generated SignedSource<<85bdd7f83672d1a88247d958f4b7dfaf>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -9,7 +9,6 @@
// @ts-nocheck
import { ConcreteRequest } from 'relay-runtime';
-export type PolicyStatus = "ACTIVE" | "DRAFT";
export type ControlLinkedPoliciesQuery$variables = {
controlId: string;
};
@@ -19,11 +18,16 @@ export type ControlLinkedPoliciesQuery$data = {
readonly policies?: {
readonly edges: ReadonlyArray<{
readonly node: {
- readonly content: string;
+ readonly createdAt: string;
+ readonly currentPublishedVersion: number | null | undefined;
+ readonly description: string;
readonly id: string;
- readonly name: string;
- readonly reviewDate: string | null | undefined;
- readonly status: PolicyStatus;
+ readonly owner: {
+ readonly fullName: string;
+ readonly id: string;
+ };
+ readonly title: string;
+ readonly updatedAt: string;
};
}>;
};
@@ -85,28 +89,54 @@ v4 = [
"alias": null,
"args": null,
"kind": "ScalarField",
- "name": "name",
+ "name": "title",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
- "name": "content",
+ "name": "description",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
- "name": "status",
+ "name": "currentPublishedVersion",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
- "name": "reviewDate",
+ "name": "createdAt",
+ "storageKey": null
+ },
+ {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "updatedAt",
+ "storageKey": null
+ },
+ {
+ "alias": null,
+ "args": null,
+ "concreteType": "People",
+ "kind": "LinkedField",
+ "name": "owner",
+ "plural": false,
+ "selections": [
+ (v2/*: any*/),
+ {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "fullName",
+ "storageKey": null
+ }
+ ],
"storageKey": null
},
(v3/*: any*/)
@@ -244,7 +274,7 @@ return {
]
},
"params": {
- "cacheID": "67f9bf1d5f255f5406e932abde540e08",
+ "cacheID": "24c5ce380772f28348df8cf089a58a8e",
"id": null,
"metadata": {
"connection": [
@@ -261,11 +291,11 @@ return {
},
"name": "ControlLinkedPoliciesQuery",
"operationKind": "query",
- "text": "query ControlLinkedPoliciesQuery(\n $controlId: ID!\n) {\n control: node(id: $controlId) {\n __typename\n id\n ... on Control {\n policies(first: 100) {\n edges {\n node {\n id\n name\n content\n status\n reviewDate\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n }\n }\n}\n"
+ "text": "query ControlLinkedPoliciesQuery(\n $controlId: ID!\n) {\n control: node(id: $controlId) {\n __typename\n id\n ... on Control {\n policies(first: 100) {\n edges {\n node {\n id\n title\n description\n currentPublishedVersion\n createdAt\n updatedAt\n owner {\n id\n fullName\n }\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n }\n }\n}\n"
}
};
})();
-(node as any).hash = "3904c2344754177177fa7c16129dc894";
+(node as any).hash = "d4d16cac2a05ea1d38fde55d04f21c01";
export default node;
diff --git a/apps/console/src/pages/organizations/frameworks/controls/__generated__/ControlOrganizationPoliciesQuery.graphql.ts b/apps/console/src/pages/organizations/frameworks/controls/__generated__/ControlOrganizationPoliciesQuery.graphql.ts
index ac483608f..8e139a145 100644
--- a/apps/console/src/pages/organizations/frameworks/controls/__generated__/ControlOrganizationPoliciesQuery.graphql.ts
+++ b/apps/console/src/pages/organizations/frameworks/controls/__generated__/ControlOrganizationPoliciesQuery.graphql.ts
@@ -1,5 +1,5 @@
/**
- * @generated SignedSource<>
+ * @generated SignedSource<<1f9de20276a5c0b1291c5e25dc11990b>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -9,7 +9,6 @@
// @ts-nocheck
import { ConcreteRequest } from 'relay-runtime';
-export type PolicyStatus = "ACTIVE" | "DRAFT";
export type ControlOrganizationPoliciesQuery$variables = {
organizationId: string;
};
@@ -19,11 +18,16 @@ export type ControlOrganizationPoliciesQuery$data = {
readonly policies?: {
readonly edges: ReadonlyArray<{
readonly node: {
- readonly content: string;
+ readonly createdAt: string;
+ readonly currentPublishedVersion: number | null | undefined;
+ readonly description: string;
readonly id: string;
- readonly name: string;
- readonly reviewDate: string | null | undefined;
- readonly status: PolicyStatus;
+ readonly owner: {
+ readonly fullName: string;
+ readonly id: string;
+ };
+ readonly title: string;
+ readonly updatedAt: string;
};
}>;
};
@@ -85,28 +89,54 @@ v4 = [
"alias": null,
"args": null,
"kind": "ScalarField",
- "name": "name",
+ "name": "title",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
- "name": "content",
+ "name": "description",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
- "name": "status",
+ "name": "currentPublishedVersion",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
- "name": "reviewDate",
+ "name": "createdAt",
+ "storageKey": null
+ },
+ {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "updatedAt",
+ "storageKey": null
+ },
+ {
+ "alias": null,
+ "args": null,
+ "concreteType": "People",
+ "kind": "LinkedField",
+ "name": "owner",
+ "plural": false,
+ "selections": [
+ (v2/*: any*/),
+ {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "fullName",
+ "storageKey": null
+ }
+ ],
"storageKey": null
},
(v3/*: any*/)
@@ -244,7 +274,7 @@ return {
]
},
"params": {
- "cacheID": "3a3c91f3e18e8a4b66011aa583e262e4",
+ "cacheID": "94e32c7758c8df264b99a44150de687d",
"id": null,
"metadata": {
"connection": [
@@ -261,11 +291,11 @@ return {
},
"name": "ControlOrganizationPoliciesQuery",
"operationKind": "query",
- "text": "query ControlOrganizationPoliciesQuery(\n $organizationId: ID!\n) {\n organization: node(id: $organizationId) {\n __typename\n id\n ... on Organization {\n policies(first: 100) {\n edges {\n node {\n id\n name\n content\n status\n reviewDate\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n }\n }\n}\n"
+ "text": "query ControlOrganizationPoliciesQuery(\n $organizationId: ID!\n) {\n organization: node(id: $organizationId) {\n __typename\n id\n ... on Organization {\n policies(first: 100) {\n edges {\n node {\n id\n title\n description\n currentPublishedVersion\n createdAt\n updatedAt\n owner {\n id\n fullName\n }\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n }\n }\n}\n"
}
};
})();
-(node as any).hash = "f4699d729e6df6192efd201047689204";
+(node as any).hash = "47aaf55ffb65d3220df2b0fe2688bc12";
export default node;
diff --git a/apps/console/src/pages/organizations/policies/EditPolicyView.tsx b/apps/console/src/pages/organizations/policies/EditPolicyView.tsx
index 5ffc9d121..a1e60a434 100644
--- a/apps/console/src/pages/organizations/policies/EditPolicyView.tsx
+++ b/apps/console/src/pages/organizations/policies/EditPolicyView.tsx
@@ -10,27 +10,30 @@ import {
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
+import { Textarea } from "@/components/ui/textarea";
import { Label } from "@/components/ui/label";
import { toast } from "@/hooks/use-toast";
-import { Calendar, User } from "lucide-react";
-import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group";
import { Suspense } from "react";
-import PolicyEditor from "@/components/PolicyEditor";
import PeopleSelector from "@/components/PeopleSelector";
import type { EditPolicyViewQuery } from "./__generated__/EditPolicyViewQuery.graphql";
import type { EditPolicyViewMutation as EditPolicyViewMutationType } from "./__generated__/EditPolicyViewMutation.graphql";
import { PageTemplate } from "@/components/PageTemplate";
import { EditPolicyViewSkeleton } from "./EditPolicyPage";
+import { User } from "lucide-react";
const editPolicyViewQuery = graphql`
- query EditPolicyViewQuery($policyId: ID!, $organizationId: ID!) {
+ query EditPolicyViewQuery($policyId: ID!, $organizationId: ID!, $policyVersionId: ID!) {
+ policyVersion: node(id: $policyVersionId) {
+ id
+ ... on PolicyVersion {
+ content
+ }
+ }
+
policy: node(id: $policyId) {
id
... on Policy {
- name
- content
- status
- reviewDate
+ title
owner {
id
fullName
@@ -44,18 +47,11 @@ const editPolicyViewQuery = graphql`
`;
const UpdatePolicyMutation = graphql`
- mutation EditPolicyViewMutation($input: UpdatePolicyInput!) {
- updatePolicy(input: $input) {
- policy {
+ mutation EditPolicyViewMutation($input: UpdatePolicyVersionInput!) {
+ updatePolicyVersion(input: $input) {
+ policyVersion {
id
- name
content
- status
- reviewDate
- owner {
- id
- fullName
- }
}
}
}
@@ -67,56 +63,28 @@ function EditPolicyViewContent({
queryRef: PreloadedQuery;
}) {
const navigate = useNavigate();
- const { organizationId, policyId } = useParams();
+ const { organizationId, policyId, versionId } = useParams();
const data = usePreloadedQuery(
editPolicyViewQuery,
queryRef
);
- console.log("EditPolicyView data:", data.policy);
+ const [content, setContent] = useState(data.policyVersion.content || "");
- const [name, setName] = useState(data.policy.name);
- const [content, setContent] = useState(data.policy.content || "");
- const [status, setStatus] = useState(data.policy.status);
- const [reviewDate, setReviewDate] = useState(data.policy.reviewDate || "");
- const [ownerId, setOwnerId] = useState(
- data.policy.owner?.id || null
- );
- const [isSubmitting, setIsSubmitting] = useState(false);
-
- console.log(
- "EditPolicyView state - content:",
- content
- ? content.substring(0, 50) + (content.length > 50 ? "..." : "")
- : "empty"
- );
-
- const [commitMutation] =
+ const [updatePolicy, isSubmitting] =
useMutation(UpdatePolicyMutation);
const handleSubmit = (e: React.FormEvent) => {
e.preventDefault();
- setIsSubmitting(true);
- // Convert reviewDate string to ISO format for the API
- let reviewDateValue = null;
- if (reviewDate) {
- reviewDateValue = new Date(reviewDate).toISOString();
- }
-
- commitMutation({
+ updatePolicy({
variables: {
input: {
- id: data.policy.id,
- name,
+ policyVersionId: data.policyVersion.id,
content,
- status,
- reviewDate: reviewDateValue,
- ownerId,
},
},
- onCompleted: (response, errors) => {
- setIsSubmitting(false);
+ onCompleted: (_, errors) => {
if (errors) {
console.error("Error updating policy:", errors);
toast({
@@ -134,7 +102,6 @@ function EditPolicyViewContent({
navigate(`/organizations/${organizationId}/policies/${policyId}`);
},
onError: (error) => {
- setIsSubmitting(false);
console.error("Error updating policy:", error);
toast({
title: "Error",
@@ -153,77 +120,20 @@ function EditPolicyViewContent({
Policy Information
-
-
- setName(e.target.value)}
- required
- />
-
-
-
-
-
-
-
- setStatus(value as "DRAFT" | "ACTIVE")
- }
- className="flex space-x-4"
- >
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- setReviewDate(e.target.value)}
- />
-
@@ -250,15 +160,17 @@ function EditPolicyViewContent({
}
export default function EditPolicyView() {
- const { organizationId, policyId } = useParams();
+ const { organizationId, policyId, versionId } = useParams();
const [queryRef, loadQuery] =
useQueryLoader (editPolicyViewQuery);
useEffect(() => {
- if (organizationId && policyId) {
- loadQuery({ organizationId, policyId });
- }
- }, [organizationId, policyId, loadQuery]);
+ loadQuery({
+ organizationId: organizationId!,
+ policyId: policyId!,
+ policyVersionId: versionId!,
+ });
+ }, [organizationId, policyId, versionId]);
if (!queryRef) {
return ;
@@ -266,7 +178,7 @@ export default function EditPolicyView() {
return (
}>
- {queryRef && }
+
);
}
diff --git a/apps/console/src/pages/organizations/policies/NewPolicyPage.tsx b/apps/console/src/pages/organizations/policies/NewPolicyPage.tsx
deleted file mode 100644
index f97c78b15..000000000
--- a/apps/console/src/pages/organizations/policies/NewPolicyPage.tsx
+++ /dev/null
@@ -1,30 +0,0 @@
-import { PageTemplateSkeleton } from "@/components/PageTemplate";
-import { Suspense } from "react";
-import { useLocation } from "react-router";
-import { ErrorBoundaryWithLocation } from "../ErrorBoundary";
-import { lazy } from "@probo/react-lazy";
-
-const NewPolicyView = lazy(() => import("./NewPolicyView"));
-
-export function NewPolicyViewSkeleton() {
- return (
-
-
-
- );
-}
-
-export function NewPolicyPage() {
- const location = useLocation();
-
- return (
- }>
-
-
-
-
- );
-}
diff --git a/apps/console/src/pages/organizations/policies/NewPolicyView.tsx b/apps/console/src/pages/organizations/policies/NewPolicyView.tsx
deleted file mode 100644
index b7a56bc34..000000000
--- a/apps/console/src/pages/organizations/policies/NewPolicyView.tsx
+++ /dev/null
@@ -1,281 +0,0 @@
-import { useState, useEffect } from "react";
-import { useNavigate, useParams } from "react-router";
-import {
- ConnectionHandler,
- graphql,
- useMutation,
- useQueryLoader,
- usePreloadedQuery,
- PreloadedQuery,
-} from "react-relay";
-import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
-import { Button } from "@/components/ui/button";
-import { Input } from "@/components/ui/input";
-import { Label } from "@/components/ui/label";
-import { useToast } from "@/hooks/use-toast";
-import { Calendar, User } from "lucide-react";
-import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group";
-import PolicyEditor from "@/components/PolicyEditor";
-import PeopleSelector from "@/components/PeopleSelector";
-import { Suspense } from "react";
-import type { NewPolicyViewMutation } from "./__generated__/NewPolicyViewMutation.graphql";
-import type { NewPolicyViewQuery } from "./__generated__/NewPolicyViewQuery.graphql";
-import { PageTemplate } from "@/components/PageTemplate";
-import { NewPolicyViewSkeleton } from "./NewPolicyPage";
-
-const newPolicyQuery = graphql`
- query NewPolicyViewQuery($organizationId: ID!) {
- organization: node(id: $organizationId) {
- ...PeopleSelector_organization
- }
- }
-`;
-
-const CreatePolicyMutation = graphql`
- mutation NewPolicyViewMutation(
- $input: CreatePolicyInput!
- $connections: [ID!]!
- ) {
- createPolicy(input: $input) {
- policyEdge @prependEdge(connections: $connections) {
- node {
- id
- name
- content
- status
- reviewDate
- owner {
- id
- fullName
- }
- }
- }
- }
- }
-`;
-
-function CreatePolicyForm({
- queryRef,
-}: {
- queryRef: PreloadedQuery;
-}) {
- const navigate = useNavigate();
- const { organizationId } = useParams();
- const data = usePreloadedQuery(newPolicyQuery, queryRef);
- const [name, setName] = useState("");
- const [content, setContent] = useState("");
- const [status, setStatus] = useState<"DRAFT" | "ACTIVE">("DRAFT");
- const [reviewDate, setReviewDate] = useState("");
- const [ownerId, setOwnerId] = useState(null);
- const [isSubmitting, setIsSubmitting] = useState(false);
- const { toast } = useToast();
-
- console.log(
- "NewPolicyView state - content:",
- content
- ? content.substring(0, 50) + (content.length > 50 ? "..." : "")
- : "empty"
- );
-
- const [createPolicy] =
- useMutation(CreatePolicyMutation);
-
- const handleSubmit = (e: React.FormEvent) => {
- e.preventDefault();
-
- if (!ownerId) {
- toast({
- title: "Error",
- description: "Please select an owner for the policy.",
- variant: "destructive",
- });
- return;
- }
-
- setIsSubmitting(true);
-
- // Convert reviewDate string to ISO format for the API
- let reviewDateValue = null;
- if (reviewDate) {
- reviewDateValue = new Date(reviewDate).toISOString();
- }
-
- const input = {
- organizationId: organizationId!,
- name,
- content,
- status,
- reviewDate: reviewDateValue,
- ownerId,
- };
-
- createPolicy({
- variables: {
- input,
- connections: [
- ConnectionHandler.getConnectionID(
- organizationId!,
- "PolicyListView_policies"
- ),
- ],
- },
- onCompleted: (response, errors) => {
- setIsSubmitting(false);
- if (errors) {
- console.error("Error creating policy:", errors);
- toast({
- title: "Error",
- description: "Failed to create policy. Please try again.",
- variant: "destructive",
- });
- return;
- }
-
- toast({
- title: "Success",
- description: "Policy created successfully!",
- });
-
- navigate(
- `/organizations/${organizationId}/policies/${response.createPolicy.policyEdge.node.id}`
- );
- },
- onError: (error) => {
- setIsSubmitting(false);
- console.error("Error creating policy:", error);
- toast({
- title: "Error",
- description: "Failed to create policy. Please try again.",
- variant: "destructive",
- });
- },
- });
- };
-
- return (
-
-
-
- );
-}
-
-export default function NewPolicyView() {
- const { organizationId } = useParams();
- const [queryRef, loadQuery] =
- useQueryLoader(newPolicyQuery);
-
- useEffect(() => {
- if (organizationId) {
- loadQuery({ organizationId });
- }
- }, [organizationId, loadQuery]);
-
- if (!queryRef) {
- return ;
- }
-
- return (
- }>
- {}
-
- );
-}
diff --git a/apps/console/src/pages/organizations/policies/PolicyListView.tsx b/apps/console/src/pages/organizations/policies/PolicyListView.tsx
index 5003ddcde..91f4bc8cf 100644
--- a/apps/console/src/pages/organizations/policies/PolicyListView.tsx
+++ b/apps/console/src/pages/organizations/policies/PolicyListView.tsx
@@ -15,6 +15,7 @@ import {
MoreHorizontal,
Trash2,
Eye,
+ X,
} from "lucide-react";
import { Badge } from "@/components/ui/badge";
import {
@@ -24,24 +25,59 @@ import {
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
import { useToast } from "@/hooks/use-toast";
-import type { PolicyListViewQuery as PolicyListViewQueryType } from "./__generated__/PolicyListViewQuery.graphql";
+import { format } from "date-fns";
+import type { PolicyListViewQuery, PolicyListViewQuery$data } from "./__generated__/PolicyListViewQuery.graphql";
import type { PolicyListViewDeleteMutation } from "./__generated__/PolicyListViewDeleteMutation.graphql";
+import type { PolicyListViewCreateMutation } from "./__generated__/PolicyListViewCreateMutation.graphql";
import { PageTemplate } from "@/components/PageTemplate";
import { PolicyListViewSkeleton } from "./PolicyListPage";
+import {
+ Dialog,
+ DialogContent,
+ DialogFooter,
+ DialogTitle,
+ DialogDescription,
+} from "@/components/ui/dialog";
+import { Avatar } from "@/components/ui/avatar";
+import { cn } from "@/lib/utils";
+import PeopleSelector from "@/components/PeopleSelector";
+import type { PeopleSelector_organization$key } from "@/components/__generated__/PeopleSelector_organization.graphql";
+import { Input } from "@/components/ui/input";
+import { Textarea } from "@/components/ui/textarea";
-const PolicyListViewQuery = graphql`
+const policyListViewQuery = graphql`
query PolicyListViewQuery($organizationId: ID!) {
+ viewer {
+ user {
+ id
+ }
+ }
+
organization: node(id: $organizationId) {
... on Organization {
- policies(first: 100) @connection(key: "PolicyListView_policies") {
+ ...PeopleSelector_organization
+ policies(first: 50, orderBy: {field: TITLE, direction: ASC}) @connection(key: "PolicyListView_policies") {
edges {
node {
id
- name
- content
+ title
+ description
+ currentPublishedVersion
createdAt
updatedAt
- status
+ owner {
+ id
+ fullName
+ }
+ versions(first: 1) {
+ edges {
+ node {
+ id
+ status
+ updatedAt
+ }
+ }
+ }
}
}
}
@@ -61,29 +97,47 @@ const DeletePolicyMutation = graphql`
}
`;
+const createPolicyMutation = graphql`
+ mutation PolicyListViewCreateMutation(
+ $input: CreatePolicyInput!
+ $connections: [ID!]!
+ ) {
+ createPolicy(input: $input) {
+ policyEdge @prependEdge(connections: $connections) {
+ node {
+ id
+ title
+ description
+ createdAt
+ updatedAt
+ owner {
+ id
+ fullName
+ }
+ }
+ }
+ }
+ }
+`;
+
function PolicyTableRow({
policy,
organizationId,
}: {
- policy: {
- id: string;
- name: string;
- content?: string;
- status?: string;
- updatedAt: string;
- };
+ policy: NonNullable["edges"][0]["node"];
organizationId: string;
}) {
const navigate = useNavigate();
const { toast } = useToast();
- const [isDeleting, setIsDeleting] = useState(false);
- const [commitDeleteMutation] = useMutation(DeletePolicyMutation);
+ const [deletePolicy, isDeleting] = useMutation(DeletePolicyMutation);
- const handleDelete = (e: React.MouseEvent) => {
+ const latestVersion = policy.versions?.edges[0]?.node;
+ const status = latestVersion?.status || "DRAFT";
+
+ const handleDeletePolicy = (e: React.MouseEvent) => {
e.stopPropagation();
if (window.confirm("Are you sure you want to delete this policy? This action cannot be undone.")) {
- setIsDeleting(true);
- commitDeleteMutation({
+ deletePolicy({
variables: {
input: {
policyId: policy.id,
@@ -96,7 +150,6 @@ function PolicyTableRow({
],
},
onCompleted: (_, errors) => {
- setIsDeleting(false);
if (errors) {
console.error("Error deleting policy:", errors);
toast({
@@ -112,7 +165,6 @@ function PolicyTableRow({
});
},
onError: (error) => {
- setIsDeleting(false);
console.error("Error deleting policy:", error);
toast({
title: "Error",
@@ -131,27 +183,33 @@ function PolicyTableRow({
return (
{
navigate(`/organizations/${organizationId}/policies/${policy.id}`);
}}
>
|
- {policy.name}
-
- Description
+ {policy.title}
+
+ {policy.description || "No description provided"}
|
- Mon, 8 Mar. 2025
+
+ {format(new Date(policy.updatedAt), "MMM d, yyyy")}
+
|
- Draft
+ {status === "PUBLISHED" ? "Published" : "Draft"}
|
@@ -172,8 +230,8 @@ function PolicyTableRow({
View
@@ -186,60 +244,264 @@ function PolicyTableRow({
);
}
+function CreatePolicyModal({
+ open,
+ onOpenChange,
+ organizationId,
+ organizationRef,
+}: {
+ open: boolean;
+ onOpenChange: (open: boolean) => void;
+ organizationId: string;
+ organizationRef: PeopleSelector_organization$key;
+}) {
+ const { toast } = useToast();
+ const [title, setTitle] = useState("");
+ const [content, setContent] = useState("");
+ const [ownerId, setOwnerId] = useState(null);
+
+ const [createPolicy, isCreating] = useMutation(createPolicyMutation);
+
+ // Reset form fields
+ const resetForm = () => {
+ setTitle("");
+ setContent("");
+ setOwnerId(null);
+ };
+
+ const handleCreatePolicy = () => {
+ if (!title.trim()) {
+ toast({
+ title: "Error",
+ description: "Please enter a policy title.",
+ variant: "destructive",
+ });
+ return;
+ }
+
+ if (!ownerId) {
+ toast({
+ title: "Error",
+ description: "Please select an owner for the policy.",
+ variant: "destructive",
+ });
+ return;
+ }
+
+ const input = {
+ organizationId,
+ title,
+ content,
+ ownerId,
+ };
+
+ createPolicy({
+ variables: {
+ input,
+ connections: [
+ ConnectionHandler.getConnectionID(
+ organizationId,
+ "PolicyListView_policies",
+ {orderBy: {field: "TITLE", direction: "ASC"}}
+ ),
+ ],
+ },
+ onCompleted: (response, errors) => {
+ if (errors) {
+ console.error("Error creating policy:", errors);
+ toast({
+ title: "Error",
+ description: "Failed to create policy. Please try again.",
+ variant: "destructive",
+ });
+ return;
+ }
+
+ toast({
+ title: "Success",
+ description: "Policy created successfully!",
+ });
+
+ resetForm();
+ onOpenChange(false);
+ },
+ onError: (error) => {
+ console.error("Error creating policy:", error);
+ toast({
+ title: "Error",
+ description: "Failed to create policy. Please try again.",
+ variant: "destructive",
+ });
+ },
+ });
+ };
+
+ // Reset form when modal closes
+ useEffect(() => {
+ if (!open) {
+ resetForm();
+ }
+ }, [open]);
+
+ return (
+
+ );
+}
+
function PolicyListViewContent({
queryRef,
}: {
- queryRef: PreloadedQuery;
+ queryRef: PreloadedQuery;
}) {
- const data = usePreloadedQuery(
- PolicyListViewQuery,
+ const data = usePreloadedQuery(
+ policyListViewQuery,
queryRef
);
const { organizationId } = useParams();
const policies =
- data.organization.policies?.edges.map((edge) => edge?.node) ?? [];
+ data.organization?.policies?.edges.map((edge) => edge?.node) ?? [];
+
+ const [createModalOpen, setCreateModalOpen] = useState(false);
+
+ const handleOpenModal = () => {
+ setCreateModalOpen(true);
+ };
+
+ const handleCloseModal = (open: boolean) => {
+ setCreateModalOpen(open);
+ };
return (
-
-
- Create policy
-
+
}
>
{/* Policy table */}
-
+
-
- |
+ |
+ |
- Vendor
-
+ Policy
+
|
-
+ |
Last update
-
+
|
-
+ |
Status
-
+
|
- |
+ |
-
+
{policies.length > 0 ? (
- policies.map((policy) => (
+ policies.map((policy: any) => (
No policies found
-
+
Create your first policy to get started
-
@@ -267,13 +527,20 @@ function PolicyListViewContent({
+
+
);
}
export default function PolicyListView() {
const [queryRef, loadQuery] =
- useQueryLoader (PolicyListViewQuery);
+ useQueryLoader(policyListViewQuery);
const { organizationId } = useParams();
diff --git a/apps/console/src/pages/organizations/policies/PolicyView.tsx b/apps/console/src/pages/organizations/policies/PolicyView.tsx
deleted file mode 100644
index 103a26686..000000000
--- a/apps/console/src/pages/organizations/policies/PolicyView.tsx
+++ /dev/null
@@ -1,423 +0,0 @@
-import { Suspense, useEffect, useState, useCallback } from "react";
-import { useParams, Link, useNavigate } from "react-router";
-import {
- graphql,
- PreloadedQuery,
- usePreloadedQuery,
- useQueryLoader,
- useMutation,
- ConnectionHandler,
-} from "react-relay";
-import { Edit, Download, Shield, User, FileText, Calendar } from "lucide-react";
-import { Card, CardContent } from "@/components/ui/card";
-import { Button } from "@/components/ui/button";
-import { Badge } from "@/components/ui/badge";
-import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
-import type { PolicyViewQuery as PolicyViewQueryType } from "./__generated__/PolicyViewQuery.graphql";
-import type { PolicyViewDeleteMutation } from "./__generated__/PolicyViewDeleteMutation.graphql";
-import { useToast } from "@/hooks/use-toast";
-import { PageTemplate } from "@/components/PageTemplate";
-import { PolicyViewSkeleton } from "./PolicyPage";
-
-const PolicyViewQuery = graphql`
- query PolicyViewQuery($policyId: ID!) {
- node(id: $policyId) {
- id
- ... on Policy {
- name
- content
- createdAt
- updatedAt
- reviewDate
- status
- owner {
- id
- fullName
- primaryEmailAddress
- }
- }
- }
- }
-`;
-
-const DeletePolicyMutation = graphql`
- mutation PolicyViewDeleteMutation(
- $input: DeletePolicyInput!
- $connections: [ID!]!
- ) {
- deletePolicy(input: $input) {
- deletedPolicyId @deleteEdge(connections: $connections)
- }
- }
-`;
-
-function PolicyViewContent({
- queryRef,
-}: {
- queryRef: PreloadedQuery;
-}) {
- const data = usePreloadedQuery(PolicyViewQuery, queryRef);
- const policy = data.node;
- const { organizationId } = useParams();
- const navigate = useNavigate();
- const [activeTab, setActiveTab] = useState("content");
- const [isDeleting, setIsDeleting] = useState(false);
- const { toast } = useToast();
-
- const [commitDeleteMutation] =
- useMutation(DeletePolicyMutation);
-
- const handleDeletePolicy = useCallback(() => {
- if (
- window.confirm(
- "Are you sure you want to delete this policy? This action cannot be undone."
- )
- ) {
- setIsDeleting(true);
-
- commitDeleteMutation({
- variables: {
- input: {
- policyId: policy.id,
- },
- connections: [
- ConnectionHandler.getConnectionID(
- organizationId!,
- "PolicyListPage_policies"
- ),
- ],
- },
- onCompleted: (_, errors) => {
- setIsDeleting(false);
- if (errors) {
- console.error("Error deleting policy:", errors);
- toast({
- title: "Error",
- description: "Failed to delete policy. Please try again.",
- variant: "destructive",
- });
- return;
- }
-
- toast({
- title: "Success",
- description: "Policy deleted successfully.",
- });
-
- navigate(`/organizations/${organizationId}/policies`);
- },
- onError: (error) => {
- setIsDeleting(false);
- console.error("Error deleting policy:", error);
- toast({
- title: "Error",
- description: "Failed to delete policy. Please try again.",
- variant: "destructive",
- });
- },
- });
- }
- }, [policy.id, organizationId, commitDeleteMutation, navigate]);
-
- // Extract a short description from the content
- const getDescription = (content: string | undefined) => {
- if (!content) return "No description available";
-
- // Remove HTML tags
- const withoutTags = content.replace(/<[^>]*>/g, "");
- // Decode HTML entities
- const decoded = withoutTags
- .replace(/&/g, "&")
- .replace(/</g, "<")
- .replace(/>/g, ">")
- .replace(/"/g, '"')
- .replace(/'/g, "'")
- .replace(/ /g, " ");
-
- // Get first paragraph or first 150 characters
- const firstParagraph = decoded.split("\n\n")[0].trim();
- return firstParagraph.length > 150
- ? firstParagraph.substring(0, 150) + "..."
- : firstParagraph;
- };
-
- const formatDate = (dateString: string | undefined) => {
- if (!dateString) return "N/A";
- const date = new Date(dateString);
- return date.toISOString().split("T")[0]; // YYYY-MM-DD format
- };
-
- return (
-
-
- {policy.status === "ACTIVE" ? "Active" : "Draft"}
-
- {policy.owner && (
-
-
-
- {policy.owner.fullName}
-
-
- )}
- {policy.reviewDate && (
-
-
- Review: {formatDate(policy.reviewDate)}
-
- )}
-
- }
- actions={
-
-
-
-
- Edit
-
-
- {
- // Logic to download policy content as PDF or text
- const element = document.createElement("a");
- const file = new Blob([policy.content || ""], {
- type: "text/plain",
- });
- element.href = URL.createObjectURL(file);
- element.download = `${policy.name}.txt`;
- document.body.appendChild(element);
- element.click();
- document.body.removeChild(element);
- }}
- >
-
- Download
-
-
- }
- >
-
-
-
-
-
-
-
-
-
- {policy.status && (
-
- {policy.status === "ACTIVE"
- ? "Active"
- : policy.status === "DRAFT"
- ? "Draft"
- : policy.status}
-
- )}
-
-
-
- {policy.name}
-
-
- {getDescription(policy.content)}
-
-
-
-
-
- Policy Content
-
-
- Version History
-
-
- Approvals
-
-
-
-
-
-
-
-
-
-
- Version history will be available soon.
-
-
-
-
-
-
-
- Approval workflow will be available soon.
-
-
-
-
-
-
-
-
-
-
-
- Policy Details
-
-
-
-
-
- Last Updated
-
- {formatDate(policy.updatedAt)}
-
-
-
-
-
- Review Due
-
-
- {policy.reviewDate
- ? formatDate(policy.reviewDate)
- : "Not set"}
-
-
-
-
-
-
- Owner
-
-
-
- {policy.owner ? policy.owner.fullName : "Not assigned"}
-
-
-
-
-
-
-
-
-
-
- Edit Policy
-
-
-
-
-
- Danger Zone
-
- Permanently delete this policy and all of its data. This action
- cannot be undone.
-
-
-
- {isDeleting ? "Deleting..." : "Delete Policy"}
-
-
-
-
-
-
- );
-}
-
-export default function PolicyView() {
- const [queryRef, loadQuery] =
- useQueryLoader(PolicyViewQuery);
-
- const { policyId } = useParams();
-
- useEffect(() => {
- loadQuery({ policyId: policyId! });
- }, [loadQuery, policyId]);
-
- if (!queryRef) {
- return ;
- }
-
- return (
- }>
- {queryRef && }
-
- );
-}
diff --git a/apps/console/src/pages/organizations/policies/PolicyPage.tsx b/apps/console/src/pages/organizations/policies/ShowPolicyPage.tsx
similarity index 95%
rename from apps/console/src/pages/organizations/policies/PolicyPage.tsx
rename to apps/console/src/pages/organizations/policies/ShowPolicyPage.tsx
index ca095f5c2..db21fb2f0 100644
--- a/apps/console/src/pages/organizations/policies/PolicyPage.tsx
+++ b/apps/console/src/pages/organizations/policies/ShowPolicyPage.tsx
@@ -5,9 +5,9 @@ import { useLocation } from "react-router";
import { ErrorBoundaryWithLocation } from "../ErrorBoundary";
import { lazy } from "@probo/react-lazy";
-const PolicyView = lazy(() => import("./PolicyView"));
+const ShowPolicyView = lazy(() => import("./ShowPolicyView"));
-export function PolicyViewSkeleton() {
+export function ShowPolicyViewSkeleton() {
return (
}>
+ }>
-
+
);
diff --git a/apps/console/src/pages/organizations/policies/ShowPolicyView.tsx b/apps/console/src/pages/organizations/policies/ShowPolicyView.tsx
new file mode 100644
index 000000000..ad21cc81d
--- /dev/null
+++ b/apps/console/src/pages/organizations/policies/ShowPolicyView.tsx
@@ -0,0 +1,426 @@
+import { Suspense, useEffect, useState, useCallback, ReactNode } from "react";
+import { useParams, Link, useNavigate } from "react-router";
+import {
+ graphql,
+ PreloadedQuery,
+ usePreloadedQuery,
+ useQueryLoader,
+ useMutation,
+} from "react-relay";
+import { Clock, Download, Edit, Trash2, MoreHorizontal, X, FileSignature } from "lucide-react";
+import { Button } from "@/components/ui/button";
+import { useToast } from "@/hooks/use-toast";
+import { PageTemplate } from "@/components/PageTemplate";
+import type { ShowPolicyViewQuery } from "./__generated__/ShowPolicyViewQuery.graphql";
+import { ShowPolicyViewPublishMutation } from "./__generated__/ShowPolicyViewPublishMutation.graphql";
+import { ShowPolicyViewCreateDraftMutation } from "./__generated__/ShowPolicyViewCreateDraftMutation.graphql";
+import ReactMarkdown from "react-markdown";
+import { ShowPolicyViewSkeleton } from "./ShowPolicyPage";
+import { format } from "date-fns";
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuTrigger,
+} from "@/components/ui/dropdown-menu";
+import {
+ Dialog,
+ DialogContent,
+ DialogDescription,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from "@/components/ui/dialog";
+import { SignaturesModal } from "./SignaturesModal";
+import { VersionHistoryModal } from "./VersionHistoryModal";
+
+const policyViewQuery = graphql`
+ query ShowPolicyViewQuery($policyId: ID!) {
+ node(id: $policyId) {
+ id
+ ... on Policy {
+ title
+ description
+ createdAt
+ updatedAt
+ currentPublishedVersion
+ owner {
+ id
+ fullName
+ primaryEmailAddress
+ }
+
+ ...SignaturesModal_policyVersions
+ ...VersionHistoryModal_policyVersions
+
+ latestVersion: versions(first: 1) {
+ edges {
+ node {
+ id
+ version
+ status
+ content
+ changelog
+ publishedAt
+ publishedBy {
+ fullName
+ }
+ createdAt
+ updatedAt
+ }
+ }
+ }
+ }
+ }
+ }
+`;
+
+const publishPolicyVersionMutation = graphql`
+ mutation ShowPolicyViewPublishMutation($input: PublishPolicyVersionInput!) {
+ publishPolicyVersion(input: $input) {
+ policy {
+ id
+ currentPublishedVersion
+ }
+ policyVersion {
+ id
+ status
+ publishedAt
+ publishedBy {
+ fullName
+ }
+ }
+ }
+ }
+`;
+
+const createDraftPolicyVersionMutation = graphql`
+ mutation ShowPolicyViewCreateDraftMutation($input: CreateDraftPolicyVersionInput!) {
+ createDraftPolicyVersion(input: $input) {
+ policyVersionEdge {
+ node {
+ id
+ version
+ status
+ }
+ }
+ }
+ }
+`;
+
+function ShowPolicyContent({
+ queryRef,
+}: {
+ queryRef: PreloadedQuery;
+}) {
+ const data = usePreloadedQuery(policyViewQuery, queryRef);
+ const policy = data.node;
+ const { organizationId } = useParams();
+ const navigate = useNavigate();
+ const { toast } = useToast();
+ const [queryRef2, loadQuery] = useQueryLoader(policyViewQuery);
+ const [isDeleteDialogOpen, setIsDeleteDialogOpen] = useState(false);
+ const [isDeleting, setIsDeleting] = useState(false);
+ const [isVersionHistoryOpen, setIsVersionHistoryOpen] = useState(false);
+ const [isSignaturesModalOpen, setIsSignaturesModalOpen] = useState(false);
+
+ const [publishDraft, isPublishInFlight] = useMutation(publishPolicyVersionMutation);
+ const [createDraft, isCreateDraftInFlight] = useMutation(createDraftPolicyVersionMutation);
+
+ const latestVersionEdge = policy.latestVersion?.edges[0];
+ const latestVersionNode = latestVersionEdge?.node;
+
+ const isDraft = latestVersionNode?.status === "DRAFT";
+
+ useEffect(() => {
+ // No need to update selectedVersion state since we're using the VersionHistoryModal component
+ }, []);
+
+
+ // Handle delete policy
+ const handleDeletePolicy = useCallback(() => {
+ setIsDeleteDialogOpen(true);
+ }, []);
+
+ // Confirm delete policy
+ const confirmDeletePolicy = useCallback(() => {
+ setIsDeleting(true);
+
+ setTimeout(() => {
+ toast({
+ title: "Policy deleted",
+ description: "The policy has been deleted successfully",
+ });
+ setIsDeleting(false);
+ setIsDeleteDialogOpen(false);
+ navigate(`/organizations/${organizationId}/policies`);
+ }, 1000);
+ }, [toast, navigate, organizationId]);
+
+ // Navigate to publish flow
+ const handlePublish = useCallback(() => {
+ if (!policy.id) return;
+
+ publishDraft({
+ variables: {
+ input: {
+ policyId: policy.id
+ }
+ },
+ onCompleted: (_, errors) => {
+ if (errors) {
+ toast({
+ title: "Error publishing policy",
+ description: errors[0]?.message || "An unknown error occurred",
+ variant: "destructive"
+ });
+ return;
+ }
+
+ toast({
+ title: "Policy published",
+ description: `The policy has been published successfully`,
+ });
+
+ // Reload the query to refresh the data
+ loadQuery({ policyId: policy.id });
+ },
+ onError: (error) => {
+ toast({
+ title: "Error publishing policy",
+ description: error.message || "An unknown error occurred",
+ variant: "destructive"
+ });
+ }
+ });
+ }, [policy.id, publishDraft, toast, loadQuery]);
+
+ // Open version history modal
+ const handleVersionHistoryClick = useCallback(() => {
+ setIsVersionHistoryOpen(true);
+ }, []);
+
+ // Restore version
+ const handleRestoreVersion = useCallback((versionNumber: number) => {
+ // Here you would implement the logic to restore a version
+ toast({
+ title: "Version restored",
+ description: `Version ${versionNumber} has been restored`,
+ });
+ setIsVersionHistoryOpen(false);
+ // Reload the query to refresh the data
+ if (policy.id) {
+ loadQuery({ policyId: policy.id });
+ }
+ }, [policy.id, loadQuery, toast]);
+
+ // Handle edit policy
+ const handleEditPolicy = useCallback(() => {
+ if (!policy.id) return;
+
+ if (latestVersionNode?.status === "PUBLISHED") {
+ // Create a new draft version first
+ createDraft({
+ variables: {
+ input: {
+ policyID: policy.id
+ }
+ },
+ onCompleted: (response, errors) => {
+ if (errors) {
+ toast({
+ title: "Error creating draft",
+ description: errors[0]?.message || "An unknown error occurred",
+ variant: "destructive"
+ });
+ return;
+ }
+
+ const newDraftId = response.createDraftPolicyVersion.policyVersionEdge.node.id;
+ navigate(`/organizations/${organizationId}/policies/${policy.id}/versions/${newDraftId}/edit`);
+ },
+ onError: (error) => {
+ toast({
+ title: "Error creating draft",
+ description: error.message || "An unknown error occurred",
+ variant: "destructive"
+ });
+ }
+ });
+ } else {
+ // Navigate directly to edit if it's already a draft
+ navigate(`/organizations/${organizationId}/policies/${policy.id}/versions/${latestVersionNode?.id}/edit`);
+ }
+ }, [policy.id, latestVersionNode, createDraft, navigate, organizationId, toast]);
+
+ // Format date helper
+ const formatDate = (dateString?: string) => {
+ if (!dateString) return "N/A";
+ const date = new Date(dateString);
+ return format(date, "MMM d, yyyy");
+ };
+
+ return (
+
+
+
+ Version history
+
+
+ setIsSignaturesModalOpen(true)}
+ >
+
+ Signature history
+
+
+ {isDraft && (
+
+ Publish version
+
+ )}
+
+
+
+
+
+
+
+
+
+
+
+ {latestVersionNode?.status === "PUBLISHED" ? "Create new draft" : "Edit draft policy"}
+
+
+
+
+ Delete policy
+
+
+
+
+ }
+ >
+
+ {latestVersionNode ? (
+
+ {latestVersionNode.changelog && (
+
+ Change summary
+
+ {latestVersionNode.changelog}
+
+
+ )}
+
+
+
+ {latestVersionNode.content || "No content available"}
+
+
+
+
+
+ {latestVersionNode.status === "PUBLISHED"
+ ? `Published on ${formatDate(latestVersionNode.publishedAt || "")}${latestVersionNode.publishedBy ? ` by ${latestVersionNode.publishedBy.fullName}` : ''}`
+ : `Last modified on ${formatDate(latestVersionNode.updatedAt)} by ${policy.owner?.fullName || 'Unknown'}`}
+
+
+
+ ) : (
+
+ No content available
+
+ )}
+
+
+ {/* Signatures Modal */}
+ setIsSignaturesModalOpen(false)}
+ policyRef={policy}
+ owner={policy.owner}
+ />
+
+ {/* Version History Modal */}
+ setIsVersionHistoryOpen(false)}
+ policyRef={policy}
+ onRestoreVersion={handleRestoreVersion}
+ />
+
+ {/* Delete Confirmation Dialog */}
+
+
+ );
+}
+
+export default function ShowPolicyView() {
+ const [queryRef, loadQuery] = useQueryLoader(policyViewQuery);
+ const { policyId } = useParams();
+
+ useEffect(() => {
+ loadQuery({ policyId: policyId! });
+ }, [loadQuery, policyId]);
+
+ if (!queryRef) {
+ return ;
+ }
+
+ return (
+ }>
+
+
+ );
+}
diff --git a/apps/console/src/pages/organizations/policies/SignaturesList.tsx b/apps/console/src/pages/organizations/policies/SignaturesList.tsx
new file mode 100644
index 000000000..3ee0da451
--- /dev/null
+++ b/apps/console/src/pages/organizations/policies/SignaturesList.tsx
@@ -0,0 +1,74 @@
+import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
+import { format } from "date-fns";
+
+interface PolicyVersionSignature {
+ id: string;
+ state: "REQUESTED" | "SIGNED";
+ signedBy: {
+ fullName: string;
+ };
+ signedAt?: string;
+ requestedAt: string;
+ requestedBy: {
+ fullName: string;
+ };
+}
+
+interface SignaturesListProps {
+ signatures: PolicyVersionSignature[];
+}
+
+export function SignaturesList({ signatures }: SignaturesListProps) {
+ const formatDateTime = (dateString: string) => {
+ const date = new Date(dateString);
+ return format(date, "h:mm a • MMM d, yyyy");
+ };
+
+ return (
+
+ {signatures.map((signature) => (
+
+
+
+
+
+ {signature.signedBy.fullName.charAt(0)}
+
+
+
+ {signature.signedBy.fullName}
+
+ {signature.state === "SIGNED" && signature.signedAt
+ ? formatDateTime(signature.signedAt)
+ : formatDateTime(signature.requestedAt)}
+
+
+
+
+
+
+ Status:{" "}
+
+ {signature.state}
+
+
+
+ Requested by:{" "}
+ {signature.requestedBy.fullName}
+
+ {signature.state === "SIGNED" && signature.signedAt && (
+
+ Signed at:{" "}
+ {formatDateTime(signature.signedAt)}
+
+ )}
+
+
+ ))}
+
+ );
+}
\ No newline at end of file
diff --git a/apps/console/src/pages/organizations/policies/SignaturesModal.tsx b/apps/console/src/pages/organizations/policies/SignaturesModal.tsx
new file mode 100644
index 000000000..702e5a067
--- /dev/null
+++ b/apps/console/src/pages/organizations/policies/SignaturesModal.tsx
@@ -0,0 +1,469 @@
+import { Dialog, DialogContent } from "@/components/ui/dialog";
+import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
+import { format } from "date-fns";
+import { Button } from "@/components/ui/button";
+import { useState, useEffect } from "react";
+import { graphql, useFragment, useMutation, useQueryLoader, usePreloadedQuery, ConnectionHandler } from "react-relay";
+import type { SignaturesModal_policyVersions$data, SignaturesModal_policyVersions$key } from "./__generated__/SignaturesModal_policyVersions.graphql";
+import type { SignaturesModalRequestSignatureMutation } from "./__generated__/SignaturesModalRequestSignatureMutation.graphql";
+import type { SignaturesModalOrganizationQuery } from "./__generated__/SignaturesModalOrganizationQuery.graphql";
+import { useToast } from "@/hooks/use-toast";
+import { useParams } from "react-router";
+import { Loader2, CheckCircle2, Clock } from "lucide-react";
+import { PreloadedQuery } from "react-relay";
+
+export const policyVersionsFragment = graphql`
+ fragment SignaturesModal_policyVersions on Policy {
+ title
+ policyVersions: versions(first: 10) {
+ edges {
+ node {
+ id
+ version
+ status
+ publishedAt
+ updatedAt
+ publishedBy {
+ fullName
+ }
+ signatures(first: 100) @connection(key: "SignaturesModal_policyVersions_signatures") {
+ edges {
+ node {
+ id
+ state
+ signedAt
+ requestedAt
+ signedBy {
+ fullName
+ id
+ }
+ requestedBy {
+ fullName
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+`;
+
+const requestSignatureMutation = graphql`
+ mutation SignaturesModalRequestSignatureMutation($input: RequestSignatureInput!, $connections: [ID!]!) {
+ requestSignature(input: $input) {
+ policyVersionSignatureEdge @prependEdge(connections: $connections) {
+ node {
+ id
+ state
+ signedAt
+ requestedAt
+ signedBy {
+ fullName
+ id
+ }
+ requestedBy {
+ fullName
+ }
+ }
+ }
+ }
+ }
+`;
+
+const organizationQuery = graphql`
+ query SignaturesModalOrganizationQuery($organizationId: ID!) {
+ organization: node(id: $organizationId) {
+ ... on Organization {
+ id
+ peoples(first: 100, orderBy: { direction: ASC, field: FULL_NAME }) {
+ edges {
+ node {
+ id
+ fullName
+ primaryEmailAddress
+ kind
+ }
+ }
+ }
+ }
+ }
+ }
+`;
+
+interface SignaturesModalProps {
+ isOpen: boolean;
+ onClose: () => void;
+ policyRef: SignaturesModal_policyVersions$key;
+ owner?: {
+ fullName: string;
+ } | null;
+}
+
+// Define the signature type based on the GraphQL response
+// interface Signature {
+// id: string;
+// state: string;
+// signedAt?: string | null;
+// requestedAt: string;
+// signedBy: {
+// fullName: string;
+// id: string;
+// } | null;
+// requestedBy: {
+// fullName: string;
+// } | null;
+// }
+
+export function SignaturesModal({
+ isOpen,
+ onClose,
+ policyRef,
+ owner,
+}: SignaturesModalProps) {
+ const data = useFragment(
+ policyVersionsFragment,
+ policyRef
+ );
+
+ // Safely access and extract version nodes
+ const versionNodes = (data?.policyVersions?.edges?.map(edge => edge.node) || []);
+
+ // Filter to just published versions and sort by version number
+ const publishedVersions = versionNodes
+ .filter(v => v.status === "PUBLISHED")
+ .sort((a, b) => b.version - a.version);
+
+ const [selectedVersion, setSelectedVersion] = useState(
+ publishedVersions[0]?.version || 0
+ );
+
+ const selectedVersionData = versionNodes.find(v => v.version === selectedVersion);
+
+ const { organizationId } = useParams();
+ const [queryRef, loadQuery] = useQueryLoader(organizationQuery);
+ const { toast } = useToast();
+ const [isRequesting, setIsRequesting] = useState(null);
+
+ const [commitRequestSignature] = useMutation(requestSignatureMutation);
+
+ // Load organization data when the modal opens and we have a valid version selected
+ useEffect(() => {
+ if (isOpen && organizationId && selectedVersionData?.status === "PUBLISHED") {
+ loadQuery({ organizationId });
+ }
+ }, [isOpen, organizationId, loadQuery, selectedVersionData]);
+
+ const formatDateTime = (dateString?: string | null) => {
+ if (!dateString) return "N/A";
+ const date = new Date(dateString);
+ return format(date, "h:mm a • MMM d, yyyy");
+ };
+
+ // Safely type signatures as our defined Signature interface
+ const signatures = selectedVersionData?.signatures?.edges?.map(edge => edge.node) || [];
+
+ const handleRequestSignature = (personId: string) => {
+ if (!selectedVersionData) return;
+
+ setIsRequesting(personId);
+
+ commitRequestSignature({
+ variables: {
+ input: {
+ policyVersionId: selectedVersionData.id,
+ signatoryId: personId,
+ },
+ connections: [
+ ConnectionHandler.getConnectionID(
+ selectedVersionData.id,
+ "SignaturesModal_policyVersions_signatures"
+ ),
+ ],
+ },
+ onCompleted: () => {
+ toast({
+ title: "Success",
+ description: "Signature request sent successfully",
+ });
+ setIsRequesting(null);
+ },
+ onError: (error) => {
+ toast({
+ title: "Error",
+ description: error.message,
+ variant: "destructive",
+ });
+ setIsRequesting(null);
+ },
+ });
+ };
+
+ return (
+
+ );
+}
+
+// Combined people and signatures list component
+function PeopleAndSignaturesList({
+ queryRef,
+ onRequestSignature,
+ requestingId,
+ existingSignatures,
+ formatDateTime,
+}: {
+ queryRef: PreloadedQuery,
+ onRequestSignature: (personId: string) => void,
+ requestingId: string | null,
+ existingSignatures: Array,
+ formatDateTime: (date?: string | null) => string,
+}) {
+ const data = usePreloadedQuery(
+ organizationQuery,
+ queryRef
+ );
+
+ const people = data?.organization?.peoples?.edges || [];
+
+ if (!data?.organization) {
+ return (
+
+ Organization not found
+
+ );
+ }
+
+ if (people.length === 0) {
+ return (
+
+ No people available to request signatures from
+
+ );
+ }
+
+ // Create lookup for signatures by person ID
+ const signaturesByPersonId = new Map();
+ existingSignatures.forEach(sig => {
+ if (sig.signedBy?.id) {
+ signaturesByPersonId.set(sig.signedBy.id, sig);
+ }
+ });
+
+ return (
+
+ {people.map((edge: any) => {
+ const person = edge.node;
+ const signature = signaturesByPersonId.get(person.id);
+ const isRequesting = requestingId === person.id;
+
+ return (
+
+
+
+
+
+ {person.fullName.charAt(0)}
+
+
+
+ {person.fullName}
+
+ {signature ? (
+ signature.state === "SIGNED" ? (
+
+
+ Signed on {formatDateTime(signature.signedAt)}
+
+ ) : (
+
+
+ Requested on {formatDateTime(signature.requestedAt)}
+
+ )
+ ) : (
+ person.primaryEmailAddress
+ )}
+
+
+
+
+ {signature ? (
+
+ {signature.state === "SIGNED" ? "Signed" : "Pending"}
+
+ ) : (
+ onRequestSignature(person.id)}
+ disabled={isRequesting}
+ >
+ {isRequesting ? (
+ <>
+
+ Requesting...
+ >
+ ) : (
+ "Request Signature"
+ )}
+
+ )}
+
+
+ );
+ })}
+
+ );
+}
\ No newline at end of file
diff --git a/apps/console/src/pages/organizations/policies/VersionHistoryModal.tsx b/apps/console/src/pages/organizations/policies/VersionHistoryModal.tsx
new file mode 100644
index 000000000..41fdd2a33
--- /dev/null
+++ b/apps/console/src/pages/organizations/policies/VersionHistoryModal.tsx
@@ -0,0 +1,149 @@
+import { Dialog, DialogContent } from "@/components/ui/dialog";
+import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
+import { format } from "date-fns";
+import { Button } from "@/components/ui/button";
+import { useState } from "react";
+import ReactMarkdown from "react-markdown";
+import { graphql, useFragment } from "react-relay";
+import type { VersionHistoryModal_policyVersions$key } from "./__generated__/VersionHistoryModal_policyVersions.graphql";
+
+export const policyVersionsFragment = graphql`
+ fragment VersionHistoryModal_policyVersions on Policy {
+ title
+ owner {
+ fullName
+ }
+ versionHistory: versions(first: 20) {
+ edges {
+ node {
+ id
+ version
+ status
+ content
+ changelog
+ publishedAt
+ updatedAt
+ publishedBy {
+ fullName
+ }
+ }
+ }
+ }
+ }
+`;
+
+interface VersionHistoryModalProps {
+ isOpen: boolean;
+ onClose: () => void;
+ policyRef: VersionHistoryModal_policyVersions$key;
+ onRestoreVersion?: (versionNumber: number) => void;
+}
+
+export function VersionHistoryModal({
+ isOpen,
+ onClose,
+ policyRef,
+ onRestoreVersion
+}: VersionHistoryModalProps) {
+ const data = useFragment(
+ policyVersionsFragment,
+ policyRef
+ );
+
+ // Safely access and extract version nodes
+ const versionNodes = data?.versionHistory?.edges?.map(edge => edge.node) || [];
+
+ // Sort versions by version number (descending)
+ const versions = [...versionNodes].sort((a, b) => b.version - a.version);
+
+ const latestVersion = versions.length > 0 ? versions[0].version : 0;
+ const [selectedVersion, setSelectedVersion] = useState(latestVersion);
+
+ const currentVersionData = versions.find(v => v.version === selectedVersion);
+
+ // Format time helper for version history
+ const formatDateTime = (dateString?: string | null) => {
+ if (!dateString) return "N/A";
+ const date = new Date(dateString);
+ return format(date, "h:mm a • MMM d, yyyy");
+ };
+
+ return (
+
+ );
+}
\ No newline at end of file
diff --git a/apps/console/src/pages/organizations/policies/__generated__/EditPolicyViewMutation.graphql.ts b/apps/console/src/pages/organizations/policies/__generated__/EditPolicyViewMutation.graphql.ts
index 0364432bb..6438b42bb 100644
--- a/apps/console/src/pages/organizations/policies/__generated__/EditPolicyViewMutation.graphql.ts
+++ b/apps/console/src/pages/organizations/policies/__generated__/EditPolicyViewMutation.graphql.ts
@@ -1,5 +1,5 @@
/**
- * @generated SignedSource<<171200736f3a443faae3f8b7c2085f4f>>
+ * @generated SignedSource<>
* @lightSyntaxTransform
* @nogrep
*/
@@ -9,30 +9,18 @@
// @ts-nocheck
import { ConcreteRequest } from 'relay-runtime';
-export type PolicyStatus = "ACTIVE" | "DRAFT";
-export type UpdatePolicyInput = {
- content?: string | null | undefined;
- id: string;
- name?: string | null | undefined;
- ownerId?: string | null | undefined;
- reviewDate?: string | null | undefined;
- status?: PolicyStatus | null | undefined;
+export type UpdatePolicyVersionInput = {
+ content: string;
+ policyVersionId: string;
};
export type EditPolicyViewMutation$variables = {
- input: UpdatePolicyInput;
+ input: UpdatePolicyVersionInput;
};
export type EditPolicyViewMutation$data = {
- readonly updatePolicy: {
- readonly policy: {
+ readonly updatePolicyVersion: {
+ readonly policyVersion: {
readonly content: string;
readonly id: string;
- readonly name: string;
- readonly owner: {
- readonly fullName: string;
- readonly id: string;
- };
- readonly reviewDate: string | null | undefined;
- readonly status: PolicyStatus;
};
};
};
@@ -49,14 +37,7 @@ var v0 = [
"name": "input"
}
],
-v1 = {
- "alias": null,
- "args": null,
- "kind": "ScalarField",
- "name": "id",
- "storageKey": null
-},
-v2 = [
+v1 = [
{
"alias": null,
"args": [
@@ -66,25 +47,24 @@ v2 = [
"variableName": "input"
}
],
- "concreteType": "UpdatePolicyPayload",
+ "concreteType": "UpdatePolicyVersionPayload",
"kind": "LinkedField",
- "name": "updatePolicy",
+ "name": "updatePolicyVersion",
"plural": false,
"selections": [
{
"alias": null,
"args": null,
- "concreteType": "Policy",
+ "concreteType": "PolicyVersion",
"kind": "LinkedField",
- "name": "policy",
+ "name": "policyVersion",
"plural": false,
"selections": [
- (v1/*: any*/),
{
"alias": null,
"args": null,
"kind": "ScalarField",
- "name": "name",
+ "name": "id",
"storageKey": null
},
{
@@ -93,39 +73,6 @@ v2 = [
"kind": "ScalarField",
"name": "content",
"storageKey": null
- },
- {
- "alias": null,
- "args": null,
- "kind": "ScalarField",
- "name": "status",
- "storageKey": null
- },
- {
- "alias": null,
- "args": null,
- "kind": "ScalarField",
- "name": "reviewDate",
- "storageKey": null
- },
- {
- "alias": null,
- "args": null,
- "concreteType": "People",
- "kind": "LinkedField",
- "name": "owner",
- "plural": false,
- "selections": [
- (v1/*: any*/),
- {
- "alias": null,
- "args": null,
- "kind": "ScalarField",
- "name": "fullName",
- "storageKey": null
- }
- ],
- "storageKey": null
}
],
"storageKey": null
@@ -140,7 +87,7 @@ return {
"kind": "Fragment",
"metadata": null,
"name": "EditPolicyViewMutation",
- "selections": (v2/*: any*/),
+ "selections": (v1/*: any*/),
"type": "Mutation",
"abstractKey": null
},
@@ -149,19 +96,19 @@ return {
"argumentDefinitions": (v0/*: any*/),
"kind": "Operation",
"name": "EditPolicyViewMutation",
- "selections": (v2/*: any*/)
+ "selections": (v1/*: any*/)
},
"params": {
- "cacheID": "643990a3ab54cb51144f434b023531e7",
+ "cacheID": "02b56043d606c6237dd502a7695fea50",
"id": null,
"metadata": {},
"name": "EditPolicyViewMutation",
"operationKind": "mutation",
- "text": "mutation EditPolicyViewMutation(\n $input: UpdatePolicyInput!\n) {\n updatePolicy(input: $input) {\n policy {\n id\n name\n content\n status\n reviewDate\n owner {\n id\n fullName\n }\n }\n }\n}\n"
+ "text": "mutation EditPolicyViewMutation(\n $input: UpdatePolicyVersionInput!\n) {\n updatePolicyVersion(input: $input) {\n policyVersion {\n id\n content\n }\n }\n}\n"
}
};
})();
-(node as any).hash = "41d4945568bc1f43eeedc727a968654d";
+(node as any).hash = "556fbcc4fadc0011c1a2154dcffeb389";
export default node;
diff --git a/apps/console/src/pages/organizations/policies/__generated__/EditPolicyViewQuery.graphql.ts b/apps/console/src/pages/organizations/policies/__generated__/EditPolicyViewQuery.graphql.ts
index 6485b3b97..cbf96d5c5 100644
--- a/apps/console/src/pages/organizations/policies/__generated__/EditPolicyViewQuery.graphql.ts
+++ b/apps/console/src/pages/organizations/policies/__generated__/EditPolicyViewQuery.graphql.ts
@@ -1,5 +1,5 @@
/**
- * @generated SignedSource<<312876323f4072e43048dfe1b2e21d08>>
+ * @generated SignedSource<<7738a95cc83ee25c08f6ddc556f144c1>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -10,25 +10,26 @@
import { ConcreteRequest } from 'relay-runtime';
import { FragmentRefs } from "relay-runtime";
-export type PolicyStatus = "ACTIVE" | "DRAFT";
export type EditPolicyViewQuery$variables = {
organizationId: string;
policyId: string;
+ policyVersionId: string;
};
export type EditPolicyViewQuery$data = {
readonly organization: {
readonly " $fragmentSpreads": FragmentRefs<"PeopleSelector_organization">;
};
readonly policy: {
- readonly content?: string;
readonly id: string;
- readonly name?: string;
readonly owner?: {
readonly fullName: string;
readonly id: string;
};
- readonly reviewDate?: string | null | undefined;
- readonly status?: PolicyStatus;
+ readonly title?: string;
+ };
+ readonly policyVersion: {
+ readonly content?: string;
+ readonly id: string;
};
};
export type EditPolicyViewQuery = {
@@ -47,56 +48,61 @@ v1 = {
"kind": "LocalArgument",
"name": "policyId"
},
-v2 = [
+v2 = {
+ "defaultValue": null,
+ "kind": "LocalArgument",
+ "name": "policyVersionId"
+},
+v3 = [
{
"kind": "Variable",
"name": "id",
- "variableName": "policyId"
+ "variableName": "policyVersionId"
}
],
-v3 = {
- "alias": null,
- "args": null,
- "kind": "ScalarField",
- "name": "id",
- "storageKey": null
-},
v4 = {
"alias": null,
"args": null,
"kind": "ScalarField",
- "name": "fullName",
+ "name": "id",
"storageKey": null
},
v5 = {
"kind": "InlineFragment",
"selections": [
- {
- "alias": null,
- "args": null,
- "kind": "ScalarField",
- "name": "name",
- "storageKey": null
- },
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "content",
"storageKey": null
- },
+ }
+ ],
+ "type": "PolicyVersion",
+ "abstractKey": null
+},
+v6 = [
+ {
+ "kind": "Variable",
+ "name": "id",
+ "variableName": "policyId"
+ }
+],
+v7 = {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "fullName",
+ "storageKey": null
+},
+v8 = {
+ "kind": "InlineFragment",
+ "selections": [
{
"alias": null,
"args": null,
"kind": "ScalarField",
- "name": "status",
- "storageKey": null
- },
- {
- "alias": null,
- "args": null,
- "kind": "ScalarField",
- "name": "reviewDate",
+ "name": "title",
"storageKey": null
},
{
@@ -107,8 +113,8 @@ v5 = {
"name": "owner",
"plural": false,
"selections": [
- (v3/*: any*/),
- (v4/*: any*/)
+ (v4/*: any*/),
+ (v7/*: any*/)
],
"storageKey": null
}
@@ -116,21 +122,21 @@ v5 = {
"type": "Policy",
"abstractKey": null
},
-v6 = [
+v9 = [
{
"kind": "Variable",
"name": "id",
"variableName": "organizationId"
}
],
-v7 = {
+v10 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "__typename",
"storageKey": null
},
-v8 = [
+v11 = [
{
"kind": "Literal",
"name": "first",
@@ -149,32 +155,46 @@ return {
"fragment": {
"argumentDefinitions": [
(v0/*: any*/),
- (v1/*: any*/)
+ (v1/*: any*/),
+ (v2/*: any*/)
],
"kind": "Fragment",
"metadata": null,
"name": "EditPolicyViewQuery",
"selections": [
{
- "alias": "policy",
- "args": (v2/*: any*/),
+ "alias": "policyVersion",
+ "args": (v3/*: any*/),
"concreteType": null,
"kind": "LinkedField",
"name": "node",
"plural": false,
"selections": [
- (v3/*: any*/),
+ (v4/*: any*/),
(v5/*: any*/)
],
"storageKey": null
},
{
- "alias": "organization",
+ "alias": "policy",
"args": (v6/*: any*/),
"concreteType": null,
"kind": "LinkedField",
"name": "node",
"plural": false,
+ "selections": [
+ (v4/*: any*/),
+ (v8/*: any*/)
+ ],
+ "storageKey": null
+ },
+ {
+ "alias": "organization",
+ "args": (v9/*: any*/),
+ "concreteType": null,
+ "kind": "LinkedField",
+ "name": "node",
+ "plural": false,
"selections": [
{
"args": null,
@@ -192,41 +212,56 @@ return {
"operation": {
"argumentDefinitions": [
(v1/*: any*/),
- (v0/*: any*/)
+ (v0/*: any*/),
+ (v2/*: any*/)
],
"kind": "Operation",
"name": "EditPolicyViewQuery",
"selections": [
{
- "alias": "policy",
- "args": (v2/*: any*/),
+ "alias": "policyVersion",
+ "args": (v3/*: any*/),
"concreteType": null,
"kind": "LinkedField",
"name": "node",
"plural": false,
"selections": [
- (v7/*: any*/),
- (v3/*: any*/),
+ (v10/*: any*/),
+ (v4/*: any*/),
(v5/*: any*/)
],
"storageKey": null
},
{
- "alias": "organization",
+ "alias": "policy",
"args": (v6/*: any*/),
"concreteType": null,
"kind": "LinkedField",
"name": "node",
"plural": false,
"selections": [
- (v7/*: any*/),
- (v3/*: any*/),
+ (v10/*: any*/),
+ (v4/*: any*/),
+ (v8/*: any*/)
+ ],
+ "storageKey": null
+ },
+ {
+ "alias": "organization",
+ "args": (v9/*: any*/),
+ "concreteType": null,
+ "kind": "LinkedField",
+ "name": "node",
+ "plural": false,
+ "selections": [
+ (v10/*: any*/),
+ (v4/*: any*/),
{
"kind": "InlineFragment",
"selections": [
{
"alias": null,
- "args": (v8/*: any*/),
+ "args": (v11/*: any*/),
"concreteType": "PeopleConnection",
"kind": "LinkedField",
"name": "peoples",
@@ -248,8 +283,8 @@ return {
"name": "node",
"plural": false,
"selections": [
- (v3/*: any*/),
(v4/*: any*/),
+ (v7/*: any*/),
{
"alias": null,
"args": null,
@@ -257,7 +292,7 @@ return {
"name": "primaryEmailAddress",
"storageKey": null
},
- (v7/*: any*/)
+ (v10/*: any*/)
],
"storageKey": null
},
@@ -301,7 +336,7 @@ return {
},
{
"alias": null,
- "args": (v8/*: any*/),
+ "args": (v11/*: any*/),
"filters": [
"orderBy"
],
@@ -320,16 +355,16 @@ return {
]
},
"params": {
- "cacheID": "4d52d22f9d8acc7912a57d974f558248",
+ "cacheID": "4d586701fc5f2e4976bb87d9be61c594",
"id": null,
"metadata": {},
"name": "EditPolicyViewQuery",
"operationKind": "query",
- "text": "query EditPolicyViewQuery(\n $policyId: ID!\n $organizationId: ID!\n) {\n policy: node(id: $policyId) {\n __typename\n id\n ... on Policy {\n name\n content\n status\n reviewDate\n owner {\n id\n fullName\n }\n }\n }\n organization: node(id: $organizationId) {\n __typename\n ...PeopleSelector_organization\n id\n }\n}\n\nfragment PeopleSelector_organization on Organization {\n id\n peoples(first: 100, orderBy: {direction: ASC, field: FULL_NAME}) {\n edges {\n node {\n id\n fullName\n primaryEmailAddress\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n}\n"
+ "text": "query EditPolicyViewQuery(\n $policyId: ID!\n $organizationId: ID!\n $policyVersionId: ID!\n) {\n policyVersion: node(id: $policyVersionId) {\n __typename\n id\n ... on PolicyVersion {\n content\n }\n }\n policy: node(id: $policyId) {\n __typename\n id\n ... on Policy {\n title\n owner {\n id\n fullName\n }\n }\n }\n organization: node(id: $organizationId) {\n __typename\n ...PeopleSelector_organization\n id\n }\n}\n\nfragment PeopleSelector_organization on Organization {\n id\n peoples(first: 100, orderBy: {direction: ASC, field: FULL_NAME}) {\n edges {\n node {\n id\n fullName\n primaryEmailAddress\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n}\n"
}
};
})();
-(node as any).hash = "d16bdd881b27b1aa5368130ce036fd20";
+(node as any).hash = "2a934195ed33bd073e3976e8cc19a925";
export default node;
diff --git a/apps/console/src/pages/organizations/policies/__generated__/NewPolicyViewQuery.graphql.ts b/apps/console/src/pages/organizations/policies/__generated__/NewPolicyViewQuery.graphql.ts
deleted file mode 100644
index f2a6daebc..000000000
--- a/apps/console/src/pages/organizations/policies/__generated__/NewPolicyViewQuery.graphql.ts
+++ /dev/null
@@ -1,230 +0,0 @@
-/**
- * @generated SignedSource<<84789bb949f94e924de1c9b9d566b4a5>>
- * @lightSyntaxTransform
- * @nogrep
- */
-
-/* tslint:disable */
-/* eslint-disable */
-// @ts-nocheck
-
-import { ConcreteRequest } from 'relay-runtime';
-import { FragmentRefs } from "relay-runtime";
-export type NewPolicyViewQuery$variables = {
- organizationId: string;
-};
-export type NewPolicyViewQuery$data = {
- readonly organization: {
- readonly " $fragmentSpreads": FragmentRefs<"PeopleSelector_organization">;
- };
-};
-export type NewPolicyViewQuery = {
- response: NewPolicyViewQuery$data;
- variables: NewPolicyViewQuery$variables;
-};
-
-const node: ConcreteRequest = (function(){
-var v0 = [
- {
- "defaultValue": null,
- "kind": "LocalArgument",
- "name": "organizationId"
- }
-],
-v1 = [
- {
- "kind": "Variable",
- "name": "id",
- "variableName": "organizationId"
- }
-],
-v2 = {
- "alias": null,
- "args": null,
- "kind": "ScalarField",
- "name": "__typename",
- "storageKey": null
-},
-v3 = {
- "alias": null,
- "args": null,
- "kind": "ScalarField",
- "name": "id",
- "storageKey": null
-},
-v4 = [
- {
- "kind": "Literal",
- "name": "first",
- "value": 100
- },
- {
- "kind": "Literal",
- "name": "orderBy",
- "value": {
- "direction": "ASC",
- "field": "FULL_NAME"
- }
- }
-];
-return {
- "fragment": {
- "argumentDefinitions": (v0/*: any*/),
- "kind": "Fragment",
- "metadata": null,
- "name": "NewPolicyViewQuery",
- "selections": [
- {
- "alias": "organization",
- "args": (v1/*: any*/),
- "concreteType": null,
- "kind": "LinkedField",
- "name": "node",
- "plural": false,
- "selections": [
- {
- "args": null,
- "kind": "FragmentSpread",
- "name": "PeopleSelector_organization"
- }
- ],
- "storageKey": null
- }
- ],
- "type": "Query",
- "abstractKey": null
- },
- "kind": "Request",
- "operation": {
- "argumentDefinitions": (v0/*: any*/),
- "kind": "Operation",
- "name": "NewPolicyViewQuery",
- "selections": [
- {
- "alias": "organization",
- "args": (v1/*: any*/),
- "concreteType": null,
- "kind": "LinkedField",
- "name": "node",
- "plural": false,
- "selections": [
- (v2/*: any*/),
- (v3/*: any*/),
- {
- "kind": "InlineFragment",
- "selections": [
- {
- "alias": null,
- "args": (v4/*: any*/),
- "concreteType": "PeopleConnection",
- "kind": "LinkedField",
- "name": "peoples",
- "plural": false,
- "selections": [
- {
- "alias": null,
- "args": null,
- "concreteType": "PeopleEdge",
- "kind": "LinkedField",
- "name": "edges",
- "plural": true,
- "selections": [
- {
- "alias": null,
- "args": null,
- "concreteType": "People",
- "kind": "LinkedField",
- "name": "node",
- "plural": false,
- "selections": [
- (v3/*: any*/),
- {
- "alias": null,
- "args": null,
- "kind": "ScalarField",
- "name": "fullName",
- "storageKey": null
- },
- {
- "alias": null,
- "args": null,
- "kind": "ScalarField",
- "name": "primaryEmailAddress",
- "storageKey": null
- },
- (v2/*: any*/)
- ],
- "storageKey": null
- },
- {
- "alias": null,
- "args": null,
- "kind": "ScalarField",
- "name": "cursor",
- "storageKey": null
- }
- ],
- "storageKey": null
- },
- {
- "alias": null,
- "args": null,
- "concreteType": "PageInfo",
- "kind": "LinkedField",
- "name": "pageInfo",
- "plural": false,
- "selections": [
- {
- "alias": null,
- "args": null,
- "kind": "ScalarField",
- "name": "endCursor",
- "storageKey": null
- },
- {
- "alias": null,
- "args": null,
- "kind": "ScalarField",
- "name": "hasNextPage",
- "storageKey": null
- }
- ],
- "storageKey": null
- }
- ],
- "storageKey": "peoples(first:100,orderBy:{\"direction\":\"ASC\",\"field\":\"FULL_NAME\"})"
- },
- {
- "alias": null,
- "args": (v4/*: any*/),
- "filters": [
- "orderBy"
- ],
- "handle": "connection",
- "key": "PeopleSelector_organization_peoples",
- "kind": "LinkedHandle",
- "name": "peoples"
- }
- ],
- "type": "Organization",
- "abstractKey": null
- }
- ],
- "storageKey": null
- }
- ]
- },
- "params": {
- "cacheID": "552067b4b0632972c14f7a8dcaf171aa",
- "id": null,
- "metadata": {},
- "name": "NewPolicyViewQuery",
- "operationKind": "query",
- "text": "query NewPolicyViewQuery(\n $organizationId: ID!\n) {\n organization: node(id: $organizationId) {\n __typename\n ...PeopleSelector_organization\n id\n }\n}\n\nfragment PeopleSelector_organization on Organization {\n id\n peoples(first: 100, orderBy: {direction: ASC, field: FULL_NAME}) {\n edges {\n node {\n id\n fullName\n primaryEmailAddress\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n}\n"
- }
-};
-})();
-
-(node as any).hash = "98fa41bfaf0d76adce1c91cf8d6ade28";
-
-export default node;
diff --git a/apps/console/src/pages/organizations/policies/__generated__/NewPolicyViewMutation.graphql.ts b/apps/console/src/pages/organizations/policies/__generated__/PolicyListViewCreateMutation.graphql.ts
similarity index 76%
rename from apps/console/src/pages/organizations/policies/__generated__/NewPolicyViewMutation.graphql.ts
rename to apps/console/src/pages/organizations/policies/__generated__/PolicyListViewCreateMutation.graphql.ts
index 2665f9fd3..ffb0b3e7d 100644
--- a/apps/console/src/pages/organizations/policies/__generated__/NewPolicyViewMutation.graphql.ts
+++ b/apps/console/src/pages/organizations/policies/__generated__/PolicyListViewCreateMutation.graphql.ts
@@ -1,5 +1,5 @@
/**
- * @generated SignedSource<<2026b385ee5eb895da6ca9c919762913>>
+ * @generated SignedSource<<885dc2a54ba3b8d4663e197cfe61d704>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -9,39 +9,36 @@
// @ts-nocheck
import { ConcreteRequest } from 'relay-runtime';
-export type PolicyStatus = "ACTIVE" | "DRAFT";
export type CreatePolicyInput = {
content: string;
- name: string;
organizationId: string;
ownerId: string;
- reviewDate?: string | null | undefined;
- status: PolicyStatus;
+ title: string;
};
-export type NewPolicyViewMutation$variables = {
+export type PolicyListViewCreateMutation$variables = {
connections: ReadonlyArray;
input: CreatePolicyInput;
};
-export type NewPolicyViewMutation$data = {
+export type PolicyListViewCreateMutation$data = {
readonly createPolicy: {
readonly policyEdge: {
readonly node: {
- readonly content: string;
+ readonly createdAt: string;
+ readonly description: string;
readonly id: string;
- readonly name: string;
readonly owner: {
readonly fullName: string;
readonly id: string;
};
- readonly reviewDate: string | null | undefined;
- readonly status: PolicyStatus;
+ readonly title: string;
+ readonly updatedAt: string;
};
};
};
};
-export type NewPolicyViewMutation = {
- response: NewPolicyViewMutation$data;
- variables: NewPolicyViewMutation$variables;
+export type PolicyListViewCreateMutation = {
+ response: PolicyListViewCreateMutation$data;
+ variables: PolicyListViewCreateMutation$variables;
};
const node: ConcreteRequest = (function(){
@@ -90,28 +87,28 @@ v4 = {
"alias": null,
"args": null,
"kind": "ScalarField",
- "name": "name",
+ "name": "title",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
- "name": "content",
+ "name": "description",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
- "name": "status",
+ "name": "createdAt",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
- "name": "reviewDate",
+ "name": "updatedAt",
"storageKey": null
},
{
@@ -147,7 +144,7 @@ return {
],
"kind": "Fragment",
"metadata": null,
- "name": "NewPolicyViewMutation",
+ "name": "PolicyListViewCreateMutation",
"selections": [
{
"alias": null,
@@ -172,7 +169,7 @@ return {
(v0/*: any*/)
],
"kind": "Operation",
- "name": "NewPolicyViewMutation",
+ "name": "PolicyListViewCreateMutation",
"selections": [
{
"alias": null,
@@ -205,16 +202,16 @@ return {
]
},
"params": {
- "cacheID": "aa29cde3106d1c8d35c6ae8e74f310b7",
+ "cacheID": "f7aae6d7a0d276e71caec643e43b5ee5",
"id": null,
"metadata": {},
- "name": "NewPolicyViewMutation",
+ "name": "PolicyListViewCreateMutation",
"operationKind": "mutation",
- "text": "mutation NewPolicyViewMutation(\n $input: CreatePolicyInput!\n) {\n createPolicy(input: $input) {\n policyEdge {\n node {\n id\n name\n content\n status\n reviewDate\n owner {\n id\n fullName\n }\n }\n }\n }\n}\n"
+ "text": "mutation PolicyListViewCreateMutation(\n $input: CreatePolicyInput!\n) {\n createPolicy(input: $input) {\n policyEdge {\n node {\n id\n title\n description\n createdAt\n updatedAt\n owner {\n id\n fullName\n }\n }\n }\n }\n}\n"
}
};
})();
-(node as any).hash = "f6dcabf6c51e3858c9750e00fcc0cc15";
+(node as any).hash = "d55ac010a7ad352d830d3a38f2f8d5a8";
export default node;
diff --git a/apps/console/src/pages/organizations/policies/__generated__/PolicyListViewQuery.graphql.ts b/apps/console/src/pages/organizations/policies/__generated__/PolicyListViewQuery.graphql.ts
index 5412d443c..320298253 100644
--- a/apps/console/src/pages/organizations/policies/__generated__/PolicyListViewQuery.graphql.ts
+++ b/apps/console/src/pages/organizations/policies/__generated__/PolicyListViewQuery.graphql.ts
@@ -1,5 +1,5 @@
/**
- * @generated SignedSource<<391e3817107bb96f50aad61d20cad0a8>>
+ * @generated SignedSource<<5b24e53258fceb03535363014f57a15e>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -9,7 +9,8 @@
// @ts-nocheck
import { ConcreteRequest } from 'relay-runtime';
-export type PolicyStatus = "ACTIVE" | "DRAFT";
+import { FragmentRefs } from "relay-runtime";
+export type PolicyStatus = "DRAFT" | "PUBLISHED";
export type PolicyListViewQuery$variables = {
organizationId: string;
};
@@ -18,15 +19,34 @@ export type PolicyListViewQuery$data = {
readonly policies?: {
readonly edges: ReadonlyArray<{
readonly node: {
- readonly content: string;
readonly createdAt: string;
+ readonly currentPublishedVersion: number | null | undefined;
+ readonly description: string;
readonly id: string;
- readonly name: string;
- readonly status: PolicyStatus;
+ readonly owner: {
+ readonly fullName: string;
+ readonly id: string;
+ };
+ readonly title: string;
readonly updatedAt: string;
+ readonly versions: {
+ readonly edges: ReadonlyArray<{
+ readonly node: {
+ readonly id: string;
+ readonly status: PolicyStatus;
+ readonly updatedAt: string;
+ };
+ }>;
+ };
};
}>;
};
+ readonly " $fragmentSpreads": FragmentRefs<"PeopleSelector_organization">;
+ };
+ readonly viewer: {
+ readonly user: {
+ readonly id: string;
+ };
};
};
export type PolicyListViewQuery = {
@@ -42,28 +62,94 @@ var v0 = [
"name": "organizationId"
}
],
-v1 = [
- {
- "kind": "Variable",
- "name": "id",
- "variableName": "organizationId"
- }
-],
-v2 = {
+v1 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "id",
"storageKey": null
},
-v3 = {
+v2 = {
+ "alias": null,
+ "args": null,
+ "concreteType": "User",
+ "kind": "LinkedField",
+ "name": "user",
+ "plural": false,
+ "selections": [
+ (v1/*: any*/)
+ ],
+ "storageKey": null
+},
+v3 = [
+ {
+ "kind": "Variable",
+ "name": "id",
+ "variableName": "organizationId"
+ }
+],
+v4 = {
+ "kind": "Literal",
+ "name": "orderBy",
+ "value": {
+ "direction": "ASC",
+ "field": "TITLE"
+ }
+},
+v5 = {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "updatedAt",
+ "storageKey": null
+},
+v6 = {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "fullName",
+ "storageKey": null
+},
+v7 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "__typename",
"storageKey": null
},
-v4 = [
+v8 = {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "cursor",
+ "storageKey": null
+},
+v9 = {
+ "alias": null,
+ "args": null,
+ "concreteType": "PageInfo",
+ "kind": "LinkedField",
+ "name": "pageInfo",
+ "plural": false,
+ "selections": [
+ {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "endCursor",
+ "storageKey": null
+ },
+ {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "hasNextPage",
+ "storageKey": null
+ }
+ ],
+ "storageKey": null
+},
+v10 = [
{
"alias": null,
"args": null,
@@ -80,19 +166,26 @@ v4 = [
"name": "node",
"plural": false,
"selections": [
- (v2/*: any*/),
+ (v1/*: any*/),
{
"alias": null,
"args": null,
"kind": "ScalarField",
- "name": "name",
+ "name": "title",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
- "name": "content",
+ "name": "description",
+ "storageKey": null
+ },
+ {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "currentPublishedVersion",
"storageKey": null
},
{
@@ -102,66 +195,103 @@ v4 = [
"name": "createdAt",
"storageKey": null
},
+ (v5/*: any*/),
{
"alias": null,
"args": null,
- "kind": "ScalarField",
- "name": "updatedAt",
+ "concreteType": "People",
+ "kind": "LinkedField",
+ "name": "owner",
+ "plural": false,
+ "selections": [
+ (v1/*: any*/),
+ (v6/*: any*/)
+ ],
"storageKey": null
},
{
"alias": null,
- "args": null,
- "kind": "ScalarField",
- "name": "status",
- "storageKey": null
+ "args": [
+ {
+ "kind": "Literal",
+ "name": "first",
+ "value": 1
+ }
+ ],
+ "concreteType": "PolicyVersionConnection",
+ "kind": "LinkedField",
+ "name": "versions",
+ "plural": false,
+ "selections": [
+ {
+ "alias": null,
+ "args": null,
+ "concreteType": "PolicyVersionEdge",
+ "kind": "LinkedField",
+ "name": "edges",
+ "plural": true,
+ "selections": [
+ {
+ "alias": null,
+ "args": null,
+ "concreteType": "PolicyVersion",
+ "kind": "LinkedField",
+ "name": "node",
+ "plural": false,
+ "selections": [
+ (v1/*: any*/),
+ {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "status",
+ "storageKey": null
+ },
+ (v5/*: any*/)
+ ],
+ "storageKey": null
+ }
+ ],
+ "storageKey": null
+ }
+ ],
+ "storageKey": "versions(first:1)"
},
- (v3/*: any*/)
+ (v7/*: any*/)
],
"storageKey": null
},
- {
- "alias": null,
- "args": null,
- "kind": "ScalarField",
- "name": "cursor",
- "storageKey": null
- }
+ (v8/*: any*/)
],
"storageKey": null
},
- {
- "alias": null,
- "args": null,
- "concreteType": "PageInfo",
- "kind": "LinkedField",
- "name": "pageInfo",
- "plural": false,
- "selections": [
- {
- "alias": null,
- "args": null,
- "kind": "ScalarField",
- "name": "endCursor",
- "storageKey": null
- },
- {
- "alias": null,
- "args": null,
- "kind": "ScalarField",
- "name": "hasNextPage",
- "storageKey": null
- }
- ],
- "storageKey": null
- }
+ (v9/*: any*/)
],
-v5 = [
+v11 = [
{
"kind": "Literal",
"name": "first",
"value": 100
+ },
+ {
+ "kind": "Literal",
+ "name": "orderBy",
+ "value": {
+ "direction": "ASC",
+ "field": "FULL_NAME"
+ }
}
+],
+v12 = [
+ "orderBy"
+],
+v13 = [
+ {
+ "kind": "Literal",
+ "name": "first",
+ "value": 50
+ },
+ (v4/*: any*/)
];
return {
"fragment": {
@@ -170,9 +300,21 @@ return {
"metadata": null,
"name": "PolicyListViewQuery",
"selections": [
+ {
+ "alias": null,
+ "args": null,
+ "concreteType": "Viewer",
+ "kind": "LinkedField",
+ "name": "viewer",
+ "plural": false,
+ "selections": [
+ (v2/*: any*/)
+ ],
+ "storageKey": null
+ },
{
"alias": "organization",
- "args": (v1/*: any*/),
+ "args": (v3/*: any*/),
"concreteType": null,
"kind": "LinkedField",
"name": "node",
@@ -182,14 +324,21 @@ return {
"kind": "InlineFragment",
"selections": [
{
- "alias": "policies",
"args": null,
+ "kind": "FragmentSpread",
+ "name": "PeopleSelector_organization"
+ },
+ {
+ "alias": "policies",
+ "args": [
+ (v4/*: any*/)
+ ],
"concreteType": "PolicyConnection",
"kind": "LinkedField",
"name": "__PolicyListView_policies_connection",
"plural": false,
- "selections": (v4/*: any*/),
- "storageKey": null
+ "selections": (v10/*: any*/),
+ "storageKey": "__PolicyListView_policies_connection(orderBy:{\"direction\":\"ASC\",\"field\":\"TITLE\"})"
}
],
"type": "Organization",
@@ -208,32 +357,100 @@ return {
"kind": "Operation",
"name": "PolicyListViewQuery",
"selections": [
+ {
+ "alias": null,
+ "args": null,
+ "concreteType": "Viewer",
+ "kind": "LinkedField",
+ "name": "viewer",
+ "plural": false,
+ "selections": [
+ (v2/*: any*/),
+ (v1/*: any*/)
+ ],
+ "storageKey": null
+ },
{
"alias": "organization",
- "args": (v1/*: any*/),
+ "args": (v3/*: any*/),
"concreteType": null,
"kind": "LinkedField",
"name": "node",
"plural": false,
"selections": [
- (v3/*: any*/),
+ (v7/*: any*/),
+ (v1/*: any*/),
{
"kind": "InlineFragment",
"selections": [
{
"alias": null,
- "args": (v5/*: any*/),
+ "args": (v11/*: any*/),
+ "concreteType": "PeopleConnection",
+ "kind": "LinkedField",
+ "name": "peoples",
+ "plural": false,
+ "selections": [
+ {
+ "alias": null,
+ "args": null,
+ "concreteType": "PeopleEdge",
+ "kind": "LinkedField",
+ "name": "edges",
+ "plural": true,
+ "selections": [
+ {
+ "alias": null,
+ "args": null,
+ "concreteType": "People",
+ "kind": "LinkedField",
+ "name": "node",
+ "plural": false,
+ "selections": [
+ (v1/*: any*/),
+ (v6/*: any*/),
+ {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "primaryEmailAddress",
+ "storageKey": null
+ },
+ (v7/*: any*/)
+ ],
+ "storageKey": null
+ },
+ (v8/*: any*/)
+ ],
+ "storageKey": null
+ },
+ (v9/*: any*/)
+ ],
+ "storageKey": "peoples(first:100,orderBy:{\"direction\":\"ASC\",\"field\":\"FULL_NAME\"})"
+ },
+ {
+ "alias": null,
+ "args": (v11/*: any*/),
+ "filters": (v12/*: any*/),
+ "handle": "connection",
+ "key": "PeopleSelector_organization_peoples",
+ "kind": "LinkedHandle",
+ "name": "peoples"
+ },
+ {
+ "alias": null,
+ "args": (v13/*: any*/),
"concreteType": "PolicyConnection",
"kind": "LinkedField",
"name": "policies",
"plural": false,
- "selections": (v4/*: any*/),
- "storageKey": "policies(first:100)"
+ "selections": (v10/*: any*/),
+ "storageKey": "policies(first:50,orderBy:{\"direction\":\"ASC\",\"field\":\"TITLE\"})"
},
{
"alias": null,
- "args": (v5/*: any*/),
- "filters": null,
+ "args": (v13/*: any*/),
+ "filters": (v12/*: any*/),
"handle": "connection",
"key": "PolicyListView_policies",
"kind": "LinkedHandle",
@@ -242,15 +459,14 @@ return {
],
"type": "Organization",
"abstractKey": null
- },
- (v2/*: any*/)
+ }
],
"storageKey": null
}
]
},
"params": {
- "cacheID": "6434c8135f68ac64eb2f06983ddc3595",
+ "cacheID": "ed650f54cc226d3adea27a78a777890c",
"id": null,
"metadata": {
"connection": [
@@ -267,11 +483,11 @@ return {
},
"name": "PolicyListViewQuery",
"operationKind": "query",
- "text": "query PolicyListViewQuery(\n $organizationId: ID!\n) {\n organization: node(id: $organizationId) {\n __typename\n ... on Organization {\n policies(first: 100) {\n edges {\n node {\n id\n name\n content\n createdAt\n updatedAt\n status\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n }\n id\n }\n}\n"
+ "text": "query PolicyListViewQuery(\n $organizationId: ID!\n) {\n viewer {\n user {\n id\n }\n id\n }\n organization: node(id: $organizationId) {\n __typename\n ... on Organization {\n ...PeopleSelector_organization\n policies(first: 50, orderBy: {field: TITLE, direction: ASC}) {\n edges {\n node {\n id\n title\n description\n currentPublishedVersion\n createdAt\n updatedAt\n owner {\n id\n fullName\n }\n versions(first: 1) {\n edges {\n node {\n id\n status\n updatedAt\n }\n }\n }\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n }\n id\n }\n}\n\nfragment PeopleSelector_organization on Organization {\n id\n peoples(first: 100, orderBy: {direction: ASC, field: FULL_NAME}) {\n edges {\n node {\n id\n fullName\n primaryEmailAddress\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n}\n"
}
};
})();
-(node as any).hash = "5567339ad9b2be90b94edc8b1a16fe1e";
+(node as any).hash = "b3b0798be0779c09013a4743d015e87f";
export default node;
diff --git a/apps/console/src/pages/organizations/policies/__generated__/PolicyViewDeleteMutation.graphql.ts b/apps/console/src/pages/organizations/policies/__generated__/PolicyViewDeleteMutation.graphql.ts
deleted file mode 100644
index 6853bb38d..000000000
--- a/apps/console/src/pages/organizations/policies/__generated__/PolicyViewDeleteMutation.graphql.ts
+++ /dev/null
@@ -1,132 +0,0 @@
-/**
- * @generated SignedSource<<4e559f39bd9ec2b3782113ef034cad03>>
- * @lightSyntaxTransform
- * @nogrep
- */
-
-/* tslint:disable */
-/* eslint-disable */
-// @ts-nocheck
-
-import { ConcreteRequest } from 'relay-runtime';
-export type DeletePolicyInput = {
- policyId: string;
-};
-export type PolicyViewDeleteMutation$variables = {
- connections: ReadonlyArray;
- input: DeletePolicyInput;
-};
-export type PolicyViewDeleteMutation$data = {
- readonly deletePolicy: {
- readonly deletedPolicyId: string;
- };
-};
-export type PolicyViewDeleteMutation = {
- response: PolicyViewDeleteMutation$data;
- variables: PolicyViewDeleteMutation$variables;
-};
-
-const node: ConcreteRequest = (function(){
-var v0 = {
- "defaultValue": null,
- "kind": "LocalArgument",
- "name": "connections"
-},
-v1 = {
- "defaultValue": null,
- "kind": "LocalArgument",
- "name": "input"
-},
-v2 = [
- {
- "kind": "Variable",
- "name": "input",
- "variableName": "input"
- }
-],
-v3 = {
- "alias": null,
- "args": null,
- "kind": "ScalarField",
- "name": "deletedPolicyId",
- "storageKey": null
-};
-return {
- "fragment": {
- "argumentDefinitions": [
- (v0/*: any*/),
- (v1/*: any*/)
- ],
- "kind": "Fragment",
- "metadata": null,
- "name": "PolicyViewDeleteMutation",
- "selections": [
- {
- "alias": null,
- "args": (v2/*: any*/),
- "concreteType": "DeletePolicyPayload",
- "kind": "LinkedField",
- "name": "deletePolicy",
- "plural": false,
- "selections": [
- (v3/*: any*/)
- ],
- "storageKey": null
- }
- ],
- "type": "Mutation",
- "abstractKey": null
- },
- "kind": "Request",
- "operation": {
- "argumentDefinitions": [
- (v1/*: any*/),
- (v0/*: any*/)
- ],
- "kind": "Operation",
- "name": "PolicyViewDeleteMutation",
- "selections": [
- {
- "alias": null,
- "args": (v2/*: any*/),
- "concreteType": "DeletePolicyPayload",
- "kind": "LinkedField",
- "name": "deletePolicy",
- "plural": false,
- "selections": [
- (v3/*: any*/),
- {
- "alias": null,
- "args": null,
- "filters": null,
- "handle": "deleteEdge",
- "key": "",
- "kind": "ScalarHandle",
- "name": "deletedPolicyId",
- "handleArgs": [
- {
- "kind": "Variable",
- "name": "connections",
- "variableName": "connections"
- }
- ]
- }
- ],
- "storageKey": null
- }
- ]
- },
- "params": {
- "cacheID": "67e67147e0c7ec0489346b1ad86899c9",
- "id": null,
- "metadata": {},
- "name": "PolicyViewDeleteMutation",
- "operationKind": "mutation",
- "text": "mutation PolicyViewDeleteMutation(\n $input: DeletePolicyInput!\n) {\n deletePolicy(input: $input) {\n deletedPolicyId\n }\n}\n"
- }
-};
-})();
-
-(node as any).hash = "7d421e9b068f3f676a4c3069769b1c18";
-
-export default node;
diff --git a/apps/console/src/pages/organizations/policies/__generated__/PolicyViewQuery.graphql.ts b/apps/console/src/pages/organizations/policies/__generated__/PolicyViewQuery.graphql.ts
deleted file mode 100644
index 3da15d2f2..000000000
--- a/apps/console/src/pages/organizations/policies/__generated__/PolicyViewQuery.graphql.ts
+++ /dev/null
@@ -1,199 +0,0 @@
-/**
- * @generated SignedSource<>
- * @lightSyntaxTransform
- * @nogrep
- */
-
-/* tslint:disable */
-/* eslint-disable */
-// @ts-nocheck
-
-import { ConcreteRequest } from 'relay-runtime';
-export type PolicyStatus = "ACTIVE" | "DRAFT";
-export type PolicyViewQuery$variables = {
- policyId: string;
-};
-export type PolicyViewQuery$data = {
- readonly node: {
- readonly content?: string;
- readonly createdAt?: string;
- readonly id: string;
- readonly name?: string;
- readonly owner?: {
- readonly fullName: string;
- readonly id: string;
- readonly primaryEmailAddress: string;
- };
- readonly reviewDate?: string | null | undefined;
- readonly status?: PolicyStatus;
- readonly updatedAt?: string;
- };
-};
-export type PolicyViewQuery = {
- response: PolicyViewQuery$data;
- variables: PolicyViewQuery$variables;
-};
-
-const node: ConcreteRequest = (function(){
-var v0 = [
- {
- "defaultValue": null,
- "kind": "LocalArgument",
- "name": "policyId"
- }
-],
-v1 = [
- {
- "kind": "Variable",
- "name": "id",
- "variableName": "policyId"
- }
-],
-v2 = {
- "alias": null,
- "args": null,
- "kind": "ScalarField",
- "name": "id",
- "storageKey": null
-},
-v3 = {
- "kind": "InlineFragment",
- "selections": [
- {
- "alias": null,
- "args": null,
- "kind": "ScalarField",
- "name": "name",
- "storageKey": null
- },
- {
- "alias": null,
- "args": null,
- "kind": "ScalarField",
- "name": "content",
- "storageKey": null
- },
- {
- "alias": null,
- "args": null,
- "kind": "ScalarField",
- "name": "createdAt",
- "storageKey": null
- },
- {
- "alias": null,
- "args": null,
- "kind": "ScalarField",
- "name": "updatedAt",
- "storageKey": null
- },
- {
- "alias": null,
- "args": null,
- "kind": "ScalarField",
- "name": "reviewDate",
- "storageKey": null
- },
- {
- "alias": null,
- "args": null,
- "kind": "ScalarField",
- "name": "status",
- "storageKey": null
- },
- {
- "alias": null,
- "args": null,
- "concreteType": "People",
- "kind": "LinkedField",
- "name": "owner",
- "plural": false,
- "selections": [
- (v2/*: any*/),
- {
- "alias": null,
- "args": null,
- "kind": "ScalarField",
- "name": "fullName",
- "storageKey": null
- },
- {
- "alias": null,
- "args": null,
- "kind": "ScalarField",
- "name": "primaryEmailAddress",
- "storageKey": null
- }
- ],
- "storageKey": null
- }
- ],
- "type": "Policy",
- "abstractKey": null
-};
-return {
- "fragment": {
- "argumentDefinitions": (v0/*: any*/),
- "kind": "Fragment",
- "metadata": null,
- "name": "PolicyViewQuery",
- "selections": [
- {
- "alias": null,
- "args": (v1/*: any*/),
- "concreteType": null,
- "kind": "LinkedField",
- "name": "node",
- "plural": false,
- "selections": [
- (v2/*: any*/),
- (v3/*: any*/)
- ],
- "storageKey": null
- }
- ],
- "type": "Query",
- "abstractKey": null
- },
- "kind": "Request",
- "operation": {
- "argumentDefinitions": (v0/*: any*/),
- "kind": "Operation",
- "name": "PolicyViewQuery",
- "selections": [
- {
- "alias": null,
- "args": (v1/*: any*/),
- "concreteType": null,
- "kind": "LinkedField",
- "name": "node",
- "plural": false,
- "selections": [
- {
- "alias": null,
- "args": null,
- "kind": "ScalarField",
- "name": "__typename",
- "storageKey": null
- },
- (v2/*: any*/),
- (v3/*: any*/)
- ],
- "storageKey": null
- }
- ]
- },
- "params": {
- "cacheID": "26bf57eeab9c600a3146e01085ecae8e",
- "id": null,
- "metadata": {},
- "name": "PolicyViewQuery",
- "operationKind": "query",
- "text": "query PolicyViewQuery(\n $policyId: ID!\n) {\n node(id: $policyId) {\n __typename\n id\n ... on Policy {\n name\n content\n createdAt\n updatedAt\n reviewDate\n status\n owner {\n id\n fullName\n primaryEmailAddress\n }\n }\n }\n}\n"
- }
-};
-})();
-
-(node as any).hash = "0fcc28fc290df69d14d7d549bd09216f";
-
-export default node;
diff --git a/apps/console/src/pages/organizations/policies/__generated__/ShowPolicyViewCreateDraftMutation.graphql.ts b/apps/console/src/pages/organizations/policies/__generated__/ShowPolicyViewCreateDraftMutation.graphql.ts
new file mode 100644
index 000000000..6dc9013c1
--- /dev/null
+++ b/apps/console/src/pages/organizations/policies/__generated__/ShowPolicyViewCreateDraftMutation.graphql.ts
@@ -0,0 +1,135 @@
+/**
+ * @generated SignedSource<<290d3c4fb382c7b99c60eeee5cfa8c5a>>
+ * @lightSyntaxTransform
+ * @nogrep
+ */
+
+/* tslint:disable */
+/* eslint-disable */
+// @ts-nocheck
+
+import { ConcreteRequest } from 'relay-runtime';
+export type PolicyStatus = "DRAFT" | "PUBLISHED";
+export type CreateDraftPolicyVersionInput = {
+ policyID: string;
+};
+export type ShowPolicyViewCreateDraftMutation$variables = {
+ input: CreateDraftPolicyVersionInput;
+};
+export type ShowPolicyViewCreateDraftMutation$data = {
+ readonly createDraftPolicyVersion: {
+ readonly policyVersionEdge: {
+ readonly node: {
+ readonly id: string;
+ readonly status: PolicyStatus;
+ readonly version: number;
+ };
+ };
+ };
+};
+export type ShowPolicyViewCreateDraftMutation = {
+ response: ShowPolicyViewCreateDraftMutation$data;
+ variables: ShowPolicyViewCreateDraftMutation$variables;
+};
+
+const node: ConcreteRequest = (function(){
+var v0 = [
+ {
+ "defaultValue": null,
+ "kind": "LocalArgument",
+ "name": "input"
+ }
+],
+v1 = [
+ {
+ "alias": null,
+ "args": [
+ {
+ "kind": "Variable",
+ "name": "input",
+ "variableName": "input"
+ }
+ ],
+ "concreteType": "CreateDraftPolicyVersionPayload",
+ "kind": "LinkedField",
+ "name": "createDraftPolicyVersion",
+ "plural": false,
+ "selections": [
+ {
+ "alias": null,
+ "args": null,
+ "concreteType": "PolicyVersionEdge",
+ "kind": "LinkedField",
+ "name": "policyVersionEdge",
+ "plural": false,
+ "selections": [
+ {
+ "alias": null,
+ "args": null,
+ "concreteType": "PolicyVersion",
+ "kind": "LinkedField",
+ "name": "node",
+ "plural": false,
+ "selections": [
+ {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "id",
+ "storageKey": null
+ },
+ {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "version",
+ "storageKey": null
+ },
+ {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "status",
+ "storageKey": null
+ }
+ ],
+ "storageKey": null
+ }
+ ],
+ "storageKey": null
+ }
+ ],
+ "storageKey": null
+ }
+];
+return {
+ "fragment": {
+ "argumentDefinitions": (v0/*: any*/),
+ "kind": "Fragment",
+ "metadata": null,
+ "name": "ShowPolicyViewCreateDraftMutation",
+ "selections": (v1/*: any*/),
+ "type": "Mutation",
+ "abstractKey": null
+ },
+ "kind": "Request",
+ "operation": {
+ "argumentDefinitions": (v0/*: any*/),
+ "kind": "Operation",
+ "name": "ShowPolicyViewCreateDraftMutation",
+ "selections": (v1/*: any*/)
+ },
+ "params": {
+ "cacheID": "e96d226e93260cd989dc122193fbcbce",
+ "id": null,
+ "metadata": {},
+ "name": "ShowPolicyViewCreateDraftMutation",
+ "operationKind": "mutation",
+ "text": "mutation ShowPolicyViewCreateDraftMutation(\n $input: CreateDraftPolicyVersionInput!\n) {\n createDraftPolicyVersion(input: $input) {\n policyVersionEdge {\n node {\n id\n version\n status\n }\n }\n }\n}\n"
+ }
+};
+})();
+
+(node as any).hash = "49282edca41fc2bdca1a1c6db4b2dc11";
+
+export default node;
diff --git a/apps/console/src/pages/organizations/policies/__generated__/ShowPolicyViewPublishMutation.graphql.ts b/apps/console/src/pages/organizations/policies/__generated__/ShowPolicyViewPublishMutation.graphql.ts
new file mode 100644
index 000000000..5d333a768
--- /dev/null
+++ b/apps/console/src/pages/organizations/policies/__generated__/ShowPolicyViewPublishMutation.graphql.ts
@@ -0,0 +1,211 @@
+/**
+ * @generated SignedSource<<024ec8d58aa5f37adad3ac5e98c15a90>>
+ * @lightSyntaxTransform
+ * @nogrep
+ */
+
+/* tslint:disable */
+/* eslint-disable */
+// @ts-nocheck
+
+import { ConcreteRequest } from 'relay-runtime';
+export type PolicyStatus = "DRAFT" | "PUBLISHED";
+export type PublishPolicyVersionInput = {
+ policyId: string;
+};
+export type ShowPolicyViewPublishMutation$variables = {
+ input: PublishPolicyVersionInput;
+};
+export type ShowPolicyViewPublishMutation$data = {
+ readonly publishPolicyVersion: {
+ readonly policy: {
+ readonly currentPublishedVersion: number | null | undefined;
+ readonly id: string;
+ };
+ readonly policyVersion: {
+ readonly id: string;
+ readonly publishedAt: string | null | undefined;
+ readonly publishedBy: {
+ readonly fullName: string;
+ } | null | undefined;
+ readonly status: PolicyStatus;
+ };
+ };
+};
+export type ShowPolicyViewPublishMutation = {
+ response: ShowPolicyViewPublishMutation$data;
+ variables: ShowPolicyViewPublishMutation$variables;
+};
+
+const node: ConcreteRequest = (function(){
+var v0 = [
+ {
+ "defaultValue": null,
+ "kind": "LocalArgument",
+ "name": "input"
+ }
+],
+v1 = [
+ {
+ "kind": "Variable",
+ "name": "input",
+ "variableName": "input"
+ }
+],
+v2 = {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "id",
+ "storageKey": null
+},
+v3 = {
+ "alias": null,
+ "args": null,
+ "concreteType": "Policy",
+ "kind": "LinkedField",
+ "name": "policy",
+ "plural": false,
+ "selections": [
+ (v2/*: any*/),
+ {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "currentPublishedVersion",
+ "storageKey": null
+ }
+ ],
+ "storageKey": null
+},
+v4 = {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "status",
+ "storageKey": null
+},
+v5 = {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "publishedAt",
+ "storageKey": null
+},
+v6 = {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "fullName",
+ "storageKey": null
+};
+return {
+ "fragment": {
+ "argumentDefinitions": (v0/*: any*/),
+ "kind": "Fragment",
+ "metadata": null,
+ "name": "ShowPolicyViewPublishMutation",
+ "selections": [
+ {
+ "alias": null,
+ "args": (v1/*: any*/),
+ "concreteType": "PublishPolicyVersionPayload",
+ "kind": "LinkedField",
+ "name": "publishPolicyVersion",
+ "plural": false,
+ "selections": [
+ (v3/*: any*/),
+ {
+ "alias": null,
+ "args": null,
+ "concreteType": "PolicyVersion",
+ "kind": "LinkedField",
+ "name": "policyVersion",
+ "plural": false,
+ "selections": [
+ (v2/*: any*/),
+ (v4/*: any*/),
+ (v5/*: any*/),
+ {
+ "alias": null,
+ "args": null,
+ "concreteType": "People",
+ "kind": "LinkedField",
+ "name": "publishedBy",
+ "plural": false,
+ "selections": [
+ (v6/*: any*/)
+ ],
+ "storageKey": null
+ }
+ ],
+ "storageKey": null
+ }
+ ],
+ "storageKey": null
+ }
+ ],
+ "type": "Mutation",
+ "abstractKey": null
+ },
+ "kind": "Request",
+ "operation": {
+ "argumentDefinitions": (v0/*: any*/),
+ "kind": "Operation",
+ "name": "ShowPolicyViewPublishMutation",
+ "selections": [
+ {
+ "alias": null,
+ "args": (v1/*: any*/),
+ "concreteType": "PublishPolicyVersionPayload",
+ "kind": "LinkedField",
+ "name": "publishPolicyVersion",
+ "plural": false,
+ "selections": [
+ (v3/*: any*/),
+ {
+ "alias": null,
+ "args": null,
+ "concreteType": "PolicyVersion",
+ "kind": "LinkedField",
+ "name": "policyVersion",
+ "plural": false,
+ "selections": [
+ (v2/*: any*/),
+ (v4/*: any*/),
+ (v5/*: any*/),
+ {
+ "alias": null,
+ "args": null,
+ "concreteType": "People",
+ "kind": "LinkedField",
+ "name": "publishedBy",
+ "plural": false,
+ "selections": [
+ (v6/*: any*/),
+ (v2/*: any*/)
+ ],
+ "storageKey": null
+ }
+ ],
+ "storageKey": null
+ }
+ ],
+ "storageKey": null
+ }
+ ]
+ },
+ "params": {
+ "cacheID": "2047a011abeae6642230cb7b31080b08",
+ "id": null,
+ "metadata": {},
+ "name": "ShowPolicyViewPublishMutation",
+ "operationKind": "mutation",
+ "text": "mutation ShowPolicyViewPublishMutation(\n $input: PublishPolicyVersionInput!\n) {\n publishPolicyVersion(input: $input) {\n policy {\n id\n currentPublishedVersion\n }\n policyVersion {\n id\n status\n publishedAt\n publishedBy {\n fullName\n id\n }\n }\n }\n}\n"
+ }
+};
+})();
+
+(node as any).hash = "d81485a797858cf5f2834cf131d248cc";
+
+export default node;
diff --git a/apps/console/src/pages/organizations/policies/__generated__/ShowPolicyViewQuery.graphql.ts b/apps/console/src/pages/organizations/policies/__generated__/ShowPolicyViewQuery.graphql.ts
new file mode 100644
index 000000000..380e5e28c
--- /dev/null
+++ b/apps/console/src/pages/organizations/policies/__generated__/ShowPolicyViewQuery.graphql.ts
@@ -0,0 +1,606 @@
+/**
+ * @generated SignedSource<<351444982c4868267f30cc9fc8a2399a>>
+ * @lightSyntaxTransform
+ * @nogrep
+ */
+
+/* tslint:disable */
+/* eslint-disable */
+// @ts-nocheck
+
+import { ConcreteRequest } from 'relay-runtime';
+import { FragmentRefs } from "relay-runtime";
+export type PolicyStatus = "DRAFT" | "PUBLISHED";
+export type ShowPolicyViewQuery$variables = {
+ policyId: string;
+};
+export type ShowPolicyViewQuery$data = {
+ readonly node: {
+ readonly createdAt?: string;
+ readonly currentPublishedVersion?: number | null | undefined;
+ readonly description?: string;
+ readonly id: string;
+ readonly latestVersion?: {
+ readonly edges: ReadonlyArray<{
+ readonly node: {
+ readonly changelog: string;
+ readonly content: string;
+ readonly createdAt: string;
+ readonly id: string;
+ readonly publishedAt: string | null | undefined;
+ readonly publishedBy: {
+ readonly fullName: string;
+ } | null | undefined;
+ readonly status: PolicyStatus;
+ readonly updatedAt: string;
+ readonly version: number;
+ };
+ }>;
+ };
+ readonly owner?: {
+ readonly fullName: string;
+ readonly id: string;
+ readonly primaryEmailAddress: string;
+ };
+ readonly title?: string;
+ readonly updatedAt?: string;
+ readonly " $fragmentSpreads": FragmentRefs<"SignaturesModal_policyVersions" | "VersionHistoryModal_policyVersions">;
+ };
+};
+export type ShowPolicyViewQuery = {
+ response: ShowPolicyViewQuery$data;
+ variables: ShowPolicyViewQuery$variables;
+};
+
+const node: ConcreteRequest = (function(){
+var v0 = [
+ {
+ "defaultValue": null,
+ "kind": "LocalArgument",
+ "name": "policyId"
+ }
+],
+v1 = [
+ {
+ "kind": "Variable",
+ "name": "id",
+ "variableName": "policyId"
+ }
+],
+v2 = {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "id",
+ "storageKey": null
+},
+v3 = {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "title",
+ "storageKey": null
+},
+v4 = {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "description",
+ "storageKey": null
+},
+v5 = {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "createdAt",
+ "storageKey": null
+},
+v6 = {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "updatedAt",
+ "storageKey": null
+},
+v7 = {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "currentPublishedVersion",
+ "storageKey": null
+},
+v8 = {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "fullName",
+ "storageKey": null
+},
+v9 = {
+ "alias": null,
+ "args": null,
+ "concreteType": "People",
+ "kind": "LinkedField",
+ "name": "owner",
+ "plural": false,
+ "selections": [
+ (v2/*: any*/),
+ (v8/*: any*/),
+ {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "primaryEmailAddress",
+ "storageKey": null
+ }
+ ],
+ "storageKey": null
+},
+v10 = [
+ {
+ "kind": "Literal",
+ "name": "first",
+ "value": 1
+ }
+],
+v11 = {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "version",
+ "storageKey": null
+},
+v12 = {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "status",
+ "storageKey": null
+},
+v13 = {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "content",
+ "storageKey": null
+},
+v14 = {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "changelog",
+ "storageKey": null
+},
+v15 = {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "publishedAt",
+ "storageKey": null
+},
+v16 = {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "__typename",
+ "storageKey": null
+},
+v17 = [
+ (v8/*: any*/),
+ (v2/*: any*/)
+],
+v18 = {
+ "alias": null,
+ "args": null,
+ "concreteType": "People",
+ "kind": "LinkedField",
+ "name": "publishedBy",
+ "plural": false,
+ "selections": (v17/*: any*/),
+ "storageKey": null
+},
+v19 = [
+ {
+ "kind": "Literal",
+ "name": "first",
+ "value": 100
+ }
+];
+return {
+ "fragment": {
+ "argumentDefinitions": (v0/*: any*/),
+ "kind": "Fragment",
+ "metadata": null,
+ "name": "ShowPolicyViewQuery",
+ "selections": [
+ {
+ "alias": null,
+ "args": (v1/*: any*/),
+ "concreteType": null,
+ "kind": "LinkedField",
+ "name": "node",
+ "plural": false,
+ "selections": [
+ (v2/*: any*/),
+ {
+ "kind": "InlineFragment",
+ "selections": [
+ (v3/*: any*/),
+ (v4/*: any*/),
+ (v5/*: any*/),
+ (v6/*: any*/),
+ (v7/*: any*/),
+ (v9/*: any*/),
+ {
+ "args": null,
+ "kind": "FragmentSpread",
+ "name": "SignaturesModal_policyVersions"
+ },
+ {
+ "args": null,
+ "kind": "FragmentSpread",
+ "name": "VersionHistoryModal_policyVersions"
+ },
+ {
+ "alias": "latestVersion",
+ "args": (v10/*: any*/),
+ "concreteType": "PolicyVersionConnection",
+ "kind": "LinkedField",
+ "name": "versions",
+ "plural": false,
+ "selections": [
+ {
+ "alias": null,
+ "args": null,
+ "concreteType": "PolicyVersionEdge",
+ "kind": "LinkedField",
+ "name": "edges",
+ "plural": true,
+ "selections": [
+ {
+ "alias": null,
+ "args": null,
+ "concreteType": "PolicyVersion",
+ "kind": "LinkedField",
+ "name": "node",
+ "plural": false,
+ "selections": [
+ (v2/*: any*/),
+ (v11/*: any*/),
+ (v12/*: any*/),
+ (v13/*: any*/),
+ (v14/*: any*/),
+ (v15/*: any*/),
+ {
+ "alias": null,
+ "args": null,
+ "concreteType": "People",
+ "kind": "LinkedField",
+ "name": "publishedBy",
+ "plural": false,
+ "selections": [
+ (v8/*: any*/)
+ ],
+ "storageKey": null
+ },
+ (v5/*: any*/),
+ (v6/*: any*/)
+ ],
+ "storageKey": null
+ }
+ ],
+ "storageKey": null
+ }
+ ],
+ "storageKey": "versions(first:1)"
+ }
+ ],
+ "type": "Policy",
+ "abstractKey": null
+ }
+ ],
+ "storageKey": null
+ }
+ ],
+ "type": "Query",
+ "abstractKey": null
+ },
+ "kind": "Request",
+ "operation": {
+ "argumentDefinitions": (v0/*: any*/),
+ "kind": "Operation",
+ "name": "ShowPolicyViewQuery",
+ "selections": [
+ {
+ "alias": null,
+ "args": (v1/*: any*/),
+ "concreteType": null,
+ "kind": "LinkedField",
+ "name": "node",
+ "plural": false,
+ "selections": [
+ (v16/*: any*/),
+ (v2/*: any*/),
+ {
+ "kind": "InlineFragment",
+ "selections": [
+ (v3/*: any*/),
+ (v4/*: any*/),
+ (v5/*: any*/),
+ (v6/*: any*/),
+ (v7/*: any*/),
+ (v9/*: any*/),
+ {
+ "alias": "policyVersions",
+ "args": [
+ {
+ "kind": "Literal",
+ "name": "first",
+ "value": 10
+ }
+ ],
+ "concreteType": "PolicyVersionConnection",
+ "kind": "LinkedField",
+ "name": "versions",
+ "plural": false,
+ "selections": [
+ {
+ "alias": null,
+ "args": null,
+ "concreteType": "PolicyVersionEdge",
+ "kind": "LinkedField",
+ "name": "edges",
+ "plural": true,
+ "selections": [
+ {
+ "alias": null,
+ "args": null,
+ "concreteType": "PolicyVersion",
+ "kind": "LinkedField",
+ "name": "node",
+ "plural": false,
+ "selections": [
+ (v2/*: any*/),
+ (v11/*: any*/),
+ (v12/*: any*/),
+ (v15/*: any*/),
+ (v6/*: any*/),
+ (v18/*: any*/),
+ {
+ "alias": null,
+ "args": (v19/*: any*/),
+ "concreteType": "PolicyVersionSignatureConnection",
+ "kind": "LinkedField",
+ "name": "signatures",
+ "plural": false,
+ "selections": [
+ {
+ "alias": null,
+ "args": null,
+ "concreteType": "PolicyVersionSignatureEdge",
+ "kind": "LinkedField",
+ "name": "edges",
+ "plural": true,
+ "selections": [
+ {
+ "alias": null,
+ "args": null,
+ "concreteType": "PolicyVersionSignature",
+ "kind": "LinkedField",
+ "name": "node",
+ "plural": false,
+ "selections": [
+ (v2/*: any*/),
+ {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "state",
+ "storageKey": null
+ },
+ {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "signedAt",
+ "storageKey": null
+ },
+ {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "requestedAt",
+ "storageKey": null
+ },
+ {
+ "alias": null,
+ "args": null,
+ "concreteType": "People",
+ "kind": "LinkedField",
+ "name": "signedBy",
+ "plural": false,
+ "selections": (v17/*: any*/),
+ "storageKey": null
+ },
+ {
+ "alias": null,
+ "args": null,
+ "concreteType": "People",
+ "kind": "LinkedField",
+ "name": "requestedBy",
+ "plural": false,
+ "selections": (v17/*: any*/),
+ "storageKey": null
+ },
+ (v16/*: any*/)
+ ],
+ "storageKey": null
+ },
+ {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "cursor",
+ "storageKey": null
+ }
+ ],
+ "storageKey": null
+ },
+ {
+ "alias": null,
+ "args": null,
+ "concreteType": "PageInfo",
+ "kind": "LinkedField",
+ "name": "pageInfo",
+ "plural": false,
+ "selections": [
+ {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "endCursor",
+ "storageKey": null
+ },
+ {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "hasNextPage",
+ "storageKey": null
+ }
+ ],
+ "storageKey": null
+ }
+ ],
+ "storageKey": "signatures(first:100)"
+ },
+ {
+ "alias": null,
+ "args": (v19/*: any*/),
+ "filters": null,
+ "handle": "connection",
+ "key": "SignaturesModal_policyVersions_signatures",
+ "kind": "LinkedHandle",
+ "name": "signatures"
+ }
+ ],
+ "storageKey": null
+ }
+ ],
+ "storageKey": null
+ }
+ ],
+ "storageKey": "versions(first:10)"
+ },
+ {
+ "alias": "versionHistory",
+ "args": [
+ {
+ "kind": "Literal",
+ "name": "first",
+ "value": 20
+ }
+ ],
+ "concreteType": "PolicyVersionConnection",
+ "kind": "LinkedField",
+ "name": "versions",
+ "plural": false,
+ "selections": [
+ {
+ "alias": null,
+ "args": null,
+ "concreteType": "PolicyVersionEdge",
+ "kind": "LinkedField",
+ "name": "edges",
+ "plural": true,
+ "selections": [
+ {
+ "alias": null,
+ "args": null,
+ "concreteType": "PolicyVersion",
+ "kind": "LinkedField",
+ "name": "node",
+ "plural": false,
+ "selections": [
+ (v2/*: any*/),
+ (v11/*: any*/),
+ (v12/*: any*/),
+ (v13/*: any*/),
+ (v14/*: any*/),
+ (v15/*: any*/),
+ (v6/*: any*/),
+ (v18/*: any*/)
+ ],
+ "storageKey": null
+ }
+ ],
+ "storageKey": null
+ }
+ ],
+ "storageKey": "versions(first:20)"
+ },
+ {
+ "alias": "latestVersion",
+ "args": (v10/*: any*/),
+ "concreteType": "PolicyVersionConnection",
+ "kind": "LinkedField",
+ "name": "versions",
+ "plural": false,
+ "selections": [
+ {
+ "alias": null,
+ "args": null,
+ "concreteType": "PolicyVersionEdge",
+ "kind": "LinkedField",
+ "name": "edges",
+ "plural": true,
+ "selections": [
+ {
+ "alias": null,
+ "args": null,
+ "concreteType": "PolicyVersion",
+ "kind": "LinkedField",
+ "name": "node",
+ "plural": false,
+ "selections": [
+ (v2/*: any*/),
+ (v11/*: any*/),
+ (v12/*: any*/),
+ (v13/*: any*/),
+ (v14/*: any*/),
+ (v15/*: any*/),
+ (v18/*: any*/),
+ (v5/*: any*/),
+ (v6/*: any*/)
+ ],
+ "storageKey": null
+ }
+ ],
+ "storageKey": null
+ }
+ ],
+ "storageKey": "versions(first:1)"
+ }
+ ],
+ "type": "Policy",
+ "abstractKey": null
+ }
+ ],
+ "storageKey": null
+ }
+ ]
+ },
+ "params": {
+ "cacheID": "751e6cc23218ca2da7b5bf44d3eef59c",
+ "id": null,
+ "metadata": {},
+ "name": "ShowPolicyViewQuery",
+ "operationKind": "query",
+ "text": "query ShowPolicyViewQuery(\n $policyId: ID!\n) {\n node(id: $policyId) {\n __typename\n id\n ... on Policy {\n title\n description\n createdAt\n updatedAt\n currentPublishedVersion\n owner {\n id\n fullName\n primaryEmailAddress\n }\n ...SignaturesModal_policyVersions\n ...VersionHistoryModal_policyVersions\n latestVersion: versions(first: 1) {\n edges {\n node {\n id\n version\n status\n content\n changelog\n publishedAt\n publishedBy {\n fullName\n id\n }\n createdAt\n updatedAt\n }\n }\n }\n }\n }\n}\n\nfragment SignaturesModal_policyVersions on Policy {\n title\n policyVersions: versions(first: 10) {\n edges {\n node {\n id\n version\n status\n publishedAt\n updatedAt\n publishedBy {\n fullName\n id\n }\n signatures(first: 100) {\n edges {\n node {\n id\n state\n signedAt\n requestedAt\n signedBy {\n fullName\n id\n }\n requestedBy {\n fullName\n id\n }\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n }\n }\n }\n}\n\nfragment VersionHistoryModal_policyVersions on Policy {\n title\n owner {\n fullName\n id\n }\n versionHistory: versions(first: 20) {\n edges {\n node {\n id\n version\n status\n content\n changelog\n publishedAt\n updatedAt\n publishedBy {\n fullName\n id\n }\n }\n }\n }\n}\n"
+ }
+};
+})();
+
+(node as any).hash = "58adb8690071648aecb252b2f807ea7d";
+
+export default node;
diff --git a/apps/console/src/pages/organizations/policies/__generated__/SignaturesModalOrganizationQuery.graphql.ts b/apps/console/src/pages/organizations/policies/__generated__/SignaturesModalOrganizationQuery.graphql.ts
new file mode 100644
index 000000000..8874e7cb0
--- /dev/null
+++ b/apps/console/src/pages/organizations/policies/__generated__/SignaturesModalOrganizationQuery.graphql.ts
@@ -0,0 +1,206 @@
+/**
+ * @generated SignedSource<<070580dfc3d76a6f1ca8b0227dc8c1c6>>
+ * @lightSyntaxTransform
+ * @nogrep
+ */
+
+/* tslint:disable */
+/* eslint-disable */
+// @ts-nocheck
+
+import { ConcreteRequest } from 'relay-runtime';
+export type PeopleKind = "CONTRACTOR" | "EMPLOYEE" | "SERVICE_ACCOUNT";
+export type SignaturesModalOrganizationQuery$variables = {
+ organizationId: string;
+};
+export type SignaturesModalOrganizationQuery$data = {
+ readonly organization: {
+ readonly id?: string;
+ readonly peoples?: {
+ readonly edges: ReadonlyArray<{
+ readonly node: {
+ readonly fullName: string;
+ readonly id: string;
+ readonly kind: PeopleKind;
+ readonly primaryEmailAddress: string;
+ };
+ }>;
+ };
+ };
+};
+export type SignaturesModalOrganizationQuery = {
+ response: SignaturesModalOrganizationQuery$data;
+ variables: SignaturesModalOrganizationQuery$variables;
+};
+
+const node: ConcreteRequest = (function(){
+var v0 = [
+ {
+ "defaultValue": null,
+ "kind": "LocalArgument",
+ "name": "organizationId"
+ }
+],
+v1 = [
+ {
+ "kind": "Variable",
+ "name": "id",
+ "variableName": "organizationId"
+ }
+],
+v2 = {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "id",
+ "storageKey": null
+},
+v3 = {
+ "alias": null,
+ "args": [
+ {
+ "kind": "Literal",
+ "name": "first",
+ "value": 100
+ },
+ {
+ "kind": "Literal",
+ "name": "orderBy",
+ "value": {
+ "direction": "ASC",
+ "field": "FULL_NAME"
+ }
+ }
+ ],
+ "concreteType": "PeopleConnection",
+ "kind": "LinkedField",
+ "name": "peoples",
+ "plural": false,
+ "selections": [
+ {
+ "alias": null,
+ "args": null,
+ "concreteType": "PeopleEdge",
+ "kind": "LinkedField",
+ "name": "edges",
+ "plural": true,
+ "selections": [
+ {
+ "alias": null,
+ "args": null,
+ "concreteType": "People",
+ "kind": "LinkedField",
+ "name": "node",
+ "plural": false,
+ "selections": [
+ (v2/*: any*/),
+ {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "fullName",
+ "storageKey": null
+ },
+ {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "primaryEmailAddress",
+ "storageKey": null
+ },
+ {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "kind",
+ "storageKey": null
+ }
+ ],
+ "storageKey": null
+ }
+ ],
+ "storageKey": null
+ }
+ ],
+ "storageKey": "peoples(first:100,orderBy:{\"direction\":\"ASC\",\"field\":\"FULL_NAME\"})"
+};
+return {
+ "fragment": {
+ "argumentDefinitions": (v0/*: any*/),
+ "kind": "Fragment",
+ "metadata": null,
+ "name": "SignaturesModalOrganizationQuery",
+ "selections": [
+ {
+ "alias": "organization",
+ "args": (v1/*: any*/),
+ "concreteType": null,
+ "kind": "LinkedField",
+ "name": "node",
+ "plural": false,
+ "selections": [
+ {
+ "kind": "InlineFragment",
+ "selections": [
+ (v2/*: any*/),
+ (v3/*: any*/)
+ ],
+ "type": "Organization",
+ "abstractKey": null
+ }
+ ],
+ "storageKey": null
+ }
+ ],
+ "type": "Query",
+ "abstractKey": null
+ },
+ "kind": "Request",
+ "operation": {
+ "argumentDefinitions": (v0/*: any*/),
+ "kind": "Operation",
+ "name": "SignaturesModalOrganizationQuery",
+ "selections": [
+ {
+ "alias": "organization",
+ "args": (v1/*: any*/),
+ "concreteType": null,
+ "kind": "LinkedField",
+ "name": "node",
+ "plural": false,
+ "selections": [
+ {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "__typename",
+ "storageKey": null
+ },
+ (v2/*: any*/),
+ {
+ "kind": "InlineFragment",
+ "selections": [
+ (v3/*: any*/)
+ ],
+ "type": "Organization",
+ "abstractKey": null
+ }
+ ],
+ "storageKey": null
+ }
+ ]
+ },
+ "params": {
+ "cacheID": "a2551c513c1c12a46c0da5328086475a",
+ "id": null,
+ "metadata": {},
+ "name": "SignaturesModalOrganizationQuery",
+ "operationKind": "query",
+ "text": "query SignaturesModalOrganizationQuery(\n $organizationId: ID!\n) {\n organization: node(id: $organizationId) {\n __typename\n ... on Organization {\n id\n peoples(first: 100, orderBy: {direction: ASC, field: FULL_NAME}) {\n edges {\n node {\n id\n fullName\n primaryEmailAddress\n kind\n }\n }\n }\n }\n id\n }\n}\n"
+ }
+};
+})();
+
+(node as any).hash = "39bec552bdf8762487cec72839225b84";
+
+export default node;
diff --git a/apps/console/src/pages/organizations/policies/__generated__/SignaturesModalRequestSignatureMutation.graphql.ts b/apps/console/src/pages/organizations/policies/__generated__/SignaturesModalRequestSignatureMutation.graphql.ts
new file mode 100644
index 000000000..8c038d615
--- /dev/null
+++ b/apps/console/src/pages/organizations/policies/__generated__/SignaturesModalRequestSignatureMutation.graphql.ts
@@ -0,0 +1,264 @@
+/**
+ * @generated SignedSource<>
+ * @lightSyntaxTransform
+ * @nogrep
+ */
+
+/* tslint:disable */
+/* eslint-disable */
+// @ts-nocheck
+
+import { ConcreteRequest } from 'relay-runtime';
+export type PolicyVersionSignatureState = "REQUESTED" | "SIGNED";
+export type RequestSignatureInput = {
+ policyVersionId: string;
+ signatoryId: string;
+};
+export type SignaturesModalRequestSignatureMutation$variables = {
+ connections: ReadonlyArray;
+ input: RequestSignatureInput;
+};
+export type SignaturesModalRequestSignatureMutation$data = {
+ readonly requestSignature: {
+ readonly policyVersionSignatureEdge: {
+ readonly node: {
+ readonly id: string;
+ readonly requestedAt: string;
+ readonly requestedBy: {
+ readonly fullName: string;
+ };
+ readonly signedAt: string | null | undefined;
+ readonly signedBy: {
+ readonly fullName: string;
+ readonly id: string;
+ };
+ readonly state: PolicyVersionSignatureState;
+ };
+ };
+ };
+};
+export type SignaturesModalRequestSignatureMutation = {
+ response: SignaturesModalRequestSignatureMutation$data;
+ variables: SignaturesModalRequestSignatureMutation$variables;
+};
+
+const node: ConcreteRequest = (function(){
+var v0 = {
+ "defaultValue": null,
+ "kind": "LocalArgument",
+ "name": "connections"
+},
+v1 = {
+ "defaultValue": null,
+ "kind": "LocalArgument",
+ "name": "input"
+},
+v2 = [
+ {
+ "kind": "Variable",
+ "name": "input",
+ "variableName": "input"
+ }
+],
+v3 = {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "id",
+ "storageKey": null
+},
+v4 = {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "state",
+ "storageKey": null
+},
+v5 = {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "signedAt",
+ "storageKey": null
+},
+v6 = {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "requestedAt",
+ "storageKey": null
+},
+v7 = {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "fullName",
+ "storageKey": null
+},
+v8 = [
+ (v7/*: any*/),
+ (v3/*: any*/)
+],
+v9 = {
+ "alias": null,
+ "args": null,
+ "concreteType": "People",
+ "kind": "LinkedField",
+ "name": "signedBy",
+ "plural": false,
+ "selections": (v8/*: any*/),
+ "storageKey": null
+};
+return {
+ "fragment": {
+ "argumentDefinitions": [
+ (v0/*: any*/),
+ (v1/*: any*/)
+ ],
+ "kind": "Fragment",
+ "metadata": null,
+ "name": "SignaturesModalRequestSignatureMutation",
+ "selections": [
+ {
+ "alias": null,
+ "args": (v2/*: any*/),
+ "concreteType": "RequestSignaturePayload",
+ "kind": "LinkedField",
+ "name": "requestSignature",
+ "plural": false,
+ "selections": [
+ {
+ "alias": null,
+ "args": null,
+ "concreteType": "PolicyVersionSignatureEdge",
+ "kind": "LinkedField",
+ "name": "policyVersionSignatureEdge",
+ "plural": false,
+ "selections": [
+ {
+ "alias": null,
+ "args": null,
+ "concreteType": "PolicyVersionSignature",
+ "kind": "LinkedField",
+ "name": "node",
+ "plural": false,
+ "selections": [
+ (v3/*: any*/),
+ (v4/*: any*/),
+ (v5/*: any*/),
+ (v6/*: any*/),
+ (v9/*: any*/),
+ {
+ "alias": null,
+ "args": null,
+ "concreteType": "People",
+ "kind": "LinkedField",
+ "name": "requestedBy",
+ "plural": false,
+ "selections": [
+ (v7/*: any*/)
+ ],
+ "storageKey": null
+ }
+ ],
+ "storageKey": null
+ }
+ ],
+ "storageKey": null
+ }
+ ],
+ "storageKey": null
+ }
+ ],
+ "type": "Mutation",
+ "abstractKey": null
+ },
+ "kind": "Request",
+ "operation": {
+ "argumentDefinitions": [
+ (v1/*: any*/),
+ (v0/*: any*/)
+ ],
+ "kind": "Operation",
+ "name": "SignaturesModalRequestSignatureMutation",
+ "selections": [
+ {
+ "alias": null,
+ "args": (v2/*: any*/),
+ "concreteType": "RequestSignaturePayload",
+ "kind": "LinkedField",
+ "name": "requestSignature",
+ "plural": false,
+ "selections": [
+ {
+ "alias": null,
+ "args": null,
+ "concreteType": "PolicyVersionSignatureEdge",
+ "kind": "LinkedField",
+ "name": "policyVersionSignatureEdge",
+ "plural": false,
+ "selections": [
+ {
+ "alias": null,
+ "args": null,
+ "concreteType": "PolicyVersionSignature",
+ "kind": "LinkedField",
+ "name": "node",
+ "plural": false,
+ "selections": [
+ (v3/*: any*/),
+ (v4/*: any*/),
+ (v5/*: any*/),
+ (v6/*: any*/),
+ (v9/*: any*/),
+ {
+ "alias": null,
+ "args": null,
+ "concreteType": "People",
+ "kind": "LinkedField",
+ "name": "requestedBy",
+ "plural": false,
+ "selections": (v8/*: any*/),
+ "storageKey": null
+ }
+ ],
+ "storageKey": null
+ }
+ ],
+ "storageKey": null
+ },
+ {
+ "alias": null,
+ "args": null,
+ "filters": null,
+ "handle": "prependEdge",
+ "key": "",
+ "kind": "LinkedHandle",
+ "name": "policyVersionSignatureEdge",
+ "handleArgs": [
+ {
+ "kind": "Variable",
+ "name": "connections",
+ "variableName": "connections"
+ }
+ ]
+ }
+ ],
+ "storageKey": null
+ }
+ ]
+ },
+ "params": {
+ "cacheID": "4c6a5b6ed95c76c157f8627409a4481b",
+ "id": null,
+ "metadata": {},
+ "name": "SignaturesModalRequestSignatureMutation",
+ "operationKind": "mutation",
+ "text": "mutation SignaturesModalRequestSignatureMutation(\n $input: RequestSignatureInput!\n) {\n requestSignature(input: $input) {\n policyVersionSignatureEdge {\n node {\n id\n state\n signedAt\n requestedAt\n signedBy {\n fullName\n id\n }\n requestedBy {\n fullName\n id\n }\n }\n }\n }\n}\n"
+ }
+};
+})();
+
+(node as any).hash = "2b17fe4feae2614a6697c63a7334a1cf";
+
+export default node;
diff --git a/apps/console/src/pages/organizations/policies/__generated__/SignaturesModal_policyVersions.graphql.ts b/apps/console/src/pages/organizations/policies/__generated__/SignaturesModal_policyVersions.graphql.ts
new file mode 100644
index 000000000..d88ec683c
--- /dev/null
+++ b/apps/console/src/pages/organizations/policies/__generated__/SignaturesModal_policyVersions.graphql.ts
@@ -0,0 +1,298 @@
+/**
+ * @generated SignedSource<>
+ * @lightSyntaxTransform
+ * @nogrep
+ */
+
+/* tslint:disable */
+/* eslint-disable */
+// @ts-nocheck
+
+import { ReaderFragment } from 'relay-runtime';
+export type PolicyStatus = "DRAFT" | "PUBLISHED";
+export type PolicyVersionSignatureState = "REQUESTED" | "SIGNED";
+import { FragmentRefs } from "relay-runtime";
+export type SignaturesModal_policyVersions$data = {
+ readonly policyVersions: {
+ readonly edges: ReadonlyArray<{
+ readonly node: {
+ readonly id: string;
+ readonly publishedAt: string | null | undefined;
+ readonly publishedBy: {
+ readonly fullName: string;
+ } | null | undefined;
+ readonly signatures: {
+ readonly edges: ReadonlyArray<{
+ readonly node: {
+ readonly id: string;
+ readonly requestedAt: string;
+ readonly requestedBy: {
+ readonly fullName: string;
+ };
+ readonly signedAt: string | null | undefined;
+ readonly signedBy: {
+ readonly fullName: string;
+ readonly id: string;
+ };
+ readonly state: PolicyVersionSignatureState;
+ };
+ }>;
+ };
+ readonly status: PolicyStatus;
+ readonly updatedAt: string;
+ readonly version: number;
+ };
+ }>;
+ };
+ readonly title: string;
+ readonly " $fragmentType": "SignaturesModal_policyVersions";
+};
+export type SignaturesModal_policyVersions$key = {
+ readonly " $data"?: SignaturesModal_policyVersions$data;
+ readonly " $fragmentSpreads": FragmentRefs<"SignaturesModal_policyVersions">;
+};
+
+const node: ReaderFragment = (function(){
+var v0 = {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "id",
+ "storageKey": null
+},
+v1 = {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "fullName",
+ "storageKey": null
+},
+v2 = [
+ (v1/*: any*/)
+];
+return {
+ "argumentDefinitions": [],
+ "kind": "Fragment",
+ "metadata": {
+ "connection": [
+ {
+ "count": null,
+ "cursor": null,
+ "direction": "forward",
+ "path": null
+ }
+ ]
+ },
+ "name": "SignaturesModal_policyVersions",
+ "selections": [
+ {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "title",
+ "storageKey": null
+ },
+ {
+ "alias": "policyVersions",
+ "args": [
+ {
+ "kind": "Literal",
+ "name": "first",
+ "value": 10
+ }
+ ],
+ "concreteType": "PolicyVersionConnection",
+ "kind": "LinkedField",
+ "name": "versions",
+ "plural": false,
+ "selections": [
+ {
+ "alias": null,
+ "args": null,
+ "concreteType": "PolicyVersionEdge",
+ "kind": "LinkedField",
+ "name": "edges",
+ "plural": true,
+ "selections": [
+ {
+ "alias": null,
+ "args": null,
+ "concreteType": "PolicyVersion",
+ "kind": "LinkedField",
+ "name": "node",
+ "plural": false,
+ "selections": [
+ (v0/*: any*/),
+ {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "version",
+ "storageKey": null
+ },
+ {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "status",
+ "storageKey": null
+ },
+ {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "publishedAt",
+ "storageKey": null
+ },
+ {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "updatedAt",
+ "storageKey": null
+ },
+ {
+ "alias": null,
+ "args": null,
+ "concreteType": "People",
+ "kind": "LinkedField",
+ "name": "publishedBy",
+ "plural": false,
+ "selections": (v2/*: any*/),
+ "storageKey": null
+ },
+ {
+ "alias": "signatures",
+ "args": null,
+ "concreteType": "PolicyVersionSignatureConnection",
+ "kind": "LinkedField",
+ "name": "__SignaturesModal_policyVersions_signatures_connection",
+ "plural": false,
+ "selections": [
+ {
+ "alias": null,
+ "args": null,
+ "concreteType": "PolicyVersionSignatureEdge",
+ "kind": "LinkedField",
+ "name": "edges",
+ "plural": true,
+ "selections": [
+ {
+ "alias": null,
+ "args": null,
+ "concreteType": "PolicyVersionSignature",
+ "kind": "LinkedField",
+ "name": "node",
+ "plural": false,
+ "selections": [
+ (v0/*: any*/),
+ {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "state",
+ "storageKey": null
+ },
+ {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "signedAt",
+ "storageKey": null
+ },
+ {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "requestedAt",
+ "storageKey": null
+ },
+ {
+ "alias": null,
+ "args": null,
+ "concreteType": "People",
+ "kind": "LinkedField",
+ "name": "signedBy",
+ "plural": false,
+ "selections": [
+ (v1/*: any*/),
+ (v0/*: any*/)
+ ],
+ "storageKey": null
+ },
+ {
+ "alias": null,
+ "args": null,
+ "concreteType": "People",
+ "kind": "LinkedField",
+ "name": "requestedBy",
+ "plural": false,
+ "selections": (v2/*: any*/),
+ "storageKey": null
+ },
+ {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "__typename",
+ "storageKey": null
+ }
+ ],
+ "storageKey": null
+ },
+ {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "cursor",
+ "storageKey": null
+ }
+ ],
+ "storageKey": null
+ },
+ {
+ "alias": null,
+ "args": null,
+ "concreteType": "PageInfo",
+ "kind": "LinkedField",
+ "name": "pageInfo",
+ "plural": false,
+ "selections": [
+ {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "endCursor",
+ "storageKey": null
+ },
+ {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "hasNextPage",
+ "storageKey": null
+ }
+ ],
+ "storageKey": null
+ }
+ ],
+ "storageKey": null
+ }
+ ],
+ "storageKey": null
+ }
+ ],
+ "storageKey": null
+ }
+ ],
+ "storageKey": "versions(first:10)"
+ }
+ ],
+ "type": "Policy",
+ "abstractKey": null
+};
+})();
+
+(node as any).hash = "da9bf0fc12618afb0f9ec8f2337b9b9b";
+
+export default node;
diff --git a/apps/console/src/pages/organizations/policies/__generated__/VersionHistoryModal_policyVersions.graphql.ts b/apps/console/src/pages/organizations/policies/__generated__/VersionHistoryModal_policyVersions.graphql.ts
new file mode 100644
index 000000000..7023f18c2
--- /dev/null
+++ b/apps/console/src/pages/organizations/policies/__generated__/VersionHistoryModal_policyVersions.graphql.ts
@@ -0,0 +1,181 @@
+/**
+ * @generated SignedSource<<21626cad90fcb579071d73bc47e3fb7a>>
+ * @lightSyntaxTransform
+ * @nogrep
+ */
+
+/* tslint:disable */
+/* eslint-disable */
+// @ts-nocheck
+
+import { ReaderFragment } from 'relay-runtime';
+export type PolicyStatus = "DRAFT" | "PUBLISHED";
+import { FragmentRefs } from "relay-runtime";
+export type VersionHistoryModal_policyVersions$data = {
+ readonly owner: {
+ readonly fullName: string;
+ };
+ readonly title: string;
+ readonly versionHistory: {
+ readonly edges: ReadonlyArray<{
+ readonly node: {
+ readonly changelog: string;
+ readonly content: string;
+ readonly id: string;
+ readonly publishedAt: string | null | undefined;
+ readonly publishedBy: {
+ readonly fullName: string;
+ } | null | undefined;
+ readonly status: PolicyStatus;
+ readonly updatedAt: string;
+ readonly version: number;
+ };
+ }>;
+ };
+ readonly " $fragmentType": "VersionHistoryModal_policyVersions";
+};
+export type VersionHistoryModal_policyVersions$key = {
+ readonly " $data"?: VersionHistoryModal_policyVersions$data;
+ readonly " $fragmentSpreads": FragmentRefs<"VersionHistoryModal_policyVersions">;
+};
+
+const node: ReaderFragment = (function(){
+var v0 = [
+ {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "fullName",
+ "storageKey": null
+ }
+];
+return {
+ "argumentDefinitions": [],
+ "kind": "Fragment",
+ "metadata": null,
+ "name": "VersionHistoryModal_policyVersions",
+ "selections": [
+ {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "title",
+ "storageKey": null
+ },
+ {
+ "alias": null,
+ "args": null,
+ "concreteType": "People",
+ "kind": "LinkedField",
+ "name": "owner",
+ "plural": false,
+ "selections": (v0/*: any*/),
+ "storageKey": null
+ },
+ {
+ "alias": "versionHistory",
+ "args": [
+ {
+ "kind": "Literal",
+ "name": "first",
+ "value": 20
+ }
+ ],
+ "concreteType": "PolicyVersionConnection",
+ "kind": "LinkedField",
+ "name": "versions",
+ "plural": false,
+ "selections": [
+ {
+ "alias": null,
+ "args": null,
+ "concreteType": "PolicyVersionEdge",
+ "kind": "LinkedField",
+ "name": "edges",
+ "plural": true,
+ "selections": [
+ {
+ "alias": null,
+ "args": null,
+ "concreteType": "PolicyVersion",
+ "kind": "LinkedField",
+ "name": "node",
+ "plural": false,
+ "selections": [
+ {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "id",
+ "storageKey": null
+ },
+ {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "version",
+ "storageKey": null
+ },
+ {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "status",
+ "storageKey": null
+ },
+ {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "content",
+ "storageKey": null
+ },
+ {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "changelog",
+ "storageKey": null
+ },
+ {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "publishedAt",
+ "storageKey": null
+ },
+ {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "updatedAt",
+ "storageKey": null
+ },
+ {
+ "alias": null,
+ "args": null,
+ "concreteType": "People",
+ "kind": "LinkedField",
+ "name": "publishedBy",
+ "plural": false,
+ "selections": (v0/*: any*/),
+ "storageKey": null
+ }
+ ],
+ "storageKey": null
+ }
+ ],
+ "storageKey": null
+ }
+ ],
+ "storageKey": "versions(first:20)"
+ }
+ ],
+ "type": "Policy",
+ "abstractKey": null
+};
+})();
+
+(node as any).hash = "09cd9142880cfbb239ce866ea81afe48";
+
+export default node;
diff --git a/apps/console/src/pages/organizations/risks/ShowRiskView.tsx b/apps/console/src/pages/organizations/risks/ShowRiskView.tsx
index ac923c4b2..f5ef4f2fd 100644
--- a/apps/console/src/pages/organizations/risks/ShowRiskView.tsx
+++ b/apps/console/src/pages/organizations/risks/ShowRiskView.tsx
@@ -101,8 +101,7 @@ const showRiskViewQuery = graphql`
edges {
node {
id
- name
- status
+ title
createdAt
}
}
@@ -155,8 +154,7 @@ const organizationPoliciesQuery = graphql`
edges {
node {
id
- name
- status
+ title
}
}
}
@@ -530,7 +528,7 @@ function ShowRiskViewContent({
return policies.filter((policy) => {
return (
!policySearchQuery ||
- policy.name.toLowerCase().includes(policySearchQuery.toLowerCase())
+ policy.title.toLowerCase().includes(policySearchQuery.toLowerCase())
);
});
}, [getPolicies, policySearchQuery]);
@@ -731,7 +729,7 @@ function ShowRiskViewContent({
toast({
title: "Success",
- description: `Linked policy "${policy.name}" to this risk.`,
+ description: `Linked policy "${policy.title}" to this risk.`,
});
},
onError: (error) => {
@@ -803,7 +801,7 @@ function ShowRiskViewContent({
toast({
title: "Success",
- description: `Unlinked policy "${policy.name}" from this risk.`,
+ description: `Unlinked policy "${policy.title}" from this risk.`,
});
},
onError: (error) => {
@@ -1090,15 +1088,26 @@ function ShowRiskViewContent({
Risk Policies
- {
- setIsPolicyDialogOpen(true);
- loadPoliciesData();
- }}
- >
-
- Link Policy
-
+
+
+
+
+ New Version
+
+
+ {
+ setIsPolicyDialogOpen(true);
+ loadPoliciesData();
+ }}
+ >
+
+ Link Policy
+
+
{policies.length > 0 ? (
@@ -1117,7 +1126,7 @@ function ShowRiskViewContent({
to={`/organizations/${organizationId}/policies/${policy.id}`}
className="font-medium text-blue-600 hover:underline"
>
- {policy.name}
+ {policy.title}
@@ -1350,7 +1359,7 @@ function ShowRiskViewContent({
>
- {policy.name}
+ {policy.title}
{isLinked ? (
>
+ * @generated SignedSource<<0335bb26d78f02170c02c7c2279a6bfd>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -9,7 +9,6 @@
// @ts-nocheck
import { ConcreteRequest } from 'relay-runtime';
-export type PolicyStatus = "ACTIVE" | "DRAFT";
export type ShowRiskViewOrganizationPoliciesQuery$variables = {
organizationId: string;
};
@@ -20,8 +19,7 @@ export type ShowRiskViewOrganizationPoliciesQuery$data = {
readonly edges: ReadonlyArray<{
readonly node: {
readonly id: string;
- readonly name: string;
- readonly status: PolicyStatus;
+ readonly title: string;
};
}>;
};
@@ -83,14 +81,7 @@ v4 = [
"alias": null,
"args": null,
"kind": "ScalarField",
- "name": "name",
- "storageKey": null
- },
- {
- "alias": null,
- "args": null,
- "kind": "ScalarField",
- "name": "status",
+ "name": "title",
"storageKey": null
},
(v3/*: any*/)
@@ -228,7 +219,7 @@ return {
]
},
"params": {
- "cacheID": "a229f1f805e79f8de378305e021d7fea",
+ "cacheID": "a92a6b2390e95e67b42fd18cc1030a9a",
"id": null,
"metadata": {
"connection": [
@@ -245,11 +236,11 @@ return {
},
"name": "ShowRiskViewOrganizationPoliciesQuery",
"operationKind": "query",
- "text": "query ShowRiskViewOrganizationPoliciesQuery(\n $organizationId: ID!\n) {\n organization: node(id: $organizationId) {\n __typename\n id\n ... on Organization {\n policies(first: 100) {\n edges {\n node {\n id\n name\n status\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n }\n }\n}\n"
+ "text": "query ShowRiskViewOrganizationPoliciesQuery(\n $organizationId: ID!\n) {\n organization: node(id: $organizationId) {\n __typename\n id\n ... on Organization {\n policies(first: 100) {\n edges {\n node {\n id\n title\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n }\n }\n}\n"
}
};
})();
-(node as any).hash = "26cbf19cd716aee7413931357b9c5354";
+(node as any).hash = "b47adf6c3a247367a6b23dd161df2702";
export default node;
diff --git a/apps/console/src/pages/organizations/risks/__generated__/ShowRiskViewQuery.graphql.ts b/apps/console/src/pages/organizations/risks/__generated__/ShowRiskViewQuery.graphql.ts
index 4a54100cd..5a32a914e 100644
--- a/apps/console/src/pages/organizations/risks/__generated__/ShowRiskViewQuery.graphql.ts
+++ b/apps/console/src/pages/organizations/risks/__generated__/ShowRiskViewQuery.graphql.ts
@@ -1,5 +1,5 @@
/**
- * @generated SignedSource<>
+ * @generated SignedSource<<5d1745636bcff5f05d946bcd613463e5>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -10,7 +10,6 @@
import { ConcreteRequest } from 'relay-runtime';
export type MesureState = "IMPLEMENTED" | "IN_PROGRESS" | "NOT_APPLICABLE" | "NOT_STARTED";
-export type PolicyStatus = "ACTIVE" | "DRAFT";
export type RiskTreatment = "ACCEPTED" | "AVOIDED" | "MITIGATED" | "TRANSFERRED";
export type ShowRiskViewQuery$variables = {
riskId: string;
@@ -56,8 +55,7 @@ export type ShowRiskViewQuery$data = {
readonly node: {
readonly createdAt: string;
readonly id: string;
- readonly name: string;
- readonly status: PolicyStatus;
+ readonly title: string;
};
}>;
};
@@ -285,12 +283,11 @@ v18 = [
"plural": false,
"selections": [
(v2/*: any*/),
- (v3/*: any*/),
{
"alias": null,
"args": null,
"kind": "ScalarField",
- "name": "status",
+ "name": "title",
"storageKey": null
},
(v12/*: any*/),
@@ -517,7 +514,7 @@ return {
]
},
"params": {
- "cacheID": "05f0fe48c916ecda883f606eed0c9244",
+ "cacheID": "a88eba4c398c292d41deaddd1d77bb3b",
"id": null,
"metadata": {
"connection": [
@@ -552,11 +549,11 @@ return {
},
"name": "ShowRiskViewQuery",
"operationKind": "query",
- "text": "query ShowRiskViewQuery(\n $riskId: ID!\n) {\n node(id: $riskId) {\n __typename\n id\n ... on Risk {\n name\n description\n treatment\n owner {\n id\n fullName\n }\n inherentLikelihood\n inherentImpact\n residualLikelihood\n residualImpact\n note\n createdAt\n updatedAt\n mesures(first: 100) {\n edges {\n node {\n id\n name\n description\n category\n createdAt\n state\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n policies(first: 100) {\n edges {\n node {\n id\n name\n status\n createdAt\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n controls(first: 100) {\n edges {\n node {\n id\n referenceId\n name\n description\n createdAt\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n }\n }\n}\n"
+ "text": "query ShowRiskViewQuery(\n $riskId: ID!\n) {\n node(id: $riskId) {\n __typename\n id\n ... on Risk {\n name\n description\n treatment\n owner {\n id\n fullName\n }\n inherentLikelihood\n inherentImpact\n residualLikelihood\n residualImpact\n note\n createdAt\n updatedAt\n mesures(first: 100) {\n edges {\n node {\n id\n name\n description\n category\n createdAt\n state\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n policies(first: 100) {\n edges {\n node {\n id\n title\n createdAt\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n controls(first: 100) {\n edges {\n node {\n id\n referenceId\n name\n description\n createdAt\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n }\n }\n}\n"
}
};
})();
-(node as any).hash = "25e67618b61999a955716e937a53a470";
+(node as any).hash = "96158658ecb7c406fc969e086917c03e";
export default node;
diff --git a/pkg/coredata/entity_type_reg.go b/pkg/coredata/entity_type_reg.go
index efcac77ad..57139a7a8 100644
--- a/pkg/coredata/entity_type_reg.go
+++ b/pkg/coredata/entity_type_reg.go
@@ -31,4 +31,6 @@ const (
EmailEntityType
ControlEntityType
RiskEntityType
+ PolicyVersionEntityType
+ PolicyVersionSignatureEntityType
)
diff --git a/pkg/coredata/migrations/20250424T094500Z.sql b/pkg/coredata/migrations/20250424T094500Z.sql
new file mode 100644
index 000000000..bb11895ce
--- /dev/null
+++ b/pkg/coredata/migrations/20250424T094500Z.sql
@@ -0,0 +1,60 @@
+CREATE TABLE policy_versions (
+ id TEXT PRIMARY KEY,
+ tenant_id TEXT NOT NULL,
+ policy_id TEXT NOT NULL REFERENCES policies(id) ON DELETE CASCADE,
+ version_number INTEGER NOT NULL,
+ content TEXT NOT NULL,
+ changelog TEXT NOT NULL,
+ created_by TEXT NOT NULL,
+ status policy_status NOT NULL,
+ published_by TEXT REFERENCES peoples(id),
+ published_at TIMESTAMP WITH TIME ZONE,
+ created_at TIMESTAMP WITH TIME ZONE NOT NULL,
+ updated_at TIMESTAMP WITH TIME ZONE NOT NULL,
+ UNIQUE(policy_id, version_number)
+);
+
+INSERT INTO policy_versions (
+ id,
+ tenant_id,
+ policy_id,
+ version_number,
+ content,
+ changelog,
+ created_by,
+ status,
+ published_by,
+ published_at,
+ created_at,
+ updated_at
+)
+SELECT
+ generate_gid(decode_base64_unpadded(p.tenant_id), 16),
+ p.tenant_id,
+ p.id,
+ 1,
+ '',
+ 'Initial version',
+ p.owner_id,
+ 'DRAFT',
+ NULL,
+ NULL,
+ p.created_at,
+ p.updated_at
+FROM policies p;
+
+ALTER TABLE policies RENAME COLUMN name TO title;
+ALTER TABLE policies DROP COLUMN content;
+ALTER TABLE policies ADD COLUMN description TEXT NOT NULL DEFAULT '';
+ALTER TABLE policies ALTER COLUMN owner_id DROP NOT NULL;
+ALTER TABLE policies DROP COLUMN review_date;
+ALTER TABLE policies DROP COLUMN status;
+ALTER TABLE policies ADD COLUMN current_published_version INTEGER;
+
+UPDATE policies p
+SET current_published_version = 1
+WHERE EXISTS (
+ SELECT 1 FROM policy_versions pv
+ WHERE pv.policy_id = p.id
+ AND pv.status = 'published'
+);
diff --git a/pkg/coredata/migrations/20250425T012700Z.sql b/pkg/coredata/migrations/20250425T012700Z.sql
new file mode 100644
index 000000000..49b96d923
--- /dev/null
+++ b/pkg/coredata/migrations/20250425T012700Z.sql
@@ -0,0 +1,22 @@
+CREATE TYPE policy_status_new AS ENUM ('DRAFT', 'PUBLISHED');
+
+ALTER TABLE policy_versions ADD COLUMN temp_status TEXT;
+
+UPDATE policy_versions SET temp_status =
+ CASE WHEN status::TEXT = 'ACTIVE' THEN 'PUBLISHED'
+ ELSE status::TEXT
+ END;
+
+ALTER TABLE policy_versions DROP COLUMN status;
+
+ALTER TABLE policy_versions ADD COLUMN status policy_status_new;
+
+UPDATE policy_versions SET status = temp_status::policy_status_new;
+
+ALTER TABLE policy_versions DROP COLUMN temp_status;
+
+DROP TYPE policy_status;
+ALTER TYPE policy_status_new RENAME TO policy_status;
+
+CREATE UNIQUE INDEX policy_one_draft_version_idx ON policy_versions (policy_id, status)
+WHERE status = 'DRAFT';
diff --git a/pkg/coredata/migrations/20250428T024800Z.sql b/pkg/coredata/migrations/20250428T024800Z.sql
new file mode 100644
index 000000000..73ab43fc2
--- /dev/null
+++ b/pkg/coredata/migrations/20250428T024800Z.sql
@@ -0,0 +1,15 @@
+CREATE TYPE policy_version_signature_state AS ENUM ('REQUESTED', 'SIGNED');
+
+CREATE TABLE policy_version_signatures (
+ id TEXT PRIMARY KEY,
+ tenant_id TEXT NOT NULL,
+ policy_version_id TEXT NOT NULL REFERENCES policy_versions(id) ON DELETE CASCADE,
+ state policy_version_signature_state NOT NULL,
+ signed_by TEXT NOT NULL REFERENCES peoples(id),
+ signed_at TIMESTAMP WITH TIME ZONE,
+ requested_at TIMESTAMP WITH TIME ZONE NOT NULL,
+ requested_by TEXT NOT NULL REFERENCES peoples(id),
+ created_at TIMESTAMP WITH TIME ZONE NOT NULL,
+ updated_at TIMESTAMP WITH TIME ZONE NOT NULL,
+ UNIQUE (policy_version_id, signed_by)
+);
diff --git a/pkg/coredata/people.go b/pkg/coredata/people.go
index 0c42cc907..a5ded78da 100644
--- a/pkg/coredata/people.go
+++ b/pkg/coredata/people.go
@@ -102,7 +102,6 @@ func (p *People) LoadByUserID(
ctx context.Context,
conn pg.Conn,
scope Scoper,
- organizationID gid.GID,
userID gid.GID,
) error {
q := `
@@ -120,14 +119,13 @@ FROM
peoples
WHERE
%s
- AND organization_id = @organization_id
AND user_id = @user_id
LIMIT 1;
`
q = fmt.Sprintf(q, scope.SQLFragment())
- args := pgx.StrictNamedArgs{"organization_id": organizationID, "user_id": userID}
+ args := pgx.StrictNamedArgs{"user_id": userID}
maps.Copy(args, scope.SQLArguments())
rows, err := conn.Query(ctx, q, args)
diff --git a/pkg/coredata/policy.go b/pkg/coredata/policy.go
index 11383faa0..5afffcd92 100644
--- a/pkg/coredata/policy.go
+++ b/pkg/coredata/policy.go
@@ -1,3 +1,17 @@
+// Copyright (c) 2025 Probo Inc .
+//
+// Permission to use, copy, modify, and/or distribute this software for any
+// purpose with or without fee is hereby granted, provided that the above
+// copyright notice and this permission notice appear in all copies.
+//
+// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
+// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+// AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
+// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+// PERFORMANCE OF THIS SOFTWARE.
+
package coredata
import (
@@ -14,15 +28,13 @@ import (
type (
Policy struct {
- ID gid.GID `db:"id"`
- OrganizationID gid.GID `db:"organization_id"`
- OwnerID gid.GID `db:"owner_id"`
- Status PolicyStatus `db:"status"`
- Name string `db:"name"`
- Content string `db:"content"`
- ReviewDate *time.Time `db:"review_date"`
- CreatedAt time.Time `db:"created_at"`
- UpdatedAt time.Time `db:"updated_at"`
+ ID gid.GID `db:"id"`
+ OrganizationID gid.GID `db:"organization_id"`
+ OwnerID gid.GID `db:"owner_id"`
+ Title string `db:"title"`
+ CurrentPublishedVersion *int `db:"current_published_version"`
+ CreatedAt time.Time `db:"created_at"`
+ UpdatedAt time.Time `db:"updated_at"`
}
Policies []*Policy
@@ -32,8 +44,8 @@ func (p Policy) CursorKey(orderBy PolicyOrderField) page.CursorKey {
switch orderBy {
case PolicyOrderFieldCreatedAt:
return page.NewCursorKey(p.ID, p.CreatedAt)
- case PolicyOrderFieldName:
- return page.NewCursorKey(p.ID, p.Name)
+ case PolicyOrderFieldTitle:
+ return page.NewCursorKey(p.ID, p.Title)
}
panic(fmt.Sprintf("unsupported order by: %s", orderBy))
@@ -50,10 +62,8 @@ SELECT
id,
organization_id,
owner_id,
- name,
- status,
- content,
- review_date,
+ title,
+ current_published_version,
created_at,
updated_at
FROM
@@ -93,13 +103,11 @@ func (p *Policies) LoadByOrganizationID(
) error {
q := `
SELECT
- id,
+ id,
organization_id,
owner_id,
- name,
- status,
- content,
- review_date,
+ title,
+ current_published_version,
created_at,
updated_at
FROM
@@ -140,41 +148,35 @@ func (p Policy) Insert(
INSERT INTO
policies (
tenant_id,
- id,
- organization_id,
- owner_id,
- name,
- status,
- content,
- review_date,
- created_at,
- updated_at
+ id,
+ organization_id,
+ owner_id,
+ title,
+ current_published_version,
+ created_at,
+ updated_at
)
VALUES (
@tenant_id,
@policy_id,
@organization_id,
@owner_id,
- @name,
- @status,
- @content,
- @review_date,
+ @title,
+ @current_published_version,
@created_at,
@updated_at
);
`
args := pgx.StrictNamedArgs{
- "tenant_id": scope.GetTenantID(),
- "policy_id": p.ID,
- "organization_id": p.OrganizationID,
- "owner_id": p.OwnerID,
- "name": p.Name,
- "status": p.Status,
- "content": p.Content,
- "review_date": p.ReviewDate,
- "created_at": p.CreatedAt,
- "updated_at": p.UpdatedAt,
+ "tenant_id": scope.GetTenantID(),
+ "policy_id": p.ID,
+ "organization_id": p.OrganizationID,
+ "owner_id": p.OwnerID,
+ "title": p.Title,
+ "current_published_version": p.CurrentPublishedVersion,
+ "created_at": p.CreatedAt,
+ "updated_at": p.UpdatedAt,
}
_, err := conn.Exec(ctx, q, args)
return err
@@ -207,10 +209,8 @@ func (p *Policy) Update(
UPDATE
policies
SET
- name = @name,
- status = @status,
- content = @content,
- review_date = @review_date,
+ title = @title,
+ current_published_version = @current_published_version,
owner_id = @owner_id,
updated_at = @updated_at
WHERE %s
@@ -219,13 +219,11 @@ WHERE %s
q = fmt.Sprintf(q, scope.SQLFragment())
args := pgx.StrictNamedArgs{
- "policy_id": p.ID,
- "updated_at": time.Now(),
- "name": p.Name,
- "content": p.Content,
- "status": p.Status,
- "review_date": p.ReviewDate,
- "owner_id": p.OwnerID,
+ "policy_id": p.ID,
+ "updated_at": time.Now(),
+ "title": p.Title,
+ "current_published_version": p.CurrentPublishedVersion,
+ "owner_id": p.OwnerID,
}
maps.Copy(args, scope.SQLArguments())
@@ -251,10 +249,8 @@ WITH plcs AS (
p.tenant_id,
p.organization_id,
p.owner_id,
- p.name,
- p.content,
- p.status,
- p.review_date,
+ p.title,
+ p.current_published_version,
p.created_at,
p.updated_at
FROM
@@ -268,10 +264,8 @@ SELECT
id,
organization_id,
owner_id,
- name,
- content,
- status,
- review_date,
+ title,
+ current_published_version,
created_at,
updated_at
FROM
@@ -314,10 +308,8 @@ WITH plcs AS (
p.tenant_id,
p.organization_id,
p.owner_id,
- p.name,
- p.content,
- p.status,
- p.review_date,
+ p.title,
+ p.current_published_version,
p.created_at,
p.updated_at
FROM
@@ -331,10 +323,8 @@ SELECT
id,
organization_id,
owner_id,
- name,
- content,
- status,
- review_date,
+ title,
+ current_published_version,
created_at,
updated_at
FROM
diff --git a/pkg/coredata/policy_order_field.go b/pkg/coredata/policy_order_field.go
index a52686b20..d52a6442d 100644
--- a/pkg/coredata/policy_order_field.go
+++ b/pkg/coredata/policy_order_field.go
@@ -20,7 +20,7 @@ type (
const (
PolicyOrderFieldCreatedAt PolicyOrderField = "CREATED_AT"
- PolicyOrderFieldName PolicyOrderField = "NAME"
+ PolicyOrderFieldTitle PolicyOrderField = "TITLE"
)
func (p PolicyOrderField) Column() string {
diff --git a/pkg/coredata/policy_status.go b/pkg/coredata/policy_status.go
index ab8e19345..5f1bc5d05 100644
--- a/pkg/coredata/policy_status.go
+++ b/pkg/coredata/policy_status.go
@@ -25,7 +25,7 @@ type (
const (
PolicyStatusDraft PolicyStatus = iota
- PolicyStatusActive
+ PolicyStatusPublished
)
func (ps PolicyStatus) MarshalText() ([]byte, error) {
@@ -38,8 +38,8 @@ func (ps *PolicyStatus) UnmarshalText(data []byte) error {
switch val {
case PolicyStatusDraft.String():
*ps = PolicyStatusDraft
- case PolicyStatusActive.String():
- *ps = PolicyStatusActive
+ case PolicyStatusPublished.String():
+ *ps = PolicyStatusPublished
default:
return fmt.Errorf("invalid PolicyStatus value: %q", val)
}
@@ -53,8 +53,8 @@ func (ps PolicyStatus) String() string {
switch ps {
case PolicyStatusDraft:
val = "DRAFT"
- case PolicyStatusActive:
- val = "ACTIVE"
+ case PolicyStatusPublished:
+ val = "PUBLISHED"
}
return val
diff --git a/pkg/coredata/policy_version.go b/pkg/coredata/policy_version.go
new file mode 100644
index 000000000..3dd99169f
--- /dev/null
+++ b/pkg/coredata/policy_version.go
@@ -0,0 +1,344 @@
+// Copyright (c) 2025 Probo Inc .
+//
+// Permission to use, copy, modify, and/or distribute this software for any
+// purpose with or without fee is hereby granted, provided that the above
+// copyright notice and this permission notice appear in all copies.
+//
+// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
+// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+// AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
+// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+// PERFORMANCE OF THIS SOFTWARE.
+
+package coredata
+
+import (
+ "context"
+ "fmt"
+ "maps"
+ "time"
+
+ "github.com/getprobo/probo/pkg/gid"
+ "github.com/getprobo/probo/pkg/page"
+ "github.com/jackc/pgx/v5"
+ "go.gearno.de/kit/pg"
+)
+
+type (
+ PolicyVersion struct {
+ ID gid.GID `db:"id"`
+ PolicyID gid.GID `db:"policy_id"`
+ VersionNumber int `db:"version_number"`
+ Content string `db:"content"`
+ Changelog string `db:"changelog"`
+ CreatedBy gid.GID `db:"created_by"`
+ Status PolicyStatus `db:"status"`
+ PublishedBy *gid.GID `db:"published_by"`
+ PublishedAt *time.Time `db:"published_at"`
+ CreatedAt time.Time `db:"created_at"`
+ UpdatedAt time.Time `db:"updated_at"`
+ }
+
+ PolicyVersions []*PolicyVersion
+)
+
+func (p *PolicyVersions) LoadByPolicyID(
+ ctx context.Context,
+ conn pg.Conn,
+ scope Scoper,
+ policyID gid.GID,
+ cursor *page.Cursor[PolicyVersionOrderField],
+) error {
+ q := `
+SELECT
+ id,
+ policy_id,
+ version_number,
+ content,
+ changelog,
+ created_by,
+ status,
+ published_by,
+ published_at,
+ created_at,
+ updated_at
+FROM
+ policy_versions
+WHERE
+ %s
+ AND policy_id = @policy_id
+ AND %s
+`
+
+ q = fmt.Sprintf(q, scope.SQLFragment(), cursor.SQLFragment())
+
+ args := pgx.StrictNamedArgs{"policy_id": policyID}
+ maps.Copy(args, scope.SQLArguments())
+ maps.Copy(args, cursor.SQLArguments())
+
+ rows, err := conn.Query(ctx, q, args)
+ if err != nil {
+ return fmt.Errorf("cannot query policy versions: %w", err)
+ }
+
+ policyVersions, err := pgx.CollectRows(rows, pgx.RowToAddrOfStructByName[PolicyVersion])
+ if err != nil {
+ return fmt.Errorf("cannot collect policy versions: %w", err)
+ }
+
+ *p = policyVersions
+
+ return nil
+}
+
+func (p PolicyVersion) CursorKey(orderBy PolicyVersionOrderField) page.CursorKey {
+ switch orderBy {
+ case PolicyVersionOrderFieldCreatedAt:
+ return page.NewCursorKey(p.ID, p.CreatedAt)
+ }
+
+ panic(fmt.Sprintf("unsupported order by: %s", orderBy))
+}
+
+func (p *PolicyVersion) LoadByID(
+ ctx context.Context,
+ conn pg.Conn,
+ scope Scoper,
+ policyVersionID gid.GID,
+) error {
+ q := `
+SELECT
+ id,
+ policy_id,
+ version_number,
+ content,
+ changelog,
+ created_by,
+ status,
+ published_by,
+ published_at,
+ created_at,
+ updated_at
+FROM
+ policy_versions
+WHERE
+ %s
+ AND id = @policy_version_id
+LIMIT 1;
+`
+
+ q = fmt.Sprintf(q, scope.SQLFragment())
+
+ args := pgx.StrictNamedArgs{"policy_version_id": policyVersionID}
+ maps.Copy(args, scope.SQLArguments())
+
+ rows, err := conn.Query(ctx, q, args)
+ if err != nil {
+ return fmt.Errorf("cannot query policy versions: %w", err)
+ }
+
+ policyVersion, err := pgx.CollectExactlyOneRow(rows, pgx.RowToStructByName[PolicyVersion])
+ if err != nil {
+ return fmt.Errorf("cannot collect policy version: %w", err)
+ }
+
+ *p = policyVersion
+
+ return nil
+}
+
+func (p PolicyVersion) Insert(
+ ctx context.Context,
+ conn pg.Conn,
+ scope Scoper,
+) error {
+ q := `
+INSERT INTO policy_versions (
+ tenant_id,
+ id,
+ policy_id,
+ version_number,
+ content,
+ changelog,
+ created_by,
+ status,
+ created_at,
+ updated_at
+) VALUES (
+ @tenant_id,
+ @id,
+ @policy_id,
+ @version_number,
+ @content,
+ @changelog,
+ @created_by,
+ @status,
+ @created_at,
+ @updated_at
+)
+`
+
+ now := time.Now()
+ args := pgx.StrictNamedArgs{
+ "tenant_id": scope.GetTenantID(),
+ "id": p.ID,
+ "policy_id": p.PolicyID,
+ "version_number": p.VersionNumber,
+ "content": p.Content,
+ "changelog": p.Changelog,
+ "created_by": p.CreatedBy,
+ "status": PolicyStatusDraft,
+ "created_at": now,
+ "updated_at": now,
+ }
+
+ _, err := conn.Exec(ctx, q, args)
+ if err != nil {
+ return fmt.Errorf("error creating/updating policy version: %w", err)
+ }
+
+ return nil
+}
+
+func (p *PolicyVersion) LoadByPolicyIDAndVersionNumber(
+ ctx context.Context,
+ conn pg.Conn,
+ scope Scoper,
+ policyID gid.GID,
+ versionNumber int,
+) error {
+ q := `
+SELECT
+ id,
+ policy_id,
+ version_number,
+ content,
+ changelog,
+ created_by,
+ status,
+ published_by,
+ published_at,
+ created_at,
+ updated_at
+FROM
+ policy_versions
+WHERE
+ %s
+ AND policy_id = @policy_id
+ AND version_number = @version_number
+LIMIT 1;
+`
+
+ q = fmt.Sprintf(q, scope.SQLFragment())
+
+ args := pgx.StrictNamedArgs{
+ "policy_id": policyID,
+ "version_number": versionNumber,
+ }
+
+ maps.Copy(args, scope.SQLArguments())
+
+ rows, err := conn.Query(ctx, q, args)
+ if err != nil {
+ return fmt.Errorf("cannot query policy versions: %w", err)
+ }
+
+ policyVersion, err := pgx.CollectExactlyOneRow(rows, pgx.RowToStructByName[PolicyVersion])
+ if err != nil {
+ return fmt.Errorf("cannot collect policy version: %w", err)
+ }
+
+ *p = policyVersion
+
+ return nil
+}
+
+func (p *PolicyVersion) LoadLatestVersion(
+ ctx context.Context,
+ conn pg.Conn,
+ scope Scoper,
+ policyID gid.GID,
+) error {
+ q := `
+SELECT
+ id,
+ policy_id,
+ version_number,
+ content,
+ changelog,
+ created_by,
+ status,
+ published_by,
+ published_at,
+ created_at,
+ updated_at
+FROM
+ policy_versions
+WHERE
+ %s
+ AND policy_id = @policy_id
+ORDER BY created_at DESC
+LIMIT 1;
+`
+
+ q = fmt.Sprintf(q, scope.SQLFragment())
+
+ args := pgx.StrictNamedArgs{
+ "policy_id": policyID,
+ }
+
+ maps.Copy(args, scope.SQLArguments())
+
+ rows, err := conn.Query(ctx, q, args)
+ if err != nil {
+ return fmt.Errorf("cannot query policy versions: %w", err)
+ }
+
+ policyVersion, err := pgx.CollectExactlyOneRow(rows, pgx.RowToStructByName[PolicyVersion])
+ if err != nil {
+ return fmt.Errorf("cannot collect policy version: %w", err)
+ }
+
+ *p = policyVersion
+
+ return nil
+}
+
+func (p PolicyVersion) Update(
+ ctx context.Context,
+ conn pg.Conn,
+ scope Scoper,
+) error {
+ q := `
+UPDATE policy_versions SET
+ changelog = @changelog,
+ status = @status,
+ content = @content,
+ published_by = @published_by,
+ published_at = @published_at,
+ updated_at = @updated_at
+WHERE %s
+ AND id = @policy_version_id;`
+
+ q = fmt.Sprintf(q, scope.SQLFragment())
+
+ args := pgx.StrictNamedArgs{
+ "policy_version_id": p.ID,
+ "changelog": p.Changelog,
+ "status": p.Status,
+ "content": p.Content,
+ "published_by": p.PublishedBy,
+ "published_at": p.PublishedAt,
+ "updated_at": p.UpdatedAt,
+ }
+ maps.Copy(args, scope.SQLArguments())
+
+ _, err := conn.Exec(ctx, q, args)
+ if err != nil {
+ return fmt.Errorf("cannot update policy version: %w", err)
+ }
+
+ return nil
+}
diff --git a/pkg/coredata/policy_version_order_field.go b/pkg/coredata/policy_version_order_field.go
new file mode 100644
index 000000000..b9267819a
--- /dev/null
+++ b/pkg/coredata/policy_version_order_field.go
@@ -0,0 +1,41 @@
+// Copyright (c) 2025 Probo Inc .
+//
+// Permission to use, copy, modify, and/or distribute this software for any
+// purpose with or without fee is hereby granted, provided that the above
+// copyright notice and this permission notice appear in all copies.
+//
+// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
+// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+// AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
+// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+// PERFORMANCE OF THIS SOFTWARE.
+
+package coredata
+
+type (
+ PolicyVersionOrderField string
+)
+
+const (
+ PolicyVersionOrderFieldCreatedAt PolicyVersionOrderField = "CREATED_AT"
+ PolicyVersionOrderFieldVersion PolicyVersionOrderField = "VERSION"
+)
+
+func (p PolicyVersionOrderField) Column() string {
+ return string(p)
+}
+
+func (p PolicyVersionOrderField) String() string {
+ return string(p)
+}
+
+func (p PolicyVersionOrderField) MarshalText() ([]byte, error) {
+ return []byte(p.String()), nil
+}
+
+func (p *PolicyVersionOrderField) UnmarshalText(text []byte) error {
+ *p = PolicyVersionOrderField(text)
+ return nil
+}
diff --git a/pkg/coredata/policy_version_signature.go b/pkg/coredata/policy_version_signature.go
new file mode 100644
index 000000000..43f896989
--- /dev/null
+++ b/pkg/coredata/policy_version_signature.go
@@ -0,0 +1,197 @@
+// Copyright (c) 2025 Probo Inc .
+//
+// Permission to use, copy, modify, and/or distribute this software for any
+// purpose with or without fee is hereby granted, provided that the above
+// copyright notice and this permission notice appear in all copies.
+//
+// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
+// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+// AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
+// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+// PERFORMANCE OF THIS SOFTWARE.
+
+package coredata
+
+import (
+ "context"
+ "fmt"
+ "maps"
+ "time"
+
+ "github.com/getprobo/probo/pkg/gid"
+ "github.com/getprobo/probo/pkg/page"
+ "github.com/jackc/pgx/v5"
+ "go.gearno.de/kit/pg"
+)
+
+type (
+ PolicyVersionSignature struct {
+ ID gid.GID `json:"id"`
+ PolicyVersionID gid.GID `json:"policy_version_id"`
+ State PolicyVersionSignatureState `json:"state"`
+ SignedBy gid.GID `json:"signed_by"`
+ SignedAt *time.Time `json:"signed_at"`
+ RequestedAt time.Time `json:"requested_at"`
+ RequestedBy gid.GID `json:"requested_by"`
+ CreatedAt time.Time `json:"created_at"`
+ UpdatedAt time.Time `json:"updated_at"`
+ }
+
+ PolicyVersionSignatures []*PolicyVersionSignature
+)
+
+func (pvs PolicyVersionSignature) CursorKey(orderBy PolicyVersionSignatureOrderField) page.CursorKey {
+ switch orderBy {
+ case PolicyVersionSignatureOrderFieldCreatedAt:
+ return page.NewCursorKey(pvs.ID, pvs.CreatedAt)
+ case PolicyVersionSignatureOrderFieldSignedAt:
+ return page.NewCursorKey(pvs.ID, pvs.SignedAt)
+ }
+
+ panic(fmt.Sprintf("unsupported order by: %s", orderBy))
+}
+
+func (pvs *PolicyVersionSignature) LoadByID(
+ ctx context.Context,
+ conn pg.Conn,
+ scope Scoper,
+ signatureID gid.GID,
+) error {
+ q := `
+SELECT
+ id,
+ policy_version_id,
+ state,
+ signed_by,
+ signed_at,
+ requested_at,
+ requested_by,
+ created_at,
+ updated_at
+FROM
+ policy_version_signatures
+WHERE
+ id = @policy_version_signature_id
+ AND %s
+`
+
+ q = fmt.Sprintf(q, scope.SQLFragment())
+
+ args := pgx.StrictNamedArgs{"policy_version_signature_id": signatureID}
+ maps.Copy(args, scope.SQLArguments())
+
+ rows, err := conn.Query(ctx, q, args)
+ if err != nil {
+ return fmt.Errorf("cannot query policy version signature: %w", err)
+ }
+
+ policyVersionSignature, err := pgx.CollectOneRow(rows, pgx.RowToStructByName[PolicyVersionSignature])
+ if err != nil {
+ return fmt.Errorf("cannot collect policy version signature: %w", err)
+ }
+
+ *pvs = policyVersionSignature
+
+ return nil
+}
+
+func (pvs PolicyVersionSignature) Insert(
+ ctx context.Context,
+ conn pg.Conn,
+ scope Scoper,
+) error {
+ q := `
+INSERT INTO policy_version_signatures (
+ id,
+ tenant_id,
+ policy_version_id,
+ state,
+ signed_by,
+ signed_at,
+ requested_at,
+ requested_by,
+ created_at,
+ updated_at
+) VALUES (
+ @id,
+ @tenant_id,
+ @policy_version_id,
+ @state,
+ @signed_by,
+ @signed_at,
+ @requested_at,
+ @requested_by,
+ @created_at,
+ @updated_at
+)
+`
+
+ args := pgx.StrictNamedArgs{
+ "id": pvs.ID,
+ "tenant_id": scope.GetTenantID(),
+ "policy_version_id": pvs.PolicyVersionID,
+ "state": pvs.State,
+ "signed_by": pvs.SignedBy,
+ "signed_at": pvs.SignedAt,
+ "requested_at": pvs.RequestedAt,
+ "requested_by": pvs.RequestedBy,
+ "created_at": pvs.CreatedAt,
+ "updated_at": pvs.UpdatedAt,
+ }
+
+ _, err := conn.Exec(ctx, q, args)
+ if err != nil {
+ return fmt.Errorf("cannot insert policy version signature: %w", err)
+ }
+
+ return nil
+}
+
+func (pvss *PolicyVersionSignatures) LoadByPolicyVersionID(
+ ctx context.Context,
+ conn pg.Conn,
+ scope Scoper,
+ policyVersionID gid.GID,
+ cursor *page.Cursor[PolicyVersionSignatureOrderField],
+) error {
+ q := `
+SELECT
+ id,
+ policy_version_id,
+ state,
+ signed_by,
+ signed_at,
+ requested_at,
+ requested_by,
+ created_at,
+ updated_at
+FROM
+ policy_version_signatures
+WHERE
+ %s
+ AND policy_version_id = @policy_version_id
+ AND %s
+`
+
+ q = fmt.Sprintf(q, scope.SQLFragment(), cursor.SQLFragment())
+
+ args := pgx.StrictNamedArgs{"policy_version_id": policyVersionID}
+ maps.Copy(args, scope.SQLArguments())
+ maps.Copy(args, cursor.SQLArguments())
+
+ rows, err := conn.Query(ctx, q, args)
+ if err != nil {
+ return fmt.Errorf("cannot query policy version signatures: %w", err)
+ }
+
+ policyVersionSignatures, err := pgx.CollectRows(rows, pgx.RowToAddrOfStructByName[PolicyVersionSignature])
+ if err != nil {
+ return fmt.Errorf("cannot collect policy version signatures: %w", err)
+ }
+
+ *pvss = policyVersionSignatures
+
+ return nil
+}
diff --git a/pkg/coredata/policy_version_signature_order_field.go b/pkg/coredata/policy_version_signature_order_field.go
new file mode 100644
index 000000000..3a986e64a
--- /dev/null
+++ b/pkg/coredata/policy_version_signature_order_field.go
@@ -0,0 +1,41 @@
+// Copyright (c) 2025 Probo Inc .
+//
+// Permission to use, copy, modify, and/or distribute this software for any
+// purpose with or without fee is hereby granted, provided that the above
+// copyright notice and this permission notice appear in all copies.
+//
+// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
+// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+// AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
+// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+// PERFORMANCE OF THIS SOFTWARE.
+
+package coredata
+
+type (
+ PolicyVersionSignatureOrderField string
+)
+
+const (
+ PolicyVersionSignatureOrderFieldCreatedAt PolicyVersionSignatureOrderField = "CREATED_AT"
+ PolicyVersionSignatureOrderFieldSignedAt PolicyVersionSignatureOrderField = "SIGNED_AT"
+)
+
+func (p PolicyVersionSignatureOrderField) Column() string {
+ return string(p)
+}
+
+func (p PolicyVersionSignatureOrderField) String() string {
+ return string(p)
+}
+
+func (p PolicyVersionSignatureOrderField) MarshalText() ([]byte, error) {
+ return []byte(p.String()), nil
+}
+
+func (p *PolicyVersionSignatureOrderField) UnmarshalText(text []byte) error {
+ *p = PolicyVersionSignatureOrderField(text)
+ return nil
+}
diff --git a/pkg/coredata/policy_version_signature_state.go b/pkg/coredata/policy_version_signature_state.go
new file mode 100644
index 000000000..db3ddd63e
--- /dev/null
+++ b/pkg/coredata/policy_version_signature_state.go
@@ -0,0 +1,74 @@
+// Copyright (c) 2025 Probo Inc .
+//
+// Permission to use, copy, modify, and/or distribute this software for any
+// purpose with or without fee is hereby granted, provided that the above
+// copyright notice and this permission notice appear in all copies.
+//
+// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
+// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+// AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
+// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+// PERFORMANCE OF THIS SOFTWARE.
+
+package coredata
+
+import (
+ "database/sql/driver"
+ "fmt"
+)
+
+type (
+ PolicyVersionSignatureState string
+)
+
+const (
+ PolicyVersionSignatureStateRequested PolicyVersionSignatureState = "REQUESTED"
+ PolicyVersionSignatureStateSigned PolicyVersionSignatureState = "SIGNED"
+)
+
+func (pvs PolicyVersionSignatureState) MarshalText() ([]byte, error) {
+ return []byte(pvs.String()), nil
+}
+
+func (pvs *PolicyVersionSignatureState) UnmarshalText(data []byte) error {
+ val := string(data)
+
+ switch val {
+ case PolicyVersionSignatureStateRequested.String():
+ *pvs = PolicyVersionSignatureStateRequested
+ case PolicyVersionSignatureStateSigned.String():
+ *pvs = PolicyVersionSignatureStateSigned
+ default:
+ return fmt.Errorf("invalid MesureState value: %q", val)
+ }
+
+ return nil
+}
+
+func (pvs PolicyVersionSignatureState) String() string {
+ var val string
+
+ switch pvs {
+ case PolicyVersionSignatureStateRequested:
+ val = "REQUESTED"
+ case PolicyVersionSignatureStateSigned:
+ val = "SIGNED"
+ }
+
+ return val
+}
+
+func (pvs *PolicyVersionSignatureState) Scan(value any) error {
+ val, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("invalid scan source for MesureState, expected string got %T", value)
+ }
+
+ return pvs.UnmarshalText([]byte(val))
+}
+
+func (pvs PolicyVersionSignatureState) Value() (driver.Value, error) {
+ return pvs.String(), nil
+}
diff --git a/pkg/probo/people_service.go b/pkg/probo/people_service.go
index 03cdd4e45..bb7bddff6 100644
--- a/pkg/probo/people_service.go
+++ b/pkg/probo/people_service.go
@@ -71,7 +71,6 @@ func (s PeopleService) Get(
func (s PeopleService) GetByUserID(
ctx context.Context,
- organizationID gid.GID,
userID gid.GID,
) (*coredata.People, error) {
people := &coredata.People{}
@@ -79,7 +78,7 @@ func (s PeopleService) GetByUserID(
err := s.svc.pg.WithConn(
ctx,
func(conn pg.Conn) error {
- return people.LoadByUserID(ctx, conn, s.svc.scope, organizationID, userID)
+ return people.LoadByUserID(ctx, conn, s.svc.scope, userID)
},
)
diff --git a/pkg/probo/policy_service.go b/pkg/probo/policy_service.go
index d4d69d771..ddc43853c 100644
--- a/pkg/probo/policy_service.go
+++ b/pkg/probo/policy_service.go
@@ -18,21 +18,21 @@ type PolicyService struct {
type (
CreatePolicyRequest struct {
OrganizationID gid.GID
- Name string
- Status coredata.PolicyStatus
+ Title string
Content string
- ReviewDate *time.Time
OwnerID gid.GID
+ CreatedBy gid.GID
}
- UpdatePolicyRequest struct {
- ID gid.GID
- ExpectedVersion int
- Name *string
- Content *string
- Status *coredata.PolicyStatus
- ReviewDate *time.Time
- OwnerID *gid.GID
+ UpdatePolicyVersionRequest struct {
+ ID gid.GID
+ Content string
+ }
+
+ RequestSignatureRequest struct {
+ PolicyVersionID gid.GID
+ RequestedBy gid.GID
+ Signatory gid.GID
}
)
@@ -56,38 +56,203 @@ func (s *PolicyService) Get(
return policy, nil
}
+func (s *PolicyService) PublishVersion(
+ ctx context.Context,
+ policyID gid.GID,
+ publishedBy gid.GID,
+) (*coredata.Policy, *coredata.PolicyVersion, error) {
+ policy := &coredata.Policy{}
+ policyVersion := &coredata.PolicyVersion{}
+ now := time.Now()
+
+ err := s.svc.pg.WithTx(
+ ctx,
+ func(tx pg.Conn) error {
+ if err := policy.LoadByID(ctx, tx, s.svc.scope, policyID); err != nil {
+ return fmt.Errorf("cannot load policy %q: %w", policyID, err)
+ }
+
+ if err := policyVersion.LoadLatestVersion(ctx, tx, s.svc.scope, policyID); err != nil {
+ return fmt.Errorf("cannot load current draft: %w", err)
+ }
+
+ if policyVersion.Status != coredata.PolicyStatusDraft {
+ return fmt.Errorf("cannot publish version")
+ }
+
+ policy.CurrentPublishedVersion = &policyVersion.VersionNumber
+ policy.UpdatedAt = now
+
+ policyVersion.Status = coredata.PolicyStatusPublished
+ policyVersion.PublishedAt = &now
+ policyVersion.PublishedBy = &publishedBy
+ policyVersion.UpdatedAt = now
+
+ if err := policy.Update(ctx, tx, s.svc.scope); err != nil {
+ return fmt.Errorf("cannot update policy: %w", err)
+ }
+
+ if err := policyVersion.Update(ctx, tx, s.svc.scope); err != nil {
+ return fmt.Errorf("cannot update policy version: %w", err)
+ }
+
+ return nil
+ },
+ )
+
+ if err != nil {
+ return nil, nil, err
+ }
+
+ return policy, policyVersion, nil
+}
+
func (s *PolicyService) Create(
ctx context.Context,
req CreatePolicyRequest,
-) (*coredata.Policy, error) {
+) (*coredata.Policy, *coredata.PolicyVersion, error) {
now := time.Now()
policyID, err := gid.NewGID(s.svc.scope.GetTenantID(), coredata.PolicyEntityType)
if err != nil {
- return nil, fmt.Errorf("cannot create policy global id: %w", err)
+ return nil, nil, fmt.Errorf("cannot create policy global id: %w", err)
+ }
+
+ policyVersionID, err := gid.NewGID(s.svc.scope.GetTenantID(), coredata.PolicyVersionEntityType)
+ if err != nil {
+ return nil, nil, fmt.Errorf("cannot create policy version global id: %w", err)
}
- organization := &coredata.Organization{}
policy := &coredata.Policy{
ID: policyID,
OrganizationID: req.OrganizationID,
OwnerID: req.OwnerID,
- Name: req.Name,
- Content: req.Content,
- Status: req.Status,
- ReviewDate: req.ReviewDate,
+ Title: req.Title,
CreatedAt: now,
UpdatedAt: now,
}
+ policyVersion := &coredata.PolicyVersion{
+ ID: policyVersionID,
+ PolicyID: policyID,
+ VersionNumber: 1,
+ Content: req.Content,
+ CreatedBy: req.CreatedBy,
+ CreatedAt: now,
+ UpdatedAt: now,
+ }
+ err = s.svc.pg.WithTx(
+ ctx,
+ func(conn pg.Conn) error {
+ if err := policy.Insert(ctx, conn, s.svc.scope); err != nil {
+ return fmt.Errorf("cannot insert policy: %w", err)
+ }
+
+ if err := policyVersion.Update(ctx, conn, s.svc.scope); err != nil {
+ return fmt.Errorf("cannot create policy version: %w", err)
+ }
+
+ return nil
+ },
+ )
+
+ if err != nil {
+ return nil, nil, err
+ }
+
+ return policy, policyVersion, nil
+}
+
+func (s *PolicyService) UpdateVersion(
+ ctx context.Context,
+ req UpdatePolicyVersionRequest,
+) (*coredata.PolicyVersion, error) {
+ policyVersion := &coredata.PolicyVersion{}
+
+ err := s.svc.pg.WithTx(
+ ctx,
+ func(conn pg.Conn) error {
+ if err := policyVersion.LoadByID(ctx, conn, s.svc.scope, req.ID); err != nil {
+ return fmt.Errorf("cannot load policy version %q: %w", req.ID, err)
+ }
+
+ if policyVersion.Status != coredata.PolicyStatusDraft {
+ return fmt.Errorf("cannot update published version")
+ }
+
+ policyVersion.Content = req.Content
+ policyVersion.UpdatedAt = time.Now()
+
+ if err := policyVersion.Update(ctx, conn, s.svc.scope); err != nil {
+ return fmt.Errorf("cannot update policy version: %w", err)
+ }
+
+ return nil
+ },
+ )
+
+ if err != nil {
+ return nil, err
+ }
+
+ return policyVersion, nil
+}
+
+func (s *PolicyService) GetVersionSignature(
+ ctx context.Context,
+ signatureID gid.GID,
+) (*coredata.PolicyVersionSignature, error) {
+ policyVersionSignature := &coredata.PolicyVersionSignature{}
+
+ err := s.svc.pg.WithConn(
+ ctx,
+ func(conn pg.Conn) error {
+ return policyVersionSignature.LoadByID(ctx, conn, s.svc.scope, signatureID)
+ },
+ )
+
+ if err != nil {
+ return nil, err
+ }
+
+ return policyVersionSignature, nil
+}
+
+func (s *PolicyService) RequestSignature(
+ ctx context.Context,
+ req RequestSignatureRequest,
+) (*coredata.PolicyVersionSignature, error) {
+ policyVersionSignatureID, err := gid.NewGID(s.svc.scope.GetTenantID(), coredata.PolicyVersionSignatureEntityType)
+ if err != nil {
+ return nil, fmt.Errorf("cannot create policy version signature global id: %w", err)
+ }
+
+ policyVersion, err := s.GetVersion(ctx, req.PolicyVersionID)
+ if err != nil {
+ return nil, fmt.Errorf("cannot get policy version: %w", err)
+ }
+
+ if policyVersion.Status != coredata.PolicyStatusPublished {
+ return nil, fmt.Errorf("cannot request signature for unpublished version")
+ }
+
+ now := time.Now()
+ policyVersionSignature := &coredata.PolicyVersionSignature{
+ ID: policyVersionSignatureID,
+ PolicyVersionID: req.PolicyVersionID,
+ State: coredata.PolicyVersionSignatureStateRequested,
+ RequestedBy: req.RequestedBy,
+ RequestedAt: now,
+ SignedBy: req.Signatory,
+ SignedAt: nil,
+ CreatedAt: now,
+ UpdatedAt: now,
+ }
+
err = s.svc.pg.WithTx(
ctx,
func(conn pg.Conn) error {
- if err := organization.LoadByID(ctx, conn, s.svc.scope, req.OrganizationID); err != nil {
- return fmt.Errorf("cannot load organization %q: %w", req.OrganizationID, err)
- }
-
- if err := policy.Insert(ctx, conn, s.svc.scope); err != nil {
- return fmt.Errorf("cannot insert policy: %w", err)
+ if err := policyVersionSignature.Insert(ctx, conn, s.svc.scope); err != nil {
+ return fmt.Errorf("cannot insert policy version signature: %w", err)
}
return nil
@@ -98,54 +263,77 @@ func (s *PolicyService) Create(
return nil, err
}
- return policy, nil
+ return policyVersionSignature, nil
}
-func (s *PolicyService) Update(
+func (s *PolicyService) ListSignatures(
ctx context.Context,
- req UpdatePolicyRequest,
-) (*coredata.Policy, error) {
- policy := &coredata.Policy{}
+ policyVersionID gid.GID,
+ cursor *page.Cursor[coredata.PolicyVersionSignatureOrderField],
+) (*page.Page[*coredata.PolicyVersionSignature, coredata.PolicyVersionSignatureOrderField], error) {
+ var policyVersionSignatures coredata.PolicyVersionSignatures
- err := s.svc.pg.WithTx(
+ err := s.svc.pg.WithConn(
ctx,
func(conn pg.Conn) error {
- if err := policy.LoadByID(ctx, conn, s.svc.scope, req.ID); err != nil {
- return fmt.Errorf("cannot load policy %q: %w", req.ID, err)
+ return policyVersionSignatures.LoadByPolicyVersionID(ctx, conn, s.svc.scope, policyVersionID, cursor)
+ },
+ )
+
+ if err != nil {
+ return nil, err
+ }
+
+ return page.NewPage(policyVersionSignatures, cursor), nil
+}
+
+func (s *PolicyService) CreateDraft(
+ ctx context.Context,
+ policyID gid.GID,
+ createdBy gid.GID,
+) (*coredata.PolicyVersion, error) {
+ draftVersionID, err := gid.NewGID(s.svc.scope.GetTenantID(), coredata.PolicyVersionEntityType)
+ if err != nil {
+ return nil, fmt.Errorf("cannot create policy version global id: %w", err)
+ }
+
+ latestVersion := &coredata.PolicyVersion{}
+ draftVersion := &coredata.PolicyVersion{}
+ now := time.Now()
+
+ err = s.svc.pg.WithTx(
+ ctx,
+ func(conn pg.Conn) error {
+ if err := latestVersion.LoadLatestVersion(ctx, conn, s.svc.scope, policyID); err != nil {
+ return fmt.Errorf("cannot load latest version: %w", err)
}
- if req.Name != nil {
- policy.Name = *req.Name
+ if latestVersion.Status != coredata.PolicyStatusPublished {
+ return fmt.Errorf("cannot create draft from unpublished version")
}
- if req.Content != nil {
- policy.Content = *req.Content
- }
+ draftVersion.ID = draftVersionID
+ draftVersion.PolicyID = policyID
+ draftVersion.VersionNumber = latestVersion.VersionNumber + 1
+ draftVersion.Content = latestVersion.Content
+ draftVersion.Status = coredata.PolicyStatusDraft
+ draftVersion.CreatedBy = createdBy
+ draftVersion.CreatedAt = now
+ draftVersion.UpdatedAt = now
- if req.Status != nil {
- policy.Status = *req.Status
- }
-
- if req.ReviewDate != nil {
- policy.ReviewDate = req.ReviewDate
- }
-
- if req.OwnerID != nil {
- policy.OwnerID = *req.OwnerID
- }
-
- if err := policy.Update(ctx, conn, s.svc.scope); err != nil {
- return fmt.Errorf("cannot update policy: %w", err)
+ if err := draftVersion.Insert(ctx, conn, s.svc.scope); err != nil {
+ return fmt.Errorf("cannot create draft: %w", err)
}
return nil
},
)
+
if err != nil {
return nil, err
}
- return policy, nil
+ return draftVersion, nil
}
func (s *PolicyService) Delete(
@@ -162,6 +350,47 @@ func (s *PolicyService) Delete(
)
}
+func (s *PolicyService) ListVersions(
+ ctx context.Context,
+ policyID gid.GID,
+ cursor *page.Cursor[coredata.PolicyVersionOrderField],
+) (*page.Page[*coredata.PolicyVersion, coredata.PolicyVersionOrderField], error) {
+ var policyVersions coredata.PolicyVersions
+
+ err := s.svc.pg.WithConn(
+ ctx,
+ func(conn pg.Conn) error {
+ return policyVersions.LoadByPolicyID(ctx, conn, s.svc.scope, policyID, cursor)
+ },
+ )
+
+ if err != nil {
+ return nil, err
+ }
+
+ return page.NewPage(policyVersions, cursor), nil
+}
+
+func (s *PolicyService) GetVersion(
+ ctx context.Context,
+ policyVersionID gid.GID,
+) (*coredata.PolicyVersion, error) {
+ policyVersion := &coredata.PolicyVersion{}
+
+ err := s.svc.pg.WithConn(
+ ctx,
+ func(conn pg.Conn) error {
+ return policyVersion.LoadByID(ctx, conn, s.svc.scope, policyVersionID)
+ },
+ )
+
+ if err != nil {
+ return nil, err
+ }
+
+ return policyVersion, nil
+}
+
func (s *PolicyService) ListByOrganizationID(
ctx context.Context,
organizationID gid.GID,
diff --git a/pkg/server/api/console/v1/schema.graphql b/pkg/server/api/console/v1/schema.graphql
index ddef33d28..fca9f3081 100644
--- a/pkg/server/api/console/v1/schema.graphql
+++ b/pkg/server/api/console/v1/schema.graphql
@@ -95,8 +95,8 @@ enum PolicyStatus
@goModel(model: "github.com/getprobo/probo/pkg/coredata.PolicyStatus") {
DRAFT
@goEnum(value: "github.com/getprobo/probo/pkg/coredata.PolicyStatusDraft")
- ACTIVE
- @goEnum(value: "github.com/getprobo/probo/pkg/coredata.PolicyStatusActive")
+ PUBLISHED
+ @goEnum(value: "github.com/getprobo/probo/pkg/coredata.PolicyStatusPublished")
}
enum EvidenceType
@@ -184,7 +184,14 @@ enum TaskOrderField
enum PolicyOrderField
@goModel(model: "github.com/getprobo/probo/pkg/coredata.PolicyOrderField") {
- NAME
+ TITLE
+ @goEnum(
+ value: "github.com/getprobo/probo/pkg/coredata.PolicyOrderFieldTitle"
+ )
+ CREATED_AT
+ @goEnum(
+ value: "github.com/getprobo/probo/pkg/coredata.PolicyOrderFieldCreatedAt"
+ )
}
enum RiskOrderField
@@ -260,6 +267,18 @@ enum BusinessImpact
@goEnum(value: "github.com/getprobo/probo/pkg/coredata.BusinessImpactCritical")
}
+enum PolicyVersionOrderField
+ @goModel(model: "github.com/getprobo/probo/pkg/coredata.PolicyVersionOrderField") {
+ VERSION
+ @goEnum(
+ value: "github.com/getprobo/probo/pkg/coredata.PolicyVersionOrderFieldVersion"
+ )
+ CREATED_AT
+ @goEnum(
+ value: "github.com/getprobo/probo/pkg/coredata.PolicyVersionOrderFieldCreatedAt"
+ )
+}
+
# Order Input Types
input UserOrder
@goModel(
@@ -359,6 +378,18 @@ input ConnectorOrder {
direction: OrderDirection!
}
+input PolicyVersionOrder
+ @goModel(
+ model: "github.com/getprobo/probo/pkg/server/api/console/v1/types.PolicyVersionOrderBy"
+ ) {
+ direction: OrderDirection!
+ field: PolicyVersionOrderField!
+}
+
+input PolicyVersionFilter {
+ status: PolicyStatus
+}
+
# Core Types
type Organization implements Node {
id: ID!
@@ -631,12 +662,20 @@ type Evidence implements Node {
type Policy implements Node {
id: ID!
- name: String!
- status: PolicyStatus!
- content: String!
- reviewDate: Datetime
+ title: String!
+ description: String!
+ currentPublishedVersion: Int
owner: People! @goField(forceResolver: true)
+ versions(
+ first: Int
+ after: CursorKey
+ last: Int
+ before: CursorKey
+ orderBy: PolicyVersionOrder
+ filter: PolicyVersionFilter
+ ): PolicyVersionConnection! @goField(forceResolver: true)
+
controls(
first: Int
after: CursorKey
@@ -852,6 +891,16 @@ type VendorRiskAssessmentEdge {
node: VendorRiskAssessment!
}
+type PolicyVersionConnection {
+ edges: [PolicyVersionEdge!]!
+ pageInfo: PageInfo!
+}
+
+type PolicyVersionEdge {
+ cursor: CursorKey!
+ node: PolicyVersion!
+}
+
# Root Types
type Query {
node(id: ID!): Node!
@@ -952,8 +1001,11 @@ type Mutation {
# Policy mutations
createPolicy(input: CreatePolicyInput!): CreatePolicyPayload!
- updatePolicy(input: UpdatePolicyInput!): UpdatePolicyPayload!
deletePolicy(input: DeletePolicyInput!): DeletePolicyPayload!
+ publishPolicyVersion(input: PublishPolicyVersionInput!): PublishPolicyVersionPayload!
+ createDraftPolicyVersion(input: CreateDraftPolicyVersionInput!): CreateDraftPolicyVersionPayload!
+ updatePolicyVersion(input: UpdatePolicyVersionInput!): UpdatePolicyVersionPayload!
+ requestSignature(input: RequestSignatureInput!): RequestSignaturePayload!
createVendorRiskAssessment(input: CreateVendorRiskAssessmentInput!): CreateVendorRiskAssessmentPayload!
}
@@ -1224,20 +1276,17 @@ input DeleteVendorComplianceReportInput {
input CreatePolicyInput {
organizationId: ID!
- name: String!
+ title: String!
content: String!
- status: PolicyStatus!
- reviewDate: Datetime
ownerId: ID!
}
input UpdatePolicyInput {
id: ID!
- name: String
+ title: String
content: String
- status: PolicyStatus
- reviewDate: Datetime
ownerId: ID
+ createdBy: ID
}
input DeletePolicyInput {
@@ -1414,6 +1463,7 @@ type DeleteVendorComplianceReportPayload {
type CreatePolicyPayload {
policyEdge: PolicyEdge!
+ policyVersionEdge: PolicyVersionEdge!
}
type UpdatePolicyPayload {
@@ -1489,4 +1539,112 @@ input DeleteMesureInput {
type DeleteMesurePayload {
deletedMesureId: ID!
-}
\ No newline at end of file
+}
+
+type PolicyVersion implements Node {
+ id: ID!
+ policy: Policy! @goField(forceResolver: true)
+ status: PolicyStatus!
+ version: Int!
+ content: String!
+ changelog: String!
+
+ signatures(
+ first: Int
+ after: CursorKey
+ last: Int
+ before: CursorKey
+ orderBy: PolicyVersionSignatureOrder
+ ): PolicyVersionSignatureConnection! @goField(forceResolver: true)
+
+ publishedBy: People @goField(forceResolver: true)
+ publishedAt: Datetime
+ createdAt: Datetime!
+ updatedAt: Datetime!
+}
+
+type PolicyVersionSignatureConnection {
+ edges: [PolicyVersionSignatureEdge!]!
+ pageInfo: PageInfo!
+}
+
+type PolicyVersionSignatureEdge {
+ cursor: CursorKey!
+ node: PolicyVersionSignature!
+}
+
+input PolicyVersionSignatureOrder {
+ field: PolicyVersionSignatureOrderField!
+ direction: OrderDirection!
+}
+
+enum PolicyVersionSignatureState
+ @goModel(model: "github.com/getprobo/probo/pkg/coredata.PolicyVersionSignatureState") {
+ REQUESTED
+ @goEnum(
+ value: "github.com/getprobo/probo/pkg/coredata.PolicyVersionSignatureStateRequested"
+ )
+ SIGNED
+ @goEnum(
+ value: "github.com/getprobo/probo/pkg/coredata.PolicyVersionSignatureStateSigned"
+ )
+}
+
+enum PolicyVersionSignatureOrderField
+ @goModel(model: "github.com/getprobo/probo/pkg/coredata.PolicyVersionSignatureOrderField") {
+ CREATED_AT
+ @goEnum(
+ value: "github.com/getprobo/probo/pkg/coredata.PolicyVersionSignatureOrderFieldCreatedAt"
+ )
+ SIGNED_AT
+ @goEnum(
+ value: "github.com/getprobo/probo/pkg/coredata.PolicyVersionSignatureOrderFieldSignedAt"
+ )
+}
+
+type PolicyVersionSignature implements Node {
+ id: ID!
+ policyVersion: PolicyVersion! @goField(forceResolver: true)
+ state: PolicyVersionSignatureState!
+ signedBy: People! @goField(forceResolver: true)
+ signedAt: Datetime
+ requestedAt: Datetime!
+ requestedBy: People! @goField(forceResolver: true)
+ createdAt: Datetime!
+ updatedAt: Datetime!
+}
+
+input RequestSignatureInput {
+ policyVersionId: ID!
+ signatoryId: ID!
+}
+
+type RequestSignaturePayload {
+ policyVersionSignatureEdge: PolicyVersionSignatureEdge!
+}
+
+input PublishPolicyVersionInput {
+ policyId: ID!
+}
+
+type PublishPolicyVersionPayload {
+ policyVersion: PolicyVersion!
+ policy: Policy!
+}
+
+type CreateDraftPolicyVersionPayload {
+ policyVersionEdge: PolicyVersionEdge!
+}
+
+input CreateDraftPolicyVersionInput {
+ policyID: ID!
+}
+
+input UpdatePolicyVersionInput {
+ policyVersionId: ID!
+ content: String!
+}
+
+type UpdatePolicyVersionPayload {
+ policyVersion: PolicyVersion!
+}
diff --git a/pkg/server/api/console/v1/schema/schema.go b/pkg/server/api/console/v1/schema/schema.go
index 5f1193dad..f67fd77ae 100644
--- a/pkg/server/api/console/v1/schema/schema.go
+++ b/pkg/server/api/console/v1/schema/schema.go
@@ -49,6 +49,8 @@ type ResolverRoot interface {
Mutation() MutationResolver
Organization() OrganizationResolver
Policy() PolicyResolver
+ PolicyVersion() PolicyVersionResolver
+ PolicyVersionSignature() PolicyVersionSignatureResolver
Query() QueryResolver
Risk() RiskResolver
Task() TaskResolver
@@ -118,6 +120,10 @@ type ComplexityRoot struct {
Success func(childComplexity int) int
}
+ CreateDraftPolicyVersionPayload struct {
+ PolicyVersionEdge func(childComplexity int) int
+ }
+
CreateEvidencePayload struct {
EvidenceEdge func(childComplexity int) int
}
@@ -139,7 +145,8 @@ type ComplexityRoot struct {
}
CreatePolicyPayload struct {
- PolicyEdge func(childComplexity int) int
+ PolicyEdge func(childComplexity int) int
+ PolicyVersionEdge func(childComplexity int) int
}
CreateRiskMesureMappingPayload struct {
@@ -309,6 +316,7 @@ type ComplexityRoot struct {
ConfirmEmail func(childComplexity int, input types.ConfirmEmailInput) int
CreateControlMesureMapping func(childComplexity int, input types.CreateControlMesureMappingInput) int
CreateControlPolicyMapping func(childComplexity int, input types.CreateControlPolicyMappingInput) int
+ CreateDraftPolicyVersion func(childComplexity int, input types.CreateDraftPolicyVersionInput) int
CreateEvidence func(childComplexity int, input types.CreateEvidenceInput) int
CreateFramework func(childComplexity int, input types.CreateFrameworkInput) int
CreateMesure func(childComplexity int, input types.CreateMesureInput) int
@@ -339,14 +347,16 @@ type ComplexityRoot struct {
ImportFramework func(childComplexity int, input types.ImportFrameworkInput) int
ImportMesure func(childComplexity int, input types.ImportMesureInput) int
InviteUser func(childComplexity int, input types.InviteUserInput) int
+ PublishPolicyVersion func(childComplexity int, input types.PublishPolicyVersionInput) int
RemoveUser func(childComplexity int, input types.RemoveUserInput) int
RequestEvidence func(childComplexity int, input types.RequestEvidenceInput) int
+ RequestSignature func(childComplexity int, input types.RequestSignatureInput) int
UnassignTask func(childComplexity int, input types.UnassignTaskInput) int
UpdateFramework func(childComplexity int, input types.UpdateFrameworkInput) int
UpdateMesure func(childComplexity int, input types.UpdateMesureInput) int
UpdateOrganization func(childComplexity int, input types.UpdateOrganizationInput) int
UpdatePeople func(childComplexity int, input types.UpdatePeopleInput) int
- UpdatePolicy func(childComplexity int, input types.UpdatePolicyInput) int
+ UpdatePolicyVersion func(childComplexity int, input types.UpdatePolicyVersionInput) int
UpdateRisk func(childComplexity int, input types.UpdateRiskInput) int
UpdateTask func(childComplexity int, input types.UpdateTaskInput) int
UpdateVendor func(childComplexity int, input types.UpdateVendorInput) int
@@ -407,15 +417,15 @@ type ComplexityRoot struct {
}
Policy struct {
- Content func(childComplexity int) int
- Controls func(childComplexity int, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.ControlOrderBy) int
- CreatedAt func(childComplexity int) int
- ID func(childComplexity int) int
- Name func(childComplexity int) int
- Owner func(childComplexity int) int
- ReviewDate func(childComplexity int) int
- Status func(childComplexity int) int
- UpdatedAt func(childComplexity int) int
+ Controls func(childComplexity int, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.ControlOrderBy) int
+ CreatedAt func(childComplexity int) int
+ CurrentPublishedVersion func(childComplexity int) int
+ Description func(childComplexity int) int
+ ID func(childComplexity int) int
+ Owner func(childComplexity int) int
+ Title func(childComplexity int) int
+ UpdatedAt func(childComplexity int) int
+ Versions func(childComplexity int, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.PolicyVersionOrderBy, filter *types.PolicyVersionFilter) int
}
PolicyConnection struct {
@@ -428,6 +438,57 @@ type ComplexityRoot struct {
Node func(childComplexity int) int
}
+ PolicyVersion struct {
+ Changelog func(childComplexity int) int
+ Content func(childComplexity int) int
+ CreatedAt func(childComplexity int) int
+ ID func(childComplexity int) int
+ Policy func(childComplexity int) int
+ PublishedAt func(childComplexity int) int
+ PublishedBy func(childComplexity int) int
+ Signatures func(childComplexity int, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.PolicyVersionSignatureOrder) int
+ Status func(childComplexity int) int
+ UpdatedAt func(childComplexity int) int
+ Version func(childComplexity int) int
+ }
+
+ PolicyVersionConnection struct {
+ Edges func(childComplexity int) int
+ PageInfo func(childComplexity int) int
+ }
+
+ PolicyVersionEdge struct {
+ Cursor func(childComplexity int) int
+ Node func(childComplexity int) int
+ }
+
+ PolicyVersionSignature struct {
+ CreatedAt func(childComplexity int) int
+ ID func(childComplexity int) int
+ PolicyVersion func(childComplexity int) int
+ RequestedAt func(childComplexity int) int
+ RequestedBy func(childComplexity int) int
+ SignedAt func(childComplexity int) int
+ SignedBy func(childComplexity int) int
+ State func(childComplexity int) int
+ UpdatedAt func(childComplexity int) int
+ }
+
+ PolicyVersionSignatureConnection struct {
+ Edges func(childComplexity int) int
+ PageInfo func(childComplexity int) int
+ }
+
+ PolicyVersionSignatureEdge struct {
+ Cursor func(childComplexity int) int
+ Node func(childComplexity int) int
+ }
+
+ PublishPolicyVersionPayload struct {
+ Policy func(childComplexity int) int
+ PolicyVersion func(childComplexity int) int
+ }
+
Query struct {
Node func(childComplexity int, id gid.GID) int
Viewer func(childComplexity int) int
@@ -441,6 +502,10 @@ type ComplexityRoot struct {
EvidenceEdge func(childComplexity int) int
}
+ RequestSignaturePayload struct {
+ PolicyVersionSignatureEdge func(childComplexity int) int
+ }
+
Risk struct {
Category func(childComplexity int) int
Controls func(childComplexity int, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.ControlOrderBy) int
@@ -523,6 +588,10 @@ type ComplexityRoot struct {
Policy func(childComplexity int) int
}
+ UpdatePolicyVersionPayload struct {
+ PolicyVersion func(childComplexity int) int
+ }
+
UpdateRiskPayload struct {
Risk func(childComplexity int) int
}
@@ -704,8 +773,11 @@ type MutationResolver interface {
UploadVendorComplianceReport(ctx context.Context, input types.UploadVendorComplianceReportInput) (*types.UploadVendorComplianceReportPayload, error)
DeleteVendorComplianceReport(ctx context.Context, input types.DeleteVendorComplianceReportInput) (*types.DeleteVendorComplianceReportPayload, error)
CreatePolicy(ctx context.Context, input types.CreatePolicyInput) (*types.CreatePolicyPayload, error)
- UpdatePolicy(ctx context.Context, input types.UpdatePolicyInput) (*types.UpdatePolicyPayload, error)
DeletePolicy(ctx context.Context, input types.DeletePolicyInput) (*types.DeletePolicyPayload, error)
+ PublishPolicyVersion(ctx context.Context, input types.PublishPolicyVersionInput) (*types.PublishPolicyVersionPayload, error)
+ CreateDraftPolicyVersion(ctx context.Context, input types.CreateDraftPolicyVersionInput) (*types.CreateDraftPolicyVersionPayload, error)
+ UpdatePolicyVersion(ctx context.Context, input types.UpdatePolicyVersionInput) (*types.UpdatePolicyVersionPayload, error)
+ RequestSignature(ctx context.Context, input types.RequestSignatureInput) (*types.RequestSignaturePayload, error)
CreateVendorRiskAssessment(ctx context.Context, input types.CreateVendorRiskAssessmentInput) (*types.CreateVendorRiskAssessmentPayload, error)
}
type OrganizationResolver interface {
@@ -721,8 +793,22 @@ type OrganizationResolver interface {
}
type PolicyResolver interface {
Owner(ctx context.Context, obj *types.Policy) (*types.People, error)
+ Versions(ctx context.Context, obj *types.Policy, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.PolicyVersionOrderBy, filter *types.PolicyVersionFilter) (*types.PolicyVersionConnection, error)
Controls(ctx context.Context, obj *types.Policy, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.ControlOrderBy) (*types.ControlConnection, error)
}
+type PolicyVersionResolver interface {
+ Policy(ctx context.Context, obj *types.PolicyVersion) (*types.Policy, error)
+
+ Signatures(ctx context.Context, obj *types.PolicyVersion, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.PolicyVersionSignatureOrder) (*types.PolicyVersionSignatureConnection, error)
+ PublishedBy(ctx context.Context, obj *types.PolicyVersion) (*types.People, error)
+}
+type PolicyVersionSignatureResolver interface {
+ PolicyVersion(ctx context.Context, obj *types.PolicyVersionSignature) (*types.PolicyVersion, error)
+
+ SignedBy(ctx context.Context, obj *types.PolicyVersionSignature) (*types.People, error)
+
+ RequestedBy(ctx context.Context, obj *types.PolicyVersionSignature) (*types.People, error)
+}
type QueryResolver interface {
Node(ctx context.Context, id gid.GID) (types.Node, error)
Viewer(ctx context.Context) (*types.Viewer, error)
@@ -964,6 +1050,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
return e.complexity.CreateControlPolicyMappingPayload.Success(childComplexity), true
+ case "CreateDraftPolicyVersionPayload.policyVersionEdge":
+ if e.complexity.CreateDraftPolicyVersionPayload.PolicyVersionEdge == nil {
+ break
+ }
+
+ return e.complexity.CreateDraftPolicyVersionPayload.PolicyVersionEdge(childComplexity), true
+
case "CreateEvidencePayload.evidenceEdge":
if e.complexity.CreateEvidencePayload.EvidenceEdge == nil {
break
@@ -1006,6 +1099,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
return e.complexity.CreatePolicyPayload.PolicyEdge(childComplexity), true
+ case "CreatePolicyPayload.policyVersionEdge":
+ if e.complexity.CreatePolicyPayload.PolicyVersionEdge == nil {
+ break
+ }
+
+ return e.complexity.CreatePolicyPayload.PolicyVersionEdge(childComplexity), true
+
case "CreateRiskMesureMappingPayload.success":
if e.complexity.CreateRiskMesureMappingPayload.Success == nil {
break
@@ -1515,6 +1615,18 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
return e.complexity.Mutation.CreateControlPolicyMapping(childComplexity, args["input"].(types.CreateControlPolicyMappingInput)), true
+ case "Mutation.createDraftPolicyVersion":
+ if e.complexity.Mutation.CreateDraftPolicyVersion == nil {
+ break
+ }
+
+ args, err := ec.field_Mutation_createDraftPolicyVersion_args(context.TODO(), rawArgs)
+ if err != nil {
+ return 0, false
+ }
+
+ return e.complexity.Mutation.CreateDraftPolicyVersion(childComplexity, args["input"].(types.CreateDraftPolicyVersionInput)), true
+
case "Mutation.createEvidence":
if e.complexity.Mutation.CreateEvidence == nil {
break
@@ -1875,6 +1987,18 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
return e.complexity.Mutation.InviteUser(childComplexity, args["input"].(types.InviteUserInput)), true
+ case "Mutation.publishPolicyVersion":
+ if e.complexity.Mutation.PublishPolicyVersion == nil {
+ break
+ }
+
+ args, err := ec.field_Mutation_publishPolicyVersion_args(context.TODO(), rawArgs)
+ if err != nil {
+ return 0, false
+ }
+
+ return e.complexity.Mutation.PublishPolicyVersion(childComplexity, args["input"].(types.PublishPolicyVersionInput)), true
+
case "Mutation.removeUser":
if e.complexity.Mutation.RemoveUser == nil {
break
@@ -1899,6 +2023,18 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
return e.complexity.Mutation.RequestEvidence(childComplexity, args["input"].(types.RequestEvidenceInput)), true
+ case "Mutation.requestSignature":
+ if e.complexity.Mutation.RequestSignature == nil {
+ break
+ }
+
+ args, err := ec.field_Mutation_requestSignature_args(context.TODO(), rawArgs)
+ if err != nil {
+ return 0, false
+ }
+
+ return e.complexity.Mutation.RequestSignature(childComplexity, args["input"].(types.RequestSignatureInput)), true
+
case "Mutation.unassignTask":
if e.complexity.Mutation.UnassignTask == nil {
break
@@ -1959,17 +2095,17 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
return e.complexity.Mutation.UpdatePeople(childComplexity, args["input"].(types.UpdatePeopleInput)), true
- case "Mutation.updatePolicy":
- if e.complexity.Mutation.UpdatePolicy == nil {
+ case "Mutation.updatePolicyVersion":
+ if e.complexity.Mutation.UpdatePolicyVersion == nil {
break
}
- args, err := ec.field_Mutation_updatePolicy_args(context.TODO(), rawArgs)
+ args, err := ec.field_Mutation_updatePolicyVersion_args(context.TODO(), rawArgs)
if err != nil {
return 0, false
}
- return e.complexity.Mutation.UpdatePolicy(childComplexity, args["input"].(types.UpdatePolicyInput)), true
+ return e.complexity.Mutation.UpdatePolicyVersion(childComplexity, args["input"].(types.UpdatePolicyVersionInput)), true
case "Mutation.updateRisk":
if e.complexity.Mutation.UpdateRisk == nil {
@@ -2283,13 +2419,6 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
return e.complexity.PeopleEdge.Node(childComplexity), true
- case "Policy.content":
- if e.complexity.Policy.Content == nil {
- break
- }
-
- return e.complexity.Policy.Content(childComplexity), true
-
case "Policy.controls":
if e.complexity.Policy.Controls == nil {
break
@@ -2309,6 +2438,20 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
return e.complexity.Policy.CreatedAt(childComplexity), true
+ case "Policy.currentPublishedVersion":
+ if e.complexity.Policy.CurrentPublishedVersion == nil {
+ break
+ }
+
+ return e.complexity.Policy.CurrentPublishedVersion(childComplexity), true
+
+ case "Policy.description":
+ if e.complexity.Policy.Description == nil {
+ break
+ }
+
+ return e.complexity.Policy.Description(childComplexity), true
+
case "Policy.id":
if e.complexity.Policy.ID == nil {
break
@@ -2316,13 +2459,6 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
return e.complexity.Policy.ID(childComplexity), true
- case "Policy.name":
- if e.complexity.Policy.Name == nil {
- break
- }
-
- return e.complexity.Policy.Name(childComplexity), true
-
case "Policy.owner":
if e.complexity.Policy.Owner == nil {
break
@@ -2330,19 +2466,12 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
return e.complexity.Policy.Owner(childComplexity), true
- case "Policy.reviewDate":
- if e.complexity.Policy.ReviewDate == nil {
+ case "Policy.title":
+ if e.complexity.Policy.Title == nil {
break
}
- return e.complexity.Policy.ReviewDate(childComplexity), true
-
- case "Policy.status":
- if e.complexity.Policy.Status == nil {
- break
- }
-
- return e.complexity.Policy.Status(childComplexity), true
+ return e.complexity.Policy.Title(childComplexity), true
case "Policy.updatedAt":
if e.complexity.Policy.UpdatedAt == nil {
@@ -2351,6 +2480,18 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
return e.complexity.Policy.UpdatedAt(childComplexity), true
+ case "Policy.versions":
+ if e.complexity.Policy.Versions == nil {
+ break
+ }
+
+ args, err := ec.field_Policy_versions_args(context.TODO(), rawArgs)
+ if err != nil {
+ return 0, false
+ }
+
+ return e.complexity.Policy.Versions(childComplexity, args["first"].(*int), args["after"].(*page.CursorKey), args["last"].(*int), args["before"].(*page.CursorKey), args["orderBy"].(*types.PolicyVersionOrderBy), args["filter"].(*types.PolicyVersionFilter)), true
+
case "PolicyConnection.edges":
if e.complexity.PolicyConnection.Edges == nil {
break
@@ -2379,6 +2520,221 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
return e.complexity.PolicyEdge.Node(childComplexity), true
+ case "PolicyVersion.changelog":
+ if e.complexity.PolicyVersion.Changelog == nil {
+ break
+ }
+
+ return e.complexity.PolicyVersion.Changelog(childComplexity), true
+
+ case "PolicyVersion.content":
+ if e.complexity.PolicyVersion.Content == nil {
+ break
+ }
+
+ return e.complexity.PolicyVersion.Content(childComplexity), true
+
+ case "PolicyVersion.createdAt":
+ if e.complexity.PolicyVersion.CreatedAt == nil {
+ break
+ }
+
+ return e.complexity.PolicyVersion.CreatedAt(childComplexity), true
+
+ case "PolicyVersion.id":
+ if e.complexity.PolicyVersion.ID == nil {
+ break
+ }
+
+ return e.complexity.PolicyVersion.ID(childComplexity), true
+
+ case "PolicyVersion.policy":
+ if e.complexity.PolicyVersion.Policy == nil {
+ break
+ }
+
+ return e.complexity.PolicyVersion.Policy(childComplexity), true
+
+ case "PolicyVersion.publishedAt":
+ if e.complexity.PolicyVersion.PublishedAt == nil {
+ break
+ }
+
+ return e.complexity.PolicyVersion.PublishedAt(childComplexity), true
+
+ case "PolicyVersion.publishedBy":
+ if e.complexity.PolicyVersion.PublishedBy == nil {
+ break
+ }
+
+ return e.complexity.PolicyVersion.PublishedBy(childComplexity), true
+
+ case "PolicyVersion.signatures":
+ if e.complexity.PolicyVersion.Signatures == nil {
+ break
+ }
+
+ args, err := ec.field_PolicyVersion_signatures_args(context.TODO(), rawArgs)
+ if err != nil {
+ return 0, false
+ }
+
+ return e.complexity.PolicyVersion.Signatures(childComplexity, args["first"].(*int), args["after"].(*page.CursorKey), args["last"].(*int), args["before"].(*page.CursorKey), args["orderBy"].(*types.PolicyVersionSignatureOrder)), true
+
+ case "PolicyVersion.status":
+ if e.complexity.PolicyVersion.Status == nil {
+ break
+ }
+
+ return e.complexity.PolicyVersion.Status(childComplexity), true
+
+ case "PolicyVersion.updatedAt":
+ if e.complexity.PolicyVersion.UpdatedAt == nil {
+ break
+ }
+
+ return e.complexity.PolicyVersion.UpdatedAt(childComplexity), true
+
+ case "PolicyVersion.version":
+ if e.complexity.PolicyVersion.Version == nil {
+ break
+ }
+
+ return e.complexity.PolicyVersion.Version(childComplexity), true
+
+ case "PolicyVersionConnection.edges":
+ if e.complexity.PolicyVersionConnection.Edges == nil {
+ break
+ }
+
+ return e.complexity.PolicyVersionConnection.Edges(childComplexity), true
+
+ case "PolicyVersionConnection.pageInfo":
+ if e.complexity.PolicyVersionConnection.PageInfo == nil {
+ break
+ }
+
+ return e.complexity.PolicyVersionConnection.PageInfo(childComplexity), true
+
+ case "PolicyVersionEdge.cursor":
+ if e.complexity.PolicyVersionEdge.Cursor == nil {
+ break
+ }
+
+ return e.complexity.PolicyVersionEdge.Cursor(childComplexity), true
+
+ case "PolicyVersionEdge.node":
+ if e.complexity.PolicyVersionEdge.Node == nil {
+ break
+ }
+
+ return e.complexity.PolicyVersionEdge.Node(childComplexity), true
+
+ case "PolicyVersionSignature.createdAt":
+ if e.complexity.PolicyVersionSignature.CreatedAt == nil {
+ break
+ }
+
+ return e.complexity.PolicyVersionSignature.CreatedAt(childComplexity), true
+
+ case "PolicyVersionSignature.id":
+ if e.complexity.PolicyVersionSignature.ID == nil {
+ break
+ }
+
+ return e.complexity.PolicyVersionSignature.ID(childComplexity), true
+
+ case "PolicyVersionSignature.policyVersion":
+ if e.complexity.PolicyVersionSignature.PolicyVersion == nil {
+ break
+ }
+
+ return e.complexity.PolicyVersionSignature.PolicyVersion(childComplexity), true
+
+ case "PolicyVersionSignature.requestedAt":
+ if e.complexity.PolicyVersionSignature.RequestedAt == nil {
+ break
+ }
+
+ return e.complexity.PolicyVersionSignature.RequestedAt(childComplexity), true
+
+ case "PolicyVersionSignature.requestedBy":
+ if e.complexity.PolicyVersionSignature.RequestedBy == nil {
+ break
+ }
+
+ return e.complexity.PolicyVersionSignature.RequestedBy(childComplexity), true
+
+ case "PolicyVersionSignature.signedAt":
+ if e.complexity.PolicyVersionSignature.SignedAt == nil {
+ break
+ }
+
+ return e.complexity.PolicyVersionSignature.SignedAt(childComplexity), true
+
+ case "PolicyVersionSignature.signedBy":
+ if e.complexity.PolicyVersionSignature.SignedBy == nil {
+ break
+ }
+
+ return e.complexity.PolicyVersionSignature.SignedBy(childComplexity), true
+
+ case "PolicyVersionSignature.state":
+ if e.complexity.PolicyVersionSignature.State == nil {
+ break
+ }
+
+ return e.complexity.PolicyVersionSignature.State(childComplexity), true
+
+ case "PolicyVersionSignature.updatedAt":
+ if e.complexity.PolicyVersionSignature.UpdatedAt == nil {
+ break
+ }
+
+ return e.complexity.PolicyVersionSignature.UpdatedAt(childComplexity), true
+
+ case "PolicyVersionSignatureConnection.edges":
+ if e.complexity.PolicyVersionSignatureConnection.Edges == nil {
+ break
+ }
+
+ return e.complexity.PolicyVersionSignatureConnection.Edges(childComplexity), true
+
+ case "PolicyVersionSignatureConnection.pageInfo":
+ if e.complexity.PolicyVersionSignatureConnection.PageInfo == nil {
+ break
+ }
+
+ return e.complexity.PolicyVersionSignatureConnection.PageInfo(childComplexity), true
+
+ case "PolicyVersionSignatureEdge.cursor":
+ if e.complexity.PolicyVersionSignatureEdge.Cursor == nil {
+ break
+ }
+
+ return e.complexity.PolicyVersionSignatureEdge.Cursor(childComplexity), true
+
+ case "PolicyVersionSignatureEdge.node":
+ if e.complexity.PolicyVersionSignatureEdge.Node == nil {
+ break
+ }
+
+ return e.complexity.PolicyVersionSignatureEdge.Node(childComplexity), true
+
+ case "PublishPolicyVersionPayload.policy":
+ if e.complexity.PublishPolicyVersionPayload.Policy == nil {
+ break
+ }
+
+ return e.complexity.PublishPolicyVersionPayload.Policy(childComplexity), true
+
+ case "PublishPolicyVersionPayload.policyVersion":
+ if e.complexity.PublishPolicyVersionPayload.PolicyVersion == nil {
+ break
+ }
+
+ return e.complexity.PublishPolicyVersionPayload.PolicyVersion(childComplexity), true
+
case "Query.node":
if e.complexity.Query.Node == nil {
break
@@ -2412,6 +2768,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
return e.complexity.RequestEvidencePayload.EvidenceEdge(childComplexity), true
+ case "RequestSignaturePayload.policyVersionSignatureEdge":
+ if e.complexity.RequestSignaturePayload.PolicyVersionSignatureEdge == nil {
+ break
+ }
+
+ return e.complexity.RequestSignaturePayload.PolicyVersionSignatureEdge(childComplexity), true
+
case "Risk.category":
if e.complexity.Risk.Category == nil {
break
@@ -2733,6 +3096,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
return e.complexity.UpdatePolicyPayload.Policy(childComplexity), true
+ case "UpdatePolicyVersionPayload.policyVersion":
+ if e.complexity.UpdatePolicyVersionPayload.PolicyVersion == nil {
+ break
+ }
+
+ return e.complexity.UpdatePolicyVersionPayload.PolicyVersion(childComplexity), true
+
case "UpdateRiskPayload.risk":
if e.complexity.UpdateRiskPayload.Risk == nil {
break
@@ -3257,6 +3627,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler {
ec.unmarshalInputControlOrder,
ec.unmarshalInputCreateControlMesureMappingInput,
ec.unmarshalInputCreateControlPolicyMappingInput,
+ ec.unmarshalInputCreateDraftPolicyVersionInput,
ec.unmarshalInputCreateEvidenceInput,
ec.unmarshalInputCreateFrameworkInput,
ec.unmarshalInputCreateMesureInput,
@@ -3293,8 +3664,13 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler {
ec.unmarshalInputOrganizationOrder,
ec.unmarshalInputPeopleOrder,
ec.unmarshalInputPolicyOrder,
+ ec.unmarshalInputPolicyVersionFilter,
+ ec.unmarshalInputPolicyVersionOrder,
+ ec.unmarshalInputPolicyVersionSignatureOrder,
+ ec.unmarshalInputPublishPolicyVersionInput,
ec.unmarshalInputRemoveUserInput,
ec.unmarshalInputRequestEvidenceInput,
+ ec.unmarshalInputRequestSignatureInput,
ec.unmarshalInputRiskOrder,
ec.unmarshalInputTaskOrder,
ec.unmarshalInputUnassignTaskInput,
@@ -3303,6 +3679,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler {
ec.unmarshalInputUpdateOrganizationInput,
ec.unmarshalInputUpdatePeopleInput,
ec.unmarshalInputUpdatePolicyInput,
+ ec.unmarshalInputUpdatePolicyVersionInput,
ec.unmarshalInputUpdateRiskInput,
ec.unmarshalInputUpdateTaskInput,
ec.unmarshalInputUpdateVendorInput,
@@ -3505,8 +3882,8 @@ enum PolicyStatus
@goModel(model: "github.com/getprobo/probo/pkg/coredata.PolicyStatus") {
DRAFT
@goEnum(value: "github.com/getprobo/probo/pkg/coredata.PolicyStatusDraft")
- ACTIVE
- @goEnum(value: "github.com/getprobo/probo/pkg/coredata.PolicyStatusActive")
+ PUBLISHED
+ @goEnum(value: "github.com/getprobo/probo/pkg/coredata.PolicyStatusPublished")
}
enum EvidenceType
@@ -3594,7 +3971,14 @@ enum TaskOrderField
enum PolicyOrderField
@goModel(model: "github.com/getprobo/probo/pkg/coredata.PolicyOrderField") {
- NAME
+ TITLE
+ @goEnum(
+ value: "github.com/getprobo/probo/pkg/coredata.PolicyOrderFieldTitle"
+ )
+ CREATED_AT
+ @goEnum(
+ value: "github.com/getprobo/probo/pkg/coredata.PolicyOrderFieldCreatedAt"
+ )
}
enum RiskOrderField
@@ -3670,6 +4054,18 @@ enum BusinessImpact
@goEnum(value: "github.com/getprobo/probo/pkg/coredata.BusinessImpactCritical")
}
+enum PolicyVersionOrderField
+ @goModel(model: "github.com/getprobo/probo/pkg/coredata.PolicyVersionOrderField") {
+ VERSION
+ @goEnum(
+ value: "github.com/getprobo/probo/pkg/coredata.PolicyVersionOrderFieldVersion"
+ )
+ CREATED_AT
+ @goEnum(
+ value: "github.com/getprobo/probo/pkg/coredata.PolicyVersionOrderFieldCreatedAt"
+ )
+}
+
# Order Input Types
input UserOrder
@goModel(
@@ -3769,6 +4165,18 @@ input ConnectorOrder {
direction: OrderDirection!
}
+input PolicyVersionOrder
+ @goModel(
+ model: "github.com/getprobo/probo/pkg/server/api/console/v1/types.PolicyVersionOrderBy"
+ ) {
+ direction: OrderDirection!
+ field: PolicyVersionOrderField!
+}
+
+input PolicyVersionFilter {
+ status: PolicyStatus
+}
+
# Core Types
type Organization implements Node {
id: ID!
@@ -4041,12 +4449,20 @@ type Evidence implements Node {
type Policy implements Node {
id: ID!
- name: String!
- status: PolicyStatus!
- content: String!
- reviewDate: Datetime
+ title: String!
+ description: String!
+ currentPublishedVersion: Int
owner: People! @goField(forceResolver: true)
+ versions(
+ first: Int
+ after: CursorKey
+ last: Int
+ before: CursorKey
+ orderBy: PolicyVersionOrder
+ filter: PolicyVersionFilter
+ ): PolicyVersionConnection! @goField(forceResolver: true)
+
controls(
first: Int
after: CursorKey
@@ -4262,6 +4678,16 @@ type VendorRiskAssessmentEdge {
node: VendorRiskAssessment!
}
+type PolicyVersionConnection {
+ edges: [PolicyVersionEdge!]!
+ pageInfo: PageInfo!
+}
+
+type PolicyVersionEdge {
+ cursor: CursorKey!
+ node: PolicyVersion!
+}
+
# Root Types
type Query {
node(id: ID!): Node!
@@ -4362,8 +4788,11 @@ type Mutation {
# Policy mutations
createPolicy(input: CreatePolicyInput!): CreatePolicyPayload!
- updatePolicy(input: UpdatePolicyInput!): UpdatePolicyPayload!
deletePolicy(input: DeletePolicyInput!): DeletePolicyPayload!
+ publishPolicyVersion(input: PublishPolicyVersionInput!): PublishPolicyVersionPayload!
+ createDraftPolicyVersion(input: CreateDraftPolicyVersionInput!): CreateDraftPolicyVersionPayload!
+ updatePolicyVersion(input: UpdatePolicyVersionInput!): UpdatePolicyVersionPayload!
+ requestSignature(input: RequestSignatureInput!): RequestSignaturePayload!
createVendorRiskAssessment(input: CreateVendorRiskAssessmentInput!): CreateVendorRiskAssessmentPayload!
}
@@ -4634,20 +5063,17 @@ input DeleteVendorComplianceReportInput {
input CreatePolicyInput {
organizationId: ID!
- name: String!
+ title: String!
content: String!
- status: PolicyStatus!
- reviewDate: Datetime
ownerId: ID!
}
input UpdatePolicyInput {
id: ID!
- name: String
+ title: String
content: String
- status: PolicyStatus
- reviewDate: Datetime
ownerId: ID
+ createdBy: ID
}
input DeletePolicyInput {
@@ -4824,6 +5250,7 @@ type DeleteVendorComplianceReportPayload {
type CreatePolicyPayload {
policyEdge: PolicyEdge!
+ policyVersionEdge: PolicyVersionEdge!
}
type UpdatePolicyPayload {
@@ -4899,7 +5326,116 @@ input DeleteMesureInput {
type DeleteMesurePayload {
deletedMesureId: ID!
-}`, BuiltIn: false},
+}
+
+type PolicyVersion implements Node {
+ id: ID!
+ policy: Policy! @goField(forceResolver: true)
+ status: PolicyStatus!
+ version: Int!
+ content: String!
+ changelog: String!
+
+ signatures(
+ first: Int
+ after: CursorKey
+ last: Int
+ before: CursorKey
+ orderBy: PolicyVersionSignatureOrder
+ ): PolicyVersionSignatureConnection! @goField(forceResolver: true)
+
+ publishedBy: People @goField(forceResolver: true)
+ publishedAt: Datetime
+ createdAt: Datetime!
+ updatedAt: Datetime!
+}
+
+type PolicyVersionSignatureConnection {
+ edges: [PolicyVersionSignatureEdge!]!
+ pageInfo: PageInfo!
+}
+
+type PolicyVersionSignatureEdge {
+ cursor: CursorKey!
+ node: PolicyVersionSignature!
+}
+
+input PolicyVersionSignatureOrder {
+ field: PolicyVersionSignatureOrderField!
+ direction: OrderDirection!
+}
+
+enum PolicyVersionSignatureState
+ @goModel(model: "github.com/getprobo/probo/pkg/coredata.PolicyVersionSignatureState") {
+ REQUESTED
+ @goEnum(
+ value: "github.com/getprobo/probo/pkg/coredata.PolicyVersionSignatureStateRequested"
+ )
+ SIGNED
+ @goEnum(
+ value: "github.com/getprobo/probo/pkg/coredata.PolicyVersionSignatureStateSigned"
+ )
+}
+
+enum PolicyVersionSignatureOrderField
+ @goModel(model: "github.com/getprobo/probo/pkg/coredata.PolicyVersionSignatureOrderField") {
+ CREATED_AT
+ @goEnum(
+ value: "github.com/getprobo/probo/pkg/coredata.PolicyVersionSignatureOrderFieldCreatedAt"
+ )
+ SIGNED_AT
+ @goEnum(
+ value: "github.com/getprobo/probo/pkg/coredata.PolicyVersionSignatureOrderFieldSignedAt"
+ )
+}
+
+type PolicyVersionSignature implements Node {
+ id: ID!
+ policyVersion: PolicyVersion! @goField(forceResolver: true)
+ state: PolicyVersionSignatureState!
+ signedBy: People! @goField(forceResolver: true)
+ signedAt: Datetime
+ requestedAt: Datetime!
+ requestedBy: People! @goField(forceResolver: true)
+ createdAt: Datetime!
+ updatedAt: Datetime!
+}
+
+input RequestSignatureInput {
+ policyVersionId: ID!
+ signatoryId: ID!
+}
+
+type RequestSignaturePayload {
+ policyVersionSignatureEdge: PolicyVersionSignatureEdge!
+}
+
+input PublishPolicyVersionInput {
+ policyId: ID!
+}
+
+type PublishPolicyVersionPayload {
+ policyVersion: PolicyVersion!
+ policy: Policy!
+}
+
+type CreateDraftPolicyVersionPayload {
+ policyVersionEdge: PolicyVersionEdge!
+}
+
+input CreateDraftPolicyVersionInput {
+ policyID: ID!
+}
+
+input UpdatePolicyVersionInput {
+ policyVersionId: ID!
+ content: String!
+}
+
+type UpdatePolicyVersionPayload {
+ policyVersion: PolicyVersion!
+}
+`, BuiltIn: false},
}
var parsedSchema = gqlparser.MustLoadSchema(sources...)
@@ -5569,6 +6105,29 @@ func (ec *executionContext) field_Mutation_createControlPolicyMapping_argsInput(
return zeroVal, nil
}
+func (ec *executionContext) field_Mutation_createDraftPolicyVersion_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) {
+ var err error
+ args := map[string]any{}
+ arg0, err := ec.field_Mutation_createDraftPolicyVersion_argsInput(ctx, rawArgs)
+ if err != nil {
+ return nil, err
+ }
+ args["input"] = arg0
+ return args, nil
+}
+func (ec *executionContext) field_Mutation_createDraftPolicyVersion_argsInput(
+ ctx context.Context,
+ rawArgs map[string]any,
+) (types.CreateDraftPolicyVersionInput, error) {
+ ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("input"))
+ if tmp, ok := rawArgs["input"]; ok {
+ return ec.unmarshalNCreateDraftPolicyVersionInput2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐCreateDraftPolicyVersionInput(ctx, tmp)
+ }
+
+ var zeroVal types.CreateDraftPolicyVersionInput
+ return zeroVal, nil
+}
+
func (ec *executionContext) field_Mutation_createEvidence_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) {
var err error
args := map[string]any{}
@@ -6259,6 +6818,29 @@ func (ec *executionContext) field_Mutation_inviteUser_argsInput(
return zeroVal, nil
}
+func (ec *executionContext) field_Mutation_publishPolicyVersion_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) {
+ var err error
+ args := map[string]any{}
+ arg0, err := ec.field_Mutation_publishPolicyVersion_argsInput(ctx, rawArgs)
+ if err != nil {
+ return nil, err
+ }
+ args["input"] = arg0
+ return args, nil
+}
+func (ec *executionContext) field_Mutation_publishPolicyVersion_argsInput(
+ ctx context.Context,
+ rawArgs map[string]any,
+) (types.PublishPolicyVersionInput, error) {
+ ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("input"))
+ if tmp, ok := rawArgs["input"]; ok {
+ return ec.unmarshalNPublishPolicyVersionInput2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐPublishPolicyVersionInput(ctx, tmp)
+ }
+
+ var zeroVal types.PublishPolicyVersionInput
+ return zeroVal, nil
+}
+
func (ec *executionContext) field_Mutation_removeUser_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) {
var err error
args := map[string]any{}
@@ -6305,6 +6887,29 @@ func (ec *executionContext) field_Mutation_requestEvidence_argsInput(
return zeroVal, nil
}
+func (ec *executionContext) field_Mutation_requestSignature_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) {
+ var err error
+ args := map[string]any{}
+ arg0, err := ec.field_Mutation_requestSignature_argsInput(ctx, rawArgs)
+ if err != nil {
+ return nil, err
+ }
+ args["input"] = arg0
+ return args, nil
+}
+func (ec *executionContext) field_Mutation_requestSignature_argsInput(
+ ctx context.Context,
+ rawArgs map[string]any,
+) (types.RequestSignatureInput, error) {
+ ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("input"))
+ if tmp, ok := rawArgs["input"]; ok {
+ return ec.unmarshalNRequestSignatureInput2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐRequestSignatureInput(ctx, tmp)
+ }
+
+ var zeroVal types.RequestSignatureInput
+ return zeroVal, nil
+}
+
func (ec *executionContext) field_Mutation_unassignTask_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) {
var err error
args := map[string]any{}
@@ -6420,26 +7025,26 @@ func (ec *executionContext) field_Mutation_updatePeople_argsInput(
return zeroVal, nil
}
-func (ec *executionContext) field_Mutation_updatePolicy_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) {
+func (ec *executionContext) field_Mutation_updatePolicyVersion_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) {
var err error
args := map[string]any{}
- arg0, err := ec.field_Mutation_updatePolicy_argsInput(ctx, rawArgs)
+ arg0, err := ec.field_Mutation_updatePolicyVersion_argsInput(ctx, rawArgs)
if err != nil {
return nil, err
}
args["input"] = arg0
return args, nil
}
-func (ec *executionContext) field_Mutation_updatePolicy_argsInput(
+func (ec *executionContext) field_Mutation_updatePolicyVersion_argsInput(
ctx context.Context,
rawArgs map[string]any,
-) (types.UpdatePolicyInput, error) {
+) (types.UpdatePolicyVersionInput, error) {
ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("input"))
if tmp, ok := rawArgs["input"]; ok {
- return ec.unmarshalNUpdatePolicyInput2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐUpdatePolicyInput(ctx, tmp)
+ return ec.unmarshalNUpdatePolicyVersionInput2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐUpdatePolicyVersionInput(ctx, tmp)
}
- var zeroVal types.UpdatePolicyInput
+ var zeroVal types.UpdatePolicyVersionInput
return zeroVal, nil
}
@@ -7295,6 +7900,101 @@ func (ec *executionContext) field_Organization_vendors_argsOrderBy(
return zeroVal, nil
}
+func (ec *executionContext) field_PolicyVersion_signatures_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) {
+ var err error
+ args := map[string]any{}
+ arg0, err := ec.field_PolicyVersion_signatures_argsFirst(ctx, rawArgs)
+ if err != nil {
+ return nil, err
+ }
+ args["first"] = arg0
+ arg1, err := ec.field_PolicyVersion_signatures_argsAfter(ctx, rawArgs)
+ if err != nil {
+ return nil, err
+ }
+ args["after"] = arg1
+ arg2, err := ec.field_PolicyVersion_signatures_argsLast(ctx, rawArgs)
+ if err != nil {
+ return nil, err
+ }
+ args["last"] = arg2
+ arg3, err := ec.field_PolicyVersion_signatures_argsBefore(ctx, rawArgs)
+ if err != nil {
+ return nil, err
+ }
+ args["before"] = arg3
+ arg4, err := ec.field_PolicyVersion_signatures_argsOrderBy(ctx, rawArgs)
+ if err != nil {
+ return nil, err
+ }
+ args["orderBy"] = arg4
+ return args, nil
+}
+func (ec *executionContext) field_PolicyVersion_signatures_argsFirst(
+ ctx context.Context,
+ rawArgs map[string]any,
+) (*int, error) {
+ ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("first"))
+ if tmp, ok := rawArgs["first"]; ok {
+ return ec.unmarshalOInt2ᚖint(ctx, tmp)
+ }
+
+ var zeroVal *int
+ return zeroVal, nil
+}
+
+func (ec *executionContext) field_PolicyVersion_signatures_argsAfter(
+ ctx context.Context,
+ rawArgs map[string]any,
+) (*page.CursorKey, error) {
+ ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("after"))
+ if tmp, ok := rawArgs["after"]; ok {
+ return ec.unmarshalOCursorKey2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋpageᚐCursorKey(ctx, tmp)
+ }
+
+ var zeroVal *page.CursorKey
+ return zeroVal, nil
+}
+
+func (ec *executionContext) field_PolicyVersion_signatures_argsLast(
+ ctx context.Context,
+ rawArgs map[string]any,
+) (*int, error) {
+ ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("last"))
+ if tmp, ok := rawArgs["last"]; ok {
+ return ec.unmarshalOInt2ᚖint(ctx, tmp)
+ }
+
+ var zeroVal *int
+ return zeroVal, nil
+}
+
+func (ec *executionContext) field_PolicyVersion_signatures_argsBefore(
+ ctx context.Context,
+ rawArgs map[string]any,
+) (*page.CursorKey, error) {
+ ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("before"))
+ if tmp, ok := rawArgs["before"]; ok {
+ return ec.unmarshalOCursorKey2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋpageᚐCursorKey(ctx, tmp)
+ }
+
+ var zeroVal *page.CursorKey
+ return zeroVal, nil
+}
+
+func (ec *executionContext) field_PolicyVersion_signatures_argsOrderBy(
+ ctx context.Context,
+ rawArgs map[string]any,
+) (*types.PolicyVersionSignatureOrder, error) {
+ ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("orderBy"))
+ if tmp, ok := rawArgs["orderBy"]; ok {
+ return ec.unmarshalOPolicyVersionSignatureOrder2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐPolicyVersionSignatureOrder(ctx, tmp)
+ }
+
+ var zeroVal *types.PolicyVersionSignatureOrder
+ return zeroVal, nil
+}
+
func (ec *executionContext) field_Policy_controls_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) {
var err error
args := map[string]any{}
@@ -7390,6 +8090,119 @@ func (ec *executionContext) field_Policy_controls_argsOrderBy(
return zeroVal, nil
}
+func (ec *executionContext) field_Policy_versions_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) {
+ var err error
+ args := map[string]any{}
+ arg0, err := ec.field_Policy_versions_argsFirst(ctx, rawArgs)
+ if err != nil {
+ return nil, err
+ }
+ args["first"] = arg0
+ arg1, err := ec.field_Policy_versions_argsAfter(ctx, rawArgs)
+ if err != nil {
+ return nil, err
+ }
+ args["after"] = arg1
+ arg2, err := ec.field_Policy_versions_argsLast(ctx, rawArgs)
+ if err != nil {
+ return nil, err
+ }
+ args["last"] = arg2
+ arg3, err := ec.field_Policy_versions_argsBefore(ctx, rawArgs)
+ if err != nil {
+ return nil, err
+ }
+ args["before"] = arg3
+ arg4, err := ec.field_Policy_versions_argsOrderBy(ctx, rawArgs)
+ if err != nil {
+ return nil, err
+ }
+ args["orderBy"] = arg4
+ arg5, err := ec.field_Policy_versions_argsFilter(ctx, rawArgs)
+ if err != nil {
+ return nil, err
+ }
+ args["filter"] = arg5
+ return args, nil
+}
+func (ec *executionContext) field_Policy_versions_argsFirst(
+ ctx context.Context,
+ rawArgs map[string]any,
+) (*int, error) {
+ ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("first"))
+ if tmp, ok := rawArgs["first"]; ok {
+ return ec.unmarshalOInt2ᚖint(ctx, tmp)
+ }
+
+ var zeroVal *int
+ return zeroVal, nil
+}
+
+func (ec *executionContext) field_Policy_versions_argsAfter(
+ ctx context.Context,
+ rawArgs map[string]any,
+) (*page.CursorKey, error) {
+ ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("after"))
+ if tmp, ok := rawArgs["after"]; ok {
+ return ec.unmarshalOCursorKey2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋpageᚐCursorKey(ctx, tmp)
+ }
+
+ var zeroVal *page.CursorKey
+ return zeroVal, nil
+}
+
+func (ec *executionContext) field_Policy_versions_argsLast(
+ ctx context.Context,
+ rawArgs map[string]any,
+) (*int, error) {
+ ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("last"))
+ if tmp, ok := rawArgs["last"]; ok {
+ return ec.unmarshalOInt2ᚖint(ctx, tmp)
+ }
+
+ var zeroVal *int
+ return zeroVal, nil
+}
+
+func (ec *executionContext) field_Policy_versions_argsBefore(
+ ctx context.Context,
+ rawArgs map[string]any,
+) (*page.CursorKey, error) {
+ ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("before"))
+ if tmp, ok := rawArgs["before"]; ok {
+ return ec.unmarshalOCursorKey2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋpageᚐCursorKey(ctx, tmp)
+ }
+
+ var zeroVal *page.CursorKey
+ return zeroVal, nil
+}
+
+func (ec *executionContext) field_Policy_versions_argsOrderBy(
+ ctx context.Context,
+ rawArgs map[string]any,
+) (*types.PolicyVersionOrderBy, error) {
+ ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("orderBy"))
+ if tmp, ok := rawArgs["orderBy"]; ok {
+ return ec.unmarshalOPolicyVersionOrder2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐPolicyVersionOrderBy(ctx, tmp)
+ }
+
+ var zeroVal *types.PolicyVersionOrderBy
+ return zeroVal, nil
+}
+
+func (ec *executionContext) field_Policy_versions_argsFilter(
+ ctx context.Context,
+ rawArgs map[string]any,
+) (*types.PolicyVersionFilter, error) {
+ ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("filter"))
+ if tmp, ok := rawArgs["filter"]; ok {
+ return ec.unmarshalOPolicyVersionFilter2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐPolicyVersionFilter(ctx, tmp)
+ }
+
+ var zeroVal *types.PolicyVersionFilter
+ return zeroVal, nil
+}
+
func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) {
var err error
args := map[string]any{}
@@ -9440,6 +10253,56 @@ func (ec *executionContext) fieldContext_CreateControlPolicyMappingPayload_succe
return fc, nil
}
+func (ec *executionContext) _CreateDraftPolicyVersionPayload_policyVersionEdge(ctx context.Context, field graphql.CollectedField, obj *types.CreateDraftPolicyVersionPayload) (ret graphql.Marshaler) {
+ fc, err := ec.fieldContext_CreateDraftPolicyVersionPayload_policyVersionEdge(ctx, field)
+ if err != nil {
+ return graphql.Null
+ }
+ ctx = graphql.WithFieldContext(ctx, fc)
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ ret = graphql.Null
+ }
+ }()
+ resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
+ ctx = rctx // use context from middleware stack in children
+ return obj.PolicyVersionEdge, nil
+ })
+ if err != nil {
+ ec.Error(ctx, err)
+ return graphql.Null
+ }
+ if resTmp == nil {
+ if !graphql.HasFieldError(ctx, fc) {
+ ec.Errorf(ctx, "must not be null")
+ }
+ return graphql.Null
+ }
+ res := resTmp.(*types.PolicyVersionEdge)
+ fc.Result = res
+ return ec.marshalNPolicyVersionEdge2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐPolicyVersionEdge(ctx, field.Selections, res)
+}
+
+func (ec *executionContext) fieldContext_CreateDraftPolicyVersionPayload_policyVersionEdge(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
+ fc = &graphql.FieldContext{
+ Object: "CreateDraftPolicyVersionPayload",
+ Field: field,
+ IsMethod: false,
+ IsResolver: false,
+ Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
+ switch field.Name {
+ case "cursor":
+ return ec.fieldContext_PolicyVersionEdge_cursor(ctx, field)
+ case "node":
+ return ec.fieldContext_PolicyVersionEdge_node(ctx, field)
+ }
+ return nil, fmt.Errorf("no field named %q was found under type PolicyVersionEdge", field.Name)
+ },
+ }
+ return fc, nil
+}
+
func (ec *executionContext) _CreateEvidencePayload_evidenceEdge(ctx context.Context, field graphql.CollectedField, obj *types.CreateEvidencePayload) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_CreateEvidencePayload_evidenceEdge(ctx, field)
if err != nil {
@@ -9740,6 +10603,56 @@ func (ec *executionContext) fieldContext_CreatePolicyPayload_policyEdge(_ contex
return fc, nil
}
+func (ec *executionContext) _CreatePolicyPayload_policyVersionEdge(ctx context.Context, field graphql.CollectedField, obj *types.CreatePolicyPayload) (ret graphql.Marshaler) {
+ fc, err := ec.fieldContext_CreatePolicyPayload_policyVersionEdge(ctx, field)
+ if err != nil {
+ return graphql.Null
+ }
+ ctx = graphql.WithFieldContext(ctx, fc)
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ ret = graphql.Null
+ }
+ }()
+ resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
+ ctx = rctx // use context from middleware stack in children
+ return obj.PolicyVersionEdge, nil
+ })
+ if err != nil {
+ ec.Error(ctx, err)
+ return graphql.Null
+ }
+ if resTmp == nil {
+ if !graphql.HasFieldError(ctx, fc) {
+ ec.Errorf(ctx, "must not be null")
+ }
+ return graphql.Null
+ }
+ res := resTmp.(*types.PolicyVersionEdge)
+ fc.Result = res
+ return ec.marshalNPolicyVersionEdge2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐPolicyVersionEdge(ctx, field.Selections, res)
+}
+
+func (ec *executionContext) fieldContext_CreatePolicyPayload_policyVersionEdge(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
+ fc = &graphql.FieldContext{
+ Object: "CreatePolicyPayload",
+ Field: field,
+ IsMethod: false,
+ IsResolver: false,
+ Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
+ switch field.Name {
+ case "cursor":
+ return ec.fieldContext_PolicyVersionEdge_cursor(ctx, field)
+ case "node":
+ return ec.fieldContext_PolicyVersionEdge_node(ctx, field)
+ }
+ return nil, fmt.Errorf("no field named %q was found under type PolicyVersionEdge", field.Name)
+ },
+ }
+ return fc, nil
+}
+
func (ec *executionContext) _CreateRiskMesureMappingPayload_success(ctx context.Context, field graphql.CollectedField, obj *types.CreateRiskMesureMappingPayload) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_CreateRiskMesureMappingPayload_success(ctx, field)
if err != nil {
@@ -15243,6 +16156,8 @@ func (ec *executionContext) fieldContext_Mutation_createPolicy(ctx context.Conte
switch field.Name {
case "policyEdge":
return ec.fieldContext_CreatePolicyPayload_policyEdge(ctx, field)
+ case "policyVersionEdge":
+ return ec.fieldContext_CreatePolicyPayload_policyVersionEdge(ctx, field)
}
return nil, fmt.Errorf("no field named %q was found under type CreatePolicyPayload", field.Name)
},
@@ -15261,65 +16176,6 @@ func (ec *executionContext) fieldContext_Mutation_createPolicy(ctx context.Conte
return fc, nil
}
-func (ec *executionContext) _Mutation_updatePolicy(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Mutation_updatePolicy(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Mutation().UpdatePolicy(rctx, fc.Args["input"].(types.UpdatePolicyInput))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(*types.UpdatePolicyPayload)
- fc.Result = res
- return ec.marshalNUpdatePolicyPayload2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐUpdatePolicyPayload(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Mutation_updatePolicy(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Mutation",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "policy":
- return ec.fieldContext_UpdatePolicyPayload_policy(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type UpdatePolicyPayload", field.Name)
- },
- }
- defer func() {
- if r := recover(); r != nil {
- err = ec.Recover(ctx, r)
- ec.Error(ctx, err)
- }
- }()
- ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_Mutation_updatePolicy_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
- ec.Error(ctx, err)
- return fc, err
- }
- return fc, nil
-}
-
func (ec *executionContext) _Mutation_deletePolicy(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_Mutation_deletePolicy(ctx, field)
if err != nil {
@@ -15379,6 +16235,244 @@ func (ec *executionContext) fieldContext_Mutation_deletePolicy(ctx context.Conte
return fc, nil
}
+func (ec *executionContext) _Mutation_publishPolicyVersion(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
+ fc, err := ec.fieldContext_Mutation_publishPolicyVersion(ctx, field)
+ if err != nil {
+ return graphql.Null
+ }
+ ctx = graphql.WithFieldContext(ctx, fc)
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ ret = graphql.Null
+ }
+ }()
+ resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
+ ctx = rctx // use context from middleware stack in children
+ return ec.resolvers.Mutation().PublishPolicyVersion(rctx, fc.Args["input"].(types.PublishPolicyVersionInput))
+ })
+ if err != nil {
+ ec.Error(ctx, err)
+ return graphql.Null
+ }
+ if resTmp == nil {
+ if !graphql.HasFieldError(ctx, fc) {
+ ec.Errorf(ctx, "must not be null")
+ }
+ return graphql.Null
+ }
+ res := resTmp.(*types.PublishPolicyVersionPayload)
+ fc.Result = res
+ return ec.marshalNPublishPolicyVersionPayload2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐPublishPolicyVersionPayload(ctx, field.Selections, res)
+}
+
+func (ec *executionContext) fieldContext_Mutation_publishPolicyVersion(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
+ fc = &graphql.FieldContext{
+ Object: "Mutation",
+ Field: field,
+ IsMethod: true,
+ IsResolver: true,
+ Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
+ switch field.Name {
+ case "policyVersion":
+ return ec.fieldContext_PublishPolicyVersionPayload_policyVersion(ctx, field)
+ case "policy":
+ return ec.fieldContext_PublishPolicyVersionPayload_policy(ctx, field)
+ }
+ return nil, fmt.Errorf("no field named %q was found under type PublishPolicyVersionPayload", field.Name)
+ },
+ }
+ defer func() {
+ if r := recover(); r != nil {
+ err = ec.Recover(ctx, r)
+ ec.Error(ctx, err)
+ }
+ }()
+ ctx = graphql.WithFieldContext(ctx, fc)
+ if fc.Args, err = ec.field_Mutation_publishPolicyVersion_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
+ ec.Error(ctx, err)
+ return fc, err
+ }
+ return fc, nil
+}
+
+func (ec *executionContext) _Mutation_createDraftPolicyVersion(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
+ fc, err := ec.fieldContext_Mutation_createDraftPolicyVersion(ctx, field)
+ if err != nil {
+ return graphql.Null
+ }
+ ctx = graphql.WithFieldContext(ctx, fc)
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ ret = graphql.Null
+ }
+ }()
+ resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
+ ctx = rctx // use context from middleware stack in children
+ return ec.resolvers.Mutation().CreateDraftPolicyVersion(rctx, fc.Args["input"].(types.CreateDraftPolicyVersionInput))
+ })
+ if err != nil {
+ ec.Error(ctx, err)
+ return graphql.Null
+ }
+ if resTmp == nil {
+ if !graphql.HasFieldError(ctx, fc) {
+ ec.Errorf(ctx, "must not be null")
+ }
+ return graphql.Null
+ }
+ res := resTmp.(*types.CreateDraftPolicyVersionPayload)
+ fc.Result = res
+ return ec.marshalNCreateDraftPolicyVersionPayload2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐCreateDraftPolicyVersionPayload(ctx, field.Selections, res)
+}
+
+func (ec *executionContext) fieldContext_Mutation_createDraftPolicyVersion(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
+ fc = &graphql.FieldContext{
+ Object: "Mutation",
+ Field: field,
+ IsMethod: true,
+ IsResolver: true,
+ Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
+ switch field.Name {
+ case "policyVersionEdge":
+ return ec.fieldContext_CreateDraftPolicyVersionPayload_policyVersionEdge(ctx, field)
+ }
+ return nil, fmt.Errorf("no field named %q was found under type CreateDraftPolicyVersionPayload", field.Name)
+ },
+ }
+ defer func() {
+ if r := recover(); r != nil {
+ err = ec.Recover(ctx, r)
+ ec.Error(ctx, err)
+ }
+ }()
+ ctx = graphql.WithFieldContext(ctx, fc)
+ if fc.Args, err = ec.field_Mutation_createDraftPolicyVersion_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
+ ec.Error(ctx, err)
+ return fc, err
+ }
+ return fc, nil
+}
+
+func (ec *executionContext) _Mutation_updatePolicyVersion(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
+ fc, err := ec.fieldContext_Mutation_updatePolicyVersion(ctx, field)
+ if err != nil {
+ return graphql.Null
+ }
+ ctx = graphql.WithFieldContext(ctx, fc)
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ ret = graphql.Null
+ }
+ }()
+ resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
+ ctx = rctx // use context from middleware stack in children
+ return ec.resolvers.Mutation().UpdatePolicyVersion(rctx, fc.Args["input"].(types.UpdatePolicyVersionInput))
+ })
+ if err != nil {
+ ec.Error(ctx, err)
+ return graphql.Null
+ }
+ if resTmp == nil {
+ if !graphql.HasFieldError(ctx, fc) {
+ ec.Errorf(ctx, "must not be null")
+ }
+ return graphql.Null
+ }
+ res := resTmp.(*types.UpdatePolicyVersionPayload)
+ fc.Result = res
+ return ec.marshalNUpdatePolicyVersionPayload2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐUpdatePolicyVersionPayload(ctx, field.Selections, res)
+}
+
+func (ec *executionContext) fieldContext_Mutation_updatePolicyVersion(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
+ fc = &graphql.FieldContext{
+ Object: "Mutation",
+ Field: field,
+ IsMethod: true,
+ IsResolver: true,
+ Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
+ switch field.Name {
+ case "policyVersion":
+ return ec.fieldContext_UpdatePolicyVersionPayload_policyVersion(ctx, field)
+ }
+ return nil, fmt.Errorf("no field named %q was found under type UpdatePolicyVersionPayload", field.Name)
+ },
+ }
+ defer func() {
+ if r := recover(); r != nil {
+ err = ec.Recover(ctx, r)
+ ec.Error(ctx, err)
+ }
+ }()
+ ctx = graphql.WithFieldContext(ctx, fc)
+ if fc.Args, err = ec.field_Mutation_updatePolicyVersion_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
+ ec.Error(ctx, err)
+ return fc, err
+ }
+ return fc, nil
+}
+
+func (ec *executionContext) _Mutation_requestSignature(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
+ fc, err := ec.fieldContext_Mutation_requestSignature(ctx, field)
+ if err != nil {
+ return graphql.Null
+ }
+ ctx = graphql.WithFieldContext(ctx, fc)
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ ret = graphql.Null
+ }
+ }()
+ resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
+ ctx = rctx // use context from middleware stack in children
+ return ec.resolvers.Mutation().RequestSignature(rctx, fc.Args["input"].(types.RequestSignatureInput))
+ })
+ if err != nil {
+ ec.Error(ctx, err)
+ return graphql.Null
+ }
+ if resTmp == nil {
+ if !graphql.HasFieldError(ctx, fc) {
+ ec.Errorf(ctx, "must not be null")
+ }
+ return graphql.Null
+ }
+ res := resTmp.(*types.RequestSignaturePayload)
+ fc.Result = res
+ return ec.marshalNRequestSignaturePayload2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐRequestSignaturePayload(ctx, field.Selections, res)
+}
+
+func (ec *executionContext) fieldContext_Mutation_requestSignature(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
+ fc = &graphql.FieldContext{
+ Object: "Mutation",
+ Field: field,
+ IsMethod: true,
+ IsResolver: true,
+ Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
+ switch field.Name {
+ case "policyVersionSignatureEdge":
+ return ec.fieldContext_RequestSignaturePayload_policyVersionSignatureEdge(ctx, field)
+ }
+ return nil, fmt.Errorf("no field named %q was found under type RequestSignaturePayload", field.Name)
+ },
+ }
+ defer func() {
+ if r := recover(); r != nil {
+ err = ec.Recover(ctx, r)
+ ec.Error(ctx, err)
+ }
+ }()
+ ctx = graphql.WithFieldContext(ctx, fc)
+ if fc.Args, err = ec.field_Mutation_requestSignature_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
+ ec.Error(ctx, err)
+ return fc, err
+ }
+ return fc, nil
+}
+
func (ec *executionContext) _Mutation_createVendorRiskAssessment(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_Mutation_createVendorRiskAssessment(ctx, field)
if err != nil {
@@ -17093,8 +18187,8 @@ func (ec *executionContext) fieldContext_Policy_id(_ context.Context, field grap
return fc, nil
}
-func (ec *executionContext) _Policy_name(ctx context.Context, field graphql.CollectedField, obj *types.Policy) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Policy_name(ctx, field)
+func (ec *executionContext) _Policy_title(ctx context.Context, field graphql.CollectedField, obj *types.Policy) (ret graphql.Marshaler) {
+ fc, err := ec.fieldContext_Policy_title(ctx, field)
if err != nil {
return graphql.Null
}
@@ -17107,7 +18201,7 @@ func (ec *executionContext) _Policy_name(ctx context.Context, field graphql.Coll
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
ctx = rctx // use context from middleware stack in children
- return obj.Name, nil
+ return obj.Title, nil
})
if err != nil {
ec.Error(ctx, err)
@@ -17124,7 +18218,7 @@ func (ec *executionContext) _Policy_name(ctx context.Context, field graphql.Coll
return ec.marshalNString2string(ctx, field.Selections, res)
}
-func (ec *executionContext) fieldContext_Policy_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
+func (ec *executionContext) fieldContext_Policy_title(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
fc = &graphql.FieldContext{
Object: "Policy",
Field: field,
@@ -17137,8 +18231,8 @@ func (ec *executionContext) fieldContext_Policy_name(_ context.Context, field gr
return fc, nil
}
-func (ec *executionContext) _Policy_status(ctx context.Context, field graphql.CollectedField, obj *types.Policy) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Policy_status(ctx, field)
+func (ec *executionContext) _Policy_description(ctx context.Context, field graphql.CollectedField, obj *types.Policy) (ret graphql.Marshaler) {
+ fc, err := ec.fieldContext_Policy_description(ctx, field)
if err != nil {
return graphql.Null
}
@@ -17151,51 +18245,7 @@ func (ec *executionContext) _Policy_status(ctx context.Context, field graphql.Co
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
ctx = rctx // use context from middleware stack in children
- return obj.Status, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(coredata.PolicyStatus)
- fc.Result = res
- return ec.marshalNPolicyStatus2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐPolicyStatus(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) fieldContext_Policy_status(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "Policy",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type PolicyStatus does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _Policy_content(ctx context.Context, field graphql.CollectedField, obj *types.Policy) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Policy_content(ctx, field)
- if err != nil {
- return graphql.Null
- }
- ctx = graphql.WithFieldContext(ctx, fc)
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Content, nil
+ return obj.Description, nil
})
if err != nil {
ec.Error(ctx, err)
@@ -17212,7 +18262,7 @@ func (ec *executionContext) _Policy_content(ctx context.Context, field graphql.C
return ec.marshalNString2string(ctx, field.Selections, res)
}
-func (ec *executionContext) fieldContext_Policy_content(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
+func (ec *executionContext) fieldContext_Policy_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
fc = &graphql.FieldContext{
Object: "Policy",
Field: field,
@@ -17225,8 +18275,8 @@ func (ec *executionContext) fieldContext_Policy_content(_ context.Context, field
return fc, nil
}
-func (ec *executionContext) _Policy_reviewDate(ctx context.Context, field graphql.CollectedField, obj *types.Policy) (ret graphql.Marshaler) {
- fc, err := ec.fieldContext_Policy_reviewDate(ctx, field)
+func (ec *executionContext) _Policy_currentPublishedVersion(ctx context.Context, field graphql.CollectedField, obj *types.Policy) (ret graphql.Marshaler) {
+ fc, err := ec.fieldContext_Policy_currentPublishedVersion(ctx, field)
if err != nil {
return graphql.Null
}
@@ -17239,7 +18289,7 @@ func (ec *executionContext) _Policy_reviewDate(ctx context.Context, field graphq
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
ctx = rctx // use context from middleware stack in children
- return obj.ReviewDate, nil
+ return obj.CurrentPublishedVersion, nil
})
if err != nil {
ec.Error(ctx, err)
@@ -17248,19 +18298,19 @@ func (ec *executionContext) _Policy_reviewDate(ctx context.Context, field graphq
if resTmp == nil {
return graphql.Null
}
- res := resTmp.(*time.Time)
+ res := resTmp.(*int)
fc.Result = res
- return ec.marshalODatetime2ᚖtimeᚐTime(ctx, field.Selections, res)
+ return ec.marshalOInt2ᚖint(ctx, field.Selections, res)
}
-func (ec *executionContext) fieldContext_Policy_reviewDate(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
+func (ec *executionContext) fieldContext_Policy_currentPublishedVersion(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
fc = &graphql.FieldContext{
Object: "Policy",
Field: field,
IsMethod: false,
IsResolver: false,
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Datetime does not have child fields")
+ return nil, errors.New("field of type Int does not have child fields")
},
}
return fc, nil
@@ -17326,6 +18376,67 @@ func (ec *executionContext) fieldContext_Policy_owner(_ context.Context, field g
return fc, nil
}
+func (ec *executionContext) _Policy_versions(ctx context.Context, field graphql.CollectedField, obj *types.Policy) (ret graphql.Marshaler) {
+ fc, err := ec.fieldContext_Policy_versions(ctx, field)
+ if err != nil {
+ return graphql.Null
+ }
+ ctx = graphql.WithFieldContext(ctx, fc)
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ ret = graphql.Null
+ }
+ }()
+ resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
+ ctx = rctx // use context from middleware stack in children
+ return ec.resolvers.Policy().Versions(rctx, obj, fc.Args["first"].(*int), fc.Args["after"].(*page.CursorKey), fc.Args["last"].(*int), fc.Args["before"].(*page.CursorKey), fc.Args["orderBy"].(*types.PolicyVersionOrderBy), fc.Args["filter"].(*types.PolicyVersionFilter))
+ })
+ if err != nil {
+ ec.Error(ctx, err)
+ return graphql.Null
+ }
+ if resTmp == nil {
+ if !graphql.HasFieldError(ctx, fc) {
+ ec.Errorf(ctx, "must not be null")
+ }
+ return graphql.Null
+ }
+ res := resTmp.(*types.PolicyVersionConnection)
+ fc.Result = res
+ return ec.marshalNPolicyVersionConnection2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐPolicyVersionConnection(ctx, field.Selections, res)
+}
+
+func (ec *executionContext) fieldContext_Policy_versions(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
+ fc = &graphql.FieldContext{
+ Object: "Policy",
+ Field: field,
+ IsMethod: true,
+ IsResolver: true,
+ Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
+ switch field.Name {
+ case "edges":
+ return ec.fieldContext_PolicyVersionConnection_edges(ctx, field)
+ case "pageInfo":
+ return ec.fieldContext_PolicyVersionConnection_pageInfo(ctx, field)
+ }
+ return nil, fmt.Errorf("no field named %q was found under type PolicyVersionConnection", field.Name)
+ },
+ }
+ defer func() {
+ if r := recover(); r != nil {
+ err = ec.Recover(ctx, r)
+ ec.Error(ctx, err)
+ }
+ }()
+ ctx = graphql.WithFieldContext(ctx, fc)
+ if fc.Args, err = ec.field_Policy_versions_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
+ ec.Error(ctx, err)
+ return fc, err
+ }
+ return fc, nil
+}
+
func (ec *executionContext) _Policy_controls(ctx context.Context, field graphql.CollectedField, obj *types.Policy) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_Policy_controls(ctx, field)
if err != nil {
@@ -17664,16 +18775,1556 @@ func (ec *executionContext) fieldContext_PolicyEdge_node(_ context.Context, fiel
switch field.Name {
case "id":
return ec.fieldContext_Policy_id(ctx, field)
- case "name":
- return ec.fieldContext_Policy_name(ctx, field)
- case "status":
- return ec.fieldContext_Policy_status(ctx, field)
- case "content":
- return ec.fieldContext_Policy_content(ctx, field)
- case "reviewDate":
- return ec.fieldContext_Policy_reviewDate(ctx, field)
+ case "title":
+ return ec.fieldContext_Policy_title(ctx, field)
+ case "description":
+ return ec.fieldContext_Policy_description(ctx, field)
+ case "currentPublishedVersion":
+ return ec.fieldContext_Policy_currentPublishedVersion(ctx, field)
case "owner":
return ec.fieldContext_Policy_owner(ctx, field)
+ case "versions":
+ return ec.fieldContext_Policy_versions(ctx, field)
+ case "controls":
+ return ec.fieldContext_Policy_controls(ctx, field)
+ case "createdAt":
+ return ec.fieldContext_Policy_createdAt(ctx, field)
+ case "updatedAt":
+ return ec.fieldContext_Policy_updatedAt(ctx, field)
+ }
+ return nil, fmt.Errorf("no field named %q was found under type Policy", field.Name)
+ },
+ }
+ return fc, nil
+}
+
+func (ec *executionContext) _PolicyVersion_id(ctx context.Context, field graphql.CollectedField, obj *types.PolicyVersion) (ret graphql.Marshaler) {
+ fc, err := ec.fieldContext_PolicyVersion_id(ctx, field)
+ if err != nil {
+ return graphql.Null
+ }
+ ctx = graphql.WithFieldContext(ctx, fc)
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ ret = graphql.Null
+ }
+ }()
+ resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
+ ctx = rctx // use context from middleware stack in children
+ return obj.ID, nil
+ })
+ if err != nil {
+ ec.Error(ctx, err)
+ return graphql.Null
+ }
+ if resTmp == nil {
+ if !graphql.HasFieldError(ctx, fc) {
+ ec.Errorf(ctx, "must not be null")
+ }
+ return graphql.Null
+ }
+ res := resTmp.(gid.GID)
+ fc.Result = res
+ return ec.marshalNID2githubᚗcomᚋgetproboᚋproboᚋpkgᚋgidᚐGID(ctx, field.Selections, res)
+}
+
+func (ec *executionContext) fieldContext_PolicyVersion_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
+ fc = &graphql.FieldContext{
+ Object: "PolicyVersion",
+ Field: field,
+ IsMethod: false,
+ IsResolver: false,
+ Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
+ return nil, errors.New("field of type ID does not have child fields")
+ },
+ }
+ return fc, nil
+}
+
+func (ec *executionContext) _PolicyVersion_policy(ctx context.Context, field graphql.CollectedField, obj *types.PolicyVersion) (ret graphql.Marshaler) {
+ fc, err := ec.fieldContext_PolicyVersion_policy(ctx, field)
+ if err != nil {
+ return graphql.Null
+ }
+ ctx = graphql.WithFieldContext(ctx, fc)
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ ret = graphql.Null
+ }
+ }()
+ resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
+ ctx = rctx // use context from middleware stack in children
+ return ec.resolvers.PolicyVersion().Policy(rctx, obj)
+ })
+ if err != nil {
+ ec.Error(ctx, err)
+ return graphql.Null
+ }
+ if resTmp == nil {
+ if !graphql.HasFieldError(ctx, fc) {
+ ec.Errorf(ctx, "must not be null")
+ }
+ return graphql.Null
+ }
+ res := resTmp.(*types.Policy)
+ fc.Result = res
+ return ec.marshalNPolicy2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐPolicy(ctx, field.Selections, res)
+}
+
+func (ec *executionContext) fieldContext_PolicyVersion_policy(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
+ fc = &graphql.FieldContext{
+ Object: "PolicyVersion",
+ Field: field,
+ IsMethod: true,
+ IsResolver: true,
+ Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
+ switch field.Name {
+ case "id":
+ return ec.fieldContext_Policy_id(ctx, field)
+ case "title":
+ return ec.fieldContext_Policy_title(ctx, field)
+ case "description":
+ return ec.fieldContext_Policy_description(ctx, field)
+ case "currentPublishedVersion":
+ return ec.fieldContext_Policy_currentPublishedVersion(ctx, field)
+ case "owner":
+ return ec.fieldContext_Policy_owner(ctx, field)
+ case "versions":
+ return ec.fieldContext_Policy_versions(ctx, field)
+ case "controls":
+ return ec.fieldContext_Policy_controls(ctx, field)
+ case "createdAt":
+ return ec.fieldContext_Policy_createdAt(ctx, field)
+ case "updatedAt":
+ return ec.fieldContext_Policy_updatedAt(ctx, field)
+ }
+ return nil, fmt.Errorf("no field named %q was found under type Policy", field.Name)
+ },
+ }
+ return fc, nil
+}
+
+func (ec *executionContext) _PolicyVersion_status(ctx context.Context, field graphql.CollectedField, obj *types.PolicyVersion) (ret graphql.Marshaler) {
+ fc, err := ec.fieldContext_PolicyVersion_status(ctx, field)
+ if err != nil {
+ return graphql.Null
+ }
+ ctx = graphql.WithFieldContext(ctx, fc)
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ ret = graphql.Null
+ }
+ }()
+ resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
+ ctx = rctx // use context from middleware stack in children
+ return obj.Status, nil
+ })
+ if err != nil {
+ ec.Error(ctx, err)
+ return graphql.Null
+ }
+ if resTmp == nil {
+ if !graphql.HasFieldError(ctx, fc) {
+ ec.Errorf(ctx, "must not be null")
+ }
+ return graphql.Null
+ }
+ res := resTmp.(coredata.PolicyStatus)
+ fc.Result = res
+ return ec.marshalNPolicyStatus2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐPolicyStatus(ctx, field.Selections, res)
+}
+
+func (ec *executionContext) fieldContext_PolicyVersion_status(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
+ fc = &graphql.FieldContext{
+ Object: "PolicyVersion",
+ Field: field,
+ IsMethod: false,
+ IsResolver: false,
+ Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
+ return nil, errors.New("field of type PolicyStatus does not have child fields")
+ },
+ }
+ return fc, nil
+}
+
+func (ec *executionContext) _PolicyVersion_version(ctx context.Context, field graphql.CollectedField, obj *types.PolicyVersion) (ret graphql.Marshaler) {
+ fc, err := ec.fieldContext_PolicyVersion_version(ctx, field)
+ if err != nil {
+ return graphql.Null
+ }
+ ctx = graphql.WithFieldContext(ctx, fc)
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ ret = graphql.Null
+ }
+ }()
+ resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
+ ctx = rctx // use context from middleware stack in children
+ return obj.Version, nil
+ })
+ if err != nil {
+ ec.Error(ctx, err)
+ return graphql.Null
+ }
+ if resTmp == nil {
+ if !graphql.HasFieldError(ctx, fc) {
+ ec.Errorf(ctx, "must not be null")
+ }
+ return graphql.Null
+ }
+ res := resTmp.(int)
+ fc.Result = res
+ return ec.marshalNInt2int(ctx, field.Selections, res)
+}
+
+func (ec *executionContext) fieldContext_PolicyVersion_version(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
+ fc = &graphql.FieldContext{
+ Object: "PolicyVersion",
+ Field: field,
+ IsMethod: false,
+ IsResolver: false,
+ Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
+ return nil, errors.New("field of type Int does not have child fields")
+ },
+ }
+ return fc, nil
+}
+
+func (ec *executionContext) _PolicyVersion_content(ctx context.Context, field graphql.CollectedField, obj *types.PolicyVersion) (ret graphql.Marshaler) {
+ fc, err := ec.fieldContext_PolicyVersion_content(ctx, field)
+ if err != nil {
+ return graphql.Null
+ }
+ ctx = graphql.WithFieldContext(ctx, fc)
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ ret = graphql.Null
+ }
+ }()
+ resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
+ ctx = rctx // use context from middleware stack in children
+ return obj.Content, nil
+ })
+ if err != nil {
+ ec.Error(ctx, err)
+ return graphql.Null
+ }
+ if resTmp == nil {
+ if !graphql.HasFieldError(ctx, fc) {
+ ec.Errorf(ctx, "must not be null")
+ }
+ return graphql.Null
+ }
+ res := resTmp.(string)
+ fc.Result = res
+ return ec.marshalNString2string(ctx, field.Selections, res)
+}
+
+func (ec *executionContext) fieldContext_PolicyVersion_content(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
+ fc = &graphql.FieldContext{
+ Object: "PolicyVersion",
+ Field: field,
+ IsMethod: false,
+ IsResolver: false,
+ Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
+ return nil, errors.New("field of type String does not have child fields")
+ },
+ }
+ return fc, nil
+}
+
+func (ec *executionContext) _PolicyVersion_changelog(ctx context.Context, field graphql.CollectedField, obj *types.PolicyVersion) (ret graphql.Marshaler) {
+ fc, err := ec.fieldContext_PolicyVersion_changelog(ctx, field)
+ if err != nil {
+ return graphql.Null
+ }
+ ctx = graphql.WithFieldContext(ctx, fc)
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ ret = graphql.Null
+ }
+ }()
+ resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
+ ctx = rctx // use context from middleware stack in children
+ return obj.Changelog, nil
+ })
+ if err != nil {
+ ec.Error(ctx, err)
+ return graphql.Null
+ }
+ if resTmp == nil {
+ if !graphql.HasFieldError(ctx, fc) {
+ ec.Errorf(ctx, "must not be null")
+ }
+ return graphql.Null
+ }
+ res := resTmp.(string)
+ fc.Result = res
+ return ec.marshalNString2string(ctx, field.Selections, res)
+}
+
+func (ec *executionContext) fieldContext_PolicyVersion_changelog(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
+ fc = &graphql.FieldContext{
+ Object: "PolicyVersion",
+ Field: field,
+ IsMethod: false,
+ IsResolver: false,
+ Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
+ return nil, errors.New("field of type String does not have child fields")
+ },
+ }
+ return fc, nil
+}
+
+func (ec *executionContext) _PolicyVersion_signatures(ctx context.Context, field graphql.CollectedField, obj *types.PolicyVersion) (ret graphql.Marshaler) {
+ fc, err := ec.fieldContext_PolicyVersion_signatures(ctx, field)
+ if err != nil {
+ return graphql.Null
+ }
+ ctx = graphql.WithFieldContext(ctx, fc)
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ ret = graphql.Null
+ }
+ }()
+ resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
+ ctx = rctx // use context from middleware stack in children
+ return ec.resolvers.PolicyVersion().Signatures(rctx, obj, fc.Args["first"].(*int), fc.Args["after"].(*page.CursorKey), fc.Args["last"].(*int), fc.Args["before"].(*page.CursorKey), fc.Args["orderBy"].(*types.PolicyVersionSignatureOrder))
+ })
+ if err != nil {
+ ec.Error(ctx, err)
+ return graphql.Null
+ }
+ if resTmp == nil {
+ if !graphql.HasFieldError(ctx, fc) {
+ ec.Errorf(ctx, "must not be null")
+ }
+ return graphql.Null
+ }
+ res := resTmp.(*types.PolicyVersionSignatureConnection)
+ fc.Result = res
+ return ec.marshalNPolicyVersionSignatureConnection2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐPolicyVersionSignatureConnection(ctx, field.Selections, res)
+}
+
+func (ec *executionContext) fieldContext_PolicyVersion_signatures(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
+ fc = &graphql.FieldContext{
+ Object: "PolicyVersion",
+ Field: field,
+ IsMethod: true,
+ IsResolver: true,
+ Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
+ switch field.Name {
+ case "edges":
+ return ec.fieldContext_PolicyVersionSignatureConnection_edges(ctx, field)
+ case "pageInfo":
+ return ec.fieldContext_PolicyVersionSignatureConnection_pageInfo(ctx, field)
+ }
+ return nil, fmt.Errorf("no field named %q was found under type PolicyVersionSignatureConnection", field.Name)
+ },
+ }
+ defer func() {
+ if r := recover(); r != nil {
+ err = ec.Recover(ctx, r)
+ ec.Error(ctx, err)
+ }
+ }()
+ ctx = graphql.WithFieldContext(ctx, fc)
+ if fc.Args, err = ec.field_PolicyVersion_signatures_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
+ ec.Error(ctx, err)
+ return fc, err
+ }
+ return fc, nil
+}
+
+func (ec *executionContext) _PolicyVersion_publishedBy(ctx context.Context, field graphql.CollectedField, obj *types.PolicyVersion) (ret graphql.Marshaler) {
+ fc, err := ec.fieldContext_PolicyVersion_publishedBy(ctx, field)
+ if err != nil {
+ return graphql.Null
+ }
+ ctx = graphql.WithFieldContext(ctx, fc)
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ ret = graphql.Null
+ }
+ }()
+ resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
+ ctx = rctx // use context from middleware stack in children
+ return ec.resolvers.PolicyVersion().PublishedBy(rctx, obj)
+ })
+ if err != nil {
+ ec.Error(ctx, err)
+ return graphql.Null
+ }
+ if resTmp == nil {
+ return graphql.Null
+ }
+ res := resTmp.(*types.People)
+ fc.Result = res
+ return ec.marshalOPeople2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐPeople(ctx, field.Selections, res)
+}
+
+func (ec *executionContext) fieldContext_PolicyVersion_publishedBy(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
+ fc = &graphql.FieldContext{
+ Object: "PolicyVersion",
+ Field: field,
+ IsMethod: true,
+ IsResolver: true,
+ Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
+ switch field.Name {
+ case "id":
+ return ec.fieldContext_People_id(ctx, field)
+ case "fullName":
+ return ec.fieldContext_People_fullName(ctx, field)
+ case "primaryEmailAddress":
+ return ec.fieldContext_People_primaryEmailAddress(ctx, field)
+ case "additionalEmailAddresses":
+ return ec.fieldContext_People_additionalEmailAddresses(ctx, field)
+ case "kind":
+ return ec.fieldContext_People_kind(ctx, field)
+ case "createdAt":
+ return ec.fieldContext_People_createdAt(ctx, field)
+ case "updatedAt":
+ return ec.fieldContext_People_updatedAt(ctx, field)
+ }
+ return nil, fmt.Errorf("no field named %q was found under type People", field.Name)
+ },
+ }
+ return fc, nil
+}
+
+func (ec *executionContext) _PolicyVersion_publishedAt(ctx context.Context, field graphql.CollectedField, obj *types.PolicyVersion) (ret graphql.Marshaler) {
+ fc, err := ec.fieldContext_PolicyVersion_publishedAt(ctx, field)
+ if err != nil {
+ return graphql.Null
+ }
+ ctx = graphql.WithFieldContext(ctx, fc)
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ ret = graphql.Null
+ }
+ }()
+ resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
+ ctx = rctx // use context from middleware stack in children
+ return obj.PublishedAt, nil
+ })
+ if err != nil {
+ ec.Error(ctx, err)
+ return graphql.Null
+ }
+ if resTmp == nil {
+ return graphql.Null
+ }
+ res := resTmp.(*time.Time)
+ fc.Result = res
+ return ec.marshalODatetime2ᚖtimeᚐTime(ctx, field.Selections, res)
+}
+
+func (ec *executionContext) fieldContext_PolicyVersion_publishedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
+ fc = &graphql.FieldContext{
+ Object: "PolicyVersion",
+ Field: field,
+ IsMethod: false,
+ IsResolver: false,
+ Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
+ return nil, errors.New("field of type Datetime does not have child fields")
+ },
+ }
+ return fc, nil
+}
+
+func (ec *executionContext) _PolicyVersion_createdAt(ctx context.Context, field graphql.CollectedField, obj *types.PolicyVersion) (ret graphql.Marshaler) {
+ fc, err := ec.fieldContext_PolicyVersion_createdAt(ctx, field)
+ if err != nil {
+ return graphql.Null
+ }
+ ctx = graphql.WithFieldContext(ctx, fc)
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ ret = graphql.Null
+ }
+ }()
+ resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
+ ctx = rctx // use context from middleware stack in children
+ return obj.CreatedAt, nil
+ })
+ if err != nil {
+ ec.Error(ctx, err)
+ return graphql.Null
+ }
+ if resTmp == nil {
+ if !graphql.HasFieldError(ctx, fc) {
+ ec.Errorf(ctx, "must not be null")
+ }
+ return graphql.Null
+ }
+ res := resTmp.(time.Time)
+ fc.Result = res
+ return ec.marshalNDatetime2timeᚐTime(ctx, field.Selections, res)
+}
+
+func (ec *executionContext) fieldContext_PolicyVersion_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
+ fc = &graphql.FieldContext{
+ Object: "PolicyVersion",
+ Field: field,
+ IsMethod: false,
+ IsResolver: false,
+ Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
+ return nil, errors.New("field of type Datetime does not have child fields")
+ },
+ }
+ return fc, nil
+}
+
+func (ec *executionContext) _PolicyVersion_updatedAt(ctx context.Context, field graphql.CollectedField, obj *types.PolicyVersion) (ret graphql.Marshaler) {
+ fc, err := ec.fieldContext_PolicyVersion_updatedAt(ctx, field)
+ if err != nil {
+ return graphql.Null
+ }
+ ctx = graphql.WithFieldContext(ctx, fc)
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ ret = graphql.Null
+ }
+ }()
+ resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
+ ctx = rctx // use context from middleware stack in children
+ return obj.UpdatedAt, nil
+ })
+ if err != nil {
+ ec.Error(ctx, err)
+ return graphql.Null
+ }
+ if resTmp == nil {
+ if !graphql.HasFieldError(ctx, fc) {
+ ec.Errorf(ctx, "must not be null")
+ }
+ return graphql.Null
+ }
+ res := resTmp.(time.Time)
+ fc.Result = res
+ return ec.marshalNDatetime2timeᚐTime(ctx, field.Selections, res)
+}
+
+func (ec *executionContext) fieldContext_PolicyVersion_updatedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
+ fc = &graphql.FieldContext{
+ Object: "PolicyVersion",
+ Field: field,
+ IsMethod: false,
+ IsResolver: false,
+ Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
+ return nil, errors.New("field of type Datetime does not have child fields")
+ },
+ }
+ return fc, nil
+}
+
+func (ec *executionContext) _PolicyVersionConnection_edges(ctx context.Context, field graphql.CollectedField, obj *types.PolicyVersionConnection) (ret graphql.Marshaler) {
+ fc, err := ec.fieldContext_PolicyVersionConnection_edges(ctx, field)
+ if err != nil {
+ return graphql.Null
+ }
+ ctx = graphql.WithFieldContext(ctx, fc)
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ ret = graphql.Null
+ }
+ }()
+ resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
+ ctx = rctx // use context from middleware stack in children
+ return obj.Edges, nil
+ })
+ if err != nil {
+ ec.Error(ctx, err)
+ return graphql.Null
+ }
+ if resTmp == nil {
+ if !graphql.HasFieldError(ctx, fc) {
+ ec.Errorf(ctx, "must not be null")
+ }
+ return graphql.Null
+ }
+ res := resTmp.([]*types.PolicyVersionEdge)
+ fc.Result = res
+ return ec.marshalNPolicyVersionEdge2ᚕᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐPolicyVersionEdgeᚄ(ctx, field.Selections, res)
+}
+
+func (ec *executionContext) fieldContext_PolicyVersionConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
+ fc = &graphql.FieldContext{
+ Object: "PolicyVersionConnection",
+ Field: field,
+ IsMethod: false,
+ IsResolver: false,
+ Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
+ switch field.Name {
+ case "cursor":
+ return ec.fieldContext_PolicyVersionEdge_cursor(ctx, field)
+ case "node":
+ return ec.fieldContext_PolicyVersionEdge_node(ctx, field)
+ }
+ return nil, fmt.Errorf("no field named %q was found under type PolicyVersionEdge", field.Name)
+ },
+ }
+ return fc, nil
+}
+
+func (ec *executionContext) _PolicyVersionConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *types.PolicyVersionConnection) (ret graphql.Marshaler) {
+ fc, err := ec.fieldContext_PolicyVersionConnection_pageInfo(ctx, field)
+ if err != nil {
+ return graphql.Null
+ }
+ ctx = graphql.WithFieldContext(ctx, fc)
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ ret = graphql.Null
+ }
+ }()
+ resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
+ ctx = rctx // use context from middleware stack in children
+ return obj.PageInfo, nil
+ })
+ if err != nil {
+ ec.Error(ctx, err)
+ return graphql.Null
+ }
+ if resTmp == nil {
+ if !graphql.HasFieldError(ctx, fc) {
+ ec.Errorf(ctx, "must not be null")
+ }
+ return graphql.Null
+ }
+ res := resTmp.(*types.PageInfo)
+ fc.Result = res
+ return ec.marshalNPageInfo2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐPageInfo(ctx, field.Selections, res)
+}
+
+func (ec *executionContext) fieldContext_PolicyVersionConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
+ fc = &graphql.FieldContext{
+ Object: "PolicyVersionConnection",
+ Field: field,
+ IsMethod: false,
+ IsResolver: false,
+ Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
+ switch field.Name {
+ case "hasNextPage":
+ return ec.fieldContext_PageInfo_hasNextPage(ctx, field)
+ case "hasPreviousPage":
+ return ec.fieldContext_PageInfo_hasPreviousPage(ctx, field)
+ case "startCursor":
+ return ec.fieldContext_PageInfo_startCursor(ctx, field)
+ case "endCursor":
+ return ec.fieldContext_PageInfo_endCursor(ctx, field)
+ }
+ return nil, fmt.Errorf("no field named %q was found under type PageInfo", field.Name)
+ },
+ }
+ return fc, nil
+}
+
+func (ec *executionContext) _PolicyVersionEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *types.PolicyVersionEdge) (ret graphql.Marshaler) {
+ fc, err := ec.fieldContext_PolicyVersionEdge_cursor(ctx, field)
+ if err != nil {
+ return graphql.Null
+ }
+ ctx = graphql.WithFieldContext(ctx, fc)
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ ret = graphql.Null
+ }
+ }()
+ resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
+ ctx = rctx // use context from middleware stack in children
+ return obj.Cursor, nil
+ })
+ if err != nil {
+ ec.Error(ctx, err)
+ return graphql.Null
+ }
+ if resTmp == nil {
+ if !graphql.HasFieldError(ctx, fc) {
+ ec.Errorf(ctx, "must not be null")
+ }
+ return graphql.Null
+ }
+ res := resTmp.(page.CursorKey)
+ fc.Result = res
+ return ec.marshalNCursorKey2githubᚗcomᚋgetproboᚋproboᚋpkgᚋpageᚐCursorKey(ctx, field.Selections, res)
+}
+
+func (ec *executionContext) fieldContext_PolicyVersionEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
+ fc = &graphql.FieldContext{
+ Object: "PolicyVersionEdge",
+ Field: field,
+ IsMethod: false,
+ IsResolver: false,
+ Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
+ return nil, errors.New("field of type CursorKey does not have child fields")
+ },
+ }
+ return fc, nil
+}
+
+func (ec *executionContext) _PolicyVersionEdge_node(ctx context.Context, field graphql.CollectedField, obj *types.PolicyVersionEdge) (ret graphql.Marshaler) {
+ fc, err := ec.fieldContext_PolicyVersionEdge_node(ctx, field)
+ if err != nil {
+ return graphql.Null
+ }
+ ctx = graphql.WithFieldContext(ctx, fc)
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ ret = graphql.Null
+ }
+ }()
+ resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
+ ctx = rctx // use context from middleware stack in children
+ return obj.Node, nil
+ })
+ if err != nil {
+ ec.Error(ctx, err)
+ return graphql.Null
+ }
+ if resTmp == nil {
+ if !graphql.HasFieldError(ctx, fc) {
+ ec.Errorf(ctx, "must not be null")
+ }
+ return graphql.Null
+ }
+ res := resTmp.(*types.PolicyVersion)
+ fc.Result = res
+ return ec.marshalNPolicyVersion2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐPolicyVersion(ctx, field.Selections, res)
+}
+
+func (ec *executionContext) fieldContext_PolicyVersionEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
+ fc = &graphql.FieldContext{
+ Object: "PolicyVersionEdge",
+ Field: field,
+ IsMethod: false,
+ IsResolver: false,
+ Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
+ switch field.Name {
+ case "id":
+ return ec.fieldContext_PolicyVersion_id(ctx, field)
+ case "policy":
+ return ec.fieldContext_PolicyVersion_policy(ctx, field)
+ case "status":
+ return ec.fieldContext_PolicyVersion_status(ctx, field)
+ case "version":
+ return ec.fieldContext_PolicyVersion_version(ctx, field)
+ case "content":
+ return ec.fieldContext_PolicyVersion_content(ctx, field)
+ case "changelog":
+ return ec.fieldContext_PolicyVersion_changelog(ctx, field)
+ case "signatures":
+ return ec.fieldContext_PolicyVersion_signatures(ctx, field)
+ case "publishedBy":
+ return ec.fieldContext_PolicyVersion_publishedBy(ctx, field)
+ case "publishedAt":
+ return ec.fieldContext_PolicyVersion_publishedAt(ctx, field)
+ case "createdAt":
+ return ec.fieldContext_PolicyVersion_createdAt(ctx, field)
+ case "updatedAt":
+ return ec.fieldContext_PolicyVersion_updatedAt(ctx, field)
+ }
+ return nil, fmt.Errorf("no field named %q was found under type PolicyVersion", field.Name)
+ },
+ }
+ return fc, nil
+}
+
+func (ec *executionContext) _PolicyVersionSignature_id(ctx context.Context, field graphql.CollectedField, obj *types.PolicyVersionSignature) (ret graphql.Marshaler) {
+ fc, err := ec.fieldContext_PolicyVersionSignature_id(ctx, field)
+ if err != nil {
+ return graphql.Null
+ }
+ ctx = graphql.WithFieldContext(ctx, fc)
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ ret = graphql.Null
+ }
+ }()
+ resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
+ ctx = rctx // use context from middleware stack in children
+ return obj.ID, nil
+ })
+ if err != nil {
+ ec.Error(ctx, err)
+ return graphql.Null
+ }
+ if resTmp == nil {
+ if !graphql.HasFieldError(ctx, fc) {
+ ec.Errorf(ctx, "must not be null")
+ }
+ return graphql.Null
+ }
+ res := resTmp.(gid.GID)
+ fc.Result = res
+ return ec.marshalNID2githubᚗcomᚋgetproboᚋproboᚋpkgᚋgidᚐGID(ctx, field.Selections, res)
+}
+
+func (ec *executionContext) fieldContext_PolicyVersionSignature_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
+ fc = &graphql.FieldContext{
+ Object: "PolicyVersionSignature",
+ Field: field,
+ IsMethod: false,
+ IsResolver: false,
+ Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
+ return nil, errors.New("field of type ID does not have child fields")
+ },
+ }
+ return fc, nil
+}
+
+func (ec *executionContext) _PolicyVersionSignature_policyVersion(ctx context.Context, field graphql.CollectedField, obj *types.PolicyVersionSignature) (ret graphql.Marshaler) {
+ fc, err := ec.fieldContext_PolicyVersionSignature_policyVersion(ctx, field)
+ if err != nil {
+ return graphql.Null
+ }
+ ctx = graphql.WithFieldContext(ctx, fc)
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ ret = graphql.Null
+ }
+ }()
+ resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
+ ctx = rctx // use context from middleware stack in children
+ return ec.resolvers.PolicyVersionSignature().PolicyVersion(rctx, obj)
+ })
+ if err != nil {
+ ec.Error(ctx, err)
+ return graphql.Null
+ }
+ if resTmp == nil {
+ if !graphql.HasFieldError(ctx, fc) {
+ ec.Errorf(ctx, "must not be null")
+ }
+ return graphql.Null
+ }
+ res := resTmp.(*types.PolicyVersion)
+ fc.Result = res
+ return ec.marshalNPolicyVersion2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐPolicyVersion(ctx, field.Selections, res)
+}
+
+func (ec *executionContext) fieldContext_PolicyVersionSignature_policyVersion(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
+ fc = &graphql.FieldContext{
+ Object: "PolicyVersionSignature",
+ Field: field,
+ IsMethod: true,
+ IsResolver: true,
+ Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
+ switch field.Name {
+ case "id":
+ return ec.fieldContext_PolicyVersion_id(ctx, field)
+ case "policy":
+ return ec.fieldContext_PolicyVersion_policy(ctx, field)
+ case "status":
+ return ec.fieldContext_PolicyVersion_status(ctx, field)
+ case "version":
+ return ec.fieldContext_PolicyVersion_version(ctx, field)
+ case "content":
+ return ec.fieldContext_PolicyVersion_content(ctx, field)
+ case "changelog":
+ return ec.fieldContext_PolicyVersion_changelog(ctx, field)
+ case "signatures":
+ return ec.fieldContext_PolicyVersion_signatures(ctx, field)
+ case "publishedBy":
+ return ec.fieldContext_PolicyVersion_publishedBy(ctx, field)
+ case "publishedAt":
+ return ec.fieldContext_PolicyVersion_publishedAt(ctx, field)
+ case "createdAt":
+ return ec.fieldContext_PolicyVersion_createdAt(ctx, field)
+ case "updatedAt":
+ return ec.fieldContext_PolicyVersion_updatedAt(ctx, field)
+ }
+ return nil, fmt.Errorf("no field named %q was found under type PolicyVersion", field.Name)
+ },
+ }
+ return fc, nil
+}
+
+func (ec *executionContext) _PolicyVersionSignature_state(ctx context.Context, field graphql.CollectedField, obj *types.PolicyVersionSignature) (ret graphql.Marshaler) {
+ fc, err := ec.fieldContext_PolicyVersionSignature_state(ctx, field)
+ if err != nil {
+ return graphql.Null
+ }
+ ctx = graphql.WithFieldContext(ctx, fc)
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ ret = graphql.Null
+ }
+ }()
+ resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
+ ctx = rctx // use context from middleware stack in children
+ return obj.State, nil
+ })
+ if err != nil {
+ ec.Error(ctx, err)
+ return graphql.Null
+ }
+ if resTmp == nil {
+ if !graphql.HasFieldError(ctx, fc) {
+ ec.Errorf(ctx, "must not be null")
+ }
+ return graphql.Null
+ }
+ res := resTmp.(coredata.PolicyVersionSignatureState)
+ fc.Result = res
+ return ec.marshalNPolicyVersionSignatureState2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐPolicyVersionSignatureState(ctx, field.Selections, res)
+}
+
+func (ec *executionContext) fieldContext_PolicyVersionSignature_state(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
+ fc = &graphql.FieldContext{
+ Object: "PolicyVersionSignature",
+ Field: field,
+ IsMethod: false,
+ IsResolver: false,
+ Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
+ return nil, errors.New("field of type PolicyVersionSignatureState does not have child fields")
+ },
+ }
+ return fc, nil
+}
+
+func (ec *executionContext) _PolicyVersionSignature_signedBy(ctx context.Context, field graphql.CollectedField, obj *types.PolicyVersionSignature) (ret graphql.Marshaler) {
+ fc, err := ec.fieldContext_PolicyVersionSignature_signedBy(ctx, field)
+ if err != nil {
+ return graphql.Null
+ }
+ ctx = graphql.WithFieldContext(ctx, fc)
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ ret = graphql.Null
+ }
+ }()
+ resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
+ ctx = rctx // use context from middleware stack in children
+ return ec.resolvers.PolicyVersionSignature().SignedBy(rctx, obj)
+ })
+ if err != nil {
+ ec.Error(ctx, err)
+ return graphql.Null
+ }
+ if resTmp == nil {
+ if !graphql.HasFieldError(ctx, fc) {
+ ec.Errorf(ctx, "must not be null")
+ }
+ return graphql.Null
+ }
+ res := resTmp.(*types.People)
+ fc.Result = res
+ return ec.marshalNPeople2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐPeople(ctx, field.Selections, res)
+}
+
+func (ec *executionContext) fieldContext_PolicyVersionSignature_signedBy(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
+ fc = &graphql.FieldContext{
+ Object: "PolicyVersionSignature",
+ Field: field,
+ IsMethod: true,
+ IsResolver: true,
+ Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
+ switch field.Name {
+ case "id":
+ return ec.fieldContext_People_id(ctx, field)
+ case "fullName":
+ return ec.fieldContext_People_fullName(ctx, field)
+ case "primaryEmailAddress":
+ return ec.fieldContext_People_primaryEmailAddress(ctx, field)
+ case "additionalEmailAddresses":
+ return ec.fieldContext_People_additionalEmailAddresses(ctx, field)
+ case "kind":
+ return ec.fieldContext_People_kind(ctx, field)
+ case "createdAt":
+ return ec.fieldContext_People_createdAt(ctx, field)
+ case "updatedAt":
+ return ec.fieldContext_People_updatedAt(ctx, field)
+ }
+ return nil, fmt.Errorf("no field named %q was found under type People", field.Name)
+ },
+ }
+ return fc, nil
+}
+
+func (ec *executionContext) _PolicyVersionSignature_signedAt(ctx context.Context, field graphql.CollectedField, obj *types.PolicyVersionSignature) (ret graphql.Marshaler) {
+ fc, err := ec.fieldContext_PolicyVersionSignature_signedAt(ctx, field)
+ if err != nil {
+ return graphql.Null
+ }
+ ctx = graphql.WithFieldContext(ctx, fc)
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ ret = graphql.Null
+ }
+ }()
+ resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
+ ctx = rctx // use context from middleware stack in children
+ return obj.SignedAt, nil
+ })
+ if err != nil {
+ ec.Error(ctx, err)
+ return graphql.Null
+ }
+ if resTmp == nil {
+ return graphql.Null
+ }
+ res := resTmp.(*time.Time)
+ fc.Result = res
+ return ec.marshalODatetime2ᚖtimeᚐTime(ctx, field.Selections, res)
+}
+
+func (ec *executionContext) fieldContext_PolicyVersionSignature_signedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
+ fc = &graphql.FieldContext{
+ Object: "PolicyVersionSignature",
+ Field: field,
+ IsMethod: false,
+ IsResolver: false,
+ Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
+ return nil, errors.New("field of type Datetime does not have child fields")
+ },
+ }
+ return fc, nil
+}
+
+func (ec *executionContext) _PolicyVersionSignature_requestedAt(ctx context.Context, field graphql.CollectedField, obj *types.PolicyVersionSignature) (ret graphql.Marshaler) {
+ fc, err := ec.fieldContext_PolicyVersionSignature_requestedAt(ctx, field)
+ if err != nil {
+ return graphql.Null
+ }
+ ctx = graphql.WithFieldContext(ctx, fc)
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ ret = graphql.Null
+ }
+ }()
+ resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
+ ctx = rctx // use context from middleware stack in children
+ return obj.RequestedAt, nil
+ })
+ if err != nil {
+ ec.Error(ctx, err)
+ return graphql.Null
+ }
+ if resTmp == nil {
+ if !graphql.HasFieldError(ctx, fc) {
+ ec.Errorf(ctx, "must not be null")
+ }
+ return graphql.Null
+ }
+ res := resTmp.(time.Time)
+ fc.Result = res
+ return ec.marshalNDatetime2timeᚐTime(ctx, field.Selections, res)
+}
+
+func (ec *executionContext) fieldContext_PolicyVersionSignature_requestedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
+ fc = &graphql.FieldContext{
+ Object: "PolicyVersionSignature",
+ Field: field,
+ IsMethod: false,
+ IsResolver: false,
+ Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
+ return nil, errors.New("field of type Datetime does not have child fields")
+ },
+ }
+ return fc, nil
+}
+
+func (ec *executionContext) _PolicyVersionSignature_requestedBy(ctx context.Context, field graphql.CollectedField, obj *types.PolicyVersionSignature) (ret graphql.Marshaler) {
+ fc, err := ec.fieldContext_PolicyVersionSignature_requestedBy(ctx, field)
+ if err != nil {
+ return graphql.Null
+ }
+ ctx = graphql.WithFieldContext(ctx, fc)
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ ret = graphql.Null
+ }
+ }()
+ resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
+ ctx = rctx // use context from middleware stack in children
+ return ec.resolvers.PolicyVersionSignature().RequestedBy(rctx, obj)
+ })
+ if err != nil {
+ ec.Error(ctx, err)
+ return graphql.Null
+ }
+ if resTmp == nil {
+ if !graphql.HasFieldError(ctx, fc) {
+ ec.Errorf(ctx, "must not be null")
+ }
+ return graphql.Null
+ }
+ res := resTmp.(*types.People)
+ fc.Result = res
+ return ec.marshalNPeople2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐPeople(ctx, field.Selections, res)
+}
+
+func (ec *executionContext) fieldContext_PolicyVersionSignature_requestedBy(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
+ fc = &graphql.FieldContext{
+ Object: "PolicyVersionSignature",
+ Field: field,
+ IsMethod: true,
+ IsResolver: true,
+ Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
+ switch field.Name {
+ case "id":
+ return ec.fieldContext_People_id(ctx, field)
+ case "fullName":
+ return ec.fieldContext_People_fullName(ctx, field)
+ case "primaryEmailAddress":
+ return ec.fieldContext_People_primaryEmailAddress(ctx, field)
+ case "additionalEmailAddresses":
+ return ec.fieldContext_People_additionalEmailAddresses(ctx, field)
+ case "kind":
+ return ec.fieldContext_People_kind(ctx, field)
+ case "createdAt":
+ return ec.fieldContext_People_createdAt(ctx, field)
+ case "updatedAt":
+ return ec.fieldContext_People_updatedAt(ctx, field)
+ }
+ return nil, fmt.Errorf("no field named %q was found under type People", field.Name)
+ },
+ }
+ return fc, nil
+}
+
+func (ec *executionContext) _PolicyVersionSignature_createdAt(ctx context.Context, field graphql.CollectedField, obj *types.PolicyVersionSignature) (ret graphql.Marshaler) {
+ fc, err := ec.fieldContext_PolicyVersionSignature_createdAt(ctx, field)
+ if err != nil {
+ return graphql.Null
+ }
+ ctx = graphql.WithFieldContext(ctx, fc)
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ ret = graphql.Null
+ }
+ }()
+ resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
+ ctx = rctx // use context from middleware stack in children
+ return obj.CreatedAt, nil
+ })
+ if err != nil {
+ ec.Error(ctx, err)
+ return graphql.Null
+ }
+ if resTmp == nil {
+ if !graphql.HasFieldError(ctx, fc) {
+ ec.Errorf(ctx, "must not be null")
+ }
+ return graphql.Null
+ }
+ res := resTmp.(time.Time)
+ fc.Result = res
+ return ec.marshalNDatetime2timeᚐTime(ctx, field.Selections, res)
+}
+
+func (ec *executionContext) fieldContext_PolicyVersionSignature_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
+ fc = &graphql.FieldContext{
+ Object: "PolicyVersionSignature",
+ Field: field,
+ IsMethod: false,
+ IsResolver: false,
+ Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
+ return nil, errors.New("field of type Datetime does not have child fields")
+ },
+ }
+ return fc, nil
+}
+
+func (ec *executionContext) _PolicyVersionSignature_updatedAt(ctx context.Context, field graphql.CollectedField, obj *types.PolicyVersionSignature) (ret graphql.Marshaler) {
+ fc, err := ec.fieldContext_PolicyVersionSignature_updatedAt(ctx, field)
+ if err != nil {
+ return graphql.Null
+ }
+ ctx = graphql.WithFieldContext(ctx, fc)
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ ret = graphql.Null
+ }
+ }()
+ resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
+ ctx = rctx // use context from middleware stack in children
+ return obj.UpdatedAt, nil
+ })
+ if err != nil {
+ ec.Error(ctx, err)
+ return graphql.Null
+ }
+ if resTmp == nil {
+ if !graphql.HasFieldError(ctx, fc) {
+ ec.Errorf(ctx, "must not be null")
+ }
+ return graphql.Null
+ }
+ res := resTmp.(time.Time)
+ fc.Result = res
+ return ec.marshalNDatetime2timeᚐTime(ctx, field.Selections, res)
+}
+
+func (ec *executionContext) fieldContext_PolicyVersionSignature_updatedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
+ fc = &graphql.FieldContext{
+ Object: "PolicyVersionSignature",
+ Field: field,
+ IsMethod: false,
+ IsResolver: false,
+ Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
+ return nil, errors.New("field of type Datetime does not have child fields")
+ },
+ }
+ return fc, nil
+}
+
+func (ec *executionContext) _PolicyVersionSignatureConnection_edges(ctx context.Context, field graphql.CollectedField, obj *types.PolicyVersionSignatureConnection) (ret graphql.Marshaler) {
+ fc, err := ec.fieldContext_PolicyVersionSignatureConnection_edges(ctx, field)
+ if err != nil {
+ return graphql.Null
+ }
+ ctx = graphql.WithFieldContext(ctx, fc)
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ ret = graphql.Null
+ }
+ }()
+ resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
+ ctx = rctx // use context from middleware stack in children
+ return obj.Edges, nil
+ })
+ if err != nil {
+ ec.Error(ctx, err)
+ return graphql.Null
+ }
+ if resTmp == nil {
+ if !graphql.HasFieldError(ctx, fc) {
+ ec.Errorf(ctx, "must not be null")
+ }
+ return graphql.Null
+ }
+ res := resTmp.([]*types.PolicyVersionSignatureEdge)
+ fc.Result = res
+ return ec.marshalNPolicyVersionSignatureEdge2ᚕᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐPolicyVersionSignatureEdgeᚄ(ctx, field.Selections, res)
+}
+
+func (ec *executionContext) fieldContext_PolicyVersionSignatureConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
+ fc = &graphql.FieldContext{
+ Object: "PolicyVersionSignatureConnection",
+ Field: field,
+ IsMethod: false,
+ IsResolver: false,
+ Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
+ switch field.Name {
+ case "cursor":
+ return ec.fieldContext_PolicyVersionSignatureEdge_cursor(ctx, field)
+ case "node":
+ return ec.fieldContext_PolicyVersionSignatureEdge_node(ctx, field)
+ }
+ return nil, fmt.Errorf("no field named %q was found under type PolicyVersionSignatureEdge", field.Name)
+ },
+ }
+ return fc, nil
+}
+
+func (ec *executionContext) _PolicyVersionSignatureConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *types.PolicyVersionSignatureConnection) (ret graphql.Marshaler) {
+ fc, err := ec.fieldContext_PolicyVersionSignatureConnection_pageInfo(ctx, field)
+ if err != nil {
+ return graphql.Null
+ }
+ ctx = graphql.WithFieldContext(ctx, fc)
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ ret = graphql.Null
+ }
+ }()
+ resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
+ ctx = rctx // use context from middleware stack in children
+ return obj.PageInfo, nil
+ })
+ if err != nil {
+ ec.Error(ctx, err)
+ return graphql.Null
+ }
+ if resTmp == nil {
+ if !graphql.HasFieldError(ctx, fc) {
+ ec.Errorf(ctx, "must not be null")
+ }
+ return graphql.Null
+ }
+ res := resTmp.(*types.PageInfo)
+ fc.Result = res
+ return ec.marshalNPageInfo2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐPageInfo(ctx, field.Selections, res)
+}
+
+func (ec *executionContext) fieldContext_PolicyVersionSignatureConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
+ fc = &graphql.FieldContext{
+ Object: "PolicyVersionSignatureConnection",
+ Field: field,
+ IsMethod: false,
+ IsResolver: false,
+ Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
+ switch field.Name {
+ case "hasNextPage":
+ return ec.fieldContext_PageInfo_hasNextPage(ctx, field)
+ case "hasPreviousPage":
+ return ec.fieldContext_PageInfo_hasPreviousPage(ctx, field)
+ case "startCursor":
+ return ec.fieldContext_PageInfo_startCursor(ctx, field)
+ case "endCursor":
+ return ec.fieldContext_PageInfo_endCursor(ctx, field)
+ }
+ return nil, fmt.Errorf("no field named %q was found under type PageInfo", field.Name)
+ },
+ }
+ return fc, nil
+}
+
+func (ec *executionContext) _PolicyVersionSignatureEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *types.PolicyVersionSignatureEdge) (ret graphql.Marshaler) {
+ fc, err := ec.fieldContext_PolicyVersionSignatureEdge_cursor(ctx, field)
+ if err != nil {
+ return graphql.Null
+ }
+ ctx = graphql.WithFieldContext(ctx, fc)
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ ret = graphql.Null
+ }
+ }()
+ resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
+ ctx = rctx // use context from middleware stack in children
+ return obj.Cursor, nil
+ })
+ if err != nil {
+ ec.Error(ctx, err)
+ return graphql.Null
+ }
+ if resTmp == nil {
+ if !graphql.HasFieldError(ctx, fc) {
+ ec.Errorf(ctx, "must not be null")
+ }
+ return graphql.Null
+ }
+ res := resTmp.(page.CursorKey)
+ fc.Result = res
+ return ec.marshalNCursorKey2githubᚗcomᚋgetproboᚋproboᚋpkgᚋpageᚐCursorKey(ctx, field.Selections, res)
+}
+
+func (ec *executionContext) fieldContext_PolicyVersionSignatureEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
+ fc = &graphql.FieldContext{
+ Object: "PolicyVersionSignatureEdge",
+ Field: field,
+ IsMethod: false,
+ IsResolver: false,
+ Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
+ return nil, errors.New("field of type CursorKey does not have child fields")
+ },
+ }
+ return fc, nil
+}
+
+func (ec *executionContext) _PolicyVersionSignatureEdge_node(ctx context.Context, field graphql.CollectedField, obj *types.PolicyVersionSignatureEdge) (ret graphql.Marshaler) {
+ fc, err := ec.fieldContext_PolicyVersionSignatureEdge_node(ctx, field)
+ if err != nil {
+ return graphql.Null
+ }
+ ctx = graphql.WithFieldContext(ctx, fc)
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ ret = graphql.Null
+ }
+ }()
+ resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
+ ctx = rctx // use context from middleware stack in children
+ return obj.Node, nil
+ })
+ if err != nil {
+ ec.Error(ctx, err)
+ return graphql.Null
+ }
+ if resTmp == nil {
+ if !graphql.HasFieldError(ctx, fc) {
+ ec.Errorf(ctx, "must not be null")
+ }
+ return graphql.Null
+ }
+ res := resTmp.(*types.PolicyVersionSignature)
+ fc.Result = res
+ return ec.marshalNPolicyVersionSignature2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐPolicyVersionSignature(ctx, field.Selections, res)
+}
+
+func (ec *executionContext) fieldContext_PolicyVersionSignatureEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
+ fc = &graphql.FieldContext{
+ Object: "PolicyVersionSignatureEdge",
+ Field: field,
+ IsMethod: false,
+ IsResolver: false,
+ Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
+ switch field.Name {
+ case "id":
+ return ec.fieldContext_PolicyVersionSignature_id(ctx, field)
+ case "policyVersion":
+ return ec.fieldContext_PolicyVersionSignature_policyVersion(ctx, field)
+ case "state":
+ return ec.fieldContext_PolicyVersionSignature_state(ctx, field)
+ case "signedBy":
+ return ec.fieldContext_PolicyVersionSignature_signedBy(ctx, field)
+ case "signedAt":
+ return ec.fieldContext_PolicyVersionSignature_signedAt(ctx, field)
+ case "requestedAt":
+ return ec.fieldContext_PolicyVersionSignature_requestedAt(ctx, field)
+ case "requestedBy":
+ return ec.fieldContext_PolicyVersionSignature_requestedBy(ctx, field)
+ case "createdAt":
+ return ec.fieldContext_PolicyVersionSignature_createdAt(ctx, field)
+ case "updatedAt":
+ return ec.fieldContext_PolicyVersionSignature_updatedAt(ctx, field)
+ }
+ return nil, fmt.Errorf("no field named %q was found under type PolicyVersionSignature", field.Name)
+ },
+ }
+ return fc, nil
+}
+
+func (ec *executionContext) _PublishPolicyVersionPayload_policyVersion(ctx context.Context, field graphql.CollectedField, obj *types.PublishPolicyVersionPayload) (ret graphql.Marshaler) {
+ fc, err := ec.fieldContext_PublishPolicyVersionPayload_policyVersion(ctx, field)
+ if err != nil {
+ return graphql.Null
+ }
+ ctx = graphql.WithFieldContext(ctx, fc)
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ ret = graphql.Null
+ }
+ }()
+ resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
+ ctx = rctx // use context from middleware stack in children
+ return obj.PolicyVersion, nil
+ })
+ if err != nil {
+ ec.Error(ctx, err)
+ return graphql.Null
+ }
+ if resTmp == nil {
+ if !graphql.HasFieldError(ctx, fc) {
+ ec.Errorf(ctx, "must not be null")
+ }
+ return graphql.Null
+ }
+ res := resTmp.(*types.PolicyVersion)
+ fc.Result = res
+ return ec.marshalNPolicyVersion2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐPolicyVersion(ctx, field.Selections, res)
+}
+
+func (ec *executionContext) fieldContext_PublishPolicyVersionPayload_policyVersion(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
+ fc = &graphql.FieldContext{
+ Object: "PublishPolicyVersionPayload",
+ Field: field,
+ IsMethod: false,
+ IsResolver: false,
+ Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
+ switch field.Name {
+ case "id":
+ return ec.fieldContext_PolicyVersion_id(ctx, field)
+ case "policy":
+ return ec.fieldContext_PolicyVersion_policy(ctx, field)
+ case "status":
+ return ec.fieldContext_PolicyVersion_status(ctx, field)
+ case "version":
+ return ec.fieldContext_PolicyVersion_version(ctx, field)
+ case "content":
+ return ec.fieldContext_PolicyVersion_content(ctx, field)
+ case "changelog":
+ return ec.fieldContext_PolicyVersion_changelog(ctx, field)
+ case "signatures":
+ return ec.fieldContext_PolicyVersion_signatures(ctx, field)
+ case "publishedBy":
+ return ec.fieldContext_PolicyVersion_publishedBy(ctx, field)
+ case "publishedAt":
+ return ec.fieldContext_PolicyVersion_publishedAt(ctx, field)
+ case "createdAt":
+ return ec.fieldContext_PolicyVersion_createdAt(ctx, field)
+ case "updatedAt":
+ return ec.fieldContext_PolicyVersion_updatedAt(ctx, field)
+ }
+ return nil, fmt.Errorf("no field named %q was found under type PolicyVersion", field.Name)
+ },
+ }
+ return fc, nil
+}
+
+func (ec *executionContext) _PublishPolicyVersionPayload_policy(ctx context.Context, field graphql.CollectedField, obj *types.PublishPolicyVersionPayload) (ret graphql.Marshaler) {
+ fc, err := ec.fieldContext_PublishPolicyVersionPayload_policy(ctx, field)
+ if err != nil {
+ return graphql.Null
+ }
+ ctx = graphql.WithFieldContext(ctx, fc)
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ ret = graphql.Null
+ }
+ }()
+ resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
+ ctx = rctx // use context from middleware stack in children
+ return obj.Policy, nil
+ })
+ if err != nil {
+ ec.Error(ctx, err)
+ return graphql.Null
+ }
+ if resTmp == nil {
+ if !graphql.HasFieldError(ctx, fc) {
+ ec.Errorf(ctx, "must not be null")
+ }
+ return graphql.Null
+ }
+ res := resTmp.(*types.Policy)
+ fc.Result = res
+ return ec.marshalNPolicy2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐPolicy(ctx, field.Selections, res)
+}
+
+func (ec *executionContext) fieldContext_PublishPolicyVersionPayload_policy(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
+ fc = &graphql.FieldContext{
+ Object: "PublishPolicyVersionPayload",
+ Field: field,
+ IsMethod: false,
+ IsResolver: false,
+ Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
+ switch field.Name {
+ case "id":
+ return ec.fieldContext_Policy_id(ctx, field)
+ case "title":
+ return ec.fieldContext_Policy_title(ctx, field)
+ case "description":
+ return ec.fieldContext_Policy_description(ctx, field)
+ case "currentPublishedVersion":
+ return ec.fieldContext_Policy_currentPublishedVersion(ctx, field)
+ case "owner":
+ return ec.fieldContext_Policy_owner(ctx, field)
+ case "versions":
+ return ec.fieldContext_Policy_versions(ctx, field)
case "controls":
return ec.fieldContext_Policy_controls(ctx, field)
case "createdAt":
@@ -18019,6 +20670,56 @@ func (ec *executionContext) fieldContext_RequestEvidencePayload_evidenceEdge(_ c
return fc, nil
}
+func (ec *executionContext) _RequestSignaturePayload_policyVersionSignatureEdge(ctx context.Context, field graphql.CollectedField, obj *types.RequestSignaturePayload) (ret graphql.Marshaler) {
+ fc, err := ec.fieldContext_RequestSignaturePayload_policyVersionSignatureEdge(ctx, field)
+ if err != nil {
+ return graphql.Null
+ }
+ ctx = graphql.WithFieldContext(ctx, fc)
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ ret = graphql.Null
+ }
+ }()
+ resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
+ ctx = rctx // use context from middleware stack in children
+ return obj.PolicyVersionSignatureEdge, nil
+ })
+ if err != nil {
+ ec.Error(ctx, err)
+ return graphql.Null
+ }
+ if resTmp == nil {
+ if !graphql.HasFieldError(ctx, fc) {
+ ec.Errorf(ctx, "must not be null")
+ }
+ return graphql.Null
+ }
+ res := resTmp.(*types.PolicyVersionSignatureEdge)
+ fc.Result = res
+ return ec.marshalNPolicyVersionSignatureEdge2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐPolicyVersionSignatureEdge(ctx, field.Selections, res)
+}
+
+func (ec *executionContext) fieldContext_RequestSignaturePayload_policyVersionSignatureEdge(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
+ fc = &graphql.FieldContext{
+ Object: "RequestSignaturePayload",
+ Field: field,
+ IsMethod: false,
+ IsResolver: false,
+ Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
+ switch field.Name {
+ case "cursor":
+ return ec.fieldContext_PolicyVersionSignatureEdge_cursor(ctx, field)
+ case "node":
+ return ec.fieldContext_PolicyVersionSignatureEdge_node(ctx, field)
+ }
+ return nil, fmt.Errorf("no field named %q was found under type PolicyVersionSignatureEdge", field.Name)
+ },
+ }
+ return fc, nil
+}
+
func (ec *executionContext) _Risk_id(ctx context.Context, field graphql.CollectedField, obj *types.Risk) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_Risk_id(ctx, field)
if err != nil {
@@ -20189,16 +22890,16 @@ func (ec *executionContext) fieldContext_UpdatePolicyPayload_policy(_ context.Co
switch field.Name {
case "id":
return ec.fieldContext_Policy_id(ctx, field)
- case "name":
- return ec.fieldContext_Policy_name(ctx, field)
- case "status":
- return ec.fieldContext_Policy_status(ctx, field)
- case "content":
- return ec.fieldContext_Policy_content(ctx, field)
- case "reviewDate":
- return ec.fieldContext_Policy_reviewDate(ctx, field)
+ case "title":
+ return ec.fieldContext_Policy_title(ctx, field)
+ case "description":
+ return ec.fieldContext_Policy_description(ctx, field)
+ case "currentPublishedVersion":
+ return ec.fieldContext_Policy_currentPublishedVersion(ctx, field)
case "owner":
return ec.fieldContext_Policy_owner(ctx, field)
+ case "versions":
+ return ec.fieldContext_Policy_versions(ctx, field)
case "controls":
return ec.fieldContext_Policy_controls(ctx, field)
case "createdAt":
@@ -20212,6 +22913,74 @@ func (ec *executionContext) fieldContext_UpdatePolicyPayload_policy(_ context.Co
return fc, nil
}
+func (ec *executionContext) _UpdatePolicyVersionPayload_policyVersion(ctx context.Context, field graphql.CollectedField, obj *types.UpdatePolicyVersionPayload) (ret graphql.Marshaler) {
+ fc, err := ec.fieldContext_UpdatePolicyVersionPayload_policyVersion(ctx, field)
+ if err != nil {
+ return graphql.Null
+ }
+ ctx = graphql.WithFieldContext(ctx, fc)
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ ret = graphql.Null
+ }
+ }()
+ resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
+ ctx = rctx // use context from middleware stack in children
+ return obj.PolicyVersion, nil
+ })
+ if err != nil {
+ ec.Error(ctx, err)
+ return graphql.Null
+ }
+ if resTmp == nil {
+ if !graphql.HasFieldError(ctx, fc) {
+ ec.Errorf(ctx, "must not be null")
+ }
+ return graphql.Null
+ }
+ res := resTmp.(*types.PolicyVersion)
+ fc.Result = res
+ return ec.marshalNPolicyVersion2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐPolicyVersion(ctx, field.Selections, res)
+}
+
+func (ec *executionContext) fieldContext_UpdatePolicyVersionPayload_policyVersion(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
+ fc = &graphql.FieldContext{
+ Object: "UpdatePolicyVersionPayload",
+ Field: field,
+ IsMethod: false,
+ IsResolver: false,
+ Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
+ switch field.Name {
+ case "id":
+ return ec.fieldContext_PolicyVersion_id(ctx, field)
+ case "policy":
+ return ec.fieldContext_PolicyVersion_policy(ctx, field)
+ case "status":
+ return ec.fieldContext_PolicyVersion_status(ctx, field)
+ case "version":
+ return ec.fieldContext_PolicyVersion_version(ctx, field)
+ case "content":
+ return ec.fieldContext_PolicyVersion_content(ctx, field)
+ case "changelog":
+ return ec.fieldContext_PolicyVersion_changelog(ctx, field)
+ case "signatures":
+ return ec.fieldContext_PolicyVersion_signatures(ctx, field)
+ case "publishedBy":
+ return ec.fieldContext_PolicyVersion_publishedBy(ctx, field)
+ case "publishedAt":
+ return ec.fieldContext_PolicyVersion_publishedAt(ctx, field)
+ case "createdAt":
+ return ec.fieldContext_PolicyVersion_createdAt(ctx, field)
+ case "updatedAt":
+ return ec.fieldContext_PolicyVersion_updatedAt(ctx, field)
+ }
+ return nil, fmt.Errorf("no field named %q was found under type PolicyVersion", field.Name)
+ },
+ }
+ return fc, nil
+}
+
func (ec *executionContext) _UpdateRiskPayload_risk(ctx context.Context, field graphql.CollectedField, obj *types.UpdateRiskPayload) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_UpdateRiskPayload_risk(ctx, field)
if err != nil {
@@ -25897,6 +28666,33 @@ func (ec *executionContext) unmarshalInputCreateControlPolicyMappingInput(ctx co
return it, nil
}
+func (ec *executionContext) unmarshalInputCreateDraftPolicyVersionInput(ctx context.Context, obj any) (types.CreateDraftPolicyVersionInput, error) {
+ var it types.CreateDraftPolicyVersionInput
+ asMap := map[string]any{}
+ for k, v := range obj.(map[string]any) {
+ asMap[k] = v
+ }
+
+ fieldsInOrder := [...]string{"policyID"}
+ for _, k := range fieldsInOrder {
+ v, ok := asMap[k]
+ if !ok {
+ continue
+ }
+ switch k {
+ case "policyID":
+ ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("policyID"))
+ data, err := ec.unmarshalNID2githubᚗcomᚋgetproboᚋproboᚋpkgᚋgidᚐGID(ctx, v)
+ if err != nil {
+ return it, err
+ }
+ it.PolicyID = data
+ }
+ }
+
+ return it, nil
+}
+
func (ec *executionContext) unmarshalInputCreateEvidenceInput(ctx context.Context, obj any) (types.CreateEvidenceInput, error) {
var it types.CreateEvidenceInput
asMap := map[string]any{}
@@ -26137,7 +28933,7 @@ func (ec *executionContext) unmarshalInputCreatePolicyInput(ctx context.Context,
asMap[k] = v
}
- fieldsInOrder := [...]string{"organizationId", "name", "content", "status", "reviewDate", "ownerId"}
+ fieldsInOrder := [...]string{"organizationId", "title", "content", "ownerId"}
for _, k := range fieldsInOrder {
v, ok := asMap[k]
if !ok {
@@ -26151,13 +28947,13 @@ func (ec *executionContext) unmarshalInputCreatePolicyInput(ctx context.Context,
return it, err
}
it.OrganizationID = data
- case "name":
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name"))
+ case "title":
+ ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("title"))
data, err := ec.unmarshalNString2string(ctx, v)
if err != nil {
return it, err
}
- it.Name = data
+ it.Title = data
case "content":
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("content"))
data, err := ec.unmarshalNString2string(ctx, v)
@@ -26165,20 +28961,6 @@ func (ec *executionContext) unmarshalInputCreatePolicyInput(ctx context.Context,
return it, err
}
it.Content = data
- case "status":
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("status"))
- data, err := ec.unmarshalNPolicyStatus2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐPolicyStatus(ctx, v)
- if err != nil {
- return it, err
- }
- it.Status = data
- case "reviewDate":
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("reviewDate"))
- data, err := ec.unmarshalODatetime2ᚖtimeᚐTime(ctx, v)
- if err != nil {
- return it, err
- }
- it.ReviewDate = data
case "ownerId":
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ownerId"))
data, err := ec.unmarshalNID2githubᚗcomᚋgetproboᚋproboᚋpkgᚋgidᚐGID(ctx, v)
@@ -27394,6 +30176,128 @@ func (ec *executionContext) unmarshalInputPolicyOrder(ctx context.Context, obj a
return it, nil
}
+func (ec *executionContext) unmarshalInputPolicyVersionFilter(ctx context.Context, obj any) (types.PolicyVersionFilter, error) {
+ var it types.PolicyVersionFilter
+ asMap := map[string]any{}
+ for k, v := range obj.(map[string]any) {
+ asMap[k] = v
+ }
+
+ fieldsInOrder := [...]string{"status"}
+ for _, k := range fieldsInOrder {
+ v, ok := asMap[k]
+ if !ok {
+ continue
+ }
+ switch k {
+ case "status":
+ ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("status"))
+ data, err := ec.unmarshalOPolicyStatus2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐPolicyStatus(ctx, v)
+ if err != nil {
+ return it, err
+ }
+ it.Status = data
+ }
+ }
+
+ return it, nil
+}
+
+func (ec *executionContext) unmarshalInputPolicyVersionOrder(ctx context.Context, obj any) (types.PolicyVersionOrderBy, error) {
+ var it types.PolicyVersionOrderBy
+ asMap := map[string]any{}
+ for k, v := range obj.(map[string]any) {
+ asMap[k] = v
+ }
+
+ fieldsInOrder := [...]string{"direction", "field"}
+ for _, k := range fieldsInOrder {
+ v, ok := asMap[k]
+ if !ok {
+ continue
+ }
+ switch k {
+ case "direction":
+ ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("direction"))
+ data, err := ec.unmarshalNOrderDirection2githubᚗcomᚋgetproboᚋproboᚋpkgᚋpageᚐOrderDirection(ctx, v)
+ if err != nil {
+ return it, err
+ }
+ it.Direction = data
+ case "field":
+ ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("field"))
+ data, err := ec.unmarshalNPolicyVersionOrderField2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐPolicyVersionOrderField(ctx, v)
+ if err != nil {
+ return it, err
+ }
+ it.Field = data
+ }
+ }
+
+ return it, nil
+}
+
+func (ec *executionContext) unmarshalInputPolicyVersionSignatureOrder(ctx context.Context, obj any) (types.PolicyVersionSignatureOrder, error) {
+ var it types.PolicyVersionSignatureOrder
+ asMap := map[string]any{}
+ for k, v := range obj.(map[string]any) {
+ asMap[k] = v
+ }
+
+ fieldsInOrder := [...]string{"field", "direction"}
+ for _, k := range fieldsInOrder {
+ v, ok := asMap[k]
+ if !ok {
+ continue
+ }
+ switch k {
+ case "field":
+ ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("field"))
+ data, err := ec.unmarshalNPolicyVersionSignatureOrderField2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐPolicyVersionSignatureOrderField(ctx, v)
+ if err != nil {
+ return it, err
+ }
+ it.Field = data
+ case "direction":
+ ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("direction"))
+ data, err := ec.unmarshalNOrderDirection2githubᚗcomᚋgetproboᚋproboᚋpkgᚋpageᚐOrderDirection(ctx, v)
+ if err != nil {
+ return it, err
+ }
+ it.Direction = data
+ }
+ }
+
+ return it, nil
+}
+
+func (ec *executionContext) unmarshalInputPublishPolicyVersionInput(ctx context.Context, obj any) (types.PublishPolicyVersionInput, error) {
+ var it types.PublishPolicyVersionInput
+ asMap := map[string]any{}
+ for k, v := range obj.(map[string]any) {
+ asMap[k] = v
+ }
+
+ fieldsInOrder := [...]string{"policyId"}
+ for _, k := range fieldsInOrder {
+ v, ok := asMap[k]
+ if !ok {
+ continue
+ }
+ switch k {
+ case "policyId":
+ ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("policyId"))
+ data, err := ec.unmarshalNID2githubᚗcomᚋgetproboᚋproboᚋpkgᚋgidᚐGID(ctx, v)
+ if err != nil {
+ return it, err
+ }
+ it.PolicyID = data
+ }
+ }
+
+ return it, nil
+}
+
func (ec *executionContext) unmarshalInputRemoveUserInput(ctx context.Context, obj any) (types.RemoveUserInput, error) {
var it types.RemoveUserInput
asMap := map[string]any{}
@@ -27476,6 +30380,40 @@ func (ec *executionContext) unmarshalInputRequestEvidenceInput(ctx context.Conte
return it, nil
}
+func (ec *executionContext) unmarshalInputRequestSignatureInput(ctx context.Context, obj any) (types.RequestSignatureInput, error) {
+ var it types.RequestSignatureInput
+ asMap := map[string]any{}
+ for k, v := range obj.(map[string]any) {
+ asMap[k] = v
+ }
+
+ fieldsInOrder := [...]string{"policyVersionId", "signatoryId"}
+ for _, k := range fieldsInOrder {
+ v, ok := asMap[k]
+ if !ok {
+ continue
+ }
+ switch k {
+ case "policyVersionId":
+ ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("policyVersionId"))
+ data, err := ec.unmarshalNID2githubᚗcomᚋgetproboᚋproboᚋpkgᚋgidᚐGID(ctx, v)
+ if err != nil {
+ return it, err
+ }
+ it.PolicyVersionID = data
+ case "signatoryId":
+ ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("signatoryId"))
+ data, err := ec.unmarshalNID2githubᚗcomᚋgetproboᚋproboᚋpkgᚋgidᚐGID(ctx, v)
+ if err != nil {
+ return it, err
+ }
+ it.SignatoryID = data
+ }
+ }
+
+ return it, nil
+}
+
func (ec *executionContext) unmarshalInputRiskOrder(ctx context.Context, obj any) (types.RiskOrderBy, error) {
var it types.RiskOrderBy
asMap := map[string]any{}
@@ -27770,7 +30708,7 @@ func (ec *executionContext) unmarshalInputUpdatePolicyInput(ctx context.Context,
asMap[k] = v
}
- fieldsInOrder := [...]string{"id", "name", "content", "status", "reviewDate", "ownerId"}
+ fieldsInOrder := [...]string{"id", "title", "content", "ownerId", "createdBy"}
for _, k := range fieldsInOrder {
v, ok := asMap[k]
if !ok {
@@ -27784,13 +30722,13 @@ func (ec *executionContext) unmarshalInputUpdatePolicyInput(ctx context.Context,
return it, err
}
it.ID = data
- case "name":
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name"))
+ case "title":
+ ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("title"))
data, err := ec.unmarshalOString2ᚖstring(ctx, v)
if err != nil {
return it, err
}
- it.Name = data
+ it.Title = data
case "content":
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("content"))
data, err := ec.unmarshalOString2ᚖstring(ctx, v)
@@ -27798,20 +30736,6 @@ func (ec *executionContext) unmarshalInputUpdatePolicyInput(ctx context.Context,
return it, err
}
it.Content = data
- case "status":
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("status"))
- data, err := ec.unmarshalOPolicyStatus2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐPolicyStatus(ctx, v)
- if err != nil {
- return it, err
- }
- it.Status = data
- case "reviewDate":
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("reviewDate"))
- data, err := ec.unmarshalODatetime2ᚖtimeᚐTime(ctx, v)
- if err != nil {
- return it, err
- }
- it.ReviewDate = data
case "ownerId":
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ownerId"))
data, err := ec.unmarshalOID2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋgidᚐGID(ctx, v)
@@ -27819,6 +30743,47 @@ func (ec *executionContext) unmarshalInputUpdatePolicyInput(ctx context.Context,
return it, err
}
it.OwnerID = data
+ case "createdBy":
+ ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdBy"))
+ data, err := ec.unmarshalOID2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋgidᚐGID(ctx, v)
+ if err != nil {
+ return it, err
+ }
+ it.CreatedBy = data
+ }
+ }
+
+ return it, nil
+}
+
+func (ec *executionContext) unmarshalInputUpdatePolicyVersionInput(ctx context.Context, obj any) (types.UpdatePolicyVersionInput, error) {
+ var it types.UpdatePolicyVersionInput
+ asMap := map[string]any{}
+ for k, v := range obj.(map[string]any) {
+ asMap[k] = v
+ }
+
+ fieldsInOrder := [...]string{"policyVersionId", "content"}
+ for _, k := range fieldsInOrder {
+ v, ok := asMap[k]
+ if !ok {
+ continue
+ }
+ switch k {
+ case "policyVersionId":
+ ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("policyVersionId"))
+ data, err := ec.unmarshalNID2githubᚗcomᚋgetproboᚋproboᚋpkgᚋgidᚐGID(ctx, v)
+ if err != nil {
+ return it, err
+ }
+ it.PolicyVersionID = data
+ case "content":
+ ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("content"))
+ data, err := ec.unmarshalNString2string(ctx, v)
+ if err != nil {
+ return it, err
+ }
+ it.Content = data
}
}
@@ -28371,6 +31336,20 @@ func (ec *executionContext) _Node(ctx context.Context, sel ast.SelectionSet, obj
return graphql.Null
}
return ec._Risk(ctx, sel, obj)
+ case types.PolicyVersionSignature:
+ return ec._PolicyVersionSignature(ctx, sel, &obj)
+ case *types.PolicyVersionSignature:
+ if obj == nil {
+ return graphql.Null
+ }
+ return ec._PolicyVersionSignature(ctx, sel, obj)
+ case types.PolicyVersion:
+ return ec._PolicyVersion(ctx, sel, &obj)
+ case *types.PolicyVersion:
+ if obj == nil {
+ return graphql.Null
+ }
+ return ec._PolicyVersion(ctx, sel, obj)
case types.Policy:
return ec._Policy(ctx, sel, &obj)
case *types.Policy:
@@ -28963,6 +31942,45 @@ func (ec *executionContext) _CreateControlPolicyMappingPayload(ctx context.Conte
return out
}
+var createDraftPolicyVersionPayloadImplementors = []string{"CreateDraftPolicyVersionPayload"}
+
+func (ec *executionContext) _CreateDraftPolicyVersionPayload(ctx context.Context, sel ast.SelectionSet, obj *types.CreateDraftPolicyVersionPayload) graphql.Marshaler {
+ fields := graphql.CollectFields(ec.OperationContext, sel, createDraftPolicyVersionPayloadImplementors)
+
+ out := graphql.NewFieldSet(fields)
+ deferred := make(map[string]*graphql.FieldSet)
+ for i, field := range fields {
+ switch field.Name {
+ case "__typename":
+ out.Values[i] = graphql.MarshalString("CreateDraftPolicyVersionPayload")
+ case "policyVersionEdge":
+ out.Values[i] = ec._CreateDraftPolicyVersionPayload_policyVersionEdge(ctx, field, obj)
+ if out.Values[i] == graphql.Null {
+ out.Invalids++
+ }
+ default:
+ panic("unknown field " + strconv.Quote(field.Name))
+ }
+ }
+ out.Dispatch(ctx)
+ if out.Invalids > 0 {
+ return graphql.Null
+ }
+
+ atomic.AddInt32(&ec.deferred, int32(len(deferred)))
+
+ for label, dfs := range deferred {
+ ec.processDeferredGroup(graphql.DeferredGroup{
+ Label: label,
+ Path: graphql.GetPath(ctx),
+ FieldSet: dfs,
+ Context: ctx,
+ })
+ }
+
+ return out
+}
+
var createEvidencePayloadImplementors = []string{"CreateEvidencePayload"}
func (ec *executionContext) _CreateEvidencePayload(ctx context.Context, sel ast.SelectionSet, obj *types.CreateEvidencePayload) graphql.Marshaler {
@@ -29174,6 +32192,11 @@ func (ec *executionContext) _CreatePolicyPayload(ctx context.Context, sel ast.Se
if out.Values[i] == graphql.Null {
out.Invalids++
}
+ case "policyVersionEdge":
+ out.Values[i] = ec._CreatePolicyPayload_policyVersionEdge(ctx, field, obj)
+ if out.Values[i] == graphql.Null {
+ out.Invalids++
+ }
default:
panic("unknown field " + strconv.Quote(field.Name))
}
@@ -31103,16 +34126,37 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet)
if out.Values[i] == graphql.Null {
out.Invalids++
}
- case "updatePolicy":
+ case "deletePolicy":
out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
- return ec._Mutation_updatePolicy(ctx, field)
+ return ec._Mutation_deletePolicy(ctx, field)
})
if out.Values[i] == graphql.Null {
out.Invalids++
}
- case "deletePolicy":
+ case "publishPolicyVersion":
out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
- return ec._Mutation_deletePolicy(ctx, field)
+ return ec._Mutation_publishPolicyVersion(ctx, field)
+ })
+ if out.Values[i] == graphql.Null {
+ out.Invalids++
+ }
+ case "createDraftPolicyVersion":
+ out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
+ return ec._Mutation_createDraftPolicyVersion(ctx, field)
+ })
+ if out.Values[i] == graphql.Null {
+ out.Invalids++
+ }
+ case "updatePolicyVersion":
+ out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
+ return ec._Mutation_updatePolicyVersion(ctx, field)
+ })
+ if out.Values[i] == graphql.Null {
+ out.Invalids++
+ }
+ case "requestSignature":
+ out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
+ return ec._Mutation_requestSignature(ctx, field)
})
if out.Values[i] == graphql.Null {
out.Invalids++
@@ -31831,23 +34875,18 @@ func (ec *executionContext) _Policy(ctx context.Context, sel ast.SelectionSet, o
if out.Values[i] == graphql.Null {
atomic.AddUint32(&out.Invalids, 1)
}
- case "name":
- out.Values[i] = ec._Policy_name(ctx, field, obj)
+ case "title":
+ out.Values[i] = ec._Policy_title(ctx, field, obj)
if out.Values[i] == graphql.Null {
atomic.AddUint32(&out.Invalids, 1)
}
- case "status":
- out.Values[i] = ec._Policy_status(ctx, field, obj)
+ case "description":
+ out.Values[i] = ec._Policy_description(ctx, field, obj)
if out.Values[i] == graphql.Null {
atomic.AddUint32(&out.Invalids, 1)
}
- case "content":
- out.Values[i] = ec._Policy_content(ctx, field, obj)
- if out.Values[i] == graphql.Null {
- atomic.AddUint32(&out.Invalids, 1)
- }
- case "reviewDate":
- out.Values[i] = ec._Policy_reviewDate(ctx, field, obj)
+ case "currentPublishedVersion":
+ out.Values[i] = ec._Policy_currentPublishedVersion(ctx, field, obj)
case "owner":
field := field
@@ -31883,6 +34922,42 @@ func (ec *executionContext) _Policy(ctx context.Context, sel ast.SelectionSet, o
continue
}
+ out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) })
+ case "versions":
+ field := field
+
+ innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) {
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ }
+ }()
+ res = ec._Policy_versions(ctx, field, obj)
+ if res == graphql.Null {
+ atomic.AddUint32(&fs.Invalids, 1)
+ }
+ return res
+ }
+
+ if field.Deferrable != nil {
+ dfs, ok := deferred[field.Deferrable.Label]
+ di := 0
+ if ok {
+ dfs.AddField(field)
+ di = len(dfs.Values) - 1
+ } else {
+ dfs = graphql.NewFieldSet([]graphql.CollectedField{field})
+ deferred[field.Deferrable.Label] = dfs
+ }
+ dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler {
+ return innerFunc(ctx, dfs)
+ })
+
+ // don't run the out.Concurrently() call below
+ out.Values[i] = graphql.Null
+ continue
+ }
+
out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) })
case "controls":
field := field
@@ -32041,6 +35116,571 @@ func (ec *executionContext) _PolicyEdge(ctx context.Context, sel ast.SelectionSe
return out
}
+var policyVersionImplementors = []string{"PolicyVersion", "Node"}
+
+func (ec *executionContext) _PolicyVersion(ctx context.Context, sel ast.SelectionSet, obj *types.PolicyVersion) graphql.Marshaler {
+ fields := graphql.CollectFields(ec.OperationContext, sel, policyVersionImplementors)
+
+ out := graphql.NewFieldSet(fields)
+ deferred := make(map[string]*graphql.FieldSet)
+ for i, field := range fields {
+ switch field.Name {
+ case "__typename":
+ out.Values[i] = graphql.MarshalString("PolicyVersion")
+ case "id":
+ out.Values[i] = ec._PolicyVersion_id(ctx, field, obj)
+ if out.Values[i] == graphql.Null {
+ atomic.AddUint32(&out.Invalids, 1)
+ }
+ case "policy":
+ field := field
+
+ innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) {
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ }
+ }()
+ res = ec._PolicyVersion_policy(ctx, field, obj)
+ if res == graphql.Null {
+ atomic.AddUint32(&fs.Invalids, 1)
+ }
+ return res
+ }
+
+ if field.Deferrable != nil {
+ dfs, ok := deferred[field.Deferrable.Label]
+ di := 0
+ if ok {
+ dfs.AddField(field)
+ di = len(dfs.Values) - 1
+ } else {
+ dfs = graphql.NewFieldSet([]graphql.CollectedField{field})
+ deferred[field.Deferrable.Label] = dfs
+ }
+ dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler {
+ return innerFunc(ctx, dfs)
+ })
+
+ // don't run the out.Concurrently() call below
+ out.Values[i] = graphql.Null
+ continue
+ }
+
+ out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) })
+ case "status":
+ out.Values[i] = ec._PolicyVersion_status(ctx, field, obj)
+ if out.Values[i] == graphql.Null {
+ atomic.AddUint32(&out.Invalids, 1)
+ }
+ case "version":
+ out.Values[i] = ec._PolicyVersion_version(ctx, field, obj)
+ if out.Values[i] == graphql.Null {
+ atomic.AddUint32(&out.Invalids, 1)
+ }
+ case "content":
+ out.Values[i] = ec._PolicyVersion_content(ctx, field, obj)
+ if out.Values[i] == graphql.Null {
+ atomic.AddUint32(&out.Invalids, 1)
+ }
+ case "changelog":
+ out.Values[i] = ec._PolicyVersion_changelog(ctx, field, obj)
+ if out.Values[i] == graphql.Null {
+ atomic.AddUint32(&out.Invalids, 1)
+ }
+ case "signatures":
+ field := field
+
+ innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) {
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ }
+ }()
+ res = ec._PolicyVersion_signatures(ctx, field, obj)
+ if res == graphql.Null {
+ atomic.AddUint32(&fs.Invalids, 1)
+ }
+ return res
+ }
+
+ if field.Deferrable != nil {
+ dfs, ok := deferred[field.Deferrable.Label]
+ di := 0
+ if ok {
+ dfs.AddField(field)
+ di = len(dfs.Values) - 1
+ } else {
+ dfs = graphql.NewFieldSet([]graphql.CollectedField{field})
+ deferred[field.Deferrable.Label] = dfs
+ }
+ dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler {
+ return innerFunc(ctx, dfs)
+ })
+
+ // don't run the out.Concurrently() call below
+ out.Values[i] = graphql.Null
+ continue
+ }
+
+ out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) })
+ case "publishedBy":
+ field := field
+
+ innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) {
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ }
+ }()
+ res = ec._PolicyVersion_publishedBy(ctx, field, obj)
+ return res
+ }
+
+ if field.Deferrable != nil {
+ dfs, ok := deferred[field.Deferrable.Label]
+ di := 0
+ if ok {
+ dfs.AddField(field)
+ di = len(dfs.Values) - 1
+ } else {
+ dfs = graphql.NewFieldSet([]graphql.CollectedField{field})
+ deferred[field.Deferrable.Label] = dfs
+ }
+ dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler {
+ return innerFunc(ctx, dfs)
+ })
+
+ // don't run the out.Concurrently() call below
+ out.Values[i] = graphql.Null
+ continue
+ }
+
+ out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) })
+ case "publishedAt":
+ out.Values[i] = ec._PolicyVersion_publishedAt(ctx, field, obj)
+ case "createdAt":
+ out.Values[i] = ec._PolicyVersion_createdAt(ctx, field, obj)
+ if out.Values[i] == graphql.Null {
+ atomic.AddUint32(&out.Invalids, 1)
+ }
+ case "updatedAt":
+ out.Values[i] = ec._PolicyVersion_updatedAt(ctx, field, obj)
+ if out.Values[i] == graphql.Null {
+ atomic.AddUint32(&out.Invalids, 1)
+ }
+ default:
+ panic("unknown field " + strconv.Quote(field.Name))
+ }
+ }
+ out.Dispatch(ctx)
+ if out.Invalids > 0 {
+ return graphql.Null
+ }
+
+ atomic.AddInt32(&ec.deferred, int32(len(deferred)))
+
+ for label, dfs := range deferred {
+ ec.processDeferredGroup(graphql.DeferredGroup{
+ Label: label,
+ Path: graphql.GetPath(ctx),
+ FieldSet: dfs,
+ Context: ctx,
+ })
+ }
+
+ return out
+}
+
+var policyVersionConnectionImplementors = []string{"PolicyVersionConnection"}
+
+func (ec *executionContext) _PolicyVersionConnection(ctx context.Context, sel ast.SelectionSet, obj *types.PolicyVersionConnection) graphql.Marshaler {
+ fields := graphql.CollectFields(ec.OperationContext, sel, policyVersionConnectionImplementors)
+
+ out := graphql.NewFieldSet(fields)
+ deferred := make(map[string]*graphql.FieldSet)
+ for i, field := range fields {
+ switch field.Name {
+ case "__typename":
+ out.Values[i] = graphql.MarshalString("PolicyVersionConnection")
+ case "edges":
+ out.Values[i] = ec._PolicyVersionConnection_edges(ctx, field, obj)
+ if out.Values[i] == graphql.Null {
+ out.Invalids++
+ }
+ case "pageInfo":
+ out.Values[i] = ec._PolicyVersionConnection_pageInfo(ctx, field, obj)
+ if out.Values[i] == graphql.Null {
+ out.Invalids++
+ }
+ default:
+ panic("unknown field " + strconv.Quote(field.Name))
+ }
+ }
+ out.Dispatch(ctx)
+ if out.Invalids > 0 {
+ return graphql.Null
+ }
+
+ atomic.AddInt32(&ec.deferred, int32(len(deferred)))
+
+ for label, dfs := range deferred {
+ ec.processDeferredGroup(graphql.DeferredGroup{
+ Label: label,
+ Path: graphql.GetPath(ctx),
+ FieldSet: dfs,
+ Context: ctx,
+ })
+ }
+
+ return out
+}
+
+var policyVersionEdgeImplementors = []string{"PolicyVersionEdge"}
+
+func (ec *executionContext) _PolicyVersionEdge(ctx context.Context, sel ast.SelectionSet, obj *types.PolicyVersionEdge) graphql.Marshaler {
+ fields := graphql.CollectFields(ec.OperationContext, sel, policyVersionEdgeImplementors)
+
+ out := graphql.NewFieldSet(fields)
+ deferred := make(map[string]*graphql.FieldSet)
+ for i, field := range fields {
+ switch field.Name {
+ case "__typename":
+ out.Values[i] = graphql.MarshalString("PolicyVersionEdge")
+ case "cursor":
+ out.Values[i] = ec._PolicyVersionEdge_cursor(ctx, field, obj)
+ if out.Values[i] == graphql.Null {
+ out.Invalids++
+ }
+ case "node":
+ out.Values[i] = ec._PolicyVersionEdge_node(ctx, field, obj)
+ if out.Values[i] == graphql.Null {
+ out.Invalids++
+ }
+ default:
+ panic("unknown field " + strconv.Quote(field.Name))
+ }
+ }
+ out.Dispatch(ctx)
+ if out.Invalids > 0 {
+ return graphql.Null
+ }
+
+ atomic.AddInt32(&ec.deferred, int32(len(deferred)))
+
+ for label, dfs := range deferred {
+ ec.processDeferredGroup(graphql.DeferredGroup{
+ Label: label,
+ Path: graphql.GetPath(ctx),
+ FieldSet: dfs,
+ Context: ctx,
+ })
+ }
+
+ return out
+}
+
+var policyVersionSignatureImplementors = []string{"PolicyVersionSignature", "Node"}
+
+func (ec *executionContext) _PolicyVersionSignature(ctx context.Context, sel ast.SelectionSet, obj *types.PolicyVersionSignature) graphql.Marshaler {
+ fields := graphql.CollectFields(ec.OperationContext, sel, policyVersionSignatureImplementors)
+
+ out := graphql.NewFieldSet(fields)
+ deferred := make(map[string]*graphql.FieldSet)
+ for i, field := range fields {
+ switch field.Name {
+ case "__typename":
+ out.Values[i] = graphql.MarshalString("PolicyVersionSignature")
+ case "id":
+ out.Values[i] = ec._PolicyVersionSignature_id(ctx, field, obj)
+ if out.Values[i] == graphql.Null {
+ atomic.AddUint32(&out.Invalids, 1)
+ }
+ case "policyVersion":
+ field := field
+
+ innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) {
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ }
+ }()
+ res = ec._PolicyVersionSignature_policyVersion(ctx, field, obj)
+ if res == graphql.Null {
+ atomic.AddUint32(&fs.Invalids, 1)
+ }
+ return res
+ }
+
+ if field.Deferrable != nil {
+ dfs, ok := deferred[field.Deferrable.Label]
+ di := 0
+ if ok {
+ dfs.AddField(field)
+ di = len(dfs.Values) - 1
+ } else {
+ dfs = graphql.NewFieldSet([]graphql.CollectedField{field})
+ deferred[field.Deferrable.Label] = dfs
+ }
+ dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler {
+ return innerFunc(ctx, dfs)
+ })
+
+ // don't run the out.Concurrently() call below
+ out.Values[i] = graphql.Null
+ continue
+ }
+
+ out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) })
+ case "state":
+ out.Values[i] = ec._PolicyVersionSignature_state(ctx, field, obj)
+ if out.Values[i] == graphql.Null {
+ atomic.AddUint32(&out.Invalids, 1)
+ }
+ case "signedBy":
+ field := field
+
+ innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) {
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ }
+ }()
+ res = ec._PolicyVersionSignature_signedBy(ctx, field, obj)
+ if res == graphql.Null {
+ atomic.AddUint32(&fs.Invalids, 1)
+ }
+ return res
+ }
+
+ if field.Deferrable != nil {
+ dfs, ok := deferred[field.Deferrable.Label]
+ di := 0
+ if ok {
+ dfs.AddField(field)
+ di = len(dfs.Values) - 1
+ } else {
+ dfs = graphql.NewFieldSet([]graphql.CollectedField{field})
+ deferred[field.Deferrable.Label] = dfs
+ }
+ dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler {
+ return innerFunc(ctx, dfs)
+ })
+
+ // don't run the out.Concurrently() call below
+ out.Values[i] = graphql.Null
+ continue
+ }
+
+ out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) })
+ case "signedAt":
+ out.Values[i] = ec._PolicyVersionSignature_signedAt(ctx, field, obj)
+ case "requestedAt":
+ out.Values[i] = ec._PolicyVersionSignature_requestedAt(ctx, field, obj)
+ if out.Values[i] == graphql.Null {
+ atomic.AddUint32(&out.Invalids, 1)
+ }
+ case "requestedBy":
+ field := field
+
+ innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) {
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ }
+ }()
+ res = ec._PolicyVersionSignature_requestedBy(ctx, field, obj)
+ if res == graphql.Null {
+ atomic.AddUint32(&fs.Invalids, 1)
+ }
+ return res
+ }
+
+ if field.Deferrable != nil {
+ dfs, ok := deferred[field.Deferrable.Label]
+ di := 0
+ if ok {
+ dfs.AddField(field)
+ di = len(dfs.Values) - 1
+ } else {
+ dfs = graphql.NewFieldSet([]graphql.CollectedField{field})
+ deferred[field.Deferrable.Label] = dfs
+ }
+ dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler {
+ return innerFunc(ctx, dfs)
+ })
+
+ // don't run the out.Concurrently() call below
+ out.Values[i] = graphql.Null
+ continue
+ }
+
+ out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) })
+ case "createdAt":
+ out.Values[i] = ec._PolicyVersionSignature_createdAt(ctx, field, obj)
+ if out.Values[i] == graphql.Null {
+ atomic.AddUint32(&out.Invalids, 1)
+ }
+ case "updatedAt":
+ out.Values[i] = ec._PolicyVersionSignature_updatedAt(ctx, field, obj)
+ if out.Values[i] == graphql.Null {
+ atomic.AddUint32(&out.Invalids, 1)
+ }
+ default:
+ panic("unknown field " + strconv.Quote(field.Name))
+ }
+ }
+ out.Dispatch(ctx)
+ if out.Invalids > 0 {
+ return graphql.Null
+ }
+
+ atomic.AddInt32(&ec.deferred, int32(len(deferred)))
+
+ for label, dfs := range deferred {
+ ec.processDeferredGroup(graphql.DeferredGroup{
+ Label: label,
+ Path: graphql.GetPath(ctx),
+ FieldSet: dfs,
+ Context: ctx,
+ })
+ }
+
+ return out
+}
+
+var policyVersionSignatureConnectionImplementors = []string{"PolicyVersionSignatureConnection"}
+
+func (ec *executionContext) _PolicyVersionSignatureConnection(ctx context.Context, sel ast.SelectionSet, obj *types.PolicyVersionSignatureConnection) graphql.Marshaler {
+ fields := graphql.CollectFields(ec.OperationContext, sel, policyVersionSignatureConnectionImplementors)
+
+ out := graphql.NewFieldSet(fields)
+ deferred := make(map[string]*graphql.FieldSet)
+ for i, field := range fields {
+ switch field.Name {
+ case "__typename":
+ out.Values[i] = graphql.MarshalString("PolicyVersionSignatureConnection")
+ case "edges":
+ out.Values[i] = ec._PolicyVersionSignatureConnection_edges(ctx, field, obj)
+ if out.Values[i] == graphql.Null {
+ out.Invalids++
+ }
+ case "pageInfo":
+ out.Values[i] = ec._PolicyVersionSignatureConnection_pageInfo(ctx, field, obj)
+ if out.Values[i] == graphql.Null {
+ out.Invalids++
+ }
+ default:
+ panic("unknown field " + strconv.Quote(field.Name))
+ }
+ }
+ out.Dispatch(ctx)
+ if out.Invalids > 0 {
+ return graphql.Null
+ }
+
+ atomic.AddInt32(&ec.deferred, int32(len(deferred)))
+
+ for label, dfs := range deferred {
+ ec.processDeferredGroup(graphql.DeferredGroup{
+ Label: label,
+ Path: graphql.GetPath(ctx),
+ FieldSet: dfs,
+ Context: ctx,
+ })
+ }
+
+ return out
+}
+
+var policyVersionSignatureEdgeImplementors = []string{"PolicyVersionSignatureEdge"}
+
+func (ec *executionContext) _PolicyVersionSignatureEdge(ctx context.Context, sel ast.SelectionSet, obj *types.PolicyVersionSignatureEdge) graphql.Marshaler {
+ fields := graphql.CollectFields(ec.OperationContext, sel, policyVersionSignatureEdgeImplementors)
+
+ out := graphql.NewFieldSet(fields)
+ deferred := make(map[string]*graphql.FieldSet)
+ for i, field := range fields {
+ switch field.Name {
+ case "__typename":
+ out.Values[i] = graphql.MarshalString("PolicyVersionSignatureEdge")
+ case "cursor":
+ out.Values[i] = ec._PolicyVersionSignatureEdge_cursor(ctx, field, obj)
+ if out.Values[i] == graphql.Null {
+ out.Invalids++
+ }
+ case "node":
+ out.Values[i] = ec._PolicyVersionSignatureEdge_node(ctx, field, obj)
+ if out.Values[i] == graphql.Null {
+ out.Invalids++
+ }
+ default:
+ panic("unknown field " + strconv.Quote(field.Name))
+ }
+ }
+ out.Dispatch(ctx)
+ if out.Invalids > 0 {
+ return graphql.Null
+ }
+
+ atomic.AddInt32(&ec.deferred, int32(len(deferred)))
+
+ for label, dfs := range deferred {
+ ec.processDeferredGroup(graphql.DeferredGroup{
+ Label: label,
+ Path: graphql.GetPath(ctx),
+ FieldSet: dfs,
+ Context: ctx,
+ })
+ }
+
+ return out
+}
+
+var publishPolicyVersionPayloadImplementors = []string{"PublishPolicyVersionPayload"}
+
+func (ec *executionContext) _PublishPolicyVersionPayload(ctx context.Context, sel ast.SelectionSet, obj *types.PublishPolicyVersionPayload) graphql.Marshaler {
+ fields := graphql.CollectFields(ec.OperationContext, sel, publishPolicyVersionPayloadImplementors)
+
+ out := graphql.NewFieldSet(fields)
+ deferred := make(map[string]*graphql.FieldSet)
+ for i, field := range fields {
+ switch field.Name {
+ case "__typename":
+ out.Values[i] = graphql.MarshalString("PublishPolicyVersionPayload")
+ case "policyVersion":
+ out.Values[i] = ec._PublishPolicyVersionPayload_policyVersion(ctx, field, obj)
+ if out.Values[i] == graphql.Null {
+ out.Invalids++
+ }
+ case "policy":
+ out.Values[i] = ec._PublishPolicyVersionPayload_policy(ctx, field, obj)
+ if out.Values[i] == graphql.Null {
+ out.Invalids++
+ }
+ default:
+ panic("unknown field " + strconv.Quote(field.Name))
+ }
+ }
+ out.Dispatch(ctx)
+ if out.Invalids > 0 {
+ return graphql.Null
+ }
+
+ atomic.AddInt32(&ec.deferred, int32(len(deferred)))
+
+ for label, dfs := range deferred {
+ ec.processDeferredGroup(graphql.DeferredGroup{
+ Label: label,
+ Path: graphql.GetPath(ctx),
+ FieldSet: dfs,
+ Context: ctx,
+ })
+ }
+
+ return out
+}
+
var queryImplementors = []string{"Query"}
func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler {
@@ -32213,6 +35853,45 @@ func (ec *executionContext) _RequestEvidencePayload(ctx context.Context, sel ast
return out
}
+var requestSignaturePayloadImplementors = []string{"RequestSignaturePayload"}
+
+func (ec *executionContext) _RequestSignaturePayload(ctx context.Context, sel ast.SelectionSet, obj *types.RequestSignaturePayload) graphql.Marshaler {
+ fields := graphql.CollectFields(ec.OperationContext, sel, requestSignaturePayloadImplementors)
+
+ out := graphql.NewFieldSet(fields)
+ deferred := make(map[string]*graphql.FieldSet)
+ for i, field := range fields {
+ switch field.Name {
+ case "__typename":
+ out.Values[i] = graphql.MarshalString("RequestSignaturePayload")
+ case "policyVersionSignatureEdge":
+ out.Values[i] = ec._RequestSignaturePayload_policyVersionSignatureEdge(ctx, field, obj)
+ if out.Values[i] == graphql.Null {
+ out.Invalids++
+ }
+ default:
+ panic("unknown field " + strconv.Quote(field.Name))
+ }
+ }
+ out.Dispatch(ctx)
+ if out.Invalids > 0 {
+ return graphql.Null
+ }
+
+ atomic.AddInt32(&ec.deferred, int32(len(deferred)))
+
+ for label, dfs := range deferred {
+ ec.processDeferredGroup(graphql.DeferredGroup{
+ Label: label,
+ Path: graphql.GetPath(ctx),
+ FieldSet: dfs,
+ Context: ctx,
+ })
+ }
+
+ return out
+}
+
var riskImplementors = []string{"Risk", "Node"}
func (ec *executionContext) _Risk(ctx context.Context, sel ast.SelectionSet, obj *types.Risk) graphql.Marshaler {
@@ -33047,6 +36726,45 @@ func (ec *executionContext) _UpdatePolicyPayload(ctx context.Context, sel ast.Se
return out
}
+var updatePolicyVersionPayloadImplementors = []string{"UpdatePolicyVersionPayload"}
+
+func (ec *executionContext) _UpdatePolicyVersionPayload(ctx context.Context, sel ast.SelectionSet, obj *types.UpdatePolicyVersionPayload) graphql.Marshaler {
+ fields := graphql.CollectFields(ec.OperationContext, sel, updatePolicyVersionPayloadImplementors)
+
+ out := graphql.NewFieldSet(fields)
+ deferred := make(map[string]*graphql.FieldSet)
+ for i, field := range fields {
+ switch field.Name {
+ case "__typename":
+ out.Values[i] = graphql.MarshalString("UpdatePolicyVersionPayload")
+ case "policyVersion":
+ out.Values[i] = ec._UpdatePolicyVersionPayload_policyVersion(ctx, field, obj)
+ if out.Values[i] == graphql.Null {
+ out.Invalids++
+ }
+ default:
+ panic("unknown field " + strconv.Quote(field.Name))
+ }
+ }
+ out.Dispatch(ctx)
+ if out.Invalids > 0 {
+ return graphql.Null
+ }
+
+ atomic.AddInt32(&ec.deferred, int32(len(deferred)))
+
+ for label, dfs := range deferred {
+ ec.processDeferredGroup(graphql.DeferredGroup{
+ Label: label,
+ Path: graphql.GetPath(ctx),
+ FieldSet: dfs,
+ Context: ctx,
+ })
+ }
+
+ return out
+}
+
var updateRiskPayloadImplementors = []string{"UpdateRiskPayload"}
func (ec *executionContext) _UpdateRiskPayload(ctx context.Context, sel ast.SelectionSet, obj *types.UpdateRiskPayload) graphql.Marshaler {
@@ -34899,6 +38617,25 @@ func (ec *executionContext) marshalNCreateControlPolicyMappingPayload2ᚖgithub
return ec._CreateControlPolicyMappingPayload(ctx, sel, v)
}
+func (ec *executionContext) unmarshalNCreateDraftPolicyVersionInput2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐCreateDraftPolicyVersionInput(ctx context.Context, v any) (types.CreateDraftPolicyVersionInput, error) {
+ res, err := ec.unmarshalInputCreateDraftPolicyVersionInput(ctx, v)
+ return res, graphql.ErrorOnPath(ctx, err)
+}
+
+func (ec *executionContext) marshalNCreateDraftPolicyVersionPayload2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐCreateDraftPolicyVersionPayload(ctx context.Context, sel ast.SelectionSet, v types.CreateDraftPolicyVersionPayload) graphql.Marshaler {
+ return ec._CreateDraftPolicyVersionPayload(ctx, sel, &v)
+}
+
+func (ec *executionContext) marshalNCreateDraftPolicyVersionPayload2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐCreateDraftPolicyVersionPayload(ctx context.Context, sel ast.SelectionSet, v *types.CreateDraftPolicyVersionPayload) graphql.Marshaler {
+ if v == nil {
+ if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
+ ec.Errorf(ctx, "the requested element is null which the schema does not allow")
+ }
+ return graphql.Null
+ }
+ return ec._CreateDraftPolicyVersionPayload(ctx, sel, v)
+}
+
func (ec *executionContext) unmarshalNCreateEvidenceInput2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐCreateEvidenceInput(ctx context.Context, v any) (types.CreateEvidenceInput, error) {
res, err := ec.unmarshalInputCreateEvidenceInput(ctx, v)
return res, graphql.ErrorOnPath(ctx, err)
@@ -36220,6 +39957,10 @@ var (
}
)
+func (ec *executionContext) marshalNPolicy2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐPolicy(ctx context.Context, sel ast.SelectionSet, v types.Policy) graphql.Marshaler {
+ return ec._Policy(ctx, sel, &v)
+}
+
func (ec *executionContext) marshalNPolicy2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐPolicy(ctx context.Context, sel ast.SelectionSet, v *types.Policy) graphql.Marshaler {
if v == nil {
if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
@@ -36300,12 +40041,12 @@ func (ec *executionContext) marshalNPolicyEdge2ᚖgithubᚗcomᚋgetproboᚋprob
func (ec *executionContext) unmarshalNPolicyOrderField2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐPolicyOrderField(ctx context.Context, v any) (coredata.PolicyOrderField, error) {
tmp, err := graphql.UnmarshalString(v)
- res := coredata.PolicyOrderField(tmp)
+ res := unmarshalNPolicyOrderField2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐPolicyOrderField[tmp]
return res, graphql.ErrorOnPath(ctx, err)
}
func (ec *executionContext) marshalNPolicyOrderField2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐPolicyOrderField(ctx context.Context, sel ast.SelectionSet, v coredata.PolicyOrderField) graphql.Marshaler {
- res := graphql.MarshalString(string(v))
+ res := graphql.MarshalString(marshalNPolicyOrderField2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐPolicyOrderField[v])
if res == graphql.Null {
if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
ec.Errorf(ctx, "the requested element is null which the schema does not allow")
@@ -36314,6 +40055,17 @@ func (ec *executionContext) marshalNPolicyOrderField2githubᚗcomᚋgetproboᚋp
return res
}
+var (
+ unmarshalNPolicyOrderField2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐPolicyOrderField = map[string]coredata.PolicyOrderField{
+ "TITLE": coredata.PolicyOrderFieldTitle,
+ "CREATED_AT": coredata.PolicyOrderFieldCreatedAt,
+ }
+ marshalNPolicyOrderField2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐPolicyOrderField = map[coredata.PolicyOrderField]string{
+ coredata.PolicyOrderFieldTitle: "TITLE",
+ coredata.PolicyOrderFieldCreatedAt: "CREATED_AT",
+ }
+)
+
func (ec *executionContext) unmarshalNPolicyStatus2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐPolicyStatus(ctx context.Context, v any) (coredata.PolicyStatus, error) {
tmp, err := graphql.UnmarshalString(v)
res := unmarshalNPolicyStatus2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐPolicyStatus[tmp]
@@ -36332,15 +40084,275 @@ func (ec *executionContext) marshalNPolicyStatus2githubᚗcomᚋgetproboᚋprobo
var (
unmarshalNPolicyStatus2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐPolicyStatus = map[string]coredata.PolicyStatus{
- "DRAFT": coredata.PolicyStatusDraft,
- "ACTIVE": coredata.PolicyStatusActive,
+ "DRAFT": coredata.PolicyStatusDraft,
+ "PUBLISHED": coredata.PolicyStatusPublished,
}
marshalNPolicyStatus2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐPolicyStatus = map[coredata.PolicyStatus]string{
- coredata.PolicyStatusDraft: "DRAFT",
- coredata.PolicyStatusActive: "ACTIVE",
+ coredata.PolicyStatusDraft: "DRAFT",
+ coredata.PolicyStatusPublished: "PUBLISHED",
}
)
+func (ec *executionContext) marshalNPolicyVersion2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐPolicyVersion(ctx context.Context, sel ast.SelectionSet, v types.PolicyVersion) graphql.Marshaler {
+ return ec._PolicyVersion(ctx, sel, &v)
+}
+
+func (ec *executionContext) marshalNPolicyVersion2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐPolicyVersion(ctx context.Context, sel ast.SelectionSet, v *types.PolicyVersion) graphql.Marshaler {
+ if v == nil {
+ if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
+ ec.Errorf(ctx, "the requested element is null which the schema does not allow")
+ }
+ return graphql.Null
+ }
+ return ec._PolicyVersion(ctx, sel, v)
+}
+
+func (ec *executionContext) marshalNPolicyVersionConnection2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐPolicyVersionConnection(ctx context.Context, sel ast.SelectionSet, v types.PolicyVersionConnection) graphql.Marshaler {
+ return ec._PolicyVersionConnection(ctx, sel, &v)
+}
+
+func (ec *executionContext) marshalNPolicyVersionConnection2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐPolicyVersionConnection(ctx context.Context, sel ast.SelectionSet, v *types.PolicyVersionConnection) graphql.Marshaler {
+ if v == nil {
+ if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
+ ec.Errorf(ctx, "the requested element is null which the schema does not allow")
+ }
+ return graphql.Null
+ }
+ return ec._PolicyVersionConnection(ctx, sel, v)
+}
+
+func (ec *executionContext) marshalNPolicyVersionEdge2ᚕᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐPolicyVersionEdgeᚄ(ctx context.Context, sel ast.SelectionSet, v []*types.PolicyVersionEdge) graphql.Marshaler {
+ ret := make(graphql.Array, len(v))
+ var wg sync.WaitGroup
+ isLen1 := len(v) == 1
+ if !isLen1 {
+ wg.Add(len(v))
+ }
+ for i := range v {
+ i := i
+ fc := &graphql.FieldContext{
+ Index: &i,
+ Result: &v[i],
+ }
+ ctx := graphql.WithFieldContext(ctx, fc)
+ f := func(i int) {
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ ret = nil
+ }
+ }()
+ if !isLen1 {
+ defer wg.Done()
+ }
+ ret[i] = ec.marshalNPolicyVersionEdge2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐPolicyVersionEdge(ctx, sel, v[i])
+ }
+ if isLen1 {
+ f(i)
+ } else {
+ go f(i)
+ }
+
+ }
+ wg.Wait()
+
+ for _, e := range ret {
+ if e == graphql.Null {
+ return graphql.Null
+ }
+ }
+
+ return ret
+}
+
+func (ec *executionContext) marshalNPolicyVersionEdge2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐPolicyVersionEdge(ctx context.Context, sel ast.SelectionSet, v *types.PolicyVersionEdge) graphql.Marshaler {
+ if v == nil {
+ if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
+ ec.Errorf(ctx, "the requested element is null which the schema does not allow")
+ }
+ return graphql.Null
+ }
+ return ec._PolicyVersionEdge(ctx, sel, v)
+}
+
+func (ec *executionContext) unmarshalNPolicyVersionOrderField2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐPolicyVersionOrderField(ctx context.Context, v any) (coredata.PolicyVersionOrderField, error) {
+ tmp, err := graphql.UnmarshalString(v)
+ res := unmarshalNPolicyVersionOrderField2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐPolicyVersionOrderField[tmp]
+ return res, graphql.ErrorOnPath(ctx, err)
+}
+
+func (ec *executionContext) marshalNPolicyVersionOrderField2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐPolicyVersionOrderField(ctx context.Context, sel ast.SelectionSet, v coredata.PolicyVersionOrderField) graphql.Marshaler {
+ res := graphql.MarshalString(marshalNPolicyVersionOrderField2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐPolicyVersionOrderField[v])
+ if res == graphql.Null {
+ if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
+ ec.Errorf(ctx, "the requested element is null which the schema does not allow")
+ }
+ }
+ return res
+}
+
+var (
+ unmarshalNPolicyVersionOrderField2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐPolicyVersionOrderField = map[string]coredata.PolicyVersionOrderField{
+ "VERSION": coredata.PolicyVersionOrderFieldVersion,
+ "CREATED_AT": coredata.PolicyVersionOrderFieldCreatedAt,
+ }
+ marshalNPolicyVersionOrderField2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐPolicyVersionOrderField = map[coredata.PolicyVersionOrderField]string{
+ coredata.PolicyVersionOrderFieldVersion: "VERSION",
+ coredata.PolicyVersionOrderFieldCreatedAt: "CREATED_AT",
+ }
+)
+
+func (ec *executionContext) marshalNPolicyVersionSignature2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐPolicyVersionSignature(ctx context.Context, sel ast.SelectionSet, v *types.PolicyVersionSignature) graphql.Marshaler {
+ if v == nil {
+ if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
+ ec.Errorf(ctx, "the requested element is null which the schema does not allow")
+ }
+ return graphql.Null
+ }
+ return ec._PolicyVersionSignature(ctx, sel, v)
+}
+
+func (ec *executionContext) marshalNPolicyVersionSignatureConnection2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐPolicyVersionSignatureConnection(ctx context.Context, sel ast.SelectionSet, v types.PolicyVersionSignatureConnection) graphql.Marshaler {
+ return ec._PolicyVersionSignatureConnection(ctx, sel, &v)
+}
+
+func (ec *executionContext) marshalNPolicyVersionSignatureConnection2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐPolicyVersionSignatureConnection(ctx context.Context, sel ast.SelectionSet, v *types.PolicyVersionSignatureConnection) graphql.Marshaler {
+ if v == nil {
+ if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
+ ec.Errorf(ctx, "the requested element is null which the schema does not allow")
+ }
+ return graphql.Null
+ }
+ return ec._PolicyVersionSignatureConnection(ctx, sel, v)
+}
+
+func (ec *executionContext) marshalNPolicyVersionSignatureEdge2ᚕᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐPolicyVersionSignatureEdgeᚄ(ctx context.Context, sel ast.SelectionSet, v []*types.PolicyVersionSignatureEdge) graphql.Marshaler {
+ ret := make(graphql.Array, len(v))
+ var wg sync.WaitGroup
+ isLen1 := len(v) == 1
+ if !isLen1 {
+ wg.Add(len(v))
+ }
+ for i := range v {
+ i := i
+ fc := &graphql.FieldContext{
+ Index: &i,
+ Result: &v[i],
+ }
+ ctx := graphql.WithFieldContext(ctx, fc)
+ f := func(i int) {
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ ret = nil
+ }
+ }()
+ if !isLen1 {
+ defer wg.Done()
+ }
+ ret[i] = ec.marshalNPolicyVersionSignatureEdge2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐPolicyVersionSignatureEdge(ctx, sel, v[i])
+ }
+ if isLen1 {
+ f(i)
+ } else {
+ go f(i)
+ }
+
+ }
+ wg.Wait()
+
+ for _, e := range ret {
+ if e == graphql.Null {
+ return graphql.Null
+ }
+ }
+
+ return ret
+}
+
+func (ec *executionContext) marshalNPolicyVersionSignatureEdge2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐPolicyVersionSignatureEdge(ctx context.Context, sel ast.SelectionSet, v *types.PolicyVersionSignatureEdge) graphql.Marshaler {
+ if v == nil {
+ if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
+ ec.Errorf(ctx, "the requested element is null which the schema does not allow")
+ }
+ return graphql.Null
+ }
+ return ec._PolicyVersionSignatureEdge(ctx, sel, v)
+}
+
+func (ec *executionContext) unmarshalNPolicyVersionSignatureOrderField2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐPolicyVersionSignatureOrderField(ctx context.Context, v any) (coredata.PolicyVersionSignatureOrderField, error) {
+ tmp, err := graphql.UnmarshalString(v)
+ res := unmarshalNPolicyVersionSignatureOrderField2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐPolicyVersionSignatureOrderField[tmp]
+ return res, graphql.ErrorOnPath(ctx, err)
+}
+
+func (ec *executionContext) marshalNPolicyVersionSignatureOrderField2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐPolicyVersionSignatureOrderField(ctx context.Context, sel ast.SelectionSet, v coredata.PolicyVersionSignatureOrderField) graphql.Marshaler {
+ res := graphql.MarshalString(marshalNPolicyVersionSignatureOrderField2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐPolicyVersionSignatureOrderField[v])
+ if res == graphql.Null {
+ if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
+ ec.Errorf(ctx, "the requested element is null which the schema does not allow")
+ }
+ }
+ return res
+}
+
+var (
+ unmarshalNPolicyVersionSignatureOrderField2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐPolicyVersionSignatureOrderField = map[string]coredata.PolicyVersionSignatureOrderField{
+ "CREATED_AT": coredata.PolicyVersionSignatureOrderFieldCreatedAt,
+ "SIGNED_AT": coredata.PolicyVersionSignatureOrderFieldSignedAt,
+ }
+ marshalNPolicyVersionSignatureOrderField2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐPolicyVersionSignatureOrderField = map[coredata.PolicyVersionSignatureOrderField]string{
+ coredata.PolicyVersionSignatureOrderFieldCreatedAt: "CREATED_AT",
+ coredata.PolicyVersionSignatureOrderFieldSignedAt: "SIGNED_AT",
+ }
+)
+
+func (ec *executionContext) unmarshalNPolicyVersionSignatureState2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐPolicyVersionSignatureState(ctx context.Context, v any) (coredata.PolicyVersionSignatureState, error) {
+ tmp, err := graphql.UnmarshalString(v)
+ res := unmarshalNPolicyVersionSignatureState2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐPolicyVersionSignatureState[tmp]
+ return res, graphql.ErrorOnPath(ctx, err)
+}
+
+func (ec *executionContext) marshalNPolicyVersionSignatureState2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐPolicyVersionSignatureState(ctx context.Context, sel ast.SelectionSet, v coredata.PolicyVersionSignatureState) graphql.Marshaler {
+ res := graphql.MarshalString(marshalNPolicyVersionSignatureState2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐPolicyVersionSignatureState[v])
+ if res == graphql.Null {
+ if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
+ ec.Errorf(ctx, "the requested element is null which the schema does not allow")
+ }
+ }
+ return res
+}
+
+var (
+ unmarshalNPolicyVersionSignatureState2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐPolicyVersionSignatureState = map[string]coredata.PolicyVersionSignatureState{
+ "REQUESTED": coredata.PolicyVersionSignatureStateRequested,
+ "SIGNED": coredata.PolicyVersionSignatureStateSigned,
+ }
+ marshalNPolicyVersionSignatureState2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐPolicyVersionSignatureState = map[coredata.PolicyVersionSignatureState]string{
+ coredata.PolicyVersionSignatureStateRequested: "REQUESTED",
+ coredata.PolicyVersionSignatureStateSigned: "SIGNED",
+ }
+)
+
+func (ec *executionContext) unmarshalNPublishPolicyVersionInput2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐPublishPolicyVersionInput(ctx context.Context, v any) (types.PublishPolicyVersionInput, error) {
+ res, err := ec.unmarshalInputPublishPolicyVersionInput(ctx, v)
+ return res, graphql.ErrorOnPath(ctx, err)
+}
+
+func (ec *executionContext) marshalNPublishPolicyVersionPayload2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐPublishPolicyVersionPayload(ctx context.Context, sel ast.SelectionSet, v types.PublishPolicyVersionPayload) graphql.Marshaler {
+ return ec._PublishPolicyVersionPayload(ctx, sel, &v)
+}
+
+func (ec *executionContext) marshalNPublishPolicyVersionPayload2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐPublishPolicyVersionPayload(ctx context.Context, sel ast.SelectionSet, v *types.PublishPolicyVersionPayload) graphql.Marshaler {
+ if v == nil {
+ if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
+ ec.Errorf(ctx, "the requested element is null which the schema does not allow")
+ }
+ return graphql.Null
+ }
+ return ec._PublishPolicyVersionPayload(ctx, sel, v)
+}
+
func (ec *executionContext) unmarshalNRemoveUserInput2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐRemoveUserInput(ctx context.Context, v any) (types.RemoveUserInput, error) {
res, err := ec.unmarshalInputRemoveUserInput(ctx, v)
return res, graphql.ErrorOnPath(ctx, err)
@@ -36379,6 +40391,25 @@ func (ec *executionContext) marshalNRequestEvidencePayload2ᚖgithubᚗcomᚋget
return ec._RequestEvidencePayload(ctx, sel, v)
}
+func (ec *executionContext) unmarshalNRequestSignatureInput2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐRequestSignatureInput(ctx context.Context, v any) (types.RequestSignatureInput, error) {
+ res, err := ec.unmarshalInputRequestSignatureInput(ctx, v)
+ return res, graphql.ErrorOnPath(ctx, err)
+}
+
+func (ec *executionContext) marshalNRequestSignaturePayload2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐRequestSignaturePayload(ctx context.Context, sel ast.SelectionSet, v types.RequestSignaturePayload) graphql.Marshaler {
+ return ec._RequestSignaturePayload(ctx, sel, &v)
+}
+
+func (ec *executionContext) marshalNRequestSignaturePayload2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐRequestSignaturePayload(ctx context.Context, sel ast.SelectionSet, v *types.RequestSignaturePayload) graphql.Marshaler {
+ if v == nil {
+ if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
+ ec.Errorf(ctx, "the requested element is null which the schema does not allow")
+ }
+ return graphql.Null
+ }
+ return ec._RequestSignaturePayload(ctx, sel, v)
+}
+
func (ec *executionContext) marshalNRisk2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐRisk(ctx context.Context, sel ast.SelectionSet, v *types.Risk) graphql.Marshaler {
if v == nil {
if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
@@ -36774,23 +40805,23 @@ func (ec *executionContext) marshalNUpdatePeoplePayload2ᚖgithubᚗcomᚋgetpro
return ec._UpdatePeoplePayload(ctx, sel, v)
}
-func (ec *executionContext) unmarshalNUpdatePolicyInput2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐUpdatePolicyInput(ctx context.Context, v any) (types.UpdatePolicyInput, error) {
- res, err := ec.unmarshalInputUpdatePolicyInput(ctx, v)
+func (ec *executionContext) unmarshalNUpdatePolicyVersionInput2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐUpdatePolicyVersionInput(ctx context.Context, v any) (types.UpdatePolicyVersionInput, error) {
+ res, err := ec.unmarshalInputUpdatePolicyVersionInput(ctx, v)
return res, graphql.ErrorOnPath(ctx, err)
}
-func (ec *executionContext) marshalNUpdatePolicyPayload2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐUpdatePolicyPayload(ctx context.Context, sel ast.SelectionSet, v types.UpdatePolicyPayload) graphql.Marshaler {
- return ec._UpdatePolicyPayload(ctx, sel, &v)
+func (ec *executionContext) marshalNUpdatePolicyVersionPayload2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐUpdatePolicyVersionPayload(ctx context.Context, sel ast.SelectionSet, v types.UpdatePolicyVersionPayload) graphql.Marshaler {
+ return ec._UpdatePolicyVersionPayload(ctx, sel, &v)
}
-func (ec *executionContext) marshalNUpdatePolicyPayload2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐUpdatePolicyPayload(ctx context.Context, sel ast.SelectionSet, v *types.UpdatePolicyPayload) graphql.Marshaler {
+func (ec *executionContext) marshalNUpdatePolicyVersionPayload2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐUpdatePolicyVersionPayload(ctx context.Context, sel ast.SelectionSet, v *types.UpdatePolicyVersionPayload) graphql.Marshaler {
if v == nil {
if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
ec.Errorf(ctx, "the requested element is null which the schema does not allow")
}
return graphql.Null
}
- return ec._UpdatePolicyPayload(ctx, sel, v)
+ return ec._UpdatePolicyVersionPayload(ctx, sel, v)
}
func (ec *executionContext) unmarshalNUpdateRiskInput2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐUpdateRiskInput(ctx context.Context, v any) (types.UpdateRiskInput, error) {
@@ -37820,15 +41851,39 @@ func (ec *executionContext) marshalOPolicyStatus2ᚖgithubᚗcomᚋgetproboᚋpr
var (
unmarshalOPolicyStatus2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐPolicyStatus = map[string]coredata.PolicyStatus{
- "DRAFT": coredata.PolicyStatusDraft,
- "ACTIVE": coredata.PolicyStatusActive,
+ "DRAFT": coredata.PolicyStatusDraft,
+ "PUBLISHED": coredata.PolicyStatusPublished,
}
marshalOPolicyStatus2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐPolicyStatus = map[coredata.PolicyStatus]string{
- coredata.PolicyStatusDraft: "DRAFT",
- coredata.PolicyStatusActive: "ACTIVE",
+ coredata.PolicyStatusDraft: "DRAFT",
+ coredata.PolicyStatusPublished: "PUBLISHED",
}
)
+func (ec *executionContext) unmarshalOPolicyVersionFilter2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐPolicyVersionFilter(ctx context.Context, v any) (*types.PolicyVersionFilter, error) {
+ if v == nil {
+ return nil, nil
+ }
+ res, err := ec.unmarshalInputPolicyVersionFilter(ctx, v)
+ return &res, graphql.ErrorOnPath(ctx, err)
+}
+
+func (ec *executionContext) unmarshalOPolicyVersionOrder2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐPolicyVersionOrderBy(ctx context.Context, v any) (*types.PolicyVersionOrderBy, error) {
+ if v == nil {
+ return nil, nil
+ }
+ res, err := ec.unmarshalInputPolicyVersionOrder(ctx, v)
+ return &res, graphql.ErrorOnPath(ctx, err)
+}
+
+func (ec *executionContext) unmarshalOPolicyVersionSignatureOrder2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐPolicyVersionSignatureOrder(ctx context.Context, v any) (*types.PolicyVersionSignatureOrder, error) {
+ if v == nil {
+ return nil, nil
+ }
+ res, err := ec.unmarshalInputPolicyVersionSignatureOrder(ctx, v)
+ return &res, graphql.ErrorOnPath(ctx, err)
+}
+
func (ec *executionContext) unmarshalORiskOrder2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐRiskOrderBy(ctx context.Context, v any) (*types.RiskOrderBy, error) {
if v == nil {
return nil, nil
diff --git a/pkg/server/api/console/v1/types/policy.go b/pkg/server/api/console/v1/types/policy.go
index 8878f2b74..cb3658942 100644
--- a/pkg/server/api/console/v1/types/policy.go
+++ b/pkg/server/api/console/v1/types/policy.go
@@ -44,12 +44,10 @@ func NewPolicyEdge(policy *coredata.Policy, orderBy coredata.PolicyOrderField) *
func NewPolicy(policy *coredata.Policy) *Policy {
return &Policy{
- ID: policy.ID,
- Name: policy.Name,
- Content: policy.Content,
- CreatedAt: policy.CreatedAt,
- UpdatedAt: policy.UpdatedAt,
- Status: policy.Status,
- ReviewDate: policy.ReviewDate,
+ ID: policy.ID,
+ Title: policy.Title,
+ CurrentPublishedVersion: policy.CurrentPublishedVersion,
+ CreatedAt: policy.CreatedAt,
+ UpdatedAt: policy.UpdatedAt,
}
}
diff --git a/pkg/server/api/console/v1/types/policy_version.go b/pkg/server/api/console/v1/types/policy_version.go
new file mode 100644
index 000000000..2835f86db
--- /dev/null
+++ b/pkg/server/api/console/v1/types/policy_version.go
@@ -0,0 +1,56 @@
+// Copyright (c) 2025 Probo Inc .
+//
+// Permission to use, copy, modify, and/or distribute this software for any
+// purpose with or without fee is hereby granted, provided that the above
+// copyright notice and this permission notice appear in all copies.
+//
+// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
+// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+// AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
+// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+// PERFORMANCE OF THIS SOFTWARE.
+
+package types
+
+import (
+ "github.com/getprobo/probo/pkg/coredata"
+ "github.com/getprobo/probo/pkg/page"
+)
+
+type (
+ PolicyVersionOrderBy OrderBy[coredata.PolicyVersionOrderField]
+)
+
+func NewPolicyVersionConnection(page *page.Page[*coredata.PolicyVersion, coredata.PolicyVersionOrderField]) *PolicyVersionConnection {
+ edges := make([]*PolicyVersionEdge, len(page.Data))
+ for i, policyVersion := range page.Data {
+ edges[i] = NewPolicyVersionEdge(policyVersion, page.Cursor.OrderBy.Field)
+ }
+
+ return &PolicyVersionConnection{
+ Edges: edges,
+ PageInfo: NewPageInfo(page),
+ }
+}
+
+func NewPolicyVersionEdge(policyVersion *coredata.PolicyVersion, orderBy coredata.PolicyVersionOrderField) *PolicyVersionEdge {
+ return &PolicyVersionEdge{
+ Cursor: policyVersion.CursorKey(orderBy),
+ Node: NewPolicyVersion(policyVersion),
+ }
+}
+
+func NewPolicyVersion(policyVersion *coredata.PolicyVersion) *PolicyVersion {
+ return &PolicyVersion{
+ ID: policyVersion.ID,
+ Version: policyVersion.VersionNumber,
+ Content: policyVersion.Content,
+ Status: policyVersion.Status,
+ PublishedAt: policyVersion.PublishedAt,
+ Changelog: policyVersion.Changelog,
+ CreatedAt: policyVersion.CreatedAt,
+ UpdatedAt: policyVersion.UpdatedAt,
+ }
+}
diff --git a/pkg/server/api/console/v1/types/policy_version_signature.go b/pkg/server/api/console/v1/types/policy_version_signature.go
new file mode 100644
index 000000000..cc76920a2
--- /dev/null
+++ b/pkg/server/api/console/v1/types/policy_version_signature.go
@@ -0,0 +1,54 @@
+// Copyright (c) 2025 Probo Inc .
+//
+// Permission to use, copy, modify, and/or distribute this software for any
+// purpose with or without fee is hereby granted, provided that the above
+// copyright notice and this permission notice appear in all copies.
+//
+// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
+// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+// AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
+// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+// PERFORMANCE OF THIS SOFTWARE.
+
+package types
+
+import (
+ "github.com/getprobo/probo/pkg/coredata"
+ "github.com/getprobo/probo/pkg/page"
+)
+
+type (
+ PolicyVersionSignatureOrderBy OrderBy[coredata.PolicyVersionSignatureOrderField]
+)
+
+func NewPolicyVersionSignatureConnection(page *page.Page[*coredata.PolicyVersionSignature, coredata.PolicyVersionSignatureOrderField]) *PolicyVersionSignatureConnection {
+ edges := make([]*PolicyVersionSignatureEdge, len(page.Data))
+ for i, policyVersionSignature := range page.Data {
+ edges[i] = NewPolicyVersionSignatureEdge(policyVersionSignature, page.Cursor.OrderBy.Field)
+ }
+
+ return &PolicyVersionSignatureConnection{
+ Edges: edges,
+ PageInfo: NewPageInfo(page),
+ }
+}
+
+func NewPolicyVersionSignatureEdge(policyVersionSignature *coredata.PolicyVersionSignature, orderBy coredata.PolicyVersionSignatureOrderField) *PolicyVersionSignatureEdge {
+ return &PolicyVersionSignatureEdge{
+ Cursor: policyVersionSignature.CursorKey(orderBy),
+ Node: NewPolicyVersionSignature(policyVersionSignature),
+ }
+}
+
+func NewPolicyVersionSignature(policyVersionSignature *coredata.PolicyVersionSignature) *PolicyVersionSignature {
+ return &PolicyVersionSignature{
+ ID: policyVersionSignature.ID,
+ State: policyVersionSignature.State,
+ SignedAt: policyVersionSignature.SignedAt,
+ RequestedAt: policyVersionSignature.RequestedAt,
+ CreatedAt: policyVersionSignature.CreatedAt,
+ UpdatedAt: policyVersionSignature.UpdatedAt,
+ }
+}
diff --git a/pkg/server/api/console/v1/types/types.go b/pkg/server/api/console/v1/types/types.go
index a8720a49f..22208e723 100644
--- a/pkg/server/api/console/v1/types/types.go
+++ b/pkg/server/api/console/v1/types/types.go
@@ -104,6 +104,14 @@ type CreateControlPolicyMappingPayload struct {
Success bool `json:"success"`
}
+type CreateDraftPolicyVersionInput struct {
+ PolicyID gid.GID `json:"policyID"`
+}
+
+type CreateDraftPolicyVersionPayload struct {
+ PolicyVersionEdge *PolicyVersionEdge `json:"policyVersionEdge"`
+}
+
type CreateEvidenceInput struct {
TaskID gid.GID `json:"taskId"`
Name string `json:"name"`
@@ -159,16 +167,15 @@ type CreatePeoplePayload struct {
}
type CreatePolicyInput struct {
- OrganizationID gid.GID `json:"organizationId"`
- Name string `json:"name"`
- Content string `json:"content"`
- Status coredata.PolicyStatus `json:"status"`
- ReviewDate *time.Time `json:"reviewDate,omitempty"`
- OwnerID gid.GID `json:"ownerId"`
+ OrganizationID gid.GID `json:"organizationId"`
+ Title string `json:"title"`
+ Content string `json:"content"`
+ OwnerID gid.GID `json:"ownerId"`
}
type CreatePolicyPayload struct {
- PolicyEdge *PolicyEdge `json:"policyEdge"`
+ PolicyEdge *PolicyEdge `json:"policyEdge"`
+ PolicyVersionEdge *PolicyVersionEdge `json:"policyVersionEdge"`
}
type CreateRiskInput struct {
@@ -556,15 +563,15 @@ type PeopleEdge struct {
}
type Policy struct {
- ID gid.GID `json:"id"`
- Name string `json:"name"`
- Status coredata.PolicyStatus `json:"status"`
- Content string `json:"content"`
- ReviewDate *time.Time `json:"reviewDate,omitempty"`
- Owner *People `json:"owner"`
- Controls *ControlConnection `json:"controls"`
- CreatedAt time.Time `json:"createdAt"`
- UpdatedAt time.Time `json:"updatedAt"`
+ ID gid.GID `json:"id"`
+ Title string `json:"title"`
+ Description string `json:"description"`
+ CurrentPublishedVersion *int `json:"currentPublishedVersion,omitempty"`
+ Owner *People `json:"owner"`
+ Versions *PolicyVersionConnection `json:"versions"`
+ Controls *ControlConnection `json:"controls"`
+ CreatedAt time.Time `json:"createdAt"`
+ UpdatedAt time.Time `json:"updatedAt"`
}
func (Policy) IsNode() {}
@@ -580,6 +587,76 @@ type PolicyEdge struct {
Node *Policy `json:"node"`
}
+type PolicyVersion struct {
+ ID gid.GID `json:"id"`
+ Policy *Policy `json:"policy"`
+ Status coredata.PolicyStatus `json:"status"`
+ Version int `json:"version"`
+ Content string `json:"content"`
+ Changelog string `json:"changelog"`
+ Signatures *PolicyVersionSignatureConnection `json:"signatures"`
+ PublishedBy *People `json:"publishedBy,omitempty"`
+ PublishedAt *time.Time `json:"publishedAt,omitempty"`
+ CreatedAt time.Time `json:"createdAt"`
+ UpdatedAt time.Time `json:"updatedAt"`
+}
+
+func (PolicyVersion) IsNode() {}
+func (this PolicyVersion) GetID() gid.GID { return this.ID }
+
+type PolicyVersionConnection struct {
+ Edges []*PolicyVersionEdge `json:"edges"`
+ PageInfo *PageInfo `json:"pageInfo"`
+}
+
+type PolicyVersionEdge struct {
+ Cursor page.CursorKey `json:"cursor"`
+ Node *PolicyVersion `json:"node"`
+}
+
+type PolicyVersionFilter struct {
+ Status *coredata.PolicyStatus `json:"status,omitempty"`
+}
+
+type PolicyVersionSignature struct {
+ ID gid.GID `json:"id"`
+ PolicyVersion *PolicyVersion `json:"policyVersion"`
+ State coredata.PolicyVersionSignatureState `json:"state"`
+ SignedBy *People `json:"signedBy"`
+ SignedAt *time.Time `json:"signedAt,omitempty"`
+ RequestedAt time.Time `json:"requestedAt"`
+ RequestedBy *People `json:"requestedBy"`
+ CreatedAt time.Time `json:"createdAt"`
+ UpdatedAt time.Time `json:"updatedAt"`
+}
+
+func (PolicyVersionSignature) IsNode() {}
+func (this PolicyVersionSignature) GetID() gid.GID { return this.ID }
+
+type PolicyVersionSignatureConnection struct {
+ Edges []*PolicyVersionSignatureEdge `json:"edges"`
+ PageInfo *PageInfo `json:"pageInfo"`
+}
+
+type PolicyVersionSignatureEdge struct {
+ Cursor page.CursorKey `json:"cursor"`
+ Node *PolicyVersionSignature `json:"node"`
+}
+
+type PolicyVersionSignatureOrder struct {
+ Field coredata.PolicyVersionSignatureOrderField `json:"field"`
+ Direction page.OrderDirection `json:"direction"`
+}
+
+type PublishPolicyVersionInput struct {
+ PolicyID gid.GID `json:"policyId"`
+}
+
+type PublishPolicyVersionPayload struct {
+ PolicyVersion *PolicyVersion `json:"policyVersion"`
+ Policy *Policy `json:"policy"`
+}
+
type Query struct {
}
@@ -603,6 +680,15 @@ type RequestEvidencePayload struct {
EvidenceEdge *EvidenceEdge `json:"evidenceEdge"`
}
+type RequestSignatureInput struct {
+ PolicyVersionID gid.GID `json:"policyVersionId"`
+ SignatoryID gid.GID `json:"signatoryId"`
+}
+
+type RequestSignaturePayload struct {
+ PolicyVersionSignatureEdge *PolicyVersionSignatureEdge `json:"policyVersionSignatureEdge"`
+}
+
type Risk struct {
ID gid.GID `json:"id"`
Name string `json:"name"`
@@ -720,18 +806,26 @@ type UpdatePeoplePayload struct {
}
type UpdatePolicyInput struct {
- ID gid.GID `json:"id"`
- Name *string `json:"name,omitempty"`
- Content *string `json:"content,omitempty"`
- Status *coredata.PolicyStatus `json:"status,omitempty"`
- ReviewDate *time.Time `json:"reviewDate,omitempty"`
- OwnerID *gid.GID `json:"ownerId,omitempty"`
+ ID gid.GID `json:"id"`
+ Title *string `json:"title,omitempty"`
+ Content *string `json:"content,omitempty"`
+ OwnerID *gid.GID `json:"ownerId,omitempty"`
+ CreatedBy *gid.GID `json:"createdBy,omitempty"`
}
type UpdatePolicyPayload struct {
Policy *Policy `json:"policy"`
}
+type UpdatePolicyVersionInput struct {
+ PolicyVersionID gid.GID `json:"policyVersionId"`
+ Content string `json:"content"`
+}
+
+type UpdatePolicyVersionPayload struct {
+ PolicyVersion *PolicyVersion `json:"policyVersion"`
+}
+
type UpdateRiskInput struct {
ID gid.GID `json:"id"`
Name *string `json:"name,omitempty"`
diff --git a/pkg/server/api/console/v1/v1_resolver.go b/pkg/server/api/console/v1/v1_resolver.go
index 4b4782ce8..f6143e872 100644
--- a/pkg/server/api/console/v1/v1_resolver.go
+++ b/pkg/server/api/console/v1/v1_resolver.go
@@ -1008,41 +1008,29 @@ func (r *mutationResolver) DeleteVendorComplianceReport(ctx context.Context, inp
func (r *mutationResolver) CreatePolicy(ctx context.Context, input types.CreatePolicyInput) (*types.CreatePolicyPayload, error) {
svc := GetTenantService(ctx, r.proboSvc, input.OrganizationID.TenantID())
- policy, err := svc.Policies.Create(ctx, probo.CreatePolicyRequest{
- OrganizationID: input.OrganizationID,
- Name: input.Name,
- Content: input.Content,
- Status: input.Status,
- ReviewDate: input.ReviewDate,
- OwnerID: input.OwnerID,
- })
+ user := UserFromContext(ctx)
+ people, err := svc.Peoples.GetByUserID(ctx, user.ID)
+ if err != nil {
+ panic(fmt.Errorf("cannot get people: %w", err))
+ }
+
+ policy, policyVersion, err := svc.Policies.Create(
+ ctx,
+ probo.CreatePolicyRequest{
+ OrganizationID: input.OrganizationID,
+ Title: input.Title,
+ OwnerID: input.OwnerID,
+ Content: input.Content,
+ CreatedBy: people.ID,
+ },
+ )
if err != nil {
panic(fmt.Errorf("cannot create policy: %w", err))
}
return &types.CreatePolicyPayload{
- PolicyEdge: types.NewPolicyEdge(policy, coredata.PolicyOrderFieldCreatedAt),
- }, nil
-}
-
-// UpdatePolicy is the resolver for the updatePolicy field.
-func (r *mutationResolver) UpdatePolicy(ctx context.Context, input types.UpdatePolicyInput) (*types.UpdatePolicyPayload, error) {
- svc := GetTenantService(ctx, r.proboSvc, input.ID.TenantID())
-
- policy, err := svc.Policies.Update(ctx, probo.UpdatePolicyRequest{
- ID: input.ID,
- Name: input.Name,
- Content: input.Content,
- Status: input.Status,
- ReviewDate: input.ReviewDate,
- OwnerID: input.OwnerID,
- })
- if err != nil {
- panic(fmt.Errorf("cannot update policy: %w", err))
- }
-
- return &types.UpdatePolicyPayload{
- Policy: types.NewPolicy(policy),
+ PolicyEdge: types.NewPolicyEdge(policy, coredata.PolicyOrderFieldTitle),
+ PolicyVersionEdge: types.NewPolicyVersionEdge(policyVersion, coredata.PolicyVersionOrderFieldCreatedAt),
}, nil
}
@@ -1060,16 +1048,96 @@ func (r *mutationResolver) DeletePolicy(ctx context.Context, input types.DeleteP
}, nil
}
+// PublishPolicyVersion is the resolver for the publishPolicyVersion field.
+func (r *mutationResolver) PublishPolicyVersion(ctx context.Context, input types.PublishPolicyVersionInput) (*types.PublishPolicyVersionPayload, error) {
+ svc := GetTenantService(ctx, r.proboSvc, input.PolicyID.TenantID())
+ user := UserFromContext(ctx)
+
+ people, err := svc.Peoples.GetByUserID(ctx, user.ID)
+ if err != nil {
+ panic(fmt.Errorf("cannot get people: %w", err))
+ }
+
+ policy, policyVersion, err := svc.Policies.PublishVersion(ctx, input.PolicyID, people.ID)
+ if err != nil {
+ panic(fmt.Errorf("cannot publish policy version: %w", err))
+ }
+
+ return &types.PublishPolicyVersionPayload{
+ PolicyVersion: types.NewPolicyVersion(policyVersion),
+ Policy: types.NewPolicy(policy),
+ }, nil
+}
+
+// CreateDraftPolicyVersion is the resolver for the createDraftPolicyVersion field.
+func (r *mutationResolver) CreateDraftPolicyVersion(ctx context.Context, input types.CreateDraftPolicyVersionInput) (*types.CreateDraftPolicyVersionPayload, error) {
+ svc := GetTenantService(ctx, r.proboSvc, input.PolicyID.TenantID())
+
+ user := UserFromContext(ctx)
+ people, err := svc.Peoples.GetByUserID(ctx, user.ID)
+ if err != nil {
+ panic(fmt.Errorf("cannot get people: %w", err))
+ }
+
+ policyVersion, err := svc.Policies.CreateDraft(ctx, input.PolicyID, people.ID)
+ if err != nil {
+ panic(fmt.Errorf("cannot create draft policy version: %w", err))
+ }
+
+ return &types.CreateDraftPolicyVersionPayload{
+ PolicyVersionEdge: types.NewPolicyVersionEdge(policyVersion, coredata.PolicyVersionOrderFieldCreatedAt),
+ }, nil
+}
+
+// UpdatePolicyVersion is the resolver for the updatePolicyVersion field.
+func (r *mutationResolver) UpdatePolicyVersion(ctx context.Context, input types.UpdatePolicyVersionInput) (*types.UpdatePolicyVersionPayload, error) {
+ svc := GetTenantService(ctx, r.proboSvc, input.PolicyVersionID.TenantID())
+
+ policyVersion, err := svc.Policies.UpdateVersion(ctx, probo.UpdatePolicyVersionRequest{
+ ID: input.PolicyVersionID,
+ Content: input.Content,
+ })
+ if err != nil {
+ panic(fmt.Errorf("cannot update policy version: %w", err))
+ }
+
+ return &types.UpdatePolicyVersionPayload{
+ PolicyVersion: types.NewPolicyVersion(policyVersion),
+ }, nil
+}
+
+// RequestSignature is the resolver for the requestSignature field.
+func (r *mutationResolver) RequestSignature(ctx context.Context, input types.RequestSignatureInput) (*types.RequestSignaturePayload, error) {
+ svc := GetTenantService(ctx, r.proboSvc, input.PolicyVersionID.TenantID())
+
+ user := UserFromContext(ctx)
+
+ people, err := svc.Peoples.GetByUserID(ctx, user.ID)
+ if err != nil {
+ panic(fmt.Errorf("cannot get people: %w", err))
+ }
+
+ policyVersionSignature, err := svc.Policies.RequestSignature(
+ ctx,
+ probo.RequestSignatureRequest{
+ PolicyVersionID: input.PolicyVersionID,
+ RequestedBy: people.ID,
+ Signatory: input.SignatoryID,
+ },
+ )
+ if err != nil {
+ panic(fmt.Errorf("cannot request signature: %w", err))
+ }
+
+ return &types.RequestSignaturePayload{
+ PolicyVersionSignatureEdge: types.NewPolicyVersionSignatureEdge(policyVersionSignature, coredata.PolicyVersionSignatureOrderFieldCreatedAt),
+ }, nil
+}
+
// CreateVendorRiskAssessment is the resolver for the createVendorRiskAssessment field.
func (r *mutationResolver) CreateVendorRiskAssessment(ctx context.Context, input types.CreateVendorRiskAssessmentInput) (*types.CreateVendorRiskAssessmentPayload, error) {
svc := GetTenantService(ctx, r.proboSvc, input.VendorID.TenantID())
- fmt.Println("input.AssessedBy", input.AssessedBy)
- fmt.Println("input.ExpiresAt", input.ExpiresAt)
- fmt.Println("input.DataSensitivity", input.DataSensitivity)
- fmt.Println("input.BusinessImpact", input.BusinessImpact)
- fmt.Println("input.Notes", input.Notes)
-
vendorRiskAssessment, err := svc.Vendors.CreateRiskAssessment(
ctx,
probo.CreateVendorRiskAssessmentRequest{
@@ -1225,7 +1293,7 @@ func (r *organizationResolver) Policies(ctx context.Context, obj *types.Organiza
svc := GetTenantService(ctx, r.proboSvc, obj.ID.TenantID())
pageOrderBy := page.OrderBy[coredata.PolicyOrderField]{
- Field: coredata.PolicyOrderFieldName,
+ Field: coredata.PolicyOrderFieldTitle,
Direction: page.OrderDirectionDesc,
}
if orderBy != nil {
@@ -1313,6 +1381,31 @@ func (r *policyResolver) Owner(ctx context.Context, obj *types.Policy) (*types.P
return types.NewPeople(owner), nil
}
+// Versions is the resolver for the versions field.
+func (r *policyResolver) Versions(ctx context.Context, obj *types.Policy, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.PolicyVersionOrderBy, filter *types.PolicyVersionFilter) (*types.PolicyVersionConnection, error) {
+ svc := GetTenantService(ctx, r.proboSvc, obj.ID.TenantID())
+
+ pageOrderBy := page.OrderBy[coredata.PolicyVersionOrderField]{
+ Field: coredata.PolicyVersionOrderFieldCreatedAt,
+ Direction: page.OrderDirectionDesc,
+ }
+ if orderBy != nil {
+ pageOrderBy = page.OrderBy[coredata.PolicyVersionOrderField]{
+ Field: orderBy.Field,
+ Direction: orderBy.Direction,
+ }
+ }
+
+ cursor := types.NewCursor(first, after, last, before, pageOrderBy)
+
+ page, err := svc.Policies.ListVersions(ctx, obj.ID, cursor)
+ if err != nil {
+ panic(fmt.Errorf("cannot list policy versions: %w", err))
+ }
+
+ return types.NewPolicyVersionConnection(page), nil
+}
+
// Controls is the resolver for the controls field.
func (r *policyResolver) Controls(ctx context.Context, obj *types.Policy, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.ControlOrderBy) (*types.ControlConnection, error) {
svc := GetTenantService(ctx, r.proboSvc, obj.ID.TenantID())
@@ -1338,6 +1431,120 @@ func (r *policyResolver) Controls(ctx context.Context, obj *types.Policy, first
return types.NewControlConnection(page), nil
}
+// Policy is the resolver for the policy field.
+func (r *policyVersionResolver) Policy(ctx context.Context, obj *types.PolicyVersion) (*types.Policy, error) {
+ svc := GetTenantService(ctx, r.proboSvc, obj.ID.TenantID())
+
+ policyVersion, err := svc.Policies.GetVersion(ctx, obj.ID)
+ if err != nil {
+ panic(fmt.Errorf("cannot get policy version: %w", err))
+ }
+
+ policy, err := svc.Policies.Get(ctx, policyVersion.PolicyID)
+ if err != nil {
+ panic(fmt.Errorf("cannot get policy: %w", err))
+ }
+
+ return types.NewPolicy(policy), nil
+}
+
+// Signatures is the resolver for the signatures field.
+func (r *policyVersionResolver) Signatures(ctx context.Context, obj *types.PolicyVersion, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.PolicyVersionSignatureOrder) (*types.PolicyVersionSignatureConnection, error) {
+ svc := GetTenantService(ctx, r.proboSvc, obj.ID.TenantID())
+
+ pageOrderBy := page.OrderBy[coredata.PolicyVersionSignatureOrderField]{
+ Field: coredata.PolicyVersionSignatureOrderFieldCreatedAt,
+ Direction: page.OrderDirectionDesc,
+ }
+ if orderBy != nil {
+ pageOrderBy = page.OrderBy[coredata.PolicyVersionSignatureOrderField]{
+ Field: orderBy.Field,
+ Direction: orderBy.Direction,
+ }
+ }
+
+ cursor := types.NewCursor(first, after, last, before, pageOrderBy)
+
+ page, err := svc.Policies.ListSignatures(ctx, obj.ID, cursor)
+ if err != nil {
+ panic(fmt.Errorf("cannot list policy version signatures: %w", err))
+ }
+
+ return types.NewPolicyVersionSignatureConnection(page), nil
+}
+
+// PublishedBy is the resolver for the publishedBy field.
+func (r *policyVersionResolver) PublishedBy(ctx context.Context, obj *types.PolicyVersion) (*types.People, error) {
+ svc := GetTenantService(ctx, r.proboSvc, obj.ID.TenantID())
+
+ policyVersion, err := svc.Policies.GetVersion(ctx, obj.ID)
+ if err != nil {
+ panic(fmt.Errorf("cannot get policy version: %w", err))
+ }
+
+ if policyVersion.PublishedBy == nil {
+ return nil, nil
+ }
+
+ people, err := svc.Peoples.Get(ctx, *policyVersion.PublishedBy)
+ if err != nil {
+ panic(fmt.Errorf("cannot get people: %w", err))
+ }
+
+ return types.NewPeople(people), nil
+}
+
+// PolicyVersion is the resolver for the policyVersion field.
+func (r *policyVersionSignatureResolver) PolicyVersion(ctx context.Context, obj *types.PolicyVersionSignature) (*types.PolicyVersion, error) {
+ svc := GetTenantService(ctx, r.proboSvc, obj.ID.TenantID())
+
+ policyVersionSignature, err := svc.Policies.GetVersionSignature(ctx, obj.ID)
+ if err != nil {
+ panic(fmt.Errorf("cannot get policy version signature: %w", err))
+ }
+
+ policyVersion, err := svc.Policies.GetVersion(ctx, policyVersionSignature.PolicyVersionID)
+ if err != nil {
+ panic(fmt.Errorf("cannot get policy version: %w", err))
+ }
+
+ return types.NewPolicyVersion(policyVersion), nil
+}
+
+// SignedBy is the resolver for the signedBy field.
+func (r *policyVersionSignatureResolver) SignedBy(ctx context.Context, obj *types.PolicyVersionSignature) (*types.People, error) {
+ svc := GetTenantService(ctx, r.proboSvc, obj.ID.TenantID())
+
+ policyVersionSignature, err := svc.Policies.GetVersionSignature(ctx, obj.ID)
+ if err != nil {
+ panic(fmt.Errorf("cannot get policy version signature: %w", err))
+ }
+
+ people, err := svc.Peoples.Get(ctx, policyVersionSignature.SignedBy)
+ if err != nil {
+ panic(fmt.Errorf("cannot get people: %w", err))
+ }
+
+ return types.NewPeople(people), nil
+}
+
+// RequestedBy is the resolver for the requestedBy field.
+func (r *policyVersionSignatureResolver) RequestedBy(ctx context.Context, obj *types.PolicyVersionSignature) (*types.People, error) {
+ svc := GetTenantService(ctx, r.proboSvc, obj.ID.TenantID())
+
+ policyVersionSignature, err := svc.Policies.GetVersionSignature(ctx, obj.ID)
+ if err != nil {
+ panic(fmt.Errorf("cannot get policy version signature: %w", err))
+ }
+
+ people, err := svc.Peoples.Get(ctx, policyVersionSignature.RequestedBy)
+ if err != nil {
+ panic(fmt.Errorf("cannot get people: %w", err))
+ }
+
+ return types.NewPeople(people), nil
+}
+
// Node is the resolver for the node field.
func (r *queryResolver) Node(ctx context.Context, id gid.GID) (types.Node, error) {
svc := GetTenantService(ctx, r.proboSvc, id.TenantID())
@@ -1417,6 +1624,18 @@ func (r *queryResolver) Node(ctx context.Context, id gid.GID) (types.Node, error
panic(fmt.Errorf("cannot get vendor compliance report: %w", err))
}
return types.NewVendorComplianceReport(vendorComplianceReport), nil
+ case coredata.PolicyVersionEntityType:
+ policyVersion, err := svc.Policies.GetVersion(ctx, id)
+ if err != nil {
+ panic(fmt.Errorf("cannot get policy version: %w", err))
+ }
+ return types.NewPolicyVersion(policyVersion), nil
+ case coredata.PolicyVersionSignatureEntityType:
+ policyVersionSignature, err := svc.Policies.GetVersionSignature(ctx, id)
+ if err != nil {
+ panic(fmt.Errorf("cannot get policy version signature: %w", err))
+ }
+ return types.NewPolicyVersionSignature(policyVersionSignature), nil
default:
}
@@ -1579,7 +1798,7 @@ func (r *taskResolver) Evidences(ctx context.Context, obj *types.Task, first *in
func (r *userResolver) People(ctx context.Context, obj *types.User, organizationID gid.GID) (*types.People, error) {
svc := GetTenantService(ctx, r.proboSvc, organizationID.TenantID())
- people, err := svc.Peoples.GetByUserID(ctx, organizationID, obj.ID)
+ people, err := svc.Peoples.GetByUserID(ctx, obj.ID)
if err != nil {
panic(fmt.Errorf("failed to get people: %w", err))
}
@@ -1778,6 +1997,14 @@ func (r *Resolver) Organization() schema.OrganizationResolver { return &organiza
// Policy returns schema.PolicyResolver implementation.
func (r *Resolver) Policy() schema.PolicyResolver { return &policyResolver{r} }
+// PolicyVersion returns schema.PolicyVersionResolver implementation.
+func (r *Resolver) PolicyVersion() schema.PolicyVersionResolver { return &policyVersionResolver{r} }
+
+// PolicyVersionSignature returns schema.PolicyVersionSignatureResolver implementation.
+func (r *Resolver) PolicyVersionSignature() schema.PolicyVersionSignatureResolver {
+ return &policyVersionSignatureResolver{r}
+}
+
// Query returns schema.QueryResolver implementation.
func (r *Resolver) Query() schema.QueryResolver { return &queryResolver{r} }
@@ -1813,6 +2040,8 @@ type mesureResolver struct{ *Resolver }
type mutationResolver struct{ *Resolver }
type organizationResolver struct{ *Resolver }
type policyResolver struct{ *Resolver }
+type policyVersionResolver struct{ *Resolver }
+type policyVersionSignatureResolver struct{ *Resolver }
type queryResolver struct{ *Resolver }
type riskResolver struct{ *Resolver }
type taskResolver struct{ *Resolver }
| | |