@kartverket/backstage-plugin-risk-scorecard 6.10.0 → 6.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/riScInfo/changeset/RiScChangeSet.esm.js +1 -1
- package/dist/components/riScInfo/changeset/RiScChangeSet.esm.js.map +1 -1
- package/dist/plugin.esm.js +2 -7
- package/dist/plugin.esm.js.map +1 -1
- package/dist/utils/featureFlags.esm.js +8 -1
- package/dist/utils/featureFlags.esm.js.map +1 -1
- package/dist/utils/types.esm.js.map +1 -1
- package/package.json +1 -1
|
@@ -13,7 +13,7 @@ function RiScChangeSet({ changeset }) {
|
|
|
13
13
|
const { t } = useTranslationRef(pluginRiScTranslationRef);
|
|
14
14
|
const migrationChanges = changeset.differenceState.migrationChanges;
|
|
15
15
|
const changes = changeset.differenceState;
|
|
16
|
-
const appliesToChanges = changes.
|
|
16
|
+
const appliesToChanges = changes.appliesTo ?? [];
|
|
17
17
|
const hasChanges = changes.scenarios.length > 0 || changes.valuations.length > 0 || changes.title || changes.scope || appliesToChanges.length > 0;
|
|
18
18
|
const hasAnyChanges = changes.migrationChanges.migrationChanges || hasChanges;
|
|
19
19
|
if (!hasAnyChanges) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RiScChangeSet.esm.js","sources":["../../../../src/components/riScInfo/changeset/RiScChangeSet.tsx"],"sourcesContent":["import { DifferenceFetchState } from '../../../utils/types.ts';\nimport { RiScMigrationChanges } from '../migrations/RiScMigrationChanges.tsx';\nimport { ChangeSetTitle } from './components/ChangeSetTitle.tsx';\nimport { RiScScenarioChangeSet } from './RiScScenarioChangeSet.tsx';\nimport { RiScScenarioChange } from './RiScScenarioChange.tsx';\nimport { dtoToScenario } from '../../../utils/DTOs.ts';\nimport { ChangeSetSimpleBox } from './components/ChangeSetSimpleBox.tsx';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { pluginRiScTranslationRef } from '../../../utils/translations.ts';\nimport { RiScAppliesToChange } from './RiScAppliesToChange.tsx';\n\ntype RiScChangeSetProps = {\n changeset: DifferenceFetchState;\n};\n\nexport function RiScChangeSet({ changeset }: RiScChangeSetProps) {\n const { t } = useTranslationRef(pluginRiScTranslationRef);\n const migrationChanges = changeset.differenceState.migrationChanges;\n const changes = changeset.differenceState;\n const appliesToChanges = changes.
|
|
1
|
+
{"version":3,"file":"RiScChangeSet.esm.js","sources":["../../../../src/components/riScInfo/changeset/RiScChangeSet.tsx"],"sourcesContent":["import { DifferenceFetchState } from '../../../utils/types.ts';\nimport { RiScMigrationChanges } from '../migrations/RiScMigrationChanges.tsx';\nimport { ChangeSetTitle } from './components/ChangeSetTitle.tsx';\nimport { RiScScenarioChangeSet } from './RiScScenarioChangeSet.tsx';\nimport { RiScScenarioChange } from './RiScScenarioChange.tsx';\nimport { dtoToScenario } from '../../../utils/DTOs.ts';\nimport { ChangeSetSimpleBox } from './components/ChangeSetSimpleBox.tsx';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { pluginRiScTranslationRef } from '../../../utils/translations.ts';\nimport { RiScAppliesToChange } from './RiScAppliesToChange.tsx';\n\ntype RiScChangeSetProps = {\n changeset: DifferenceFetchState;\n};\n\nexport function RiScChangeSet({ changeset }: RiScChangeSetProps) {\n const { t } = useTranslationRef(pluginRiScTranslationRef);\n const migrationChanges = changeset.differenceState.migrationChanges;\n const changes = changeset.differenceState;\n const appliesToChanges = changes.appliesTo ?? [];\n\n const hasChanges =\n changes.scenarios.length > 0 ||\n changes.valuations.length > 0 ||\n changes.title ||\n changes.scope ||\n appliesToChanges.length > 0;\n\n const hasAnyChanges = changes.migrationChanges.migrationChanges || hasChanges;\n\n if (!hasAnyChanges) {\n return <i>{t('comparisonDialog.noChanges')}</i>;\n }\n\n return (\n <div>\n {migrationChanges.migrationVersions?.fromVersion !==\n migrationChanges.migrationVersions?.toVersion && (\n <RiScMigrationChanges migrationStatus={migrationChanges} />\n )}\n {hasChanges && (\n <>\n <ChangeSetTitle text={t('comparisonDialog.changes')} />\n <ChangeSetSimpleBox\n prop={changes.title}\n title={t('dictionary.title')}\n />\n <ChangeSetSimpleBox\n prop={changes.scope}\n title={t('dictionary.scope')}\n />\n {appliesToChanges.length > 1 && (\n <RiScAppliesToChange appliesToChanges={appliesToChanges} />\n )}\n {changes.scenarios.map(scenario => (\n <>\n {(scenario.type === 'ADDED' || scenario.type === 'DELETED') && (\n <RiScScenarioChange\n scenario={dtoToScenario(\n scenario.type === 'ADDED'\n ? scenario.newValue\n : scenario.oldValue,\n )}\n type={scenario.type}\n />\n )}\n {scenario.type === 'CONTENT_CHANGED' && (\n <RiScScenarioChangeSet scenario={scenario.value} />\n )}\n </>\n ))}\n </>\n )}\n </div>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;AAeO,SAAS,aAAA,CAAc,EAAE,SAAA,EAAU,EAAuB;AAC/D,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,iBAAA,CAAkB,wBAAwB,CAAA;AACxD,EAAA,MAAM,gBAAA,GAAmB,UAAU,eAAA,CAAgB,gBAAA;AACnD,EAAA,MAAM,UAAU,SAAA,CAAU,eAAA;AAC1B,EAAA,MAAM,gBAAA,GAAmB,OAAA,CAAQ,SAAA,IAAa,EAAC;AAE/C,EAAA,MAAM,UAAA,GACJ,OAAA,CAAQ,SAAA,CAAU,MAAA,GAAS,KAC3B,OAAA,CAAQ,UAAA,CAAW,MAAA,GAAS,CAAA,IAC5B,OAAA,CAAQ,KAAA,IACR,OAAA,CAAQ,KAAA,IACR,iBAAiB,MAAA,GAAS,CAAA;AAE5B,EAAA,MAAM,aAAA,GAAgB,OAAA,CAAQ,gBAAA,CAAiB,gBAAA,IAAoB,UAAA;AAEnE,EAAA,IAAI,CAAC,aAAA,EAAe;AAClB,IAAA,uBAAO,GAAA,CAAC,GAAA,EAAA,EAAG,QAAA,EAAA,CAAA,CAAE,4BAA4B,CAAA,EAAE,CAAA;AAAA,EAC7C;AAEA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CACD;AAAA,KAAA,EACH;AAAA,GAAA,EAEJ,CAAA;AAEJ;;;;"}
|
package/dist/plugin.esm.js
CHANGED
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
import { createPlugin, createRoutableExtension } from '@backstage/core-plugin-api';
|
|
2
2
|
import { riScRouteRef, scenarioRouteRef, rootRouteRef } from './routes.esm.js';
|
|
3
|
-
import {
|
|
3
|
+
import { riScFeatureFlags } from './utils/featureFlags.esm.js';
|
|
4
4
|
|
|
5
5
|
const riScPlugin = createPlugin({
|
|
6
6
|
id: "riSc",
|
|
7
|
-
featureFlags:
|
|
8
|
-
{
|
|
9
|
-
name: systemRiScsFeatureFlag,
|
|
10
|
-
description: "Testing av system-RoS for Team SKVIS. Bruk p\xE5 eget ansvar. UNNG\xC5 lagring av System-RoSer i \xE5pne repoer."
|
|
11
|
-
}
|
|
12
|
-
],
|
|
7
|
+
featureFlags: riScFeatureFlags,
|
|
13
8
|
routes: {
|
|
14
9
|
root: rootRouteRef,
|
|
15
10
|
scenario: scenarioRouteRef,
|
package/dist/plugin.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.esm.js","sources":["../src/plugin.ts"],"sourcesContent":["import {\n createPlugin,\n createRoutableExtension,\n} from '@backstage/core-plugin-api';\n\nimport { rootRouteRef, riScRouteRef, scenarioRouteRef } from './routes';\nimport {
|
|
1
|
+
{"version":3,"file":"plugin.esm.js","sources":["../src/plugin.ts"],"sourcesContent":["import {\n createPlugin,\n createRoutableExtension,\n} from '@backstage/core-plugin-api';\n\nimport { rootRouteRef, riScRouteRef, scenarioRouteRef } from './routes';\nimport { riScFeatureFlags } from './utils/featureFlags';\n\nexport const riScPlugin = createPlugin({\n id: 'riSc',\n featureFlags: riScFeatureFlags,\n routes: {\n root: rootRouteRef,\n scenario: scenarioRouteRef,\n riSc: riScRouteRef,\n },\n});\n\nexport const RiScPage = riScPlugin.provide(\n createRoutableExtension({\n name: 'RiScPage',\n component: () => import('./PluginRoot').then(m => m.PluginRoot),\n mountPoint: rootRouteRef,\n }),\n);\n"],"names":[],"mappings":";;;;AAQO,MAAM,aAAa,YAAA,CAAa;AAAA,EACrC,EAAA,EAAI,MAAA;AAAA,EACJ,YAAA,EAAc,gBAAA;AAAA,EACd,MAAA,EAAQ;AAAA,IACN,IAAA,EAAM,YAAA;AAAA,IACN,QAAA,EAAU,gBAAA;AAAA,IACV,IAAA,EAAM;AAAA;AAEV,CAAC;AAEM,MAAM,WAAW,UAAA,CAAW,OAAA;AAAA,EACjC,uBAAA,CAAwB;AAAA,IACtB,IAAA,EAAM,UAAA;AAAA,IACN,SAAA,EAAW,MAAM,OAAO,qBAAc,EAAE,IAAA,CAAK,CAAA,CAAA,KAAK,EAAE,UAAU,CAAA;AAAA,IAC9D,UAAA,EAAY;AAAA,GACb;AACH;;;;"}
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import { useApi, featureFlagsApiRef } from '@backstage/core-plugin-api';
|
|
2
2
|
|
|
3
3
|
const systemRiScsFeatureFlag = "system-riscs";
|
|
4
|
+
const riScFeatureFlags = [
|
|
5
|
+
// {
|
|
6
|
+
// name: systemRiScsFeatureFlag,
|
|
7
|
+
// description:
|
|
8
|
+
// 'Testing av system-RoS for Team SKVIS. Bruk på eget ansvar. UNNGÅ lagring av System-RoSer i åpne repoer.',
|
|
9
|
+
// },
|
|
10
|
+
];
|
|
4
11
|
function useSystemRiScsFeatureFlag() {
|
|
5
12
|
const featureFlagsApi = useApi(featureFlagsApiRef);
|
|
6
13
|
return featureFlagsApi.isActive(systemRiScsFeatureFlag);
|
|
7
14
|
}
|
|
8
15
|
|
|
9
|
-
export { systemRiScsFeatureFlag, useSystemRiScsFeatureFlag };
|
|
16
|
+
export { riScFeatureFlags, systemRiScsFeatureFlag, useSystemRiScsFeatureFlag };
|
|
10
17
|
//# sourceMappingURL=featureFlags.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"featureFlags.esm.js","sources":["../../src/utils/featureFlags.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"featureFlags.esm.js","sources":["../../src/utils/featureFlags.ts"],"sourcesContent":["import {\n featureFlagsApiRef,\n type PluginFeatureFlagConfig,\n useApi,\n} from '@backstage/core-plugin-api';\n\nexport const systemRiScsFeatureFlag = 'system-riscs';\n\nexport const riScFeatureFlags: PluginFeatureFlagConfig[] = [\n // {\n // name: systemRiScsFeatureFlag,\n // description:\n // 'Testing av system-RoS for Team SKVIS. Bruk på eget ansvar. UNNGÅ lagring av System-RoSer i åpne repoer.',\n // },\n];\n\nexport function useSystemRiScsFeatureFlag(): boolean {\n const featureFlagsApi = useApi(featureFlagsApiRef);\n return featureFlagsApi.isActive(systemRiScsFeatureFlag);\n}\n"],"names":[],"mappings":";;AAMO,MAAM,sBAAA,GAAyB;AAE/B,MAAM,gBAAA,GAA8C;AAAA;AAAA;AAAA;AAAA;AAAA;AAM3D;AAEO,SAAS,yBAAA,GAAqC;AACnD,EAAA,MAAM,eAAA,GAAkB,OAAO,kBAAkB,CAAA;AACjD,EAAA,OAAO,eAAA,CAAgB,SAAS,sBAAsB,CAAA;AACxD;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.esm.js","sources":["../../src/utils/types.ts"],"sourcesContent":["import type { Dispatch } from 'react';\nimport { ActionsDTO, ScenarioDTO, SopsConfigDTO } from './DTOs';\nimport { ActionStatusOptions } from './constants';\n\n/**\n * Modify one key on an object type. Modify takes 3 type arguments. First one takes the original type you want to modify. Second is the specific key you want to modify. Third is the new type for that key.\n * @template {object} O Which object type to use as basis\n * @template {string} K Key of field in object to modify\n * @template R New type to set field of key to\n */\nexport type Modify<O, K extends keyof any, R> = Omit<O, K> & { [P in K]: R };\n\n/** Type of the setter from `useState` */\nexport type SetState<T extends any> = Dispatch<React.SetStateAction<T>>;\n\nexport type LastPublished = {\n dateTime: Date;\n numberOfCommits: number;\n};\n\nexport type LockedRiSc = {\n id: string;\n encryptionKeyId: string | null;\n};\n\nexport type SystemRiSc = {\n sourceFilePath: string;\n riScId: string;\n appliesTo: string[];\n lastSavedAt: string;\n};\n\nexport type RiScWithMetadata = {\n id: string;\n status: RiScStatus;\n content: RiSc;\n sopsConfig: SopsConfigDTO;\n isRequiresNewApproval?: boolean;\n pullRequestUrl?: string;\n schemaVersion?: string;\n migrationStatus?: MigrationStatus;\n lastPublished?: LastPublished;\n};\n\nexport type DefaultRiScTypeDescriptor = {\n id: string;\n listName: string;\n listDescription: string;\n defaultTitle: string;\n defaultScope: string;\n numberOfScenarios: number | null;\n numberOfActions: number | null;\n preferredBackstageComponentType: string | null;\n priorityIndex: number | null;\n};\n\nexport type MigrationStatus = {\n migrationChanges: boolean;\n migrationRequiresNewApproval: boolean;\n migrationVersions?: MigrationVersions;\n migrationChanges40?: MigrationChanges40;\n migrationChanges41?: MigrationChanges41;\n migrationChanges42?: MigrationChanges42;\n migrationChanges50?: MigrationChanges50;\n migrationChanges51?: MigrationChanges51;\n migrationChanges52?: MigrationChanges52;\n};\n\nexport type MigrationVersions = {\n fromVersion: string;\n toVersion: string;\n};\n\nexport type MigrationChanges52 = {\n removedValuationsCount?: number;\n};\n\nexport type MigrationChanges51 = {\n scenarios: MigrationChanges51Scenario[];\n};\n\nexport type MigrationChanges51Scenario = {\n title: string;\n id: string;\n changedActions: MigrationChanges51Action[];\n};\n\nexport type MigrationChanges51Action = {\n title: string;\n id: string;\n lastUpdatedBy?: string | null;\n};\n\nexport type MigrationChanges50 = {\n scenarios: MigrationChanges50Scenario[];\n};\n\nexport type MigrationChanges50Scenario = {\n title: string;\n id: string;\n changedActions: MigrationChanges50Action[];\n};\n\nexport type MigrationChanges50Action = {\n title: string;\n id: string;\n changedActionStatus: MigrationChangedTypedValue<\n ActionStatusOptionsV4,\n ActionStatusOptions\n >;\n};\n\nexport type MigrationChanges42 = {\n scenarios: MigrationChanges42Scenario[];\n};\n\nexport type MigrationChanges42Scenario = {\n title: string;\n id: string;\n changedActions: MigrationChanges42Action[];\n};\n\nexport type MigrationChanges42Action = {\n title: string;\n id: string;\n lastUpdated?: Date | null;\n};\n\nexport type MigrationChanges41 = {\n scenarios: MigrationChanges41Scenario[];\n};\n\nexport type MigrationChanges41Scenario = {\n title: string;\n id: string;\n changedRiskConsequence?: MigrationChangedValue<number>;\n changedRiskProbability?: MigrationChangedValue<number>;\n changedRemainingRiskConsequence?: MigrationChangedValue<number>;\n changedRemainingRiskProbability?: MigrationChangedValue<number>;\n};\n\nexport type MigrationChanges40 = {\n scenarios: MigrationChanges40Scenario[];\n};\n\nexport type MigrationChanges40Scenario = {\n title: string;\n id: string;\n removedExistingActions?: string;\n changedVulnerabilities: MigrationChangedValue<string>[];\n changedActions: MigrationChanges40Action[];\n};\n\nexport type MigrationChanges40Action = {\n title: string;\n id: string;\n removedOwner?: string;\n removedDeadline?: string;\n};\n\nexport type MigrationChangedValue<T> = {\n oldValue: T;\n newValue: T;\n};\n\nexport type MigrationChangedTypedValue<S, T> = {\n oldValue: S;\n newValue: T;\n};\n\nexport type RiSc = {\n schemaVersion: string;\n title: string;\n scope: string;\n unencryptedMetadata?: UnencryptedMetadata;\n scenarios: Scenario[];\n};\n\nexport type UnencryptedMetadata = {\n appliesTo?: string[];\n};\n\n// The Valuations concept was removed in PR #850 and the remaining code referencing it can be removed when old schema migration code including to v4 is removed.\ntype Valuations = {\n description: string;\n confidentiality: string;\n integrity: string;\n availability: string;\n};\n\nexport type Scenario = {\n ID: string;\n title: string;\n url?: string;\n description: string;\n threatActors: string[];\n vulnerabilities: string[];\n risk: Risk;\n remainingRisk: Risk;\n actions: Action[];\n};\n\nexport type Risk = {\n summary: string;\n probability: number;\n consequence: number;\n};\n\nexport type Action = {\n ID: string;\n title: string;\n description: string;\n status: string;\n url: string;\n lastUpdated?: Date | null;\n lastUpdatedBy?: string | null;\n};\n\nexport type GithubRepoInfo = {\n name: string;\n owner: string;\n};\n\nexport type SubmitResponseObject = {\n status: ProcessingStatus;\n statusMessage: string;\n};\n\nexport enum RiScStatus {\n Draft = 'Draft',\n Published = 'Published',\n SentForApproval = 'SentForApproval',\n DeletionDraft = 'DeletionDraft',\n DeletionSentForApproval = 'DeletionSentForApproval',\n}\n\nexport enum ProcessingStatus {\n RiScNotValid = 'RiScNotValid',\n EncryptionFailed = 'EncryptionFailed',\n CouldNotCreateBranch = 'CouldNotCreateBranch',\n UpdatedRiSc = 'UpdatedRiSc',\n DeletedRiSc = 'DeletedRiSc',\n DeletedRiScRequiresApproval = 'DeletedRiScRequiresApproval',\n UpdatedSops = 'UpdatedSops',\n UpdatedRiScRequiresNewApproval = 'UpdatedRiScRequiresNewApproval',\n UpdatedRiScAndCreatedPullRequest = 'UpdatedRiScAndCreatedPullRequest',\n CreatedRiSc = 'CreatedRiSc',\n OpenedPullRequest = 'OpenedPullRequest',\n CreatedPullRequest = 'CreatedPullRequest',\n ErrorWhenCreatingRiSc = 'ErrorWhenCreatingRiSc',\n ErrorWhenUpdatingRiSc = 'ErrorWhenUpdatingRiSc',\n ErrorWhenUpdatingDeletedRiSc = 'ErrorWhenUpdatingDeletedRiSc',\n ErrorWhenDeletingRiSc = 'ErrorWhenDeletingRiSc',\n ErrorWhenPublishingRiSc = 'ErrorWhenPublishingRiSc',\n ErrorWhenNoWriteAccessToRepository = 'ErrorWhenNoWriteAccessToRepository',\n ErrorWhenFetchingRiScs = 'ErrorWhenFetchingRiScs',\n ErrorWhenCreatingPullRequest = 'ErrorWhenCreatingPullRequest',\n ErrorWhenFetchingGcpCryptoKeys = 'ErrorWhenFetchingGcpCryptoKeys',\n FailedToFetchGcpProjectIds = 'Failed to fetch GCP project IDs',\n InvalidGitHubAccessToken = 'InvalidGitHubAccessToken',\n}\n\nexport enum ContentStatus {\n Success = 'Success',\n Deleted = 'Deleted',\n Failure = 'Failure',\n FileNotFound = 'FileNotFound',\n DecryptionFailed = 'DecryptionFailed',\n NoReadAccess = 'NoReadAccess',\n UnsupportedMigration = 'UnsupportedMigration',\n SchemaValidationFailed = 'SchemaValidationFailed',\n}\n\nexport enum DifferenceStatus {\n Success = 'Success',\n GithubFileNotFound = 'GithubFileNotFound',\n FrontendFallback = 'FrontendFallback',\n}\n\nexport enum ActionStatusOptionsV4 {\n NotStarted = 'Not started',\n InProgress = 'In progress',\n OnHold = 'On hold',\n Completed = 'Completed',\n Aborted = 'Aborted',\n}\n\ntype FormRisk = Modify<\n Modify<Risk, 'probability', string>,\n 'consequence',\n string\n>;\n\nexport type FormScenario = Modify<\n Modify<Scenario, 'risk', FormRisk>,\n 'remainingRisk',\n FormRisk\n>;\n\nexport type Difference = {\n type: '4.*';\n migrationChanges: MigrationStatus;\n title?: SimpleTrackedProperty<string>;\n scope?: SimpleTrackedProperty<string>;\n unencryptedMetadata?: {\n appliesTo?: SimpleTrackedProperty<string>[];\n };\n valuations: SimpleTrackedProperty<Valuations>[];\n scenarios: TrackedProperty<ScenarioChange, ScenarioDTO>[];\n};\n\nexport type ScenarioChange = {\n title: SimpleTrackedProperty<string>;\n id: string;\n description: SimpleTrackedProperty<string>;\n url?: SimpleTrackedProperty<string | null>;\n threatActors: SimpleTrackedProperty<string>[];\n vulnerabilities: SimpleTrackedProperty<string>[];\n risk: SimpleTrackedProperty<ScenarioRiskChange>;\n remainingRisk: SimpleTrackedProperty<ScenarioRiskChange>;\n actions: TrackedProperty<ActionChange, ActionsDTO>[];\n};\n\nexport type ActionChange = {\n title: SimpleTrackedProperty<string>;\n // The id will never change\n id: string;\n description: SimpleTrackedProperty<string>;\n url?: SimpleTrackedProperty<string | null>;\n status?: SimpleTrackedProperty<string>;\n lastUpdated?: SimpleTrackedProperty<Date | null>;\n lastUpdatedBy?: SimpleTrackedProperty<string | null>;\n};\n\nexport type ScenarioRiskChange = {\n summary?: SimpleTrackedProperty<string | null>;\n probability: SimpleTrackedProperty<number>;\n consequence: SimpleTrackedProperty<number>;\n};\n\nexport type SimpleTrackedProperty<T> = TrackedProperty<T, T>;\n\nexport type TrackedProperty<S, T> =\n | AddedProperty<T>\n | ChangedProperty<S>\n | ContentChangedProperty<S>\n | DeletedProperty<T>\n | UnchangedProperty<T>;\n\nexport type AddedProperty<T> = {\n type: 'ADDED';\n newValue: T;\n};\n\nexport type ChangedProperty<S> = {\n type: 'CHANGED';\n oldValue: S;\n newValue: S;\n};\n\nexport type ContentChangedProperty<S> = {\n type: 'CONTENT_CHANGED';\n value: S;\n};\n\nexport type DeletedProperty<T> = {\n type: 'DELETED';\n oldValue: T;\n};\n\nexport type UnchangedProperty<T> = {\n type: 'UNCHANGED';\n value: T;\n};\n\nexport type DifferenceDTO = {\n status: DifferenceStatus;\n differenceState: Difference;\n errorMessage?: string;\n defaultLastModifiedDateString: string;\n};\n\nexport type DifferenceFetchState = Modify<\n DifferenceDTO,\n 'status',\n DifferenceStatus | null\n> & { isLoading: boolean; currentDifferenceId: string };\n"],"names":["RiScStatus","ProcessingStatus","ContentStatus","DifferenceStatus"],"mappings":"AAoOO,IAAK,UAAA,qBAAAA,WAAAA,KAAL;AACL,EAAAA,YAAA,OAAA,CAAA,GAAQ,OAAA;AACR,EAAAA,YAAA,WAAA,CAAA,GAAY,WAAA;AACZ,EAAAA,YAAA,iBAAA,CAAA,GAAkB,iBAAA;AAClB,EAAAA,YAAA,eAAA,CAAA,GAAgB,eAAA;AAChB,EAAAA,YAAA,yBAAA,CAAA,GAA0B,yBAAA;AALhB,EAAA,OAAAA,WAAAA;AAAA,CAAA,EAAA,UAAA,IAAA,EAAA;AAQL,IAAK,gBAAA,qBAAAC,iBAAAA,KAAL;AACL,EAAAA,kBAAA,cAAA,CAAA,GAAe,cAAA;AACf,EAAAA,kBAAA,kBAAA,CAAA,GAAmB,kBAAA;AACnB,EAAAA,kBAAA,sBAAA,CAAA,GAAuB,sBAAA;AACvB,EAAAA,kBAAA,aAAA,CAAA,GAAc,aAAA;AACd,EAAAA,kBAAA,aAAA,CAAA,GAAc,aAAA;AACd,EAAAA,kBAAA,6BAAA,CAAA,GAA8B,6BAAA;AAC9B,EAAAA,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BAAA,CAAA,GAAyB,wBAAA;AARf,EAAA,OAAAA,cAAAA;AAAA,CAAA,EAAA,aAAA,IAAA,EAAA;AAWL,IAAK,gBAAA,qBAAAC,iBAAAA,KAAL;AACL,EAAAA,kBAAA,SAAA,CAAA,GAAU,SAAA;AACV,EAAAA,kBAAA,oBAAA,CAAA,GAAqB,oBAAA;AACrB,EAAAA,kBAAA,kBAAA,CAAA,GAAmB,kBAAA;AAHT,EAAA,OAAAA,iBAAAA;AAAA,CAAA,EAAA,gBAAA,IAAA,EAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"types.esm.js","sources":["../../src/utils/types.ts"],"sourcesContent":["import type { Dispatch } from 'react';\nimport { ActionsDTO, ScenarioDTO, SopsConfigDTO } from './DTOs';\nimport { ActionStatusOptions } from './constants';\n\n/**\n * Modify one key on an object type. Modify takes 3 type arguments. First one takes the original type you want to modify. Second is the specific key you want to modify. Third is the new type for that key.\n * @template {object} O Which object type to use as basis\n * @template {string} K Key of field in object to modify\n * @template R New type to set field of key to\n */\nexport type Modify<O, K extends keyof any, R> = Omit<O, K> & { [P in K]: R };\n\n/** Type of the setter from `useState` */\nexport type SetState<T extends any> = Dispatch<React.SetStateAction<T>>;\n\nexport type LastPublished = {\n dateTime: Date;\n numberOfCommits: number;\n};\n\nexport type LockedRiSc = {\n id: string;\n encryptionKeyId: string | null;\n};\n\nexport type SystemRiSc = {\n sourceFilePath: string;\n riScId: string;\n appliesTo: string[];\n lastSavedAt: string;\n};\n\nexport type RiScWithMetadata = {\n id: string;\n status: RiScStatus;\n content: RiSc;\n sopsConfig: SopsConfigDTO;\n isRequiresNewApproval?: boolean;\n pullRequestUrl?: string;\n schemaVersion?: string;\n migrationStatus?: MigrationStatus;\n lastPublished?: LastPublished;\n};\n\nexport type DefaultRiScTypeDescriptor = {\n id: string;\n listName: string;\n listDescription: string;\n defaultTitle: string;\n defaultScope: string;\n numberOfScenarios: number | null;\n numberOfActions: number | null;\n preferredBackstageComponentType: string | null;\n priorityIndex: number | null;\n};\n\nexport type MigrationStatus = {\n migrationChanges: boolean;\n migrationRequiresNewApproval: boolean;\n migrationVersions?: MigrationVersions;\n migrationChanges40?: MigrationChanges40;\n migrationChanges41?: MigrationChanges41;\n migrationChanges42?: MigrationChanges42;\n migrationChanges50?: MigrationChanges50;\n migrationChanges51?: MigrationChanges51;\n migrationChanges52?: MigrationChanges52;\n};\n\nexport type MigrationVersions = {\n fromVersion: string;\n toVersion: string;\n};\n\nexport type MigrationChanges52 = {\n removedValuationsCount?: number;\n};\n\nexport type MigrationChanges51 = {\n scenarios: MigrationChanges51Scenario[];\n};\n\nexport type MigrationChanges51Scenario = {\n title: string;\n id: string;\n changedActions: MigrationChanges51Action[];\n};\n\nexport type MigrationChanges51Action = {\n title: string;\n id: string;\n lastUpdatedBy?: string | null;\n};\n\nexport type MigrationChanges50 = {\n scenarios: MigrationChanges50Scenario[];\n};\n\nexport type MigrationChanges50Scenario = {\n title: string;\n id: string;\n changedActions: MigrationChanges50Action[];\n};\n\nexport type MigrationChanges50Action = {\n title: string;\n id: string;\n changedActionStatus: MigrationChangedTypedValue<\n ActionStatusOptionsV4,\n ActionStatusOptions\n >;\n};\n\nexport type MigrationChanges42 = {\n scenarios: MigrationChanges42Scenario[];\n};\n\nexport type MigrationChanges42Scenario = {\n title: string;\n id: string;\n changedActions: MigrationChanges42Action[];\n};\n\nexport type MigrationChanges42Action = {\n title: string;\n id: string;\n lastUpdated?: Date | null;\n};\n\nexport type MigrationChanges41 = {\n scenarios: MigrationChanges41Scenario[];\n};\n\nexport type MigrationChanges41Scenario = {\n title: string;\n id: string;\n changedRiskConsequence?: MigrationChangedValue<number>;\n changedRiskProbability?: MigrationChangedValue<number>;\n changedRemainingRiskConsequence?: MigrationChangedValue<number>;\n changedRemainingRiskProbability?: MigrationChangedValue<number>;\n};\n\nexport type MigrationChanges40 = {\n scenarios: MigrationChanges40Scenario[];\n};\n\nexport type MigrationChanges40Scenario = {\n title: string;\n id: string;\n removedExistingActions?: string;\n changedVulnerabilities: MigrationChangedValue<string>[];\n changedActions: MigrationChanges40Action[];\n};\n\nexport type MigrationChanges40Action = {\n title: string;\n id: string;\n removedOwner?: string;\n removedDeadline?: string;\n};\n\nexport type MigrationChangedValue<T> = {\n oldValue: T;\n newValue: T;\n};\n\nexport type MigrationChangedTypedValue<S, T> = {\n oldValue: S;\n newValue: T;\n};\n\nexport type RiSc = {\n schemaVersion: string;\n title: string;\n scope: string;\n unencryptedMetadata?: UnencryptedMetadata;\n scenarios: Scenario[];\n};\n\nexport type UnencryptedMetadata = {\n appliesTo?: string[];\n};\n\n// The Valuations concept was removed in PR #850 and the remaining code referencing it can be removed when old schema migration code including to v4 is removed.\ntype Valuations = {\n description: string;\n confidentiality: string;\n integrity: string;\n availability: string;\n};\n\nexport type Scenario = {\n ID: string;\n title: string;\n url?: string;\n description: string;\n threatActors: string[];\n vulnerabilities: string[];\n risk: Risk;\n remainingRisk: Risk;\n actions: Action[];\n};\n\nexport type Risk = {\n summary: string;\n probability: number;\n consequence: number;\n};\n\nexport type Action = {\n ID: string;\n title: string;\n description: string;\n status: string;\n url: string;\n lastUpdated?: Date | null;\n lastUpdatedBy?: string | null;\n};\n\nexport type GithubRepoInfo = {\n name: string;\n owner: string;\n};\n\nexport type SubmitResponseObject = {\n status: ProcessingStatus;\n statusMessage: string;\n};\n\nexport enum RiScStatus {\n Draft = 'Draft',\n Published = 'Published',\n SentForApproval = 'SentForApproval',\n DeletionDraft = 'DeletionDraft',\n DeletionSentForApproval = 'DeletionSentForApproval',\n}\n\nexport enum ProcessingStatus {\n RiScNotValid = 'RiScNotValid',\n EncryptionFailed = 'EncryptionFailed',\n CouldNotCreateBranch = 'CouldNotCreateBranch',\n UpdatedRiSc = 'UpdatedRiSc',\n DeletedRiSc = 'DeletedRiSc',\n DeletedRiScRequiresApproval = 'DeletedRiScRequiresApproval',\n UpdatedSops = 'UpdatedSops',\n UpdatedRiScRequiresNewApproval = 'UpdatedRiScRequiresNewApproval',\n UpdatedRiScAndCreatedPullRequest = 'UpdatedRiScAndCreatedPullRequest',\n CreatedRiSc = 'CreatedRiSc',\n OpenedPullRequest = 'OpenedPullRequest',\n CreatedPullRequest = 'CreatedPullRequest',\n ErrorWhenCreatingRiSc = 'ErrorWhenCreatingRiSc',\n ErrorWhenUpdatingRiSc = 'ErrorWhenUpdatingRiSc',\n ErrorWhenUpdatingDeletedRiSc = 'ErrorWhenUpdatingDeletedRiSc',\n ErrorWhenDeletingRiSc = 'ErrorWhenDeletingRiSc',\n ErrorWhenPublishingRiSc = 'ErrorWhenPublishingRiSc',\n ErrorWhenNoWriteAccessToRepository = 'ErrorWhenNoWriteAccessToRepository',\n ErrorWhenFetchingRiScs = 'ErrorWhenFetchingRiScs',\n ErrorWhenCreatingPullRequest = 'ErrorWhenCreatingPullRequest',\n ErrorWhenFetchingGcpCryptoKeys = 'ErrorWhenFetchingGcpCryptoKeys',\n FailedToFetchGcpProjectIds = 'Failed to fetch GCP project IDs',\n InvalidGitHubAccessToken = 'InvalidGitHubAccessToken',\n}\n\nexport enum ContentStatus {\n Success = 'Success',\n Deleted = 'Deleted',\n Failure = 'Failure',\n FileNotFound = 'FileNotFound',\n DecryptionFailed = 'DecryptionFailed',\n NoReadAccess = 'NoReadAccess',\n UnsupportedMigration = 'UnsupportedMigration',\n SchemaValidationFailed = 'SchemaValidationFailed',\n}\n\nexport enum DifferenceStatus {\n Success = 'Success',\n GithubFileNotFound = 'GithubFileNotFound',\n FrontendFallback = 'FrontendFallback',\n}\n\nexport enum ActionStatusOptionsV4 {\n NotStarted = 'Not started',\n InProgress = 'In progress',\n OnHold = 'On hold',\n Completed = 'Completed',\n Aborted = 'Aborted',\n}\n\ntype FormRisk = Modify<\n Modify<Risk, 'probability', string>,\n 'consequence',\n string\n>;\n\nexport type FormScenario = Modify<\n Modify<Scenario, 'risk', FormRisk>,\n 'remainingRisk',\n FormRisk\n>;\n\nexport type Difference = {\n type: '4.*';\n migrationChanges: MigrationStatus;\n title?: SimpleTrackedProperty<string>;\n scope?: SimpleTrackedProperty<string>;\n appliesTo?: SimpleTrackedProperty<string>[];\n valuations: SimpleTrackedProperty<Valuations>[];\n scenarios: TrackedProperty<ScenarioChange, ScenarioDTO>[];\n};\n\nexport type ScenarioChange = {\n title: SimpleTrackedProperty<string>;\n id: string;\n description: SimpleTrackedProperty<string>;\n url?: SimpleTrackedProperty<string | null>;\n threatActors: SimpleTrackedProperty<string>[];\n vulnerabilities: SimpleTrackedProperty<string>[];\n risk: SimpleTrackedProperty<ScenarioRiskChange>;\n remainingRisk: SimpleTrackedProperty<ScenarioRiskChange>;\n actions: TrackedProperty<ActionChange, ActionsDTO>[];\n};\n\nexport type ActionChange = {\n title: SimpleTrackedProperty<string>;\n // The id will never change\n id: string;\n description: SimpleTrackedProperty<string>;\n url?: SimpleTrackedProperty<string | null>;\n status?: SimpleTrackedProperty<string>;\n lastUpdated?: SimpleTrackedProperty<Date | null>;\n lastUpdatedBy?: SimpleTrackedProperty<string | null>;\n};\n\nexport type ScenarioRiskChange = {\n summary?: SimpleTrackedProperty<string | null>;\n probability: SimpleTrackedProperty<number>;\n consequence: SimpleTrackedProperty<number>;\n};\n\nexport type SimpleTrackedProperty<T> = TrackedProperty<T, T>;\n\nexport type TrackedProperty<S, T> =\n | AddedProperty<T>\n | ChangedProperty<S>\n | ContentChangedProperty<S>\n | DeletedProperty<T>\n | UnchangedProperty<T>;\n\nexport type AddedProperty<T> = {\n type: 'ADDED';\n newValue: T;\n};\n\nexport type ChangedProperty<S> = {\n type: 'CHANGED';\n oldValue: S;\n newValue: S;\n};\n\nexport type ContentChangedProperty<S> = {\n type: 'CONTENT_CHANGED';\n value: S;\n};\n\nexport type DeletedProperty<T> = {\n type: 'DELETED';\n oldValue: T;\n};\n\nexport type UnchangedProperty<T> = {\n type: 'UNCHANGED';\n value: T;\n};\n\nexport type DifferenceDTO = {\n status: DifferenceStatus;\n differenceState: Difference;\n errorMessage?: string;\n defaultLastModifiedDateString: string;\n};\n\nexport type DifferenceFetchState = Modify<\n DifferenceDTO,\n 'status',\n DifferenceStatus | null\n> & { isLoading: boolean; currentDifferenceId: string };\n"],"names":["RiScStatus","ProcessingStatus","ContentStatus","DifferenceStatus"],"mappings":"AAoOO,IAAK,UAAA,qBAAAA,WAAAA,KAAL;AACL,EAAAA,YAAA,OAAA,CAAA,GAAQ,OAAA;AACR,EAAAA,YAAA,WAAA,CAAA,GAAY,WAAA;AACZ,EAAAA,YAAA,iBAAA,CAAA,GAAkB,iBAAA;AAClB,EAAAA,YAAA,eAAA,CAAA,GAAgB,eAAA;AAChB,EAAAA,YAAA,yBAAA,CAAA,GAA0B,yBAAA;AALhB,EAAA,OAAAA,WAAAA;AAAA,CAAA,EAAA,UAAA,IAAA,EAAA;AAQL,IAAK,gBAAA,qBAAAC,iBAAAA,KAAL;AACL,EAAAA,kBAAA,cAAA,CAAA,GAAe,cAAA;AACf,EAAAA,kBAAA,kBAAA,CAAA,GAAmB,kBAAA;AACnB,EAAAA,kBAAA,sBAAA,CAAA,GAAuB,sBAAA;AACvB,EAAAA,kBAAA,aAAA,CAAA,GAAc,aAAA;AACd,EAAAA,kBAAA,aAAA,CAAA,GAAc,aAAA;AACd,EAAAA,kBAAA,6BAAA,CAAA,GAA8B,6BAAA;AAC9B,EAAAA,kBAAA,aAAA,CAAA,GAAc,aAAA;AACd,EAAAA,kBAAA,gCAAA,CAAA,GAAiC,gCAAA;AACjC,EAAAA,kBAAA,kCAAA,CAAA,GAAmC,kCAAA;AACnC,EAAAA,kBAAA,aAAA,CAAA,GAAc,aAAA;AACd,EAAAA,kBAAA,mBAAA,CAAA,GAAoB,mBAAA;AACpB,EAAAA,kBAAA,oBAAA,CAAA,GAAqB,oBAAA;AACrB,EAAAA,kBAAA,uBAAA,CAAA,GAAwB,uBAAA;AACxB,EAAAA,kBAAA,uBAAA,CAAA,GAAwB,uBAAA;AACxB,EAAAA,kBAAA,8BAAA,CAAA,GAA+B,8BAAA;AAC/B,EAAAA,kBAAA,uB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