Add control-policy mappings and rename control APIs

This introduces the ability to map controls to policies alongside the
existing control-mitigation mappings. The feature adds bidirectional
relationships with new GraphQL fields on Control and Policy types.

Signed-off-by: gearnode <bryan@frimin.fr>
This commit is contained in:
gearnode
2025-04-08 21:14:11 -07:00
parent 348e2641bb
commit 4ce72c03f7
17 changed files with 1630 additions and 207 deletions

View File

@@ -93,9 +93,9 @@ const organizationMitigationsQuery = graphql`
// Mutation to create a mapping between a control and a mitigation
const createMitigationMappingMutation = graphql`
mutation ControlCreateMitigationMappingMutation(
$input: CreateControlMappingInput!
$input: CreateControlMitigationMappingInput!
) {
createControlMapping(input: $input) {
createControlMitigationMapping(input: $input) {
success
}
}
@@ -104,9 +104,9 @@ const createMitigationMappingMutation = graphql`
// Mutation to delete a mapping between a control and a mitigation
const deleteMitigationMappingMutation = graphql`
mutation ControlDeleteMitigationMappingMutation(
$input: DeleteControlMappingInput!
$input: DeleteControlMitigationMappingInput!
) {
deleteControlMapping(input: $input) {
deleteControlMitigationMapping(input: $input) {
success
}
}

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<7598a6cf0314f71bab809d65acc60237>>
* @generated SignedSource<<2eea3e72c7001db14095958b3bcd750a>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -9,15 +9,15 @@
// @ts-nocheck
import { ConcreteRequest } from 'relay-runtime';
export type CreateControlMappingInput = {
export type CreateControlMitigationMappingInput = {
controlId: string;
mitigationId: string;
};
export type ControlCreateMitigationMappingMutation$variables = {
input: CreateControlMappingInput;
input: CreateControlMitigationMappingInput;
};
export type ControlCreateMitigationMappingMutation$data = {
readonly createControlMapping: {
readonly createControlMitigationMapping: {
readonly success: boolean;
};
};
@@ -44,9 +44,9 @@ v1 = [
"variableName": "input"
}
],
"concreteType": "CreateControlMappingPayload",
"concreteType": "CreateControlMitigationMappingPayload",
"kind": "LinkedField",
"name": "createControlMapping",
"name": "createControlMitigationMapping",
"plural": false,
"selections": [
{
@@ -78,16 +78,16 @@ return {
"selections": (v1/*: any*/)
},
"params": {
"cacheID": "57ab0bf99dd6ed3d2e980c51f185b9c0",
"cacheID": "955241a049e81cd7faed45d69ce3b145",
"id": null,
"metadata": {},
"name": "ControlCreateMitigationMappingMutation",
"operationKind": "mutation",
"text": "mutation ControlCreateMitigationMappingMutation(\n $input: CreateControlMappingInput!\n) {\n createControlMapping(input: $input) {\n success\n }\n}\n"
"text": "mutation ControlCreateMitigationMappingMutation(\n $input: CreateControlMitigationMappingInput!\n) {\n createControlMitigationMapping(input: $input) {\n success\n }\n}\n"
}
};
})();
(node as any).hash = "17ef8f09acabf19168dad896e4225e3d";
(node as any).hash = "ffbcf187d7f2d3c65a2d1fb5c6a180bb";
export default node;

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<c1cd34e6543447b414b10f63225883c2>>
* @generated SignedSource<<7c4ad77e70fa42cf8257113897a607ec>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -9,15 +9,15 @@
// @ts-nocheck
import { ConcreteRequest } from 'relay-runtime';
export type DeleteControlMappingInput = {
export type DeleteControlMitigationMappingInput = {
controlId: string;
mitigationId: string;
};
export type ControlDeleteMitigationMappingMutation$variables = {
input: DeleteControlMappingInput;
input: DeleteControlMitigationMappingInput;
};
export type ControlDeleteMitigationMappingMutation$data = {
readonly deleteControlMapping: {
readonly deleteControlMitigationMapping: {
readonly success: boolean;
};
};
@@ -44,9 +44,9 @@ v1 = [
"variableName": "input"
}
],
"concreteType": "DeleteControlMappingPayload",
"concreteType": "DeleteControlMitigationMappingPayload",
"kind": "LinkedField",
"name": "deleteControlMapping",
"name": "deleteControlMitigationMapping",
"plural": false,
"selections": [
{
@@ -78,16 +78,16 @@ return {
"selections": (v1/*: any*/)
},
"params": {
"cacheID": "31dcbb70c0b32e78dcb3fd2a2dc1a58b",
"cacheID": "3d09a29c8ae06a97d098e565a7f2d172",
"id": null,
"metadata": {},
"name": "ControlDeleteMitigationMappingMutation",
"operationKind": "mutation",
"text": "mutation ControlDeleteMitigationMappingMutation(\n $input: DeleteControlMappingInput!\n) {\n deleteControlMapping(input: $input) {\n success\n }\n}\n"
"text": "mutation ControlDeleteMitigationMappingMutation(\n $input: DeleteControlMitigationMappingInput!\n) {\n deleteControlMitigationMapping(input: $input) {\n success\n }\n}\n"
}
};
})();
(node as any).hash = "6070b58009682dfa712e445363f0ebf5";
(node as any).hash = "6905236aeeb313e5deed3e569a0c7c54";
export default node;

View File

@@ -394,9 +394,9 @@ const linkedControlsQuery = graphql`
const createControlMappingMutation = graphql`
mutation MitigationViewCreateControlMappingMutation(
$input: CreateControlMappingInput!
$input: CreateControlMitigationMappingInput!
) {
createControlMapping(input: $input) {
createControlMitigationMapping(input: $input) {
success
}
}
@@ -404,9 +404,9 @@ const createControlMappingMutation = graphql`
const deleteControlMappingMutation = graphql`
mutation MitigationViewDeleteControlMappingMutation(
$input: DeleteControlMappingInput!
$input: DeleteControlMitigationMappingInput!
) {
deleteControlMapping(input: $input) {
deleteControlMitigationMapping(input: $input) {
success
}
}

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<d072ba12f8b6bd81f47e8d2fbe56db9c>>
* @generated SignedSource<<53f255c3852774870c7d294d64e6808d>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -9,15 +9,15 @@
// @ts-nocheck
import { ConcreteRequest } from 'relay-runtime';
export type CreateControlMappingInput = {
export type CreateControlMitigationMappingInput = {
controlId: string;
mitigationId: string;
};
export type MitigationViewCreateControlMappingMutation$variables = {
input: CreateControlMappingInput;
input: CreateControlMitigationMappingInput;
};
export type MitigationViewCreateControlMappingMutation$data = {
readonly createControlMapping: {
readonly createControlMitigationMapping: {
readonly success: boolean;
};
};
@@ -44,9 +44,9 @@ v1 = [
"variableName": "input"
}
],
"concreteType": "CreateControlMappingPayload",
"concreteType": "CreateControlMitigationMappingPayload",
"kind": "LinkedField",
"name": "createControlMapping",
"name": "createControlMitigationMapping",
"plural": false,
"selections": [
{
@@ -78,16 +78,16 @@ return {
"selections": (v1/*: any*/)
},
"params": {
"cacheID": "79290e466d2aa856113aae8a4e7a0035",
"cacheID": "fa46c5cf8b96b70117d12cf985247824",
"id": null,
"metadata": {},
"name": "MitigationViewCreateControlMappingMutation",
"operationKind": "mutation",
"text": "mutation MitigationViewCreateControlMappingMutation(\n $input: CreateControlMappingInput!\n) {\n createControlMapping(input: $input) {\n success\n }\n}\n"
"text": "mutation MitigationViewCreateControlMappingMutation(\n $input: CreateControlMitigationMappingInput!\n) {\n createControlMitigationMapping(input: $input) {\n success\n }\n}\n"
}
};
})();
(node as any).hash = "32a27dc5fdd06c261258e80db3db50fc";
(node as any).hash = "af6e4d7933e5c428eec0e97cdf0b73dd";
export default node;

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<aee67baf82965259c299a4ae9947bda3>>
* @generated SignedSource<<f34a09cd4eda414409384386a4cea5b4>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -9,15 +9,15 @@
// @ts-nocheck
import { ConcreteRequest } from 'relay-runtime';
export type DeleteControlMappingInput = {
export type DeleteControlMitigationMappingInput = {
controlId: string;
mitigationId: string;
};
export type MitigationViewDeleteControlMappingMutation$variables = {
input: DeleteControlMappingInput;
input: DeleteControlMitigationMappingInput;
};
export type MitigationViewDeleteControlMappingMutation$data = {
readonly deleteControlMapping: {
readonly deleteControlMitigationMapping: {
readonly success: boolean;
};
};
@@ -44,9 +44,9 @@ v1 = [
"variableName": "input"
}
],
"concreteType": "DeleteControlMappingPayload",
"concreteType": "DeleteControlMitigationMappingPayload",
"kind": "LinkedField",
"name": "deleteControlMapping",
"name": "deleteControlMitigationMapping",
"plural": false,
"selections": [
{
@@ -78,16 +78,16 @@ return {
"selections": (v1/*: any*/)
},
"params": {
"cacheID": "824394c9cc09d7d428ad42835d3737ef",
"cacheID": "b18a11215ba33a6c770cc08c88a28769",
"id": null,
"metadata": {},
"name": "MitigationViewDeleteControlMappingMutation",
"operationKind": "mutation",
"text": "mutation MitigationViewDeleteControlMappingMutation(\n $input: DeleteControlMappingInput!\n) {\n deleteControlMapping(input: $input) {\n success\n }\n}\n"
"text": "mutation MitigationViewDeleteControlMappingMutation(\n $input: DeleteControlMitigationMappingInput!\n) {\n deleteControlMitigationMapping(input: $input) {\n success\n }\n}\n"
}
};
})();
(node as any).hash = "4d7bd098ed16e825abec0e5d996b06e9";
(node as any).hash = "f4f01abb45a3288558d7e8a1d19ce1ed";
export default node;