From cb3d79502de45c7e3ae1e96540c3f9f7e803a25d Mon Sep 17 00:00:00 2001 From: Sacha Al Himdani Date: Mon, 28 Jul 2025 17:24:16 +0200 Subject: [PATCH] Add trust center front Signed-off-by: Sacha Al Himdani --- apps/console/relay.config.json | 5 +- .../trustCenter/PublicTrustCenterAudits.tsx | 132 + .../PublicTrustCenterDocuments.tsx | 146 + .../trustCenter/PublicTrustCenterVendors.tsx | 117 + ...enterDocumentsExportPDFMutation.graphql.ts | 92 + .../src/hooks/graph/PublicTrustCenterGraph.ts | 64 + .../src/hooks/graph/TrustCenterAccessGraph.ts | 95 + .../graph/TrustCenterAccessTokenGraph.ts | 17 + ...CenterAccessGraphCreateMutation.graphql.ts | 201 + ...CenterAccessGraphDeleteMutation.graphql.ts | 132 + .../TrustCenterAccessGraphQuery.graphql.ts | 317 + ...CenterAccessGraphRevokeMutation.graphql.ts | 137 + ...CenterAccessGraphUpdateMutation.graphql.ts | 141 + ...rustCenterAccessTokenGraphQuery.graphql.ts | 169 + .../src/layouts/PublicTrustCenterLayout.tsx | 87 + .../src/pages/PublicTrustCenterPage.tsx | 218 + .../src/pages/TrustCenterAccessPage.tsx | 130 + .../pages/organizations/TrustCenterPage.tsx | 6 +- .../trustCenter/TrustCenterAccessTab.tsx | 361 + .../src/providers/TrustRelayProvider.tsx | 80 + apps/console/src/routes.tsx | 38 +- apps/console/src/routes/trustCenterRoutes.ts | 7 + pkg/coredata/audit.go | 5 +- pkg/coredata/audit_filter.go | 54 + pkg/coredata/document_filter.go | 52 +- pkg/coredata/entity_type_reg.go | 1 + pkg/coredata/migrations/20250728T194402Z.sql | 11 + pkg/coredata/trust_center.go | 38 + pkg/coredata/trust_center_access.go | 318 + pkg/coredata/vendor.go | 63 +- pkg/coredata/vendor_filter.go | 54 + pkg/probo/audit_service.go | 3 +- pkg/probo/service.go | 13 + pkg/probo/trust_center_access_service.go | 341 + pkg/probo/trust_center_service.go | 2 +- pkg/probo/vendor_service.go | 2 + pkg/probod/probod.go | 17 +- pkg/server/api/api.go | 37 +- pkg/server/api/console/v1/schema.graphql | 128 + pkg/server/api/console/v1/schema/schema.go | 3115 +++++- .../console/v1/types/trust_center_access.go | 57 + pkg/server/api/console/v1/types/types.go | 91 +- pkg/server/api/console/v1/v1_resolver.go | 121 +- pkg/server/api/trust/v1/gqlgen.yaml | 29 + pkg/server/api/trust/v1/resolver.go | 277 + pkg/server/api/trust/v1/schema.graphql | 263 + pkg/server/api/trust/v1/schema/schema.go | 9013 +++++++++++++++++ .../trust/v1/trust_center_access_handler.go | 153 + pkg/server/api/trust/v1/types/audit.go | 47 + pkg/server/api/trust/v1/types/cursorkey.go | 70 + pkg/server/api/trust/v1/types/document.go | 49 + .../api/trust/v1/types/document_version.go | 47 + pkg/server/api/trust/v1/types/framework.go | 26 + pkg/server/api/trust/v1/types/gid.go | 44 + pkg/server/api/trust/v1/types/organization.go | 26 + pkg/server/api/trust/v1/types/pageinfo.go | 39 + pkg/server/api/trust/v1/types/report.go | 26 + pkg/server/api/trust/v1/types/trust_center.go | 27 + pkg/server/api/trust/v1/types/types.go | 212 + pkg/server/api/trust/v1/types/vendor.go | 51 + pkg/server/api/trust/v1/v1_resolver.go | 258 + pkg/server/server.go | 6 +- pkg/trust/audit_service.go | 99 + pkg/trust/document_service.go | 219 + pkg/trust/framework_service.go | 51 + pkg/trust/organization_service.go | 97 + pkg/trust/report_service.go | 84 + pkg/trust/service.go | 108 + pkg/trust/trust_center_access_service.go | 89 + pkg/trust/trust_center_service.go | 53 + pkg/trust/vendor_service.go | 81 + pkg/usrmgr/usrmgr.go | 35 + 72 files changed, 18712 insertions(+), 82 deletions(-) create mode 100644 apps/console/src/components/trustCenter/PublicTrustCenterAudits.tsx create mode 100644 apps/console/src/components/trustCenter/PublicTrustCenterDocuments.tsx create mode 100644 apps/console/src/components/trustCenter/PublicTrustCenterVendors.tsx create mode 100644 apps/console/src/components/trustCenter/__generated__/PublicTrustCenterDocumentsExportPDFMutation.graphql.ts create mode 100644 apps/console/src/hooks/graph/PublicTrustCenterGraph.ts create mode 100644 apps/console/src/hooks/graph/TrustCenterAccessGraph.ts create mode 100644 apps/console/src/hooks/graph/TrustCenterAccessTokenGraph.ts create mode 100644 apps/console/src/hooks/graph/__generated__/TrustCenterAccessGraphCreateMutation.graphql.ts create mode 100644 apps/console/src/hooks/graph/__generated__/TrustCenterAccessGraphDeleteMutation.graphql.ts create mode 100644 apps/console/src/hooks/graph/__generated__/TrustCenterAccessGraphQuery.graphql.ts create mode 100644 apps/console/src/hooks/graph/__generated__/TrustCenterAccessGraphRevokeMutation.graphql.ts create mode 100644 apps/console/src/hooks/graph/__generated__/TrustCenterAccessGraphUpdateMutation.graphql.ts create mode 100644 apps/console/src/hooks/graph/__generated__/TrustCenterAccessTokenGraphQuery.graphql.ts create mode 100644 apps/console/src/layouts/PublicTrustCenterLayout.tsx create mode 100644 apps/console/src/pages/PublicTrustCenterPage.tsx create mode 100644 apps/console/src/pages/TrustCenterAccessPage.tsx create mode 100644 apps/console/src/pages/organizations/trustCenter/TrustCenterAccessTab.tsx create mode 100644 apps/console/src/providers/TrustRelayProvider.tsx create mode 100644 pkg/coredata/audit_filter.go create mode 100644 pkg/coredata/migrations/20250728T194402Z.sql create mode 100644 pkg/coredata/trust_center_access.go create mode 100644 pkg/coredata/vendor_filter.go create mode 100644 pkg/probo/trust_center_access_service.go create mode 100644 pkg/server/api/console/v1/types/trust_center_access.go create mode 100644 pkg/server/api/trust/v1/gqlgen.yaml create mode 100644 pkg/server/api/trust/v1/resolver.go create mode 100644 pkg/server/api/trust/v1/schema.graphql create mode 100644 pkg/server/api/trust/v1/schema/schema.go create mode 100644 pkg/server/api/trust/v1/trust_center_access_handler.go create mode 100644 pkg/server/api/trust/v1/types/audit.go create mode 100644 pkg/server/api/trust/v1/types/cursorkey.go create mode 100644 pkg/server/api/trust/v1/types/document.go create mode 100644 pkg/server/api/trust/v1/types/document_version.go create mode 100644 pkg/server/api/trust/v1/types/framework.go create mode 100644 pkg/server/api/trust/v1/types/gid.go create mode 100644 pkg/server/api/trust/v1/types/organization.go create mode 100644 pkg/server/api/trust/v1/types/pageinfo.go create mode 100644 pkg/server/api/trust/v1/types/report.go create mode 100644 pkg/server/api/trust/v1/types/trust_center.go create mode 100644 pkg/server/api/trust/v1/types/types.go create mode 100644 pkg/server/api/trust/v1/types/vendor.go create mode 100644 pkg/server/api/trust/v1/v1_resolver.go create mode 100644 pkg/trust/audit_service.go create mode 100644 pkg/trust/document_service.go create mode 100644 pkg/trust/framework_service.go create mode 100644 pkg/trust/organization_service.go create mode 100644 pkg/trust/report_service.go create mode 100644 pkg/trust/service.go create mode 100644 pkg/trust/trust_center_access_service.go create mode 100644 pkg/trust/trust_center_service.go create mode 100644 pkg/trust/vendor_service.go diff --git a/apps/console/relay.config.json b/apps/console/relay.config.json index 6c55a8183..5151fee83 100644 --- a/apps/console/relay.config.json +++ b/apps/console/relay.config.json @@ -3,5 +3,8 @@ "schema": "../../pkg/server/api/console/v1/schema.graphql", "language": "typescript", "eagerEsModules": true, - "noFutureProofEnums": true + "noFutureProofEnums": true, + "excludes": [ + "**/PublicTrustCenterGraph.ts" + ] } diff --git a/apps/console/src/components/trustCenter/PublicTrustCenterAudits.tsx b/apps/console/src/components/trustCenter/PublicTrustCenterAudits.tsx new file mode 100644 index 000000000..7338dd078 --- /dev/null +++ b/apps/console/src/components/trustCenter/PublicTrustCenterAudits.tsx @@ -0,0 +1,132 @@ +import { + Card, + Tr, + Td, + Table, + Thead, + Tbody, + Th, + Button, + IconArrowDown, +} from "@probo/ui"; +import { useTranslate } from "@probo/i18n"; +import { sprintf } from "@probo/helpers"; +import { FrameworkLogo } from "/components/FrameworkLogo"; + +type Audit = { + id: string; + framework: { + name: string; + }; + validFrom: string; + validUntil: string | null; + state: string; + createdAt: string; + report: { + id: string; + filename: string; + downloadUrl: string | null; + } | null; + reportUrl: string | null; +}; + +type Props = { + audits: Audit[]; + organizationName: string; + isAuthenticated: boolean; +}; + +export function PublicTrustCenterAudits({ audits, organizationName, isAuthenticated }: Props) { + const { __ } = useTranslate(); + + if (audits.length === 0) { + return ( + +
+

+ {__("Compliance")} +

+

+ {__("No compliance reports are currently available.")} +

+
+
+ ); + } + + return ( + +
+

+ {__("Compliance")} +

+

+ {sprintf(__("%s is compliant with the following frameworks"), organizationName)} +

+
+ + + + + + + + + + {audits.map((audit) => { + const hasReport = audit.report || audit.reportUrl; + const downloadUrl = audit.report?.downloadUrl || audit.reportUrl; + const reportName = audit.report?.filename || __("Compliance Report"); + + return ( + + + + + ); + })} + +
{__("Framework")}{__("Report")}
+
+
+
+ +
+
+
+ {audit.framework.name} +
+
+
+ {!hasReport ? ( + + {__("No report")} + + ) : !isAuthenticated ? ( + + {__("Not available")} + + ) : downloadUrl ? ( + + ) : ( + + {__("Not available")} + + )} +
+
+ ); +} diff --git a/apps/console/src/components/trustCenter/PublicTrustCenterDocuments.tsx b/apps/console/src/components/trustCenter/PublicTrustCenterDocuments.tsx new file mode 100644 index 000000000..09650c051 --- /dev/null +++ b/apps/console/src/components/trustCenter/PublicTrustCenterDocuments.tsx @@ -0,0 +1,146 @@ +import { + Card, + Tr, + Td, + Table, + Thead, + Tbody, + Th, + DocumentTypeBadge, + Button, + IconArrowDown, +} from "@probo/ui"; +import { useTranslate } from "@probo/i18n"; +import { graphql } from "relay-runtime"; +import { useMutation } from "react-relay"; +import type { PublicTrustCenterDocumentsExportPDFMutation } from "./__generated__/PublicTrustCenterDocumentsExportPDFMutation.graphql"; + +const exportDocumentVersionPDFMutation = graphql` + mutation PublicTrustCenterDocumentsExportPDFMutation( + $input: ExportDocumentVersionPDFInput! + ) { + exportDocumentVersionPDF(input: $input) { + data + } + } +`; + +type Document = { + id: string; + title: string; + documentType: string; + versions: { + edges: Array<{ + node: { + id: string; + status: string; + }; + }>; + }; +}; + +type Props = { + documents: Document[]; + isAuthenticated: boolean; +}; + +export function PublicTrustCenterDocuments({ documents, isAuthenticated }: Props) { + const { __ } = useTranslate(); + const [exportDocumentVersionPDF] = useMutation(exportDocumentVersionPDFMutation); + + const handleDownload = (document: Document) => { + const latestVersion = document.versions.edges[0]?.node; + if (!latestVersion) return; + + exportDocumentVersionPDF({ + variables: { + input: { documentVersionId: latestVersion.id }, + }, + onCompleted: (data) => { + if (data.exportDocumentVersionPDF?.data) { + const link = window.document.createElement("a"); + link.href = data.exportDocumentVersionPDF.data; + link.download = `${document.title}.pdf`; + window.document.body.appendChild(link); + link.click(); + window.document.body.removeChild(link); + } + }, + }); + }; + + if (documents.length === 0) { + return ( + +
+

+ {__("Documents")} +

+

+ {__("No documents are currently available.")} +

+
+
+ ); + } + + return ( + +
+

+ {__("Documents")} +

+

+ {__("Security and compliance documentation")} +

+
+ + + + + + + + + + + {documents.map((document) => { + const latestVersion = document.versions.edges[0]?.node; + + return ( + + + + + + ); + })} + +
{__("Document")}{__("Type")}{__("Download")}
+
+ {document.title} +
+
+ + + {!latestVersion ? ( + + {__("No version available")} + + ) : !isAuthenticated ? ( + + {__("Not available")} + + ) : ( + + )} +
+
+ ); +} diff --git a/apps/console/src/components/trustCenter/PublicTrustCenterVendors.tsx b/apps/console/src/components/trustCenter/PublicTrustCenterVendors.tsx new file mode 100644 index 000000000..201dee64f --- /dev/null +++ b/apps/console/src/components/trustCenter/PublicTrustCenterVendors.tsx @@ -0,0 +1,117 @@ +import { + Card, + Tr, + Td, + Table, + Thead, + Tbody, + Th, +} from "@probo/ui"; +import { useTranslate } from "@probo/i18n"; +import { faviconUrl, sprintf } from "@probo/helpers"; + +type Vendor = { + id: string; + name: string; + category: string; + description: string | null; + createdAt: string; + privacyPolicyUrl?: string | null; + websiteUrl?: string | null; +}; + +type Props = { + vendors: Vendor[]; + organizationName: string; +}; + +export function PublicTrustCenterVendors({ vendors, organizationName }: Props) { + const { __ } = useTranslate(); + + if (vendors.length === 0) { + return ( + +
+

+ {__("Vendors")} +

+

+ {__("No vendor information is currently available.")} +

+
+
+ ); + } + + return ( + +
+

+ {__("Vendors")} +

+

+ {sprintf(__("Third-party vendors and service providers %s work with"), organizationName)} +

+
+ + + + + + + + + + {vendors.map((vendor) => { + const url = vendor.privacyPolicyUrl || vendor.websiteUrl; + const logo = faviconUrl(vendor.websiteUrl); + + const getCleanUrl = (url: string) => { + try { + const parsedUrl = new URL(url); + return parsedUrl.hostname + parsedUrl.pathname + parsedUrl.search; + } catch { + return url.replace(/^https?:\/\//, ''); + } + }; + + return ( + + + + + ); + })} + +
{__("Company")}{__("Website")}
+
+ {logo && ( + {`${vendor.name} + )} +
+ {vendor.name} +
+
+
+ {url ? ( + + {getCleanUrl(url)} + + ) : ( + + {__("No website available")} + + )} +
+
+ ); +} diff --git a/apps/console/src/components/trustCenter/__generated__/PublicTrustCenterDocumentsExportPDFMutation.graphql.ts b/apps/console/src/components/trustCenter/__generated__/PublicTrustCenterDocumentsExportPDFMutation.graphql.ts new file mode 100644 index 000000000..908ffa284 --- /dev/null +++ b/apps/console/src/components/trustCenter/__generated__/PublicTrustCenterDocumentsExportPDFMutation.graphql.ts @@ -0,0 +1,92 @@ +/** + * @generated SignedSource<<24fd0dcf15c98ad3d20762e4ccc83a1b>> + * @lightSyntaxTransform + * @nogrep + */ + +/* tslint:disable */ +/* eslint-disable */ +// @ts-nocheck + +import { ConcreteRequest } from 'relay-runtime'; +export type ExportDocumentVersionPDFInput = { + documentVersionId: string; +}; +export type PublicTrustCenterDocumentsExportPDFMutation$variables = { + input: ExportDocumentVersionPDFInput; +}; +export type PublicTrustCenterDocumentsExportPDFMutation$data = { + readonly exportDocumentVersionPDF: { + readonly data: string; + }; +}; +export type PublicTrustCenterDocumentsExportPDFMutation = { + response: PublicTrustCenterDocumentsExportPDFMutation$data; + variables: PublicTrustCenterDocumentsExportPDFMutation$variables; +}; + +const node: ConcreteRequest = (function(){ +var v0 = [ + { + "defaultValue": null, + "kind": "LocalArgument", + "name": "input" + } +], +v1 = [ + { + "alias": null, + "args": [ + { + "kind": "Variable", + "name": "input", + "variableName": "input" + } + ], + "concreteType": "ExportDocumentVersionPDFPayload", + "kind": "LinkedField", + "name": "exportDocumentVersionPDF", + "plural": false, + "selections": [ + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "data", + "storageKey": null + } + ], + "storageKey": null + } +]; +return { + "fragment": { + "argumentDefinitions": (v0/*: any*/), + "kind": "Fragment", + "metadata": null, + "name": "PublicTrustCenterDocumentsExportPDFMutation", + "selections": (v1/*: any*/), + "type": "Mutation", + "abstractKey": null + }, + "kind": "Request", + "operation": { + "argumentDefinitions": (v0/*: any*/), + "kind": "Operation", + "name": "PublicTrustCenterDocumentsExportPDFMutation", + "selections": (v1/*: any*/) + }, + "params": { + "cacheID": "b5d33d4c301cfa811bb74d52f61f52e8", + "id": null, + "metadata": {}, + "name": "PublicTrustCenterDocumentsExportPDFMutation", + "operationKind": "mutation", + "text": "mutation PublicTrustCenterDocumentsExportPDFMutation(\n $input: ExportDocumentVersionPDFInput!\n) {\n exportDocumentVersionPDF(input: $input) {\n data\n }\n}\n" + } +}; +})(); + +(node as any).hash = "b6a173895aea2450ad4ac1a4ec6aeb4e"; + +export default node; diff --git a/apps/console/src/hooks/graph/PublicTrustCenterGraph.ts b/apps/console/src/hooks/graph/PublicTrustCenterGraph.ts new file mode 100644 index 000000000..d23c81e78 --- /dev/null +++ b/apps/console/src/hooks/graph/PublicTrustCenterGraph.ts @@ -0,0 +1,64 @@ +// Manual query definition for trust API (not processed by relay compiler) +export const publicTrustCenterQuery = { + params: { + name: "PublicTrustCenterGraphQuery", + operationKind: "query", + text: ` + query PublicTrustCenterGraphQuery($slug: String!) { + trustCenterBySlug(slug: $slug) { + id + active + slug + organization { + id + name + logoUrl + } + documents(first: 100) { + edges { + node { + id + title + documentType + versions(first: 1) { + edges { + node { + id + } + } + } + } + } + } + audits(first: 100) { + edges { + node { + id + framework { + name + } + report { + id + filename + downloadUrl + } + reportUrl + } + } + } + vendors(first: 100) { + edges { + node { + id + name + category + websiteUrl + privacyPolicyUrl + } + } + } + } + } + ` + } +}; diff --git a/apps/console/src/hooks/graph/TrustCenterAccessGraph.ts b/apps/console/src/hooks/graph/TrustCenterAccessGraph.ts new file mode 100644 index 000000000..64c25eccb --- /dev/null +++ b/apps/console/src/hooks/graph/TrustCenterAccessGraph.ts @@ -0,0 +1,95 @@ +import { graphql } from 'react-relay'; +import { useLazyLoadQuery } from 'react-relay'; + +export const trustCenterAccessesQuery = graphql` + query TrustCenterAccessGraphQuery($trustCenterId: ID!) { + node(id: $trustCenterId) { + ... on TrustCenter { + id + accesses(first: 100, orderBy: { field: CREATED_AT, direction: DESC }) + @connection(key: "TrustCenterAccessTab_accesses") { + __id + pageInfo { + hasNextPage + hasPreviousPage + startCursor + endCursor + } + edges { + cursor + node { + id + email + name + active + createdAt + } + } + } + } + } + } +`; + +export const revokeTrustCenterAccessMutation = graphql` + mutation TrustCenterAccessGraphRevokeMutation($input: RevokeTrustCenterAccessInput!) { + revokeTrustCenterAccess(input: $input) { + trustCenterAccess { + id + email + name + active + createdAt + } + } + } +`; + +export const createTrustCenterAccessMutation = graphql` + mutation TrustCenterAccessGraphCreateMutation( + $input: CreateTrustCenterAccessInput! + $connections: [ID!]! + ) { + createTrustCenterAccess(input: $input) { + trustCenterAccessEdge @prependEdge(connections: $connections) { + cursor + node { + id + email + name + active + createdAt + } + } + } + } +`; + +export const updateTrustCenterAccessMutation = graphql` + mutation TrustCenterAccessGraphUpdateMutation($input: UpdateTrustCenterAccessInput!) { + updateTrustCenterAccess(input: $input) { + trustCenterAccess { + id + email + name + active + createdAt + } + } + } +`; + +export const deleteTrustCenterAccessMutation = graphql` + mutation TrustCenterAccessGraphDeleteMutation( + $input: DeleteTrustCenterAccessInput! + $connections: [ID!]! + ) { + deleteTrustCenterAccess(input: $input) { + deletedTrustCenterAccessId @deleteEdge(connections: $connections) + } + } +`; + +export function useTrustCenterAccesses(trustCenterId: string) { + return useLazyLoadQuery(trustCenterAccessesQuery, { trustCenterId }); +} diff --git a/apps/console/src/hooks/graph/TrustCenterAccessTokenGraph.ts b/apps/console/src/hooks/graph/TrustCenterAccessTokenGraph.ts new file mode 100644 index 000000000..7e45f4815 --- /dev/null +++ b/apps/console/src/hooks/graph/TrustCenterAccessTokenGraph.ts @@ -0,0 +1,17 @@ +import { graphql } from 'react-relay'; + +export const trustCenterByIdQuery = graphql` + query TrustCenterAccessTokenGraphQuery($trustCenterId: ID!) { + node(id: $trustCenterId) { + ... on TrustCenter { + id + slug + active + organization { + id + name + } + } + } + } +`; diff --git a/apps/console/src/hooks/graph/__generated__/TrustCenterAccessGraphCreateMutation.graphql.ts b/apps/console/src/hooks/graph/__generated__/TrustCenterAccessGraphCreateMutation.graphql.ts new file mode 100644 index 000000000..20945a56e --- /dev/null +++ b/apps/console/src/hooks/graph/__generated__/TrustCenterAccessGraphCreateMutation.graphql.ts @@ -0,0 +1,201 @@ +/** + * @generated SignedSource<<79b53f51663ada6e9899523400d54996>> + * @lightSyntaxTransform + * @nogrep + */ + +/* tslint:disable */ +/* eslint-disable */ +// @ts-nocheck + +import { ConcreteRequest } from 'relay-runtime'; +export type CreateTrustCenterAccessInput = { + email: string; + name: string; + sendEmail?: boolean; + trustCenterId: string; +}; +export type TrustCenterAccessGraphCreateMutation$variables = { + connections: ReadonlyArray; + input: CreateTrustCenterAccessInput; +}; +export type TrustCenterAccessGraphCreateMutation$data = { + readonly createTrustCenterAccess: { + readonly trustCenterAccessEdge: { + readonly cursor: any; + readonly node: { + readonly active: boolean; + readonly createdAt: any; + readonly email: string; + readonly id: string; + readonly name: string; + }; + }; + }; +}; +export type TrustCenterAccessGraphCreateMutation = { + response: TrustCenterAccessGraphCreateMutation$data; + variables: TrustCenterAccessGraphCreateMutation$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, + "concreteType": "TrustCenterAccessEdge", + "kind": "LinkedField", + "name": "trustCenterAccessEdge", + "plural": false, + "selections": [ + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "cursor", + "storageKey": null + }, + { + "alias": null, + "args": null, + "concreteType": "TrustCenterAccess", + "kind": "LinkedField", + "name": "node", + "plural": false, + "selections": [ + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "id", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "email", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "name", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "active", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "createdAt", + "storageKey": null + } + ], + "storageKey": null + } + ], + "storageKey": null +}; +return { + "fragment": { + "argumentDefinitions": [ + (v0/*: any*/), + (v1/*: any*/) + ], + "kind": "Fragment", + "metadata": null, + "name": "TrustCenterAccessGraphCreateMutation", + "selections": [ + { + "alias": null, + "args": (v2/*: any*/), + "concreteType": "CreateTrustCenterAccessPayload", + "kind": "LinkedField", + "name": "createTrustCenterAccess", + "plural": false, + "selections": [ + (v3/*: any*/) + ], + "storageKey": null + } + ], + "type": "Mutation", + "abstractKey": null + }, + "kind": "Request", + "operation": { + "argumentDefinitions": [ + (v1/*: any*/), + (v0/*: any*/) + ], + "kind": "Operation", + "name": "TrustCenterAccessGraphCreateMutation", + "selections": [ + { + "alias": null, + "args": (v2/*: any*/), + "concreteType": "CreateTrustCenterAccessPayload", + "kind": "LinkedField", + "name": "createTrustCenterAccess", + "plural": false, + "selections": [ + (v3/*: any*/), + { + "alias": null, + "args": null, + "filters": null, + "handle": "prependEdge", + "key": "", + "kind": "LinkedHandle", + "name": "trustCenterAccessEdge", + "handleArgs": [ + { + "kind": "Variable", + "name": "connections", + "variableName": "connections" + } + ] + } + ], + "storageKey": null + } + ] + }, + "params": { + "cacheID": "eafddcd0263963235d3249c22eb50593", + "id": null, + "metadata": {}, + "name": "TrustCenterAccessGraphCreateMutation", + "operationKind": "mutation", + "text": "mutation TrustCenterAccessGraphCreateMutation(\n $input: CreateTrustCenterAccessInput!\n) {\n createTrustCenterAccess(input: $input) {\n trustCenterAccessEdge {\n cursor\n node {\n id\n email\n name\n active\n createdAt\n }\n }\n }\n}\n" + } +}; +})(); + +(node as any).hash = "99676fee0b2de06a92cdad66c577eee7"; + +export default node; diff --git a/apps/console/src/hooks/graph/__generated__/TrustCenterAccessGraphDeleteMutation.graphql.ts b/apps/console/src/hooks/graph/__generated__/TrustCenterAccessGraphDeleteMutation.graphql.ts new file mode 100644 index 000000000..79ff11ed1 --- /dev/null +++ b/apps/console/src/hooks/graph/__generated__/TrustCenterAccessGraphDeleteMutation.graphql.ts @@ -0,0 +1,132 @@ +/** + * @generated SignedSource<<509cd7c9db3cbf15931c386b13a13987>> + * @lightSyntaxTransform + * @nogrep + */ + +/* tslint:disable */ +/* eslint-disable */ +// @ts-nocheck + +import { ConcreteRequest } from 'relay-runtime'; +export type DeleteTrustCenterAccessInput = { + accessId: string; +}; +export type TrustCenterAccessGraphDeleteMutation$variables = { + connections: ReadonlyArray; + input: DeleteTrustCenterAccessInput; +}; +export type TrustCenterAccessGraphDeleteMutation$data = { + readonly deleteTrustCenterAccess: { + readonly deletedTrustCenterAccessId: string; + }; +}; +export type TrustCenterAccessGraphDeleteMutation = { + response: TrustCenterAccessGraphDeleteMutation$data; + variables: TrustCenterAccessGraphDeleteMutation$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": "deletedTrustCenterAccessId", + "storageKey": null +}; +return { + "fragment": { + "argumentDefinitions": [ + (v0/*: any*/), + (v1/*: any*/) + ], + "kind": "Fragment", + "metadata": null, + "name": "TrustCenterAccessGraphDeleteMutation", + "selections": [ + { + "alias": null, + "args": (v2/*: any*/), + "concreteType": "DeleteTrustCenterAccessPayload", + "kind": "LinkedField", + "name": "deleteTrustCenterAccess", + "plural": false, + "selections": [ + (v3/*: any*/) + ], + "storageKey": null + } + ], + "type": "Mutation", + "abstractKey": null + }, + "kind": "Request", + "operation": { + "argumentDefinitions": [ + (v1/*: any*/), + (v0/*: any*/) + ], + "kind": "Operation", + "name": "TrustCenterAccessGraphDeleteMutation", + "selections": [ + { + "alias": null, + "args": (v2/*: any*/), + "concreteType": "DeleteTrustCenterAccessPayload", + "kind": "LinkedField", + "name": "deleteTrustCenterAccess", + "plural": false, + "selections": [ + (v3/*: any*/), + { + "alias": null, + "args": null, + "filters": null, + "handle": "deleteEdge", + "key": "", + "kind": "ScalarHandle", + "name": "deletedTrustCenterAccessId", + "handleArgs": [ + { + "kind": "Variable", + "name": "connections", + "variableName": "connections" + } + ] + } + ], + "storageKey": null + } + ] + }, + "params": { + "cacheID": "3f55c9ce5cac2874b769ec994977367a", + "id": null, + "metadata": {}, + "name": "TrustCenterAccessGraphDeleteMutation", + "operationKind": "mutation", + "text": "mutation TrustCenterAccessGraphDeleteMutation(\n $input: DeleteTrustCenterAccessInput!\n) {\n deleteTrustCenterAccess(input: $input) {\n deletedTrustCenterAccessId\n }\n}\n" + } +}; +})(); + +(node as any).hash = "0d0a44eb6db912eeb533d24718c49b35"; + +export default node; diff --git a/apps/console/src/hooks/graph/__generated__/TrustCenterAccessGraphQuery.graphql.ts b/apps/console/src/hooks/graph/__generated__/TrustCenterAccessGraphQuery.graphql.ts new file mode 100644 index 000000000..050c16803 --- /dev/null +++ b/apps/console/src/hooks/graph/__generated__/TrustCenterAccessGraphQuery.graphql.ts @@ -0,0 +1,317 @@ +/** + * @generated SignedSource<<2333a6a7d5415f1a08a5612dcaceee8f>> + * @lightSyntaxTransform + * @nogrep + */ + +/* tslint:disable */ +/* eslint-disable */ +// @ts-nocheck + +import { ConcreteRequest } from 'relay-runtime'; +export type TrustCenterAccessGraphQuery$variables = { + trustCenterId: string; +}; +export type TrustCenterAccessGraphQuery$data = { + readonly node: { + readonly accesses?: { + readonly __id: string; + readonly edges: ReadonlyArray<{ + readonly cursor: any; + readonly node: { + readonly active: boolean; + readonly createdAt: any; + readonly email: string; + readonly id: string; + readonly name: string; + }; + }>; + readonly pageInfo: { + readonly endCursor: any | null | undefined; + readonly hasNextPage: boolean; + readonly hasPreviousPage: boolean; + readonly startCursor: any | null | undefined; + }; + }; + readonly id?: string; + }; +}; +export type TrustCenterAccessGraphQuery = { + response: TrustCenterAccessGraphQuery$data; + variables: TrustCenterAccessGraphQuery$variables; +}; + +const node: ConcreteRequest = (function(){ +var v0 = [ + { + "defaultValue": null, + "kind": "LocalArgument", + "name": "trustCenterId" + } +], +v1 = [ + { + "kind": "Variable", + "name": "id", + "variableName": "trustCenterId" + } +], +v2 = { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "id", + "storageKey": null +}, +v3 = { + "kind": "Literal", + "name": "orderBy", + "value": { + "direction": "DESC", + "field": "CREATED_AT" + } +}, +v4 = { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "__typename", + "storageKey": null +}, +v5 = [ + { + "alias": null, + "args": null, + "concreteType": "PageInfo", + "kind": "LinkedField", + "name": "pageInfo", + "plural": false, + "selections": [ + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "hasNextPage", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "hasPreviousPage", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "startCursor", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "endCursor", + "storageKey": null + } + ], + "storageKey": null + }, + { + "alias": null, + "args": null, + "concreteType": "TrustCenterAccessEdge", + "kind": "LinkedField", + "name": "edges", + "plural": true, + "selections": [ + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "cursor", + "storageKey": null + }, + { + "alias": null, + "args": null, + "concreteType": "TrustCenterAccess", + "kind": "LinkedField", + "name": "node", + "plural": false, + "selections": [ + (v2/*: any*/), + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "email", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "name", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "active", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "createdAt", + "storageKey": null + }, + (v4/*: any*/) + ], + "storageKey": null + } + ], + "storageKey": null + }, + { + "kind": "ClientExtension", + "selections": [ + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "__id", + "storageKey": null + } + ] + } +], +v6 = [ + { + "kind": "Literal", + "name": "first", + "value": 100 + }, + (v3/*: any*/) +]; +return { + "fragment": { + "argumentDefinitions": (v0/*: any*/), + "kind": "Fragment", + "metadata": null, + "name": "TrustCenterAccessGraphQuery", + "selections": [ + { + "alias": null, + "args": (v1/*: any*/), + "concreteType": null, + "kind": "LinkedField", + "name": "node", + "plural": false, + "selections": [ + { + "kind": "InlineFragment", + "selections": [ + (v2/*: any*/), + { + "alias": "accesses", + "args": [ + (v3/*: any*/) + ], + "concreteType": "TrustCenterAccessConnection", + "kind": "LinkedField", + "name": "__TrustCenterAccessTab_accesses_connection", + "plural": false, + "selections": (v5/*: any*/), + "storageKey": "__TrustCenterAccessTab_accesses_connection(orderBy:{\"direction\":\"DESC\",\"field\":\"CREATED_AT\"})" + } + ], + "type": "TrustCenter", + "abstractKey": null + } + ], + "storageKey": null + } + ], + "type": "Query", + "abstractKey": null + }, + "kind": "Request", + "operation": { + "argumentDefinitions": (v0/*: any*/), + "kind": "Operation", + "name": "TrustCenterAccessGraphQuery", + "selections": [ + { + "alias": null, + "args": (v1/*: any*/), + "concreteType": null, + "kind": "LinkedField", + "name": "node", + "plural": false, + "selections": [ + (v4/*: any*/), + (v2/*: any*/), + { + "kind": "InlineFragment", + "selections": [ + { + "alias": null, + "args": (v6/*: any*/), + "concreteType": "TrustCenterAccessConnection", + "kind": "LinkedField", + "name": "accesses", + "plural": false, + "selections": (v5/*: any*/), + "storageKey": "accesses(first:100,orderBy:{\"direction\":\"DESC\",\"field\":\"CREATED_AT\"})" + }, + { + "alias": null, + "args": (v6/*: any*/), + "filters": [ + "orderBy" + ], + "handle": "connection", + "key": "TrustCenterAccessTab_accesses", + "kind": "LinkedHandle", + "name": "accesses" + } + ], + "type": "TrustCenter", + "abstractKey": null + } + ], + "storageKey": null + } + ] + }, + "params": { + "cacheID": "5b83cd4ae2434ce2e00de7230d264432", + "id": null, + "metadata": { + "connection": [ + { + "count": null, + "cursor": null, + "direction": "forward", + "path": [ + "node", + "accesses" + ] + } + ] + }, + "name": "TrustCenterAccessGraphQuery", + "operationKind": "query", + "text": "query TrustCenterAccessGraphQuery(\n $trustCenterId: ID!\n) {\n node(id: $trustCenterId) {\n __typename\n ... on TrustCenter {\n id\n accesses(first: 100, orderBy: {field: CREATED_AT, direction: DESC}) {\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n edges {\n cursor\n node {\n id\n email\n name\n active\n createdAt\n __typename\n }\n }\n }\n }\n id\n }\n}\n" + } +}; +})(); + +(node as any).hash = "af598fd2af198e63ed84fd618857a985"; + +export default node; diff --git a/apps/console/src/hooks/graph/__generated__/TrustCenterAccessGraphRevokeMutation.graphql.ts b/apps/console/src/hooks/graph/__generated__/TrustCenterAccessGraphRevokeMutation.graphql.ts new file mode 100644 index 000000000..386e808fc --- /dev/null +++ b/apps/console/src/hooks/graph/__generated__/TrustCenterAccessGraphRevokeMutation.graphql.ts @@ -0,0 +1,137 @@ +/** + * @generated SignedSource<> + * @lightSyntaxTransform + * @nogrep + */ + +/* tslint:disable */ +/* eslint-disable */ +// @ts-nocheck + +import { ConcreteRequest } from 'relay-runtime'; +export type RevokeTrustCenterAccessInput = { + accessId: string; +}; +export type TrustCenterAccessGraphRevokeMutation$variables = { + input: RevokeTrustCenterAccessInput; +}; +export type TrustCenterAccessGraphRevokeMutation$data = { + readonly revokeTrustCenterAccess: { + readonly trustCenterAccess: { + readonly active: boolean; + readonly createdAt: any; + readonly email: string; + readonly id: string; + readonly name: string; + }; + }; +}; +export type TrustCenterAccessGraphRevokeMutation = { + response: TrustCenterAccessGraphRevokeMutation$data; + variables: TrustCenterAccessGraphRevokeMutation$variables; +}; + +const node: ConcreteRequest = (function(){ +var v0 = [ + { + "defaultValue": null, + "kind": "LocalArgument", + "name": "input" + } +], +v1 = [ + { + "alias": null, + "args": [ + { + "kind": "Variable", + "name": "input", + "variableName": "input" + } + ], + "concreteType": "RevokeTrustCenterAccessPayload", + "kind": "LinkedField", + "name": "revokeTrustCenterAccess", + "plural": false, + "selections": [ + { + "alias": null, + "args": null, + "concreteType": "TrustCenterAccess", + "kind": "LinkedField", + "name": "trustCenterAccess", + "plural": false, + "selections": [ + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "id", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "email", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "name", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "active", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "createdAt", + "storageKey": null + } + ], + "storageKey": null + } + ], + "storageKey": null + } +]; +return { + "fragment": { + "argumentDefinitions": (v0/*: any*/), + "kind": "Fragment", + "metadata": null, + "name": "TrustCenterAccessGraphRevokeMutation", + "selections": (v1/*: any*/), + "type": "Mutation", + "abstractKey": null + }, + "kind": "Request", + "operation": { + "argumentDefinitions": (v0/*: any*/), + "kind": "Operation", + "name": "TrustCenterAccessGraphRevokeMutation", + "selections": (v1/*: any*/) + }, + "params": { + "cacheID": "b26927a2b8d02eb2e3754850b0a44d8b", + "id": null, + "metadata": {}, + "name": "TrustCenterAccessGraphRevokeMutation", + "operationKind": "mutation", + "text": "mutation TrustCenterAccessGraphRevokeMutation(\n $input: RevokeTrustCenterAccessInput!\n) {\n revokeTrustCenterAccess(input: $input) {\n trustCenterAccess {\n id\n email\n name\n active\n createdAt\n }\n }\n}\n" + } +}; +})(); + +(node as any).hash = "269cce2fe60fac04d807f1004ef0777f"; + +export default node; diff --git a/apps/console/src/hooks/graph/__generated__/TrustCenterAccessGraphUpdateMutation.graphql.ts b/apps/console/src/hooks/graph/__generated__/TrustCenterAccessGraphUpdateMutation.graphql.ts new file mode 100644 index 000000000..2e382c6cd --- /dev/null +++ b/apps/console/src/hooks/graph/__generated__/TrustCenterAccessGraphUpdateMutation.graphql.ts @@ -0,0 +1,141 @@ +/** + * @generated SignedSource<<54ac79c4d292eb19f73bbf2363015dd9>> + * @lightSyntaxTransform + * @nogrep + */ + +/* tslint:disable */ +/* eslint-disable */ +// @ts-nocheck + +import { ConcreteRequest } from 'relay-runtime'; +export type UpdateTrustCenterAccessInput = { + accessId: string; + active?: boolean | null | undefined; + email?: string | null | undefined; + name?: string | null | undefined; + sendEmail?: boolean; +}; +export type TrustCenterAccessGraphUpdateMutation$variables = { + input: UpdateTrustCenterAccessInput; +}; +export type TrustCenterAccessGraphUpdateMutation$data = { + readonly updateTrustCenterAccess: { + readonly trustCenterAccess: { + readonly active: boolean; + readonly createdAt: any; + readonly email: string; + readonly id: string; + readonly name: string; + }; + }; +}; +export type TrustCenterAccessGraphUpdateMutation = { + response: TrustCenterAccessGraphUpdateMutation$data; + variables: TrustCenterAccessGraphUpdateMutation$variables; +}; + +const node: ConcreteRequest = (function(){ +var v0 = [ + { + "defaultValue": null, + "kind": "LocalArgument", + "name": "input" + } +], +v1 = [ + { + "alias": null, + "args": [ + { + "kind": "Variable", + "name": "input", + "variableName": "input" + } + ], + "concreteType": "UpdateTrustCenterAccessPayload", + "kind": "LinkedField", + "name": "updateTrustCenterAccess", + "plural": false, + "selections": [ + { + "alias": null, + "args": null, + "concreteType": "TrustCenterAccess", + "kind": "LinkedField", + "name": "trustCenterAccess", + "plural": false, + "selections": [ + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "id", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "email", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "name", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "active", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "createdAt", + "storageKey": null + } + ], + "storageKey": null + } + ], + "storageKey": null + } +]; +return { + "fragment": { + "argumentDefinitions": (v0/*: any*/), + "kind": "Fragment", + "metadata": null, + "name": "TrustCenterAccessGraphUpdateMutation", + "selections": (v1/*: any*/), + "type": "Mutation", + "abstractKey": null + }, + "kind": "Request", + "operation": { + "argumentDefinitions": (v0/*: any*/), + "kind": "Operation", + "name": "TrustCenterAccessGraphUpdateMutation", + "selections": (v1/*: any*/) + }, + "params": { + "cacheID": "8e284c8129de02d689385cae38cc3876", + "id": null, + "metadata": {}, + "name": "TrustCenterAccessGraphUpdateMutation", + "operationKind": "mutation", + "text": "mutation TrustCenterAccessGraphUpdateMutation(\n $input: UpdateTrustCenterAccessInput!\n) {\n updateTrustCenterAccess(input: $input) {\n trustCenterAccess {\n id\n email\n name\n active\n createdAt\n }\n }\n}\n" + } +}; +})(); + +(node as any).hash = "235754d40be56785bd0e7a36ac8c4ec2"; + +export default node; diff --git a/apps/console/src/hooks/graph/__generated__/TrustCenterAccessTokenGraphQuery.graphql.ts b/apps/console/src/hooks/graph/__generated__/TrustCenterAccessTokenGraphQuery.graphql.ts new file mode 100644 index 000000000..93492c38b --- /dev/null +++ b/apps/console/src/hooks/graph/__generated__/TrustCenterAccessTokenGraphQuery.graphql.ts @@ -0,0 +1,169 @@ +/** + * @generated SignedSource<<6e43a07222fde7acc3d588bac24a8077>> + * @lightSyntaxTransform + * @nogrep + */ + +/* tslint:disable */ +/* eslint-disable */ +// @ts-nocheck + +import { ConcreteRequest } from 'relay-runtime'; +export type TrustCenterAccessTokenGraphQuery$variables = { + trustCenterId: string; +}; +export type TrustCenterAccessTokenGraphQuery$data = { + readonly node: { + readonly active?: boolean; + readonly id?: string; + readonly organization?: { + readonly id: string; + readonly name: string; + }; + readonly slug?: string; + }; +}; +export type TrustCenterAccessTokenGraphQuery = { + response: TrustCenterAccessTokenGraphQuery$data; + variables: TrustCenterAccessTokenGraphQuery$variables; +}; + +const node: ConcreteRequest = (function(){ +var v0 = [ + { + "defaultValue": null, + "kind": "LocalArgument", + "name": "trustCenterId" + } +], +v1 = [ + { + "kind": "Variable", + "name": "id", + "variableName": "trustCenterId" + } +], +v2 = { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "id", + "storageKey": null +}, +v3 = { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "slug", + "storageKey": null +}, +v4 = { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "active", + "storageKey": null +}, +v5 = { + "alias": null, + "args": null, + "concreteType": "Organization", + "kind": "LinkedField", + "name": "organization", + "plural": false, + "selections": [ + (v2/*: any*/), + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "name", + "storageKey": null + } + ], + "storageKey": null +}; +return { + "fragment": { + "argumentDefinitions": (v0/*: any*/), + "kind": "Fragment", + "metadata": null, + "name": "TrustCenterAccessTokenGraphQuery", + "selections": [ + { + "alias": null, + "args": (v1/*: any*/), + "concreteType": null, + "kind": "LinkedField", + "name": "node", + "plural": false, + "selections": [ + { + "kind": "InlineFragment", + "selections": [ + (v2/*: any*/), + (v3/*: any*/), + (v4/*: any*/), + (v5/*: any*/) + ], + "type": "TrustCenter", + "abstractKey": null + } + ], + "storageKey": null + } + ], + "type": "Query", + "abstractKey": null + }, + "kind": "Request", + "operation": { + "argumentDefinitions": (v0/*: any*/), + "kind": "Operation", + "name": "TrustCenterAccessTokenGraphQuery", + "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*/), + { + "kind": "InlineFragment", + "selections": [ + (v3/*: any*/), + (v4/*: any*/), + (v5/*: any*/) + ], + "type": "TrustCenter", + "abstractKey": null + } + ], + "storageKey": null + } + ] + }, + "params": { + "cacheID": "7d3d891944391d31a722364f8b1f1cbb", + "id": null, + "metadata": {}, + "name": "TrustCenterAccessTokenGraphQuery", + "operationKind": "query", + "text": "query TrustCenterAccessTokenGraphQuery(\n $trustCenterId: ID!\n) {\n node(id: $trustCenterId) {\n __typename\n ... on TrustCenter {\n id\n slug\n active\n organization {\n id\n name\n }\n }\n id\n }\n}\n" + } +}; +})(); + +(node as any).hash = "e273d4e8c8b756a5aba5271520df8602"; + +export default node; diff --git a/apps/console/src/layouts/PublicTrustCenterLayout.tsx b/apps/console/src/layouts/PublicTrustCenterLayout.tsx new file mode 100644 index 000000000..2738119ad --- /dev/null +++ b/apps/console/src/layouts/PublicTrustCenterLayout.tsx @@ -0,0 +1,87 @@ +import { Outlet } from "react-router"; +import { Logo, Button, IconArrowBoxLeft } from "@probo/ui"; +import { useTranslate } from "@probo/i18n"; +import { buildEndpoint } from "/providers/RelayProviders"; +import type { ReactNode } from "react"; + +type Props = { + organizationName: string; + organizationLogo?: string | null; + children?: ReactNode; +}; + +export function PublicTrustCenterLayout({ organizationName, organizationLogo, children }: Props) { + const { __ } = useTranslate(); + + const handleLogout = async () => { + try { + await fetch(buildEndpoint('/api/trust/v1/trust-center-access/logout'), { + method: 'DELETE', + headers: { + 'Content-Type': 'application/json', + }, + credentials: 'include', + }); + } catch (error) { + console.error('Logout failed:', error); + } finally { + window.location.href = "/"; + } + }; + + return ( +
+
+
+
+
+ {organizationLogo ? ( + {organizationName} + ) : ( + + )} +
+

+ {organizationName} +

+

Trust Center

+
+
+ +
+
+
+ +
+ {children || } +
+
+ ); +} diff --git a/apps/console/src/pages/PublicTrustCenterPage.tsx b/apps/console/src/pages/PublicTrustCenterPage.tsx new file mode 100644 index 000000000..825d1d949 --- /dev/null +++ b/apps/console/src/pages/PublicTrustCenterPage.tsx @@ -0,0 +1,218 @@ +import { useParams, Navigate } from "react-router"; +import { usePageTitle } from "@probo/hooks"; +import { useTranslate } from "@probo/i18n"; +import { sprintf } from "@probo/helpers"; +import { publicTrustCenterQuery } from "/hooks/graph/PublicTrustCenterGraph"; +import { PublicTrustCenterLayout } from "/layouts/PublicTrustCenterLayout"; +import { PublicTrustCenterAudits } from "../components/trustCenter/PublicTrustCenterAudits"; +import { PublicTrustCenterVendors } from "../components/trustCenter/PublicTrustCenterVendors"; +import { PublicTrustCenterDocuments } from "../components/trustCenter/PublicTrustCenterDocuments"; +import { PageError } from "/components/PageError"; +import { TrustRelayProvider } from "/providers/TrustRelayProvider"; +import { useState, useEffect } from "react"; +import { buildEndpoint } from "/providers/RelayProviders"; + +interface GraphQLError { + message: string; + path?: string[]; + locations?: Array<{ line: number; column: number }>; +} + +interface GraphQLResponse { + data?: T; + errors?: GraphQLError[]; +} + +interface Organization { + id: string; + name: string; + logoUrl?: string; +} + +interface Framework { + name: string; +} + +interface DocumentVersion { + id: string; + status: string; +} + +interface DocumentVersionConnection { + edges: Array<{ + node: DocumentVersion; + }>; +} + +interface Document { + id: string; + title: string; + documentType: string; + versions: DocumentVersionConnection; +} + +interface Audit { + id: string; + framework: Framework; + validFrom: string; + validUntil: string | null; + state: string; + createdAt: string; + report: { + id: string; + filename: string; + downloadUrl: string | null; + } | null; + reportUrl: string | null; +} + +interface Vendor { + id: string; + name: string; + category: string; + description: string | null; + createdAt: string; + websiteUrl?: string | null; + privacyPolicyUrl?: string | null; +} + +interface Connection { + edges: Array<{ + node: T; + }>; +} + +interface TrustCenter { + id: string; + active: boolean; + slug: string; + organization: Organization; + documents: Connection; + audits: Connection; + vendors: Connection; +} + +interface PublicTrustCenterData { + trustCenterBySlug?: TrustCenter; +} + +function PublicTrustCenterContent() { + const { __ } = useTranslate(); + const { slug } = useParams<{ slug: string }>(); + const [data, setData] = useState(null); + const [loading, setLoading] = useState(true); + const [error, setError] = useState(null); + + const organizationName = data?.trustCenterBySlug?.organization?.name; + usePageTitle(organizationName ? `${organizationName} - Trust Center` : "Trust Center"); + + useEffect(() => { + if (!slug) { + setLoading(false); + return; + } + + setLoading(true); + + fetch(buildEndpoint("/api/trust/v1/graphql"), { + method: "POST", + headers: { + "Content-Type": "application/json", + "Accept": "application/json", + }, + credentials: "include", + body: JSON.stringify({ + operationName: publicTrustCenterQuery.params.name, + query: publicTrustCenterQuery.params.text, + variables: { slug }, + }), + }) + .then(response => response.json()) + .then((result: GraphQLResponse) => { + if (result.errors && result.errors.some((error: GraphQLError) => + !error.message.includes('access denied: authentication required') + )) { + throw new Error(result.errors[0].message); + } + setData(result.data || null); + }) + .catch(setError) + .finally(() => setLoading(false)); + }, [slug]); + + if (!slug) { + return ; + } + + if (loading) { + return
Loading...
; + } + + if (error) { + return ; + } + + const { trustCenterBySlug } = data || {}; + + if (!trustCenterBySlug) { + return ; + } + + if (!trustCenterBySlug.active) { + return ; + } + + const { organization } = trustCenterBySlug; + + const documents = trustCenterBySlug.documents.edges + .map(edge => edge.node); + + const audits = trustCenterBySlug.audits.edges + .map(edge => edge.node); + + const vendors = trustCenterBySlug.vendors.edges + .map(edge => edge.node); + + const isAuthenticated = audits.some((audit: Audit) => + audit.report?.downloadUrl || audit.reportUrl + ); + + return ( + +
+
+

+ {sprintf(__("%s Trust Center"), organization.name)} +

+

+ {__("Explore our security practices, compliance certifications, and transparency reports.")} +

+
+ + + +
+
+ ); +} + +export default function PublicTrustCenterPage() { + return ( + + + + ); +} diff --git a/apps/console/src/pages/TrustCenterAccessPage.tsx b/apps/console/src/pages/TrustCenterAccessPage.tsx new file mode 100644 index 000000000..0d52b5e37 --- /dev/null +++ b/apps/console/src/pages/TrustCenterAccessPage.tsx @@ -0,0 +1,130 @@ +import { useTranslate } from "@probo/i18n"; +import { useParams, useNavigate, useSearchParams } from "react-router"; +import { useState, useEffect } from "react"; +import { PageSkeleton } from "/components/skeletons/PageSkeleton"; +import { PageError } from "/components/PageError"; +import { buildEndpoint } from "/providers/RelayProviders"; +import { IconClock, IconWarning } from "@probo/ui"; + +function TokenErrorPage({ error }: { error: string }) { + const { __ } = useTranslate(); + + const isExpiredToken = error.toLowerCase().includes('expired'); + + return ( +
+
+
+ {isExpiredToken ? ( +
+
+ +
+

+ {__("Access Link Expired")} +

+

+ {__("This access link has expired. Trust center access links are valid for 7 days for security reasons.")} +

+
+ ) : ( +
+
+ +
+

+ {__("Invalid Access Link")} +

+

+ {__("This access link is not valid. It may have been revoked or the link might be incorrect.")} +

+
+ )} +
+ +
+

{__("What can you do?")}

+
    +
  • + • + {__("Contact the person who sent you this link to request a new access invitation")} +
  • +
  • + • + {__("Check if you received a newer email with an updated access link")} +
  • +
  • + • + {__("Verify that you copied the entire link correctly from the email")} +
  • +
+
+
+
+ ); +} + +export default function TrustCenterAccessPage() { + const { __ } = useTranslate(); + const { slug } = useParams<{ slug: string }>(); + const [searchParams] = useSearchParams(); + const token = searchParams.get('token'); + const navigate = useNavigate(); + + const [loading, setLoading] = useState(true); + const [error, setError] = useState(null); + + useEffect(() => { + if (!slug) { + setError(__("Invalid trust center")); + setLoading(false); + return; + } + + if (!token) { + setError(__("Invalid or missing access token")); + setLoading(false); + return; + } + + fetch(buildEndpoint('/api/trust/v1/trust-center-access/authenticate'), { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + credentials: 'include', + body: JSON.stringify({ token }), + }) + .then(response => response.json()) + .then(data => { + if (data.success) { + navigate(`/trust/${slug}`); + } else { + setError(data.message || __("Authentication failed")); + setLoading(false); + } + }) + .catch(() => { + setError(__("Authentication failed")); + setLoading(false); + }); + }, [slug, token, __, navigate]); + + if (loading) { + return ; + } + + if (error) { + const isTokenError = error.toLowerCase().includes('token') || + error.toLowerCase().includes('expired') || + error.toLowerCase().includes('invalid'); + + if (isTokenError) { + return ; + } + + return ; + } + + return
{__("Redirecting to trust center...")}
; +} diff --git a/apps/console/src/pages/organizations/TrustCenterPage.tsx b/apps/console/src/pages/organizations/TrustCenterPage.tsx index cc9f62ed7..10a194f9f 100644 --- a/apps/console/src/pages/organizations/TrustCenterPage.tsx +++ b/apps/console/src/pages/organizations/TrustCenterPage.tsx @@ -212,8 +212,7 @@ export default function TrustCenterPage({ queryRef }: Props) {
-

{__("Content")}

- + {__("Documents")} + + {__("Access")} + diff --git a/apps/console/src/pages/organizations/trustCenter/TrustCenterAccessTab.tsx b/apps/console/src/pages/organizations/trustCenter/TrustCenterAccessTab.tsx new file mode 100644 index 000000000..7f61f152c --- /dev/null +++ b/apps/console/src/pages/organizations/trustCenter/TrustCenterAccessTab.tsx @@ -0,0 +1,361 @@ +import { Badge, Button, Card, Dialog, DialogContent, DialogFooter, Field, Input, Spinner, Table, Tbody, Td, Th, Thead, Tr, useDialogRef, useToast, IconCheckmark1, IconCrossLargeX, IconTrashCan } from "@probo/ui"; +import { useTranslate } from "@probo/i18n"; +import { useOutletContext } from "react-router"; +import { useState, useCallback } from "react"; +import { + useTrustCenterAccesses, + createTrustCenterAccessMutation, + updateTrustCenterAccessMutation, + deleteTrustCenterAccessMutation +} from "/hooks/graph/TrustCenterAccessGraph"; +import { useMutation } from "react-relay"; +import type { TrustCenterAccessGraphQuery$data } from "/hooks/graph/__generated__/TrustCenterAccessGraphQuery.graphql"; + +type ContextType = { + organization: { + id: string; + trustCenter?: { + id: string; + }; + }; +}; + +export default function TrustCenterAccessTab() { + const { __ } = useTranslate(); + const { toast } = useToast(); + const { organization } = useOutletContext(); + + const [createInvitation, isCreating] = useMutation(createTrustCenterAccessMutation); + const [updateInvitation, isUpdating] = useMutation(updateTrustCenterAccessMutation); + const [deleteInvitation, isDeleting] = useMutation(deleteTrustCenterAccessMutation); + + const dialogRef = useDialogRef(); + const [email, setEmail] = useState(""); + const [name, setName] = useState(""); + + type AccessType = { + id: string; + email: string; + name: string; + active: boolean; + createdAt: Date; + }; + + const data = useTrustCenterAccesses(organization.trustCenter?.id || ""); + + if (!organization.trustCenter?.id) { + return ( +
+
+
+

{__("External Access")}

+

+ {__("Manage who can access your trust center with time-limited tokens")} +

+
+
+ +
+ +
+
+
+ ); + } + + const trustCenterData = data as TrustCenterAccessGraphQuery$data | null; + const accesses: AccessType[] = trustCenterData?.node?.accesses?.edges ? + trustCenterData.node.accesses.edges.map(edge => ({ + id: edge.node.id, + email: edge.node.email, + name: edge.node.name, + active: edge.node.active, + createdAt: new Date(edge.node.createdAt) + })) : []; + + const handleInvite = useCallback(async () => { + if (!organization.trustCenter?.id) { + toast({ + title: __("Error"), + description: __("Trust center not found"), + variant: "error", + }); + return; + } + + if (!email.trim() || !name.trim()) { + toast({ + title: __("Error"), + description: __("Email and name are required"), + variant: "error", + }); + return; + } + + const connectionId = trustCenterData?.node?.accesses?.__id; + + try { + createInvitation({ + variables: { + input: { + trustCenterId: organization.trustCenter.id, + email: email.trim(), + name: name.trim(), + sendEmail: true, + }, + connections: connectionId ? [connectionId] : [], + }, + onCompleted: (_, errors) => { + if (errors && errors.length > 0) { + toast({ + title: __("Error"), + description: errors[0]?.message || __("Failed to send invitation"), + variant: "error", + }); + return; + } + + if (dialogRef.current) { + dialogRef.current.close(); + } + setEmail(""); + setName(""); + + toast({ + title: __("Success"), + description: __("Access invitation sent successfully"), + variant: "success", + }); + }, + onError: (error) => { + toast({ + title: __("Error"), + description: error.message || __("Failed to send invitation. Please try again."), + variant: "error", + }); + }, + }); + } catch (error) { + toast({ + title: __("Error"), + description: __("An unexpected error occurred. Please try again."), + variant: "error", + }); + } + }, [organization.trustCenter?.id, email, name, trustCenterData, createInvitation, toast, __, dialogRef]); + + const handleRevoke = useCallback(async (accessId: string) => { + updateInvitation({ + variables: { + input: { + accessId, + active: false, + sendEmail: false, + }, + }, + onCompleted: () => { + toast({ + title: __("Success"), + description: __("Access revoked successfully"), + variant: "success", + }); + }, + onError: (error) => { + toast({ + title: __("Error"), + description: error.message, + variant: "error", + }); + }, + }); + }, [updateInvitation, toast, __]); + + const handleReinvite = useCallback(async (access: AccessType) => { + if (!organization.trustCenter?.id) { + toast({ + title: __("Error"), + description: __("Trust center not found"), + variant: "error", + }); + return; + } + + try { + updateInvitation({ + variables: { + input: { + accessId: access.id, + active: true, + sendEmail: true, + }, + }, + onCompleted: (_, errors) => { + if (errors && errors.length > 0) { + toast({ + title: __("Error"), + description: errors[0]?.message || __("Failed to send reinvitation"), + variant: "error", + }); + return; + } + + toast({ + title: __("Success"), + description: __("Reinvitation sent successfully"), + variant: "success", + }); + }, + onError: (error) => { + toast({ + title: __("Error"), + description: error.message || __("Failed to send reinvitation. Please try again."), + variant: "error", + }); + }, + }); + } catch (error) { + toast({ + title: __("Error"), + description: __("An unexpected error occurred. Please try again."), + variant: "error", + }); + } + }, [organization.trustCenter?.id, updateInvitation, toast, __]); + + const handleDelete = useCallback(async (accessId: string) => { + const connectionId = trustCenterData?.node?.accesses?.__id; + + deleteInvitation({ + variables: { + input: { + accessId, + }, + connections: connectionId ? [connectionId] : [], + }, + onCompleted: () => { + toast({ + title: __("Success"), + description: __("Access deleted successfully"), + variant: "success", + }); + }, + onError: (error) => { + toast({ + title: __("Error"), + description: error.message, + variant: "error", + }); + }, + }); + }, [deleteInvitation, toast, __, trustCenterData]); + + return ( +
+
+
+

{__("External Access")}

+

+ {__("Manage who can access your trust center with time-limited tokens")} +

+
+ +
+ + + {accesses.length === 0 ? ( +
+ {__("No external access granted yet")} +
+ ) : ( + + + + + + + + + + + + {accesses.map((access) => ( + + + + + + + + ))} + +
{__("Name")}{__("Email")}{__("Status")}{__("Date")}
{access.name}{access.email} + + {access.active ? __("Active") : __("Revoked")} + + + {access.createdAt.toLocaleDateString()} + +
+
+
+ )} +
+ + + +

+ {__("Send a 7-day access token to an external person to view your trust center")} +

+ + + setName(e.target.value)} + placeholder={__("John Doe")} + /> + + + + setEmail(e.target.value)} + placeholder={__("john@example.com")} + /> + +
+ + + + + +
+
+ ); +} diff --git a/apps/console/src/providers/TrustRelayProvider.tsx b/apps/console/src/providers/TrustRelayProvider.tsx new file mode 100644 index 000000000..b438b3d82 --- /dev/null +++ b/apps/console/src/providers/TrustRelayProvider.tsx @@ -0,0 +1,80 @@ +import { + Environment, + type FetchFunction, + Network, + RecordSource, + Store, +} from "relay-runtime"; + +import type { PropsWithChildren } from "react"; +import { RelayEnvironmentProvider } from "react-relay"; +import { buildEndpoint } from "./RelayProviders"; + +export class TrustCenterError extends Error { + constructor(message: string) { + super(message); + this.name = "TrustCenterError"; + } +} + +const fetchTrustRelay: FetchFunction = async (request, variables) => { + const requestInit: RequestInit = { + method: "POST", + headers: { + Accept: + "application/graphql-response+json; charset=utf-8, application/json; charset=utf-8", + "Content-Type": "application/json", + }, + credentials: "include", // Include cookies for authentication + body: JSON.stringify({ + operationName: request.name, + query: request.text, + variables, + }), + }; + + const response = await fetch( + buildEndpoint("/api/trust/v1/graphql"), + requestInit + ); + + if (response.status === 500) { + throw new TrustCenterError("Internal server error"); + } + + const json = await response.json(); + + if (json.errors) { + throw new TrustCenterError( + `Error fetching GraphQL query '${ + request.name + }' with variables '${JSON.stringify(variables)}': ${JSON.stringify( + json.errors + )}` + ); + } + + return json; +}; + +const trustSource = new RecordSource(); +const trustStore = new Store(trustSource, { + queryCacheExpirationTime: 5 * 60 * 1000, // 5 minutes for trust center content + gcReleaseBufferSize: 10, +}); + +export const trustRelayEnvironment = new Environment({ + network: Network.create(fetchTrustRelay), + store: trustStore, +}); + +/** + * Provider for trust center Relay environment (public API) + */ +export function TrustRelayProvider({ children }: PropsWithChildren) { + return ( + + {children} + + ); +} diff --git a/apps/console/src/routes.tsx b/apps/console/src/routes.tsx index a937731ea..443c033ff 100644 --- a/apps/console/src/routes.tsx +++ b/apps/console/src/routes.tsx @@ -8,7 +8,7 @@ import { } from "react-router"; import { MainLayout } from "./layouts/MainLayout"; import { AuthLayout, CenteredLayout, CenteredLayoutSkeleton } from "@probo/ui"; -import { Fragment, Suspense, type FC, type LazyExoticComponent } from "react"; +import { Fragment, Suspense } from "react"; import { relayEnvironment, UnAuthenticatedError, @@ -31,6 +31,13 @@ import { auditRoutes } from "./routes/auditRoutes.ts"; import { trustCenterRoutes } from "./routes/trustCenterRoutes.ts"; import { lazy } from "@probo/react-lazy"; +export type AppRoute = Omit & { + Component?: React.ComponentType; + children?: AppRoute[]; + fallback?: React.ComponentType; + queryLoader?: (params: any) => PreloadedQuery; +}; + /** * Top level error boundary */ @@ -44,13 +51,6 @@ function ErrorBoundary({ error: propsError }: { error?: string }) { return ; } -export type AppRoute = { - Component: FC | LazyExoticComponent>; - children?: AppRoute[]; - fallback?: FC; - queryLoader?: (params: Record) => PreloadedQuery; -} & Omit; - const routes = [ { path: "/auth", @@ -106,6 +106,18 @@ const routes = [ }, ], }, + { + path: "/trust/:slug", + ErrorBoundary: ErrorBoundary, + fallback: PageSkeleton, + Component: lazy(() => import("./pages/PublicTrustCenterPage")), + }, + { + path: "/trust/:slug/access", + ErrorBoundary: ErrorBoundary, + fallback: PageSkeleton, + Component: lazy(() => import("./pages/TrustCenterAccessPage")), + }, { path: "/organizations/:organizationId", Component: MainLayout, @@ -160,17 +172,19 @@ function routeTransformer({ ...route }: AppRoute): RouteObject { let result = { ...route }; - if (FallbackComponent) { + if (FallbackComponent && route.Component) { + const OriginalComponent = route.Component; result = { ...result, Component: (props) => ( }> - + ), }; } - if (queryLoader) { + if (queryLoader && route.Component) { + const OriginalComponent = route.Component; result = { ...result, loader: ({ params }) => { @@ -187,7 +201,7 @@ function routeTransformer({ return ( : null}> - + ); }, diff --git a/apps/console/src/routes/trustCenterRoutes.ts b/apps/console/src/routes/trustCenterRoutes.ts index 5c1ac85a4..dc5470a2a 100644 --- a/apps/console/src/routes/trustCenterRoutes.ts +++ b/apps/console/src/routes/trustCenterRoutes.ts @@ -44,6 +44,13 @@ export const trustCenterRoutes = [ () => import("/pages/organizations/trustCenter/TrustCenterDocumentsTab") ), }, + { + path: "access", + fallback: LinkCardSkeleton, + Component: lazy( + () => import("/pages/organizations/trustCenter/TrustCenterAccessTab") + ), + }, ], }, ] satisfies AppRoute[]; diff --git a/pkg/coredata/audit.go b/pkg/coredata/audit.go index 3ea52b6f8..0952562fe 100644 --- a/pkg/coredata/audit.go +++ b/pkg/coredata/audit.go @@ -142,6 +142,7 @@ func (a *Audits) LoadByOrganizationID( scope Scoper, organizationID gid.GID, cursor *page.Cursor[AuditOrderField], + filter *AuditFilter, ) error { q := ` SELECT @@ -161,12 +162,14 @@ WHERE %s AND organization_id = @organization_id AND %s + AND %s ` - q = fmt.Sprintf(q, scope.SQLFragment(), cursor.SQLFragment()) + q = fmt.Sprintf(q, scope.SQLFragment(), filter.SQLFragment(), cursor.SQLFragment()) args := pgx.StrictNamedArgs{"organization_id": organizationID} maps.Copy(args, scope.SQLArguments()) + maps.Copy(args, filter.SQLArguments()) maps.Copy(args, cursor.SQLArguments()) rows, err := conn.Query(ctx, q, args) diff --git a/pkg/coredata/audit_filter.go b/pkg/coredata/audit_filter.go new file mode 100644 index 000000000..f9abdf4a0 --- /dev/null +++ b/pkg/coredata/audit_filter.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 coredata + +import ( + "github.com/jackc/pgx/v5" +) + +type ( + AuditFilter struct { + showOnTrustCenter *bool + } +) + +func NewAuditFilter() *AuditFilter { + return &AuditFilter{} +} + +func NewAuditTrustCenterFilter() *AuditFilter { + showOnTrustCenter := true + return &AuditFilter{ + showOnTrustCenter: &showOnTrustCenter, + } +} + +func (f *AuditFilter) SQLArguments() pgx.NamedArgs { + args := pgx.NamedArgs{} + + if f.showOnTrustCenter != nil { + args["show_on_trust_center"] = *f.showOnTrustCenter + } + + return args +} + +func (f *AuditFilter) SQLFragment() string { + if f.showOnTrustCenter != nil { + return "show_on_trust_center = @show_on_trust_center" + } + + return "TRUE" +} diff --git a/pkg/coredata/document_filter.go b/pkg/coredata/document_filter.go index 569534670..bdb58dc41 100644 --- a/pkg/coredata/document_filter.go +++ b/pkg/coredata/document_filter.go @@ -20,7 +20,8 @@ import ( type ( DocumentFilter struct { - query *string + query *string + showOnTrustCenter *bool } ) @@ -30,21 +31,52 @@ func NewDocumentFilter(query *string) *DocumentFilter { } } -func (f *DocumentFilter) SQLArguments() pgx.NamedArgs { - return pgx.NamedArgs{ - "query": f.query, +func NewDocumentTrustCenterFilter() *DocumentFilter { + showOnTrustCenter := true + return &DocumentFilter{ + showOnTrustCenter: &showOnTrustCenter, } } +func (f *DocumentFilter) SQLArguments() pgx.NamedArgs { + args := pgx.NamedArgs{} + + if f.query != nil { + args["query"] = *f.query + } + if f.showOnTrustCenter != nil { + args["show_on_trust_center"] = *f.showOnTrustCenter + } + + return args +} + func (f *DocumentFilter) SQLFragment() string { - if f.query == nil || *f.query == "" { - return "TRUE" - } + conditions := []string{} - return ` + if f.query != nil && *f.query != "" { + conditions = append(conditions, ` search_vector @@ ( SELECT to_tsquery('simple', string_agg(lexeme || ':*', ' & ')) FROM unnest(regexp_split_to_array(trim(@query), '\s+')) AS lexeme - ) - ` + )`) + } + + if f.showOnTrustCenter != nil { + conditions = append(conditions, "show_on_trust_center = @show_on_trust_center") + } + + if len(conditions) == 0 { + return "TRUE" + } + + result := "" + for i, condition := range conditions { + if i > 0 { + result += " AND " + } + result += condition + } + + return result } diff --git a/pkg/coredata/entity_type_reg.go b/pkg/coredata/entity_type_reg.go index 8223db995..67d3334dc 100644 --- a/pkg/coredata/entity_type_reg.go +++ b/pkg/coredata/entity_type_reg.go @@ -38,4 +38,5 @@ const ( AuditEntityType ReportEntityType TrustCenterEntityType + TrustCenterAccessEntityType ) diff --git a/pkg/coredata/migrations/20250728T194402Z.sql b/pkg/coredata/migrations/20250728T194402Z.sql new file mode 100644 index 000000000..667d3f3b7 --- /dev/null +++ b/pkg/coredata/migrations/20250728T194402Z.sql @@ -0,0 +1,11 @@ +CREATE TABLE trust_center_accesses ( + id TEXT PRIMARY KEY, + tenant_id TEXT NOT NULL, + trust_center_id TEXT NOT NULL REFERENCES trust_centers(id) ON DELETE CASCADE, + email CITEXT NOT NULL, + name TEXT NOT NULL, + active BOOLEAN NOT NULL DEFAULT true, + created_at TIMESTAMP WITH TIME ZONE NOT NULL, + updated_at TIMESTAMP WITH TIME ZONE NOT NULL, + UNIQUE(trust_center_id, email) +); diff --git a/pkg/coredata/trust_center.go b/pkg/coredata/trust_center.go index ff0687fe4..69dd971e1 100644 --- a/pkg/coredata/trust_center.go +++ b/pkg/coredata/trust_center.go @@ -135,6 +135,44 @@ LIMIT 1; return nil } +func (tc *TrustCenter) LoadBySlug( + ctx context.Context, + conn pg.Conn, + slug string, +) error { + q := ` +SELECT + id, + organization_id, + tenant_id, + active, + slug, + created_at, + updated_at +FROM + trust_centers +WHERE + slug = @slug +LIMIT 1; +` + + args := pgx.StrictNamedArgs{"slug": slug} + + rows, err := conn.Query(ctx, q, args) + if err != nil { + return fmt.Errorf("cannot query trust center: %w", err) + } + + trustCenter, err := pgx.CollectExactlyOneRow(rows, pgx.RowToStructByName[TrustCenter]) + if err != nil { + return fmt.Errorf("cannot collect trust center: %w", err) + } + + *tc = trustCenter + + return nil +} + func (tc *TrustCenter) Insert( ctx context.Context, conn pg.Conn, diff --git a/pkg/coredata/trust_center_access.go b/pkg/coredata/trust_center_access.go new file mode 100644 index 000000000..82c047998 --- /dev/null +++ b/pkg/coredata/trust_center_access.go @@ -0,0 +1,318 @@ +// 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 ( + TrustCenterAccess struct { + ID gid.GID `db:"id"` + TenantID gid.TenantID `db:"tenant_id"` + TrustCenterID gid.GID `db:"trust_center_id"` + Email string `db:"email"` + Name string `db:"name"` + Active bool `db:"active"` + CreatedAt time.Time `db:"created_at"` + UpdatedAt time.Time `db:"updated_at"` + } + + TrustCenterAccesses []*TrustCenterAccess +) + +func (tca *TrustCenterAccess) CursorKey(orderBy TrustCenterAccessOrderField) page.CursorKey { + switch orderBy { + case TrustCenterAccessOrderFieldCreatedAt: + return page.NewCursorKey(tca.ID, tca.CreatedAt) + } + + panic(fmt.Sprintf("unsupported order by: %s", orderBy)) +} + +func (tca *TrustCenterAccess) LoadByID( + ctx context.Context, + conn pg.Conn, + scope Scoper, + accessID gid.GID, +) error { + q := ` +SELECT + id, + tenant_id, + trust_center_id, + email, + name, + active, + created_at, + updated_at +FROM + trust_center_accesses +WHERE + %s + AND id = @access_id +LIMIT 1; +` + + q = fmt.Sprintf(q, scope.SQLFragment()) + + args := pgx.StrictNamedArgs{"access_id": accessID} + maps.Copy(args, scope.SQLArguments()) + + rows, err := conn.Query(ctx, q, args) + if err != nil { + return fmt.Errorf("cannot query trust center access: %w", err) + } + + access, err := pgx.CollectExactlyOneRow(rows, pgx.RowToStructByName[TrustCenterAccess]) + if err != nil { + return fmt.Errorf("cannot collect trust center access: %w", err) + } + + *tca = access + + return nil +} + +func (tca *TrustCenterAccess) LoadByTrustCenterIDAndEmail( + ctx context.Context, + conn pg.Conn, + scope Scoper, + trustCenterID gid.GID, + email string, +) error { + q := ` +SELECT + id, + tenant_id, + trust_center_id, + email, + name, + active, + created_at, + updated_at +FROM + trust_center_accesses +WHERE + %s + AND trust_center_id = @trust_center_id + AND email = @email +LIMIT 1; +` + + q = fmt.Sprintf(q, scope.SQLFragment()) + + args := pgx.StrictNamedArgs{ + "trust_center_id": trustCenterID, + "email": email, + } + maps.Copy(args, scope.SQLArguments()) + + rows, err := conn.Query(ctx, q, args) + if err != nil { + return fmt.Errorf("cannot query trust center access: %w", err) + } + + access, err := pgx.CollectExactlyOneRow(rows, pgx.RowToStructByName[TrustCenterAccess]) + if err != nil { + return fmt.Errorf("cannot collect trust center access: %w", err) + } + + *tca = access + + return nil +} + +func (tca *TrustCenterAccess) Insert( + ctx context.Context, + conn pg.Conn, + scope Scoper, +) error { + q := ` +INSERT INTO trust_center_accesses ( + id, + tenant_id, + trust_center_id, + email, + name, + active, + created_at, + updated_at +) VALUES ( + @id, + @tenant_id, + @trust_center_id, + @email, + @name, + @active, + @created_at, + @updated_at +) +` + + args := pgx.StrictNamedArgs{ + "id": tca.ID, + "tenant_id": tca.TenantID, + "trust_center_id": tca.TrustCenterID, + "email": tca.Email, + "name": tca.Name, + "active": tca.Active, + "created_at": tca.CreatedAt, + "updated_at": tca.UpdatedAt, + } + + _, err := conn.Exec(ctx, q, args) + if err != nil { + return fmt.Errorf("cannot insert trust center access: %w", err) + } + + return nil +} + +func (tca *TrustCenterAccess) Update( + ctx context.Context, + conn pg.Conn, + scope Scoper, +) error { + q := ` +UPDATE trust_center_accesses +SET + active = @active, + updated_at = @updated_at +WHERE + %s + AND id = @id +` + + q = fmt.Sprintf(q, scope.SQLFragment()) + + args := pgx.StrictNamedArgs{ + "id": tca.ID, + "active": tca.Active, + "updated_at": tca.UpdatedAt, + } + maps.Copy(args, scope.SQLArguments()) + + _, err := conn.Exec(ctx, q, args) + if err != nil { + return fmt.Errorf("cannot update trust center access: %w", err) + } + + return nil +} + +func (tca *TrustCenterAccess) Delete( + ctx context.Context, + conn pg.Conn, + scope Scoper, +) error { + q := ` +DELETE FROM trust_center_accesses +WHERE + %s + AND id = @id +` + + q = fmt.Sprintf(q, scope.SQLFragment()) + + args := pgx.StrictNamedArgs{ + "id": tca.ID, + } + maps.Copy(args, scope.SQLArguments()) + + _, err := conn.Exec(ctx, q, args) + if err != nil { + return fmt.Errorf("cannot delete trust center access: %w", err) + } + + return nil +} + +func (tcas *TrustCenterAccesses) LoadByTrustCenterID( + ctx context.Context, + conn pg.Conn, + scope Scoper, + trustCenterID gid.GID, + cursor *page.Cursor[TrustCenterAccessOrderField], +) error { + q := ` +SELECT + id, + tenant_id, + trust_center_id, + email, + name, + active, + created_at, + updated_at +FROM + trust_center_accesses +WHERE + %s + AND trust_center_id = @trust_center_id + AND %s +` + + q = fmt.Sprintf(q, scope.SQLFragment(), cursor.SQLFragment()) + + args := pgx.StrictNamedArgs{ + "trust_center_id": trustCenterID, + } + 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 trust center accesses: %w", err) + } + + accesses, err := pgx.CollectRows(rows, pgx.RowToAddrOfStructByName[TrustCenterAccess]) + if err != nil { + return fmt.Errorf("cannot collect trust center accesses: %w", err) + } + + *tcas = accesses + + return nil +} + +type ( + TrustCenterAccessOrderField string +) + +const ( + TrustCenterAccessOrderFieldCreatedAt TrustCenterAccessOrderField = "CREATED_AT" +) + +func (tcaof TrustCenterAccessOrderField) String() string { + return string(tcaof) +} + +func (tcaof TrustCenterAccessOrderField) Column() string { + switch tcaof { + case TrustCenterAccessOrderFieldCreatedAt: + return "created_at" + } + + panic(fmt.Sprintf("unsupported order by: %s", tcaof)) +} diff --git a/pkg/coredata/vendor.go b/pkg/coredata/vendor.go index a1376db44..f8768f845 100644 --- a/pkg/coredata/vendor.go +++ b/pkg/coredata/vendor.go @@ -278,45 +278,48 @@ func (v *Vendors) LoadByOrganizationID( scope Scoper, organizationID gid.GID, cursor *page.Cursor[VendorOrderField], + filter *VendorFilter, ) error { q := ` SELECT - id, - tenant_id, - organization_id, - name, - description, - category, - headquarter_address, - legal_name, - website_url, - privacy_policy_url, - service_level_agreement_url, - data_processing_agreement_url, - business_associate_agreement_url, - subprocessors_list_url, - certifications, - business_owner_id, - security_owner_id, - status_page_url, - terms_of_service_url, - security_page_url, - trust_page_url, - show_on_trust_center, - created_at, - updated_at + id, + tenant_id, + organization_id, + name, + description, + category, + headquarter_address, + legal_name, + website_url, + privacy_policy_url, + service_level_agreement_url, + data_processing_agreement_url, + business_associate_agreement_url, + subprocessors_list_url, + certifications, + business_owner_id, + security_owner_id, + status_page_url, + terms_of_service_url, + security_page_url, + trust_page_url, + show_on_trust_center, + created_at, + updated_at FROM - vendors + vendors WHERE - %s - AND organization_id = @organization_id - AND %s + %s + AND organization_id = @organization_id + AND %s + AND %s ` - q = fmt.Sprintf(q, scope.SQLFragment(), cursor.SQLFragment()) + q = fmt.Sprintf(q, scope.SQLFragment(), filter.SQLFragment(), cursor.SQLFragment()) args := pgx.StrictNamedArgs{"organization_id": organizationID} - maps.Copy(args, cursor.SQLArguments()) maps.Copy(args, scope.SQLArguments()) + maps.Copy(args, filter.SQLArguments()) + maps.Copy(args, cursor.SQLArguments()) rows, err := conn.Query(ctx, q, args) if err != nil { diff --git a/pkg/coredata/vendor_filter.go b/pkg/coredata/vendor_filter.go new file mode 100644 index 000000000..c67a1d9ed --- /dev/null +++ b/pkg/coredata/vendor_filter.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 coredata + +import ( + "github.com/jackc/pgx/v5" +) + +type ( + VendorFilter struct { + showOnTrustCenter *bool + } +) + +func NewVendorFilter() *VendorFilter { + return &VendorFilter{} +} + +func NewVendorTrustCenterFilter() *VendorFilter { + showOnTrustCenter := true + return &VendorFilter{ + showOnTrustCenter: &showOnTrustCenter, + } +} + +func (f *VendorFilter) SQLArguments() pgx.NamedArgs { + args := pgx.NamedArgs{} + + if f.showOnTrustCenter != nil { + args["show_on_trust_center"] = *f.showOnTrustCenter + } + + return args +} + +func (f *VendorFilter) SQLFragment() string { + if f.showOnTrustCenter != nil { + return "show_on_trust_center = @show_on_trust_center" + } + + return "TRUE" +} diff --git a/pkg/probo/audit_service.go b/pkg/probo/audit_service.go index cee0e6255..23c7f2ecd 100644 --- a/pkg/probo/audit_service.go +++ b/pkg/probo/audit_service.go @@ -201,7 +201,8 @@ func (s AuditService) ListForOrganizationID( err := s.svc.pg.WithConn( ctx, func(conn pg.Conn) error { - err := audits.LoadByOrganizationID(ctx, conn, s.svc.scope, organizationID, cursor) + filter := coredata.NewAuditFilter() + err := audits.LoadByOrganizationID(ctx, conn, s.svc.scope, organizationID, cursor, filter) if err != nil { return fmt.Errorf("cannot load audits: %w", err) } diff --git a/pkg/probo/service.go b/pkg/probo/service.go index 69a36c65b..8121a5c51 100644 --- a/pkg/probo/service.go +++ b/pkg/probo/service.go @@ -25,6 +25,7 @@ import ( "github.com/getprobo/probo/pkg/filevalidation" "github.com/getprobo/probo/pkg/gid" "github.com/getprobo/probo/pkg/html2pdf" + "github.com/getprobo/probo/pkg/usrmgr" "go.gearno.de/kit/pg" ) @@ -38,6 +39,7 @@ type ( tokenSecret string agentConfig agents.Config html2pdfConverter *html2pdf.Converter + usrmgr *usrmgr.Service } TenantService struct { @@ -66,6 +68,7 @@ type ( Audits *AuditService Reports *ReportService TrustCenters *TrustCenterService + TrustCenterAccesses *TrustCenterAccessService } ) @@ -79,6 +82,7 @@ func NewService( tokenSecret string, agentConfig agents.Config, html2pdfConverter *html2pdf.Converter, + usrmgrService *usrmgr.Service, ) (*Service, error) { if bucket == "" { return nil, fmt.Errorf("bucket is required") @@ -93,11 +97,16 @@ func NewService( tokenSecret: tokenSecret, agentConfig: agentConfig, html2pdfConverter: html2pdfConverter, + usrmgr: usrmgrService, } return svc, nil } +func (s *Service) GetEncryptionKey() cipher.EncryptionKey { + return s.encryptionKey +} + func (s *Service) WithTenant(tenantID gid.TenantID) *TenantService { tenantService := &TenantService{ pg: s.pg, @@ -146,5 +155,9 @@ func (s *Service) WithTenant(tenantID gid.TenantID) *TenantService { tenantService.Audits = &AuditService{svc: tenantService} tenantService.Reports = &ReportService{svc: tenantService} tenantService.TrustCenters = &TrustCenterService{svc: tenantService} + tenantService.TrustCenterAccesses = &TrustCenterAccessService{ + svc: tenantService, + usrmgr: s.usrmgr, + } return tenantService } diff --git a/pkg/probo/trust_center_access_service.go b/pkg/probo/trust_center_access_service.go new file mode 100644 index 000000000..d48e105c3 --- /dev/null +++ b/pkg/probo/trust_center_access_service.go @@ -0,0 +1,341 @@ +// 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 probo + +import ( + "context" + "fmt" + "net/url" + "strings" + "time" + + "github.com/getprobo/probo/pkg/coredata" + "github.com/getprobo/probo/pkg/gid" + "github.com/getprobo/probo/pkg/page" + "github.com/getprobo/probo/pkg/statelesstoken" + "github.com/getprobo/probo/pkg/usrmgr" + "go.gearno.de/kit/pg" +) + +type ( + TrustCenterAccessService struct { + svc *TenantService + usrmgr *usrmgr.Service + } + + CreateTrustCenterAccessRequest struct { + TrustCenterID gid.GID + Email string + Name string + SendEmail bool + } + + UpdateTrustCenterAccessRequest struct { + AccessID gid.GID + Email *string + Name *string + Active *bool + SendEmail bool + } + + DeleteTrustCenterAccessRequest struct { + AccessID gid.GID + } + + RevokeTrustCenterAccessRequest struct { + AccessID gid.GID + } + + TrustCenterAccessData struct { + TrustCenterID gid.GID `json:"trust_center_id"` + Email string `json:"email"` + } +) + +const ( + TokenTypeTrustCenterAccess = "trust_center_access" +) + +func (s TrustCenterAccessService) RevokeAccess( + ctx context.Context, + req *RevokeTrustCenterAccessRequest, +) (*coredata.TrustCenterAccess, error) { + access := &coredata.TrustCenterAccess{} + + err := s.svc.pg.WithTx(ctx, func(tx pg.Conn) error { + if err := access.LoadByID(ctx, tx, s.svc.scope, req.AccessID); err != nil { + return fmt.Errorf("cannot load trust center access: %w", err) + } + + access.Active = false + access.UpdatedAt = time.Now() + + if err := access.Update(ctx, tx, s.svc.scope); err != nil { + return fmt.Errorf("cannot update trust center access: %w", err) + } + + return nil + }) + + if err != nil { + return nil, err + } + + return access, nil +} + +func (s TrustCenterAccessService) ListForTrustCenterID( + ctx context.Context, + trustCenterID gid.GID, + cursor *page.Cursor[coredata.TrustCenterAccessOrderField], +) (*page.Page[*coredata.TrustCenterAccess, coredata.TrustCenterAccessOrderField], error) { + var accesses coredata.TrustCenterAccesses + + err := s.svc.pg.WithConn(ctx, func(conn pg.Conn) error { + return accesses.LoadByTrustCenterID(ctx, conn, s.svc.scope, trustCenterID, cursor) + }) + + if err != nil { + return nil, err + } + + return page.NewPage(accesses, cursor), nil +} + +func (s TrustCenterAccessService) ValidateToken( + ctx context.Context, + tokenString string, +) (*TrustCenterAccessData, error) { + token, err := statelesstoken.ValidateToken[TrustCenterAccessData]( + s.svc.tokenSecret, + TokenTypeTrustCenterAccess, + tokenString, + ) + if err != nil { + return nil, fmt.Errorf("cannot validate trust center access token: %w", err) + } + + access := &coredata.TrustCenterAccess{} + err = s.svc.pg.WithConn(ctx, func(conn pg.Conn) error { + return access.LoadByTrustCenterIDAndEmail(ctx, conn, s.svc.scope, token.Data.TrustCenterID, token.Data.Email) + }) + + if err != nil { + return nil, fmt.Errorf("access not found or revoked: %w", err) + } + + if !access.Active { + return nil, fmt.Errorf("access has been revoked") + } + + return &token.Data, nil +} + +func (s TrustCenterAccessService) IsAccessActive( + ctx context.Context, + trustCenterID gid.GID, + email string, +) (bool, error) { + access := &coredata.TrustCenterAccess{} + err := s.svc.pg.WithConn(ctx, func(conn pg.Conn) error { + return access.LoadByTrustCenterIDAndEmail(ctx, conn, s.svc.scope, trustCenterID, email) + }) + + if err != nil { + return false, fmt.Errorf("cannot load trust center access: %w", err) + } + + return access.Active, nil +} + +func (s TrustCenterAccessService) Create( + ctx context.Context, + req *CreateTrustCenterAccessRequest, +) (*coredata.TrustCenterAccess, error) { + if !strings.Contains(req.Email, "@") { + return nil, fmt.Errorf("invalid email address") + } + + if req.Name == "" { + return nil, fmt.Errorf("name is required") + } + + now := time.Now() + + existingAccess := &coredata.TrustCenterAccess{} + err := s.svc.pg.WithConn(ctx, func(conn pg.Conn) error { + return existingAccess.LoadByTrustCenterIDAndEmail(ctx, conn, s.svc.scope, req.TrustCenterID, req.Email) + }) + + var access *coredata.TrustCenterAccess + + if err == nil { + access = existingAccess + access.Name = req.Name + access.Active = true + access.UpdatedAt = now + + err = s.svc.pg.WithTx(ctx, func(tx pg.Conn) error { + if err := access.Update(ctx, tx, s.svc.scope); err != nil { + return fmt.Errorf("cannot update trust center access: %w", err) + } + return nil + }) + if err != nil { + return nil, err + } + } else { + access = &coredata.TrustCenterAccess{ + ID: gid.New(s.svc.scope.GetTenantID(), coredata.TrustCenterAccessEntityType), + TenantID: s.svc.scope.GetTenantID(), + TrustCenterID: req.TrustCenterID, + Email: req.Email, + Name: req.Name, + Active: true, + CreatedAt: now, + UpdatedAt: now, + } + + err = s.svc.pg.WithTx(ctx, func(tx pg.Conn) error { + if err := access.Insert(ctx, tx, s.svc.scope); err != nil { + return fmt.Errorf("cannot insert trust center access: %w", err) + } + return nil + }) + if err != nil { + return nil, err + } + } + + if req.SendEmail { + if err := s.sendAccessEmail(ctx, access); err != nil { + fmt.Printf("Failed to send access email\n") + } + } + + return access, nil +} + +func (s TrustCenterAccessService) Update( + ctx context.Context, + req *UpdateTrustCenterAccessRequest, +) (*coredata.TrustCenterAccess, error) { + access := &coredata.TrustCenterAccess{} + + err := s.svc.pg.WithTx(ctx, func(tx pg.Conn) error { + if err := access.LoadByID(ctx, tx, s.svc.scope, req.AccessID); err != nil { + return fmt.Errorf("cannot load trust center access: %w", err) + } + + if req.Email != nil { + if !strings.Contains(*req.Email, "@") { + return fmt.Errorf("invalid email address") + } + access.Email = *req.Email + } + + if req.Name != nil { + if *req.Name == "" { + return fmt.Errorf("name cannot be empty") + } + access.Name = *req.Name + } + + if req.Active != nil { + access.Active = *req.Active + } + + access.UpdatedAt = time.Now() + + if err := access.Update(ctx, tx, s.svc.scope); err != nil { + return fmt.Errorf("cannot update trust center access: %w", err) + } + + return nil + }) + + if err != nil { + return nil, err + } + + if req.SendEmail && access.Active { + if err := s.sendAccessEmail(ctx, access); err != nil { + fmt.Printf("Failed to send access email\n") + } + } + + return access, nil +} + +func (s TrustCenterAccessService) Delete( + ctx context.Context, + req *DeleteTrustCenterAccessRequest, +) error { + err := s.svc.pg.WithTx(ctx, func(tx pg.Conn) error { + access := &coredata.TrustCenterAccess{} + + if err := access.LoadByID(ctx, tx, s.svc.scope, req.AccessID); err != nil { + return fmt.Errorf("cannot load trust center access: %w", err) + } + + if err := access.Delete(ctx, tx, s.svc.scope); err != nil { + return fmt.Errorf("cannot delete trust center access: %w", err) + } + + return nil + }) + + return err +} + +func (s TrustCenterAccessService) sendAccessEmail(ctx context.Context, access *coredata.TrustCenterAccess) error { + accessToken, err := statelesstoken.NewToken( + s.svc.tokenSecret, + TokenTypeTrustCenterAccess, + 7*24*time.Hour, + TrustCenterAccessData{ + TrustCenterID: access.TrustCenterID, + Email: access.Email, + }, + ) + if err != nil { + return fmt.Errorf("cannot generate access token: %w", err) + } + + trustCenter := &coredata.TrustCenter{} + err = s.svc.pg.WithConn(ctx, func(conn pg.Conn) error { + return trustCenter.LoadByID(ctx, conn, s.svc.scope, access.TrustCenterID) + }) + if err != nil { + return fmt.Errorf("cannot load trust center: %w", err) + } + + organization := &coredata.Organization{} + err = s.svc.pg.WithConn(ctx, func(conn pg.Conn) error { + return organization.LoadByID(ctx, conn, s.svc.scope, trustCenter.OrganizationID) + }) + if err != nil { + return fmt.Errorf("cannot load organization: %w", err) + } + + accessURL := url.URL{ + Scheme: "https", + Host: s.svc.hostname, + Path: "/trust/" + trustCenter.Slug + "/access", + RawQuery: "token=" + url.QueryEscape(accessToken), + } + + return s.usrmgr.SendTrustCenterAccessEmail(ctx, access.Name, access.Email, organization.Name, accessURL.String()) +} diff --git a/pkg/probo/trust_center_service.go b/pkg/probo/trust_center_service.go index bc0987bed..ff5f1636f 100644 --- a/pkg/probo/trust_center_service.go +++ b/pkg/probo/trust_center_service.go @@ -86,7 +86,7 @@ func (s TrustCenterService) GetByOrganizationID( return trustCenter, nil } -func (s *TrustCenterService) Update( +func (s TrustCenterService) Update( ctx context.Context, req *UpdateTrustCenterRequest, ) (*coredata.TrustCenter, error) { diff --git a/pkg/probo/vendor_service.go b/pkg/probo/vendor_service.go index 07faea001..fd925886d 100644 --- a/pkg/probo/vendor_service.go +++ b/pkg/probo/vendor_service.go @@ -131,12 +131,14 @@ func (s VendorService) ListForOrganizationID( return fmt.Errorf("cannot load organization: %w", err) } + filter := coredata.NewVendorFilter() return vendors.LoadByOrganizationID( ctx, conn, s.svc.scope, organization.ID, cursor, + filter, ) }, ) diff --git a/pkg/probod/probod.go b/pkg/probod/probod.go index bf9578242..01ca31afd 100644 --- a/pkg/probod/probod.go +++ b/pkg/probod/probod.go @@ -35,7 +35,8 @@ import ( "github.com/getprobo/probo/pkg/probo" "github.com/getprobo/probo/pkg/saferedirect" "github.com/getprobo/probo/pkg/server" - console_v1 "github.com/getprobo/probo/pkg/server/api/console/v1" + "github.com/getprobo/probo/pkg/server/api" + "github.com/getprobo/probo/pkg/trust" "github.com/getprobo/probo/pkg/usrmgr" "github.com/prometheus/client_golang/prometheus" "go.gearno.de/kit/httpclient" @@ -226,22 +227,34 @@ func (impl *Implm) Run( impl.cfg.Auth.Cookie.Secret, agentConfig, html2pdfConverter, + usrmgrService, ) if err != nil { return fmt.Errorf("cannot create probo service: %w", err) } + trustService := trust.NewService( + pgClient, + s3Client, + impl.cfg.AWS.Bucket, + impl.cfg.EncryptionKey, + impl.cfg.Auth.Cookie.Secret, + usrmgrService, + html2pdfConverter, + ) + serverHandler, err := server.NewServer( server.Config{ AllowedOrigins: impl.cfg.Api.Cors.AllowedOrigins, ExtraHeaderFields: impl.cfg.Api.ExtraHeaderFields, Probo: proboService, Usrmgr: usrmgrService, + Trust: trustService, ConnectorRegistry: defaultConnectorRegistry, Agent: agent, SafeRedirect: &saferedirect.SafeRedirect{AllowedHost: impl.cfg.Hostname}, Logger: l.Named("http.server"), - Auth: console_v1.AuthConfig{ + Auth: api.AuthConfig{ CookieName: impl.cfg.Auth.Cookie.Name, CookieDomain: impl.cfg.Auth.Cookie.Domain, SessionDuration: time.Duration(impl.cfg.Auth.Cookie.Duration) * time.Hour, diff --git a/pkg/server/api/api.go b/pkg/server/api/api.go index 91b435ef7..6516ad099 100644 --- a/pkg/server/api/api.go +++ b/pkg/server/api/api.go @@ -18,10 +18,14 @@ import ( "errors" "net/http" + "time" + "github.com/getprobo/probo/pkg/connector" "github.com/getprobo/probo/pkg/probo" "github.com/getprobo/probo/pkg/saferedirect" console_v1 "github.com/getprobo/probo/pkg/server/api/console/v1" + trust_v1 "github.com/getprobo/probo/pkg/server/api/trust/v1" + "github.com/getprobo/probo/pkg/trust" "github.com/getprobo/probo/pkg/usrmgr" "github.com/go-chi/chi/v5" "github.com/go-chi/cors" @@ -30,11 +34,19 @@ import ( ) type ( + AuthConfig struct { + CookieName string + CookieDomain string + SessionDuration time.Duration + CookieSecret string + } + Config struct { AllowedOrigins []string Probo *probo.Service Usrmgr *usrmgr.Service - Auth console_v1.AuthConfig + Trust *trust.Service + Auth AuthConfig ConnectorRegistry *connector.ConnectorRegistry SafeRedirect *saferedirect.SafeRedirect Logger *log.Logger @@ -122,11 +134,32 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { s.cfg.Logger.Named("console.v1"), s.cfg.Probo, s.cfg.Usrmgr, - s.cfg.Auth, + console_v1.AuthConfig{ + CookieName: s.cfg.Auth.CookieName, + CookieDomain: s.cfg.Auth.CookieDomain, + SessionDuration: s.cfg.Auth.SessionDuration, + CookieSecret: s.cfg.Auth.CookieSecret, + }, s.cfg.ConnectorRegistry, s.cfg.SafeRedirect, ), ) + // Mount the trust API with authentication + router.Mount( + "/trust/v1", + trust_v1.NewMux( + s.cfg.Logger.Named("trust.v1"), + s.cfg.Usrmgr, + s.cfg.Trust, + trust_v1.AuthConfig{ + CookieName: s.cfg.Auth.CookieName, + CookieDomain: s.cfg.Auth.CookieDomain, + SessionDuration: s.cfg.Auth.SessionDuration, + CookieSecret: s.cfg.Auth.CookieSecret, + }, + ), + ) + router.ServeHTTP(w, r) } diff --git a/pkg/server/api/console/v1/schema.graphql b/pkg/server/api/console/v1/schema.graphql index b37d01fc8..165daf29f 100644 --- a/pkg/server/api/console/v1/schema.graphql +++ b/pkg/server/api/console/v1/schema.graphql @@ -566,6 +566,14 @@ enum AuditOrderField ) } +enum TrustCenterAccessOrderField + @goModel(model: "github.com/getprobo/probo/pkg/coredata.TrustCenterAccessOrderField") { + CREATED_AT + @goEnum( + value: "github.com/getprobo/probo/pkg/coredata.TrustCenterAccessOrderFieldCreatedAt" + ) +} + # Input Types input UserOrder @goModel( @@ -647,6 +655,14 @@ input AuditOrder field: AuditOrderField! } +input TrustCenterAccessOrder + @goModel( + model: "github.com/getprobo/probo/pkg/server/api/console/v1/types.TrustCenterAccessOrderBy" + ) { + direction: OrderDirection! + field: TrustCenterAccessOrderField! +} + input EvidenceOrder @goModel( model: "github.com/getprobo/probo/pkg/server/api/console/v1/types.EvidenceOrderBy" @@ -702,6 +718,14 @@ input RiskFilter { query: String } +input OrganizationFilter { + trustCenterSlug: String +} + +input TrustCenterFilter { + slug: String +} + # Core Types type TrustCenter implements Node { id: ID! @@ -709,6 +733,15 @@ type TrustCenter implements Node { slug: String! createdAt: Datetime! updatedAt: Datetime! + organization: Organization! @goField(forceResolver: true) + + accesses( + first: Int + after: CursorKey + last: Int + before: CursorKey + orderBy: TrustCenterAccessOrder + ): TrustCenterAccessConnection! @goField(forceResolver: true) } type Organization implements Node { @@ -1177,6 +1210,7 @@ type Viewer { last: Int before: CursorKey orderBy: OrganizationOrder + filter: OrganizationFilter ): OrganizationConnection! @goField(forceResolver: true) } @@ -1191,6 +1225,35 @@ type OrganizationEdge { node: Organization! } +type TrustCenterConnection { + edges: [TrustCenterEdge!]! + pageInfo: PageInfo! +} + +type TrustCenterEdge { + cursor: CursorKey! + node: TrustCenter! +} + +type TrustCenterAccess implements Node { + id: ID! + email: String! + name: String! + active: Boolean! + createdAt: Datetime! + updatedAt: Datetime! +} + +type TrustCenterAccessConnection { + edges: [TrustCenterAccessEdge!]! + pageInfo: PageInfo! +} + +type TrustCenterAccessEdge { + cursor: CursorKey! + node: TrustCenterAccess! +} + type UserConnection { edges: [UserEdge!]! pageInfo: PageInfo! @@ -1399,6 +1462,13 @@ type AuditEdge { type Query { node(id: ID!): Node! viewer: Viewer! + trustCenters( + first: Int + after: CursorKey + last: Int + before: CursorKey + filter: TrustCenterFilter + ): TrustCenterConnection! @goField(forceResolver: true) } type Mutation { @@ -1414,6 +1484,23 @@ type Mutation { input: UpdateTrustCenterInput! ): UpdateTrustCenterPayload! + revokeTrustCenterAccess( + input: RevokeTrustCenterAccessInput! + ): RevokeTrustCenterAccessPayload! + + # Trust Center Access CRUD mutations + createTrustCenterAccess( + input: CreateTrustCenterAccessInput! + ): CreateTrustCenterAccessPayload! + + updateTrustCenterAccess( + input: UpdateTrustCenterAccessInput! + ): UpdateTrustCenterAccessPayload! + + deleteTrustCenterAccess( + input: DeleteTrustCenterAccessInput! + ): DeleteTrustCenterAccessPayload! + # User mutations confirmEmail(input: ConfirmEmailInput!): ConfirmEmailPayload! inviteUser(input: InviteUserInput!): InviteUserPayload! @@ -1586,6 +1673,29 @@ input UpdateTrustCenterInput { slug: String } +input RevokeTrustCenterAccessInput { + accessId: ID! +} + +input CreateTrustCenterAccessInput { + trustCenterId: ID! + email: String! + name: String! + sendEmail: Boolean! = true +} + +input UpdateTrustCenterAccessInput { + accessId: ID! + email: String + name: String + active: Boolean + sendEmail: Boolean! = false +} + +input DeleteTrustCenterAccessInput { + accessId: ID! +} + input CreateVendorInput { organizationId: ID! name: String! @@ -1951,6 +2061,24 @@ type UpdateTrustCenterPayload { trustCenter: TrustCenter! } + + +type RevokeTrustCenterAccessPayload { + trustCenterAccess: TrustCenterAccess! +} + +type CreateTrustCenterAccessPayload { + trustCenterAccessEdge: TrustCenterAccessEdge! +} + +type UpdateTrustCenterAccessPayload { + trustCenterAccess: TrustCenterAccess! +} + +type DeleteTrustCenterAccessPayload { + deletedTrustCenterAccessId: ID! +} + type CreateControlPayload { controlEdge: ControlEdge! } diff --git a/pkg/server/api/console/v1/schema/schema.go b/pkg/server/api/console/v1/schema/schema.go index 7b350327a..97fc896df 100644 --- a/pkg/server/api/console/v1/schema/schema.go +++ b/pkg/server/api/console/v1/schema/schema.go @@ -69,6 +69,7 @@ type ResolverRoot interface { RiskConnection() RiskConnectionResolver Task() TaskResolver TaskConnection() TaskConnectionResolver + TrustCenter() TrustCenterResolver User() UserResolver Vendor() VendorResolver VendorComplianceReport() VendorComplianceReportResolver @@ -272,6 +273,10 @@ type ComplexityRoot struct { TaskEdge func(childComplexity int) int } + CreateTrustCenterAccessPayload struct { + TrustCenterAccessEdge func(childComplexity int) int + } + CreateVendorPayload struct { VendorEdge func(childComplexity int) int } @@ -370,6 +375,10 @@ type ComplexityRoot struct { DeletedTaskID func(childComplexity int) int } + DeleteTrustCenterAccessPayload struct { + DeletedTrustCenterAccessID func(childComplexity int) int + } + DeleteVendorComplianceReportPayload struct { DeletedVendorComplianceReportID func(childComplexity int) int } @@ -576,6 +585,7 @@ type ComplexityRoot struct { CreateRiskDocumentMapping func(childComplexity int, input types.CreateRiskDocumentMappingInput) int CreateRiskMeasureMapping func(childComplexity int, input types.CreateRiskMeasureMappingInput) int CreateTask func(childComplexity int, input types.CreateTaskInput) int + CreateTrustCenterAccess func(childComplexity int, input types.CreateTrustCenterAccessInput) int CreateVendor func(childComplexity int, input types.CreateVendorInput) int CreateVendorRiskAssessment func(childComplexity int, input types.CreateVendorRiskAssessmentInput) int DeleteAsset func(childComplexity int, input types.DeleteAssetInput) int @@ -594,6 +604,7 @@ type ComplexityRoot struct { DeleteRiskDocumentMapping func(childComplexity int, input types.DeleteRiskDocumentMappingInput) int DeleteRiskMeasureMapping func(childComplexity int, input types.DeleteRiskMeasureMappingInput) int DeleteTask func(childComplexity int, input types.DeleteTaskInput) int + DeleteTrustCenterAccess func(childComplexity int, input types.DeleteTrustCenterAccessInput) int DeleteVendor func(childComplexity int, input types.DeleteVendorInput) int DeleteVendorComplianceReport func(childComplexity int, input types.DeleteVendorComplianceReportInput) int ExportDocumentVersionPDF func(childComplexity int, input types.ExportDocumentVersionPDFInput) int @@ -607,6 +618,7 @@ type ComplexityRoot struct { RemoveUser func(childComplexity int, input types.RemoveUserInput) int RequestEvidence func(childComplexity int, input types.RequestEvidenceInput) int RequestSignature func(childComplexity int, input types.RequestSignatureInput) int + RevokeTrustCenterAccess func(childComplexity int, input types.RevokeTrustCenterAccessInput) int SendSigningNotifications func(childComplexity int, input types.SendSigningNotificationsInput) int UnassignTask func(childComplexity int, input types.UnassignTaskInput) int UpdateAsset func(childComplexity int, input types.UpdateAssetInput) int @@ -622,6 +634,7 @@ type ComplexityRoot struct { UpdateRisk func(childComplexity int, input types.UpdateRiskInput) int UpdateTask func(childComplexity int, input types.UpdateTaskInput) int UpdateTrustCenter func(childComplexity int, input types.UpdateTrustCenterInput) int + UpdateTrustCenterAccess func(childComplexity int, input types.UpdateTrustCenterAccessInput) int UpdateVendor func(childComplexity int, input types.UpdateVendorInput) int UploadAuditReport func(childComplexity int, input types.UploadAuditReportInput) int UploadMeasureEvidence func(childComplexity int, input types.UploadMeasureEvidenceInput) int @@ -698,8 +711,9 @@ type ComplexityRoot struct { } Query struct { - Node func(childComplexity int, id gid.GID) int - Viewer func(childComplexity int) int + Node func(childComplexity int, id gid.GID) int + TrustCenters func(childComplexity int, first *int, after *page.CursorKey, last *int, before *page.CursorKey, filter *types.TrustCenterFilter) int + Viewer func(childComplexity int) int } RemoveUserPayload struct { @@ -725,6 +739,10 @@ type ComplexityRoot struct { DocumentVersionSignatureEdge func(childComplexity int) int } + RevokeTrustCenterAccessPayload struct { + TrustCenterAccess 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, filter *types.ControlFilter) int @@ -794,13 +812,44 @@ type ComplexityRoot struct { } TrustCenter struct { + Accesses func(childComplexity int, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.OrderBy[coredata.TrustCenterAccessOrderField]) int + Active func(childComplexity int) int + CreatedAt func(childComplexity int) int + ID func(childComplexity int) int + Organization func(childComplexity int) int + Slug func(childComplexity int) int + UpdatedAt func(childComplexity int) int + } + + TrustCenterAccess struct { Active func(childComplexity int) int CreatedAt func(childComplexity int) int + Email func(childComplexity int) int ID func(childComplexity int) int - Slug func(childComplexity int) int + Name func(childComplexity int) int UpdatedAt func(childComplexity int) int } + TrustCenterAccessConnection struct { + Edges func(childComplexity int) int + PageInfo func(childComplexity int) int + } + + TrustCenterAccessEdge struct { + Cursor func(childComplexity int) int + Node func(childComplexity int) int + } + + TrustCenterConnection struct { + Edges func(childComplexity int) int + PageInfo func(childComplexity int) int + } + + TrustCenterEdge struct { + Cursor func(childComplexity int) int + Node func(childComplexity int) int + } + UnassignTaskPayload struct { Task func(childComplexity int) int } @@ -853,6 +902,10 @@ type ComplexityRoot struct { Task func(childComplexity int) int } + UpdateTrustCenterAccessPayload struct { + TrustCenterAccess func(childComplexity int) int + } + UpdateTrustCenterPayload struct { TrustCenter func(childComplexity int) int } @@ -982,7 +1035,7 @@ type ComplexityRoot struct { Viewer struct { ID func(childComplexity int) int - Organizations func(childComplexity int, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.OrganizationOrder) int + Organizations func(childComplexity int, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.OrganizationOrder, filter *types.OrganizationFilter) int User func(childComplexity int) int } } @@ -1076,6 +1129,10 @@ type MutationResolver interface { CreateOrganization(ctx context.Context, input types.CreateOrganizationInput) (*types.CreateOrganizationPayload, error) UpdateOrganization(ctx context.Context, input types.UpdateOrganizationInput) (*types.UpdateOrganizationPayload, error) UpdateTrustCenter(ctx context.Context, input types.UpdateTrustCenterInput) (*types.UpdateTrustCenterPayload, error) + RevokeTrustCenterAccess(ctx context.Context, input types.RevokeTrustCenterAccessInput) (*types.RevokeTrustCenterAccessPayload, error) + CreateTrustCenterAccess(ctx context.Context, input types.CreateTrustCenterAccessInput) (*types.CreateTrustCenterAccessPayload, error) + UpdateTrustCenterAccess(ctx context.Context, input types.UpdateTrustCenterAccessInput) (*types.UpdateTrustCenterAccessPayload, error) + DeleteTrustCenterAccess(ctx context.Context, input types.DeleteTrustCenterAccessInput) (*types.DeleteTrustCenterAccessPayload, error) ConfirmEmail(ctx context.Context, input types.ConfirmEmailInput) (*types.ConfirmEmailPayload, error) InviteUser(ctx context.Context, input types.InviteUserInput) (*types.InviteUserPayload, error) RemoveUser(ctx context.Context, input types.RemoveUserInput) (*types.RemoveUserPayload, error) @@ -1170,6 +1227,7 @@ type PeopleConnectionResolver interface { type QueryResolver interface { Node(ctx context.Context, id gid.GID) (types.Node, error) Viewer(ctx context.Context) (*types.Viewer, error) + TrustCenters(ctx context.Context, first *int, after *page.CursorKey, last *int, before *page.CursorKey, filter *types.TrustCenterFilter) (*types.TrustCenterConnection, error) } type ReportResolver interface { DownloadURL(ctx context.Context, obj *types.Report) (*string, error) @@ -1193,6 +1251,10 @@ type TaskResolver interface { type TaskConnectionResolver interface { TotalCount(ctx context.Context, obj *types.TaskConnection) (int, error) } +type TrustCenterResolver interface { + Organization(ctx context.Context, obj *types.TrustCenter) (*types.Organization, error) + Accesses(ctx context.Context, obj *types.TrustCenter, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.OrderBy[coredata.TrustCenterAccessOrderField]) (*types.TrustCenterAccessConnection, error) +} type UserResolver interface { People(ctx context.Context, obj *types.User, organizationID gid.GID) (*types.People, error) } @@ -1217,7 +1279,7 @@ type VendorRiskAssessmentResolver interface { AssessedBy(ctx context.Context, obj *types.VendorRiskAssessment) (*types.People, error) } type ViewerResolver interface { - Organizations(ctx context.Context, obj *types.Viewer, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.OrganizationOrder) (*types.OrganizationConnection, error) + Organizations(ctx context.Context, obj *types.Viewer, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.OrganizationOrder, filter *types.OrganizationFilter) (*types.OrganizationConnection, error) } type executableSchema struct { @@ -1856,6 +1918,13 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.complexity.CreateTaskPayload.TaskEdge(childComplexity), true + case "CreateTrustCenterAccessPayload.trustCenterAccessEdge": + if e.complexity.CreateTrustCenterAccessPayload.TrustCenterAccessEdge == nil { + break + } + + return e.complexity.CreateTrustCenterAccessPayload.TrustCenterAccessEdge(childComplexity), true + case "CreateVendorPayload.vendorEdge": if e.complexity.CreateVendorPayload.VendorEdge == nil { break @@ -2106,6 +2175,13 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.complexity.DeleteTaskPayload.DeletedTaskID(childComplexity), true + case "DeleteTrustCenterAccessPayload.deletedTrustCenterAccessId": + if e.complexity.DeleteTrustCenterAccessPayload.DeletedTrustCenterAccessID == nil { + break + } + + return e.complexity.DeleteTrustCenterAccessPayload.DeletedTrustCenterAccessID(childComplexity), true + case "DeleteVendorComplianceReportPayload.deletedVendorComplianceReportId": if e.complexity.DeleteVendorComplianceReportPayload.DeletedVendorComplianceReportID == nil { break @@ -3124,6 +3200,18 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.complexity.Mutation.CreateTask(childComplexity, args["input"].(types.CreateTaskInput)), true + case "Mutation.createTrustCenterAccess": + if e.complexity.Mutation.CreateTrustCenterAccess == nil { + break + } + + args, err := ec.field_Mutation_createTrustCenterAccess_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.CreateTrustCenterAccess(childComplexity, args["input"].(types.CreateTrustCenterAccessInput)), true + case "Mutation.createVendor": if e.complexity.Mutation.CreateVendor == nil { break @@ -3340,6 +3428,18 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.complexity.Mutation.DeleteTask(childComplexity, args["input"].(types.DeleteTaskInput)), true + case "Mutation.deleteTrustCenterAccess": + if e.complexity.Mutation.DeleteTrustCenterAccess == nil { + break + } + + args, err := ec.field_Mutation_deleteTrustCenterAccess_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.DeleteTrustCenterAccess(childComplexity, args["input"].(types.DeleteTrustCenterAccessInput)), true + case "Mutation.deleteVendor": if e.complexity.Mutation.DeleteVendor == nil { break @@ -3496,6 +3596,18 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.complexity.Mutation.RequestSignature(childComplexity, args["input"].(types.RequestSignatureInput)), true + case "Mutation.revokeTrustCenterAccess": + if e.complexity.Mutation.RevokeTrustCenterAccess == nil { + break + } + + args, err := ec.field_Mutation_revokeTrustCenterAccess_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.RevokeTrustCenterAccess(childComplexity, args["input"].(types.RevokeTrustCenterAccessInput)), true + case "Mutation.sendSigningNotifications": if e.complexity.Mutation.SendSigningNotifications == nil { break @@ -3676,6 +3788,18 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.complexity.Mutation.UpdateTrustCenter(childComplexity, args["input"].(types.UpdateTrustCenterInput)), true + case "Mutation.updateTrustCenterAccess": + if e.complexity.Mutation.UpdateTrustCenterAccess == nil { + break + } + + args, err := ec.field_Mutation_updateTrustCenterAccess_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.UpdateTrustCenterAccess(childComplexity, args["input"].(types.UpdateTrustCenterAccessInput)), true + case "Mutation.updateVendor": if e.complexity.Mutation.UpdateVendor == nil { break @@ -4121,6 +4245,18 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.complexity.Query.Node(childComplexity, args["id"].(gid.GID)), true + case "Query.trustCenters": + if e.complexity.Query.TrustCenters == nil { + break + } + + args, err := ec.field_Query_trustCenters_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.TrustCenters(childComplexity, args["first"].(*int), args["after"].(*page.CursorKey), args["last"].(*int), args["before"].(*page.CursorKey), args["filter"].(*types.TrustCenterFilter)), true + case "Query.viewer": if e.complexity.Query.Viewer == nil { break @@ -4205,6 +4341,13 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.complexity.RequestSignaturePayload.DocumentVersionSignatureEdge(childComplexity), true + case "RevokeTrustCenterAccessPayload.trustCenterAccess": + if e.complexity.RevokeTrustCenterAccessPayload.TrustCenterAccess == nil { + break + } + + return e.complexity.RevokeTrustCenterAccessPayload.TrustCenterAccess(childComplexity), true + case "Risk.category": if e.complexity.Risk.Category == nil { break @@ -4533,6 +4676,18 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.complexity.TaskEdge.Node(childComplexity), true + case "TrustCenter.accesses": + if e.complexity.TrustCenter.Accesses == nil { + break + } + + args, err := ec.field_TrustCenter_accesses_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.TrustCenter.Accesses(childComplexity, args["first"].(*int), args["after"].(*page.CursorKey), args["last"].(*int), args["before"].(*page.CursorKey), args["orderBy"].(*types.OrderBy[coredata.TrustCenterAccessOrderField])), true + case "TrustCenter.active": if e.complexity.TrustCenter.Active == nil { break @@ -4554,6 +4709,13 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.complexity.TrustCenter.ID(childComplexity), true + case "TrustCenter.organization": + if e.complexity.TrustCenter.Organization == nil { + break + } + + return e.complexity.TrustCenter.Organization(childComplexity), true + case "TrustCenter.slug": if e.complexity.TrustCenter.Slug == nil { break @@ -4568,6 +4730,104 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.complexity.TrustCenter.UpdatedAt(childComplexity), true + case "TrustCenterAccess.active": + if e.complexity.TrustCenterAccess.Active == nil { + break + } + + return e.complexity.TrustCenterAccess.Active(childComplexity), true + + case "TrustCenterAccess.createdAt": + if e.complexity.TrustCenterAccess.CreatedAt == nil { + break + } + + return e.complexity.TrustCenterAccess.CreatedAt(childComplexity), true + + case "TrustCenterAccess.email": + if e.complexity.TrustCenterAccess.Email == nil { + break + } + + return e.complexity.TrustCenterAccess.Email(childComplexity), true + + case "TrustCenterAccess.id": + if e.complexity.TrustCenterAccess.ID == nil { + break + } + + return e.complexity.TrustCenterAccess.ID(childComplexity), true + + case "TrustCenterAccess.name": + if e.complexity.TrustCenterAccess.Name == nil { + break + } + + return e.complexity.TrustCenterAccess.Name(childComplexity), true + + case "TrustCenterAccess.updatedAt": + if e.complexity.TrustCenterAccess.UpdatedAt == nil { + break + } + + return e.complexity.TrustCenterAccess.UpdatedAt(childComplexity), true + + case "TrustCenterAccessConnection.edges": + if e.complexity.TrustCenterAccessConnection.Edges == nil { + break + } + + return e.complexity.TrustCenterAccessConnection.Edges(childComplexity), true + + case "TrustCenterAccessConnection.pageInfo": + if e.complexity.TrustCenterAccessConnection.PageInfo == nil { + break + } + + return e.complexity.TrustCenterAccessConnection.PageInfo(childComplexity), true + + case "TrustCenterAccessEdge.cursor": + if e.complexity.TrustCenterAccessEdge.Cursor == nil { + break + } + + return e.complexity.TrustCenterAccessEdge.Cursor(childComplexity), true + + case "TrustCenterAccessEdge.node": + if e.complexity.TrustCenterAccessEdge.Node == nil { + break + } + + return e.complexity.TrustCenterAccessEdge.Node(childComplexity), true + + case "TrustCenterConnection.edges": + if e.complexity.TrustCenterConnection.Edges == nil { + break + } + + return e.complexity.TrustCenterConnection.Edges(childComplexity), true + + case "TrustCenterConnection.pageInfo": + if e.complexity.TrustCenterConnection.PageInfo == nil { + break + } + + return e.complexity.TrustCenterConnection.PageInfo(childComplexity), true + + case "TrustCenterEdge.cursor": + if e.complexity.TrustCenterEdge.Cursor == nil { + break + } + + return e.complexity.TrustCenterEdge.Cursor(childComplexity), true + + case "TrustCenterEdge.node": + if e.complexity.TrustCenterEdge.Node == nil { + break + } + + return e.complexity.TrustCenterEdge.Node(childComplexity), true + case "UnassignTaskPayload.task": if e.complexity.UnassignTaskPayload.Task == nil { break @@ -4659,6 +4919,13 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.complexity.UpdateTaskPayload.Task(childComplexity), true + case "UpdateTrustCenterAccessPayload.trustCenterAccess": + if e.complexity.UpdateTrustCenterAccessPayload.TrustCenterAccess == nil { + break + } + + return e.complexity.UpdateTrustCenterAccessPayload.TrustCenterAccess(childComplexity), true + case "UpdateTrustCenterPayload.trustCenter": if e.complexity.UpdateTrustCenterPayload.TrustCenter == nil { break @@ -5202,7 +5469,7 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return 0, false } - return e.complexity.Viewer.Organizations(childComplexity, args["first"].(*int), args["after"].(*page.CursorKey), args["last"].(*int), args["before"].(*page.CursorKey), args["orderBy"].(*types.OrganizationOrder)), true + return e.complexity.Viewer.Organizations(childComplexity, args["first"].(*int), args["after"].(*page.CursorKey), args["last"].(*int), args["before"].(*page.CursorKey), args["orderBy"].(*types.OrganizationOrder), args["filter"].(*types.OrganizationFilter)), true case "Viewer.user": if e.complexity.Viewer.User == nil { @@ -5247,6 +5514,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { ec.unmarshalInputCreateRiskInput, ec.unmarshalInputCreateRiskMeasureMappingInput, ec.unmarshalInputCreateTaskInput, + ec.unmarshalInputCreateTrustCenterAccessInput, ec.unmarshalInputCreateVendorInput, ec.unmarshalInputCreateVendorRiskAssessmentInput, ec.unmarshalInputDatumOrder, @@ -5266,6 +5534,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { ec.unmarshalInputDeleteRiskInput, ec.unmarshalInputDeleteRiskMeasureMappingInput, ec.unmarshalInputDeleteTaskInput, + ec.unmarshalInputDeleteTrustCenterAccessInput, ec.unmarshalInputDeleteVendorComplianceReportInput, ec.unmarshalInputDeleteVendorInput, ec.unmarshalInputDocumentFilter, @@ -5284,16 +5553,20 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { ec.unmarshalInputInviteUserInput, ec.unmarshalInputMeasureFilter, ec.unmarshalInputMeasureOrder, + ec.unmarshalInputOrganizationFilter, ec.unmarshalInputOrganizationOrder, ec.unmarshalInputPeopleOrder, ec.unmarshalInputPublishDocumentVersionInput, ec.unmarshalInputRemoveUserInput, ec.unmarshalInputRequestEvidenceInput, ec.unmarshalInputRequestSignatureInput, + ec.unmarshalInputRevokeTrustCenterAccessInput, ec.unmarshalInputRiskFilter, ec.unmarshalInputRiskOrder, ec.unmarshalInputSendSigningNotificationsInput, ec.unmarshalInputTaskOrder, + ec.unmarshalInputTrustCenterAccessOrder, + ec.unmarshalInputTrustCenterFilter, ec.unmarshalInputUnassignTaskInput, ec.unmarshalInputUpdateAssetInput, ec.unmarshalInputUpdateAuditInput, @@ -5307,6 +5580,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { ec.unmarshalInputUpdatePeopleInput, ec.unmarshalInputUpdateRiskInput, ec.unmarshalInputUpdateTaskInput, + ec.unmarshalInputUpdateTrustCenterAccessInput, ec.unmarshalInputUpdateTrustCenterInput, ec.unmarshalInputUpdateVendorInput, ec.unmarshalInputUploadAuditReportInput, @@ -5982,6 +6256,14 @@ enum AuditOrderField ) } +enum TrustCenterAccessOrderField + @goModel(model: "github.com/getprobo/probo/pkg/coredata.TrustCenterAccessOrderField") { + CREATED_AT + @goEnum( + value: "github.com/getprobo/probo/pkg/coredata.TrustCenterAccessOrderFieldCreatedAt" + ) +} + # Input Types input UserOrder @goModel( @@ -6063,6 +6345,14 @@ input AuditOrder field: AuditOrderField! } +input TrustCenterAccessOrder + @goModel( + model: "github.com/getprobo/probo/pkg/server/api/console/v1/types.TrustCenterAccessOrderBy" + ) { + direction: OrderDirection! + field: TrustCenterAccessOrderField! +} + input EvidenceOrder @goModel( model: "github.com/getprobo/probo/pkg/server/api/console/v1/types.EvidenceOrderBy" @@ -6118,6 +6408,14 @@ input RiskFilter { query: String } +input OrganizationFilter { + trustCenterSlug: String +} + +input TrustCenterFilter { + slug: String +} + # Core Types type TrustCenter implements Node { id: ID! @@ -6125,6 +6423,15 @@ type TrustCenter implements Node { slug: String! createdAt: Datetime! updatedAt: Datetime! + organization: Organization! @goField(forceResolver: true) + + accesses( + first: Int + after: CursorKey + last: Int + before: CursorKey + orderBy: TrustCenterAccessOrder + ): TrustCenterAccessConnection! @goField(forceResolver: true) } type Organization implements Node { @@ -6593,6 +6900,7 @@ type Viewer { last: Int before: CursorKey orderBy: OrganizationOrder + filter: OrganizationFilter ): OrganizationConnection! @goField(forceResolver: true) } @@ -6607,6 +6915,35 @@ type OrganizationEdge { node: Organization! } +type TrustCenterConnection { + edges: [TrustCenterEdge!]! + pageInfo: PageInfo! +} + +type TrustCenterEdge { + cursor: CursorKey! + node: TrustCenter! +} + +type TrustCenterAccess implements Node { + id: ID! + email: String! + name: String! + active: Boolean! + createdAt: Datetime! + updatedAt: Datetime! +} + +type TrustCenterAccessConnection { + edges: [TrustCenterAccessEdge!]! + pageInfo: PageInfo! +} + +type TrustCenterAccessEdge { + cursor: CursorKey! + node: TrustCenterAccess! +} + type UserConnection { edges: [UserEdge!]! pageInfo: PageInfo! @@ -6815,6 +7152,13 @@ type AuditEdge { type Query { node(id: ID!): Node! viewer: Viewer! + trustCenters( + first: Int + after: CursorKey + last: Int + before: CursorKey + filter: TrustCenterFilter + ): TrustCenterConnection! @goField(forceResolver: true) } type Mutation { @@ -6830,6 +7174,24 @@ type Mutation { input: UpdateTrustCenterInput! ): UpdateTrustCenterPayload! + + revokeTrustCenterAccess( + input: RevokeTrustCenterAccessInput! + ): RevokeTrustCenterAccessPayload! + + # Trust Center Access CRUD mutations + createTrustCenterAccess( + input: CreateTrustCenterAccessInput! + ): CreateTrustCenterAccessPayload! + + updateTrustCenterAccess( + input: UpdateTrustCenterAccessInput! + ): UpdateTrustCenterAccessPayload! + + deleteTrustCenterAccess( + input: DeleteTrustCenterAccessInput! + ): DeleteTrustCenterAccessPayload! + # User mutations confirmEmail(input: ConfirmEmailInput!): ConfirmEmailPayload! inviteUser(input: InviteUserInput!): InviteUserPayload! @@ -7002,6 +7364,31 @@ input UpdateTrustCenterInput { slug: String } + + +input RevokeTrustCenterAccessInput { + accessId: ID! +} + +input CreateTrustCenterAccessInput { + trustCenterId: ID! + email: String! + name: String! + sendEmail: Boolean! = true +} + +input UpdateTrustCenterAccessInput { + accessId: ID! + email: String + name: String + active: Boolean + sendEmail: Boolean! = false +} + +input DeleteTrustCenterAccessInput { + accessId: ID! +} + input CreateVendorInput { organizationId: ID! name: String! @@ -7367,6 +7754,24 @@ type UpdateTrustCenterPayload { trustCenter: TrustCenter! } + + +type RevokeTrustCenterAccessPayload { + trustCenterAccess: TrustCenterAccess! +} + +type CreateTrustCenterAccessPayload { + trustCenterAccessEdge: TrustCenterAccessEdge! +} + +type UpdateTrustCenterAccessPayload { + trustCenterAccess: TrustCenterAccess! +} + +type DeleteTrustCenterAccessPayload { + deletedTrustCenterAccessId: ID! +} + type CreateControlPayload { controlEdge: ControlEdge! } @@ -9734,6 +10139,29 @@ func (ec *executionContext) field_Mutation_createTask_argsInput( return zeroVal, nil } +func (ec *executionContext) field_Mutation_createTrustCenterAccess_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := ec.field_Mutation_createTrustCenterAccess_argsInput(ctx, rawArgs) + if err != nil { + return nil, err + } + args["input"] = arg0 + return args, nil +} +func (ec *executionContext) field_Mutation_createTrustCenterAccess_argsInput( + ctx context.Context, + rawArgs map[string]any, +) (types.CreateTrustCenterAccessInput, error) { + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) + if tmp, ok := rawArgs["input"]; ok { + return ec.unmarshalNCreateTrustCenterAccessInput2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐCreateTrustCenterAccessInput(ctx, tmp) + } + + var zeroVal types.CreateTrustCenterAccessInput + return zeroVal, nil +} + func (ec *executionContext) field_Mutation_createVendorRiskAssessment_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} @@ -10148,6 +10576,29 @@ func (ec *executionContext) field_Mutation_deleteTask_argsInput( return zeroVal, nil } +func (ec *executionContext) field_Mutation_deleteTrustCenterAccess_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := ec.field_Mutation_deleteTrustCenterAccess_argsInput(ctx, rawArgs) + if err != nil { + return nil, err + } + args["input"] = arg0 + return args, nil +} +func (ec *executionContext) field_Mutation_deleteTrustCenterAccess_argsInput( + ctx context.Context, + rawArgs map[string]any, +) (types.DeleteTrustCenterAccessInput, error) { + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) + if tmp, ok := rawArgs["input"]; ok { + return ec.unmarshalNDeleteTrustCenterAccessInput2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐDeleteTrustCenterAccessInput(ctx, tmp) + } + + var zeroVal types.DeleteTrustCenterAccessInput + return zeroVal, nil +} + func (ec *executionContext) field_Mutation_deleteVendorComplianceReport_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} @@ -10447,6 +10898,29 @@ func (ec *executionContext) field_Mutation_requestSignature_argsInput( return zeroVal, nil } +func (ec *executionContext) field_Mutation_revokeTrustCenterAccess_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := ec.field_Mutation_revokeTrustCenterAccess_argsInput(ctx, rawArgs) + if err != nil { + return nil, err + } + args["input"] = arg0 + return args, nil +} +func (ec *executionContext) field_Mutation_revokeTrustCenterAccess_argsInput( + ctx context.Context, + rawArgs map[string]any, +) (types.RevokeTrustCenterAccessInput, error) { + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) + if tmp, ok := rawArgs["input"]; ok { + return ec.unmarshalNRevokeTrustCenterAccessInput2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐRevokeTrustCenterAccessInput(ctx, tmp) + } + + var zeroVal types.RevokeTrustCenterAccessInput + return zeroVal, nil +} + func (ec *executionContext) field_Mutation_sendSigningNotifications_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} @@ -10769,6 +11243,29 @@ func (ec *executionContext) field_Mutation_updateTask_argsInput( return zeroVal, nil } +func (ec *executionContext) field_Mutation_updateTrustCenterAccess_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := ec.field_Mutation_updateTrustCenterAccess_argsInput(ctx, rawArgs) + if err != nil { + return nil, err + } + args["input"] = arg0 + return args, nil +} +func (ec *executionContext) field_Mutation_updateTrustCenterAccess_argsInput( + ctx context.Context, + rawArgs map[string]any, +) (types.UpdateTrustCenterAccessInput, error) { + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) + if tmp, ok := rawArgs["input"]; ok { + return ec.unmarshalNUpdateTrustCenterAccessInput2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐUpdateTrustCenterAccessInput(ctx, tmp) + } + + var zeroVal types.UpdateTrustCenterAccessInput + return zeroVal, nil +} + func (ec *executionContext) field_Mutation_updateTrustCenter_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} @@ -12260,6 +12757,101 @@ func (ec *executionContext) field_Query_node_argsID( return zeroVal, nil } +func (ec *executionContext) field_Query_trustCenters_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := ec.field_Query_trustCenters_argsFirst(ctx, rawArgs) + if err != nil { + return nil, err + } + args["first"] = arg0 + arg1, err := ec.field_Query_trustCenters_argsAfter(ctx, rawArgs) + if err != nil { + return nil, err + } + args["after"] = arg1 + arg2, err := ec.field_Query_trustCenters_argsLast(ctx, rawArgs) + if err != nil { + return nil, err + } + args["last"] = arg2 + arg3, err := ec.field_Query_trustCenters_argsBefore(ctx, rawArgs) + if err != nil { + return nil, err + } + args["before"] = arg3 + arg4, err := ec.field_Query_trustCenters_argsFilter(ctx, rawArgs) + if err != nil { + return nil, err + } + args["filter"] = arg4 + return args, nil +} +func (ec *executionContext) field_Query_trustCenters_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_Query_trustCenters_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_Query_trustCenters_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_Query_trustCenters_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_Query_trustCenters_argsFilter( + ctx context.Context, + rawArgs map[string]any, +) (*types.TrustCenterFilter, error) { + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("filter")) + if tmp, ok := rawArgs["filter"]; ok { + return ec.unmarshalOTrustCenterFilter2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐTrustCenterFilter(ctx, tmp) + } + + var zeroVal *types.TrustCenterFilter + return zeroVal, nil +} + func (ec *executionContext) field_Risk_controls_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} @@ -12694,6 +13286,101 @@ func (ec *executionContext) field_Task_evidences_argsOrderBy( return zeroVal, nil } +func (ec *executionContext) field_TrustCenter_accesses_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := ec.field_TrustCenter_accesses_argsFirst(ctx, rawArgs) + if err != nil { + return nil, err + } + args["first"] = arg0 + arg1, err := ec.field_TrustCenter_accesses_argsAfter(ctx, rawArgs) + if err != nil { + return nil, err + } + args["after"] = arg1 + arg2, err := ec.field_TrustCenter_accesses_argsLast(ctx, rawArgs) + if err != nil { + return nil, err + } + args["last"] = arg2 + arg3, err := ec.field_TrustCenter_accesses_argsBefore(ctx, rawArgs) + if err != nil { + return nil, err + } + args["before"] = arg3 + arg4, err := ec.field_TrustCenter_accesses_argsOrderBy(ctx, rawArgs) + if err != nil { + return nil, err + } + args["orderBy"] = arg4 + return args, nil +} +func (ec *executionContext) field_TrustCenter_accesses_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_TrustCenter_accesses_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_TrustCenter_accesses_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_TrustCenter_accesses_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_TrustCenter_accesses_argsOrderBy( + ctx context.Context, + rawArgs map[string]any, +) (*types.OrderBy[coredata.TrustCenterAccessOrderField], error) { + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("orderBy")) + if tmp, ok := rawArgs["orderBy"]; ok { + return ec.unmarshalOTrustCenterAccessOrder2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐOrderBy(ctx, tmp) + } + + var zeroVal *types.OrderBy[coredata.TrustCenterAccessOrderField] + return zeroVal, nil +} + func (ec *executionContext) field_User_people_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} @@ -12935,6 +13622,11 @@ func (ec *executionContext) field_Viewer_organizations_args(ctx context.Context, return nil, err } args["orderBy"] = arg4 + arg5, err := ec.field_Viewer_organizations_argsFilter(ctx, rawArgs) + if err != nil { + return nil, err + } + args["filter"] = arg5 return args, nil } func (ec *executionContext) field_Viewer_organizations_argsFirst( @@ -13002,6 +13694,19 @@ func (ec *executionContext) field_Viewer_organizations_argsOrderBy( return zeroVal, nil } +func (ec *executionContext) field_Viewer_organizations_argsFilter( + ctx context.Context, + rawArgs map[string]any, +) (*types.OrganizationFilter, error) { + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("filter")) + if tmp, ok := rawArgs["filter"]; ok { + return ec.unmarshalOOrganizationFilter2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐOrganizationFilter(ctx, tmp) + } + + var zeroVal *types.OrganizationFilter + return zeroVal, nil +} + func (ec *executionContext) field___Directive_args_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} @@ -17456,6 +18161,56 @@ func (ec *executionContext) fieldContext_CreateTaskPayload_taskEdge(_ context.Co return fc, nil } +func (ec *executionContext) _CreateTrustCenterAccessPayload_trustCenterAccessEdge(ctx context.Context, field graphql.CollectedField, obj *types.CreateTrustCenterAccessPayload) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_CreateTrustCenterAccessPayload_trustCenterAccessEdge(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.TrustCenterAccessEdge, 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.TrustCenterAccessEdge) + fc.Result = res + return ec.marshalNTrustCenterAccessEdge2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐTrustCenterAccessEdge(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_CreateTrustCenterAccessPayload_trustCenterAccessEdge(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "CreateTrustCenterAccessPayload", + 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_TrustCenterAccessEdge_cursor(ctx, field) + case "node": + return ec.fieldContext_TrustCenterAccessEdge_node(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TrustCenterAccessEdge", field.Name) + }, + } + return fc, nil +} + func (ec *executionContext) _CreateVendorPayload_vendorEdge(ctx context.Context, field graphql.CollectedField, obj *types.CreateVendorPayload) (ret graphql.Marshaler) { fc, err := ec.fieldContext_CreateVendorPayload_vendorEdge(ctx, field) if err != nil { @@ -19147,6 +19902,50 @@ func (ec *executionContext) fieldContext_DeleteTaskPayload_deletedTaskId(_ conte return fc, nil } +func (ec *executionContext) _DeleteTrustCenterAccessPayload_deletedTrustCenterAccessId(ctx context.Context, field graphql.CollectedField, obj *types.DeleteTrustCenterAccessPayload) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_DeleteTrustCenterAccessPayload_deletedTrustCenterAccessId(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.DeletedTrustCenterAccessID, 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_DeleteTrustCenterAccessPayload_deletedTrustCenterAccessId(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "DeleteTrustCenterAccessPayload", + 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) _DeleteVendorComplianceReportPayload_deletedVendorComplianceReportId(ctx context.Context, field graphql.CollectedField, obj *types.DeleteVendorComplianceReportPayload) (ret graphql.Marshaler) { fc, err := ec.fieldContext_DeleteVendorComplianceReportPayload_deletedVendorComplianceReportId(ctx, field) if err != nil { @@ -24489,6 +25288,242 @@ func (ec *executionContext) fieldContext_Mutation_updateTrustCenter(ctx context. return fc, nil } +func (ec *executionContext) _Mutation_revokeTrustCenterAccess(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_revokeTrustCenterAccess(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().RevokeTrustCenterAccess(rctx, fc.Args["input"].(types.RevokeTrustCenterAccessInput)) + }) + 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.RevokeTrustCenterAccessPayload) + fc.Result = res + return ec.marshalNRevokeTrustCenterAccessPayload2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐRevokeTrustCenterAccessPayload(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_revokeTrustCenterAccess(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 "trustCenterAccess": + return ec.fieldContext_RevokeTrustCenterAccessPayload_trustCenterAccess(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type RevokeTrustCenterAccessPayload", 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_revokeTrustCenterAccess_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_createTrustCenterAccess(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_createTrustCenterAccess(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().CreateTrustCenterAccess(rctx, fc.Args["input"].(types.CreateTrustCenterAccessInput)) + }) + 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.CreateTrustCenterAccessPayload) + fc.Result = res + return ec.marshalNCreateTrustCenterAccessPayload2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐCreateTrustCenterAccessPayload(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_createTrustCenterAccess(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 "trustCenterAccessEdge": + return ec.fieldContext_CreateTrustCenterAccessPayload_trustCenterAccessEdge(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type CreateTrustCenterAccessPayload", 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_createTrustCenterAccess_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_updateTrustCenterAccess(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_updateTrustCenterAccess(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().UpdateTrustCenterAccess(rctx, fc.Args["input"].(types.UpdateTrustCenterAccessInput)) + }) + 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.UpdateTrustCenterAccessPayload) + fc.Result = res + return ec.marshalNUpdateTrustCenterAccessPayload2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐUpdateTrustCenterAccessPayload(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_updateTrustCenterAccess(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 "trustCenterAccess": + return ec.fieldContext_UpdateTrustCenterAccessPayload_trustCenterAccess(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UpdateTrustCenterAccessPayload", 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_updateTrustCenterAccess_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_deleteTrustCenterAccess(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_deleteTrustCenterAccess(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().DeleteTrustCenterAccess(rctx, fc.Args["input"].(types.DeleteTrustCenterAccessInput)) + }) + 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.DeleteTrustCenterAccessPayload) + fc.Result = res + return ec.marshalNDeleteTrustCenterAccessPayload2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐDeleteTrustCenterAccessPayload(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_deleteTrustCenterAccess(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 "deletedTrustCenterAccessId": + return ec.fieldContext_DeleteTrustCenterAccessPayload_deletedTrustCenterAccessId(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type DeleteTrustCenterAccessPayload", 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_deleteTrustCenterAccess_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + func (ec *executionContext) _Mutation_confirmEmail(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Mutation_confirmEmail(ctx, field) if err != nil { @@ -29631,6 +30666,10 @@ func (ec *executionContext) fieldContext_Organization_trustCenter(_ context.Cont return ec.fieldContext_TrustCenter_createdAt(ctx, field) case "updatedAt": return ec.fieldContext_TrustCenter_updatedAt(ctx, field) + case "organization": + return ec.fieldContext_TrustCenter_organization(ctx, field) + case "accesses": + return ec.fieldContext_TrustCenter_accesses(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type TrustCenter", field.Name) }, @@ -31066,6 +32105,67 @@ func (ec *executionContext) fieldContext_Query_viewer(_ context.Context, field g return fc, nil } +func (ec *executionContext) _Query_trustCenters(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_trustCenters(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.Query().TrustCenters(rctx, fc.Args["first"].(*int), fc.Args["after"].(*page.CursorKey), fc.Args["last"].(*int), fc.Args["before"].(*page.CursorKey), fc.Args["filter"].(*types.TrustCenterFilter)) + }) + 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.TrustCenterConnection) + fc.Result = res + return ec.marshalNTrustCenterConnection2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐTrustCenterConnection(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_trustCenters(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + 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_TrustCenterConnection_edges(ctx, field) + case "pageInfo": + return ec.fieldContext_TrustCenterConnection_pageInfo(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TrustCenterConnection", 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_Query_trustCenters_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Query___type(ctx, field) if err != nil { @@ -31690,6 +32790,64 @@ func (ec *executionContext) fieldContext_RequestSignaturePayload_documentVersion return fc, nil } +func (ec *executionContext) _RevokeTrustCenterAccessPayload_trustCenterAccess(ctx context.Context, field graphql.CollectedField, obj *types.RevokeTrustCenterAccessPayload) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_RevokeTrustCenterAccessPayload_trustCenterAccess(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.TrustCenterAccess, 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.TrustCenterAccess) + fc.Result = res + return ec.marshalNTrustCenterAccess2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐTrustCenterAccess(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_RevokeTrustCenterAccessPayload_trustCenterAccess(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "RevokeTrustCenterAccessPayload", + 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_TrustCenterAccess_id(ctx, field) + case "email": + return ec.fieldContext_TrustCenterAccess_email(ctx, field) + case "name": + return ec.fieldContext_TrustCenterAccess_name(ctx, field) + case "active": + return ec.fieldContext_TrustCenterAccess_active(ctx, field) + case "createdAt": + return ec.fieldContext_TrustCenterAccess_createdAt(ctx, field) + case "updatedAt": + return ec.fieldContext_TrustCenterAccess_updatedAt(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TrustCenterAccess", 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 { @@ -34153,6 +35311,829 @@ func (ec *executionContext) fieldContext_TrustCenter_updatedAt(_ context.Context return fc, nil } +func (ec *executionContext) _TrustCenter_organization(ctx context.Context, field graphql.CollectedField, obj *types.TrustCenter) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_TrustCenter_organization(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.TrustCenter().Organization(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.Organization) + fc.Result = res + return ec.marshalNOrganization2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐOrganization(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_TrustCenter_organization(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "TrustCenter", + 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_Organization_id(ctx, field) + case "name": + return ec.fieldContext_Organization_name(ctx, field) + case "logoUrl": + return ec.fieldContext_Organization_logoUrl(ctx, field) + case "users": + return ec.fieldContext_Organization_users(ctx, field) + case "connectors": + return ec.fieldContext_Organization_connectors(ctx, field) + case "frameworks": + return ec.fieldContext_Organization_frameworks(ctx, field) + case "controls": + return ec.fieldContext_Organization_controls(ctx, field) + case "vendors": + return ec.fieldContext_Organization_vendors(ctx, field) + case "peoples": + return ec.fieldContext_Organization_peoples(ctx, field) + case "documents": + return ec.fieldContext_Organization_documents(ctx, field) + case "measures": + return ec.fieldContext_Organization_measures(ctx, field) + case "risks": + return ec.fieldContext_Organization_risks(ctx, field) + case "tasks": + return ec.fieldContext_Organization_tasks(ctx, field) + case "assets": + return ec.fieldContext_Organization_assets(ctx, field) + case "data": + return ec.fieldContext_Organization_data(ctx, field) + case "audits": + return ec.fieldContext_Organization_audits(ctx, field) + case "trustCenter": + return ec.fieldContext_Organization_trustCenter(ctx, field) + case "createdAt": + return ec.fieldContext_Organization_createdAt(ctx, field) + case "updatedAt": + return ec.fieldContext_Organization_updatedAt(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Organization", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _TrustCenter_accesses(ctx context.Context, field graphql.CollectedField, obj *types.TrustCenter) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_TrustCenter_accesses(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.TrustCenter().Accesses(rctx, obj, fc.Args["first"].(*int), fc.Args["after"].(*page.CursorKey), fc.Args["last"].(*int), fc.Args["before"].(*page.CursorKey), fc.Args["orderBy"].(*types.OrderBy[coredata.TrustCenterAccessOrderField])) + }) + 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.TrustCenterAccessConnection) + fc.Result = res + return ec.marshalNTrustCenterAccessConnection2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐTrustCenterAccessConnection(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_TrustCenter_accesses(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "TrustCenter", + 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_TrustCenterAccessConnection_edges(ctx, field) + case "pageInfo": + return ec.fieldContext_TrustCenterAccessConnection_pageInfo(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TrustCenterAccessConnection", 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_TrustCenter_accesses_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _TrustCenterAccess_id(ctx context.Context, field graphql.CollectedField, obj *types.TrustCenterAccess) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_TrustCenterAccess_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_TrustCenterAccess_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "TrustCenterAccess", + 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) _TrustCenterAccess_email(ctx context.Context, field graphql.CollectedField, obj *types.TrustCenterAccess) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_TrustCenterAccess_email(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.Email, 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_TrustCenterAccess_email(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "TrustCenterAccess", + 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) _TrustCenterAccess_name(ctx context.Context, field graphql.CollectedField, obj *types.TrustCenterAccess) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_TrustCenterAccess_name(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.Name, 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_TrustCenterAccess_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "TrustCenterAccess", + 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) _TrustCenterAccess_active(ctx context.Context, field graphql.CollectedField, obj *types.TrustCenterAccess) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_TrustCenterAccess_active(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.Active, 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.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_TrustCenterAccess_active(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "TrustCenterAccess", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _TrustCenterAccess_createdAt(ctx context.Context, field graphql.CollectedField, obj *types.TrustCenterAccess) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_TrustCenterAccess_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_TrustCenterAccess_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "TrustCenterAccess", + 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) _TrustCenterAccess_updatedAt(ctx context.Context, field graphql.CollectedField, obj *types.TrustCenterAccess) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_TrustCenterAccess_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_TrustCenterAccess_updatedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "TrustCenterAccess", + 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) _TrustCenterAccessConnection_edges(ctx context.Context, field graphql.CollectedField, obj *types.TrustCenterAccessConnection) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_TrustCenterAccessConnection_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.TrustCenterAccessEdge) + fc.Result = res + return ec.marshalNTrustCenterAccessEdge2ᚕᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐTrustCenterAccessEdgeᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_TrustCenterAccessConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "TrustCenterAccessConnection", + 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_TrustCenterAccessEdge_cursor(ctx, field) + case "node": + return ec.fieldContext_TrustCenterAccessEdge_node(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TrustCenterAccessEdge", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _TrustCenterAccessConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *types.TrustCenterAccessConnection) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_TrustCenterAccessConnection_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_TrustCenterAccessConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "TrustCenterAccessConnection", + 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) _TrustCenterAccessEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *types.TrustCenterAccessEdge) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_TrustCenterAccessEdge_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_TrustCenterAccessEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "TrustCenterAccessEdge", + 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) _TrustCenterAccessEdge_node(ctx context.Context, field graphql.CollectedField, obj *types.TrustCenterAccessEdge) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_TrustCenterAccessEdge_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.TrustCenterAccess) + fc.Result = res + return ec.marshalNTrustCenterAccess2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐTrustCenterAccess(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_TrustCenterAccessEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "TrustCenterAccessEdge", + 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_TrustCenterAccess_id(ctx, field) + case "email": + return ec.fieldContext_TrustCenterAccess_email(ctx, field) + case "name": + return ec.fieldContext_TrustCenterAccess_name(ctx, field) + case "active": + return ec.fieldContext_TrustCenterAccess_active(ctx, field) + case "createdAt": + return ec.fieldContext_TrustCenterAccess_createdAt(ctx, field) + case "updatedAt": + return ec.fieldContext_TrustCenterAccess_updatedAt(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TrustCenterAccess", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _TrustCenterConnection_edges(ctx context.Context, field graphql.CollectedField, obj *types.TrustCenterConnection) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_TrustCenterConnection_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.TrustCenterEdge) + fc.Result = res + return ec.marshalNTrustCenterEdge2ᚕᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐTrustCenterEdgeᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_TrustCenterConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "TrustCenterConnection", + 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_TrustCenterEdge_cursor(ctx, field) + case "node": + return ec.fieldContext_TrustCenterEdge_node(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TrustCenterEdge", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _TrustCenterConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *types.TrustCenterConnection) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_TrustCenterConnection_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_TrustCenterConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "TrustCenterConnection", + 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) _TrustCenterEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *types.TrustCenterEdge) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_TrustCenterEdge_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_TrustCenterEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "TrustCenterEdge", + 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) _TrustCenterEdge_node(ctx context.Context, field graphql.CollectedField, obj *types.TrustCenterEdge) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_TrustCenterEdge_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.TrustCenter) + fc.Result = res + return ec.marshalNTrustCenter2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐTrustCenter(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_TrustCenterEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "TrustCenterEdge", + 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_TrustCenter_id(ctx, field) + case "active": + return ec.fieldContext_TrustCenter_active(ctx, field) + case "slug": + return ec.fieldContext_TrustCenter_slug(ctx, field) + case "createdAt": + return ec.fieldContext_TrustCenter_createdAt(ctx, field) + case "updatedAt": + return ec.fieldContext_TrustCenter_updatedAt(ctx, field) + case "organization": + return ec.fieldContext_TrustCenter_organization(ctx, field) + case "accesses": + return ec.fieldContext_TrustCenter_accesses(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TrustCenter", field.Name) + }, + } + return fc, nil +} + func (ec *executionContext) _UnassignTaskPayload_task(ctx context.Context, field graphql.CollectedField, obj *types.UnassignTaskPayload) (ret graphql.Marshaler) { fc, err := ec.fieldContext_UnassignTaskPayload_task(ctx, field) if err != nil { @@ -35063,6 +37044,64 @@ func (ec *executionContext) fieldContext_UpdateTaskPayload_task(_ context.Contex return fc, nil } +func (ec *executionContext) _UpdateTrustCenterAccessPayload_trustCenterAccess(ctx context.Context, field graphql.CollectedField, obj *types.UpdateTrustCenterAccessPayload) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_UpdateTrustCenterAccessPayload_trustCenterAccess(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.TrustCenterAccess, 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.TrustCenterAccess) + fc.Result = res + return ec.marshalNTrustCenterAccess2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐTrustCenterAccess(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_UpdateTrustCenterAccessPayload_trustCenterAccess(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "UpdateTrustCenterAccessPayload", + 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_TrustCenterAccess_id(ctx, field) + case "email": + return ec.fieldContext_TrustCenterAccess_email(ctx, field) + case "name": + return ec.fieldContext_TrustCenterAccess_name(ctx, field) + case "active": + return ec.fieldContext_TrustCenterAccess_active(ctx, field) + case "createdAt": + return ec.fieldContext_TrustCenterAccess_createdAt(ctx, field) + case "updatedAt": + return ec.fieldContext_TrustCenterAccess_updatedAt(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TrustCenterAccess", field.Name) + }, + } + return fc, nil +} + func (ec *executionContext) _UpdateTrustCenterPayload_trustCenter(ctx context.Context, field graphql.CollectedField, obj *types.UpdateTrustCenterPayload) (ret graphql.Marshaler) { fc, err := ec.fieldContext_UpdateTrustCenterPayload_trustCenter(ctx, field) if err != nil { @@ -35112,6 +37151,10 @@ func (ec *executionContext) fieldContext_UpdateTrustCenterPayload_trustCenter(_ return ec.fieldContext_TrustCenter_createdAt(ctx, field) case "updatedAt": return ec.fieldContext_TrustCenter_updatedAt(ctx, field) + case "organization": + return ec.fieldContext_TrustCenter_organization(ctx, field) + case "accesses": + return ec.fieldContext_TrustCenter_accesses(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type TrustCenter", field.Name) }, @@ -38892,7 +40935,7 @@ func (ec *executionContext) _Viewer_organizations(ctx context.Context, field gra }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Viewer().Organizations(rctx, obj, fc.Args["first"].(*int), fc.Args["after"].(*page.CursorKey), fc.Args["last"].(*int), fc.Args["before"].(*page.CursorKey), fc.Args["orderBy"].(*types.OrganizationOrder)) + return ec.resolvers.Viewer().Organizations(rctx, obj, fc.Args["first"].(*int), fc.Args["after"].(*page.CursorKey), fc.Args["last"].(*int), fc.Args["before"].(*page.CursorKey), fc.Args["orderBy"].(*types.OrganizationOrder), fc.Args["filter"].(*types.OrganizationFilter)) }) if err != nil { ec.Error(ctx, err) @@ -42133,6 +44176,58 @@ func (ec *executionContext) unmarshalInputCreateTaskInput(ctx context.Context, o return it, nil } +func (ec *executionContext) unmarshalInputCreateTrustCenterAccessInput(ctx context.Context, obj any) (types.CreateTrustCenterAccessInput, error) { + var it types.CreateTrustCenterAccessInput + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + if _, present := asMap["sendEmail"]; !present { + asMap["sendEmail"] = true + } + + fieldsInOrder := [...]string{"trustCenterId", "email", "name", "sendEmail"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "trustCenterId": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("trustCenterId")) + data, err := ec.unmarshalNID2githubᚗcomᚋgetproboᚋproboᚋpkgᚋgidᚐGID(ctx, v) + if err != nil { + return it, err + } + it.TrustCenterID = data + case "email": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("email")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.Email = data + case "name": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.Name = data + case "sendEmail": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("sendEmail")) + data, err := ec.unmarshalNBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.SendEmail = data + } + } + + return it, nil +} + func (ec *executionContext) unmarshalInputCreateVendorInput(ctx context.Context, obj any) (types.CreateVendorInput, error) { var it types.CreateVendorInput asMap := map[string]any{} @@ -42842,6 +44937,33 @@ func (ec *executionContext) unmarshalInputDeleteTaskInput(ctx context.Context, o return it, nil } +func (ec *executionContext) unmarshalInputDeleteTrustCenterAccessInput(ctx context.Context, obj any) (types.DeleteTrustCenterAccessInput, error) { + var it types.DeleteTrustCenterAccessInput + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"accessId"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "accessId": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("accessId")) + data, err := ec.unmarshalNID2githubᚗcomᚋgetproboᚋproboᚋpkgᚋgidᚐGID(ctx, v) + if err != nil { + return it, err + } + it.AccessID = data + } + } + + return it, nil +} + func (ec *executionContext) unmarshalInputDeleteVendorComplianceReportInput(ctx context.Context, obj any) (types.DeleteVendorComplianceReportInput, error) { var it types.DeleteVendorComplianceReportInput asMap := map[string]any{} @@ -43419,6 +45541,33 @@ func (ec *executionContext) unmarshalInputMeasureOrder(ctx context.Context, obj return it, nil } +func (ec *executionContext) unmarshalInputOrganizationFilter(ctx context.Context, obj any) (types.OrganizationFilter, error) { + var it types.OrganizationFilter + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"trustCenterSlug"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "trustCenterSlug": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("trustCenterSlug")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.TrustCenterSlug = data + } + } + + return it, nil +} + func (ec *executionContext) unmarshalInputOrganizationOrder(ctx context.Context, obj any) (types.OrganizationOrder, error) { var it types.OrganizationOrder asMap := map[string]any{} @@ -43637,6 +45786,33 @@ func (ec *executionContext) unmarshalInputRequestSignatureInput(ctx context.Cont return it, nil } +func (ec *executionContext) unmarshalInputRevokeTrustCenterAccessInput(ctx context.Context, obj any) (types.RevokeTrustCenterAccessInput, error) { + var it types.RevokeTrustCenterAccessInput + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"accessId"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "accessId": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("accessId")) + data, err := ec.unmarshalNID2githubᚗcomᚋgetproboᚋproboᚋpkgᚋgidᚐGID(ctx, v) + if err != nil { + return it, err + } + it.AccessID = data + } + } + + return it, nil +} + func (ec *executionContext) unmarshalInputRiskFilter(ctx context.Context, obj any) (types.RiskFilter, error) { var it types.RiskFilter asMap := map[string]any{} @@ -43759,6 +45935,67 @@ func (ec *executionContext) unmarshalInputTaskOrder(ctx context.Context, obj any return it, nil } +func (ec *executionContext) unmarshalInputTrustCenterAccessOrder(ctx context.Context, obj any) (types.OrderBy[coredata.TrustCenterAccessOrderField], error) { + var it types.OrderBy[coredata.TrustCenterAccessOrderField] + 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.unmarshalNTrustCenterAccessOrderField2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐTrustCenterAccessOrderField(ctx, v) + if err != nil { + return it, err + } + it.Field = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputTrustCenterFilter(ctx context.Context, obj any) (types.TrustCenterFilter, error) { + var it types.TrustCenterFilter + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"slug"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "slug": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("slug")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Slug = data + } + } + + return it, nil +} + func (ec *executionContext) unmarshalInputUnassignTaskInput(ctx context.Context, obj any) (types.UnassignTaskInput, error) { var it types.UnassignTaskInput asMap := map[string]any{} @@ -44509,6 +46746,65 @@ func (ec *executionContext) unmarshalInputUpdateTaskInput(ctx context.Context, o return it, nil } +func (ec *executionContext) unmarshalInputUpdateTrustCenterAccessInput(ctx context.Context, obj any) (types.UpdateTrustCenterAccessInput, error) { + var it types.UpdateTrustCenterAccessInput + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + if _, present := asMap["sendEmail"]; !present { + asMap["sendEmail"] = false + } + + fieldsInOrder := [...]string{"accessId", "email", "name", "active", "sendEmail"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "accessId": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("accessId")) + data, err := ec.unmarshalNID2githubᚗcomᚋgetproboᚋproboᚋpkgᚋgidᚐGID(ctx, v) + if err != nil { + return it, err + } + it.AccessID = data + case "email": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("email")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Email = data + case "name": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Name = data + case "active": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("active")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.Active = data + case "sendEmail": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("sendEmail")) + data, err := ec.unmarshalNBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.SendEmail = data + } + } + + return it, nil +} + func (ec *executionContext) unmarshalInputUpdateTrustCenterInput(ctx context.Context, obj any) (types.UpdateTrustCenterInput, error) { var it types.UpdateTrustCenterInput asMap := map[string]any{} @@ -45039,6 +47335,13 @@ func (ec *executionContext) _Node(ctx context.Context, sel ast.SelectionSet, obj return graphql.Null } return ec._User(ctx, sel, obj) + case types.TrustCenterAccess: + return ec._TrustCenterAccess(ctx, sel, &obj) + case *types.TrustCenterAccess: + if obj == nil { + return graphql.Null + } + return ec._TrustCenterAccess(ctx, sel, obj) case types.TrustCenter: return ec._TrustCenter(ctx, sel, &obj) case *types.TrustCenter: @@ -47206,6 +49509,45 @@ func (ec *executionContext) _CreateTaskPayload(ctx context.Context, sel ast.Sele return out } +var createTrustCenterAccessPayloadImplementors = []string{"CreateTrustCenterAccessPayload"} + +func (ec *executionContext) _CreateTrustCenterAccessPayload(ctx context.Context, sel ast.SelectionSet, obj *types.CreateTrustCenterAccessPayload) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, createTrustCenterAccessPayloadImplementors) + + 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("CreateTrustCenterAccessPayload") + case "trustCenterAccessEdge": + out.Values[i] = ec._CreateTrustCenterAccessPayload_trustCenterAccessEdge(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 createVendorPayloadImplementors = []string{"CreateVendorPayload"} func (ec *executionContext) _CreateVendorPayload(ctx context.Context, sel ast.SelectionSet, obj *types.CreateVendorPayload) graphql.Marshaler { @@ -48219,6 +50561,45 @@ func (ec *executionContext) _DeleteTaskPayload(ctx context.Context, sel ast.Sele return out } +var deleteTrustCenterAccessPayloadImplementors = []string{"DeleteTrustCenterAccessPayload"} + +func (ec *executionContext) _DeleteTrustCenterAccessPayload(ctx context.Context, sel ast.SelectionSet, obj *types.DeleteTrustCenterAccessPayload) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, deleteTrustCenterAccessPayloadImplementors) + + 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("DeleteTrustCenterAccessPayload") + case "deletedTrustCenterAccessId": + out.Values[i] = ec._DeleteTrustCenterAccessPayload_deletedTrustCenterAccessId(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 deleteVendorComplianceReportPayloadImplementors = []string{"DeleteVendorComplianceReportPayload"} func (ec *executionContext) _DeleteVendorComplianceReportPayload(ctx context.Context, sel ast.SelectionSet, obj *types.DeleteVendorComplianceReportPayload) graphql.Marshaler { @@ -50410,6 +52791,34 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) if out.Values[i] == graphql.Null { out.Invalids++ } + case "revokeTrustCenterAccess": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_revokeTrustCenterAccess(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "createTrustCenterAccess": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_createTrustCenterAccess(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "updateTrustCenterAccess": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_updateTrustCenterAccess(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "deleteTrustCenterAccess": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_deleteTrustCenterAccess(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } case "confirmEmail": out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { return ec._Mutation_confirmEmail(ctx, field) @@ -51952,6 +54361,28 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) } + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "trustCenters": + 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._Query_trustCenters(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) case "__type": out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { @@ -52203,6 +54634,45 @@ func (ec *executionContext) _RequestSignaturePayload(ctx context.Context, sel as return out } +var revokeTrustCenterAccessPayloadImplementors = []string{"RevokeTrustCenterAccessPayload"} + +func (ec *executionContext) _RevokeTrustCenterAccessPayload(ctx context.Context, sel ast.SelectionSet, obj *types.RevokeTrustCenterAccessPayload) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, revokeTrustCenterAccessPayloadImplementors) + + 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("RevokeTrustCenterAccessPayload") + case "trustCenterAccess": + out.Values[i] = ec._RevokeTrustCenterAccessPayload_trustCenterAccess(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 { @@ -53035,25 +55505,337 @@ func (ec *executionContext) _TrustCenter(ctx context.Context, sel ast.SelectionS case "id": out.Values[i] = ec._TrustCenter_id(ctx, field, obj) if out.Values[i] == graphql.Null { - out.Invalids++ + atomic.AddUint32(&out.Invalids, 1) } case "active": out.Values[i] = ec._TrustCenter_active(ctx, field, obj) if out.Values[i] == graphql.Null { - out.Invalids++ + atomic.AddUint32(&out.Invalids, 1) } case "slug": out.Values[i] = ec._TrustCenter_slug(ctx, field, obj) if out.Values[i] == graphql.Null { - out.Invalids++ + atomic.AddUint32(&out.Invalids, 1) } case "createdAt": out.Values[i] = ec._TrustCenter_createdAt(ctx, field, obj) if out.Values[i] == graphql.Null { - out.Invalids++ + atomic.AddUint32(&out.Invalids, 1) } case "updatedAt": out.Values[i] = ec._TrustCenter_updatedAt(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "organization": + 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._TrustCenter_organization(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 "accesses": + 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._TrustCenter_accesses(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) }) + 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 trustCenterAccessImplementors = []string{"TrustCenterAccess", "Node"} + +func (ec *executionContext) _TrustCenterAccess(ctx context.Context, sel ast.SelectionSet, obj *types.TrustCenterAccess) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, trustCenterAccessImplementors) + + 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("TrustCenterAccess") + case "id": + out.Values[i] = ec._TrustCenterAccess_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "email": + out.Values[i] = ec._TrustCenterAccess_email(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "name": + out.Values[i] = ec._TrustCenterAccess_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "active": + out.Values[i] = ec._TrustCenterAccess_active(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "createdAt": + out.Values[i] = ec._TrustCenterAccess_createdAt(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "updatedAt": + out.Values[i] = ec._TrustCenterAccess_updatedAt(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 trustCenterAccessConnectionImplementors = []string{"TrustCenterAccessConnection"} + +func (ec *executionContext) _TrustCenterAccessConnection(ctx context.Context, sel ast.SelectionSet, obj *types.TrustCenterAccessConnection) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, trustCenterAccessConnectionImplementors) + + 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("TrustCenterAccessConnection") + case "edges": + out.Values[i] = ec._TrustCenterAccessConnection_edges(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "pageInfo": + out.Values[i] = ec._TrustCenterAccessConnection_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 trustCenterAccessEdgeImplementors = []string{"TrustCenterAccessEdge"} + +func (ec *executionContext) _TrustCenterAccessEdge(ctx context.Context, sel ast.SelectionSet, obj *types.TrustCenterAccessEdge) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, trustCenterAccessEdgeImplementors) + + 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("TrustCenterAccessEdge") + case "cursor": + out.Values[i] = ec._TrustCenterAccessEdge_cursor(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "node": + out.Values[i] = ec._TrustCenterAccessEdge_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 trustCenterConnectionImplementors = []string{"TrustCenterConnection"} + +func (ec *executionContext) _TrustCenterConnection(ctx context.Context, sel ast.SelectionSet, obj *types.TrustCenterConnection) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, trustCenterConnectionImplementors) + + 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("TrustCenterConnection") + case "edges": + out.Values[i] = ec._TrustCenterConnection_edges(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "pageInfo": + out.Values[i] = ec._TrustCenterConnection_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 trustCenterEdgeImplementors = []string{"TrustCenterEdge"} + +func (ec *executionContext) _TrustCenterEdge(ctx context.Context, sel ast.SelectionSet, obj *types.TrustCenterEdge) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, trustCenterEdgeImplementors) + + 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("TrustCenterEdge") + case "cursor": + out.Values[i] = ec._TrustCenterEdge_cursor(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "node": + out.Values[i] = ec._TrustCenterEdge_node(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } @@ -53587,6 +56369,45 @@ func (ec *executionContext) _UpdateTaskPayload(ctx context.Context, sel ast.Sele return out } +var updateTrustCenterAccessPayloadImplementors = []string{"UpdateTrustCenterAccessPayload"} + +func (ec *executionContext) _UpdateTrustCenterAccessPayload(ctx context.Context, sel ast.SelectionSet, obj *types.UpdateTrustCenterAccessPayload) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, updateTrustCenterAccessPayloadImplementors) + + 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("UpdateTrustCenterAccessPayload") + case "trustCenterAccess": + out.Values[i] = ec._UpdateTrustCenterAccessPayload_trustCenterAccess(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 updateTrustCenterPayloadImplementors = []string{"UpdateTrustCenterPayload"} func (ec *executionContext) _UpdateTrustCenterPayload(ctx context.Context, sel ast.SelectionSet, obj *types.UpdateTrustCenterPayload) graphql.Marshaler { @@ -56252,6 +59073,25 @@ func (ec *executionContext) marshalNCreateTaskPayload2ᚖgithubᚗcomᚋgetprobo return ec._CreateTaskPayload(ctx, sel, v) } +func (ec *executionContext) unmarshalNCreateTrustCenterAccessInput2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐCreateTrustCenterAccessInput(ctx context.Context, v any) (types.CreateTrustCenterAccessInput, error) { + res, err := ec.unmarshalInputCreateTrustCenterAccessInput(ctx, v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNCreateTrustCenterAccessPayload2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐCreateTrustCenterAccessPayload(ctx context.Context, sel ast.SelectionSet, v types.CreateTrustCenterAccessPayload) graphql.Marshaler { + return ec._CreateTrustCenterAccessPayload(ctx, sel, &v) +} + +func (ec *executionContext) marshalNCreateTrustCenterAccessPayload2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐCreateTrustCenterAccessPayload(ctx context.Context, sel ast.SelectionSet, v *types.CreateTrustCenterAccessPayload) 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._CreateTrustCenterAccessPayload(ctx, sel, v) +} + func (ec *executionContext) unmarshalNCreateVendorInput2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐCreateVendorInput(ctx context.Context, v any) (types.CreateVendorInput, error) { res, err := ec.unmarshalInputCreateVendorInput(ctx, v) return res, graphql.ErrorOnPath(ctx, err) @@ -56830,6 +59670,25 @@ func (ec *executionContext) marshalNDeleteTaskPayload2ᚖgithubᚗcomᚋgetprobo return ec._DeleteTaskPayload(ctx, sel, v) } +func (ec *executionContext) unmarshalNDeleteTrustCenterAccessInput2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐDeleteTrustCenterAccessInput(ctx context.Context, v any) (types.DeleteTrustCenterAccessInput, error) { + res, err := ec.unmarshalInputDeleteTrustCenterAccessInput(ctx, v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNDeleteTrustCenterAccessPayload2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐDeleteTrustCenterAccessPayload(ctx context.Context, sel ast.SelectionSet, v types.DeleteTrustCenterAccessPayload) graphql.Marshaler { + return ec._DeleteTrustCenterAccessPayload(ctx, sel, &v) +} + +func (ec *executionContext) marshalNDeleteTrustCenterAccessPayload2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐDeleteTrustCenterAccessPayload(ctx context.Context, sel ast.SelectionSet, v *types.DeleteTrustCenterAccessPayload) 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._DeleteTrustCenterAccessPayload(ctx, sel, v) +} + func (ec *executionContext) unmarshalNDeleteVendorComplianceReportInput2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐDeleteVendorComplianceReportInput(ctx context.Context, v any) (types.DeleteVendorComplianceReportInput, error) { res, err := ec.unmarshalInputDeleteVendorComplianceReportInput(ctx, v) return res, graphql.ErrorOnPath(ctx, err) @@ -58258,6 +61117,25 @@ func (ec *executionContext) marshalNRequestSignaturePayload2ᚖgithubᚗcomᚋge return ec._RequestSignaturePayload(ctx, sel, v) } +func (ec *executionContext) unmarshalNRevokeTrustCenterAccessInput2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐRevokeTrustCenterAccessInput(ctx context.Context, v any) (types.RevokeTrustCenterAccessInput, error) { + res, err := ec.unmarshalInputRevokeTrustCenterAccessInput(ctx, v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNRevokeTrustCenterAccessPayload2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐRevokeTrustCenterAccessPayload(ctx context.Context, sel ast.SelectionSet, v types.RevokeTrustCenterAccessPayload) graphql.Marshaler { + return ec._RevokeTrustCenterAccessPayload(ctx, sel, &v) +} + +func (ec *executionContext) marshalNRevokeTrustCenterAccessPayload2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐRevokeTrustCenterAccessPayload(ctx context.Context, sel ast.SelectionSet, v *types.RevokeTrustCenterAccessPayload) 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._RevokeTrustCenterAccessPayload(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)) { @@ -58604,6 +61482,178 @@ func (ec *executionContext) marshalNTrustCenter2ᚖgithubᚗcomᚋgetproboᚋpro return ec._TrustCenter(ctx, sel, v) } +func (ec *executionContext) marshalNTrustCenterAccess2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐTrustCenterAccess(ctx context.Context, sel ast.SelectionSet, v *types.TrustCenterAccess) 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._TrustCenterAccess(ctx, sel, v) +} + +func (ec *executionContext) marshalNTrustCenterAccessConnection2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐTrustCenterAccessConnection(ctx context.Context, sel ast.SelectionSet, v types.TrustCenterAccessConnection) graphql.Marshaler { + return ec._TrustCenterAccessConnection(ctx, sel, &v) +} + +func (ec *executionContext) marshalNTrustCenterAccessConnection2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐTrustCenterAccessConnection(ctx context.Context, sel ast.SelectionSet, v *types.TrustCenterAccessConnection) 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._TrustCenterAccessConnection(ctx, sel, v) +} + +func (ec *executionContext) marshalNTrustCenterAccessEdge2ᚕᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐTrustCenterAccessEdgeᚄ(ctx context.Context, sel ast.SelectionSet, v []*types.TrustCenterAccessEdge) 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.marshalNTrustCenterAccessEdge2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐTrustCenterAccessEdge(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) marshalNTrustCenterAccessEdge2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐTrustCenterAccessEdge(ctx context.Context, sel ast.SelectionSet, v *types.TrustCenterAccessEdge) 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._TrustCenterAccessEdge(ctx, sel, v) +} + +func (ec *executionContext) unmarshalNTrustCenterAccessOrderField2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐTrustCenterAccessOrderField(ctx context.Context, v any) (coredata.TrustCenterAccessOrderField, error) { + tmp, err := graphql.UnmarshalString(v) + res := unmarshalNTrustCenterAccessOrderField2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐTrustCenterAccessOrderField[tmp] + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNTrustCenterAccessOrderField2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐTrustCenterAccessOrderField(ctx context.Context, sel ast.SelectionSet, v coredata.TrustCenterAccessOrderField) graphql.Marshaler { + _ = sel + res := graphql.MarshalString(marshalNTrustCenterAccessOrderField2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐTrustCenterAccessOrderField[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 ( + unmarshalNTrustCenterAccessOrderField2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐTrustCenterAccessOrderField = map[string]coredata.TrustCenterAccessOrderField{ + "CREATED_AT": coredata.TrustCenterAccessOrderFieldCreatedAt, + } + marshalNTrustCenterAccessOrderField2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐTrustCenterAccessOrderField = map[coredata.TrustCenterAccessOrderField]string{ + coredata.TrustCenterAccessOrderFieldCreatedAt: "CREATED_AT", + } +) + +func (ec *executionContext) marshalNTrustCenterConnection2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐTrustCenterConnection(ctx context.Context, sel ast.SelectionSet, v types.TrustCenterConnection) graphql.Marshaler { + return ec._TrustCenterConnection(ctx, sel, &v) +} + +func (ec *executionContext) marshalNTrustCenterConnection2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐTrustCenterConnection(ctx context.Context, sel ast.SelectionSet, v *types.TrustCenterConnection) 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._TrustCenterConnection(ctx, sel, v) +} + +func (ec *executionContext) marshalNTrustCenterEdge2ᚕᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐTrustCenterEdgeᚄ(ctx context.Context, sel ast.SelectionSet, v []*types.TrustCenterEdge) 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.marshalNTrustCenterEdge2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐTrustCenterEdge(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) marshalNTrustCenterEdge2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐTrustCenterEdge(ctx context.Context, sel ast.SelectionSet, v *types.TrustCenterEdge) 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._TrustCenterEdge(ctx, sel, v) +} + func (ec *executionContext) unmarshalNUnassignTaskInput2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐUnassignTaskInput(ctx context.Context, v any) (types.UnassignTaskInput, error) { res, err := ec.unmarshalInputUnassignTaskInput(ctx, v) return res, graphql.ErrorOnPath(ctx, err) @@ -58851,6 +61901,25 @@ func (ec *executionContext) marshalNUpdateTaskPayload2ᚖgithubᚗcomᚋgetprobo return ec._UpdateTaskPayload(ctx, sel, v) } +func (ec *executionContext) unmarshalNUpdateTrustCenterAccessInput2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐUpdateTrustCenterAccessInput(ctx context.Context, v any) (types.UpdateTrustCenterAccessInput, error) { + res, err := ec.unmarshalInputUpdateTrustCenterAccessInput(ctx, v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNUpdateTrustCenterAccessPayload2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐUpdateTrustCenterAccessPayload(ctx context.Context, sel ast.SelectionSet, v types.UpdateTrustCenterAccessPayload) graphql.Marshaler { + return ec._UpdateTrustCenterAccessPayload(ctx, sel, &v) +} + +func (ec *executionContext) marshalNUpdateTrustCenterAccessPayload2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐUpdateTrustCenterAccessPayload(ctx context.Context, sel ast.SelectionSet, v *types.UpdateTrustCenterAccessPayload) 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._UpdateTrustCenterAccessPayload(ctx, sel, v) +} + func (ec *executionContext) unmarshalNUpdateTrustCenterInput2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐUpdateTrustCenterInput(ctx context.Context, v any) (types.UpdateTrustCenterInput, error) { res, err := ec.unmarshalInputUpdateTrustCenterInput(ctx, v) return res, graphql.ErrorOnPath(ctx, err) @@ -60287,6 +63356,14 @@ var ( } ) +func (ec *executionContext) unmarshalOOrganizationFilter2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐOrganizationFilter(ctx context.Context, v any) (*types.OrganizationFilter, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalInputOrganizationFilter(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + func (ec *executionContext) unmarshalOOrganizationOrder2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐOrganizationOrder(ctx context.Context, v any) (*types.OrganizationOrder, error) { if v == nil { return nil, nil @@ -60505,6 +63582,22 @@ func (ec *executionContext) marshalOTrustCenter2ᚖgithubᚗcomᚋgetproboᚋpro return ec._TrustCenter(ctx, sel, v) } +func (ec *executionContext) unmarshalOTrustCenterAccessOrder2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐOrderBy(ctx context.Context, v any) (*types.OrderBy[coredata.TrustCenterAccessOrderField], error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalInputTrustCenterAccessOrder(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) unmarshalOTrustCenterFilter2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐTrustCenterFilter(ctx context.Context, v any) (*types.TrustCenterFilter, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalInputTrustCenterFilter(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + func (ec *executionContext) unmarshalOUpload2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚐUpload(ctx context.Context, v any) (*graphql.Upload, error) { if v == nil { return nil, nil diff --git a/pkg/server/api/console/v1/types/trust_center_access.go b/pkg/server/api/console/v1/types/trust_center_access.go new file mode 100644 index 000000000..e36b5f3db --- /dev/null +++ b/pkg/server/api/console/v1/types/trust_center_access.go @@ -0,0 +1,57 @@ +// 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 TrustCenterAccessOrderBy = OrderBy[coredata.TrustCenterAccessOrderField] + +func NewTrustCenterAccess(tca *coredata.TrustCenterAccess) *TrustCenterAccess { + return &TrustCenterAccess{ + ID: tca.ID, + Email: tca.Email, + Name: tca.Name, + Active: tca.Active, + CreatedAt: tca.CreatedAt, + UpdatedAt: tca.UpdatedAt, + } +} + +func NewTrustCenterAccessConnection( + page *page.Page[*coredata.TrustCenterAccess, coredata.TrustCenterAccessOrderField], +) *TrustCenterAccessConnection { + var edges = make([]*TrustCenterAccessEdge, len(page.Data)) + + for i := range edges { + edges[i] = NewTrustCenterAccessEdge(page.Data[i], page.Cursor.OrderBy.Field) + } + + return &TrustCenterAccessConnection{ + Edges: edges, + PageInfo: NewPageInfo(page), + } +} + +func NewTrustCenterAccessEdge(tca *coredata.TrustCenterAccess, orderBy coredata.TrustCenterAccessOrderField) *TrustCenterAccessEdge { + return &TrustCenterAccessEdge{ + Cursor: tca.CursorKey(orderBy), + Node: NewTrustCenterAccess(tca), + } +} + +// Types are auto-generated in types.go - only helper functions remain here diff --git a/pkg/server/api/console/v1/types/types.go b/pkg/server/api/console/v1/types/types.go index b4ef06d7a..849513d27 100644 --- a/pkg/server/api/console/v1/types/types.go +++ b/pkg/server/api/console/v1/types/types.go @@ -367,6 +367,17 @@ type CreateTaskPayload struct { TaskEdge *TaskEdge `json:"taskEdge"` } +type CreateTrustCenterAccessInput struct { + TrustCenterID gid.GID `json:"trustCenterId"` + Email string `json:"email"` + Name string `json:"name"` + SendEmail bool `json:"sendEmail"` +} + +type CreateTrustCenterAccessPayload struct { + TrustCenterAccessEdge *TrustCenterAccessEdge `json:"trustCenterAccessEdge"` +} + type CreateVendorInput struct { OrganizationID gid.GID `json:"organizationId"` Name string `json:"name"` @@ -561,6 +572,14 @@ type DeleteTaskPayload struct { DeletedTaskID gid.GID `json:"deletedTaskId"` } +type DeleteTrustCenterAccessInput struct { + AccessID gid.GID `json:"accessId"` +} + +type DeleteTrustCenterAccessPayload struct { + DeletedTrustCenterAccessID gid.GID `json:"deletedTrustCenterAccessId"` +} + type DeleteVendorComplianceReportInput struct { ReportID gid.GID `json:"reportId"` } @@ -836,6 +855,10 @@ type OrganizationEdge struct { Node *Organization `json:"node"` } +type OrganizationFilter struct { + TrustCenterSlug *string `json:"trustCenterSlug,omitempty"` +} + type OrganizationOrder struct { Direction page.OrderDirection `json:"direction"` Field coredata.OrganizationOrderField `json:"field"` @@ -925,6 +948,14 @@ type RequestSignaturePayload struct { DocumentVersionSignatureEdge *DocumentVersionSignatureEdge `json:"documentVersionSignatureEdge"` } +type RevokeTrustCenterAccessInput struct { + AccessID gid.GID `json:"accessId"` +} + +type RevokeTrustCenterAccessPayload struct { + TrustCenterAccess *TrustCenterAccess `json:"trustCenterAccess"` +} + type Risk struct { ID gid.GID `json:"id"` Name string `json:"name"` @@ -996,16 +1027,54 @@ type TaskEdge struct { } type TrustCenter struct { - ID gid.GID `json:"id"` - Active bool `json:"active"` - Slug string `json:"slug"` - CreatedAt time.Time `json:"createdAt"` - UpdatedAt time.Time `json:"updatedAt"` + ID gid.GID `json:"id"` + Active bool `json:"active"` + Slug string `json:"slug"` + CreatedAt time.Time `json:"createdAt"` + UpdatedAt time.Time `json:"updatedAt"` + Organization *Organization `json:"organization"` + Accesses *TrustCenterAccessConnection `json:"accesses"` } func (TrustCenter) IsNode() {} func (this TrustCenter) GetID() gid.GID { return this.ID } +type TrustCenterAccess struct { + ID gid.GID `json:"id"` + Email string `json:"email"` + Name string `json:"name"` + Active bool `json:"active"` + CreatedAt time.Time `json:"createdAt"` + UpdatedAt time.Time `json:"updatedAt"` +} + +func (TrustCenterAccess) IsNode() {} +func (this TrustCenterAccess) GetID() gid.GID { return this.ID } + +type TrustCenterAccessConnection struct { + Edges []*TrustCenterAccessEdge `json:"edges"` + PageInfo *PageInfo `json:"pageInfo"` +} + +type TrustCenterAccessEdge struct { + Cursor page.CursorKey `json:"cursor"` + Node *TrustCenterAccess `json:"node"` +} + +type TrustCenterConnection struct { + Edges []*TrustCenterEdge `json:"edges"` + PageInfo *PageInfo `json:"pageInfo"` +} + +type TrustCenterEdge struct { + Cursor page.CursorKey `json:"cursor"` + Node *TrustCenter `json:"node"` +} + +type TrustCenterFilter struct { + Slug *string `json:"slug,omitempty"` +} + type UnassignTaskInput struct { TaskID gid.GID `json:"taskId"` } @@ -1167,6 +1236,18 @@ type UpdateTaskPayload struct { Task *Task `json:"task"` } +type UpdateTrustCenterAccessInput struct { + AccessID gid.GID `json:"accessId"` + Email *string `json:"email,omitempty"` + Name *string `json:"name,omitempty"` + Active *bool `json:"active,omitempty"` + SendEmail bool `json:"sendEmail"` +} + +type UpdateTrustCenterAccessPayload struct { + TrustCenterAccess *TrustCenterAccess `json:"trustCenterAccess"` +} + type UpdateTrustCenterInput struct { TrustCenterID gid.GID `json:"trustCenterId"` Active *bool `json:"active,omitempty"` diff --git a/pkg/server/api/console/v1/v1_resolver.go b/pkg/server/api/console/v1/v1_resolver.go index 0f2eea48c..ad268a7b7 100644 --- a/pkg/server/api/console/v1/v1_resolver.go +++ b/pkg/server/api/console/v1/v1_resolver.go @@ -998,6 +998,77 @@ func (r *mutationResolver) UpdateTrustCenter(ctx context.Context, input types.Up }, nil } +// RevokeTrustCenterAccess is the resolver for the revokeTrustCenterAccess field. +func (r *mutationResolver) RevokeTrustCenterAccess(ctx context.Context, input types.RevokeTrustCenterAccessInput) (*types.RevokeTrustCenterAccessPayload, error) { + prb := r.ProboService(ctx, input.AccessID.TenantID()) + + access, err := prb.TrustCenterAccesses.RevokeAccess(ctx, &probo.RevokeTrustCenterAccessRequest{ + AccessID: input.AccessID, + }) + if err != nil { + return nil, fmt.Errorf("cannot revoke trust center access: %w", err) + } + + return &types.RevokeTrustCenterAccessPayload{ + TrustCenterAccess: types.NewTrustCenterAccess(access), + }, nil +} + +// CreateTrustCenterAccess is the resolver for the createTrustCenterAccess field. +func (r *mutationResolver) CreateTrustCenterAccess(ctx context.Context, input types.CreateTrustCenterAccessInput) (*types.CreateTrustCenterAccessPayload, error) { + prb := r.ProboService(ctx, input.TrustCenterID.TenantID()) + + access, err := prb.TrustCenterAccesses.Create(ctx, &probo.CreateTrustCenterAccessRequest{ + TrustCenterID: input.TrustCenterID, + Email: input.Email, + Name: input.Name, + SendEmail: input.SendEmail, + }) + if err != nil { + return nil, fmt.Errorf("cannot create trust center access: %w", err) + } + + return &types.CreateTrustCenterAccessPayload{ + TrustCenterAccessEdge: types.NewTrustCenterAccessEdge(access, coredata.TrustCenterAccessOrderFieldCreatedAt), + }, nil +} + +// UpdateTrustCenterAccess is the resolver for the updateTrustCenterAccess field. +func (r *mutationResolver) UpdateTrustCenterAccess(ctx context.Context, input types.UpdateTrustCenterAccessInput) (*types.UpdateTrustCenterAccessPayload, error) { + prb := r.ProboService(ctx, input.AccessID.TenantID()) + + access, err := prb.TrustCenterAccesses.Update(ctx, &probo.UpdateTrustCenterAccessRequest{ + AccessID: input.AccessID, + Email: input.Email, + Name: input.Name, + Active: input.Active, + SendEmail: input.SendEmail, + }) + if err != nil { + return nil, fmt.Errorf("cannot update trust center access: %w", err) + } + + return &types.UpdateTrustCenterAccessPayload{ + TrustCenterAccess: types.NewTrustCenterAccess(access), + }, nil +} + +// DeleteTrustCenterAccess is the resolver for the deleteTrustCenterAccess field. +func (r *mutationResolver) DeleteTrustCenterAccess(ctx context.Context, input types.DeleteTrustCenterAccessInput) (*types.DeleteTrustCenterAccessPayload, error) { + prb := r.ProboService(ctx, input.AccessID.TenantID()) + + err := prb.TrustCenterAccesses.Delete(ctx, &probo.DeleteTrustCenterAccessRequest{ + AccessID: input.AccessID, + }) + if err != nil { + return nil, fmt.Errorf("cannot delete trust center access: %w", err) + } + + return &types.DeleteTrustCenterAccessPayload{ + DeletedTrustCenterAccessID: input.AccessID, + }, nil +} + // ConfirmEmail is the resolver for the confirmEmail field. func (r *mutationResolver) ConfirmEmail(ctx context.Context, input types.ConfirmEmailInput) (*types.ConfirmEmailPayload, error) { err := r.usrmgrSvc.ConfirmEmail(ctx, input.Token) @@ -2883,7 +2954,7 @@ func (r *queryResolver) Node(ctx context.Context, id gid.GID) (types.Node, error } return types.NewReport(report), nil case coredata.TrustCenterEntityType: - trustCenter, err := prb.TrustCenters.GetByOrganizationID(ctx, id) + trustCenter, err := prb.TrustCenters.Get(ctx, id) if err != nil { panic(fmt.Errorf("cannot get trust center: %w", err)) } @@ -2905,6 +2976,11 @@ func (r *queryResolver) Viewer(ctx context.Context) (*types.Viewer, error) { }, nil } +// TrustCenters is the resolver for the trustCenters field. +func (r *queryResolver) TrustCenters(ctx context.Context, first *int, after *page.CursorKey, last *int, before *page.CursorKey, filter *types.TrustCenterFilter) (*types.TrustCenterConnection, error) { + panic(fmt.Errorf("not implemented: TrustCenters - trustCenters")) +} + // DownloadURL is the resolver for the downloadUrl field. func (r *reportResolver) DownloadURL(ctx context.Context, obj *types.Report) (*string, error) { prb := r.ProboService(ctx, obj.ID.TenantID()) @@ -3167,6 +3243,43 @@ func (r *taskConnectionResolver) TotalCount(ctx context.Context, obj *types.Task panic(fmt.Errorf("unsupported resolver: %T", obj.Resolver)) } +// Organization is the resolver for the organization field. +func (r *trustCenterResolver) Organization(ctx context.Context, obj *types.TrustCenter) (*types.Organization, error) { + prb := r.ProboService(ctx, obj.ID.TenantID()) + + organization, err := prb.Organizations.Get(ctx, obj.Organization.ID) + if err != nil { + return nil, fmt.Errorf("cannot get organization: %w", err) + } + + return types.NewOrganization(organization), nil +} + +// Accesses is the resolver for the accesses field. +func (r *trustCenterResolver) Accesses(ctx context.Context, obj *types.TrustCenter, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.OrderBy[coredata.TrustCenterAccessOrderField]) (*types.TrustCenterAccessConnection, error) { + prb := r.ProboService(ctx, obj.ID.TenantID()) + + pageOrderBy := page.OrderBy[coredata.TrustCenterAccessOrderField]{ + Field: coredata.TrustCenterAccessOrderFieldCreatedAt, + Direction: page.OrderDirectionDesc, + } + if orderBy != nil { + pageOrderBy = page.OrderBy[coredata.TrustCenterAccessOrderField]{ + Field: orderBy.Field, + Direction: orderBy.Direction, + } + } + + cursor := types.NewCursor(first, after, last, before, pageOrderBy) + + result, err := prb.TrustCenterAccesses.ListForTrustCenterID(ctx, obj.ID, cursor) + if err != nil { + panic(fmt.Errorf("cannot list trust center accesses: %w", err)) + } + + return types.NewTrustCenterAccessConnection(result), nil +} + // People is the resolver for the people field. func (r *userResolver) People(ctx context.Context, obj *types.User, organizationID gid.GID) (*types.People, error) { prb := r.ProboService(ctx, organizationID.TenantID()) @@ -3369,7 +3482,7 @@ func (r *vendorRiskAssessmentResolver) AssessedBy(ctx context.Context, obj *type } // Organizations is the resolver for the organizations field. -func (r *viewerResolver) Organizations(ctx context.Context, obj *types.Viewer, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.OrganizationOrder) (*types.OrganizationConnection, error) { +func (r *viewerResolver) Organizations(ctx context.Context, obj *types.Viewer, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.OrganizationOrder, filter *types.OrganizationFilter) (*types.OrganizationConnection, error) { user := UserFromContext(ctx) // For now, we're not using cursor pagination since we're loading all organizations @@ -3496,6 +3609,9 @@ func (r *Resolver) Task() schema.TaskResolver { return &taskResolver{r} } // TaskConnection returns schema.TaskConnectionResolver implementation. func (r *Resolver) TaskConnection() schema.TaskConnectionResolver { return &taskConnectionResolver{r} } +// TrustCenter returns schema.TrustCenterResolver implementation. +func (r *Resolver) TrustCenter() schema.TrustCenterResolver { return &trustCenterResolver{r} } + // User returns schema.UserResolver implementation. func (r *Resolver) User() schema.UserResolver { return &userResolver{r} } @@ -3547,6 +3663,7 @@ type riskResolver struct{ *Resolver } type riskConnectionResolver struct{ *Resolver } type taskResolver struct{ *Resolver } type taskConnectionResolver struct{ *Resolver } +type trustCenterResolver struct{ *Resolver } type userResolver struct{ *Resolver } type vendorResolver struct{ *Resolver } type vendorComplianceReportResolver struct{ *Resolver } diff --git a/pkg/server/api/trust/v1/gqlgen.yaml b/pkg/server/api/trust/v1/gqlgen.yaml new file mode 100644 index 000000000..c31e646ee --- /dev/null +++ b/pkg/server/api/trust/v1/gqlgen.yaml @@ -0,0 +1,29 @@ +schema: ["schema.graphql"] + +exec: + filename: "schema/schema.go" + package: "schema" + +model: + filename: "types/types.go" + package: "types" + +resolver: + layout: "follow-schema" + dir: "." + package: "trust_v1" + filename_template: "v1_resolver.go" + +autobind: [] +call_argument_directives_with_null: true + +models: + ID: + model: + - "github.com/getprobo/probo/pkg/server/api/trust/v1/types.GIDScalar" + Datetime: + model: + - "github.com/99designs/gqlgen/graphql.Time" + CursorKey: + model: + - "github.com/getprobo/probo/pkg/server/api/trust/v1/types.CursorKeyScalar" diff --git a/pkg/server/api/trust/v1/resolver.go b/pkg/server/api/trust/v1/resolver.go new file mode 100644 index 000000000..c2aab4386 --- /dev/null +++ b/pkg/server/api/trust/v1/resolver.go @@ -0,0 +1,277 @@ +//go:generate go run github.com/99designs/gqlgen generate + +// 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 trust_v1 + +import ( + "context" + "encoding/base64" + "encoding/json" + "errors" + "fmt" + "net/http" + "runtime/debug" + "time" + + "github.com/99designs/gqlgen/graphql" + "github.com/99designs/gqlgen/graphql/handler" + "github.com/99designs/gqlgen/graphql/handler/extension" + "github.com/99designs/gqlgen/graphql/handler/transport" + "github.com/99designs/gqlgen/graphql/playground" + "github.com/getprobo/probo/pkg/coredata" + "github.com/getprobo/probo/pkg/crypto/cipher" + "github.com/getprobo/probo/pkg/gid" + "github.com/getprobo/probo/pkg/securecookie" + "github.com/getprobo/probo/pkg/server/api/trust/v1/schema" + "github.com/getprobo/probo/pkg/server/api/trust/v1/types" + "github.com/getprobo/probo/pkg/trust" + "github.com/getprobo/probo/pkg/usrmgr" + "github.com/go-chi/chi/v5" + "go.gearno.de/kit/httpserver" + "go.gearno.de/kit/log" +) + +type ( + AuthConfig struct { + CookieName string + CookieDomain string + SessionDuration time.Duration + CookieSecret string + } + + Resolver struct { + trustCenterSvc *trust.Service + authCfg AuthConfig + } + + ctxKey struct{ name string } + + TokenAccessData struct { + TrustCenterID gid.GID + Email string + TenantID gid.TenantID + Scope string + } + + TrustCenterTokenData struct { + TrustCenterID gid.GID `json:"trust_center_id"` + Email string `json:"email"` + TenantID gid.TenantID `json:"tenant_id"` + Scope string `json:"scope"` + ExpiresAt time.Time `json:"expires_at"` + } +) + +const ( + TokenScopeTrustCenterReadOnly = "trust_center_readonly" + TokenCookieName = "trust_center_token" +) + +var ( + sessionContextKey = &ctxKey{name: "session"} + userContextKey = &ctxKey{name: "user"} + userTenantContextKey = &ctxKey{name: "user_tenants"} + tokenAccessContextKey = &ctxKey{name: "token_access"} +) + +func SessionFromContext(ctx context.Context) *coredata.Session { + session, _ := ctx.Value(sessionContextKey).(*coredata.Session) + return session +} + +func UserFromContext(ctx context.Context) *coredata.User { + user, _ := ctx.Value(userContextKey).(*coredata.User) + return user +} + +func TokenAccessFromContext(ctx context.Context) *TokenAccessData { + tokenAccess, _ := ctx.Value(tokenAccessContextKey).(*TokenAccessData) + return tokenAccess +} + +func GetCurrentUserRole(ctx context.Context) types.Role { + user := UserFromContext(ctx) + tokenAccess := TokenAccessFromContext(ctx) + + if user != nil || tokenAccess != nil { + return types.RoleUser + } + return types.RoleNone +} + +func NewMux( + logger *log.Logger, + usrmgrSvc *usrmgr.Service, + trustSvc *trust.Service, + authCfg AuthConfig, +) *chi.Mux { + r := chi.NewMux() + + encryptionKey := trustSvc.GetEncryptionKey() + + r.Handle("/graphql", graphqlHandler(logger, usrmgrSvc, trustSvc, authCfg, encryptionKey)) + + r.Handle("/playground", playground.Handler("GraphQL Playground", "/api/trust/v1/graphql")) + + r.Post("/trust-center-access/authenticate", authTokenHandler(trustSvc, authCfg, encryptionKey)) + r.Delete("/trust-center-access/logout", trustCenterLogoutHandler(authCfg)) + + return r +} + +func graphqlHandler(logger *log.Logger, usrmgrSvc *usrmgr.Service, trustSvc *trust.Service, authCfg AuthConfig, encryptionKey cipher.EncryptionKey) http.HandlerFunc { + var mb int64 = 1 << 20 + + c := schema.Config{ + Resolvers: &Resolver{ + trustCenterSvc: trustSvc, + authCfg: authCfg, + }, + } + + c.Directives.MustBeAuthenticated = func(ctx context.Context, obj interface{}, next graphql.Resolver, role *types.Role) (interface{}, error) { + currentRole := GetCurrentUserRole(ctx) + + if role != nil && *role == types.RoleUser && currentRole == types.RoleNone { + return nil, fmt.Errorf("access denied: authentication required") + } + + return next(ctx) + } + + es := schema.NewExecutableSchema(c) + + srv := handler.New(es) + + srv.AddTransport(transport.POST{}) + srv.AddTransport(transport.GET{}) + srv.AddTransport(transport.Options{}) + srv.AddTransport( + transport.MultipartForm{ + MaxMemory: 32 * mb, + MaxUploadSize: 50 * mb, + }, + ) + + srv.Use(extension.Introspection{}) + + srv.SetRecoverFunc(func(ctx context.Context, err any) error { + logger := httpserver.LoggerFromContext(ctx) + logger.Error("resolver panic", log.Any("error", err), log.Any("stack", string(debug.Stack()))) + + return errors.New("internal server error") + }) + + return WithSession(usrmgrSvc, trustSvc, authCfg, encryptionKey, srv.ServeHTTP) +} + +// TrustService returns a trust service scoped to the given tenant +func (r *Resolver) TrustService(ctx context.Context, tenantID gid.TenantID) *trust.TenantService { + return r.trustCenterSvc.WithTenant(tenantID) +} + +// GetTenantService returns a tenant service for the given tenant ID +func (r *Resolver) GetTenantService(ctx context.Context, tenantID gid.TenantID) *trust.TenantService { + return r.trustCenterSvc.WithTenant(tenantID) +} + +func WithSession(usrmgrSvc *usrmgr.Service, trustSvc *trust.Service, authCfg AuthConfig, encryptionKey cipher.EncryptionKey, next http.HandlerFunc) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + ctx := r.Context() + + cookieValue, err := securecookie.Get(r, securecookie.DefaultConfig( + authCfg.CookieName, + authCfg.CookieSecret, + )) + + if err == nil { + sessionID, err := gid.ParseGID(cookieValue) + if err == nil { + session, err := usrmgrSvc.GetSession(ctx, sessionID) + if err == nil { + user, err := usrmgrSvc.GetUserBySession(ctx, sessionID) + if err == nil { + tenantIDs, err := usrmgrSvc.ListTenantsForUserID(ctx, user.ID) + if err == nil { + ctx = context.WithValue(ctx, sessionContextKey, session) + ctx = context.WithValue(ctx, userContextKey, user) + ctx = context.WithValue(ctx, userTenantContextKey, &tenantIDs) + + next(w, r.WithContext(ctx)) + + if err := usrmgrSvc.UpdateSession(ctx, session); err != nil { + panic(fmt.Errorf("failed to update session: %w", err)) + } + return + } + } + } + } + + securecookie.Clear(w, securecookie.DefaultConfig( + authCfg.CookieName, + authCfg.CookieSecret, + )) + } + + tokenCookieValue, err := securecookie.Get(r, securecookie.Config{ + Name: TokenCookieName, + Secret: authCfg.CookieSecret, + }) + + if err == nil { + encryptedData, err := base64.StdEncoding.DecodeString(tokenCookieValue) + if err == nil { + decryptedData, err := cipher.Decrypt(encryptedData, encryptionKey) + if err == nil { + var tokenData TrustCenterTokenData + if err := json.Unmarshal(decryptedData, &tokenData); err == nil { + if time.Now().Before(tokenData.ExpiresAt) { + tenantSvc := trustSvc.WithTenant(tokenData.TenantID) + isActive, err := tenantSvc.TrustCenterAccesses.IsAccessActive(ctx, tokenData.TrustCenterID, tokenData.Email) + + if err == nil && isActive { + tokenAccess := &TokenAccessData{ + TrustCenterID: tokenData.TrustCenterID, + Email: tokenData.Email, + TenantID: tokenData.TenantID, + Scope: tokenData.Scope, + } + + ctx = context.WithValue(ctx, tokenAccessContextKey, tokenAccess) + next(w, r.WithContext(ctx)) + return + } else { + securecookie.Clear(w, securecookie.Config{ + Name: TokenCookieName, + Secret: authCfg.CookieSecret, + }) + } + } else { + securecookie.Clear(w, securecookie.Config{ + Name: TokenCookieName, + Secret: authCfg.CookieSecret, + }) + } + } + } + } + } + + // Continue without authentication for public access + next(w, r.WithContext(ctx)) + } +} diff --git a/pkg/server/api/trust/v1/schema.graphql b/pkg/server/api/trust/v1/schema.graphql new file mode 100644 index 000000000..e0392f191 --- /dev/null +++ b/pkg/server/api/trust/v1/schema.graphql @@ -0,0 +1,263 @@ +# Directives +directive @goField( + forceResolver: Boolean + name: String + omittable: Boolean +) on INPUT_FIELD_DEFINITION | FIELD_DEFINITION + +directive @goModel( + model: String + models: [String!] +) on OBJECT | INPUT_OBJECT | SCALAR | ENUM | INTERFACE | UNION + +directive @goEnum(value: String) on ENUM_VALUE + +directive @mustBeAuthenticated(role: Role = NONE) on FIELD_DEFINITION | OBJECT + +enum Role { + NONE + USER +} + +scalar Datetime +scalar CursorKey + +interface Node { + id: ID! +} + +type PageInfo { + hasNextPage: Boolean! + hasPreviousPage: Boolean! + startCursor: CursorKey + endCursor: CursorKey +} + +type Organization implements Node { + id: ID! + name: String! + logoUrl: String @goField(forceResolver: true) +} + +enum DocumentType + @goModel(model: "github.com/getprobo/probo/pkg/coredata.DocumentType") { + OTHER + @goEnum(value: "github.com/getprobo/probo/pkg/coredata.DocumentTypeOther") + ISMS @goEnum(value: "github.com/getprobo/probo/pkg/coredata.DocumentTypeISMS") + POLICY + @goEnum(value: "github.com/getprobo/probo/pkg/coredata.DocumentTypePolicy") +} + +type DocumentVersion implements Node { + id: ID! +} + +type Document implements Node { + id: ID! + title: String! + documentType: DocumentType! + versions( + first: Int + after: CursorKey + last: Int + before: CursorKey + ): DocumentVersionConnection! @goField(forceResolver: true) +} + +type DocumentConnection { + edges: [DocumentEdge!]! + pageInfo: PageInfo! +} + +type DocumentEdge { + cursor: CursorKey! + node: Document! +} + +type DocumentVersionConnection { + edges: [DocumentVersionEdge!]! + pageInfo: PageInfo! +} + +type DocumentVersionEdge { + cursor: CursorKey! + node: DocumentVersion! +} + + +type Framework implements Node { + id: ID! + name: String! +} + +type Report implements Node { + id: ID! + filename: String! + downloadUrl: String @goField(forceResolver: true) @mustBeAuthenticated(role: USER) +} + +type Audit implements Node { + id: ID! + framework: Framework! @goField(forceResolver: true) + report: Report @goField(forceResolver: true) + reportUrl: String @goField(forceResolver: true) @mustBeAuthenticated(role: USER) +} + +type AuditConnection { + edges: [AuditEdge!]! + pageInfo: PageInfo! +} + +type AuditEdge { + cursor: CursorKey! + node: Audit! +} + +enum VendorCategory + @goModel(model: "github.com/getprobo/probo/pkg/coredata.VendorCategory") { + ANALYTICS + @goEnum( + value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryAnalytics" + ) + CLOUD_MONITORING + @goEnum( + value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryCloudMonitoring" + ) + CLOUD_PROVIDER + @goEnum( + value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryCloudProvider" + ) + COLLABORATION + @goEnum( + value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryCollaboration" + ) + CUSTOMER_SUPPORT + @goEnum( + value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryCustomerSupport" + ) + DATA_STORAGE_AND_PROCESSING + @goEnum( + value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryDataStorageAndProcessing" + ) + DOCUMENT_MANAGEMENT + @goEnum( + value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryDocumentManagement" + ) + EMPLOYEE_MANAGEMENT + @goEnum( + value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryEmployeeManagement" + ) + ENGINEERING + @goEnum( + value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryEngineering" + ) + FINANCE + @goEnum( + value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryFinance" + ) + IDENTITY_PROVIDER + @goEnum( + value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryIdentityProvider" + ) + IT @goEnum(value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryIT") + MARKETING + @goEnum( + value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryMarketing" + ) + OFFICE_OPERATIONS + @goEnum( + value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryOfficeOperations" + ) + OTHER + @goEnum(value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryOther") + PASSWORD_MANAGEMENT + @goEnum( + value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryPasswordManagement" + ) + PRODUCT_AND_DESIGN + @goEnum( + value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryProductAndDesign" + ) + PROFESSIONAL_SERVICES + @goEnum( + value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryProfessionalServices" + ) + RECRUITING + @goEnum( + value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryRecruiting" + ) + SALES + @goEnum(value: "github.com/getprobo/probo/pkg/coredata.VendorCategorySales") + SECURITY + @goEnum( + value: "github.com/getprobo/probo/pkg/coredata.VendorCategorySecurity" + ) + VERSION_CONTROL + @goEnum( + value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryVersionControl" + ) +} + +type Vendor implements Node { + id: ID! + name: String! + category: VendorCategory! + websiteUrl: String + privacyPolicyUrl: String +} + +type VendorConnection { + edges: [VendorEdge!]! + pageInfo: PageInfo! +} + +type VendorEdge { + cursor: CursorKey! + node: Vendor! +} + +type TrustCenter implements Node { + id: ID! + active: Boolean! + slug: String! + organization: Organization! @goField(forceResolver: true) + + documents( + first: Int + after: CursorKey + last: Int + before: CursorKey + ): DocumentConnection! @goField(forceResolver: true) + + audits( + first: Int + after: CursorKey + last: Int + before: CursorKey + ): AuditConnection! @goField(forceResolver: true) + + vendors( + first: Int + after: CursorKey + last: Int + before: CursorKey + ): VendorConnection! @goField(forceResolver: true) +} + +input ExportDocumentVersionPDFInput { + documentVersionId: ID! +} + +type ExportDocumentVersionPDFPayload { + data: String! +} + +type Query { + trustCenterBySlug(slug: String!): TrustCenter @mustBeAuthenticated(role: NONE) +} + +type Mutation { + exportDocumentVersionPDF( + input: ExportDocumentVersionPDFInput! + ): ExportDocumentVersionPDFPayload! @mustBeAuthenticated(role: USER) +} diff --git a/pkg/server/api/trust/v1/schema/schema.go b/pkg/server/api/trust/v1/schema/schema.go new file mode 100644 index 000000000..2c61e04bf --- /dev/null +++ b/pkg/server/api/trust/v1/schema/schema.go @@ -0,0 +1,9013 @@ +// Code generated by github.com/99designs/gqlgen, DO NOT EDIT. + +package schema + +import ( + "bytes" + "context" + "errors" + "fmt" + "strconv" + "sync" + "sync/atomic" + + "github.com/99designs/gqlgen/graphql" + "github.com/99designs/gqlgen/graphql/introspection" + "github.com/getprobo/probo/pkg/coredata" + "github.com/getprobo/probo/pkg/gid" + "github.com/getprobo/probo/pkg/page" + "github.com/getprobo/probo/pkg/server/api/trust/v1/types" + gqlparser "github.com/vektah/gqlparser/v2" + "github.com/vektah/gqlparser/v2/ast" +) + +// region ************************** generated!.gotpl ************************** + +// NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface. +func NewExecutableSchema(cfg Config) graphql.ExecutableSchema { + return &executableSchema{ + schema: cfg.Schema, + resolvers: cfg.Resolvers, + directives: cfg.Directives, + complexity: cfg.Complexity, + } +} + +type Config struct { + Schema *ast.Schema + Resolvers ResolverRoot + Directives DirectiveRoot + Complexity ComplexityRoot +} + +type ResolverRoot interface { + Audit() AuditResolver + Document() DocumentResolver + Mutation() MutationResolver + Organization() OrganizationResolver + Query() QueryResolver + Report() ReportResolver + TrustCenter() TrustCenterResolver +} + +type DirectiveRoot struct { + MustBeAuthenticated func(ctx context.Context, obj any, next graphql.Resolver, role *types.Role) (res any, err error) +} + +type ComplexityRoot struct { + Audit struct { + Framework func(childComplexity int) int + ID func(childComplexity int) int + Report func(childComplexity int) int + ReportURL func(childComplexity int) int + } + + AuditConnection struct { + Edges func(childComplexity int) int + PageInfo func(childComplexity int) int + } + + AuditEdge struct { + Cursor func(childComplexity int) int + Node func(childComplexity int) int + } + + Document struct { + DocumentType func(childComplexity int) int + ID func(childComplexity int) int + Title func(childComplexity int) int + Versions func(childComplexity int, first *int, after *page.CursorKey, last *int, before *page.CursorKey) int + } + + DocumentConnection struct { + Edges func(childComplexity int) int + PageInfo func(childComplexity int) int + } + + DocumentEdge struct { + Cursor func(childComplexity int) int + Node func(childComplexity int) int + } + + DocumentVersion struct { + ID func(childComplexity int) int + } + + DocumentVersionConnection struct { + Edges func(childComplexity int) int + PageInfo func(childComplexity int) int + } + + DocumentVersionEdge struct { + Cursor func(childComplexity int) int + Node func(childComplexity int) int + } + + ExportDocumentVersionPDFPayload struct { + Data func(childComplexity int) int + } + + Framework struct { + ID func(childComplexity int) int + Name func(childComplexity int) int + } + + Mutation struct { + ExportDocumentVersionPDF func(childComplexity int, input types.ExportDocumentVersionPDFInput) int + } + + Organization struct { + ID func(childComplexity int) int + LogoURL func(childComplexity int) int + Name func(childComplexity int) int + } + + PageInfo struct { + EndCursor func(childComplexity int) int + HasNextPage func(childComplexity int) int + HasPreviousPage func(childComplexity int) int + StartCursor func(childComplexity int) int + } + + Query struct { + TrustCenterBySlug func(childComplexity int, slug string) int + } + + Report struct { + DownloadURL func(childComplexity int) int + Filename func(childComplexity int) int + ID func(childComplexity int) int + } + + TrustCenter struct { + Active func(childComplexity int) int + Audits func(childComplexity int, first *int, after *page.CursorKey, last *int, before *page.CursorKey) int + Documents func(childComplexity int, first *int, after *page.CursorKey, last *int, before *page.CursorKey) int + ID func(childComplexity int) int + Organization func(childComplexity int) int + Slug func(childComplexity int) int + Vendors func(childComplexity int, first *int, after *page.CursorKey, last *int, before *page.CursorKey) int + } + + Vendor struct { + Category func(childComplexity int) int + ID func(childComplexity int) int + Name func(childComplexity int) int + PrivacyPolicyURL func(childComplexity int) int + WebsiteURL func(childComplexity int) int + } + + VendorConnection struct { + Edges func(childComplexity int) int + PageInfo func(childComplexity int) int + } + + VendorEdge struct { + Cursor func(childComplexity int) int + Node func(childComplexity int) int + } +} + +type AuditResolver interface { + Framework(ctx context.Context, obj *types.Audit) (*types.Framework, error) + Report(ctx context.Context, obj *types.Audit) (*types.Report, error) + ReportURL(ctx context.Context, obj *types.Audit) (*string, error) +} +type DocumentResolver interface { + Versions(ctx context.Context, obj *types.Document, first *int, after *page.CursorKey, last *int, before *page.CursorKey) (*types.DocumentVersionConnection, error) +} +type MutationResolver interface { + ExportDocumentVersionPDF(ctx context.Context, input types.ExportDocumentVersionPDFInput) (*types.ExportDocumentVersionPDFPayload, error) +} +type OrganizationResolver interface { + LogoURL(ctx context.Context, obj *types.Organization) (*string, error) +} +type QueryResolver interface { + TrustCenterBySlug(ctx context.Context, slug string) (*types.TrustCenter, error) +} +type ReportResolver interface { + DownloadURL(ctx context.Context, obj *types.Report) (*string, error) +} +type TrustCenterResolver interface { + Organization(ctx context.Context, obj *types.TrustCenter) (*types.Organization, error) + Documents(ctx context.Context, obj *types.TrustCenter, first *int, after *page.CursorKey, last *int, before *page.CursorKey) (*types.DocumentConnection, error) + Audits(ctx context.Context, obj *types.TrustCenter, first *int, after *page.CursorKey, last *int, before *page.CursorKey) (*types.AuditConnection, error) + Vendors(ctx context.Context, obj *types.TrustCenter, first *int, after *page.CursorKey, last *int, before *page.CursorKey) (*types.VendorConnection, error) +} + +type executableSchema struct { + schema *ast.Schema + resolvers ResolverRoot + directives DirectiveRoot + complexity ComplexityRoot +} + +func (e *executableSchema) Schema() *ast.Schema { + if e.schema != nil { + return e.schema + } + return parsedSchema +} + +func (e *executableSchema) Complexity(ctx context.Context, typeName, field string, childComplexity int, rawArgs map[string]any) (int, bool) { + ec := executionContext{nil, e, 0, 0, nil} + _ = ec + switch typeName + "." + field { + + case "Audit.framework": + if e.complexity.Audit.Framework == nil { + break + } + + return e.complexity.Audit.Framework(childComplexity), true + + case "Audit.id": + if e.complexity.Audit.ID == nil { + break + } + + return e.complexity.Audit.ID(childComplexity), true + + case "Audit.report": + if e.complexity.Audit.Report == nil { + break + } + + return e.complexity.Audit.Report(childComplexity), true + + case "Audit.reportUrl": + if e.complexity.Audit.ReportURL == nil { + break + } + + return e.complexity.Audit.ReportURL(childComplexity), true + + case "AuditConnection.edges": + if e.complexity.AuditConnection.Edges == nil { + break + } + + return e.complexity.AuditConnection.Edges(childComplexity), true + + case "AuditConnection.pageInfo": + if e.complexity.AuditConnection.PageInfo == nil { + break + } + + return e.complexity.AuditConnection.PageInfo(childComplexity), true + + case "AuditEdge.cursor": + if e.complexity.AuditEdge.Cursor == nil { + break + } + + return e.complexity.AuditEdge.Cursor(childComplexity), true + + case "AuditEdge.node": + if e.complexity.AuditEdge.Node == nil { + break + } + + return e.complexity.AuditEdge.Node(childComplexity), true + + case "Document.documentType": + if e.complexity.Document.DocumentType == nil { + break + } + + return e.complexity.Document.DocumentType(childComplexity), true + + case "Document.id": + if e.complexity.Document.ID == nil { + break + } + + return e.complexity.Document.ID(childComplexity), true + + case "Document.title": + if e.complexity.Document.Title == nil { + break + } + + return e.complexity.Document.Title(childComplexity), true + + case "Document.versions": + if e.complexity.Document.Versions == nil { + break + } + + args, err := ec.field_Document_versions_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Document.Versions(childComplexity, args["first"].(*int), args["after"].(*page.CursorKey), args["last"].(*int), args["before"].(*page.CursorKey)), true + + case "DocumentConnection.edges": + if e.complexity.DocumentConnection.Edges == nil { + break + } + + return e.complexity.DocumentConnection.Edges(childComplexity), true + + case "DocumentConnection.pageInfo": + if e.complexity.DocumentConnection.PageInfo == nil { + break + } + + return e.complexity.DocumentConnection.PageInfo(childComplexity), true + + case "DocumentEdge.cursor": + if e.complexity.DocumentEdge.Cursor == nil { + break + } + + return e.complexity.DocumentEdge.Cursor(childComplexity), true + + case "DocumentEdge.node": + if e.complexity.DocumentEdge.Node == nil { + break + } + + return e.complexity.DocumentEdge.Node(childComplexity), true + + case "DocumentVersion.id": + if e.complexity.DocumentVersion.ID == nil { + break + } + + return e.complexity.DocumentVersion.ID(childComplexity), true + + case "DocumentVersionConnection.edges": + if e.complexity.DocumentVersionConnection.Edges == nil { + break + } + + return e.complexity.DocumentVersionConnection.Edges(childComplexity), true + + case "DocumentVersionConnection.pageInfo": + if e.complexity.DocumentVersionConnection.PageInfo == nil { + break + } + + return e.complexity.DocumentVersionConnection.PageInfo(childComplexity), true + + case "DocumentVersionEdge.cursor": + if e.complexity.DocumentVersionEdge.Cursor == nil { + break + } + + return e.complexity.DocumentVersionEdge.Cursor(childComplexity), true + + case "DocumentVersionEdge.node": + if e.complexity.DocumentVersionEdge.Node == nil { + break + } + + return e.complexity.DocumentVersionEdge.Node(childComplexity), true + + case "ExportDocumentVersionPDFPayload.data": + if e.complexity.ExportDocumentVersionPDFPayload.Data == nil { + break + } + + return e.complexity.ExportDocumentVersionPDFPayload.Data(childComplexity), true + + case "Framework.id": + if e.complexity.Framework.ID == nil { + break + } + + return e.complexity.Framework.ID(childComplexity), true + + case "Framework.name": + if e.complexity.Framework.Name == nil { + break + } + + return e.complexity.Framework.Name(childComplexity), true + + case "Mutation.exportDocumentVersionPDF": + if e.complexity.Mutation.ExportDocumentVersionPDF == nil { + break + } + + args, err := ec.field_Mutation_exportDocumentVersionPDF_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.ExportDocumentVersionPDF(childComplexity, args["input"].(types.ExportDocumentVersionPDFInput)), true + + case "Organization.id": + if e.complexity.Organization.ID == nil { + break + } + + return e.complexity.Organization.ID(childComplexity), true + + case "Organization.logoUrl": + if e.complexity.Organization.LogoURL == nil { + break + } + + return e.complexity.Organization.LogoURL(childComplexity), true + + case "Organization.name": + if e.complexity.Organization.Name == nil { + break + } + + return e.complexity.Organization.Name(childComplexity), true + + case "PageInfo.endCursor": + if e.complexity.PageInfo.EndCursor == nil { + break + } + + return e.complexity.PageInfo.EndCursor(childComplexity), true + + case "PageInfo.hasNextPage": + if e.complexity.PageInfo.HasNextPage == nil { + break + } + + return e.complexity.PageInfo.HasNextPage(childComplexity), true + + case "PageInfo.hasPreviousPage": + if e.complexity.PageInfo.HasPreviousPage == nil { + break + } + + return e.complexity.PageInfo.HasPreviousPage(childComplexity), true + + case "PageInfo.startCursor": + if e.complexity.PageInfo.StartCursor == nil { + break + } + + return e.complexity.PageInfo.StartCursor(childComplexity), true + + case "Query.trustCenterBySlug": + if e.complexity.Query.TrustCenterBySlug == nil { + break + } + + args, err := ec.field_Query_trustCenterBySlug_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.TrustCenterBySlug(childComplexity, args["slug"].(string)), true + + case "Report.downloadUrl": + if e.complexity.Report.DownloadURL == nil { + break + } + + return e.complexity.Report.DownloadURL(childComplexity), true + + case "Report.filename": + if e.complexity.Report.Filename == nil { + break + } + + return e.complexity.Report.Filename(childComplexity), true + + case "Report.id": + if e.complexity.Report.ID == nil { + break + } + + return e.complexity.Report.ID(childComplexity), true + + case "TrustCenter.active": + if e.complexity.TrustCenter.Active == nil { + break + } + + return e.complexity.TrustCenter.Active(childComplexity), true + + case "TrustCenter.audits": + if e.complexity.TrustCenter.Audits == nil { + break + } + + args, err := ec.field_TrustCenter_audits_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.TrustCenter.Audits(childComplexity, args["first"].(*int), args["after"].(*page.CursorKey), args["last"].(*int), args["before"].(*page.CursorKey)), true + + case "TrustCenter.documents": + if e.complexity.TrustCenter.Documents == nil { + break + } + + args, err := ec.field_TrustCenter_documents_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.TrustCenter.Documents(childComplexity, args["first"].(*int), args["after"].(*page.CursorKey), args["last"].(*int), args["before"].(*page.CursorKey)), true + + case "TrustCenter.id": + if e.complexity.TrustCenter.ID == nil { + break + } + + return e.complexity.TrustCenter.ID(childComplexity), true + + case "TrustCenter.organization": + if e.complexity.TrustCenter.Organization == nil { + break + } + + return e.complexity.TrustCenter.Organization(childComplexity), true + + case "TrustCenter.slug": + if e.complexity.TrustCenter.Slug == nil { + break + } + + return e.complexity.TrustCenter.Slug(childComplexity), true + + case "TrustCenter.vendors": + if e.complexity.TrustCenter.Vendors == nil { + break + } + + args, err := ec.field_TrustCenter_vendors_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.TrustCenter.Vendors(childComplexity, args["first"].(*int), args["after"].(*page.CursorKey), args["last"].(*int), args["before"].(*page.CursorKey)), true + + case "Vendor.category": + if e.complexity.Vendor.Category == nil { + break + } + + return e.complexity.Vendor.Category(childComplexity), true + + case "Vendor.id": + if e.complexity.Vendor.ID == nil { + break + } + + return e.complexity.Vendor.ID(childComplexity), true + + case "Vendor.name": + if e.complexity.Vendor.Name == nil { + break + } + + return e.complexity.Vendor.Name(childComplexity), true + + case "Vendor.privacyPolicyUrl": + if e.complexity.Vendor.PrivacyPolicyURL == nil { + break + } + + return e.complexity.Vendor.PrivacyPolicyURL(childComplexity), true + + case "Vendor.websiteUrl": + if e.complexity.Vendor.WebsiteURL == nil { + break + } + + return e.complexity.Vendor.WebsiteURL(childComplexity), true + + case "VendorConnection.edges": + if e.complexity.VendorConnection.Edges == nil { + break + } + + return e.complexity.VendorConnection.Edges(childComplexity), true + + case "VendorConnection.pageInfo": + if e.complexity.VendorConnection.PageInfo == nil { + break + } + + return e.complexity.VendorConnection.PageInfo(childComplexity), true + + case "VendorEdge.cursor": + if e.complexity.VendorEdge.Cursor == nil { + break + } + + return e.complexity.VendorEdge.Cursor(childComplexity), true + + case "VendorEdge.node": + if e.complexity.VendorEdge.Node == nil { + break + } + + return e.complexity.VendorEdge.Node(childComplexity), true + + } + return 0, false +} + +func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { + opCtx := graphql.GetOperationContext(ctx) + ec := executionContext{opCtx, e, 0, 0, make(chan graphql.DeferredResult)} + inputUnmarshalMap := graphql.BuildUnmarshalerMap( + ec.unmarshalInputExportDocumentVersionPDFInput, + ) + first := true + + switch opCtx.Operation.Operation { + case ast.Query: + return func(ctx context.Context) *graphql.Response { + var response graphql.Response + var data graphql.Marshaler + if first { + first = false + ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) + data = ec._Query(ctx, opCtx.Operation.SelectionSet) + } else { + if atomic.LoadInt32(&ec.pendingDeferred) > 0 { + result := <-ec.deferredResults + atomic.AddInt32(&ec.pendingDeferred, -1) + data = result.Result + response.Path = result.Path + response.Label = result.Label + response.Errors = result.Errors + } else { + return nil + } + } + var buf bytes.Buffer + data.MarshalGQL(&buf) + response.Data = buf.Bytes() + if atomic.LoadInt32(&ec.deferred) > 0 { + hasNext := atomic.LoadInt32(&ec.pendingDeferred) > 0 + response.HasNext = &hasNext + } + + return &response + } + case ast.Mutation: + return func(ctx context.Context) *graphql.Response { + if !first { + return nil + } + first = false + ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) + data := ec._Mutation(ctx, opCtx.Operation.SelectionSet) + var buf bytes.Buffer + data.MarshalGQL(&buf) + + return &graphql.Response{ + Data: buf.Bytes(), + } + } + + default: + return graphql.OneShot(graphql.ErrorResponse(ctx, "unsupported GraphQL operation")) + } +} + +type executionContext struct { + *graphql.OperationContext + *executableSchema + deferred int32 + pendingDeferred int32 + deferredResults chan graphql.DeferredResult +} + +func (ec *executionContext) processDeferredGroup(dg graphql.DeferredGroup) { + atomic.AddInt32(&ec.pendingDeferred, 1) + go func() { + ctx := graphql.WithFreshResponseContext(dg.Context) + dg.FieldSet.Dispatch(ctx) + ds := graphql.DeferredResult{ + Path: dg.Path, + Label: dg.Label, + Result: dg.FieldSet, + Errors: graphql.GetErrors(ctx), + } + // null fields should bubble up + if dg.FieldSet.Invalids > 0 { + ds.Result = graphql.Null + } + ec.deferredResults <- ds + }() +} + +func (ec *executionContext) introspectSchema() (*introspection.Schema, error) { + if ec.DisableIntrospection { + return nil, errors.New("introspection disabled") + } + return introspection.WrapSchema(ec.Schema()), nil +} + +func (ec *executionContext) introspectType(name string) (*introspection.Type, error) { + if ec.DisableIntrospection { + return nil, errors.New("introspection disabled") + } + return introspection.WrapTypeFromDef(ec.Schema(), ec.Schema().Types[name]), nil +} + +var sources = []*ast.Source{ + {Name: "../schema.graphql", Input: `# Directives +directive @goField( + forceResolver: Boolean + name: String + omittable: Boolean +) on INPUT_FIELD_DEFINITION | FIELD_DEFINITION + +directive @goModel( + model: String + models: [String!] +) on OBJECT | INPUT_OBJECT | SCALAR | ENUM | INTERFACE | UNION + +directive @goEnum(value: String) on ENUM_VALUE + +directive @mustBeAuthenticated(role: Role = NONE) on FIELD_DEFINITION | OBJECT + +enum Role { + NONE + USER +} + +scalar Datetime +scalar CursorKey + +interface Node { + id: ID! +} + +type PageInfo { + hasNextPage: Boolean! + hasPreviousPage: Boolean! + startCursor: CursorKey + endCursor: CursorKey +} + +type Organization implements Node { + id: ID! + name: String! + logoUrl: String @goField(forceResolver: true) +} + +enum DocumentType + @goModel(model: "github.com/getprobo/probo/pkg/coredata.DocumentType") { + OTHER + @goEnum(value: "github.com/getprobo/probo/pkg/coredata.DocumentTypeOther") + ISMS @goEnum(value: "github.com/getprobo/probo/pkg/coredata.DocumentTypeISMS") + POLICY + @goEnum(value: "github.com/getprobo/probo/pkg/coredata.DocumentTypePolicy") +} + +type DocumentVersion implements Node { + id: ID! +} + +type Document implements Node { + id: ID! + title: String! + documentType: DocumentType! + versions( + first: Int + after: CursorKey + last: Int + before: CursorKey + ): DocumentVersionConnection! @goField(forceResolver: true) +} + +type DocumentConnection { + edges: [DocumentEdge!]! + pageInfo: PageInfo! +} + +type DocumentEdge { + cursor: CursorKey! + node: Document! +} + +type DocumentVersionConnection { + edges: [DocumentVersionEdge!]! + pageInfo: PageInfo! +} + +type DocumentVersionEdge { + cursor: CursorKey! + node: DocumentVersion! +} + + +type Framework implements Node { + id: ID! + name: String! +} + +type Report implements Node { + id: ID! + filename: String! + downloadUrl: String @goField(forceResolver: true) @mustBeAuthenticated(role: USER) +} + +type Audit implements Node { + id: ID! + framework: Framework! @goField(forceResolver: true) + report: Report @goField(forceResolver: true) + reportUrl: String @goField(forceResolver: true) @mustBeAuthenticated(role: USER) +} + +type AuditConnection { + edges: [AuditEdge!]! + pageInfo: PageInfo! +} + +type AuditEdge { + cursor: CursorKey! + node: Audit! +} + +enum VendorCategory + @goModel(model: "github.com/getprobo/probo/pkg/coredata.VendorCategory") { + ANALYTICS + @goEnum( + value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryAnalytics" + ) + CLOUD_MONITORING + @goEnum( + value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryCloudMonitoring" + ) + CLOUD_PROVIDER + @goEnum( + value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryCloudProvider" + ) + COLLABORATION + @goEnum( + value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryCollaboration" + ) + CUSTOMER_SUPPORT + @goEnum( + value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryCustomerSupport" + ) + DATA_STORAGE_AND_PROCESSING + @goEnum( + value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryDataStorageAndProcessing" + ) + DOCUMENT_MANAGEMENT + @goEnum( + value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryDocumentManagement" + ) + EMPLOYEE_MANAGEMENT + @goEnum( + value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryEmployeeManagement" + ) + ENGINEERING + @goEnum( + value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryEngineering" + ) + FINANCE + @goEnum( + value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryFinance" + ) + IDENTITY_PROVIDER + @goEnum( + value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryIdentityProvider" + ) + IT @goEnum(value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryIT") + MARKETING + @goEnum( + value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryMarketing" + ) + OFFICE_OPERATIONS + @goEnum( + value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryOfficeOperations" + ) + OTHER + @goEnum(value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryOther") + PASSWORD_MANAGEMENT + @goEnum( + value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryPasswordManagement" + ) + PRODUCT_AND_DESIGN + @goEnum( + value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryProductAndDesign" + ) + PROFESSIONAL_SERVICES + @goEnum( + value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryProfessionalServices" + ) + RECRUITING + @goEnum( + value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryRecruiting" + ) + SALES + @goEnum(value: "github.com/getprobo/probo/pkg/coredata.VendorCategorySales") + SECURITY + @goEnum( + value: "github.com/getprobo/probo/pkg/coredata.VendorCategorySecurity" + ) + VERSION_CONTROL + @goEnum( + value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryVersionControl" + ) +} + +type Vendor implements Node { + id: ID! + name: String! + category: VendorCategory! + websiteUrl: String + privacyPolicyUrl: String +} + +type VendorConnection { + edges: [VendorEdge!]! + pageInfo: PageInfo! +} + +type VendorEdge { + cursor: CursorKey! + node: Vendor! +} + +type TrustCenter implements Node { + id: ID! + active: Boolean! + slug: String! + organization: Organization! @goField(forceResolver: true) + + documents( + first: Int + after: CursorKey + last: Int + before: CursorKey + ): DocumentConnection! @goField(forceResolver: true) + + audits( + first: Int + after: CursorKey + last: Int + before: CursorKey + ): AuditConnection! @goField(forceResolver: true) + + vendors( + first: Int + after: CursorKey + last: Int + before: CursorKey + ): VendorConnection! @goField(forceResolver: true) +} + +input ExportDocumentVersionPDFInput { + documentVersionId: ID! +} + +type ExportDocumentVersionPDFPayload { + data: String! +} + +type Query { + trustCenterBySlug(slug: String!): TrustCenter @mustBeAuthenticated(role: NONE) +} + +type Mutation { + exportDocumentVersionPDF( + input: ExportDocumentVersionPDFInput! + ): ExportDocumentVersionPDFPayload! @mustBeAuthenticated(role: USER) +} +`, BuiltIn: false}, +} +var parsedSchema = gqlparser.MustLoadSchema(sources...) + +// endregion ************************** generated!.gotpl ************************** + +// region ***************************** args.gotpl ***************************** + +func (ec *executionContext) dir_mustBeAuthenticated_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := ec.dir_mustBeAuthenticated_argsRole(ctx, rawArgs) + if err != nil { + return nil, err + } + args["role"] = arg0 + return args, nil +} +func (ec *executionContext) dir_mustBeAuthenticated_argsRole( + ctx context.Context, + rawArgs map[string]any, +) (*types.Role, error) { + if _, ok := rawArgs["role"]; !ok { + var zeroVal *types.Role + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("role")) + if tmp, ok := rawArgs["role"]; ok { + return ec.unmarshalORole2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐRole(ctx, tmp) + } + + var zeroVal *types.Role + return zeroVal, nil +} + +func (ec *executionContext) field_Document_versions_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := ec.field_Document_versions_argsFirst(ctx, rawArgs) + if err != nil { + return nil, err + } + args["first"] = arg0 + arg1, err := ec.field_Document_versions_argsAfter(ctx, rawArgs) + if err != nil { + return nil, err + } + args["after"] = arg1 + arg2, err := ec.field_Document_versions_argsLast(ctx, rawArgs) + if err != nil { + return nil, err + } + args["last"] = arg2 + arg3, err := ec.field_Document_versions_argsBefore(ctx, rawArgs) + if err != nil { + return nil, err + } + args["before"] = arg3 + return args, nil +} +func (ec *executionContext) field_Document_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_Document_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_Document_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_Document_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_Mutation_exportDocumentVersionPDF_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := ec.field_Mutation_exportDocumentVersionPDF_argsInput(ctx, rawArgs) + if err != nil { + return nil, err + } + args["input"] = arg0 + return args, nil +} +func (ec *executionContext) field_Mutation_exportDocumentVersionPDF_argsInput( + ctx context.Context, + rawArgs map[string]any, +) (types.ExportDocumentVersionPDFInput, error) { + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) + if tmp, ok := rawArgs["input"]; ok { + return ec.unmarshalNExportDocumentVersionPDFInput2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐExportDocumentVersionPDFInput(ctx, tmp) + } + + var zeroVal types.ExportDocumentVersionPDFInput + 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{} + arg0, err := ec.field_Query___type_argsName(ctx, rawArgs) + if err != nil { + return nil, err + } + args["name"] = arg0 + return args, nil +} +func (ec *executionContext) field_Query___type_argsName( + ctx context.Context, + rawArgs map[string]any, +) (string, error) { + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + if tmp, ok := rawArgs["name"]; ok { + return ec.unmarshalNString2string(ctx, tmp) + } + + var zeroVal string + return zeroVal, nil +} + +func (ec *executionContext) field_Query_trustCenterBySlug_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := ec.field_Query_trustCenterBySlug_argsSlug(ctx, rawArgs) + if err != nil { + return nil, err + } + args["slug"] = arg0 + return args, nil +} +func (ec *executionContext) field_Query_trustCenterBySlug_argsSlug( + ctx context.Context, + rawArgs map[string]any, +) (string, error) { + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("slug")) + if tmp, ok := rawArgs["slug"]; ok { + return ec.unmarshalNString2string(ctx, tmp) + } + + var zeroVal string + return zeroVal, nil +} + +func (ec *executionContext) field_TrustCenter_audits_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := ec.field_TrustCenter_audits_argsFirst(ctx, rawArgs) + if err != nil { + return nil, err + } + args["first"] = arg0 + arg1, err := ec.field_TrustCenter_audits_argsAfter(ctx, rawArgs) + if err != nil { + return nil, err + } + args["after"] = arg1 + arg2, err := ec.field_TrustCenter_audits_argsLast(ctx, rawArgs) + if err != nil { + return nil, err + } + args["last"] = arg2 + arg3, err := ec.field_TrustCenter_audits_argsBefore(ctx, rawArgs) + if err != nil { + return nil, err + } + args["before"] = arg3 + return args, nil +} +func (ec *executionContext) field_TrustCenter_audits_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_TrustCenter_audits_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_TrustCenter_audits_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_TrustCenter_audits_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_TrustCenter_documents_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := ec.field_TrustCenter_documents_argsFirst(ctx, rawArgs) + if err != nil { + return nil, err + } + args["first"] = arg0 + arg1, err := ec.field_TrustCenter_documents_argsAfter(ctx, rawArgs) + if err != nil { + return nil, err + } + args["after"] = arg1 + arg2, err := ec.field_TrustCenter_documents_argsLast(ctx, rawArgs) + if err != nil { + return nil, err + } + args["last"] = arg2 + arg3, err := ec.field_TrustCenter_documents_argsBefore(ctx, rawArgs) + if err != nil { + return nil, err + } + args["before"] = arg3 + return args, nil +} +func (ec *executionContext) field_TrustCenter_documents_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_TrustCenter_documents_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_TrustCenter_documents_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_TrustCenter_documents_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_TrustCenter_vendors_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := ec.field_TrustCenter_vendors_argsFirst(ctx, rawArgs) + if err != nil { + return nil, err + } + args["first"] = arg0 + arg1, err := ec.field_TrustCenter_vendors_argsAfter(ctx, rawArgs) + if err != nil { + return nil, err + } + args["after"] = arg1 + arg2, err := ec.field_TrustCenter_vendors_argsLast(ctx, rawArgs) + if err != nil { + return nil, err + } + args["last"] = arg2 + arg3, err := ec.field_TrustCenter_vendors_argsBefore(ctx, rawArgs) + if err != nil { + return nil, err + } + args["before"] = arg3 + return args, nil +} +func (ec *executionContext) field_TrustCenter_vendors_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_TrustCenter_vendors_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_TrustCenter_vendors_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_TrustCenter_vendors_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___Directive_args_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := ec.field___Directive_args_argsIncludeDeprecated(ctx, rawArgs) + if err != nil { + return nil, err + } + args["includeDeprecated"] = arg0 + return args, nil +} +func (ec *executionContext) field___Directive_args_argsIncludeDeprecated( + ctx context.Context, + rawArgs map[string]any, +) (*bool, error) { + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) + if tmp, ok := rawArgs["includeDeprecated"]; ok { + return ec.unmarshalOBoolean2ᚖbool(ctx, tmp) + } + + var zeroVal *bool + return zeroVal, nil +} + +func (ec *executionContext) field___Field_args_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := ec.field___Field_args_argsIncludeDeprecated(ctx, rawArgs) + if err != nil { + return nil, err + } + args["includeDeprecated"] = arg0 + return args, nil +} +func (ec *executionContext) field___Field_args_argsIncludeDeprecated( + ctx context.Context, + rawArgs map[string]any, +) (*bool, error) { + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) + if tmp, ok := rawArgs["includeDeprecated"]; ok { + return ec.unmarshalOBoolean2ᚖbool(ctx, tmp) + } + + var zeroVal *bool + return zeroVal, nil +} + +func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := ec.field___Type_enumValues_argsIncludeDeprecated(ctx, rawArgs) + if err != nil { + return nil, err + } + args["includeDeprecated"] = arg0 + return args, nil +} +func (ec *executionContext) field___Type_enumValues_argsIncludeDeprecated( + ctx context.Context, + rawArgs map[string]any, +) (bool, error) { + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) + if tmp, ok := rawArgs["includeDeprecated"]; ok { + return ec.unmarshalOBoolean2bool(ctx, tmp) + } + + var zeroVal bool + return zeroVal, nil +} + +func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := ec.field___Type_fields_argsIncludeDeprecated(ctx, rawArgs) + if err != nil { + return nil, err + } + args["includeDeprecated"] = arg0 + return args, nil +} +func (ec *executionContext) field___Type_fields_argsIncludeDeprecated( + ctx context.Context, + rawArgs map[string]any, +) (bool, error) { + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) + if tmp, ok := rawArgs["includeDeprecated"]; ok { + return ec.unmarshalOBoolean2bool(ctx, tmp) + } + + var zeroVal bool + return zeroVal, nil +} + +// endregion ***************************** args.gotpl ***************************** + +// region ************************** directives.gotpl ************************** + +// endregion ************************** directives.gotpl ************************** + +// region **************************** field.gotpl ***************************** + +func (ec *executionContext) _Audit_id(ctx context.Context, field graphql.CollectedField, obj *types.Audit) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Audit_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_Audit_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Audit", + 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) _Audit_framework(ctx context.Context, field graphql.CollectedField, obj *types.Audit) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Audit_framework(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.Audit().Framework(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.Framework) + fc.Result = res + return ec.marshalNFramework2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐFramework(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Audit_framework(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Audit", + 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_Framework_id(ctx, field) + case "name": + return ec.fieldContext_Framework_name(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Framework", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Audit_report(ctx context.Context, field graphql.CollectedField, obj *types.Audit) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Audit_report(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.Audit().Report(rctx, obj) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*types.Report) + fc.Result = res + return ec.marshalOReport2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐReport(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Audit_report(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Audit", + 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_Report_id(ctx, field) + case "filename": + return ec.fieldContext_Report_filename(ctx, field) + case "downloadUrl": + return ec.fieldContext_Report_downloadUrl(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Report", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Audit_reportUrl(ctx context.Context, field graphql.CollectedField, obj *types.Audit) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Audit_reportUrl(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) { + directive0 := func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Audit().ReportURL(rctx, obj) + } + + directive1 := func(ctx context.Context) (any, error) { + role, err := ec.unmarshalORole2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐRole(ctx, "USER") + if err != nil { + var zeroVal *string + return zeroVal, err + } + if ec.directives.MustBeAuthenticated == nil { + var zeroVal *string + return zeroVal, errors.New("directive mustBeAuthenticated is not implemented") + } + return ec.directives.MustBeAuthenticated(ctx, obj, directive0, role) + } + + tmp, err := directive1(rctx) + if err != nil { + return nil, graphql.ErrorOnPath(ctx, err) + } + if tmp == nil { + return nil, nil + } + if data, ok := tmp.(*string); ok { + return data, nil + } + return nil, fmt.Errorf(`unexpected type %T from directive, should be *string`, tmp) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Audit_reportUrl(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Audit", + Field: field, + IsMethod: true, + IsResolver: true, + 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) _AuditConnection_edges(ctx context.Context, field graphql.CollectedField, obj *types.AuditConnection) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_AuditConnection_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.AuditEdge) + fc.Result = res + return ec.marshalNAuditEdge2ᚕᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐAuditEdgeᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_AuditConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "AuditConnection", + 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_AuditEdge_cursor(ctx, field) + case "node": + return ec.fieldContext_AuditEdge_node(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type AuditEdge", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _AuditConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *types.AuditConnection) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_AuditConnection_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ᚋtrustᚋv1ᚋtypesᚐPageInfo(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_AuditConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "AuditConnection", + 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) _AuditEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *types.AuditEdge) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_AuditEdge_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_AuditEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "AuditEdge", + 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) _AuditEdge_node(ctx context.Context, field graphql.CollectedField, obj *types.AuditEdge) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_AuditEdge_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.Audit) + fc.Result = res + return ec.marshalNAudit2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐAudit(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_AuditEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "AuditEdge", + 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_Audit_id(ctx, field) + case "framework": + return ec.fieldContext_Audit_framework(ctx, field) + case "report": + return ec.fieldContext_Audit_report(ctx, field) + case "reportUrl": + return ec.fieldContext_Audit_reportUrl(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Audit", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Document_id(ctx context.Context, field graphql.CollectedField, obj *types.Document) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Document_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_Document_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Document", + 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) _Document_title(ctx context.Context, field graphql.CollectedField, obj *types.Document) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Document_title(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.Title, 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_Document_title(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Document", + 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) _Document_documentType(ctx context.Context, field graphql.CollectedField, obj *types.Document) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Document_documentType(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.DocumentType, 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.DocumentType) + fc.Result = res + return ec.marshalNDocumentType2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐDocumentType(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Document_documentType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Document", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type DocumentType does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Document_versions(ctx context.Context, field graphql.CollectedField, obj *types.Document) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Document_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.Document().Versions(rctx, obj, fc.Args["first"].(*int), fc.Args["after"].(*page.CursorKey), fc.Args["last"].(*int), fc.Args["before"].(*page.CursorKey)) + }) + 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.DocumentVersionConnection) + fc.Result = res + return ec.marshalNDocumentVersionConnection2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐDocumentVersionConnection(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Document_versions(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Document", + 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_DocumentVersionConnection_edges(ctx, field) + case "pageInfo": + return ec.fieldContext_DocumentVersionConnection_pageInfo(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type DocumentVersionConnection", 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_Document_versions_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _DocumentConnection_edges(ctx context.Context, field graphql.CollectedField, obj *types.DocumentConnection) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_DocumentConnection_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.DocumentEdge) + fc.Result = res + return ec.marshalNDocumentEdge2ᚕᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐDocumentEdgeᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_DocumentConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "DocumentConnection", + 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_DocumentEdge_cursor(ctx, field) + case "node": + return ec.fieldContext_DocumentEdge_node(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type DocumentEdge", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _DocumentConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *types.DocumentConnection) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_DocumentConnection_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ᚋtrustᚋv1ᚋtypesᚐPageInfo(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_DocumentConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "DocumentConnection", + 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) _DocumentEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *types.DocumentEdge) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_DocumentEdge_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_DocumentEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "DocumentEdge", + 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) _DocumentEdge_node(ctx context.Context, field graphql.CollectedField, obj *types.DocumentEdge) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_DocumentEdge_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.Document) + fc.Result = res + return ec.marshalNDocument2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐDocument(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_DocumentEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "DocumentEdge", + 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_Document_id(ctx, field) + case "title": + return ec.fieldContext_Document_title(ctx, field) + case "documentType": + return ec.fieldContext_Document_documentType(ctx, field) + case "versions": + return ec.fieldContext_Document_versions(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Document", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _DocumentVersion_id(ctx context.Context, field graphql.CollectedField, obj *types.DocumentVersion) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_DocumentVersion_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_DocumentVersion_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "DocumentVersion", + 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) _DocumentVersionConnection_edges(ctx context.Context, field graphql.CollectedField, obj *types.DocumentVersionConnection) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_DocumentVersionConnection_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.DocumentVersionEdge) + fc.Result = res + return ec.marshalNDocumentVersionEdge2ᚕᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐDocumentVersionEdgeᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_DocumentVersionConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "DocumentVersionConnection", + 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_DocumentVersionEdge_cursor(ctx, field) + case "node": + return ec.fieldContext_DocumentVersionEdge_node(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type DocumentVersionEdge", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _DocumentVersionConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *types.DocumentVersionConnection) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_DocumentVersionConnection_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ᚋtrustᚋv1ᚋtypesᚐPageInfo(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_DocumentVersionConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "DocumentVersionConnection", + 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) _DocumentVersionEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *types.DocumentVersionEdge) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_DocumentVersionEdge_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_DocumentVersionEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "DocumentVersionEdge", + 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) _DocumentVersionEdge_node(ctx context.Context, field graphql.CollectedField, obj *types.DocumentVersionEdge) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_DocumentVersionEdge_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.DocumentVersion) + fc.Result = res + return ec.marshalNDocumentVersion2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐDocumentVersion(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_DocumentVersionEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "DocumentVersionEdge", + 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_DocumentVersion_id(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type DocumentVersion", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _ExportDocumentVersionPDFPayload_data(ctx context.Context, field graphql.CollectedField, obj *types.ExportDocumentVersionPDFPayload) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ExportDocumentVersionPDFPayload_data(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.Data, 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_ExportDocumentVersionPDFPayload_data(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ExportDocumentVersionPDFPayload", + 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) _Framework_id(ctx context.Context, field graphql.CollectedField, obj *types.Framework) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Framework_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_Framework_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Framework", + 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) _Framework_name(ctx context.Context, field graphql.CollectedField, obj *types.Framework) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Framework_name(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.Name, 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_Framework_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Framework", + 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) _Mutation_exportDocumentVersionPDF(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_exportDocumentVersionPDF(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) { + directive0 := func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().ExportDocumentVersionPDF(rctx, fc.Args["input"].(types.ExportDocumentVersionPDFInput)) + } + + directive1 := func(ctx context.Context) (any, error) { + role, err := ec.unmarshalORole2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐRole(ctx, "USER") + if err != nil { + var zeroVal *types.ExportDocumentVersionPDFPayload + return zeroVal, err + } + if ec.directives.MustBeAuthenticated == nil { + var zeroVal *types.ExportDocumentVersionPDFPayload + return zeroVal, errors.New("directive mustBeAuthenticated is not implemented") + } + return ec.directives.MustBeAuthenticated(ctx, nil, directive0, role) + } + + tmp, err := directive1(rctx) + if err != nil { + return nil, graphql.ErrorOnPath(ctx, err) + } + if tmp == nil { + return nil, nil + } + if data, ok := tmp.(*types.ExportDocumentVersionPDFPayload); ok { + return data, nil + } + return nil, fmt.Errorf(`unexpected type %T from directive, should be *github.com/getprobo/probo/pkg/server/api/trust/v1/types.ExportDocumentVersionPDFPayload`, tmp) + }) + 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.ExportDocumentVersionPDFPayload) + fc.Result = res + return ec.marshalNExportDocumentVersionPDFPayload2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐExportDocumentVersionPDFPayload(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_exportDocumentVersionPDF(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 "data": + return ec.fieldContext_ExportDocumentVersionPDFPayload_data(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type ExportDocumentVersionPDFPayload", 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_exportDocumentVersionPDF_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Organization_id(ctx context.Context, field graphql.CollectedField, obj *types.Organization) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Organization_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_Organization_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Organization", + 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) _Organization_name(ctx context.Context, field graphql.CollectedField, obj *types.Organization) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Organization_name(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.Name, 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_Organization_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Organization", + 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) _Organization_logoUrl(ctx context.Context, field graphql.CollectedField, obj *types.Organization) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Organization_logoUrl(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.Organization().LogoURL(rctx, obj) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Organization_logoUrl(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Organization", + Field: field, + IsMethod: true, + IsResolver: true, + 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) _PageInfo_hasNextPage(ctx context.Context, field graphql.CollectedField, obj *types.PageInfo) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_PageInfo_hasNextPage(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.HasNextPage, 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.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_PageInfo_hasNextPage(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "PageInfo", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _PageInfo_hasPreviousPage(ctx context.Context, field graphql.CollectedField, obj *types.PageInfo) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_PageInfo_hasPreviousPage(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.HasPreviousPage, 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.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_PageInfo_hasPreviousPage(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "PageInfo", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _PageInfo_startCursor(ctx context.Context, field graphql.CollectedField, obj *types.PageInfo) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_PageInfo_startCursor(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.StartCursor, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*page.CursorKey) + fc.Result = res + return ec.marshalOCursorKey2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋpageᚐCursorKey(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_PageInfo_startCursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "PageInfo", + 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) _PageInfo_endCursor(ctx context.Context, field graphql.CollectedField, obj *types.PageInfo) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_PageInfo_endCursor(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.EndCursor, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*page.CursorKey) + fc.Result = res + return ec.marshalOCursorKey2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋpageᚐCursorKey(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_PageInfo_endCursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "PageInfo", + 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) _Query_trustCenterBySlug(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_trustCenterBySlug(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) { + directive0 := func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().TrustCenterBySlug(rctx, fc.Args["slug"].(string)) + } + + directive1 := func(ctx context.Context) (any, error) { + role, err := ec.unmarshalORole2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐRole(ctx, "NONE") + if err != nil { + var zeroVal *types.TrustCenter + return zeroVal, err + } + if ec.directives.MustBeAuthenticated == nil { + var zeroVal *types.TrustCenter + return zeroVal, errors.New("directive mustBeAuthenticated is not implemented") + } + return ec.directives.MustBeAuthenticated(ctx, nil, directive0, role) + } + + tmp, err := directive1(rctx) + if err != nil { + return nil, graphql.ErrorOnPath(ctx, err) + } + if tmp == nil { + return nil, nil + } + if data, ok := tmp.(*types.TrustCenter); ok { + return data, nil + } + return nil, fmt.Errorf(`unexpected type %T from directive, should be *github.com/getprobo/probo/pkg/server/api/trust/v1/types.TrustCenter`, tmp) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*types.TrustCenter) + fc.Result = res + return ec.marshalOTrustCenter2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐTrustCenter(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_trustCenterBySlug(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + 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_TrustCenter_id(ctx, field) + case "active": + return ec.fieldContext_TrustCenter_active(ctx, field) + case "slug": + return ec.fieldContext_TrustCenter_slug(ctx, field) + case "organization": + return ec.fieldContext_TrustCenter_organization(ctx, field) + case "documents": + return ec.fieldContext_TrustCenter_documents(ctx, field) + case "audits": + return ec.fieldContext_TrustCenter_audits(ctx, field) + case "vendors": + return ec.fieldContext_TrustCenter_vendors(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TrustCenter", 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_Query_trustCenterBySlug_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query___type(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.introspectType(fc.Args["name"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*introspection.Type) + fc.Result = res + return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query___type(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "isOneOf": + return ec.fieldContext___Type_isOneOf(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", 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_Query___type_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query___schema(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.introspectSchema() + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*introspection.Schema) + fc.Result = res + return ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query___schema(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "description": + return ec.fieldContext___Schema_description(ctx, field) + case "types": + return ec.fieldContext___Schema_types(ctx, field) + case "queryType": + return ec.fieldContext___Schema_queryType(ctx, field) + case "mutationType": + return ec.fieldContext___Schema_mutationType(ctx, field) + case "subscriptionType": + return ec.fieldContext___Schema_subscriptionType(ctx, field) + case "directives": + return ec.fieldContext___Schema_directives(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Schema", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Report_id(ctx context.Context, field graphql.CollectedField, obj *types.Report) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Report_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_Report_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Report", + 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) _Report_filename(ctx context.Context, field graphql.CollectedField, obj *types.Report) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Report_filename(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.Filename, 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_Report_filename(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Report", + 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) _Report_downloadUrl(ctx context.Context, field graphql.CollectedField, obj *types.Report) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Report_downloadUrl(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) { + directive0 := func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Report().DownloadURL(rctx, obj) + } + + directive1 := func(ctx context.Context) (any, error) { + role, err := ec.unmarshalORole2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐRole(ctx, "USER") + if err != nil { + var zeroVal *string + return zeroVal, err + } + if ec.directives.MustBeAuthenticated == nil { + var zeroVal *string + return zeroVal, errors.New("directive mustBeAuthenticated is not implemented") + } + return ec.directives.MustBeAuthenticated(ctx, obj, directive0, role) + } + + tmp, err := directive1(rctx) + if err != nil { + return nil, graphql.ErrorOnPath(ctx, err) + } + if tmp == nil { + return nil, nil + } + if data, ok := tmp.(*string); ok { + return data, nil + } + return nil, fmt.Errorf(`unexpected type %T from directive, should be *string`, tmp) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Report_downloadUrl(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Report", + Field: field, + IsMethod: true, + IsResolver: true, + 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) _TrustCenter_id(ctx context.Context, field graphql.CollectedField, obj *types.TrustCenter) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_TrustCenter_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_TrustCenter_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "TrustCenter", + 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) _TrustCenter_active(ctx context.Context, field graphql.CollectedField, obj *types.TrustCenter) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_TrustCenter_active(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.Active, 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.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_TrustCenter_active(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "TrustCenter", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _TrustCenter_slug(ctx context.Context, field graphql.CollectedField, obj *types.TrustCenter) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_TrustCenter_slug(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.Slug, 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_TrustCenter_slug(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "TrustCenter", + 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) _TrustCenter_organization(ctx context.Context, field graphql.CollectedField, obj *types.TrustCenter) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_TrustCenter_organization(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.TrustCenter().Organization(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.Organization) + fc.Result = res + return ec.marshalNOrganization2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐOrganization(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_TrustCenter_organization(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "TrustCenter", + 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_Organization_id(ctx, field) + case "name": + return ec.fieldContext_Organization_name(ctx, field) + case "logoUrl": + return ec.fieldContext_Organization_logoUrl(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Organization", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _TrustCenter_documents(ctx context.Context, field graphql.CollectedField, obj *types.TrustCenter) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_TrustCenter_documents(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.TrustCenter().Documents(rctx, obj, fc.Args["first"].(*int), fc.Args["after"].(*page.CursorKey), fc.Args["last"].(*int), fc.Args["before"].(*page.CursorKey)) + }) + 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.DocumentConnection) + fc.Result = res + return ec.marshalNDocumentConnection2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐDocumentConnection(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_TrustCenter_documents(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "TrustCenter", + 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_DocumentConnection_edges(ctx, field) + case "pageInfo": + return ec.fieldContext_DocumentConnection_pageInfo(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type DocumentConnection", 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_TrustCenter_documents_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _TrustCenter_audits(ctx context.Context, field graphql.CollectedField, obj *types.TrustCenter) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_TrustCenter_audits(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.TrustCenter().Audits(rctx, obj, fc.Args["first"].(*int), fc.Args["after"].(*page.CursorKey), fc.Args["last"].(*int), fc.Args["before"].(*page.CursorKey)) + }) + 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.AuditConnection) + fc.Result = res + return ec.marshalNAuditConnection2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐAuditConnection(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_TrustCenter_audits(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "TrustCenter", + 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_AuditConnection_edges(ctx, field) + case "pageInfo": + return ec.fieldContext_AuditConnection_pageInfo(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type AuditConnection", 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_TrustCenter_audits_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _TrustCenter_vendors(ctx context.Context, field graphql.CollectedField, obj *types.TrustCenter) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_TrustCenter_vendors(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.TrustCenter().Vendors(rctx, obj, fc.Args["first"].(*int), fc.Args["after"].(*page.CursorKey), fc.Args["last"].(*int), fc.Args["before"].(*page.CursorKey)) + }) + 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.VendorConnection) + fc.Result = res + return ec.marshalNVendorConnection2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐVendorConnection(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_TrustCenter_vendors(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "TrustCenter", + 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_VendorConnection_edges(ctx, field) + case "pageInfo": + return ec.fieldContext_VendorConnection_pageInfo(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type VendorConnection", 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_TrustCenter_vendors_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Vendor_id(ctx context.Context, field graphql.CollectedField, obj *types.Vendor) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Vendor_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_Vendor_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Vendor", + 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) _Vendor_name(ctx context.Context, field graphql.CollectedField, obj *types.Vendor) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Vendor_name(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.Name, 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_Vendor_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Vendor", + 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) _Vendor_category(ctx context.Context, field graphql.CollectedField, obj *types.Vendor) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Vendor_category(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.Category, 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.VendorCategory) + fc.Result = res + return ec.marshalNVendorCategory2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐVendorCategory(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Vendor_category(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Vendor", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type VendorCategory does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Vendor_websiteUrl(ctx context.Context, field graphql.CollectedField, obj *types.Vendor) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Vendor_websiteUrl(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.WebsiteURL, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Vendor_websiteUrl(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Vendor", + 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) _Vendor_privacyPolicyUrl(ctx context.Context, field graphql.CollectedField, obj *types.Vendor) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Vendor_privacyPolicyUrl(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.PrivacyPolicyURL, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Vendor_privacyPolicyUrl(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Vendor", + 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) _VendorConnection_edges(ctx context.Context, field graphql.CollectedField, obj *types.VendorConnection) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_VendorConnection_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.VendorEdge) + fc.Result = res + return ec.marshalNVendorEdge2ᚕᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐVendorEdgeᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_VendorConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "VendorConnection", + 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_VendorEdge_cursor(ctx, field) + case "node": + return ec.fieldContext_VendorEdge_node(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type VendorEdge", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _VendorConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *types.VendorConnection) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_VendorConnection_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ᚋtrustᚋv1ᚋtypesᚐPageInfo(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_VendorConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "VendorConnection", + 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) _VendorEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *types.VendorEdge) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_VendorEdge_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_VendorEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "VendorEdge", + 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) _VendorEdge_node(ctx context.Context, field graphql.CollectedField, obj *types.VendorEdge) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_VendorEdge_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.Vendor) + fc.Result = res + return ec.marshalNVendor2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐVendor(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_VendorEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "VendorEdge", + 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_Vendor_id(ctx, field) + case "name": + return ec.fieldContext_Vendor_name(ctx, field) + case "category": + return ec.fieldContext_Vendor_category(ctx, field) + case "websiteUrl": + return ec.fieldContext_Vendor_websiteUrl(ctx, field) + case "privacyPolicyUrl": + return ec.fieldContext_Vendor_privacyPolicyUrl(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Vendor", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Directive_name(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.Name, 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___Directive_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Directive", + 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) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Directive_description(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.Description(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Directive_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Directive", + Field: field, + IsMethod: true, + 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) ___Directive_isRepeatable(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Directive_isRepeatable(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.IsRepeatable, 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.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Directive_isRepeatable(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Directive", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Directive_locations(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.Locations, 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.marshalN__DirectiveLocation2ᚕstringᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Directive_locations(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Directive", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type __DirectiveLocation does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Directive_args(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.Args, 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.([]introspection.InputValue) + fc.Result = res + return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Directive_args(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Directive", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext___InputValue_name(ctx, field) + case "description": + return ec.fieldContext___InputValue_description(ctx, field) + case "type": + return ec.fieldContext___InputValue_type(ctx, field) + case "defaultValue": + return ec.fieldContext___InputValue_defaultValue(ctx, field) + case "isDeprecated": + return ec.fieldContext___InputValue_isDeprecated(ctx, field) + case "deprecationReason": + return ec.fieldContext___InputValue_deprecationReason(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __InputValue", 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___Directive_args_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___EnumValue_name(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.Name, 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___EnumValue_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__EnumValue", + 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) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___EnumValue_description(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.Description(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___EnumValue_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + IsMethod: true, + 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) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___EnumValue_isDeprecated(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.IsDeprecated(), 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.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___EnumValue_isDeprecated(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___EnumValue_deprecationReason(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.DeprecationReason(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___EnumValue_deprecationReason(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + IsMethod: true, + 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) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Field_name(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.Name, 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___Field_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Field", + 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) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Field_description(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.Description(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Field_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Field", + Field: field, + IsMethod: true, + 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) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Field_args(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.Args, 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.([]introspection.InputValue) + fc.Result = res + return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Field_args(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Field", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext___InputValue_name(ctx, field) + case "description": + return ec.fieldContext___InputValue_description(ctx, field) + case "type": + return ec.fieldContext___InputValue_type(ctx, field) + case "defaultValue": + return ec.fieldContext___InputValue_defaultValue(ctx, field) + case "isDeprecated": + return ec.fieldContext___InputValue_isDeprecated(ctx, field) + case "deprecationReason": + return ec.fieldContext___InputValue_deprecationReason(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __InputValue", 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___Field_args_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Field_type(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.Type, 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.(*introspection.Type) + fc.Result = res + return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Field_type(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Field", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "isOneOf": + return ec.fieldContext___Type_isOneOf(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Field_isDeprecated(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.IsDeprecated(), 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.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Field_isDeprecated(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Field", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Field_deprecationReason(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.DeprecationReason(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Field_deprecationReason(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Field", + Field: field, + IsMethod: true, + 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) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___InputValue_name(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.Name, 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___InputValue_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__InputValue", + 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) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___InputValue_description(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.Description(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___InputValue_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + IsMethod: true, + 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) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___InputValue_type(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.Type, 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.(*introspection.Type) + fc.Result = res + return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___InputValue_type(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "isOneOf": + return ec.fieldContext___Type_isOneOf(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___InputValue_defaultValue(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.DefaultValue, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___InputValue_defaultValue(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__InputValue", + 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) ___InputValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___InputValue_isDeprecated(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.IsDeprecated(), 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.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___InputValue_isDeprecated(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___InputValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___InputValue_deprecationReason(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.DeprecationReason(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___InputValue_deprecationReason(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + IsMethod: true, + 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) ___Schema_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Schema_description(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.Description(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Schema_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Schema", + Field: field, + IsMethod: true, + 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) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Schema_types(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.Types(), 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.([]introspection.Type) + fc.Result = res + return ec.marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Schema_types(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Schema", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "isOneOf": + return ec.fieldContext___Type_isOneOf(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Schema_queryType(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.QueryType(), 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.(*introspection.Type) + fc.Result = res + return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Schema_queryType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Schema", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "isOneOf": + return ec.fieldContext___Type_isOneOf(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Schema_mutationType(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.MutationType(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*introspection.Type) + fc.Result = res + return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Schema_mutationType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Schema", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "isOneOf": + return ec.fieldContext___Type_isOneOf(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Schema_subscriptionType(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.SubscriptionType(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*introspection.Type) + fc.Result = res + return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Schema_subscriptionType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Schema", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "isOneOf": + return ec.fieldContext___Type_isOneOf(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Schema_directives(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.Directives(), 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.([]introspection.Directive) + fc.Result = res + return ec.marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirectiveᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Schema_directives(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Schema", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext___Directive_name(ctx, field) + case "description": + return ec.fieldContext___Directive_description(ctx, field) + case "isRepeatable": + return ec.fieldContext___Directive_isRepeatable(ctx, field) + case "locations": + return ec.fieldContext___Directive_locations(ctx, field) + case "args": + return ec.fieldContext___Directive_args(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Directive", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_kind(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.Kind(), 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.marshalN__TypeKind2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_kind(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type __TypeKind does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_name(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.Name(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + 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) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_description(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.Description(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + 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) ___Type_specifiedByURL(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_specifiedByURL(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.SpecifiedByURL(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_specifiedByURL(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + 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) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_fields(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.Fields(fc.Args["includeDeprecated"].(bool)), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]introspection.Field) + fc.Result = res + return ec.marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐFieldᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_fields(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext___Field_name(ctx, field) + case "description": + return ec.fieldContext___Field_description(ctx, field) + case "args": + return ec.fieldContext___Field_args(ctx, field) + case "type": + return ec.fieldContext___Field_type(ctx, field) + case "isDeprecated": + return ec.fieldContext___Field_isDeprecated(ctx, field) + case "deprecationReason": + return ec.fieldContext___Field_deprecationReason(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Field", 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___Type_fields_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_interfaces(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.Interfaces(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]introspection.Type) + fc.Result = res + return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_interfaces(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "isOneOf": + return ec.fieldContext___Type_isOneOf(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_possibleTypes(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.PossibleTypes(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]introspection.Type) + fc.Result = res + return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_possibleTypes(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "isOneOf": + return ec.fieldContext___Type_isOneOf(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_enumValues(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.EnumValues(fc.Args["includeDeprecated"].(bool)), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]introspection.EnumValue) + fc.Result = res + return ec.marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValueᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_enumValues(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext___EnumValue_name(ctx, field) + case "description": + return ec.fieldContext___EnumValue_description(ctx, field) + case "isDeprecated": + return ec.fieldContext___EnumValue_isDeprecated(ctx, field) + case "deprecationReason": + return ec.fieldContext___EnumValue_deprecationReason(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __EnumValue", 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___Type_enumValues_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_inputFields(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.InputFields(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]introspection.InputValue) + fc.Result = res + return ec.marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_inputFields(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext___InputValue_name(ctx, field) + case "description": + return ec.fieldContext___InputValue_description(ctx, field) + case "type": + return ec.fieldContext___InputValue_type(ctx, field) + case "defaultValue": + return ec.fieldContext___InputValue_defaultValue(ctx, field) + case "isDeprecated": + return ec.fieldContext___InputValue_isDeprecated(ctx, field) + case "deprecationReason": + return ec.fieldContext___InputValue_deprecationReason(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __InputValue", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_ofType(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.OfType(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*introspection.Type) + fc.Result = res + return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_ofType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "isOneOf": + return ec.fieldContext___Type_isOneOf(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Type_isOneOf(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_isOneOf(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.IsOneOf(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalOBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_isOneOf(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +// endregion **************************** field.gotpl ***************************** + +// region **************************** input.gotpl ***************************** + +func (ec *executionContext) unmarshalInputExportDocumentVersionPDFInput(ctx context.Context, obj any) (types.ExportDocumentVersionPDFInput, error) { + var it types.ExportDocumentVersionPDFInput + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"documentVersionId"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "documentVersionId": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("documentVersionId")) + data, err := ec.unmarshalNID2githubᚗcomᚋgetproboᚋproboᚋpkgᚋgidᚐGID(ctx, v) + if err != nil { + return it, err + } + it.DocumentVersionID = data + } + } + + return it, nil +} + +// endregion **************************** input.gotpl ***************************** + +// region ************************** interface.gotpl *************************** + +func (ec *executionContext) _Node(ctx context.Context, sel ast.SelectionSet, obj types.Node) graphql.Marshaler { + switch obj := (obj).(type) { + case nil: + return graphql.Null + case types.Vendor: + return ec._Vendor(ctx, sel, &obj) + case *types.Vendor: + if obj == nil { + return graphql.Null + } + return ec._Vendor(ctx, sel, obj) + case types.TrustCenter: + return ec._TrustCenter(ctx, sel, &obj) + case *types.TrustCenter: + if obj == nil { + return graphql.Null + } + return ec._TrustCenter(ctx, sel, obj) + case types.Report: + return ec._Report(ctx, sel, &obj) + case *types.Report: + if obj == nil { + return graphql.Null + } + return ec._Report(ctx, sel, obj) + case types.Organization: + return ec._Organization(ctx, sel, &obj) + case *types.Organization: + if obj == nil { + return graphql.Null + } + return ec._Organization(ctx, sel, obj) + case types.Framework: + return ec._Framework(ctx, sel, &obj) + case *types.Framework: + if obj == nil { + return graphql.Null + } + return ec._Framework(ctx, sel, obj) + case types.DocumentVersion: + return ec._DocumentVersion(ctx, sel, &obj) + case *types.DocumentVersion: + if obj == nil { + return graphql.Null + } + return ec._DocumentVersion(ctx, sel, obj) + case types.Document: + return ec._Document(ctx, sel, &obj) + case *types.Document: + if obj == nil { + return graphql.Null + } + return ec._Document(ctx, sel, obj) + case types.Audit: + return ec._Audit(ctx, sel, &obj) + case *types.Audit: + if obj == nil { + return graphql.Null + } + return ec._Audit(ctx, sel, obj) + default: + panic(fmt.Errorf("unexpected type %T", obj)) + } +} + +// endregion ************************** interface.gotpl *************************** + +// region **************************** object.gotpl **************************** + +var auditImplementors = []string{"Audit", "Node"} + +func (ec *executionContext) _Audit(ctx context.Context, sel ast.SelectionSet, obj *types.Audit) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, auditImplementors) + + 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("Audit") + case "id": + out.Values[i] = ec._Audit_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "framework": + 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._Audit_framework(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 "report": + 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._Audit_report(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 "reportUrl": + 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._Audit_reportUrl(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) }) + 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 auditConnectionImplementors = []string{"AuditConnection"} + +func (ec *executionContext) _AuditConnection(ctx context.Context, sel ast.SelectionSet, obj *types.AuditConnection) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, auditConnectionImplementors) + + 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("AuditConnection") + case "edges": + out.Values[i] = ec._AuditConnection_edges(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "pageInfo": + out.Values[i] = ec._AuditConnection_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 auditEdgeImplementors = []string{"AuditEdge"} + +func (ec *executionContext) _AuditEdge(ctx context.Context, sel ast.SelectionSet, obj *types.AuditEdge) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, auditEdgeImplementors) + + 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("AuditEdge") + case "cursor": + out.Values[i] = ec._AuditEdge_cursor(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "node": + out.Values[i] = ec._AuditEdge_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 documentImplementors = []string{"Document", "Node"} + +func (ec *executionContext) _Document(ctx context.Context, sel ast.SelectionSet, obj *types.Document) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, documentImplementors) + + 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("Document") + case "id": + out.Values[i] = ec._Document_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "title": + out.Values[i] = ec._Document_title(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "documentType": + out.Values[i] = ec._Document_documentType(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + 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._Document_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) }) + 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 documentConnectionImplementors = []string{"DocumentConnection"} + +func (ec *executionContext) _DocumentConnection(ctx context.Context, sel ast.SelectionSet, obj *types.DocumentConnection) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, documentConnectionImplementors) + + 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("DocumentConnection") + case "edges": + out.Values[i] = ec._DocumentConnection_edges(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "pageInfo": + out.Values[i] = ec._DocumentConnection_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 documentEdgeImplementors = []string{"DocumentEdge"} + +func (ec *executionContext) _DocumentEdge(ctx context.Context, sel ast.SelectionSet, obj *types.DocumentEdge) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, documentEdgeImplementors) + + 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("DocumentEdge") + case "cursor": + out.Values[i] = ec._DocumentEdge_cursor(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "node": + out.Values[i] = ec._DocumentEdge_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 documentVersionImplementors = []string{"DocumentVersion", "Node"} + +func (ec *executionContext) _DocumentVersion(ctx context.Context, sel ast.SelectionSet, obj *types.DocumentVersion) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, documentVersionImplementors) + + 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("DocumentVersion") + case "id": + out.Values[i] = ec._DocumentVersion_id(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 documentVersionConnectionImplementors = []string{"DocumentVersionConnection"} + +func (ec *executionContext) _DocumentVersionConnection(ctx context.Context, sel ast.SelectionSet, obj *types.DocumentVersionConnection) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, documentVersionConnectionImplementors) + + 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("DocumentVersionConnection") + case "edges": + out.Values[i] = ec._DocumentVersionConnection_edges(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "pageInfo": + out.Values[i] = ec._DocumentVersionConnection_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 documentVersionEdgeImplementors = []string{"DocumentVersionEdge"} + +func (ec *executionContext) _DocumentVersionEdge(ctx context.Context, sel ast.SelectionSet, obj *types.DocumentVersionEdge) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, documentVersionEdgeImplementors) + + 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("DocumentVersionEdge") + case "cursor": + out.Values[i] = ec._DocumentVersionEdge_cursor(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "node": + out.Values[i] = ec._DocumentVersionEdge_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 exportDocumentVersionPDFPayloadImplementors = []string{"ExportDocumentVersionPDFPayload"} + +func (ec *executionContext) _ExportDocumentVersionPDFPayload(ctx context.Context, sel ast.SelectionSet, obj *types.ExportDocumentVersionPDFPayload) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, exportDocumentVersionPDFPayloadImplementors) + + 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("ExportDocumentVersionPDFPayload") + case "data": + out.Values[i] = ec._ExportDocumentVersionPDFPayload_data(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 frameworkImplementors = []string{"Framework", "Node"} + +func (ec *executionContext) _Framework(ctx context.Context, sel ast.SelectionSet, obj *types.Framework) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, frameworkImplementors) + + 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("Framework") + case "id": + out.Values[i] = ec._Framework_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "name": + out.Values[i] = ec._Framework_name(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 mutationImplementors = []string{"Mutation"} + +func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, mutationImplementors) + ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ + Object: "Mutation", + }) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{ + Object: field.Name, + Field: field, + }) + + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("Mutation") + case "exportDocumentVersionPDF": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_exportDocumentVersionPDF(ctx, field) + }) + 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 organizationImplementors = []string{"Organization", "Node"} + +func (ec *executionContext) _Organization(ctx context.Context, sel ast.SelectionSet, obj *types.Organization) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, organizationImplementors) + + 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("Organization") + case "id": + out.Values[i] = ec._Organization_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "name": + out.Values[i] = ec._Organization_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "logoUrl": + 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._Organization_logoUrl(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) }) + 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 pageInfoImplementors = []string{"PageInfo"} + +func (ec *executionContext) _PageInfo(ctx context.Context, sel ast.SelectionSet, obj *types.PageInfo) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, pageInfoImplementors) + + 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("PageInfo") + case "hasNextPage": + out.Values[i] = ec._PageInfo_hasNextPage(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "hasPreviousPage": + out.Values[i] = ec._PageInfo_hasPreviousPage(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "startCursor": + out.Values[i] = ec._PageInfo_startCursor(ctx, field, obj) + case "endCursor": + out.Values[i] = ec._PageInfo_endCursor(ctx, field, obj) + 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 { + fields := graphql.CollectFields(ec.OperationContext, sel, queryImplementors) + ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ + Object: "Query", + }) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{ + Object: field.Name, + Field: field, + }) + + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("Query") + case "trustCenterBySlug": + 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._Query_trustCenterBySlug(ctx, field) + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "__type": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Query___type(ctx, field) + }) + case "__schema": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Query___schema(ctx, field) + }) + 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 reportImplementors = []string{"Report", "Node"} + +func (ec *executionContext) _Report(ctx context.Context, sel ast.SelectionSet, obj *types.Report) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, reportImplementors) + + 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("Report") + case "id": + out.Values[i] = ec._Report_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "filename": + out.Values[i] = ec._Report_filename(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "downloadUrl": + 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._Report_downloadUrl(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) }) + 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 trustCenterImplementors = []string{"TrustCenter", "Node"} + +func (ec *executionContext) _TrustCenter(ctx context.Context, sel ast.SelectionSet, obj *types.TrustCenter) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, trustCenterImplementors) + + 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("TrustCenter") + case "id": + out.Values[i] = ec._TrustCenter_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "active": + out.Values[i] = ec._TrustCenter_active(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "slug": + out.Values[i] = ec._TrustCenter_slug(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "organization": + 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._TrustCenter_organization(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 "documents": + 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._TrustCenter_documents(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 "audits": + 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._TrustCenter_audits(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 "vendors": + 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._TrustCenter_vendors(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) }) + 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 vendorImplementors = []string{"Vendor", "Node"} + +func (ec *executionContext) _Vendor(ctx context.Context, sel ast.SelectionSet, obj *types.Vendor) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, vendorImplementors) + + 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("Vendor") + case "id": + out.Values[i] = ec._Vendor_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "name": + out.Values[i] = ec._Vendor_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "category": + out.Values[i] = ec._Vendor_category(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "websiteUrl": + out.Values[i] = ec._Vendor_websiteUrl(ctx, field, obj) + case "privacyPolicyUrl": + out.Values[i] = ec._Vendor_privacyPolicyUrl(ctx, field, obj) + 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 vendorConnectionImplementors = []string{"VendorConnection"} + +func (ec *executionContext) _VendorConnection(ctx context.Context, sel ast.SelectionSet, obj *types.VendorConnection) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, vendorConnectionImplementors) + + 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("VendorConnection") + case "edges": + out.Values[i] = ec._VendorConnection_edges(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "pageInfo": + out.Values[i] = ec._VendorConnection_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 vendorEdgeImplementors = []string{"VendorEdge"} + +func (ec *executionContext) _VendorEdge(ctx context.Context, sel ast.SelectionSet, obj *types.VendorEdge) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, vendorEdgeImplementors) + + 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("VendorEdge") + case "cursor": + out.Values[i] = ec._VendorEdge_cursor(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "node": + out.Values[i] = ec._VendorEdge_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 __DirectiveImplementors = []string{"__Directive"} + +func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionSet, obj *introspection.Directive) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, __DirectiveImplementors) + + 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("__Directive") + case "name": + out.Values[i] = ec.___Directive_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "description": + out.Values[i] = ec.___Directive_description(ctx, field, obj) + case "isRepeatable": + out.Values[i] = ec.___Directive_isRepeatable(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "locations": + out.Values[i] = ec.___Directive_locations(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "args": + out.Values[i] = ec.___Directive_args(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 __EnumValueImplementors = []string{"__EnumValue"} + +func (ec *executionContext) ___EnumValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.EnumValue) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, __EnumValueImplementors) + + 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("__EnumValue") + case "name": + out.Values[i] = ec.___EnumValue_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "description": + out.Values[i] = ec.___EnumValue_description(ctx, field, obj) + case "isDeprecated": + out.Values[i] = ec.___EnumValue_isDeprecated(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "deprecationReason": + out.Values[i] = ec.___EnumValue_deprecationReason(ctx, field, obj) + 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 __FieldImplementors = []string{"__Field"} + +func (ec *executionContext) ___Field(ctx context.Context, sel ast.SelectionSet, obj *introspection.Field) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, __FieldImplementors) + + 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("__Field") + case "name": + out.Values[i] = ec.___Field_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "description": + out.Values[i] = ec.___Field_description(ctx, field, obj) + case "args": + out.Values[i] = ec.___Field_args(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "type": + out.Values[i] = ec.___Field_type(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "isDeprecated": + out.Values[i] = ec.___Field_isDeprecated(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "deprecationReason": + out.Values[i] = ec.___Field_deprecationReason(ctx, field, obj) + 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 __InputValueImplementors = []string{"__InputValue"} + +func (ec *executionContext) ___InputValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.InputValue) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, __InputValueImplementors) + + 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("__InputValue") + case "name": + out.Values[i] = ec.___InputValue_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "description": + out.Values[i] = ec.___InputValue_description(ctx, field, obj) + case "type": + out.Values[i] = ec.___InputValue_type(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "defaultValue": + out.Values[i] = ec.___InputValue_defaultValue(ctx, field, obj) + case "isDeprecated": + out.Values[i] = ec.___InputValue_isDeprecated(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "deprecationReason": + out.Values[i] = ec.___InputValue_deprecationReason(ctx, field, obj) + 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 __SchemaImplementors = []string{"__Schema"} + +func (ec *executionContext) ___Schema(ctx context.Context, sel ast.SelectionSet, obj *introspection.Schema) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, __SchemaImplementors) + + 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("__Schema") + case "description": + out.Values[i] = ec.___Schema_description(ctx, field, obj) + case "types": + out.Values[i] = ec.___Schema_types(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "queryType": + out.Values[i] = ec.___Schema_queryType(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "mutationType": + out.Values[i] = ec.___Schema_mutationType(ctx, field, obj) + case "subscriptionType": + out.Values[i] = ec.___Schema_subscriptionType(ctx, field, obj) + case "directives": + out.Values[i] = ec.___Schema_directives(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 __TypeImplementors = []string{"__Type"} + +func (ec *executionContext) ___Type(ctx context.Context, sel ast.SelectionSet, obj *introspection.Type) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, __TypeImplementors) + + 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("__Type") + case "kind": + out.Values[i] = ec.___Type_kind(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "name": + out.Values[i] = ec.___Type_name(ctx, field, obj) + case "description": + out.Values[i] = ec.___Type_description(ctx, field, obj) + case "specifiedByURL": + out.Values[i] = ec.___Type_specifiedByURL(ctx, field, obj) + case "fields": + out.Values[i] = ec.___Type_fields(ctx, field, obj) + case "interfaces": + out.Values[i] = ec.___Type_interfaces(ctx, field, obj) + case "possibleTypes": + out.Values[i] = ec.___Type_possibleTypes(ctx, field, obj) + case "enumValues": + out.Values[i] = ec.___Type_enumValues(ctx, field, obj) + case "inputFields": + out.Values[i] = ec.___Type_inputFields(ctx, field, obj) + case "ofType": + out.Values[i] = ec.___Type_ofType(ctx, field, obj) + case "isOneOf": + out.Values[i] = ec.___Type_isOneOf(ctx, field, obj) + 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 +} + +// endregion **************************** object.gotpl **************************** + +// region ***************************** type.gotpl ***************************** + +func (ec *executionContext) marshalNAudit2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐAudit(ctx context.Context, sel ast.SelectionSet, v *types.Audit) 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._Audit(ctx, sel, v) +} + +func (ec *executionContext) marshalNAuditConnection2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐAuditConnection(ctx context.Context, sel ast.SelectionSet, v types.AuditConnection) graphql.Marshaler { + return ec._AuditConnection(ctx, sel, &v) +} + +func (ec *executionContext) marshalNAuditConnection2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐAuditConnection(ctx context.Context, sel ast.SelectionSet, v *types.AuditConnection) 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._AuditConnection(ctx, sel, v) +} + +func (ec *executionContext) marshalNAuditEdge2ᚕᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐAuditEdgeᚄ(ctx context.Context, sel ast.SelectionSet, v []*types.AuditEdge) 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.marshalNAuditEdge2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐAuditEdge(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) marshalNAuditEdge2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐAuditEdge(ctx context.Context, sel ast.SelectionSet, v *types.AuditEdge) 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._AuditEdge(ctx, sel, v) +} + +func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v any) (bool, error) { + res, err := graphql.UnmarshalBoolean(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { + _ = sel + res := graphql.MarshalBoolean(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 +} + +func (ec *executionContext) unmarshalNCursorKey2githubᚗcomᚋgetproboᚋproboᚋpkgᚋpageᚐCursorKey(ctx context.Context, v any) (page.CursorKey, error) { + res, err := types.UnmarshalCursorKeyScalar(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNCursorKey2githubᚗcomᚋgetproboᚋproboᚋpkgᚋpageᚐCursorKey(ctx context.Context, sel ast.SelectionSet, v page.CursorKey) graphql.Marshaler { + _ = sel + res := types.MarshalCursorKeyScalar(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 +} + +func (ec *executionContext) marshalNDocument2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐDocument(ctx context.Context, sel ast.SelectionSet, v *types.Document) 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._Document(ctx, sel, v) +} + +func (ec *executionContext) marshalNDocumentConnection2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐDocumentConnection(ctx context.Context, sel ast.SelectionSet, v types.DocumentConnection) graphql.Marshaler { + return ec._DocumentConnection(ctx, sel, &v) +} + +func (ec *executionContext) marshalNDocumentConnection2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐDocumentConnection(ctx context.Context, sel ast.SelectionSet, v *types.DocumentConnection) 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._DocumentConnection(ctx, sel, v) +} + +func (ec *executionContext) marshalNDocumentEdge2ᚕᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐDocumentEdgeᚄ(ctx context.Context, sel ast.SelectionSet, v []*types.DocumentEdge) 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.marshalNDocumentEdge2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐDocumentEdge(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) marshalNDocumentEdge2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐDocumentEdge(ctx context.Context, sel ast.SelectionSet, v *types.DocumentEdge) 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._DocumentEdge(ctx, sel, v) +} + +func (ec *executionContext) unmarshalNDocumentType2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐDocumentType(ctx context.Context, v any) (coredata.DocumentType, error) { + tmp, err := graphql.UnmarshalString(v) + res := unmarshalNDocumentType2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐDocumentType[tmp] + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNDocumentType2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐDocumentType(ctx context.Context, sel ast.SelectionSet, v coredata.DocumentType) graphql.Marshaler { + _ = sel + res := graphql.MarshalString(marshalNDocumentType2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐDocumentType[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 ( + unmarshalNDocumentType2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐDocumentType = map[string]coredata.DocumentType{ + "OTHER": coredata.DocumentTypeOther, + "ISMS": coredata.DocumentTypeISMS, + "POLICY": coredata.DocumentTypePolicy, + } + marshalNDocumentType2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐDocumentType = map[coredata.DocumentType]string{ + coredata.DocumentTypeOther: "OTHER", + coredata.DocumentTypeISMS: "ISMS", + coredata.DocumentTypePolicy: "POLICY", + } +) + +func (ec *executionContext) marshalNDocumentVersion2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐDocumentVersion(ctx context.Context, sel ast.SelectionSet, v *types.DocumentVersion) 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._DocumentVersion(ctx, sel, v) +} + +func (ec *executionContext) marshalNDocumentVersionConnection2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐDocumentVersionConnection(ctx context.Context, sel ast.SelectionSet, v types.DocumentVersionConnection) graphql.Marshaler { + return ec._DocumentVersionConnection(ctx, sel, &v) +} + +func (ec *executionContext) marshalNDocumentVersionConnection2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐDocumentVersionConnection(ctx context.Context, sel ast.SelectionSet, v *types.DocumentVersionConnection) 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._DocumentVersionConnection(ctx, sel, v) +} + +func (ec *executionContext) marshalNDocumentVersionEdge2ᚕᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐDocumentVersionEdgeᚄ(ctx context.Context, sel ast.SelectionSet, v []*types.DocumentVersionEdge) 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.marshalNDocumentVersionEdge2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐDocumentVersionEdge(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) marshalNDocumentVersionEdge2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐDocumentVersionEdge(ctx context.Context, sel ast.SelectionSet, v *types.DocumentVersionEdge) 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._DocumentVersionEdge(ctx, sel, v) +} + +func (ec *executionContext) unmarshalNExportDocumentVersionPDFInput2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐExportDocumentVersionPDFInput(ctx context.Context, v any) (types.ExportDocumentVersionPDFInput, error) { + res, err := ec.unmarshalInputExportDocumentVersionPDFInput(ctx, v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNExportDocumentVersionPDFPayload2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐExportDocumentVersionPDFPayload(ctx context.Context, sel ast.SelectionSet, v types.ExportDocumentVersionPDFPayload) graphql.Marshaler { + return ec._ExportDocumentVersionPDFPayload(ctx, sel, &v) +} + +func (ec *executionContext) marshalNExportDocumentVersionPDFPayload2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐExportDocumentVersionPDFPayload(ctx context.Context, sel ast.SelectionSet, v *types.ExportDocumentVersionPDFPayload) 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._ExportDocumentVersionPDFPayload(ctx, sel, v) +} + +func (ec *executionContext) marshalNFramework2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐFramework(ctx context.Context, sel ast.SelectionSet, v types.Framework) graphql.Marshaler { + return ec._Framework(ctx, sel, &v) +} + +func (ec *executionContext) marshalNFramework2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐFramework(ctx context.Context, sel ast.SelectionSet, v *types.Framework) 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._Framework(ctx, sel, v) +} + +func (ec *executionContext) unmarshalNID2githubᚗcomᚋgetproboᚋproboᚋpkgᚋgidᚐGID(ctx context.Context, v any) (gid.GID, error) { + res, err := types.UnmarshalGIDScalar(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNID2githubᚗcomᚋgetproboᚋproboᚋpkgᚋgidᚐGID(ctx context.Context, sel ast.SelectionSet, v gid.GID) graphql.Marshaler { + _ = sel + res := types.MarshalGIDScalar(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 +} + +func (ec *executionContext) marshalNOrganization2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐOrganization(ctx context.Context, sel ast.SelectionSet, v types.Organization) graphql.Marshaler { + return ec._Organization(ctx, sel, &v) +} + +func (ec *executionContext) marshalNOrganization2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐOrganization(ctx context.Context, sel ast.SelectionSet, v *types.Organization) 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._Organization(ctx, sel, v) +} + +func (ec *executionContext) marshalNPageInfo2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐPageInfo(ctx context.Context, sel ast.SelectionSet, v *types.PageInfo) 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._PageInfo(ctx, sel, v) +} + +func (ec *executionContext) unmarshalNString2string(ctx context.Context, v any) (string, error) { + res, err := graphql.UnmarshalString(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { + _ = sel + res := graphql.MarshalString(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 +} + +func (ec *executionContext) marshalNVendor2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐVendor(ctx context.Context, sel ast.SelectionSet, v *types.Vendor) 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._Vendor(ctx, sel, v) +} + +func (ec *executionContext) unmarshalNVendorCategory2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐVendorCategory(ctx context.Context, v any) (coredata.VendorCategory, error) { + tmp, err := graphql.UnmarshalString(v) + res := unmarshalNVendorCategory2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐVendorCategory[tmp] + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNVendorCategory2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐVendorCategory(ctx context.Context, sel ast.SelectionSet, v coredata.VendorCategory) graphql.Marshaler { + _ = sel + res := graphql.MarshalString(marshalNVendorCategory2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐVendorCategory[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 ( + unmarshalNVendorCategory2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐVendorCategory = map[string]coredata.VendorCategory{ + "ANALYTICS": coredata.VendorCategoryAnalytics, + "CLOUD_MONITORING": coredata.VendorCategoryCloudMonitoring, + "CLOUD_PROVIDER": coredata.VendorCategoryCloudProvider, + "COLLABORATION": coredata.VendorCategoryCollaboration, + "CUSTOMER_SUPPORT": coredata.VendorCategoryCustomerSupport, + "DATA_STORAGE_AND_PROCESSING": coredata.VendorCategoryDataStorageAndProcessing, + "DOCUMENT_MANAGEMENT": coredata.VendorCategoryDocumentManagement, + "EMPLOYEE_MANAGEMENT": coredata.VendorCategoryEmployeeManagement, + "ENGINEERING": coredata.VendorCategoryEngineering, + "FINANCE": coredata.VendorCategoryFinance, + "IDENTITY_PROVIDER": coredata.VendorCategoryIdentityProvider, + "IT": coredata.VendorCategoryIT, + "MARKETING": coredata.VendorCategoryMarketing, + "OFFICE_OPERATIONS": coredata.VendorCategoryOfficeOperations, + "OTHER": coredata.VendorCategoryOther, + "PASSWORD_MANAGEMENT": coredata.VendorCategoryPasswordManagement, + "PRODUCT_AND_DESIGN": coredata.VendorCategoryProductAndDesign, + "PROFESSIONAL_SERVICES": coredata.VendorCategoryProfessionalServices, + "RECRUITING": coredata.VendorCategoryRecruiting, + "SALES": coredata.VendorCategorySales, + "SECURITY": coredata.VendorCategorySecurity, + "VERSION_CONTROL": coredata.VendorCategoryVersionControl, + } + marshalNVendorCategory2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐVendorCategory = map[coredata.VendorCategory]string{ + coredata.VendorCategoryAnalytics: "ANALYTICS", + coredata.VendorCategoryCloudMonitoring: "CLOUD_MONITORING", + coredata.VendorCategoryCloudProvider: "CLOUD_PROVIDER", + coredata.VendorCategoryCollaboration: "COLLABORATION", + coredata.VendorCategoryCustomerSupport: "CUSTOMER_SUPPORT", + coredata.VendorCategoryDataStorageAndProcessing: "DATA_STORAGE_AND_PROCESSING", + coredata.VendorCategoryDocumentManagement: "DOCUMENT_MANAGEMENT", + coredata.VendorCategoryEmployeeManagement: "EMPLOYEE_MANAGEMENT", + coredata.VendorCategoryEngineering: "ENGINEERING", + coredata.VendorCategoryFinance: "FINANCE", + coredata.VendorCategoryIdentityProvider: "IDENTITY_PROVIDER", + coredata.VendorCategoryIT: "IT", + coredata.VendorCategoryMarketing: "MARKETING", + coredata.VendorCategoryOfficeOperations: "OFFICE_OPERATIONS", + coredata.VendorCategoryOther: "OTHER", + coredata.VendorCategoryPasswordManagement: "PASSWORD_MANAGEMENT", + coredata.VendorCategoryProductAndDesign: "PRODUCT_AND_DESIGN", + coredata.VendorCategoryProfessionalServices: "PROFESSIONAL_SERVICES", + coredata.VendorCategoryRecruiting: "RECRUITING", + coredata.VendorCategorySales: "SALES", + coredata.VendorCategorySecurity: "SECURITY", + coredata.VendorCategoryVersionControl: "VERSION_CONTROL", + } +) + +func (ec *executionContext) marshalNVendorConnection2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐVendorConnection(ctx context.Context, sel ast.SelectionSet, v types.VendorConnection) graphql.Marshaler { + return ec._VendorConnection(ctx, sel, &v) +} + +func (ec *executionContext) marshalNVendorConnection2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐVendorConnection(ctx context.Context, sel ast.SelectionSet, v *types.VendorConnection) 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._VendorConnection(ctx, sel, v) +} + +func (ec *executionContext) marshalNVendorEdge2ᚕᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐVendorEdgeᚄ(ctx context.Context, sel ast.SelectionSet, v []*types.VendorEdge) 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.marshalNVendorEdge2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐVendorEdge(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) marshalNVendorEdge2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐVendorEdge(ctx context.Context, sel ast.SelectionSet, v *types.VendorEdge) 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._VendorEdge(ctx, sel, v) +} + +func (ec *executionContext) marshalN__Directive2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx context.Context, sel ast.SelectionSet, v introspection.Directive) graphql.Marshaler { + return ec.___Directive(ctx, sel, &v) +} + +func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirectiveᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.Directive) 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.marshalN__Directive2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(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) unmarshalN__DirectiveLocation2string(ctx context.Context, v any) (string, error) { + res, err := graphql.UnmarshalString(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalN__DirectiveLocation2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { + _ = sel + res := graphql.MarshalString(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 +} + +func (ec *executionContext) unmarshalN__DirectiveLocation2ᚕstringᚄ(ctx context.Context, v any) ([]string, error) { + var vSlice []any + vSlice = graphql.CoerceList(v) + var err error + res := make([]string, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalN__DirectiveLocation2string(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func (ec *executionContext) marshalN__DirectiveLocation2ᚕstringᚄ(ctx context.Context, sel ast.SelectionSet, v []string) 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.marshalN__DirectiveLocation2string(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) marshalN__EnumValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx context.Context, sel ast.SelectionSet, v introspection.EnumValue) graphql.Marshaler { + return ec.___EnumValue(ctx, sel, &v) +} + +func (ec *executionContext) marshalN__Field2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx context.Context, sel ast.SelectionSet, v introspection.Field) graphql.Marshaler { + return ec.___Field(ctx, sel, &v) +} + +func (ec *executionContext) marshalN__InputValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx context.Context, sel ast.SelectionSet, v introspection.InputValue) graphql.Marshaler { + return ec.___InputValue(ctx, sel, &v) +} + +func (ec *executionContext) marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.InputValue) 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.marshalN__InputValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(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) marshalN__Type2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v introspection.Type) graphql.Marshaler { + return ec.___Type(ctx, sel, &v) +} + +func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.Type) 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.marshalN__Type2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(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) marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v *introspection.Type) 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.___Type(ctx, sel, v) +} + +func (ec *executionContext) unmarshalN__TypeKind2string(ctx context.Context, v any) (string, error) { + res, err := graphql.UnmarshalString(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { + _ = sel + res := graphql.MarshalString(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 +} + +func (ec *executionContext) unmarshalOBoolean2bool(ctx context.Context, v any) (bool, error) { + res, err := graphql.UnmarshalBoolean(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { + _ = sel + _ = ctx + res := graphql.MarshalBoolean(v) + return res +} + +func (ec *executionContext) unmarshalOBoolean2ᚖbool(ctx context.Context, v any) (*bool, error) { + if v == nil { + return nil, nil + } + res, err := graphql.UnmarshalBoolean(v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOBoolean2ᚖbool(ctx context.Context, sel ast.SelectionSet, v *bool) graphql.Marshaler { + if v == nil { + return graphql.Null + } + _ = sel + _ = ctx + res := graphql.MarshalBoolean(*v) + return res +} + +func (ec *executionContext) unmarshalOCursorKey2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋpageᚐCursorKey(ctx context.Context, v any) (*page.CursorKey, error) { + if v == nil { + return nil, nil + } + res, err := types.UnmarshalCursorKeyScalar(v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOCursorKey2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋpageᚐCursorKey(ctx context.Context, sel ast.SelectionSet, v *page.CursorKey) graphql.Marshaler { + if v == nil { + return graphql.Null + } + _ = sel + _ = ctx + res := types.MarshalCursorKeyScalar(*v) + return res +} + +func (ec *executionContext) unmarshalOInt2ᚖint(ctx context.Context, v any) (*int, error) { + if v == nil { + return nil, nil + } + res, err := graphql.UnmarshalInt(v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOInt2ᚖint(ctx context.Context, sel ast.SelectionSet, v *int) graphql.Marshaler { + if v == nil { + return graphql.Null + } + _ = sel + _ = ctx + res := graphql.MarshalInt(*v) + return res +} + +func (ec *executionContext) marshalOReport2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐReport(ctx context.Context, sel ast.SelectionSet, v *types.Report) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._Report(ctx, sel, v) +} + +func (ec *executionContext) unmarshalORole2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐRole(ctx context.Context, v any) (*types.Role, error) { + if v == nil { + return nil, nil + } + var res = new(types.Role) + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalORole2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐRole(ctx context.Context, sel ast.SelectionSet, v *types.Role) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return v +} + +func (ec *executionContext) unmarshalOString2ᚕstringᚄ(ctx context.Context, v any) ([]string, error) { + if v == nil { + return nil, nil + } + var vSlice []any + vSlice = graphql.CoerceList(v) + var err error + res := make([]string, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalNString2string(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func (ec *executionContext) marshalOString2ᚕstringᚄ(ctx context.Context, sel ast.SelectionSet, v []string) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + for i := range v { + ret[i] = ec.marshalNString2string(ctx, sel, v[i]) + } + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) unmarshalOString2ᚖstring(ctx context.Context, v any) (*string, error) { + if v == nil { + return nil, nil + } + res, err := graphql.UnmarshalString(v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOString2ᚖstring(ctx context.Context, sel ast.SelectionSet, v *string) graphql.Marshaler { + if v == nil { + return graphql.Null + } + _ = sel + _ = ctx + res := graphql.MarshalString(*v) + return res +} + +func (ec *executionContext) marshalOTrustCenter2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐTrustCenter(ctx context.Context, sel ast.SelectionSet, v *types.TrustCenter) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._TrustCenter(ctx, sel, v) +} + +func (ec *executionContext) marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValueᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.EnumValue) graphql.Marshaler { + if v == nil { + return graphql.Null + } + 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.marshalN__EnumValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(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) marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐFieldᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.Field) graphql.Marshaler { + if v == nil { + return graphql.Null + } + 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.marshalN__Field2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(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) marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.InputValue) graphql.Marshaler { + if v == nil { + return graphql.Null + } + 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.marshalN__InputValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(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) marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx context.Context, sel ast.SelectionSet, v *introspection.Schema) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec.___Schema(ctx, sel, v) +} + +func (ec *executionContext) marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.Type) graphql.Marshaler { + if v == nil { + return graphql.Null + } + 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.marshalN__Type2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(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) marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v *introspection.Type) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec.___Type(ctx, sel, v) +} + +// endregion ***************************** type.gotpl ***************************** diff --git a/pkg/server/api/trust/v1/trust_center_access_handler.go b/pkg/server/api/trust/v1/trust_center_access_handler.go new file mode 100644 index 000000000..e4dd77718 --- /dev/null +++ b/pkg/server/api/trust/v1/trust_center_access_handler.go @@ -0,0 +1,153 @@ +// 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 trust_v1 + +import ( + "context" + "encoding/base64" + "encoding/json" + "fmt" + "net/http" + "time" + + "github.com/getprobo/probo/pkg/crypto/cipher" + "github.com/getprobo/probo/pkg/probo" + "github.com/getprobo/probo/pkg/securecookie" + "github.com/getprobo/probo/pkg/statelesstoken" + "github.com/getprobo/probo/pkg/trust" + "go.gearno.de/kit/httpserver" +) + +type ( + AuthTokenRequest struct { + Token string `json:"token"` + } + + AuthTokenResponse struct { + Success bool `json:"success"` + TrustCenterID string `json:"trust_center_id,omitempty"` + Message string `json:"message,omitempty"` + } +) + +func authTokenHandler(trustSvc *trust.Service, authCfg AuthConfig, encryptionKey cipher.EncryptionKey) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req AuthTokenRequest + // Limit request body size to 1KB to prevent DoS attacks + limitedReader := http.MaxBytesReader(w, r.Body, 1024) + if err := json.NewDecoder(limitedReader).Decode(&req); err != nil { + httpserver.RenderError(w, http.StatusBadRequest, fmt.Errorf("cannot decode body: %w", err)) + return + } + + if req.Token == "" { + httpserver.RenderJSON(w, http.StatusBadRequest, AuthTokenResponse{ + Success: false, + Message: "Token is required", + }) + return + } + + accessData, err := validateTrustCenterAccessToken(r.Context(), trustSvc, authCfg, req.Token) + if err != nil { + httpserver.RenderJSON(w, http.StatusUnauthorized, AuthTokenResponse{ + Success: false, + Message: "Invalid or expired token", + }) + return + } + + tokenData := TrustCenterTokenData{ + TrustCenterID: accessData.TrustCenterID, + Email: accessData.Email, + TenantID: accessData.TrustCenterID.TenantID(), + Scope: TokenScopeTrustCenterReadOnly, + ExpiresAt: time.Now().Add(24 * time.Hour), + } + + tokenBytes, err := json.Marshal(tokenData) + if err != nil { + httpserver.RenderError(w, http.StatusInternalServerError, fmt.Errorf("failed to serialize token data: %w", err)) + return + } + + encryptedTokenData, err := cipher.Encrypt(tokenBytes, encryptionKey) + if err != nil { + httpserver.RenderError(w, http.StatusInternalServerError, fmt.Errorf("failed to encrypt token data: %w", err)) + return + } + + encryptedTokenString := base64.StdEncoding.EncodeToString(encryptedTokenData) + + cookieConfig := securecookie.Config{ + Name: TokenCookieName, + Secret: authCfg.CookieSecret, + Domain: authCfg.CookieDomain, + Path: "/", + MaxAge: int(24 * time.Hour / time.Second), // 24 hours + Secure: true, + HTTPOnly: true, + SameSite: http.SameSiteStrictMode, + } + + if err := securecookie.Set(w, cookieConfig, encryptedTokenString); err != nil { + httpserver.RenderError(w, http.StatusInternalServerError, fmt.Errorf("failed to set cookie: %w", err)) + return + } + + httpserver.RenderJSON(w, http.StatusOK, AuthTokenResponse{ + Success: true, + TrustCenterID: accessData.TrustCenterID.String(), + Message: "Authentication successful", + }) + } +} + +func validateTrustCenterAccessToken(ctx context.Context, trustSvc *trust.Service, authCfg AuthConfig, tokenString string) (*probo.TrustCenterAccessData, error) { + token, err := statelesstoken.ValidateToken[probo.TrustCenterAccessData]( + authCfg.CookieSecret, + probo.TokenTypeTrustCenterAccess, + tokenString, + ) + if err != nil { + return nil, fmt.Errorf("cannot validate trust center access token: %w", err) + } + + tenantID := token.Data.TrustCenterID.TenantID() + tenantSvc := trustSvc.WithTenant(tenantID) + + return tenantSvc.TrustCenterAccesses.ValidateToken(ctx, tokenString) +} + +func trustCenterLogoutHandler(authCfg AuthConfig) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + cookieConfig := securecookie.Config{ + Name: TokenCookieName, + Secret: authCfg.CookieSecret, + Domain: authCfg.CookieDomain, + Path: "/", + MaxAge: -1, + Secure: true, + HTTPOnly: true, + SameSite: http.SameSiteStrictMode, + } + + securecookie.Clear(w, cookieConfig) + + w.Header().Set("Clear-Site-Data", "*") + + httpserver.RenderJSON(w, http.StatusOK, map[string]bool{"success": true}) + } +} diff --git a/pkg/server/api/trust/v1/types/audit.go b/pkg/server/api/trust/v1/types/audit.go new file mode 100644 index 000000000..8a574db4f --- /dev/null +++ b/pkg/server/api/trust/v1/types/audit.go @@ -0,0 +1,47 @@ +// 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" +) + +func NewAuditConnection( + p *page.Page[*coredata.Audit, coredata.AuditOrderField], +) *AuditConnection { + edges := make([]*AuditEdge, len(p.Data)) + for i, audit := range p.Data { + edges[i] = NewAuditEdge(audit, p.Cursor.OrderBy.Field) + } + + return &AuditConnection{ + Edges: edges, + PageInfo: NewPageInfo(p), + } +} + +func NewAudit(a *coredata.Audit) *Audit { + return &Audit{ + ID: a.ID, + } +} + +func NewAuditEdge(a *coredata.Audit, orderField coredata.AuditOrderField) *AuditEdge { + return &AuditEdge{ + Node: NewAudit(a), + Cursor: a.CursorKey(orderField), + } +} diff --git a/pkg/server/api/trust/v1/types/cursorkey.go b/pkg/server/api/trust/v1/types/cursorkey.go new file mode 100644 index 000000000..00acf530f --- /dev/null +++ b/pkg/server/api/trust/v1/types/cursorkey.go @@ -0,0 +1,70 @@ +// 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 ( + "errors" + "io" + "strconv" + + "github.com/99designs/gqlgen/graphql" + "github.com/getprobo/probo/pkg/page" +) + +func NewCursor[O page.OrderField]( + first *int, + after *page.CursorKey, + last *int, + before *page.CursorKey, + orderBy page.OrderBy[O], +) *page.Cursor[O] { + var ( + size int + from *page.CursorKey + direction = page.Head + ) + + if first != nil { + size = *first + direction = page.Head + from = after + } else if last != nil { + size = *last + direction = page.Tail + from = before + } + + return page.NewCursor(size, from, direction, orderBy) +} + +func MarshalCursorKeyScalar(ck page.CursorKey) graphql.Marshaler { + return graphql.WriterFunc(func(w io.Writer) { + _, _ = w.Write([]byte(strconv.Quote(ck.String()))) + }) +} + +func UnmarshalCursorKeyScalar(v interface{}) (page.CursorKey, error) { + s, ok := v.(string) + if !ok { + return page.CursorKeyNil, errors.New("must be a string") + } + + ck, err := page.ParseCursorKey(s) + if err != nil { + return page.CursorKeyNil, err + } + + return ck, nil +} diff --git a/pkg/server/api/trust/v1/types/document.go b/pkg/server/api/trust/v1/types/document.go new file mode 100644 index 000000000..535a46744 --- /dev/null +++ b/pkg/server/api/trust/v1/types/document.go @@ -0,0 +1,49 @@ +// 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" +) + +func NewDocumentConnection( + p *page.Page[*coredata.Document, coredata.DocumentOrderField], +) *DocumentConnection { + edges := make([]*DocumentEdge, len(p.Data)) + for i, document := range p.Data { + edges[i] = NewDocumentEdge(document, p.Cursor.OrderBy.Field) + } + + return &DocumentConnection{ + Edges: edges, + PageInfo: NewPageInfo(p), + } +} + +func NewDocument(d *coredata.Document) *Document { + return &Document{ + ID: d.ID, + Title: d.Title, + DocumentType: d.DocumentType, + } +} + +func NewDocumentEdge(d *coredata.Document, orderField coredata.DocumentOrderField) *DocumentEdge { + return &DocumentEdge{ + Node: NewDocument(d), + Cursor: d.CursorKey(orderField), + } +} diff --git a/pkg/server/api/trust/v1/types/document_version.go b/pkg/server/api/trust/v1/types/document_version.go new file mode 100644 index 000000000..d91e340bc --- /dev/null +++ b/pkg/server/api/trust/v1/types/document_version.go @@ -0,0 +1,47 @@ +// 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" +) + +func NewDocumentVersionConnection( + p *page.Page[*coredata.DocumentVersion, coredata.DocumentVersionOrderField], +) *DocumentVersionConnection { + edges := make([]*DocumentVersionEdge, len(p.Data)) + for i, documentVersion := range p.Data { + edges[i] = NewDocumentVersionEdge(documentVersion, p.Cursor.OrderBy.Field) + } + + return &DocumentVersionConnection{ + Edges: edges, + PageInfo: NewPageInfo(p), + } +} + +func NewDocumentVersion(dv *coredata.DocumentVersion) *DocumentVersion { + return &DocumentVersion{ + ID: dv.ID, + } +} + +func NewDocumentVersionEdge(dv *coredata.DocumentVersion, orderField coredata.DocumentVersionOrderField) *DocumentVersionEdge { + return &DocumentVersionEdge{ + Node: NewDocumentVersion(dv), + Cursor: dv.CursorKey(orderField), + } +} diff --git a/pkg/server/api/trust/v1/types/framework.go b/pkg/server/api/trust/v1/types/framework.go new file mode 100644 index 000000000..1201e4ca9 --- /dev/null +++ b/pkg/server/api/trust/v1/types/framework.go @@ -0,0 +1,26 @@ +// 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" +) + +func NewFramework(f *coredata.Framework) *Framework { + return &Framework{ + ID: f.ID, + Name: f.Name, + } +} diff --git a/pkg/server/api/trust/v1/types/gid.go b/pkg/server/api/trust/v1/types/gid.go new file mode 100644 index 000000000..2f7ca1869 --- /dev/null +++ b/pkg/server/api/trust/v1/types/gid.go @@ -0,0 +1,44 @@ +// 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 ( + "errors" + "io" + "strconv" + + "github.com/99designs/gqlgen/graphql" + "github.com/getprobo/probo/pkg/gid" +) + +func MarshalGIDScalar(id gid.GID) graphql.Marshaler { + return graphql.WriterFunc(func(w io.Writer) { + w.Write([]byte(strconv.Quote(id.String()))) + }) +} + +func UnmarshalGIDScalar(v interface{}) (gid.GID, error) { + s, ok := v.(string) + if !ok { + return gid.Nil, errors.New("must be a string") + } + + id, err := gid.ParseGID(s) + if err != nil { + return gid.Nil, err + } + + return id, nil +} diff --git a/pkg/server/api/trust/v1/types/organization.go b/pkg/server/api/trust/v1/types/organization.go new file mode 100644 index 000000000..878f60440 --- /dev/null +++ b/pkg/server/api/trust/v1/types/organization.go @@ -0,0 +1,26 @@ +// 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" +) + +func NewOrganization(o *coredata.Organization) *Organization { + return &Organization{ + ID: o.ID, + Name: o.Name, + } +} diff --git a/pkg/server/api/trust/v1/types/pageinfo.go b/pkg/server/api/trust/v1/types/pageinfo.go new file mode 100644 index 000000000..bd60d2049 --- /dev/null +++ b/pkg/server/api/trust/v1/types/pageinfo.go @@ -0,0 +1,39 @@ +// 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/page" + "go.gearno.de/x/ref" +) + +func NewPageInfo[T page.Paginable[O], O page.OrderField](p *page.Page[T, O]) *PageInfo { + var ( + startCursor *page.CursorKey + endCursor *page.CursorKey + ) + + if len(p.Data) > 0 { + startCursor = ref.Ref(p.First().CursorKey(p.Cursor.OrderBy.Field)) + endCursor = ref.Ref(p.Last().CursorKey(p.Cursor.OrderBy.Field)) + } + + return &PageInfo{ + HasNextPage: p.Info.HasNext, + HasPreviousPage: p.Info.HasPrev, + StartCursor: startCursor, + EndCursor: endCursor, + } +} diff --git a/pkg/server/api/trust/v1/types/report.go b/pkg/server/api/trust/v1/types/report.go new file mode 100644 index 000000000..9d39ec200 --- /dev/null +++ b/pkg/server/api/trust/v1/types/report.go @@ -0,0 +1,26 @@ +// 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" +) + +func NewReport(r *coredata.Report) *Report { + return &Report{ + ID: r.ID, + Filename: r.Filename, + } +} diff --git a/pkg/server/api/trust/v1/types/trust_center.go b/pkg/server/api/trust/v1/types/trust_center.go new file mode 100644 index 000000000..479befbcc --- /dev/null +++ b/pkg/server/api/trust/v1/types/trust_center.go @@ -0,0 +1,27 @@ +// 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" +) + +func NewTrustCenter(tc *coredata.TrustCenter) *TrustCenter { + return &TrustCenter{ + ID: tc.ID, + Active: tc.Active, + Slug: tc.Slug, + } +} diff --git a/pkg/server/api/trust/v1/types/types.go b/pkg/server/api/trust/v1/types/types.go new file mode 100644 index 000000000..ab57cfbad --- /dev/null +++ b/pkg/server/api/trust/v1/types/types.go @@ -0,0 +1,212 @@ +// Code generated by github.com/99designs/gqlgen, DO NOT EDIT. + +package types + +import ( + "bytes" + "fmt" + "io" + "strconv" + + "github.com/getprobo/probo/pkg/coredata" + "github.com/getprobo/probo/pkg/gid" + "github.com/getprobo/probo/pkg/page" +) + +type Node interface { + IsNode() + GetID() gid.GID +} + +type Audit struct { + ID gid.GID `json:"id"` + Framework *Framework `json:"framework"` + Report *Report `json:"report,omitempty"` + ReportURL *string `json:"reportUrl,omitempty"` +} + +func (Audit) IsNode() {} +func (this Audit) GetID() gid.GID { return this.ID } + +type AuditConnection struct { + Edges []*AuditEdge `json:"edges"` + PageInfo *PageInfo `json:"pageInfo"` +} + +type AuditEdge struct { + Cursor page.CursorKey `json:"cursor"` + Node *Audit `json:"node"` +} + +type Document struct { + ID gid.GID `json:"id"` + Title string `json:"title"` + DocumentType coredata.DocumentType `json:"documentType"` + Versions *DocumentVersionConnection `json:"versions"` +} + +func (Document) IsNode() {} +func (this Document) GetID() gid.GID { return this.ID } + +type DocumentConnection struct { + Edges []*DocumentEdge `json:"edges"` + PageInfo *PageInfo `json:"pageInfo"` +} + +type DocumentEdge struct { + Cursor page.CursorKey `json:"cursor"` + Node *Document `json:"node"` +} + +type DocumentVersion struct { + ID gid.GID `json:"id"` +} + +func (DocumentVersion) IsNode() {} +func (this DocumentVersion) GetID() gid.GID { return this.ID } + +type DocumentVersionConnection struct { + Edges []*DocumentVersionEdge `json:"edges"` + PageInfo *PageInfo `json:"pageInfo"` +} + +type DocumentVersionEdge struct { + Cursor page.CursorKey `json:"cursor"` + Node *DocumentVersion `json:"node"` +} + +type ExportDocumentVersionPDFInput struct { + DocumentVersionID gid.GID `json:"documentVersionId"` +} + +type ExportDocumentVersionPDFPayload struct { + Data string `json:"data"` +} + +type Framework struct { + ID gid.GID `json:"id"` + Name string `json:"name"` +} + +func (Framework) IsNode() {} +func (this Framework) GetID() gid.GID { return this.ID } + +type Mutation struct { +} + +type Organization struct { + ID gid.GID `json:"id"` + Name string `json:"name"` + LogoURL *string `json:"logoUrl,omitempty"` +} + +func (Organization) IsNode() {} +func (this Organization) GetID() gid.GID { return this.ID } + +type PageInfo struct { + HasNextPage bool `json:"hasNextPage"` + HasPreviousPage bool `json:"hasPreviousPage"` + StartCursor *page.CursorKey `json:"startCursor,omitempty"` + EndCursor *page.CursorKey `json:"endCursor,omitempty"` +} + +type Query struct { +} + +type Report struct { + ID gid.GID `json:"id"` + Filename string `json:"filename"` + DownloadURL *string `json:"downloadUrl,omitempty"` +} + +func (Report) IsNode() {} +func (this Report) GetID() gid.GID { return this.ID } + +type TrustCenter struct { + ID gid.GID `json:"id"` + Active bool `json:"active"` + Slug string `json:"slug"` + Organization *Organization `json:"organization"` + Documents *DocumentConnection `json:"documents"` + Audits *AuditConnection `json:"audits"` + Vendors *VendorConnection `json:"vendors"` +} + +func (TrustCenter) IsNode() {} +func (this TrustCenter) GetID() gid.GID { return this.ID } + +type Vendor struct { + ID gid.GID `json:"id"` + Name string `json:"name"` + Category coredata.VendorCategory `json:"category"` + WebsiteURL *string `json:"websiteUrl,omitempty"` + PrivacyPolicyURL *string `json:"privacyPolicyUrl,omitempty"` +} + +func (Vendor) IsNode() {} +func (this Vendor) GetID() gid.GID { return this.ID } + +type VendorConnection struct { + Edges []*VendorEdge `json:"edges"` + PageInfo *PageInfo `json:"pageInfo"` +} + +type VendorEdge struct { + Cursor page.CursorKey `json:"cursor"` + Node *Vendor `json:"node"` +} + +type Role string + +const ( + RoleNone Role = "NONE" + RoleUser Role = "USER" +) + +var AllRole = []Role{ + RoleNone, + RoleUser, +} + +func (e Role) IsValid() bool { + switch e { + case RoleNone, RoleUser: + return true + } + return false +} + +func (e Role) String() string { + return string(e) +} + +func (e *Role) UnmarshalGQL(v any) error { + str, ok := v.(string) + if !ok { + return fmt.Errorf("enums must be strings") + } + + *e = Role(str) + if !e.IsValid() { + return fmt.Errorf("%s is not a valid Role", str) + } + return nil +} + +func (e Role) MarshalGQL(w io.Writer) { + fmt.Fprint(w, strconv.Quote(e.String())) +} + +func (e *Role) UnmarshalJSON(b []byte) error { + s, err := strconv.Unquote(string(b)) + if err != nil { + return err + } + return e.UnmarshalGQL(s) +} + +func (e Role) MarshalJSON() ([]byte, error) { + var buf bytes.Buffer + e.MarshalGQL(&buf) + return buf.Bytes(), nil +} diff --git a/pkg/server/api/trust/v1/types/vendor.go b/pkg/server/api/trust/v1/types/vendor.go new file mode 100644 index 000000000..8364e003a --- /dev/null +++ b/pkg/server/api/trust/v1/types/vendor.go @@ -0,0 +1,51 @@ +// 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" +) + +func NewVendorConnection( + p *page.Page[*coredata.Vendor, coredata.VendorOrderField], +) *VendorConnection { + edges := make([]*VendorEdge, len(p.Data)) + for i, vendor := range p.Data { + edges[i] = NewVendorEdge(vendor, p.Cursor.OrderBy.Field) + } + + return &VendorConnection{ + Edges: edges, + PageInfo: NewPageInfo(p), + } +} + +func NewVendor(v *coredata.Vendor) *Vendor { + return &Vendor{ + ID: v.ID, + Name: v.Name, + Category: v.Category, + WebsiteURL: v.WebsiteURL, + PrivacyPolicyURL: v.PrivacyPolicyURL, + } +} + +func NewVendorEdge(v *coredata.Vendor, orderField coredata.VendorOrderField) *VendorEdge { + return &VendorEdge{ + Node: NewVendor(v), + Cursor: v.CursorKey(orderField), + } +} diff --git a/pkg/server/api/trust/v1/v1_resolver.go b/pkg/server/api/trust/v1/v1_resolver.go new file mode 100644 index 000000000..f53f66f59 --- /dev/null +++ b/pkg/server/api/trust/v1/v1_resolver.go @@ -0,0 +1,258 @@ +package trust_v1 + +// This file will be automatically regenerated based on the schema, any resolver implementations +// will be copied through when generating and any unknown code will be moved to the end. +// Code generated by github.com/99designs/gqlgen version v0.17.76 + +import ( + "context" + "encoding/base64" + "fmt" + "time" + + "github.com/getprobo/probo/pkg/coredata" + "github.com/getprobo/probo/pkg/gid" + "github.com/getprobo/probo/pkg/page" + "github.com/getprobo/probo/pkg/server/api/trust/v1/schema" + "github.com/getprobo/probo/pkg/server/api/trust/v1/types" +) + +// Framework is the resolver for the framework field. +func (r *auditResolver) Framework(ctx context.Context, obj *types.Audit) (*types.Framework, error) { + trust := r.TrustService(ctx, obj.ID.TenantID()) + + audit, err := trust.Audits.Get(ctx, obj.ID) + if err != nil { + return nil, fmt.Errorf("cannot load audit: %w", err) + } + + framework, err := trust.Frameworks.Get(ctx, audit.FrameworkID) + if err != nil { + return nil, fmt.Errorf("cannot load framework: %w", err) + } + + return types.NewFramework(framework), nil +} + +// Report is the resolver for the report field. +func (r *auditResolver) Report(ctx context.Context, obj *types.Audit) (*types.Report, error) { + trust := r.TrustService(ctx, obj.ID.TenantID()) + + audit, err := trust.Audits.Get(ctx, obj.ID) + if err != nil { + return nil, fmt.Errorf("cannot load audit: %w", err) + } + + if audit.ReportID == nil { + return nil, nil + } + + report, err := trust.Reports.Get(ctx, *audit.ReportID) + if err != nil { + return nil, fmt.Errorf("cannot load report: %w", err) + } + + return types.NewReport(report), nil +} + +// ReportURL is the resolver for the reportUrl field. +func (r *auditResolver) ReportURL(ctx context.Context, obj *types.Audit) (*string, error) { + trust := r.TrustService(ctx, obj.ID.TenantID()) + + audit, err := trust.Audits.Get(ctx, obj.ID) + if err != nil { + return nil, fmt.Errorf("cannot load audit: %w", err) + } + + if audit.ReportID == nil { + return nil, nil + } + + url, err := trust.Audits.GenerateReportURL(ctx, obj.ID, 15*time.Minute) + if err != nil { + return nil, fmt.Errorf("cannot generate report URL: %w", err) + } + + return url, nil +} + +// Versions is the resolver for the versions field. +func (r *documentResolver) Versions(ctx context.Context, obj *types.Document, first *int, after *page.CursorKey, last *int, before *page.CursorKey) (*types.DocumentVersionConnection, error) { + trust := r.TrustService(ctx, obj.ID.TenantID()) + + pageOrderBy := page.OrderBy[coredata.DocumentVersionOrderField]{ + Field: coredata.DocumentVersionOrderFieldCreatedAt, + Direction: page.OrderDirectionDesc, + } + cursor := types.NewCursor(first, after, last, before, pageOrderBy) + + // For the public trust API, only return published versions + page, err := trust.Documents.ListVersions(ctx, obj.ID, cursor) + if err != nil { + return nil, fmt.Errorf("cannot list document versions: %w", err) + } + + // Filter to only published versions and create edges directly + publishedEdges := make([]*types.DocumentVersionEdge, 0) + for _, version := range page.Data { + if version.Status == coredata.DocumentStatusPublished { + edge := &types.DocumentVersionEdge{ + Cursor: version.CursorKey(pageOrderBy.Field), + Node: types.NewDocumentVersion(version), + } + publishedEdges = append(publishedEdges, edge) + } + } + + return &types.DocumentVersionConnection{ + Edges: publishedEdges, + PageInfo: types.NewPageInfo(page), + }, nil +} + +// ExportDocumentVersionPDF is the resolver for the exportDocumentVersionPDF field. +func (r *mutationResolver) ExportDocumentVersionPDF(ctx context.Context, input types.ExportDocumentVersionPDFInput) (*types.ExportDocumentVersionPDFPayload, error) { + trust := r.trustCenterSvc.WithTenant(input.DocumentVersionID.TenantID()) + + pdf, err := trust.Documents.ExportPDF(ctx, input.DocumentVersionID) + if err != nil { + return nil, fmt.Errorf("cannot export document version PDF: %w", err) + } + + return &types.ExportDocumentVersionPDFPayload{ + Data: fmt.Sprintf("data:application/pdf;base64,%s", base64.StdEncoding.EncodeToString(pdf)), + }, nil +} + +// LogoURL is the resolver for the logoUrl field. +func (r *organizationResolver) LogoURL(ctx context.Context, obj *types.Organization) (*string, error) { + trust := r.TrustService(ctx, obj.ID.TenantID()) + + return trust.Organizations.GenerateLogoURL(ctx, obj.ID, 1*time.Hour) +} + +// TrustCenterBySlug is the resolver for the trustCenterBySlug field. +func (r *queryResolver) TrustCenterBySlug(ctx context.Context, slug string) (*types.TrustCenter, error) { + trust := r.trustCenterSvc.WithTenant(gid.NewTenantID()) + + trustCenter, err := trust.TrustCenters.GetBySlug(ctx, slug) + if err != nil { + return nil, nil + } + + if !trustCenter.Active { + return nil, nil + } + + result := types.NewTrustCenter(trustCenter) + + orgTrust := r.trustCenterSvc.WithTenant(trustCenter.TenantID) + org, err := orgTrust.Organizations.Get(ctx, trustCenter.OrganizationID) + if err != nil { + return nil, fmt.Errorf("cannot get organization: %w", err) + } + + result.Organization = types.NewOrganization(org) + + return result, nil +} + +// DownloadURL is the resolver for the downloadUrl field. +func (r *reportResolver) DownloadURL(ctx context.Context, obj *types.Report) (*string, error) { + trust := r.TrustService(ctx, obj.ID.TenantID()) + + url, err := trust.Reports.GenerateDownloadURL(ctx, obj.ID, 5*time.Minute) + if err != nil { + return nil, fmt.Errorf("cannot generate download URL: %w", err) + } + + return url, nil +} + +// Organization is the resolver for the organization field. +func (r *trustCenterResolver) Organization(ctx context.Context, obj *types.TrustCenter) (*types.Organization, error) { + return obj.Organization, nil +} + +// Documents is the resolver for the documents field. +func (r *trustCenterResolver) Documents(ctx context.Context, obj *types.TrustCenter, first *int, after *page.CursorKey, last *int, before *page.CursorKey) (*types.DocumentConnection, error) { + trust := r.trustCenterSvc.WithTenant(obj.Organization.ID.TenantID()) + + pageOrderBy := page.OrderBy[coredata.DocumentOrderField]{ + Field: coredata.DocumentOrderFieldTitle, + Direction: page.OrderDirectionAsc, + } + cursor := types.NewCursor(first, after, last, before, pageOrderBy) + + documentPage, err := trust.Documents.ListForOrganizationId(ctx, obj.Organization.ID, cursor) + if err != nil { + return nil, fmt.Errorf("cannot list public documents: %w", err) + } + + return types.NewDocumentConnection(documentPage), nil +} + +// Audits is the resolver for the audits field. +func (r *trustCenterResolver) Audits(ctx context.Context, obj *types.TrustCenter, first *int, after *page.CursorKey, last *int, before *page.CursorKey) (*types.AuditConnection, error) { + trust := r.trustCenterSvc.WithTenant(obj.Organization.ID.TenantID()) + + pageOrderBy := page.OrderBy[coredata.AuditOrderField]{ + Field: coredata.AuditOrderFieldValidFrom, + Direction: page.OrderDirectionDesc, + } + cursor := types.NewCursor(first, after, last, before, pageOrderBy) + + auditPage, err := trust.Audits.ListForOrganizationId(ctx, obj.Organization.ID, cursor) + if err != nil { + return nil, fmt.Errorf("cannot list public audits: %w", err) + } + + return types.NewAuditConnection(auditPage), nil +} + +// Vendors is the resolver for the vendors field. +func (r *trustCenterResolver) Vendors(ctx context.Context, obj *types.TrustCenter, first *int, after *page.CursorKey, last *int, before *page.CursorKey) (*types.VendorConnection, error) { + trust := r.trustCenterSvc.WithTenant(obj.Organization.ID.TenantID()) + + pageOrderBy := page.OrderBy[coredata.VendorOrderField]{ + Field: coredata.VendorOrderFieldName, + Direction: page.OrderDirectionAsc, + } + cursor := types.NewCursor(first, after, last, before, pageOrderBy) + + vendorPage, err := trust.Vendors.ListForOrganizationId(ctx, obj.Organization.ID, cursor) + if err != nil { + return nil, fmt.Errorf("cannot list public vendors: %w", err) + } + + return types.NewVendorConnection(vendorPage), nil +} + +// Audit returns schema.AuditResolver implementation. +func (r *Resolver) Audit() schema.AuditResolver { return &auditResolver{r} } + +// Document returns schema.DocumentResolver implementation. +func (r *Resolver) Document() schema.DocumentResolver { return &documentResolver{r} } + +// Mutation returns schema.MutationResolver implementation. +func (r *Resolver) Mutation() schema.MutationResolver { return &mutationResolver{r} } + +// Organization returns schema.OrganizationResolver implementation. +func (r *Resolver) Organization() schema.OrganizationResolver { return &organizationResolver{r} } + +// Query returns schema.QueryResolver implementation. +func (r *Resolver) Query() schema.QueryResolver { return &queryResolver{r} } + +// Report returns schema.ReportResolver implementation. +func (r *Resolver) Report() schema.ReportResolver { return &reportResolver{r} } + +// TrustCenter returns schema.TrustCenterResolver implementation. +func (r *Resolver) TrustCenter() schema.TrustCenterResolver { return &trustCenterResolver{r} } + +type auditResolver struct{ *Resolver } +type documentResolver struct{ *Resolver } +type mutationResolver struct{ *Resolver } +type organizationResolver struct{ *Resolver } +type queryResolver struct{ *Resolver } +type reportResolver struct{ *Resolver } +type trustCenterResolver struct{ *Resolver } diff --git a/pkg/server/server.go b/pkg/server/server.go index 50e9f7071..9c84cb9d8 100644 --- a/pkg/server/server.go +++ b/pkg/server/server.go @@ -24,8 +24,8 @@ import ( "github.com/getprobo/probo/pkg/probo" "github.com/getprobo/probo/pkg/saferedirect" "github.com/getprobo/probo/pkg/server/api" - console_v1 "github.com/getprobo/probo/pkg/server/api/console/v1" "github.com/getprobo/probo/pkg/server/web" + "github.com/getprobo/probo/pkg/trust" "github.com/getprobo/probo/pkg/usrmgr" "github.com/go-chi/chi/v5" "go.gearno.de/kit/log" @@ -37,7 +37,8 @@ type Config struct { ExtraHeaderFields map[string]string Probo *probo.Service Usrmgr *usrmgr.Service - Auth console_v1.AuthConfig + Trust *trust.Service + Auth api.AuthConfig ConnectorRegistry *connector.ConnectorRegistry Agent *agents.Agent SafeRedirect *saferedirect.SafeRedirect @@ -59,6 +60,7 @@ func NewServer(cfg Config) (*Server, error) { AllowedOrigins: cfg.AllowedOrigins, Probo: cfg.Probo, Usrmgr: cfg.Usrmgr, + Trust: cfg.Trust, Auth: cfg.Auth, ConnectorRegistry: cfg.ConnectorRegistry, SafeRedirect: cfg.SafeRedirect, diff --git a/pkg/trust/audit_service.go b/pkg/trust/audit_service.go new file mode 100644 index 000000000..4ea5e6b8b --- /dev/null +++ b/pkg/trust/audit_service.go @@ -0,0 +1,99 @@ +// 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 trust + +import ( + "context" + "fmt" + "time" + + "github.com/getprobo/probo/pkg/coredata" + "github.com/getprobo/probo/pkg/gid" + "github.com/getprobo/probo/pkg/page" + "go.gearno.de/kit/pg" +) + +type AuditService struct { + svc *TenantService +} + +func (s AuditService) Get( + ctx context.Context, + auditID gid.GID, +) (*coredata.Audit, error) { + audit := &coredata.Audit{} + + err := s.svc.pg.WithConn( + ctx, + func(conn pg.Conn) error { + return audit.LoadByID(ctx, conn, s.svc.scope, auditID) + }, + ) + + if err != nil { + return nil, err + } + + return audit, nil +} + +func (s AuditService) ListForOrganizationId( + ctx context.Context, + organizationID gid.GID, + cursor *page.Cursor[coredata.AuditOrderField], +) (*page.Page[*coredata.Audit, coredata.AuditOrderField], error) { + var audits coredata.Audits + + err := s.svc.pg.WithConn( + ctx, + func(conn pg.Conn) error { + filter := coredata.NewAuditTrustCenterFilter() + err := audits.LoadByOrganizationID(ctx, conn, s.svc.scope, organizationID, cursor, filter) + if err != nil { + return fmt.Errorf("cannot load audits: %w", err) + } + + return nil + }, + ) + + if err != nil { + return nil, err + } + + return page.NewPage(audits, cursor), nil +} + +func (s AuditService) GenerateReportURL( + ctx context.Context, + auditID gid.GID, + expiresIn time.Duration, +) (*string, error) { + audit, err := s.Get(ctx, auditID) + if err != nil { + return nil, fmt.Errorf("cannot get audit: %w", err) + } + + if audit.ReportID == nil { + return nil, fmt.Errorf("audit has no report") + } + + url, err := s.svc.Reports.GenerateDownloadURL(ctx, *audit.ReportID, expiresIn) + if err != nil { + return nil, fmt.Errorf("cannot generate report download URL: %w", err) + } + + return url, nil +} diff --git a/pkg/trust/document_service.go b/pkg/trust/document_service.go new file mode 100644 index 000000000..455a7818b --- /dev/null +++ b/pkg/trust/document_service.go @@ -0,0 +1,219 @@ +// 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 trust + +import ( + "context" + "fmt" + "io" + + "github.com/getprobo/probo/pkg/coredata" + "github.com/getprobo/probo/pkg/docgen" + "github.com/getprobo/probo/pkg/gid" + "github.com/getprobo/probo/pkg/html2pdf" + "github.com/getprobo/probo/pkg/page" + "go.gearno.de/kit/pg" +) + +type ( + DocumentService struct { + svc *TenantService + html2pdfConverter *html2pdf.Converter + } +) + +// ListVersions lists all versions of a document +func (s *DocumentService) ListVersions( + ctx context.Context, + documentID gid.GID, + cursor *page.Cursor[coredata.DocumentVersionOrderField], +) (*page.Page[*coredata.DocumentVersion, coredata.DocumentVersionOrderField], error) { + var documentVersions coredata.DocumentVersions + + err := s.svc.pg.WithConn( + ctx, + func(conn pg.Conn) error { + return documentVersions.LoadByDocumentID(ctx, conn, s.svc.scope, documentID, cursor) + }, + ) + + if err != nil { + return nil, err + } + + return page.NewPage(documentVersions, cursor), nil +} + +func (s *DocumentService) ListForOrganizationId( + ctx context.Context, + organizationID gid.GID, + cursor *page.Cursor[coredata.DocumentOrderField], +) (*page.Page[*coredata.Document, coredata.DocumentOrderField], error) { + var documents coredata.Documents + + err := s.svc.pg.WithConn( + ctx, + func(conn pg.Conn) error { + filter := coredata.NewDocumentTrustCenterFilter() + err := documents.LoadByOrganizationID(ctx, conn, s.svc.scope, organizationID, cursor, filter) + if err != nil { + return fmt.Errorf("cannot load documents: %w", err) + } + + return nil + }, + ) + + if err != nil { + return nil, err + } + + return page.NewPage(documents, cursor), nil +} + +func (s *DocumentService) ExportPDF( + ctx context.Context, + documentVersionID gid.GID, +) ([]byte, error) { + document := &coredata.Document{} + version := &coredata.DocumentVersion{} + owner := &coredata.People{} + publishedBy := &coredata.People{} + signatures := coredata.DocumentVersionSignatures{} + peopleMap := make(map[gid.GID]*coredata.People) + + err := s.svc.pg.WithConn( + ctx, + func(conn pg.Conn) error { + if err := version.LoadByID(ctx, conn, s.svc.scope, documentVersionID); err != nil { + return fmt.Errorf("cannot load document version: %w", err) + } + + if err := document.LoadByID(ctx, conn, s.svc.scope, version.DocumentID); err != nil { + return fmt.Errorf("cannot load document: %w", err) + } + + if !document.ShowOnTrustCenter { + return fmt.Errorf("document not visible on trust center") + } + + if version.PublishedBy != nil { + if err := publishedBy.LoadByID(ctx, conn, s.svc.scope, *version.PublishedBy); err != nil { + return fmt.Errorf("cannot load published by person: %w", err) + } + } + + cursor := page.NewCursor( + 100, + nil, + page.Head, + page.OrderBy[coredata.DocumentVersionSignatureOrderField]{ + Field: coredata.DocumentVersionSignatureOrderFieldCreatedAt, + Direction: page.OrderDirectionAsc, + }, + ) + + if err := signatures.LoadByDocumentVersionID(ctx, conn, s.svc.scope, documentVersionID, cursor); err != nil { + return fmt.Errorf("cannot load document version signatures: %w", err) + } + + if err := owner.LoadByID(ctx, conn, s.svc.scope, document.OwnerID); err != nil { + return fmt.Errorf("cannot load document owner: %w", err) + } + + // TODO: refactor this to use a single query + for _, sig := range signatures { + if _, ok := peopleMap[sig.SignedBy]; !ok { + people := &coredata.People{} + if err := people.LoadByID(ctx, conn, s.svc.scope, sig.SignedBy); err != nil { + return fmt.Errorf("cannot load people %q: %w", sig.SignedBy, err) + } + peopleMap[sig.SignedBy] = people + } + + if _, ok := peopleMap[sig.RequestedBy]; !ok { + people := &coredata.People{} + if err := people.LoadByID(ctx, conn, s.svc.scope, sig.RequestedBy); err != nil { + return fmt.Errorf("cannot load people %q: %w", sig.RequestedBy, err) + } + peopleMap[sig.RequestedBy] = people + } + } + + return nil + }, + ) + + if err != nil { + return nil, err + } + + classification := docgen.ClassificationInternal + switch document.DocumentType { + case coredata.DocumentTypePolicy: + classification = docgen.ClassificationConfidential + case coredata.DocumentTypeISMS: + classification = docgen.ClassificationSecret + } + + docData := docgen.DocumentData{ + Title: version.Title, + Content: version.Content, + Version: version.VersionNumber, + Classification: classification, + Approver: owner.FullName, + Description: version.Changelog, + PublishedAt: version.PublishedAt, + PublishedBy: publishedBy.FullName, + Signatures: make([]docgen.SignatureData, len(signatures)), + } + + for i, sig := range signatures { + docData.Signatures[i] = docgen.SignatureData{ + SignedBy: peopleMap[sig.SignedBy].FullName, + SignedAt: sig.SignedAt, + State: sig.State, + RequestedAt: sig.RequestedAt, + RequestedBy: peopleMap[sig.RequestedBy].FullName, + } + } + + htmlContent, err := docgen.RenderHTML(docData) + if err != nil { + return nil, fmt.Errorf("cannot generate HTML: %w", err) + } + + cfg := html2pdf.RenderConfig{ + PageFormat: html2pdf.PageFormatA4, + Orientation: html2pdf.OrientationPortrait, + MarginTop: html2pdf.NewMarginInches(1.0), + MarginBottom: html2pdf.NewMarginInches(1.0), + MarginLeft: html2pdf.NewMarginInches(1.0), + MarginRight: html2pdf.NewMarginInches(1.0), + PrintBackground: true, + Scale: 1.0, + } + + pdfReader, err := s.html2pdfConverter.GeneratePDF(ctx, htmlContent, cfg) + if err != nil { + return nil, fmt.Errorf("cannot generate PDF: %w", err) + } + + pdfData, err := io.ReadAll(pdfReader) + if err != nil { + return nil, fmt.Errorf("cannot read PDF data: %w", err) + } + return pdfData, nil +} diff --git a/pkg/trust/framework_service.go b/pkg/trust/framework_service.go new file mode 100644 index 000000000..66ab8595a --- /dev/null +++ b/pkg/trust/framework_service.go @@ -0,0 +1,51 @@ +// 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 trust + +import ( + "context" + + "fmt" + + "github.com/getprobo/probo/pkg/coredata" + "github.com/getprobo/probo/pkg/gid" + "go.gearno.de/kit/pg" +) + +type FrameworkService struct { + svc *TenantService +} + +func (s FrameworkService) Get( + ctx context.Context, + frameworkID gid.GID, +) (*coredata.Framework, error) { + framework := &coredata.Framework{} + + err := s.svc.pg.WithConn(ctx, func(conn pg.Conn) error { + err := framework.LoadByID(ctx, conn, s.svc.scope, frameworkID) + if err != nil { + return fmt.Errorf("cannot load framework: %w", err) + } + + return nil + }) + + if err != nil { + return nil, err + } + + return framework, nil +} diff --git a/pkg/trust/organization_service.go b/pkg/trust/organization_service.go new file mode 100644 index 000000000..9576c49e9 --- /dev/null +++ b/pkg/trust/organization_service.go @@ -0,0 +1,97 @@ +// 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 trust + +import ( + "context" + "fmt" + "net/url" + "time" + + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/service/s3" + "github.com/getprobo/probo/pkg/coredata" + "github.com/getprobo/probo/pkg/gid" + "go.gearno.de/kit/pg" +) + +type OrganizationService struct { + svc *TenantService +} + +func (s OrganizationService) Get( + ctx context.Context, + organizationID gid.GID, +) (*coredata.Organization, error) { + organization := &coredata.Organization{} + + err := s.svc.pg.WithConn( + ctx, + func(conn pg.Conn) error { + err := organization.LoadByID( + ctx, + conn, + s.svc.scope, + organizationID, + ) + if err != nil { + return fmt.Errorf("cannot load organization: %w", err) + } + + return nil + }, + ) + + if err != nil { + return nil, err + } + + return organization, nil +} + +func (s OrganizationService) GenerateLogoURL( + ctx context.Context, + organizationID gid.GID, + expiresIn time.Duration, +) (*string, error) { + organization, err := s.Get(ctx, organizationID) + if err != nil { + return nil, fmt.Errorf("cannot get organization: %w", err) + } + + if organization.LogoObjectKey == "" { + return nil, nil + } + + presignClient := s3.NewPresignClient(s.svc.s3) + + encodedFilename := url.QueryEscape(organization.Name) + contentDisposition := fmt.Sprintf("attachment; filename=\"%s\"; filename*=UTF-8''%s", + encodedFilename, encodedFilename) + + presignedReq, err := presignClient.PresignGetObject(ctx, &s3.GetObjectInput{ + Bucket: aws.String(s.svc.bucket), + Key: aws.String(organization.LogoObjectKey), + ResponseCacheControl: aws.String("max-age=3600, public"), + ResponseContentDisposition: aws.String(contentDisposition), + }, func(opts *s3.PresignOptions) { + opts.Expires = expiresIn + }) + if err != nil { + return nil, fmt.Errorf("cannot presign GetObject request: %w", err) + } + + return &presignedReq.URL, nil +} diff --git a/pkg/trust/report_service.go b/pkg/trust/report_service.go new file mode 100644 index 000000000..95d4b2781 --- /dev/null +++ b/pkg/trust/report_service.go @@ -0,0 +1,84 @@ +// 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 trust + +import ( + "context" + "fmt" + "time" + + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/service/s3" + "github.com/getprobo/probo/pkg/coredata" + "github.com/getprobo/probo/pkg/gid" + "go.gearno.de/kit/pg" +) + +type ReportService struct { + svc *TenantService +} + +func (s ReportService) Get( + ctx context.Context, + reportID gid.GID, +) (*coredata.Report, error) { + report := &coredata.Report{} + + err := s.svc.pg.WithConn( + ctx, + func(conn pg.Conn) error { + err := report.LoadByID(ctx, conn, s.svc.scope, reportID) + if err != nil { + return fmt.Errorf("cannot load report: %w", err) + } + + return nil + }, + ) + + if err != nil { + return nil, err + } + + return report, nil +} + +func (s ReportService) GenerateDownloadURL( + ctx context.Context, + reportID gid.GID, + expiresIn time.Duration, +) (*string, error) { + report, err := s.Get(ctx, reportID) + if err != nil { + return nil, fmt.Errorf("cannot get report: %w", err) + } + + presignClient := s3.NewPresignClient(s.svc.s3) + + presignedReq, err := presignClient.PresignGetObject(ctx, &s3.GetObjectInput{ + Bucket: aws.String(s.svc.bucket), + Key: aws.String(report.ObjectKey), + ResponseCacheControl: aws.String("max-age=3600, public"), + ResponseContentType: aws.String(report.MimeType), + ResponseContentDisposition: aws.String(fmt.Sprintf("attachment; filename=\"%s\"", report.Filename)), + }, func(opts *s3.PresignOptions) { + opts.Expires = expiresIn + }) + if err != nil { + return nil, fmt.Errorf("cannot presign GetObject request: %w", err) + } + + return &presignedReq.URL, nil +} diff --git a/pkg/trust/service.go b/pkg/trust/service.go new file mode 100644 index 000000000..9f2770939 --- /dev/null +++ b/pkg/trust/service.go @@ -0,0 +1,108 @@ +// 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 trust + +import ( + "github.com/aws/aws-sdk-go-v2/service/s3" + "github.com/getprobo/probo/pkg/coredata" + "github.com/getprobo/probo/pkg/crypto/cipher" + "github.com/getprobo/probo/pkg/gid" + "github.com/getprobo/probo/pkg/html2pdf" + "github.com/getprobo/probo/pkg/probo" + "github.com/getprobo/probo/pkg/usrmgr" + "go.gearno.de/kit/pg" +) + +type ( + Service struct { + pg *pg.Client + s3 *s3.Client + bucket string + proboSvc *probo.Service + encryptionKey cipher.EncryptionKey + tokenSecret string + usrmgr *usrmgr.Service + html2pdfConverter *html2pdf.Converter + } + + TenantService struct { + pg *pg.Client + s3 *s3.Client + bucket string + scope coredata.Scoper + proboSvc *probo.Service + encryptionKey cipher.EncryptionKey + tokenSecret string + usrmgr *usrmgr.Service + html2pdfConverter *html2pdf.Converter + TrustCenters *TrustCenterService + Documents *DocumentService + Audits *AuditService + Vendors *VendorService + Frameworks *FrameworkService + TrustCenterAccesses *TrustCenterAccessService + Reports *ReportService + Organizations *OrganizationService + } +) + +func NewService( + pgClient *pg.Client, + s3Client *s3.Client, + bucket string, + encryptionKey cipher.EncryptionKey, + tokenSecret string, + usrmgr *usrmgr.Service, + html2pdfConverter *html2pdf.Converter, +) *Service { + return &Service{ + pg: pgClient, + s3: s3Client, + bucket: bucket, + encryptionKey: encryptionKey, + tokenSecret: tokenSecret, + usrmgr: usrmgr, + html2pdfConverter: html2pdfConverter, + } +} + +func (s *Service) GetEncryptionKey() cipher.EncryptionKey { + return s.encryptionKey +} + +func (s *Service) WithTenant(tenantID gid.TenantID) *TenantService { + tenantService := &TenantService{ + pg: s.pg, + s3: s.s3, + bucket: s.bucket, + scope: coredata.NewScope(tenantID), + proboSvc: s.proboSvc, + encryptionKey: s.encryptionKey, + tokenSecret: s.tokenSecret, + usrmgr: s.usrmgr, + html2pdfConverter: s.html2pdfConverter, + } + + tenantService.TrustCenters = &TrustCenterService{svc: tenantService} + tenantService.Documents = &DocumentService{svc: tenantService, html2pdfConverter: s.html2pdfConverter} + tenantService.Audits = &AuditService{svc: tenantService} + tenantService.Vendors = &VendorService{svc: tenantService} + tenantService.Frameworks = &FrameworkService{svc: tenantService} + tenantService.TrustCenterAccesses = &TrustCenterAccessService{svc: tenantService, usrmgr: s.usrmgr} + tenantService.Reports = &ReportService{svc: tenantService} + tenantService.Organizations = &OrganizationService{svc: tenantService} + + return tenantService +} diff --git a/pkg/trust/trust_center_access_service.go b/pkg/trust/trust_center_access_service.go new file mode 100644 index 000000000..b1048d663 --- /dev/null +++ b/pkg/trust/trust_center_access_service.go @@ -0,0 +1,89 @@ +// 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 trust + +import ( + "context" + "fmt" + + "github.com/getprobo/probo/pkg/coredata" + "github.com/getprobo/probo/pkg/gid" + "github.com/getprobo/probo/pkg/probo" + "github.com/getprobo/probo/pkg/statelesstoken" + "github.com/getprobo/probo/pkg/usrmgr" + "go.gearno.de/kit/pg" +) + +type ( + TrustCenterAccessService struct { + svc *TenantService + usrmgr *usrmgr.Service + } +) + +const ( + TokenTypeTrustCenterAccess = "trust_center_access" +) + +func (s TrustCenterAccessService) ValidateToken( + ctx context.Context, + tokenString string, +) (*probo.TrustCenterAccessData, error) { + token, err := statelesstoken.ValidateToken[probo.TrustCenterAccessData]( + s.svc.tokenSecret, + TokenTypeTrustCenterAccess, + tokenString, + ) + if err != nil { + return nil, fmt.Errorf("cannot validate trust center access token: %w", err) + } + + access := &coredata.TrustCenterAccess{} + err = s.svc.pg.WithConn(ctx, func(conn pg.Conn) error { + err := access.LoadByTrustCenterIDAndEmail(ctx, conn, s.svc.scope, token.Data.TrustCenterID, token.Data.Email) + if err != nil { + return fmt.Errorf("cannot load trust center access: %w", err) + } + + return nil + }) + + if err != nil { + return nil, err + } + + if !access.Active { + return nil, fmt.Errorf("access has been revoked") + } + + return &token.Data, nil +} + +func (s TrustCenterAccessService) IsAccessActive( + ctx context.Context, + trustCenterID gid.GID, + email string, +) (bool, error) { + access := &coredata.TrustCenterAccess{} + err := s.svc.pg.WithConn(ctx, func(conn pg.Conn) error { + return access.LoadByTrustCenterIDAndEmail(ctx, conn, s.svc.scope, trustCenterID, email) + }) + + if err != nil { + return false, fmt.Errorf("cannot load trust center access: %w", err) + } + + return access.Active, nil +} diff --git a/pkg/trust/trust_center_service.go b/pkg/trust/trust_center_service.go new file mode 100644 index 000000000..8265db061 --- /dev/null +++ b/pkg/trust/trust_center_service.go @@ -0,0 +1,53 @@ +// 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 trust + +import ( + "context" + + "fmt" + + "github.com/getprobo/probo/pkg/coredata" + "go.gearno.de/kit/pg" +) + +type TrustCenterService struct { + svc *TenantService +} + +func (s TrustCenterService) GetBySlug( + ctx context.Context, + slug string, +) (*coredata.TrustCenter, error) { + trustCenter := &coredata.TrustCenter{} + + err := s.svc.pg.WithConn( + ctx, + func(conn pg.Conn) error { + err := trustCenter.LoadBySlug(ctx, conn, slug) + if err != nil { + return fmt.Errorf("cannot load trust center: %w", err) + } + + return nil + }, + ) + + if err != nil { + return nil, err + } + + return trustCenter, nil +} diff --git a/pkg/trust/vendor_service.go b/pkg/trust/vendor_service.go new file mode 100644 index 000000000..f6947a488 --- /dev/null +++ b/pkg/trust/vendor_service.go @@ -0,0 +1,81 @@ +// 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 trust + +import ( + "context" + "fmt" + + "github.com/getprobo/probo/pkg/coredata" + "github.com/getprobo/probo/pkg/gid" + "github.com/getprobo/probo/pkg/page" + "go.gearno.de/kit/pg" +) + +type VendorService struct { + svc *TenantService +} + +func (s VendorService) Get( + ctx context.Context, + vendorID gid.GID, +) (*coredata.Vendor, error) { + vendor := &coredata.Vendor{} + + err := s.svc.pg.WithConn( + ctx, + func(conn pg.Conn) error { + err := vendor.LoadByID(ctx, conn, s.svc.scope, vendorID) + if err != nil { + return fmt.Errorf("cannot load vendor: %w", err) + } + + return nil + }, + ) + + if err != nil { + return nil, err + } + + return vendor, nil +} + +func (s VendorService) ListForOrganizationId( + ctx context.Context, + organizationID gid.GID, + cursor *page.Cursor[coredata.VendorOrderField], +) (*page.Page[*coredata.Vendor, coredata.VendorOrderField], error) { + var vendors coredata.Vendors + + err := s.svc.pg.WithConn( + ctx, + func(conn pg.Conn) error { + filter := coredata.NewVendorTrustCenterFilter() + err := vendors.LoadByOrganizationID(ctx, conn, s.svc.scope, organizationID, cursor, filter) + if err != nil { + return fmt.Errorf("cannot load vendors: %w", err) + } + + return nil + }, + ) + + if err != nil { + return nil, err + } + + return page.NewPage(vendors, cursor), nil +} diff --git a/pkg/usrmgr/usrmgr.go b/pkg/usrmgr/usrmgr.go index 593aa3c7f..13d6939ec 100644 --- a/pkg/usrmgr/usrmgr.go +++ b/pkg/usrmgr/usrmgr.go @@ -123,6 +123,19 @@ var ( [1] %s ` + + trustCenterAccessEmailSubject = "Trust Center Access Invitation - %s" + trustCenterAccessEmailTemplate = ` + You have been granted access to %s's Trust Center! + + Click the link below to access it: + + [1] %s + + This link will expire in 7 days. + + If the link above doesn't work, copy and paste the entire URL into your browser. + ` ) func (e ErrInvalidCredentials) Error() string { @@ -909,3 +922,25 @@ func (s Service) ResetPassword(ctx context.Context, tokenString string, newPassw }, ) } + +func (s Service) SendTrustCenterAccessEmail( + ctx context.Context, + name string, + email string, + companyName string, + accessURL string, +) error { + accessEmail := coredata.NewEmail( + name, + email, + fmt.Sprintf(trustCenterAccessEmailSubject, companyName), + fmt.Sprintf(trustCenterAccessEmailTemplate, companyName, accessURL), + ) + + return s.pg.WithTx(ctx, func(tx pg.Conn) error { + if err := accessEmail.Insert(ctx, tx); err != nil { + return fmt.Errorf("cannot insert access email: %w", err) + } + return nil + }) +}