From d0af53e1f480e518ec9e4f7f5d2f1a606e29cc45 Mon Sep 17 00:00:00 2001 From: Sacha Al Himdani Date: Mon, 16 Feb 2026 10:51:03 +0100 Subject: [PATCH] Fix control order in SOA Signed-off-by: Sacha Al Himdani --- ...pplicabilityControlsTabFragment.graphql.ts | 8 +- ...cabilityControlsTabRefetchQuery.graphql.ts | 370 ++++ ...eOfApplicabilityDetailPageQuery.graphql.ts | 10 +- ...ooksSettingsPage_createMutation.graphql.ts | 6 +- .../AddApplicabilityStatementDialog.tsx | 9 +- .../dialogs/EditControlDialog.tsx | 7 - .../tabs/StateOfApplicabilityControlsTab.tsx | 27 +- pkg/coredata/applicability_statement.go | 85 +- .../applicability_statement_order_field.go | 8 +- pkg/probo/state_of_applicability_service.go | 2 +- pkg/server/api/console/v1/schema.graphql | 4 + pkg/server/api/console/v1/schema/schema.go | 1486 +++++++++-------- pkg/server/api/console/v1/types/types.go | 34 +- 13 files changed, 1259 insertions(+), 797 deletions(-) create mode 100644 apps/console/src/__generated__/core/StateOfApplicabilityControlsTabRefetchQuery.graphql.ts diff --git a/apps/console/src/__generated__/core/StateOfApplicabilityControlsTabFragment.graphql.ts b/apps/console/src/__generated__/core/StateOfApplicabilityControlsTabFragment.graphql.ts index 396166d39..32f5a5937 100644 --- a/apps/console/src/__generated__/core/StateOfApplicabilityControlsTabFragment.graphql.ts +++ b/apps/console/src/__generated__/core/StateOfApplicabilityControlsTabFragment.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<6a0d32b2293db5f05fee4b79e61db4b6>> + * @generated SignedSource<<3eedb29b73b6e2c450d59f1d1ae0d88a>> * @lightSyntaxTransform * @nogrep */ @@ -144,7 +144,7 @@ return { "name": "orderBy", "value": { "direction": "ASC", - "field": "CREATED_AT" + "field": "CONTROL_SECTION_TITLE" } } ], @@ -304,7 +304,7 @@ return { ] } ], - "storageKey": "__StateOfApplicabilityControlsTab_applicabilityStatements_connection(orderBy:{\"direction\":\"ASC\",\"field\":\"CREATED_AT\"})" + "storageKey": "__StateOfApplicabilityControlsTab_applicabilityStatements_connection(orderBy:{\"direction\":\"ASC\",\"field\":\"CONTROL_SECTION_TITLE\"})" } ], "type": "StateOfApplicability", @@ -312,6 +312,6 @@ return { }; })(); -(node as any).hash = "b5a28520cb7a702b208cbfad2c904a99"; +(node as any).hash = "b80671ffb8f18997cb72a9beddd6cad3"; export default node; diff --git a/apps/console/src/__generated__/core/StateOfApplicabilityControlsTabRefetchQuery.graphql.ts b/apps/console/src/__generated__/core/StateOfApplicabilityControlsTabRefetchQuery.graphql.ts new file mode 100644 index 000000000..ae496e514 --- /dev/null +++ b/apps/console/src/__generated__/core/StateOfApplicabilityControlsTabRefetchQuery.graphql.ts @@ -0,0 +1,370 @@ +/** + * @generated SignedSource<<6205c318cd1e934de3d61bd54de6e67d>> + * @lightSyntaxTransform + * @nogrep + */ + +/* tslint:disable */ +/* eslint-disable */ +// @ts-nocheck + +import { ConcreteRequest } from 'relay-runtime'; +import { FragmentRefs } from "relay-runtime"; +export type StateOfApplicabilityControlsTabRefetchQuery$variables = { + stateOfApplicabilityId: string; +}; +export type StateOfApplicabilityControlsTabRefetchQuery$data = { + readonly node: { + readonly " $fragmentSpreads": FragmentRefs<"StateOfApplicabilityControlsTabFragment">; + }; +}; +export type StateOfApplicabilityControlsTabRefetchQuery = { + response: StateOfApplicabilityControlsTabRefetchQuery$data; + variables: StateOfApplicabilityControlsTabRefetchQuery$variables; +}; + +const node: ConcreteRequest = (function(){ +var v0 = [ + { + "defaultValue": null, + "kind": "LocalArgument", + "name": "stateOfApplicabilityId" + } +], +v1 = [ + { + "kind": "Variable", + "name": "id", + "variableName": "stateOfApplicabilityId" + } +], +v2 = { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "__typename", + "storageKey": null +}, +v3 = { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "id", + "storageKey": null +}, +v4 = { + "alias": null, + "args": null, + "concreteType": "Organization", + "kind": "LinkedField", + "name": "organization", + "plural": false, + "selections": [ + (v3/*: any*/) + ], + "storageKey": null +}, +v5 = [ + { + "kind": "Literal", + "name": "first", + "value": 1000 + }, + { + "kind": "Literal", + "name": "orderBy", + "value": { + "direction": "ASC", + "field": "CONTROL_SECTION_TITLE" + } + } +], +v6 = { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "name", + "storageKey": null +}; +return { + "fragment": { + "argumentDefinitions": (v0/*: any*/), + "kind": "Fragment", + "metadata": null, + "name": "StateOfApplicabilityControlsTabRefetchQuery", + "selections": [ + { + "alias": null, + "args": (v1/*: any*/), + "concreteType": null, + "kind": "LinkedField", + "name": "node", + "plural": false, + "selections": [ + { + "kind": "InlineFragment", + "selections": [ + { + "args": null, + "kind": "FragmentSpread", + "name": "StateOfApplicabilityControlsTabFragment" + } + ], + "type": "StateOfApplicability", + "abstractKey": null + } + ], + "storageKey": null + } + ], + "type": "Query", + "abstractKey": null + }, + "kind": "Request", + "operation": { + "argumentDefinitions": (v0/*: any*/), + "kind": "Operation", + "name": "StateOfApplicabilityControlsTabRefetchQuery", + "selections": [ + { + "alias": null, + "args": (v1/*: any*/), + "concreteType": null, + "kind": "LinkedField", + "name": "node", + "plural": false, + "selections": [ + (v2/*: any*/), + (v3/*: any*/), + { + "kind": "InlineFragment", + "selections": [ + (v4/*: any*/), + { + "alias": "canCreateApplicabilityStatement", + "args": [ + { + "kind": "Literal", + "name": "action", + "value": "core:applicability-statement:create" + } + ], + "kind": "ScalarField", + "name": "permission", + "storageKey": "permission(action:\"core:applicability-statement:create\")" + }, + { + "alias": "canUpdateApplicabilityStatement", + "args": [ + { + "kind": "Literal", + "name": "action", + "value": "core:applicability-statement:update" + } + ], + "kind": "ScalarField", + "name": "permission", + "storageKey": "permission(action:\"core:applicability-statement:update\")" + }, + { + "alias": "canDeleteApplicabilityStatement", + "args": [ + { + "kind": "Literal", + "name": "action", + "value": "core:applicability-statement:delete" + } + ], + "kind": "ScalarField", + "name": "permission", + "storageKey": "permission(action:\"core:applicability-statement:delete\")" + }, + { + "alias": null, + "args": (v5/*: any*/), + "concreteType": "ApplicabilityStatementConnection", + "kind": "LinkedField", + "name": "applicabilityStatements", + "plural": false, + "selections": [ + { + "alias": null, + "args": null, + "concreteType": "ApplicabilityStatementEdge", + "kind": "LinkedField", + "name": "edges", + "plural": true, + "selections": [ + { + "alias": null, + "args": null, + "concreteType": "ApplicabilityStatement", + "kind": "LinkedField", + "name": "node", + "plural": false, + "selections": [ + (v3/*: any*/), + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "applicability", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "justification", + "storageKey": null + }, + { + "alias": null, + "args": null, + "concreteType": "Control", + "kind": "LinkedField", + "name": "control", + "plural": false, + "selections": [ + (v3/*: any*/), + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "sectionTitle", + "storageKey": null + }, + (v6/*: any*/), + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "bestPractice", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "regulatory", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "contractual", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "riskAssessment", + "storageKey": null + }, + { + "alias": null, + "args": null, + "concreteType": "Framework", + "kind": "LinkedField", + "name": "framework", + "plural": false, + "selections": [ + (v3/*: any*/), + (v6/*: any*/) + ], + "storageKey": null + }, + (v4/*: any*/) + ], + "storageKey": null + }, + (v2/*: any*/) + ], + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "cursor", + "storageKey": null + } + ], + "storageKey": null + }, + { + "alias": null, + "args": null, + "concreteType": "PageInfo", + "kind": "LinkedField", + "name": "pageInfo", + "plural": false, + "selections": [ + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "endCursor", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "hasNextPage", + "storageKey": null + } + ], + "storageKey": null + }, + { + "kind": "ClientExtension", + "selections": [ + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "__id", + "storageKey": null + } + ] + } + ], + "storageKey": "applicabilityStatements(first:1000,orderBy:{\"direction\":\"ASC\",\"field\":\"CONTROL_SECTION_TITLE\"})" + }, + { + "alias": null, + "args": (v5/*: any*/), + "filters": [ + "orderBy" + ], + "handle": "connection", + "key": "StateOfApplicabilityControlsTab_applicabilityStatements", + "kind": "LinkedHandle", + "name": "applicabilityStatements" + } + ], + "type": "StateOfApplicability", + "abstractKey": null + } + ], + "storageKey": null + } + ] + }, + "params": { + "cacheID": "33994a831b0a5b34f01e96337e1a638d", + "id": null, + "metadata": {}, + "name": "StateOfApplicabilityControlsTabRefetchQuery", + "operationKind": "query", + "text": "query StateOfApplicabilityControlsTabRefetchQuery(\n $stateOfApplicabilityId: ID!\n) {\n node(id: $stateOfApplicabilityId) {\n __typename\n ... on StateOfApplicability {\n ...StateOfApplicabilityControlsTabFragment\n }\n id\n }\n}\n\nfragment StateOfApplicabilityControlsTabFragment on StateOfApplicability {\n id\n organization {\n id\n }\n canCreateApplicabilityStatement: permission(action: \"core:applicability-statement:create\")\n canUpdateApplicabilityStatement: permission(action: \"core:applicability-statement:update\")\n canDeleteApplicabilityStatement: permission(action: \"core:applicability-statement:delete\")\n applicabilityStatements(first: 1000, orderBy: {direction: ASC, field: CONTROL_SECTION_TITLE}) {\n edges {\n node {\n id\n applicability\n justification\n control {\n id\n sectionTitle\n name\n bestPractice\n regulatory\n contractual\n riskAssessment\n framework {\n id\n name\n }\n organization {\n id\n }\n }\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n}\n" + } +}; +})(); + +(node as any).hash = "e0895b7dc7342b7df2d310a3a316bac1"; + +export default node; diff --git a/apps/console/src/__generated__/core/StateOfApplicabilityDetailPageQuery.graphql.ts b/apps/console/src/__generated__/core/StateOfApplicabilityDetailPageQuery.graphql.ts index 610dfb9e8..4b3721329 100644 --- a/apps/console/src/__generated__/core/StateOfApplicabilityDetailPageQuery.graphql.ts +++ b/apps/console/src/__generated__/core/StateOfApplicabilityDetailPageQuery.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<> + * @generated SignedSource<<06d20e72b67288c86573caa22b15adff>> * @lightSyntaxTransform * @nogrep */ @@ -184,7 +184,7 @@ v14 = [ "name": "orderBy", "value": { "direction": "ASC", - "field": "CREATED_AT" + "field": "CONTROL_SECTION_TITLE" } } ]; @@ -454,7 +454,7 @@ return { ] } ], - "storageKey": "applicabilityStatements(first:1000,orderBy:{\"direction\":\"ASC\",\"field\":\"CREATED_AT\"})" + "storageKey": "applicabilityStatements(first:1000,orderBy:{\"direction\":\"ASC\",\"field\":\"CONTROL_SECTION_TITLE\"})" }, { "alias": null, @@ -477,12 +477,12 @@ return { ] }, "params": { - "cacheID": "ae9d15bd80281c127b74f1a0a32099ee", + "cacheID": "dceee9f818236953e28441fb1bbde7aa", "id": null, "metadata": {}, "name": "StateOfApplicabilityDetailPageQuery", "operationKind": "query", - "text": "query StateOfApplicabilityDetailPageQuery(\n $stateOfApplicabilityId: ID!\n) {\n node(id: $stateOfApplicabilityId) {\n __typename\n ... on StateOfApplicability {\n id\n name\n sourceId\n snapshotId\n createdAt\n updatedAt\n canUpdate: permission(action: \"core:state-of-applicability:update\")\n canDelete: permission(action: \"core:state-of-applicability:delete\")\n canExport: permission(action: \"core:state-of-applicability:export\")\n organization {\n id\n }\n owner {\n id\n fullName\n }\n ...StateOfApplicabilityControlsTabFragment\n }\n id\n }\n}\n\nfragment StateOfApplicabilityControlsTabFragment on StateOfApplicability {\n id\n organization {\n id\n }\n canCreateApplicabilityStatement: permission(action: \"core:applicability-statement:create\")\n canUpdateApplicabilityStatement: permission(action: \"core:applicability-statement:update\")\n canDeleteApplicabilityStatement: permission(action: \"core:applicability-statement:delete\")\n applicabilityStatements(first: 1000, orderBy: {direction: ASC, field: CREATED_AT}) {\n edges {\n node {\n id\n applicability\n justification\n control {\n id\n sectionTitle\n name\n bestPractice\n regulatory\n contractual\n riskAssessment\n framework {\n id\n name\n }\n organization {\n id\n }\n }\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n}\n" + "text": "query StateOfApplicabilityDetailPageQuery(\n $stateOfApplicabilityId: ID!\n) {\n node(id: $stateOfApplicabilityId) {\n __typename\n ... on StateOfApplicability {\n id\n name\n sourceId\n snapshotId\n createdAt\n updatedAt\n canUpdate: permission(action: \"core:state-of-applicability:update\")\n canDelete: permission(action: \"core:state-of-applicability:delete\")\n canExport: permission(action: \"core:state-of-applicability:export\")\n organization {\n id\n }\n owner {\n id\n fullName\n }\n ...StateOfApplicabilityControlsTabFragment\n }\n id\n }\n}\n\nfragment StateOfApplicabilityControlsTabFragment on StateOfApplicability {\n id\n organization {\n id\n }\n canCreateApplicabilityStatement: permission(action: \"core:applicability-statement:create\")\n canUpdateApplicabilityStatement: permission(action: \"core:applicability-statement:update\")\n canDeleteApplicabilityStatement: permission(action: \"core:applicability-statement:delete\")\n applicabilityStatements(first: 1000, orderBy: {direction: ASC, field: CONTROL_SECTION_TITLE}) {\n edges {\n node {\n id\n applicability\n justification\n control {\n id\n sectionTitle\n name\n bestPractice\n regulatory\n contractual\n riskAssessment\n framework {\n id\n name\n }\n organization {\n id\n }\n }\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n}\n" } }; })(); diff --git a/apps/console/src/__generated__/core/WebhooksSettingsPage_createMutation.graphql.ts b/apps/console/src/__generated__/core/WebhooksSettingsPage_createMutation.graphql.ts index c4ee5e1dc..7228877f2 100644 --- a/apps/console/src/__generated__/core/WebhooksSettingsPage_createMutation.graphql.ts +++ b/apps/console/src/__generated__/core/WebhooksSettingsPage_createMutation.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<> + * @generated SignedSource<<240851e53a2871e13a6e19a5b327684c>> * @lightSyntaxTransform * @nogrep */ @@ -189,7 +189,7 @@ return { ] }, "params": { - "cacheID": "478c002a1f98dd87f23c6af0269ea2c6", + "cacheID": "680c8a1d89c3f45d06e203072c68e593", "id": null, "metadata": {}, "name": "WebhooksSettingsPage_createMutation", @@ -199,6 +199,6 @@ return { }; })(); -(node as any).hash = "f47b849f8cad710922bf62eb6aebdd93"; +(node as any).hash = "ba13f2e1f417d449aa7d959c6411f858"; export default node; diff --git a/apps/console/src/pages/organizations/states-of-applicability/dialogs/AddApplicabilityStatementDialog.tsx b/apps/console/src/pages/organizations/states-of-applicability/dialogs/AddApplicabilityStatementDialog.tsx index e480f10e8..ea45a977f 100644 --- a/apps/console/src/pages/organizations/states-of-applicability/dialogs/AddApplicabilityStatementDialog.tsx +++ b/apps/console/src/pages/organizations/states-of-applicability/dialogs/AddApplicabilityStatementDialog.tsx @@ -461,8 +461,12 @@ function AddApplicabilityStatementDialogContent({ ); } -export const AddApplicabilityStatementDialog = forwardRef( - (_props, ref) => { +type AddApplicabilityStatementDialogProps = { + onClose?: () => void; +}; + +export const AddApplicabilityStatementDialog = forwardRef( + ({ onClose }, ref) => { const { __ } = useTranslate(); const dialogRef = useDialogRef(); const [stateOfApplicabilityId, setStateOfApplicabilityId] = useState(null); @@ -486,6 +490,7 @@ export const AddApplicabilityStatementDialog = forwardRef((_props, ref) )} - diff --git a/apps/console/src/pages/organizations/states-of-applicability/tabs/StateOfApplicabilityControlsTab.tsx b/apps/console/src/pages/organizations/states-of-applicability/tabs/StateOfApplicabilityControlsTab.tsx index a000cc0f1..fa5609301 100644 --- a/apps/console/src/pages/organizations/states-of-applicability/tabs/StateOfApplicabilityControlsTab.tsx +++ b/apps/console/src/pages/organizations/states-of-applicability/tabs/StateOfApplicabilityControlsTab.tsx @@ -14,8 +14,9 @@ import { Thead, Tr, } from "@probo/ui"; -import { Suspense, useRef } from "react"; -import { graphql, useFragment } from "react-relay"; +import { Suspense, useCallback, useRef } from "react"; +import { graphql, useFragment, useRelayEnvironment } from "react-relay"; +import { fetchQuery } from "relay-runtime"; import type { StateOfApplicabilityControlsTabFragment$key } from "#/__generated__/core/StateOfApplicabilityControlsTabFragment.graphql"; import { useMutationWithToasts } from "#/hooks/useMutationWithToasts"; @@ -30,6 +31,16 @@ import { type EditControlDialogRef, } from "../dialogs/EditControlDialog"; +const refetchStatementsQuery = graphql` + query StateOfApplicabilityControlsTabRefetchQuery($stateOfApplicabilityId: ID!) { + node(id: $stateOfApplicabilityId) { + ... on StateOfApplicability { + ...StateOfApplicabilityControlsTabFragment + } + } + } +`; + export const controlsFragment = graphql` fragment StateOfApplicabilityControlsTabFragment on StateOfApplicability { id @@ -47,7 +58,7 @@ export const controlsFragment = graphql` action: "core:applicability-statement:delete" ) - applicabilityStatements(first: 1000, orderBy: { direction: ASC, field: CREATED_AT }) + applicabilityStatements(first: 1000, orderBy: { direction: ASC, field: CONTROL_SECTION_TITLE }) @connection(key: "StateOfApplicabilityControlsTab_applicabilityStatements") { __id edges { @@ -99,10 +110,18 @@ export default function StateOfApplicabilityControlsTab({ }) { const { __ } = useTranslate(); const data = useFragment(controlsFragment, stateOfApplicability); + const environment = useRelayEnvironment(); const organizationId = useOrganizationId(); const addStatementDialogRef = useRef(null); const editDialogRef = useRef(null); + const handleDialogClose = useCallback(() => { + if (!data.id) return; + fetchQuery(environment, refetchStatementsQuery, { + stateOfApplicabilityId: data.id, + }).subscribe({}); + }, [environment, data.id]); + const connectionId = data.applicabilityStatements?.__id; const linkedControls = (data.applicabilityStatements?.edges || []).map(edge => ({ @@ -401,7 +420,7 @@ export default function StateOfApplicabilityControlsTab({ - + diff --git a/pkg/coredata/applicability_statement.go b/pkg/coredata/applicability_statement.go index f4534e3df..b5fd36781 100644 --- a/pkg/coredata/applicability_statement.go +++ b/pkg/coredata/applicability_statement.go @@ -39,6 +39,9 @@ type ( Justification *string `db:"justification"` CreatedAt time.Time `db:"created_at"` UpdatedAt time.Time `db:"updated_at"` + + // Ordering only. + SectionTitle string `db:"section_title"` } ApplicabilityStatements []*ApplicabilityStatement @@ -48,6 +51,8 @@ func (s ApplicabilityStatement) CursorKey(orderBy ApplicabilityStatementOrderFie switch orderBy { case ApplicabilityStatementOrderFieldCreatedAt: return page.NewCursorKey(s.ID, s.CreatedAt) + case ApplicabilityStatementOrderFieldControlSectionTitle: + return page.NewCursorKey(s.ID, s.SectionTitle) } panic(fmt.Sprintf("unsupported order by: %s", orderBy)) @@ -74,6 +79,29 @@ func (sac *ApplicabilityStatement) LoadByID( id gid.GID, ) error { q := ` +WITH stmt AS ( + SELECT + a.id, + a.state_of_applicability_id, + a.control_id, + a.organization_id, + a.snapshot_id, + a.applicability, + a.justification, + a.created_at, + a.updated_at, + a.tenant_id, + f.name || ' - ' || c.section_title AS section_title + FROM + applicability_statements a + INNER JOIN + controls c ON c.id = a.control_id + INNER JOIN + frameworks f ON f.id = c.framework_id + WHERE + a.%s + AND a.id = @id +) SELECT id, state_of_applicability_id, @@ -83,15 +111,15 @@ SELECT applicability, justification, created_at, - updated_at + updated_at, + section_title FROM - applicability_statements + stmt WHERE %s - AND id = @id LIMIT 1; ` - q = fmt.Sprintf(q, scope.SQLFragment()) + q = fmt.Sprintf(q, scope.SQLFragment(), scope.SQLFragment()) args := pgx.StrictNamedArgs{"id": id} maps.Copy(args, scope.SQLArguments()) @@ -139,11 +167,16 @@ SELECT soac.applicability, soac.justification, soac.created_at, - soac.updated_at + soac.updated_at, + f.name || ' - ' || c.section_title AS section_title FROM applicability_statements soac INNER JOIN current_soa ON soac.state_of_applicability_id = current_soa.id +INNER JOIN + controls c ON c.id = soac.control_id +INNER JOIN + frameworks f ON f.id = c.framework_id WHERE soac.control_id = @control_id LIMIT 1; @@ -373,6 +406,29 @@ func (sacs *ApplicabilityStatements) LoadByStateOfApplicabilityID( cursor *page.Cursor[ApplicabilityStatementOrderField], ) error { q := ` +WITH stmt AS ( + SELECT + a.id, + a.state_of_applicability_id, + a.control_id, + a.organization_id, + a.snapshot_id, + a.applicability, + a.justification, + a.created_at, + a.updated_at, + a.tenant_id, + f.name || ' - ' || c.section_title AS section_title + FROM + applicability_statements a + INNER JOIN + controls c ON c.id = a.control_id + INNER JOIN + frameworks f ON f.id = c.framework_id + WHERE + a.%[1]s + AND a.state_of_applicability_id = @state_of_applicability_id +) SELECT id, state_of_applicability_id, @@ -382,13 +438,12 @@ SELECT applicability, justification, created_at, - updated_at + updated_at, + section_title FROM - applicability_statements + stmt WHERE - %[1]s - AND state_of_applicability_id = @state_of_applicability_id - AND %[2]s + %[2]s ` q = fmt.Sprintf(q, scope.SQLFragment(), cursor.SQLFragment()) @@ -459,11 +514,16 @@ WITH soac_ctrl AS ( soac.justification, soac.created_at, soac.updated_at, - soac.tenant_id + soac.tenant_id, + f.name || ' - ' || c.section_title AS section_title FROM applicability_statements soac INNER JOIN states_of_applicability soa ON soac.state_of_applicability_id = soa.id + INNER JOIN + controls c ON c.id = soac.control_id + INNER JOIN + frameworks f ON f.id = c.framework_id WHERE soac.%[1]s AND soac.control_id = @control_id @@ -478,7 +538,8 @@ SELECT applicability, justification, created_at, - updated_at + updated_at, + section_title FROM soac_ctrl WHERE diff --git a/pkg/coredata/applicability_statement_order_field.go b/pkg/coredata/applicability_statement_order_field.go index d58402305..9c78807d6 100644 --- a/pkg/coredata/applicability_statement_order_field.go +++ b/pkg/coredata/applicability_statement_order_field.go @@ -21,13 +21,16 @@ import ( type ApplicabilityStatementOrderField string const ( - ApplicabilityStatementOrderFieldCreatedAt ApplicabilityStatementOrderField = "CREATED_AT" + ApplicabilityStatementOrderFieldCreatedAt ApplicabilityStatementOrderField = "CREATED_AT" + ApplicabilityStatementOrderFieldControlSectionTitle ApplicabilityStatementOrderField = "CONTROL_SECTION_TITLE" ) func (p ApplicabilityStatementOrderField) Column() string { switch p { case ApplicabilityStatementOrderFieldCreatedAt: return "created_at" + case ApplicabilityStatementOrderFieldControlSectionTitle: + return "section_title_sort_key(section_title)" } panic("unknown ApplicabilityStatementOrderField") @@ -44,7 +47,8 @@ func (p ApplicabilityStatementOrderField) MarshalText() ([]byte, error) { func (p *ApplicabilityStatementOrderField) UnmarshalText(text []byte) error { val := string(text) switch val { - case string(ApplicabilityStatementOrderFieldCreatedAt): + case string(ApplicabilityStatementOrderFieldCreatedAt), + string(ApplicabilityStatementOrderFieldControlSectionTitle): *p = ApplicabilityStatementOrderField(val) return nil } diff --git a/pkg/probo/state_of_applicability_service.go b/pkg/probo/state_of_applicability_service.go index b8b67a5f0..eda361119 100644 --- a/pkg/probo/state_of_applicability_service.go +++ b/pkg/probo/state_of_applicability_service.go @@ -457,7 +457,7 @@ func (s StateOfApplicabilityService) ExportPDF( nil, page.Head, page.OrderBy[coredata.ApplicabilityStatementOrderField]{ - Field: coredata.ApplicabilityStatementOrderFieldCreatedAt, + Field: coredata.ApplicabilityStatementOrderFieldControlSectionTitle, Direction: page.OrderDirectionAsc, }, ) diff --git a/pkg/server/api/console/v1/schema.graphql b/pkg/server/api/console/v1/schema.graphql index 06c68483a..1a6c71b28 100644 --- a/pkg/server/api/console/v1/schema.graphql +++ b/pkg/server/api/console/v1/schema.graphql @@ -615,6 +615,10 @@ enum ApplicabilityStatementOrderField @goEnum( value: "go.probo.inc/probo/pkg/coredata.ApplicabilityStatementOrderFieldCreatedAt" ) + CONTROL_SECTION_TITLE + @goEnum( + value: "go.probo.inc/probo/pkg/coredata.ApplicabilityStatementOrderFieldControlSectionTitle" + ) } enum CountryCode diff --git a/pkg/server/api/console/v1/schema/schema.go b/pkg/server/api/console/v1/schema/schema.go index 14e18a6cf..624800caa 100644 --- a/pkg/server/api/console/v1/schema/schema.go +++ b/pkg/server/api/console/v1/schema/schema.go @@ -119,9 +119,9 @@ type ResolverRoot interface { VendorRiskAssessment() VendorRiskAssessmentResolver VendorService() VendorServiceResolver Viewer() ViewerResolver + WebhookEventConnection() WebhookEventConnectionResolver WebhookSubscription() WebhookSubscriptionResolver WebhookSubscriptionConnection() WebhookSubscriptionConnectionResolver - WebhookEventConnection() WebhookEventConnectionResolver } type DirectiveRoot struct { @@ -1930,6 +1930,25 @@ type ComplexityRoot struct { SignableDocuments func(childComplexity int, organizationID gid.GID, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.DocumentOrderBy) int } + WebhookEvent struct { + CreatedAt func(childComplexity int) int + ID func(childComplexity int) int + Response func(childComplexity int) int + Status func(childComplexity int) int + WebhookSubscriptionID func(childComplexity int) int + } + + WebhookEventConnection struct { + Edges func(childComplexity int) int + PageInfo func(childComplexity int) int + TotalCount func(childComplexity int) int + } + + WebhookEventEdge struct { + Cursor func(childComplexity int) int + Node func(childComplexity int) int + } + WebhookSubscription struct { CreatedAt func(childComplexity int) int EndpointURL func(childComplexity int) int @@ -1952,25 +1971,6 @@ type ComplexityRoot struct { Cursor func(childComplexity int) int Node func(childComplexity int) int } - - WebhookEvent struct { - CreatedAt func(childComplexity int) int - ID func(childComplexity int) int - Response func(childComplexity int) int - Status func(childComplexity int) int - WebhookSubscriptionID func(childComplexity int) int - } - - WebhookEventConnection struct { - Edges func(childComplexity int) int - PageInfo func(childComplexity int) int - TotalCount func(childComplexity int) int - } - - WebhookEventEdge struct { - Cursor func(childComplexity int) int - Node func(childComplexity int) int - } } type ApplicabilityStatementResolver interface { @@ -2526,6 +2526,9 @@ type ViewerResolver interface { SignableDocuments(ctx context.Context, obj *types.Viewer, organizationID gid.GID, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.DocumentOrderBy) (*types.SignableDocumentConnection, error) SignableDocument(ctx context.Context, obj *types.Viewer, id gid.GID) (*types.SignableDocument, error) } +type WebhookEventConnectionResolver interface { + TotalCount(ctx context.Context, obj *types.WebhookEventConnection) (int, error) +} type WebhookSubscriptionResolver interface { Organization(ctx context.Context, obj *types.WebhookSubscription) (*types.Organization, error) @@ -2537,9 +2540,6 @@ type WebhookSubscriptionResolver interface { type WebhookSubscriptionConnectionResolver interface { TotalCount(ctx context.Context, obj *types.WebhookSubscriptionConnection) (int, error) } -type WebhookEventConnectionResolver interface { - TotalCount(ctx context.Context, obj *types.WebhookEventConnection) (int, error) -} type executableSchema struct { schema *ast.Schema @@ -10125,6 +10125,69 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.complexity.Viewer.SignableDocuments(childComplexity, args["organizationId"].(gid.GID), args["first"].(*int), args["after"].(*page.CursorKey), args["last"].(*int), args["before"].(*page.CursorKey), args["orderBy"].(*types.DocumentOrderBy)), true + case "WebhookEvent.createdAt": + if e.complexity.WebhookEvent.CreatedAt == nil { + break + } + + return e.complexity.WebhookEvent.CreatedAt(childComplexity), true + case "WebhookEvent.id": + if e.complexity.WebhookEvent.ID == nil { + break + } + + return e.complexity.WebhookEvent.ID(childComplexity), true + case "WebhookEvent.response": + if e.complexity.WebhookEvent.Response == nil { + break + } + + return e.complexity.WebhookEvent.Response(childComplexity), true + case "WebhookEvent.status": + if e.complexity.WebhookEvent.Status == nil { + break + } + + return e.complexity.WebhookEvent.Status(childComplexity), true + case "WebhookEvent.webhookSubscriptionId": + if e.complexity.WebhookEvent.WebhookSubscriptionID == nil { + break + } + + return e.complexity.WebhookEvent.WebhookSubscriptionID(childComplexity), true + + case "WebhookEventConnection.edges": + if e.complexity.WebhookEventConnection.Edges == nil { + break + } + + return e.complexity.WebhookEventConnection.Edges(childComplexity), true + case "WebhookEventConnection.pageInfo": + if e.complexity.WebhookEventConnection.PageInfo == nil { + break + } + + return e.complexity.WebhookEventConnection.PageInfo(childComplexity), true + case "WebhookEventConnection.totalCount": + if e.complexity.WebhookEventConnection.TotalCount == nil { + break + } + + return e.complexity.WebhookEventConnection.TotalCount(childComplexity), true + + case "WebhookEventEdge.cursor": + if e.complexity.WebhookEventEdge.Cursor == nil { + break + } + + return e.complexity.WebhookEventEdge.Cursor(childComplexity), true + case "WebhookEventEdge.node": + if e.complexity.WebhookEventEdge.Node == nil { + break + } + + return e.complexity.WebhookEventEdge.Node(childComplexity), true + case "WebhookSubscription.createdAt": if e.complexity.WebhookSubscription.CreatedAt == nil { break @@ -10222,69 +10285,6 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.complexity.WebhookSubscriptionEdge.Node(childComplexity), true - case "WebhookEvent.createdAt": - if e.complexity.WebhookEvent.CreatedAt == nil { - break - } - - return e.complexity.WebhookEvent.CreatedAt(childComplexity), true - case "WebhookEvent.id": - if e.complexity.WebhookEvent.ID == nil { - break - } - - return e.complexity.WebhookEvent.ID(childComplexity), true - case "WebhookEvent.response": - if e.complexity.WebhookEvent.Response == nil { - break - } - - return e.complexity.WebhookEvent.Response(childComplexity), true - case "WebhookEvent.status": - if e.complexity.WebhookEvent.Status == nil { - break - } - - return e.complexity.WebhookEvent.Status(childComplexity), true - case "WebhookEvent.webhookSubscriptionId": - if e.complexity.WebhookEvent.WebhookSubscriptionID == nil { - break - } - - return e.complexity.WebhookEvent.WebhookSubscriptionID(childComplexity), true - - case "WebhookEventConnection.edges": - if e.complexity.WebhookEventConnection.Edges == nil { - break - } - - return e.complexity.WebhookEventConnection.Edges(childComplexity), true - case "WebhookEventConnection.pageInfo": - if e.complexity.WebhookEventConnection.PageInfo == nil { - break - } - - return e.complexity.WebhookEventConnection.PageInfo(childComplexity), true - case "WebhookEventConnection.totalCount": - if e.complexity.WebhookEventConnection.TotalCount == nil { - break - } - - return e.complexity.WebhookEventConnection.TotalCount(childComplexity), true - - case "WebhookEventEdge.cursor": - if e.complexity.WebhookEventEdge.Cursor == nil { - break - } - - return e.complexity.WebhookEventEdge.Cursor(childComplexity), true - case "WebhookEventEdge.node": - if e.complexity.WebhookEventEdge.Node == nil { - break - } - - return e.complexity.WebhookEventEdge.Node(childComplexity), true - } return 0, false } @@ -10486,8 +10486,8 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { ec.unmarshalInputVendorOrder, ec.unmarshalInputVendorRiskAssessmentOrder, ec.unmarshalInputVendorServiceOrder, - ec.unmarshalInputWebhookSubscriptionOrder, ec.unmarshalInputWebhookEventOrder, + ec.unmarshalInputWebhookSubscriptionOrder, ) first := true @@ -11202,6 +11202,10 @@ enum ApplicabilityStatementOrderField @goEnum( value: "go.probo.inc/probo/pkg/coredata.ApplicabilityStatementOrderFieldCreatedAt" ) + CONTROL_SECTION_TITLE + @goEnum( + value: "go.probo.inc/probo/pkg/coredata.ApplicabilityStatementOrderFieldControlSectionTitle" + ) } enum CountryCode @@ -59912,6 +59916,324 @@ func (ec *executionContext) fieldContext_Viewer_signableDocument(ctx context.Con return fc, nil } +func (ec *executionContext) _WebhookEvent_id(ctx context.Context, field graphql.CollectedField, obj *types.WebhookEvent) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_WebhookEvent_id, + func(ctx context.Context) (any, error) { + return obj.ID, nil + }, + nil, + ec.marshalNID2goᚗproboᚗincᚋproboᚋpkgᚋgidᚐGID, + true, + true, + ) +} + +func (ec *executionContext) fieldContext_WebhookEvent_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "WebhookEvent", + 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) _WebhookEvent_webhookSubscriptionId(ctx context.Context, field graphql.CollectedField, obj *types.WebhookEvent) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_WebhookEvent_webhookSubscriptionId, + func(ctx context.Context) (any, error) { + return obj.WebhookSubscriptionID, nil + }, + nil, + ec.marshalNID2goᚗproboᚗincᚋproboᚋpkgᚋgidᚐGID, + true, + true, + ) +} + +func (ec *executionContext) fieldContext_WebhookEvent_webhookSubscriptionId(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "WebhookEvent", + 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) _WebhookEvent_status(ctx context.Context, field graphql.CollectedField, obj *types.WebhookEvent) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_WebhookEvent_status, + func(ctx context.Context) (any, error) { + return obj.Status, nil + }, + nil, + ec.marshalNWebhookEventStatus2goᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐWebhookEventStatus, + true, + true, + ) +} + +func (ec *executionContext) fieldContext_WebhookEvent_status(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "WebhookEvent", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type WebhookEventStatus does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _WebhookEvent_response(ctx context.Context, field graphql.CollectedField, obj *types.WebhookEvent) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_WebhookEvent_response, + func(ctx context.Context) (any, error) { + return obj.Response, nil + }, + nil, + ec.marshalOString2ᚖstring, + true, + false, + ) +} + +func (ec *executionContext) fieldContext_WebhookEvent_response(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "WebhookEvent", + 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) _WebhookEvent_createdAt(ctx context.Context, field graphql.CollectedField, obj *types.WebhookEvent) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_WebhookEvent_createdAt, + func(ctx context.Context) (any, error) { + return obj.CreatedAt, nil + }, + nil, + ec.marshalNDatetime2timeᚐTime, + true, + true, + ) +} + +func (ec *executionContext) fieldContext_WebhookEvent_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "WebhookEvent", + 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) _WebhookEventConnection_edges(ctx context.Context, field graphql.CollectedField, obj *types.WebhookEventConnection) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_WebhookEventConnection_edges, + func(ctx context.Context) (any, error) { + return obj.Edges, nil + }, + nil, + ec.marshalNWebhookEventEdge2ᚕᚖgoᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐWebhookEventEdgeᚄ, + true, + true, + ) +} + +func (ec *executionContext) fieldContext_WebhookEventConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "WebhookEventConnection", + 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_WebhookEventEdge_cursor(ctx, field) + case "node": + return ec.fieldContext_WebhookEventEdge_node(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type WebhookEventEdge", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _WebhookEventConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *types.WebhookEventConnection) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_WebhookEventConnection_pageInfo, + func(ctx context.Context) (any, error) { + return obj.PageInfo, nil + }, + nil, + ec.marshalNPageInfo2goᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐPageInfo, + true, + true, + ) +} + +func (ec *executionContext) fieldContext_WebhookEventConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "WebhookEventConnection", + 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) _WebhookEventConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *types.WebhookEventConnection) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_WebhookEventConnection_totalCount, + func(ctx context.Context) (any, error) { + return ec.resolvers.WebhookEventConnection().TotalCount(ctx, obj) + }, + nil, + ec.marshalNInt2int, + true, + true, + ) +} + +func (ec *executionContext) fieldContext_WebhookEventConnection_totalCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "WebhookEventConnection", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _WebhookEventEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *types.WebhookEventEdge) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_WebhookEventEdge_cursor, + func(ctx context.Context) (any, error) { + return obj.Cursor, nil + }, + nil, + ec.marshalNCursorKey2goᚗproboᚗincᚋproboᚋpkgᚋpageᚐCursorKey, + true, + true, + ) +} + +func (ec *executionContext) fieldContext_WebhookEventEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "WebhookEventEdge", + 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) _WebhookEventEdge_node(ctx context.Context, field graphql.CollectedField, obj *types.WebhookEventEdge) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_WebhookEventEdge_node, + func(ctx context.Context) (any, error) { + return obj.Node, nil + }, + nil, + ec.marshalNWebhookEvent2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐWebhookEvent, + true, + true, + ) +} + +func (ec *executionContext) fieldContext_WebhookEventEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "WebhookEventEdge", + 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_WebhookEvent_id(ctx, field) + case "webhookSubscriptionId": + return ec.fieldContext_WebhookEvent_webhookSubscriptionId(ctx, field) + case "status": + return ec.fieldContext_WebhookEvent_status(ctx, field) + case "response": + return ec.fieldContext_WebhookEvent_response(ctx, field) + case "createdAt": + return ec.fieldContext_WebhookEvent_createdAt(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type WebhookEvent", field.Name) + }, + } + return fc, nil +} + func (ec *executionContext) _WebhookSubscription_id(ctx context.Context, field graphql.CollectedField, obj *types.WebhookSubscription) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, @@ -60464,324 +60786,6 @@ func (ec *executionContext) fieldContext_WebhookSubscriptionEdge_node(_ context. return fc, nil } -func (ec *executionContext) _WebhookEvent_id(ctx context.Context, field graphql.CollectedField, obj *types.WebhookEvent) (ret graphql.Marshaler) { - return graphql.ResolveField( - ctx, - ec.OperationContext, - field, - ec.fieldContext_WebhookEvent_id, - func(ctx context.Context) (any, error) { - return obj.ID, nil - }, - nil, - ec.marshalNID2goᚗproboᚗincᚋproboᚋpkgᚋgidᚐGID, - true, - true, - ) -} - -func (ec *executionContext) fieldContext_WebhookEvent_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "WebhookEvent", - 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) _WebhookEvent_webhookSubscriptionId(ctx context.Context, field graphql.CollectedField, obj *types.WebhookEvent) (ret graphql.Marshaler) { - return graphql.ResolveField( - ctx, - ec.OperationContext, - field, - ec.fieldContext_WebhookEvent_webhookSubscriptionId, - func(ctx context.Context) (any, error) { - return obj.WebhookSubscriptionID, nil - }, - nil, - ec.marshalNID2goᚗproboᚗincᚋproboᚋpkgᚋgidᚐGID, - true, - true, - ) -} - -func (ec *executionContext) fieldContext_WebhookEvent_webhookSubscriptionId(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "WebhookEvent", - 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) _WebhookEvent_status(ctx context.Context, field graphql.CollectedField, obj *types.WebhookEvent) (ret graphql.Marshaler) { - return graphql.ResolveField( - ctx, - ec.OperationContext, - field, - ec.fieldContext_WebhookEvent_status, - func(ctx context.Context) (any, error) { - return obj.Status, nil - }, - nil, - ec.marshalNWebhookEventStatus2goᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐWebhookEventStatus, - true, - true, - ) -} - -func (ec *executionContext) fieldContext_WebhookEvent_status(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "WebhookEvent", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type WebhookEventStatus does not have child fields") - }, - } - return fc, nil -} - -func (ec *executionContext) _WebhookEvent_response(ctx context.Context, field graphql.CollectedField, obj *types.WebhookEvent) (ret graphql.Marshaler) { - return graphql.ResolveField( - ctx, - ec.OperationContext, - field, - ec.fieldContext_WebhookEvent_response, - func(ctx context.Context) (any, error) { - return obj.Response, nil - }, - nil, - ec.marshalOString2ᚖstring, - true, - false, - ) -} - -func (ec *executionContext) fieldContext_WebhookEvent_response(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "WebhookEvent", - 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) _WebhookEvent_createdAt(ctx context.Context, field graphql.CollectedField, obj *types.WebhookEvent) (ret graphql.Marshaler) { - return graphql.ResolveField( - ctx, - ec.OperationContext, - field, - ec.fieldContext_WebhookEvent_createdAt, - func(ctx context.Context) (any, error) { - return obj.CreatedAt, nil - }, - nil, - ec.marshalNDatetime2timeᚐTime, - true, - true, - ) -} - -func (ec *executionContext) fieldContext_WebhookEvent_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "WebhookEvent", - 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) _WebhookEventConnection_edges(ctx context.Context, field graphql.CollectedField, obj *types.WebhookEventConnection) (ret graphql.Marshaler) { - return graphql.ResolveField( - ctx, - ec.OperationContext, - field, - ec.fieldContext_WebhookEventConnection_edges, - func(ctx context.Context) (any, error) { - return obj.Edges, nil - }, - nil, - ec.marshalNWebhookEventEdge2ᚕᚖgoᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐWebhookEventEdgeᚄ, - true, - true, - ) -} - -func (ec *executionContext) fieldContext_WebhookEventConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "WebhookEventConnection", - 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_WebhookEventEdge_cursor(ctx, field) - case "node": - return ec.fieldContext_WebhookEventEdge_node(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type WebhookEventEdge", field.Name) - }, - } - return fc, nil -} - -func (ec *executionContext) _WebhookEventConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *types.WebhookEventConnection) (ret graphql.Marshaler) { - return graphql.ResolveField( - ctx, - ec.OperationContext, - field, - ec.fieldContext_WebhookEventConnection_pageInfo, - func(ctx context.Context) (any, error) { - return obj.PageInfo, nil - }, - nil, - ec.marshalNPageInfo2goᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐPageInfo, - true, - true, - ) -} - -func (ec *executionContext) fieldContext_WebhookEventConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "WebhookEventConnection", - 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) _WebhookEventConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *types.WebhookEventConnection) (ret graphql.Marshaler) { - return graphql.ResolveField( - ctx, - ec.OperationContext, - field, - ec.fieldContext_WebhookEventConnection_totalCount, - func(ctx context.Context) (any, error) { - return ec.resolvers.WebhookEventConnection().TotalCount(ctx, obj) - }, - nil, - ec.marshalNInt2int, - true, - true, - ) -} - -func (ec *executionContext) fieldContext_WebhookEventConnection_totalCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "WebhookEventConnection", - Field: field, - IsMethod: true, - IsResolver: true, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Int does not have child fields") - }, - } - return fc, nil -} - -func (ec *executionContext) _WebhookEventEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *types.WebhookEventEdge) (ret graphql.Marshaler) { - return graphql.ResolveField( - ctx, - ec.OperationContext, - field, - ec.fieldContext_WebhookEventEdge_cursor, - func(ctx context.Context) (any, error) { - return obj.Cursor, nil - }, - nil, - ec.marshalNCursorKey2goᚗproboᚗincᚋproboᚋpkgᚋpageᚐCursorKey, - true, - true, - ) -} - -func (ec *executionContext) fieldContext_WebhookEventEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "WebhookEventEdge", - 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) _WebhookEventEdge_node(ctx context.Context, field graphql.CollectedField, obj *types.WebhookEventEdge) (ret graphql.Marshaler) { - return graphql.ResolveField( - ctx, - ec.OperationContext, - field, - ec.fieldContext_WebhookEventEdge_node, - func(ctx context.Context) (any, error) { - return obj.Node, nil - }, - nil, - ec.marshalNWebhookEvent2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐWebhookEvent, - true, - true, - ) -} - -func (ec *executionContext) fieldContext_WebhookEventEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "WebhookEventEdge", - 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_WebhookEvent_id(ctx, field) - case "webhookSubscriptionId": - return ec.fieldContext_WebhookEvent_webhookSubscriptionId(ctx, field) - case "status": - return ec.fieldContext_WebhookEvent_status(ctx, field) - case "response": - return ec.fieldContext_WebhookEvent_response(ctx, field) - case "createdAt": - return ec.fieldContext_WebhookEvent_createdAt(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type WebhookEvent", field.Name) - }, - } - return fc, nil -} - func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, @@ -70449,40 +70453,6 @@ func (ec *executionContext) unmarshalInputVendorServiceOrder(ctx context.Context return it, nil } -func (ec *executionContext) unmarshalInputWebhookSubscriptionOrder(ctx context.Context, obj any) (types.WebhookSubscriptionOrderBy, error) { - var it types.WebhookSubscriptionOrderBy - 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.unmarshalNOrderDirection2goᚗproboᚗincᚋ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.unmarshalNWebhookSubscriptionOrderField2goᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐWebhookSubscriptionOrderField(ctx, v) - if err != nil { - return it, err - } - it.Field = data - } - } - - return it, nil -} - func (ec *executionContext) unmarshalInputWebhookEventOrder(ctx context.Context, obj any) (types.WebhookEventOrderBy, error) { var it types.WebhookEventOrderBy asMap := map[string]any{} @@ -70517,6 +70487,40 @@ func (ec *executionContext) unmarshalInputWebhookEventOrder(ctx context.Context, return it, nil } +func (ec *executionContext) unmarshalInputWebhookSubscriptionOrder(ctx context.Context, obj any) (types.WebhookSubscriptionOrderBy, error) { + var it types.WebhookSubscriptionOrderBy + 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.unmarshalNOrderDirection2goᚗproboᚗincᚋ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.unmarshalNWebhookSubscriptionOrderField2goᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐWebhookSubscriptionOrderField(ctx, v) + if err != nil { + return it, err + } + it.Field = data + } + } + + return it, nil +} + // endregion **************************** input.gotpl ***************************** // region ************************** interface.gotpl *************************** @@ -70525,13 +70529,6 @@ func (ec *executionContext) _Node(ctx context.Context, sel ast.SelectionSet, obj switch obj := (obj).(type) { case nil: return graphql.Null - case types.WebhookEvent: - return ec._WebhookEvent(ctx, sel, &obj) - case *types.WebhookEvent: - if obj == nil { - return graphql.Null - } - return ec._WebhookEvent(ctx, sel, obj) case types.WebhookSubscription: return ec._WebhookSubscription(ctx, sel, &obj) case *types.WebhookSubscription: @@ -70539,6 +70536,13 @@ func (ec *executionContext) _Node(ctx context.Context, sel ast.SelectionSet, obj return graphql.Null } return ec._WebhookSubscription(ctx, sel, obj) + case types.WebhookEvent: + return ec._WebhookEvent(ctx, sel, &obj) + case *types.WebhookEvent: + if obj == nil { + return graphql.Null + } + return ec._WebhookEvent(ctx, sel, obj) case types.VendorService: return ec._VendorService(ctx, sel, &obj) case *types.VendorService: @@ -91286,6 +91290,186 @@ func (ec *executionContext) _Viewer(ctx context.Context, sel ast.SelectionSet, o return out } +var webhookEventImplementors = []string{"WebhookEvent", "Node"} + +func (ec *executionContext) _WebhookEvent(ctx context.Context, sel ast.SelectionSet, obj *types.WebhookEvent) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, webhookEventImplementors) + + 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("WebhookEvent") + case "id": + out.Values[i] = ec._WebhookEvent_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "webhookSubscriptionId": + out.Values[i] = ec._WebhookEvent_webhookSubscriptionId(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "status": + out.Values[i] = ec._WebhookEvent_status(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "response": + out.Values[i] = ec._WebhookEvent_response(ctx, field, obj) + case "createdAt": + out.Values[i] = ec._WebhookEvent_createdAt(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 webhookEventConnectionImplementors = []string{"WebhookEventConnection"} + +func (ec *executionContext) _WebhookEventConnection(ctx context.Context, sel ast.SelectionSet, obj *types.WebhookEventConnection) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, webhookEventConnectionImplementors) + + 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("WebhookEventConnection") + case "edges": + out.Values[i] = ec._WebhookEventConnection_edges(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "pageInfo": + out.Values[i] = ec._WebhookEventConnection_pageInfo(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "totalCount": + 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._WebhookEventConnection_totalCount(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 webhookEventEdgeImplementors = []string{"WebhookEventEdge"} + +func (ec *executionContext) _WebhookEventEdge(ctx context.Context, sel ast.SelectionSet, obj *types.WebhookEventEdge) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, webhookEventEdgeImplementors) + + 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("WebhookEventEdge") + case "cursor": + out.Values[i] = ec._WebhookEventEdge_cursor(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "node": + out.Values[i] = ec._WebhookEventEdge_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 webhookSubscriptionImplementors = []string{"WebhookSubscription", "Node"} func (ec *executionContext) _WebhookSubscription(ctx context.Context, sel ast.SelectionSet, obj *types.WebhookSubscription) graphql.Marshaler { @@ -91610,186 +91794,6 @@ func (ec *executionContext) _WebhookSubscriptionEdge(ctx context.Context, sel as return out } -var webhookEventImplementors = []string{"WebhookEvent", "Node"} - -func (ec *executionContext) _WebhookEvent(ctx context.Context, sel ast.SelectionSet, obj *types.WebhookEvent) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, webhookEventImplementors) - - 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("WebhookEvent") - case "id": - out.Values[i] = ec._WebhookEvent_id(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "webhookSubscriptionId": - out.Values[i] = ec._WebhookEvent_webhookSubscriptionId(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "status": - out.Values[i] = ec._WebhookEvent_status(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "response": - out.Values[i] = ec._WebhookEvent_response(ctx, field, obj) - case "createdAt": - out.Values[i] = ec._WebhookEvent_createdAt(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 webhookEventConnectionImplementors = []string{"WebhookEventConnection"} - -func (ec *executionContext) _WebhookEventConnection(ctx context.Context, sel ast.SelectionSet, obj *types.WebhookEventConnection) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, webhookEventConnectionImplementors) - - 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("WebhookEventConnection") - case "edges": - out.Values[i] = ec._WebhookEventConnection_edges(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) - } - case "pageInfo": - out.Values[i] = ec._WebhookEventConnection_pageInfo(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) - } - case "totalCount": - 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._WebhookEventConnection_totalCount(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 webhookEventEdgeImplementors = []string{"WebhookEventEdge"} - -func (ec *executionContext) _WebhookEventEdge(ctx context.Context, sel ast.SelectionSet, obj *types.WebhookEventEdge) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, webhookEventEdgeImplementors) - - 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("WebhookEventEdge") - case "cursor": - out.Values[i] = ec._WebhookEventEdge_cursor(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "node": - out.Values[i] = ec._WebhookEventEdge_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 { @@ -92222,10 +92226,12 @@ func (ec *executionContext) marshalNApplicabilityStatementOrderField2goᚗprobo var ( unmarshalNApplicabilityStatementOrderField2goᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐApplicabilityStatementOrderField = map[string]coredata.ApplicabilityStatementOrderField{ - "CREATED_AT": coredata.ApplicabilityStatementOrderFieldCreatedAt, + "CREATED_AT": coredata.ApplicabilityStatementOrderFieldCreatedAt, + "CONTROL_SECTION_TITLE": coredata.ApplicabilityStatementOrderFieldControlSectionTitle, } marshalNApplicabilityStatementOrderField2goᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐApplicabilityStatementOrderField = map[coredata.ApplicabilityStatementOrderField]string{ - coredata.ApplicabilityStatementOrderFieldCreatedAt: "CREATED_AT", + coredata.ApplicabilityStatementOrderFieldCreatedAt: "CREATED_AT", + coredata.ApplicabilityStatementOrderFieldControlSectionTitle: "CONTROL_SECTION_TITLE", } ) @@ -100696,110 +100702,6 @@ func (ec *executionContext) marshalNViewer2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋs return ec._Viewer(ctx, sel, v) } -func (ec *executionContext) marshalNWebhookSubscription2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐWebhookSubscription(ctx context.Context, sel ast.SelectionSet, v *types.WebhookSubscription) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow") - } - return graphql.Null - } - return ec._WebhookSubscription(ctx, sel, v) -} - -func (ec *executionContext) marshalNWebhookSubscriptionConnection2goᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐWebhookSubscriptionConnection(ctx context.Context, sel ast.SelectionSet, v types.WebhookSubscriptionConnection) graphql.Marshaler { - return ec._WebhookSubscriptionConnection(ctx, sel, &v) -} - -func (ec *executionContext) marshalNWebhookSubscriptionConnection2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐWebhookSubscriptionConnection(ctx context.Context, sel ast.SelectionSet, v *types.WebhookSubscriptionConnection) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow") - } - return graphql.Null - } - return ec._WebhookSubscriptionConnection(ctx, sel, v) -} - -func (ec *executionContext) marshalNWebhookSubscriptionEdge2ᚕᚖgoᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐWebhookSubscriptionEdgeᚄ(ctx context.Context, sel ast.SelectionSet, v []*types.WebhookSubscriptionEdge) 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.marshalNWebhookSubscriptionEdge2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐWebhookSubscriptionEdge(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) marshalNWebhookSubscriptionEdge2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐWebhookSubscriptionEdge(ctx context.Context, sel ast.SelectionSet, v *types.WebhookSubscriptionEdge) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow") - } - return graphql.Null - } - return ec._WebhookSubscriptionEdge(ctx, sel, v) -} - -func (ec *executionContext) unmarshalNWebhookSubscriptionOrderField2goᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐWebhookSubscriptionOrderField(ctx context.Context, v any) (coredata.WebhookSubscriptionOrderField, error) { - tmp, err := graphql.UnmarshalString(v) - res := unmarshalNWebhookSubscriptionOrderField2goᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐWebhookSubscriptionOrderField[tmp] - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalNWebhookSubscriptionOrderField2goᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐWebhookSubscriptionOrderField(ctx context.Context, sel ast.SelectionSet, v coredata.WebhookSubscriptionOrderField) graphql.Marshaler { - _ = sel - res := graphql.MarshalString(marshalNWebhookSubscriptionOrderField2goᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐWebhookSubscriptionOrderField[v]) - if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow") - } - } - return res -} - -var ( - unmarshalNWebhookSubscriptionOrderField2goᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐWebhookSubscriptionOrderField = map[string]coredata.WebhookSubscriptionOrderField{ - "CREATED_AT": coredata.WebhookSubscriptionOrderFieldCreatedAt, - } - marshalNWebhookSubscriptionOrderField2goᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐWebhookSubscriptionOrderField = map[coredata.WebhookSubscriptionOrderField]string{ - coredata.WebhookSubscriptionOrderFieldCreatedAt: "CREATED_AT", - } -) - func (ec *executionContext) marshalNWebhookEvent2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐWebhookEvent(ctx context.Context, sel ast.SelectionSet, v *types.WebhookEvent) graphql.Marshaler { if v == nil { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { @@ -101029,6 +100931,110 @@ func (ec *executionContext) marshalNWebhookEventType2ᚕgoᚗproboᚗincᚋprobo return ret } +func (ec *executionContext) marshalNWebhookSubscription2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐWebhookSubscription(ctx context.Context, sel ast.SelectionSet, v *types.WebhookSubscription) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._WebhookSubscription(ctx, sel, v) +} + +func (ec *executionContext) marshalNWebhookSubscriptionConnection2goᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐWebhookSubscriptionConnection(ctx context.Context, sel ast.SelectionSet, v types.WebhookSubscriptionConnection) graphql.Marshaler { + return ec._WebhookSubscriptionConnection(ctx, sel, &v) +} + +func (ec *executionContext) marshalNWebhookSubscriptionConnection2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐWebhookSubscriptionConnection(ctx context.Context, sel ast.SelectionSet, v *types.WebhookSubscriptionConnection) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._WebhookSubscriptionConnection(ctx, sel, v) +} + +func (ec *executionContext) marshalNWebhookSubscriptionEdge2ᚕᚖgoᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐWebhookSubscriptionEdgeᚄ(ctx context.Context, sel ast.SelectionSet, v []*types.WebhookSubscriptionEdge) 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.marshalNWebhookSubscriptionEdge2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐWebhookSubscriptionEdge(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) marshalNWebhookSubscriptionEdge2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐWebhookSubscriptionEdge(ctx context.Context, sel ast.SelectionSet, v *types.WebhookSubscriptionEdge) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._WebhookSubscriptionEdge(ctx, sel, v) +} + +func (ec *executionContext) unmarshalNWebhookSubscriptionOrderField2goᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐWebhookSubscriptionOrderField(ctx context.Context, v any) (coredata.WebhookSubscriptionOrderField, error) { + tmp, err := graphql.UnmarshalString(v) + res := unmarshalNWebhookSubscriptionOrderField2goᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐWebhookSubscriptionOrderField[tmp] + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNWebhookSubscriptionOrderField2goᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐWebhookSubscriptionOrderField(ctx context.Context, sel ast.SelectionSet, v coredata.WebhookSubscriptionOrderField) graphql.Marshaler { + _ = sel + res := graphql.MarshalString(marshalNWebhookSubscriptionOrderField2goᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐWebhookSubscriptionOrderField[v]) + if res == graphql.Null { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow") + } + } + return res +} + +var ( + unmarshalNWebhookSubscriptionOrderField2goᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐWebhookSubscriptionOrderField = map[string]coredata.WebhookSubscriptionOrderField{ + "CREATED_AT": coredata.WebhookSubscriptionOrderFieldCreatedAt, + } + marshalNWebhookSubscriptionOrderField2goᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐWebhookSubscriptionOrderField = map[coredata.WebhookSubscriptionOrderField]string{ + coredata.WebhookSubscriptionOrderFieldCreatedAt: "CREATED_AT", + } +) + 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) } @@ -103105,14 +103111,6 @@ func (ec *executionContext) unmarshalOVendorServiceOrder2ᚖgoᚗproboᚗincᚋp return &res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) unmarshalOWebhookSubscriptionOrder2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐWebhookSubscriptionOrderBy(ctx context.Context, v any) (*types.WebhookSubscriptionOrderBy, error) { - if v == nil { - return nil, nil - } - res, err := ec.unmarshalInputWebhookSubscriptionOrder(ctx, v) - return &res, graphql.ErrorOnPath(ctx, err) -} - func (ec *executionContext) unmarshalOWebhookEventOrder2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐWebhookEventOrderBy(ctx context.Context, v any) (*types.WebhookEventOrderBy, error) { if v == nil { return nil, nil @@ -103186,6 +103184,14 @@ func (ec *executionContext) marshalOWebhookEventType2ᚕgoᚗproboᚗincᚋprobo return ret } +func (ec *executionContext) unmarshalOWebhookSubscriptionOrder2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐWebhookSubscriptionOrderBy(ctx context.Context, v any) (*types.WebhookSubscriptionOrderBy, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalInputWebhookSubscriptionOrder(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + 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 diff --git a/pkg/server/api/console/v1/types/types.go b/pkg/server/api/console/v1/types/types.go index e98d442f3..05635f0fc 100644 --- a/pkg/server/api/console/v1/types/types.go +++ b/pkg/server/api/console/v1/types/types.go @@ -1517,7 +1517,7 @@ type Organization struct { TrustCenterFiles *TrustCenterFileConnection `json:"trustCenterFiles"` TrustCenter *TrustCenter `json:"trustCenter,omitempty"` CustomDomain *CustomDomain `json:"customDomain,omitempty"` - WebhookSubscriptions *WebhookSubscriptionConnection `json:"webhookSubscriptions"` + WebhookSubscriptions *WebhookSubscriptionConnection `json:"webhookSubscriptions"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` Permission bool `json:"permission"` @@ -2623,6 +2623,22 @@ type Viewer struct { SignableDocument *SignableDocument `json:"signableDocument,omitempty"` } +type WebhookEvent struct { + ID gid.GID `json:"id"` + WebhookSubscriptionID gid.GID `json:"webhookSubscriptionId"` + Status coredata.WebhookEventStatus `json:"status"` + Response *string `json:"response,omitempty"` + CreatedAt time.Time `json:"createdAt"` +} + +func (WebhookEvent) IsNode() {} +func (this WebhookEvent) GetID() gid.GID { return this.ID } + +type WebhookEventEdge struct { + Cursor page.CursorKey `json:"cursor"` + Node *WebhookEvent `json:"node"` +} + type WebhookSubscription struct { ID gid.GID `json:"id"` Organization *Organization `json:"organization,omitempty"` @@ -2642,19 +2658,3 @@ type WebhookSubscriptionEdge struct { Cursor page.CursorKey `json:"cursor"` Node *WebhookSubscription `json:"node"` } - -type WebhookEvent struct { - ID gid.GID `json:"id"` - WebhookSubscriptionID gid.GID `json:"webhookSubscriptionId"` - Status coredata.WebhookEventStatus `json:"status"` - Response *string `json:"response,omitempty"` - CreatedAt time.Time `json:"createdAt"` -} - -func (WebhookEvent) IsNode() {} -func (this WebhookEvent) GetID() gid.GID { return this.ID } - -type WebhookEventEdge struct { - Cursor page.CursorKey `json:"cursor"` - Node *WebhookEvent `json:"node"` -}