@oneuptime/common 14.0.10 → 14.0.11
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/Models/DatabaseModels/AIConversation.ts +127 -1
- package/Models/DatabaseModels/CephCluster.ts +12 -0
- package/Models/DatabaseModels/CloudResource.ts +12 -0
- package/Models/DatabaseModels/DatabaseServer.ts +12 -0
- package/Models/DatabaseModels/DockerHost.ts +12 -0
- package/Models/DatabaseModels/DockerSwarmCluster.ts +12 -0
- package/Models/DatabaseModels/GlobalOidc.ts +0 -4
- package/Models/DatabaseModels/GlobalOidcProject.ts +0 -4
- package/Models/DatabaseModels/GlobalSso.ts +0 -4
- package/Models/DatabaseModels/GlobalSsoProject.ts +0 -4
- package/Models/DatabaseModels/Host.ts +12 -0
- package/Models/DatabaseModels/IncidentForm.ts +594 -0
- package/Models/DatabaseModels/IncidentFormSubmission.ts +283 -0
- package/Models/DatabaseModels/IncidentTemplate.ts +59 -0
- package/Models/DatabaseModels/Index.ts +14 -0
- package/Models/DatabaseModels/IoTFleet.ts +12 -0
- package/Models/DatabaseModels/KubernetesCluster.ts +12 -0
- package/Models/DatabaseModels/MessageQueue.ts +1102 -0
- package/Models/DatabaseModels/MessageQueueLabelRule.ts +553 -0
- package/Models/DatabaseModels/MessageQueueOwnerRule.ts +633 -0
- package/Models/DatabaseModels/MessageQueueOwnerTeam.ts +491 -0
- package/Models/DatabaseModels/MessageQueueOwnerUser.ts +490 -0
- package/Models/DatabaseModels/PodmanHost.ts +12 -0
- package/Models/DatabaseModels/Project.ts +59 -0
- package/Models/DatabaseModels/ProjectOidc.ts +0 -4
- package/Models/DatabaseModels/ProjectSso.ts +0 -4
- package/Models/DatabaseModels/ProxmoxCluster.ts +12 -0
- package/Models/DatabaseModels/RumApplication.ts +12 -0
- package/Models/DatabaseModels/ServerlessFunction.ts +12 -0
- package/Models/DatabaseModels/Service.ts +12 -0
- package/Models/DatabaseModels/StatusPageOidc.ts +0 -4
- package/Models/DatabaseModels/StatusPageSso.ts +0 -4
- package/Models/DatabaseModels/TeamComplianceSetting.ts +47 -2
- package/Models/DatabaseModels/VMwareVCenter.ts +12 -0
- package/Server/API/AIChatAPI.ts +13 -114
- package/Server/API/AIInvestigationAPI.ts +3 -3
- package/Server/API/AIInvestigationConversationAPI.ts +266 -0
- package/Server/API/IncidentFormAPI.ts +376 -0
- package/Server/API/ProjectOIDC.ts +16 -25
- package/Server/API/ProjectSSO.ts +16 -24
- package/Server/API/StatusPageAPI.ts +42 -77
- package/Server/Enterprise/EnterpriseEdition.ts +93 -28
- package/Server/Enterprise/EnterpriseFeature.ts +25 -3
- package/Server/Enterprise/EnterpriseLicenseSnapshot.ts +1 -1
- package/Server/Enterprise/EnterpriseServerModule.ts +4 -1
- package/Server/EnvironmentConfig.ts +1 -1
- package/Server/Infrastructure/Postgres/SchemaMigrations/1796400000000-AddIncidentForms.ts +129 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1796500000000-AddTeamComplianceRuleNotificationChannels.ts +52 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1796600000000-AddAIInvestigationConversationAndTimeLimits.ts +75 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1796700000000-AddMessageQueueTables.ts +477 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +8 -0
- package/Server/Middleware/IncidentFormRateLimit.ts +847 -0
- package/Server/Middleware/UserAuthorization.ts +16 -38
- package/Server/Services/AIService.ts +10 -13
- package/Server/Services/IncidentCustomFieldService.ts +112 -2
- package/Server/Services/IncidentEpisodeMemberService.ts +24 -4
- package/Server/Services/IncidentEpisodeService.ts +10 -1
- package/Server/Services/IncidentFormService.ts +1566 -0
- package/Server/Services/IncidentFormSubmissionService.ts +97 -0
- package/Server/Services/IncidentGroupingEngineService.ts +45 -8
- package/Server/Services/IncidentService.ts +123 -5
- package/Server/Services/IncidentTemplateService.ts +22 -0
- package/Server/Services/Index.ts +14 -0
- package/Server/Services/MessageQueueLabelRuleEngineService.ts +321 -0
- package/Server/Services/MessageQueueLabelRuleService.ts +14 -0
- package/Server/Services/MessageQueueOwnerRuleEngineService.ts +412 -0
- package/Server/Services/MessageQueueOwnerRuleService.ts +14 -0
- package/Server/Services/MessageQueueOwnerTeamService.ts +62 -0
- package/Server/Services/MessageQueueOwnerUserService.ts +62 -0
- package/Server/Services/MessageQueueService.ts +1463 -0
- package/Server/Services/OpenTelemetryIngestService.ts +37 -4
- package/Server/Services/ProjectService.ts +0 -59
- package/Server/Services/StatusPagePrivateUserService.ts +1 -4
- package/Server/Services/StatusPageService.ts +1 -51
- package/Server/Services/TeamComplianceSettingService.ts +163 -42
- package/Server/Services/UserNotificationRuleService.ts +8 -1
- package/Server/Services/WorkspaceNotificationSummaryService.ts +12 -3
- package/Server/Types/Database/Permissions/CreatePermission.ts +17 -3
- package/Server/Types/Database/Permissions/EditionPermission.ts +140 -38
- package/Server/Types/Database/Permissions/OwnerTableRegistry.ts +16 -0
- package/Server/Types/Database/Permissions/TablePermission.ts +3 -3
- package/Server/Types/Database/Permissions/UpdatePermission.ts +20 -6
- package/Server/Utils/AI/Chat/AgentContextCompactor.ts +200 -0
- package/Server/Utils/AI/Chat/ChatAgentRunner.ts +307 -48
- package/Server/Utils/AI/Chat/ChatRunCancellation.ts +156 -0
- package/Server/Utils/AI/Chat/ObservabilityAssistant.ts +78 -18
- package/Server/Utils/AI/Chat/ObservabilityChatPrompt.ts +1 -1
- package/Server/Utils/AI/Chat/ToolOutputPager.ts +322 -0
- package/Server/Utils/AI/ClusterAccess/KubectlInvestigationToolkit.ts +88 -30
- package/Server/Utils/AI/ClusterAccess/KubectlJobRunner.ts +13 -1
- package/Server/Utils/AI/CodeFix/CodeFixReadiness.ts +0 -32
- package/Server/Utils/AI/CodeFix/FixRunBudget.ts +27 -25
- package/Server/Utils/AI/Remediation/RemediationCommandTools.ts +7 -1
- package/Server/Utils/AI/Remediation/RemediationExecutionRunner.ts +34 -14
- package/Server/Utils/AI/ResourceAccess/InfrastructureInvestigationToolkit.ts +69 -24
- package/Server/Utils/AI/ResourceAccess/ResourceCommandJobRunner.ts +9 -0
- package/Server/Utils/AI/SRE/AIInvestigationEngine.ts +53 -10
- package/Server/Utils/AI/SRE/AlertInvestigationRunner.ts +27 -10
- package/Server/Utils/AI/SRE/IncidentInvestigationRunner.ts +27 -10
- package/Server/Utils/AI/SRE/InvestigationQueue.ts +16 -19
- package/Server/Utils/AI/SRE/InvestigationThread.ts +646 -0
- package/Server/Utils/AI/SRE/InvestigationThreadService.ts +715 -0
- package/Server/Utils/AI/Toolbox/Serializer.ts +10 -3
- package/Server/Utils/EditionEnforcement.ts +19 -202
- package/Server/Utils/LLM/LLMService.ts +259 -63
- package/Server/Utils/RelaxedScimTeamLocksReport.ts +245 -0
- package/Server/Utils/Rules/RuleRun/RuleRunRegistry.ts +25 -0
- package/Server/Utils/SameOriginRequest.ts +203 -0
- package/Server/Utils/TeamMember/ProjectLeaveResourceCleanup.ts +2 -0
- package/Server/Utils/Telemetry/EntityRegistry.ts +4 -1
- package/Server/Utils/Telemetry/MessageQueueDiscovery.ts +1402 -0
- package/Server/Utils/Telemetry/ResourceEntityFilter.ts +4 -1
- package/Server/Utils/VendorAssets.ts +3 -3
- package/Server/Utils/Workspace/MicrosoftTeams/Actions/Incident.ts +3 -1
- package/Server/Utils/Workspace/MicrosoftTeams/Actions/IncidentEpisode.ts +3 -1
- package/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.ts +10 -1
- package/Tests/App/Accounts/IncidentFormPage.test.tsx +2036 -0
- package/Tests/App/Accounts/IncidentFormServerMessages.test.ts +119 -0
- package/Tests/App/Accounts/IncidentFormUtils.test.ts +1157 -0
- package/Tests/App/Accounts/LoginPasskey.test.tsx +6 -4
- package/Tests/App/Accounts/LoginSso.test.tsx +724 -0
- package/Tests/App/AdminDashboard/AdminAuthenticationRequireSso.test.tsx +338 -0
- package/Tests/App/AdminDashboard/AdminAuthenticationSsoCardLocales.test.tsx +331 -0
- package/Tests/App/AdminDashboard/AdminEnterprisePluginPage.test.tsx +47 -33
- package/Tests/App/AdminDashboard/GlobalSsoOidcPages.test.tsx +1021 -0
- package/Tests/App/Dashboard/AffectedResourcesDisplay.test.tsx +876 -78
- package/Tests/App/Dashboard/AffectedResourcesSlo.test.tsx +20 -3
- package/Tests/App/Dashboard/CephProxmoxVMwareDocumentationCards.test.tsx +359 -0
- package/Tests/App/Dashboard/CephSetupGuide.test.ts +961 -0
- package/Tests/App/Dashboard/CloudDocumentationCard.test.tsx +381 -95
- package/Tests/App/Dashboard/CloudSetupGuide.test.ts +1463 -0
- package/Tests/App/Dashboard/ClusterAccessNotice.test.tsx +174 -12
- package/Tests/App/Dashboard/ContainerSetupGuideCards.test.tsx +345 -0
- package/Tests/App/Dashboard/CoreListEmptyStates.test.tsx +501 -0
- package/Tests/App/Dashboard/DashboardLazyPages.test.tsx +0 -1
- package/Tests/App/Dashboard/DatabaseDocumentationCard.test.tsx +400 -0
- package/Tests/App/Dashboard/DatabaseDocumentationMarkdown.test.ts +5 -0
- package/Tests/App/Dashboard/DatabaseSetupGuide.test.ts +1869 -0
- package/Tests/App/Dashboard/DatabaseTelemetryScope.test.ts +44 -0
- package/Tests/App/Dashboard/DatabaseTelemetryTabs.test.tsx +50 -9
- package/Tests/App/Dashboard/DockerSetupGuide.test.ts +899 -0
- package/Tests/App/Dashboard/DockerSwarmSetupGuide.test.ts +964 -0
- package/Tests/App/Dashboard/EnterpriseFeatureUpgrade.test.tsx +141 -7
- package/Tests/App/Dashboard/EnterprisePluginPage.test.tsx +52 -39
- package/Tests/App/Dashboard/EventOverviewPages.test.tsx +7 -1
- package/Tests/App/Dashboard/GettingStartedTaskRoutes.test.tsx +331 -0
- package/Tests/App/Dashboard/HomeOverviewStatsFirstRun.test.tsx +925 -0
- package/Tests/App/Dashboard/HostDocumentationCard.test.tsx +225 -0
- package/Tests/App/Dashboard/HostSetupGuide.test.ts +1183 -0
- package/Tests/App/Dashboard/IdentityEnterpriseShells.test.tsx +69 -45
- package/Tests/App/Dashboard/IncidentCreateTemplateCustomFieldSettings.test.tsx +745 -0
- package/Tests/App/Dashboard/IncidentCreateTemplateOwners.test.tsx +414 -0
- package/Tests/App/Dashboard/IncidentCustomFieldCreateSettingsForm.test.ts +1042 -0
- package/Tests/App/Dashboard/IncidentCustomFieldSettingsCard.test.tsx +1816 -0
- package/Tests/App/Dashboard/IncidentFormPlan.test.ts +89 -0
- package/Tests/App/Dashboard/IncidentFormShareLinkCard.test.tsx +846 -0
- package/Tests/App/Dashboard/IncidentFormsPages.test.tsx +1324 -0
- package/Tests/App/Dashboard/IncidentTemplateCustomFieldSettings.test.tsx +630 -0
- package/Tests/App/Dashboard/IncidentsSideMenu.test.tsx +13 -0
- package/Tests/App/Dashboard/IncomingEmailMonitorLinkVerifyHint.test.tsx +104 -0
- package/Tests/App/Dashboard/InvestigationConversation.test.tsx +1107 -0
- package/Tests/App/Dashboard/InvestigationConversationData.test.ts +546 -0
- package/Tests/App/Dashboard/InvestigationEvidenceList.test.tsx +170 -5
- package/Tests/App/Dashboard/InvestigationNotStarted.test.tsx +207 -2
- package/Tests/App/Dashboard/InvestigationPanel.test.tsx +729 -34
- package/Tests/App/Dashboard/InvestigationPanelStatus.test.tsx +9 -21
- package/Tests/App/Dashboard/InvestigationReportView.test.tsx +274 -37
- package/Tests/App/Dashboard/InvestigationStatusBadge.test.tsx +130 -0
- package/Tests/App/Dashboard/IoTDocumentationCard.test.tsx +218 -0
- package/Tests/App/Dashboard/IoTSetupGuide.test.ts +1124 -0
- package/Tests/App/Dashboard/KubernetesClusterAiAccessSettings.test.ts +20 -6
- package/Tests/App/Dashboard/KubernetesClusterAiDocumentationMarkdown.test.ts +107 -83
- package/Tests/App/Dashboard/KubernetesSetupGuide.test.ts +787 -0
- package/Tests/App/Dashboard/MessageQueueBreadcrumbs.test.tsx +228 -0
- package/Tests/App/Dashboard/MessageQueueBrokerHealth.test.tsx +1538 -0
- package/Tests/App/Dashboard/MessageQueueBrokerHealthMetricChart.test.tsx +969 -0
- package/Tests/App/Dashboard/MessageQueueBrokerHealthReads.test.ts +889 -0
- package/Tests/App/Dashboard/MessageQueueBrokerMetricsReach.test.ts +236 -0
- package/Tests/App/Dashboard/MessageQueueDocumentationCard.test.tsx +479 -0
- package/Tests/App/Dashboard/MessageQueueListPages.test.tsx +1232 -0
- package/Tests/App/Dashboard/MessageQueueMetricDescriptions.test.ts +244 -0
- package/Tests/App/Dashboard/MessageQueueMonitorLink.test.ts +952 -0
- package/Tests/App/Dashboard/MessageQueueMonitorLinkMonitorCreate.test.tsx +859 -0
- package/Tests/App/Dashboard/MessageQueueOverview.test.tsx +1773 -0
- package/Tests/App/Dashboard/MessageQueueOverviewPresentation.test.ts +196 -0
- package/Tests/App/Dashboard/MessageQueuePresentation.test.ts +799 -0
- package/Tests/App/Dashboard/MessageQueueProducersConsumers.test.tsx +680 -0
- package/Tests/App/Dashboard/MessageQueueRoutes.test.tsx +383 -0
- package/Tests/App/Dashboard/MessageQueueRulePages.test.tsx +278 -0
- package/Tests/App/Dashboard/MessageQueueSetupGuide.test.ts +2778 -0
- package/Tests/App/Dashboard/MessageQueueSideMenus.test.tsx +273 -0
- package/Tests/App/Dashboard/MessageQueueSpanPopulations.test.ts +930 -0
- package/Tests/App/Dashboard/MessageQueueSpanStore.ts +351 -0
- package/Tests/App/Dashboard/MessageQueueTelemetryScope.test.ts +375 -0
- package/Tests/App/Dashboard/MessageQueueTelemetryScopeTabs.test.tsx +668 -0
- package/Tests/App/Dashboard/MessageQueueViewPages.test.tsx +685 -0
- package/Tests/App/Dashboard/MonitorAndHomeNotOperationalMenus.test.tsx +342 -0
- package/Tests/App/Dashboard/MonitorCreateFirstRunDefaults.test.tsx +623 -0
- package/Tests/App/Dashboard/MonitorCreateFromMonitorBackedDevice.test.tsx +442 -0
- package/Tests/App/Dashboard/MonitorLogsPageViewSummary.test.tsx +814 -0
- package/Tests/App/Dashboard/MonitorSetupCardBodies.test.tsx +246 -0
- package/Tests/App/Dashboard/NavigationSearchKeywords.test.tsx +8 -0
- package/Tests/App/Dashboard/OnboardingSsoEmptyState.test.tsx +27 -12
- package/Tests/App/Dashboard/PlanGatedPage.test.tsx +292 -0
- package/Tests/App/Dashboard/PodmanSetupGuide.test.ts +948 -0
- package/Tests/App/Dashboard/ProductOrientation.test.tsx +5 -4
- package/Tests/App/Dashboard/ProductSettingsSectionCollapsed.test.tsx +266 -0
- package/Tests/App/Dashboard/ProxmoxSetupGuide.test.ts +1318 -0
- package/Tests/App/Dashboard/ResourceAiAgentAttentionServerParity.test.ts +555 -0
- package/Tests/App/Dashboard/ResourceAiAgentPage.test.tsx +298 -9
- package/Tests/App/Dashboard/ResourceAiAgentStatus.test.ts +453 -0
- package/Tests/App/Dashboard/ResourceArchiveSettings.test.tsx +16 -0
- package/Tests/App/Dashboard/ResourceConnectionGuideCard.test.tsx +444 -0
- package/Tests/App/Dashboard/ResourceConnectionGuideOverviewsInfra.test.tsx +798 -0
- package/Tests/App/Dashboard/ResourceConnectionGuideOverviewsPlatforms.test.tsx +717 -0
- package/Tests/App/Dashboard/ResourceConnectionGuides.test.ts +981 -0
- package/Tests/App/Dashboard/ResourceConnectionState.test.ts +132 -0
- package/Tests/App/Dashboard/RumDocumentationCard.test.tsx +293 -0
- package/Tests/App/Dashboard/RumSessionReplayRetentionSettings.test.tsx +467 -0
- package/Tests/App/Dashboard/RumSetupGuide.test.ts +758 -0
- package/Tests/App/Dashboard/ScheduledMaintenanceOverviewPage.test.tsx +25 -0
- package/Tests/App/Dashboard/ServerlessDocumentationCard.test.tsx +254 -0
- package/Tests/App/Dashboard/ServerlessSetupGuide.test.ts +1074 -0
- package/Tests/App/Dashboard/SetupGuide.test.ts +246 -0
- package/Tests/App/Dashboard/SetupGuideCard.test.tsx +756 -0
- package/Tests/App/Dashboard/SloListSideMenu.test.tsx +120 -0
- package/Tests/App/Dashboard/SsoPages.test.tsx +833 -0
- package/Tests/App/Dashboard/TelemetryDocumentation.test.tsx +253 -0
- package/Tests/App/Dashboard/TelemetryRetentionShells.test.tsx +730 -0
- package/Tests/App/Dashboard/VMwareSetupGuide.test.ts +1033 -0
- package/Tests/App/StatusPage/StatusPageSsoEmptyState.test.tsx +87 -7
- package/Tests/Models/DatabaseModels/DatabaseServerModels.test.ts +28 -9
- package/Tests/Models/DatabaseModels/IncidentFormModel.test.ts +1250 -0
- package/Tests/Models/DatabaseModels/MessageQueueModels.test.ts +1983 -0
- package/Tests/Models/DatabaseModels/StaticRuleCriteriaInheritance.test.ts +4 -2
- package/Tests/Models/DatabaseModels/TeamComplianceSettingModel.test.ts +190 -14
- package/Tests/Models/IncidentTemplateCustomFieldSettingsColumn.test.ts +291 -0
- package/Tests/Server/API/AIInvestigationConversationAPI.test.ts +412 -0
- package/Tests/Server/API/GlobalConfigLicense.test.ts +38 -9
- package/Tests/Server/API/IncidentFormAPI.test.ts +942 -0
- package/Tests/Server/API/IncidentFormPublicRoutes.test.ts +1653 -0
- package/Tests/Server/API/KubernetesClusterAiAccessAPI.test.ts +2 -1
- package/Tests/Server/API/{SsoProviderListingsEdition.test.ts → SsoProviderListings.test.ts} +164 -110
- package/Tests/Server/Enterprise/EnterpriseEdition.test.ts +76 -54
- package/Tests/Server/Enterprise/EnterpriseFeatureActive.test.ts +125 -42
- package/Tests/Server/Enterprise/EnterpriseLicenseSnapshot.test.ts +36 -10
- package/Tests/Server/Enterprise/EnterpriseModelFeatureMap.test.ts +51 -9
- package/Tests/Server/Enterprise/FakeEnterpriseModule.ts +13 -8
- package/Tests/Server/Enterprise/SsoInCommunityEdition.test.ts +540 -0
- package/Tests/Server/Infrastructure/Postgres/AddConfigurableRuleCriteriaMigration.test.ts +3 -0
- package/Tests/Server/Infrastructure/Postgres/AddIncidentFormsMigration.test.ts +438 -0
- package/Tests/Server/Infrastructure/Postgres/AddTeamComplianceRuleNotificationChannelsMigration.test.ts +255 -0
- package/Tests/Server/Infrastructure/Postgres/MessageQueueTablesMigration.test.ts +637 -0
- package/Tests/Server/Middleware/IncidentFormRateLimit.test.ts +1630 -0
- package/Tests/Server/Middleware/UserAuthorization.test.ts +16 -17
- package/Tests/Server/Middleware/UserAuthorizationSsoEnforcement.test.ts +544 -0
- package/Tests/Server/Services/AIServiceDailyBudget.test.ts +37 -8
- package/Tests/Server/Services/IncidentCreatedFeedTitle.test.ts +212 -0
- package/Tests/Server/Services/IncidentCustomFieldDeleteFormQuestions.test.ts +297 -0
- package/Tests/Server/Services/IncidentFormOwnersCreatedNotification.test.ts +497 -0
- package/Tests/Server/Services/IncidentFormPostgres.test.ts +958 -0
- package/Tests/Server/Services/IncidentFormPublicForm.test.ts +1260 -0
- package/Tests/Server/Services/IncidentFormPublicSubmission.test.ts +2520 -0
- package/Tests/Server/Services/IncidentFormRegistration.test.ts +159 -0
- package/Tests/Server/Services/IncidentFormService.test.ts +663 -0
- package/Tests/Server/Services/IncidentFormSubmissionService.test.ts +430 -0
- package/Tests/Server/Services/IncidentFormSubmissionTemplateBranch.test.ts +473 -0
- package/Tests/Server/Services/IncidentGroupingTemplateSubstitution.test.ts +81 -0
- package/Tests/Server/Services/IncidentTemplateCustomFieldSettings.test.ts +262 -0
- package/Tests/Server/Services/IncidentTemplateOwnersOnDeclare.test.ts +566 -0
- package/Tests/Server/Services/IncidentTitleMarkdownSinks.test.ts +640 -0
- package/Tests/Server/Services/LlmLogServiceTokenAggregateParams.test.ts +3 -3
- package/Tests/Server/Services/MessageQueueOwnerServices.test.ts +440 -0
- package/Tests/Server/Services/MessageQueueRegistries.test.ts +577 -0
- package/Tests/Server/Services/MessageQueueRuleEngines.test.ts +900 -0
- package/Tests/Server/Services/MessageQueueService.test.ts +2210 -0
- package/Tests/Server/Services/MessageQueueSqlPostgres.test.ts +1271 -0
- package/Tests/Server/Services/OpenTelemetryResourceRetentionMemo.test.ts +28 -1
- package/Tests/Server/Services/OpenTelemetryRetentionOverrideEdition.test.ts +474 -0
- package/Tests/Server/Services/OpenTelemetryServiceResolutionCache.test.ts +21 -0
- package/Tests/Server/Services/OwnerRowUniqueness.test.ts +3 -0
- package/Tests/Server/Services/ProjectServiceAuditLogLicense.test.ts +0 -1
- package/Tests/Server/Services/RuleRun/LabelRuleEnginesGroupBRun.test.ts +56 -6
- package/Tests/Server/Services/RuleRun/OwnerRuleEnginesGroupBRun.test.ts +30 -1
- package/Tests/Server/Services/SsoRequirementReads.test.ts +454 -0
- package/Tests/Server/Services/SsoRequirementWrites.test.ts +529 -0
- package/Tests/Server/Services/StaticRuleCriteriaRuntimeCoverage.test.ts +3 -3
- package/Tests/Server/Services/StatusPagePrivateUserInvitationPolicy.test.ts +107 -89
- package/Tests/Server/Services/TeamComplianceSettingPostgres.test.ts +1068 -176
- package/Tests/Server/Services/TeamComplianceSettingService.test.ts +1962 -200
- package/Tests/Server/Types/Database/Permissions/EditionPermission.test.ts +654 -297
- package/Tests/Server/Types/Database/Permissions/RetentionOverrideColumns.test.ts +784 -0
- package/Tests/Server/Types/Database/Permissions/SsoScalePlanGate.test.ts +418 -0
- package/Tests/Server/Utils/AI/AIAlertGating.test.ts +0 -1
- package/Tests/Server/Utils/AI/AIInvestigationEngineRunLimits.test.ts +136 -0
- package/Tests/Server/Utils/AI/AIInvestigationQueue.test.ts +15 -14
- package/Tests/Server/Utils/AI/AgentContextCompactor.test.ts +351 -0
- package/Tests/Server/Utils/AI/ChatAgentRunnerSharedThread.test.ts +842 -0
- package/Tests/Server/Utils/AI/ChatRunCancellation.test.ts +195 -0
- package/Tests/Server/Utils/AI/CodeFixReadiness.test.ts +10 -57
- package/Tests/Server/Utils/AI/FixRunBudget.test.ts +20 -24
- package/Tests/Server/Utils/AI/Insights/InvestigationQueueInsightSubject.test.ts +7 -30
- package/Tests/Server/Utils/AI/InvestigationClusterAccessWiring.test.ts +225 -29
- package/Tests/Server/Utils/AI/InvestigationInfrastructureAccessWiring.test.ts +266 -25
- package/Tests/Server/Utils/AI/InvestigationThread.test.ts +580 -0
- package/Tests/Server/Utils/AI/InvestigationThreadService.test.ts +801 -0
- package/Tests/Server/Utils/AI/KubectlInvestigationToolkit.test.ts +525 -43
- package/Tests/Server/Utils/AI/KubectlJobRunner.test.ts +4 -2
- package/Tests/Server/Utils/AI/LLMServiceUnreachableProvider.test.ts +435 -0
- package/Tests/Server/Utils/AI/ObservabilityAssistantLimits.test.ts +462 -0
- package/Tests/Server/Utils/AI/RemediationExecutionRunner.test.ts +14 -25
- package/Tests/Server/Utils/AI/RemediationExecutionRunnerResourceMode.test.ts +2 -0
- package/Tests/Server/Utils/AI/ResourceAccess/InfrastructureInvestigationToolkit.test.ts +297 -15
- package/Tests/Server/Utils/AI/ResourceAccess/ResourceCommandJobRunner.test.ts +10 -6
- package/Tests/Server/Utils/AI/ToolOutputPager.test.ts +382 -0
- package/Tests/Server/Utils/AI/ToolResultSerializer.test.ts +23 -4
- package/Tests/Server/Utils/AI/Toolbox/LogTools.test.ts +25 -6
- package/Tests/Server/Utils/AI/Toolbox/Serializer.test.ts +14 -3
- package/Tests/Server/Utils/EditionEnforcement.test.ts +107 -147
- package/Tests/Server/Utils/{CommunityEditionSsoReport.test.ts → RelaxedScimTeamLocksReport.test.ts} +212 -208
- package/Tests/Server/Utils/SameOriginRequest.test.ts +372 -0
- package/Tests/Server/Utils/Telemetry/EntityRegistry.test.ts +20 -0
- package/Tests/Server/Utils/Telemetry/MessageQueueDiscovery.test.ts +2590 -0
- package/Tests/Server/Utils/Telemetry/MessageQueueSpanQueryTwin.ts +246 -0
- package/Tests/Server/Utils/Telemetry/TelemetryEntity.test.ts +23 -0
- package/Tests/Types/AI/AIAgentRunLimits.test.ts +255 -0
- package/Tests/Types/Code/JsonSyntax.test.ts +1300 -0
- package/Tests/Types/CustomField/CustomFieldCreateSettings.test.ts +1113 -0
- package/Tests/Types/CustomField/CustomFieldMappingCatalog.test.ts +91 -0
- package/Tests/Types/CustomField/CustomFieldValueValidator.test.ts +30 -0
- package/Tests/Types/Incident/IncidentFormIpAllowlist.test.ts +227 -0
- package/Tests/Types/Incident/IncidentFormPublic.test.ts +1916 -0
- package/Tests/Types/MessageQueue/MessageQueueEntityKey.test.ts +916 -0
- package/Tests/Types/MessageQueue/MessageQueueIdentity.test.ts +567 -0
- package/Tests/Types/MessageQueue/MessageQueueManualIdentity.test.ts +686 -0
- package/Tests/Types/MessageQueue/MessageQueueMetricCatalog.test.ts +1726 -0
- package/Tests/Types/MessageQueue/MessageQueueMetricResolution.test.ts +1758 -0
- package/Tests/Types/MessageQueue/MessagingInstrumentationFixtures.test.ts +4686 -0
- package/Tests/Types/MessageQueue/MessagingSystem.test.ts +840 -0
- package/Tests/Types/MessageQueue/MessagingTelemetryFixtures.ts +3287 -0
- package/Tests/Types/MessageQueue/MessagingTelemetryResolver.test.ts +2966 -0
- package/Tests/Types/Monitor/MessageQueueAlertTemplates.test.ts +5401 -0
- package/Tests/Types/Monitor/MetricEngineFold.ts +154 -0
- package/Tests/Types/ResourceAiAgent/ResourceAiAccess.test.ts +5 -3
- package/Tests/Types/Team/ComplianceRule.test.ts +588 -37
- package/Tests/Types/Team/TeamComplianceStatus.test.ts +64 -11
- package/Tests/Types/XML.test.ts +51 -0
- package/Tests/UI/Components/CodeEditor/CodeEditor.test.tsx +2362 -0
- package/Tests/UI/Components/CodeEditor/CodeEditorCommands.test.ts +810 -0
- package/Tests/UI/Components/CodeEditor/CodeEditorHighlight.test.ts +338 -0
- package/Tests/UI/Components/CodeEditor/CodeEditorLanguages.test.ts +222 -0
- package/Tests/UI/Components/CodeEditor/CodeEditorStyles.test.ts +807 -0
- package/Tests/UI/Components/CodeEditor/NoMonaco.test.ts +245 -0
- package/Tests/UI/Components/CodeEditor/YamlEditor.test.tsx +729 -0
- package/Tests/UI/Components/CopyTextButton.test.tsx +76 -0
- package/Tests/UI/Components/EditionLabelLapseCopy.ts +51 -14
- package/Tests/UI/Components/EditionLabelLicenseStatus.test.tsx +131 -23
- package/Tests/UI/Components/ErrorMessageAction.test.tsx +142 -0
- package/Tests/UI/Components/FacetSidebarInScope.test.tsx +459 -0
- package/Tests/UI/Components/FacetValuesInScope.test.ts +270 -0
- package/Tests/UI/Components/Forms/FormFieldCodeEditors.test.tsx +294 -0
- package/Tests/UI/Components/Forms/FormFieldMarkdown.test.tsx +126 -0
- package/Tests/UI/Components/Forms/FormFieldYaml.test.tsx +22 -75
- package/Tests/UI/Components/Forms/ModelFormOnBeforeCreateMiscData.test.tsx +254 -0
- package/Tests/UI/Components/Icon.test.tsx +32 -0
- package/Tests/UI/Components/Input.test.tsx +31 -0
- package/Tests/UI/Components/LockedFilterChipScope.test.tsx +501 -0
- package/Tests/UI/Components/MarkdownConverters.test.ts +253 -1
- package/Tests/UI/Components/MarkdownEditor.test.tsx +2785 -2
- package/Tests/UI/Components/MarkdownEditorHistory.test.ts +243 -0
- package/Tests/UI/Components/MarkdownListEditing.test.ts +1118 -0
- package/Tests/UI/Components/MarkdownPaste.test.ts +1180 -0
- package/Tests/UI/Components/MarkdownViewerCopy.test.tsx +466 -0
- package/Tests/UI/Components/MarkdownVisualEditing.test.ts +1089 -0
- package/Tests/UI/Components/ModelTable/BaseModelTableEmptyStateAction.test.tsx +623 -0
- package/Tests/UI/Components/ResetObjectID.test.tsx +282 -0
- package/Tests/UI/Components/RuleCriteria/RuleCriteriaModelTable.test.tsx +3 -3
- package/Tests/UI/Components/Table/EmptyTableMessage.test.ts +439 -0
- package/Tests/UI/Components/Table/TableEmptyState.test.tsx +352 -0
- package/Tests/UI/Components/TableRowMobileTitles.test.tsx +78 -0
- package/Tests/UI/Components/TextArea.test.tsx +19 -0
- package/Tests/UI/Components/Workflow/ModelColumnEditor.render.test.tsx +12 -29
- package/Tests/UI/Components/fixtures/MarkdownPasteFixtures.ts +460 -0
- package/Tests/UI/EsbuildConfig.test.ts +115 -39
- package/Tests/UI/EsbuildEnterpriseAlias.test.ts +4 -4
- package/Tests/UI/Monitor/MonitorLogSummaryRender.test.tsx +377 -0
- package/Tests/UI/Utils/Breadcrumb/fixtures/RealBreadcrumbTrails.ts +81 -1
- package/Tests/UI/Utils/Breadcrumb/fixtures/RealRoutePatterns.ts +17 -0
- package/Tests/Utils/LabelRuleImportExport.test.ts +5 -0
- package/Tests/Utils/Markdown/DashboardMarkdownRenderer.ts +81 -0
- package/Tests/Utils/Markdown/UntrustedMarkdown.test.ts +1339 -0
- package/Tests/Utils/Monitor/MonitorLogSummaryUtil.test.ts +862 -0
- package/Types/AI/AIAgentRunLimits.ts +146 -0
- package/Types/Code/CodeType.ts +2 -0
- package/Types/Code/JsonSyntax.ts +923 -0
- package/Types/CustomField/CustomFieldCreateSettings.ts +549 -0
- package/Types/CustomField/CustomFieldMappingCatalog.ts +77 -0
- package/Types/CustomField/CustomFieldValueValidator.ts +10 -7
- package/Types/EnterpriseLicense/EnterpriseLicensePeriods.ts +1 -1
- package/Types/Icon/IconProp.ts +2 -0
- package/Types/Incident/IncidentFormIpAllowlist.ts +206 -0
- package/Types/Incident/IncidentFormPublic.ts +1145 -0
- package/Types/Kubernetes/KubernetesClusterAiAccess.ts +10 -3
- package/Types/MessageQueue/MessageQueueIdentity.ts +256 -0
- package/Types/MessageQueue/MessageQueueManualIdentity.ts +325 -0
- package/Types/MessageQueue/MessageQueueMetricCatalog.ts +1357 -0
- package/Types/MessageQueue/MessagingSystem.ts +518 -0
- package/Types/MessageQueue/MessagingTelemetryResolver.ts +2311 -0
- package/Types/Monitor/MessageQueueAlertTemplates.ts +2128 -0
- package/Types/Permission.ts +310 -0
- package/Types/ResourceAiAgent/ResourceAiAccess.ts +10 -4
- package/Types/Rules/RuleCriteriaFieldRegistry.ts +12 -0
- package/Types/Rules/RuleRun.ts +4 -0
- package/Types/Team/ComplianceNotificationChannel.ts +4 -3
- package/Types/Team/ComplianceRule.ts +71 -18
- package/Types/Team/ComplianceRuleType.ts +2 -2
- package/Types/Team/TeamComplianceStatus.ts +6 -2
- package/Types/Telemetry/EntityType.ts +16 -0
- package/Types/Telemetry/LockedFilterDetail.ts +22 -0
- package/Types/XML.ts +26 -0
- package/UI/Components/CodeEditor/CodeEditor.css +379 -0
- package/UI/Components/CodeEditor/CodeEditor.tsx +1128 -294
- package/UI/Components/CodeEditor/CodeEditorCommands.ts +774 -0
- package/UI/Components/CodeEditor/CodeEditorHighlight.ts +106 -0
- package/UI/Components/CodeEditor/CodeEditorLanguages.ts +164 -0
- package/UI/Components/CodeEditor/YamlEditor.tsx +28 -326
- package/UI/Components/CopyTextButton/CopyTextButton.tsx +5 -1
- package/UI/Components/CustomFields/CustomFieldModelFormFields.tsx +6 -25
- package/UI/Components/EditionLabel/EditionLabel.tsx +14 -13
- package/UI/Components/ErrorMessage/ErrorMessage.tsx +11 -1
- package/UI/Components/Forms/Fields/FormField.tsx +8 -0
- package/UI/Components/Forms/Types/Field.ts +8 -0
- package/UI/Components/Icon/Icon.tsx +18 -0
- package/UI/Components/Input/Input.tsx +11 -4
- package/UI/Components/LogsViewer/LogsViewer.tsx +4 -0
- package/UI/Components/LogsViewer/components/LogsFacetSidebar.tsx +21 -3
- package/UI/Components/Markdown.tsx/MarkdownConverters.ts +0 -0
- package/UI/Components/Markdown.tsx/MarkdownEditor.tsx +877 -79
- package/UI/Components/Markdown.tsx/MarkdownEditorHistory.ts +284 -0
- package/UI/Components/Markdown.tsx/MarkdownListEditing.ts +1362 -0
- package/UI/Components/Markdown.tsx/MarkdownPaste.ts +1326 -0
- package/UI/Components/Markdown.tsx/MarkdownViewer.tsx +106 -10
- package/UI/Components/Markdown.tsx/MarkdownVisualEditing.ts +1032 -0
- package/UI/Components/ModelTable/BaseModelTable.tsx +85 -7
- package/UI/Components/ResetObjectID/ResetObjectID.tsx +35 -9
- package/UI/Components/Table/EmptyTableMessage.ts +81 -0
- package/UI/Components/Table/Table.tsx +50 -21
- package/UI/Components/Table/TableRow.tsx +9 -1
- package/UI/Components/TelemetryViewer/FacetVisibility.ts +97 -2
- package/UI/Components/TelemetryViewer/TelemetryViewer.tsx +13 -0
- package/UI/Components/TelemetryViewer/components/LockedFilterChip.tsx +214 -7
- package/UI/Components/TelemetryViewer/components/TelemetryFacetSidebar.tsx +21 -3
- package/UI/Components/TextArea/TextArea.tsx +9 -2
- package/UI/Components/Workflow/ModelFieldPicker.tsx +10 -12
- package/UI/Styles/Theme.css +8 -0
- package/UI/esbuild-config.js +2 -32
- package/Utils/LabelRuleImportExport.ts +2 -0
- package/Utils/Markdown/UntrustedMarkdown.ts +1513 -0
- package/Utils/Monitor/IncomingEmailMonitorRequestUtil.ts +41 -0
- package/Utils/Monitor/MonitorLogSummaryUtil.ts +212 -0
- package/Utils/Telemetry/EntityKey.ts +48 -0
- package/build/dist/Models/DatabaseModels/AIConversation.js +125 -1
- package/build/dist/Models/DatabaseModels/AIConversation.js.map +1 -1
- package/build/dist/Models/DatabaseModels/CephCluster.js +12 -0
- package/build/dist/Models/DatabaseModels/CephCluster.js.map +1 -1
- package/build/dist/Models/DatabaseModels/CloudResource.js +12 -0
- package/build/dist/Models/DatabaseModels/CloudResource.js.map +1 -1
- package/build/dist/Models/DatabaseModels/DatabaseServer.js +12 -0
- package/build/dist/Models/DatabaseModels/DatabaseServer.js.map +1 -1
- package/build/dist/Models/DatabaseModels/DockerHost.js +12 -0
- package/build/dist/Models/DatabaseModels/DockerHost.js.map +1 -1
- package/build/dist/Models/DatabaseModels/DockerSwarmCluster.js +12 -0
- package/build/dist/Models/DatabaseModels/DockerSwarmCluster.js.map +1 -1
- package/build/dist/Models/DatabaseModels/GlobalOidc.js +0 -4
- package/build/dist/Models/DatabaseModels/GlobalOidc.js.map +1 -1
- package/build/dist/Models/DatabaseModels/GlobalOidcProject.js +0 -4
- package/build/dist/Models/DatabaseModels/GlobalOidcProject.js.map +1 -1
- package/build/dist/Models/DatabaseModels/GlobalSso.js +0 -4
- package/build/dist/Models/DatabaseModels/GlobalSso.js.map +1 -1
- package/build/dist/Models/DatabaseModels/GlobalSsoProject.js +0 -4
- package/build/dist/Models/DatabaseModels/GlobalSsoProject.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Host.js +12 -0
- package/build/dist/Models/DatabaseModels/Host.js.map +1 -1
- package/build/dist/Models/DatabaseModels/IncidentForm.js +605 -0
- package/build/dist/Models/DatabaseModels/IncidentForm.js.map +1 -0
- package/build/dist/Models/DatabaseModels/IncidentFormSubmission.js +299 -0
- package/build/dist/Models/DatabaseModels/IncidentFormSubmission.js.map +1 -0
- package/build/dist/Models/DatabaseModels/IncidentTemplate.js +60 -0
- package/build/dist/Models/DatabaseModels/IncidentTemplate.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Index.js +14 -0
- package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
- package/build/dist/Models/DatabaseModels/IoTFleet.js +12 -0
- package/build/dist/Models/DatabaseModels/IoTFleet.js.map +1 -1
- package/build/dist/Models/DatabaseModels/KubernetesCluster.js +12 -0
- package/build/dist/Models/DatabaseModels/KubernetesCluster.js.map +1 -1
- package/build/dist/Models/DatabaseModels/MessageQueue.js +1106 -0
- package/build/dist/Models/DatabaseModels/MessageQueue.js.map +1 -0
- package/build/dist/Models/DatabaseModels/MessageQueueLabelRule.js +562 -0
- package/build/dist/Models/DatabaseModels/MessageQueueLabelRule.js.map +1 -0
- package/build/dist/Models/DatabaseModels/MessageQueueOwnerRule.js +643 -0
- package/build/dist/Models/DatabaseModels/MessageQueueOwnerRule.js.map +1 -0
- package/build/dist/Models/DatabaseModels/MessageQueueOwnerTeam.js +506 -0
- package/build/dist/Models/DatabaseModels/MessageQueueOwnerTeam.js.map +1 -0
- package/build/dist/Models/DatabaseModels/MessageQueueOwnerUser.js +505 -0
- package/build/dist/Models/DatabaseModels/MessageQueueOwnerUser.js.map +1 -0
- package/build/dist/Models/DatabaseModels/PodmanHost.js +12 -0
- package/build/dist/Models/DatabaseModels/PodmanHost.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Project.js +61 -0
- package/build/dist/Models/DatabaseModels/Project.js.map +1 -1
- package/build/dist/Models/DatabaseModels/ProjectOidc.js +0 -4
- package/build/dist/Models/DatabaseModels/ProjectOidc.js.map +1 -1
- package/build/dist/Models/DatabaseModels/ProjectSso.js +0 -4
- package/build/dist/Models/DatabaseModels/ProjectSso.js.map +1 -1
- package/build/dist/Models/DatabaseModels/ProxmoxCluster.js +12 -0
- package/build/dist/Models/DatabaseModels/ProxmoxCluster.js.map +1 -1
- package/build/dist/Models/DatabaseModels/RumApplication.js +12 -0
- package/build/dist/Models/DatabaseModels/RumApplication.js.map +1 -1
- package/build/dist/Models/DatabaseModels/ServerlessFunction.js +12 -0
- package/build/dist/Models/DatabaseModels/ServerlessFunction.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Service.js +12 -0
- package/build/dist/Models/DatabaseModels/Service.js.map +1 -1
- package/build/dist/Models/DatabaseModels/StatusPageOidc.js +0 -4
- package/build/dist/Models/DatabaseModels/StatusPageOidc.js.map +1 -1
- package/build/dist/Models/DatabaseModels/StatusPageSso.js +0 -4
- package/build/dist/Models/DatabaseModels/StatusPageSso.js.map +1 -1
- package/build/dist/Models/DatabaseModels/TeamComplianceSetting.js +49 -3
- package/build/dist/Models/DatabaseModels/TeamComplianceSetting.js.map +1 -1
- package/build/dist/Models/DatabaseModels/VMwareVCenter.js +12 -0
- package/build/dist/Models/DatabaseModels/VMwareVCenter.js.map +1 -1
- package/build/dist/Server/API/AIChatAPI.js +9 -103
- package/build/dist/Server/API/AIChatAPI.js.map +1 -1
- package/build/dist/Server/API/AIInvestigationAPI.js +3 -3
- package/build/dist/Server/API/AIInvestigationAPI.js.map +1 -1
- package/build/dist/Server/API/AIInvestigationConversationAPI.js +162 -0
- package/build/dist/Server/API/AIInvestigationConversationAPI.js.map +1 -0
- package/build/dist/Server/API/IncidentFormAPI.js +245 -0
- package/build/dist/Server/API/IncidentFormAPI.js.map +1 -0
- package/build/dist/Server/API/ProjectOIDC.js +16 -24
- package/build/dist/Server/API/ProjectOIDC.js.map +1 -1
- package/build/dist/Server/API/ProjectSSO.js +16 -24
- package/build/dist/Server/API/ProjectSSO.js.map +1 -1
- package/build/dist/Server/API/StatusPageAPI.js +42 -75
- package/build/dist/Server/API/StatusPageAPI.js.map +1 -1
- package/build/dist/Server/Enterprise/EnterpriseEdition.js +79 -25
- package/build/dist/Server/Enterprise/EnterpriseEdition.js.map +1 -1
- package/build/dist/Server/Enterprise/EnterpriseFeature.js +24 -3
- package/build/dist/Server/Enterprise/EnterpriseFeature.js.map +1 -1
- package/build/dist/Server/Enterprise/EnterpriseLicenseSnapshot.js +1 -1
- package/build/dist/Server/Enterprise/EnterpriseServerModule.js.map +1 -1
- package/build/dist/Server/EnvironmentConfig.js +1 -1
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1796400000000-AddIncidentForms.js +63 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1796400000000-AddIncidentForms.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1796500000000-AddTeamComplianceRuleNotificationChannels.js +41 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1796500000000-AddTeamComplianceRuleNotificationChannels.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1796600000000-AddAIInvestigationConversationAndTimeLimits.js +40 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1796600000000-AddAIInvestigationConversationAndTimeLimits.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1796700000000-AddMessageQueueTables.js +183 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1796700000000-AddMessageQueueTables.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +8 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
- package/build/dist/Server/Middleware/IncidentFormRateLimit.js +559 -0
- package/build/dist/Server/Middleware/IncidentFormRateLimit.js.map +1 -0
- package/build/dist/Server/Middleware/UserAuthorization.js +11 -30
- package/build/dist/Server/Middleware/UserAuthorization.js.map +1 -1
- package/build/dist/Server/Services/AIService.js +10 -13
- package/build/dist/Server/Services/AIService.js.map +1 -1
- package/build/dist/Server/Services/IncidentCustomFieldService.js +83 -0
- package/build/dist/Server/Services/IncidentCustomFieldService.js.map +1 -1
- package/build/dist/Server/Services/IncidentEpisodeMemberService.js +8 -4
- package/build/dist/Server/Services/IncidentEpisodeMemberService.js.map +1 -1
- package/build/dist/Server/Services/IncidentEpisodeService.js +10 -1
- package/build/dist/Server/Services/IncidentEpisodeService.js.map +1 -1
- package/build/dist/Server/Services/IncidentFormService.js +1202 -0
- package/build/dist/Server/Services/IncidentFormService.js.map +1 -0
- package/build/dist/Server/Services/IncidentFormSubmissionService.js +91 -0
- package/build/dist/Server/Services/IncidentFormSubmissionService.js.map +1 -0
- package/build/dist/Server/Services/IncidentGroupingEngineService.js +20 -8
- package/build/dist/Server/Services/IncidentGroupingEngineService.js.map +1 -1
- package/build/dist/Server/Services/IncidentService.js +106 -4
- package/build/dist/Server/Services/IncidentService.js.map +1 -1
- package/build/dist/Server/Services/IncidentTemplateService.js +18 -0
- package/build/dist/Server/Services/IncidentTemplateService.js.map +1 -1
- package/build/dist/Server/Services/Index.js +14 -0
- package/build/dist/Server/Services/Index.js.map +1 -1
- package/build/dist/Server/Services/MessageQueueLabelRuleEngineService.js +262 -0
- package/build/dist/Server/Services/MessageQueueLabelRuleEngineService.js.map +1 -0
- package/build/dist/Server/Services/MessageQueueLabelRuleService.js +13 -0
- package/build/dist/Server/Services/MessageQueueLabelRuleService.js.map +1 -0
- package/build/dist/Server/Services/MessageQueueOwnerRuleEngineService.js +334 -0
- package/build/dist/Server/Services/MessageQueueOwnerRuleEngineService.js.map +1 -0
- package/build/dist/Server/Services/MessageQueueOwnerRuleService.js +13 -0
- package/build/dist/Server/Services/MessageQueueOwnerRuleService.js.map +1 -0
- package/build/dist/Server/Services/MessageQueueOwnerTeamService.js +62 -0
- package/build/dist/Server/Services/MessageQueueOwnerTeamService.js.map +1 -0
- package/build/dist/Server/Services/MessageQueueOwnerUserService.js +62 -0
- package/build/dist/Server/Services/MessageQueueOwnerUserService.js.map +1 -0
- package/build/dist/Server/Services/MessageQueueService.js +1140 -0
- package/build/dist/Server/Services/MessageQueueService.js.map +1 -0
- package/build/dist/Server/Services/OpenTelemetryIngestService.js +25 -4
- package/build/dist/Server/Services/OpenTelemetryIngestService.js.map +1 -1
- package/build/dist/Server/Services/ProjectService.js +0 -54
- package/build/dist/Server/Services/ProjectService.js.map +1 -1
- package/build/dist/Server/Services/StatusPagePrivateUserService.js +1 -4
- package/build/dist/Server/Services/StatusPagePrivateUserService.js.map +1 -1
- package/build/dist/Server/Services/StatusPageService.js +0 -46
- package/build/dist/Server/Services/StatusPageService.js.map +1 -1
- package/build/dist/Server/Services/TeamComplianceSettingService.js +120 -31
- package/build/dist/Server/Services/TeamComplianceSettingService.js.map +1 -1
- package/build/dist/Server/Services/UserNotificationRuleService.js +8 -1
- package/build/dist/Server/Services/UserNotificationRuleService.js.map +1 -1
- package/build/dist/Server/Services/WorkspaceNotificationSummaryService.js +12 -3
- package/build/dist/Server/Services/WorkspaceNotificationSummaryService.js.map +1 -1
- package/build/dist/Server/Types/Database/Permissions/CreatePermission.js +6 -3
- package/build/dist/Server/Types/Database/Permissions/CreatePermission.js.map +1 -1
- package/build/dist/Server/Types/Database/Permissions/EditionPermission.js +109 -37
- package/build/dist/Server/Types/Database/Permissions/EditionPermission.js.map +1 -1
- package/build/dist/Server/Types/Database/Permissions/OwnerTableRegistry.js +16 -0
- package/build/dist/Server/Types/Database/Permissions/OwnerTableRegistry.js.map +1 -1
- package/build/dist/Server/Types/Database/Permissions/TablePermission.js +3 -3
- package/build/dist/Server/Types/Database/Permissions/UpdatePermission.js +9 -6
- package/build/dist/Server/Types/Database/Permissions/UpdatePermission.js.map +1 -1
- package/build/dist/Server/Utils/AI/Chat/AgentContextCompactor.js +128 -0
- package/build/dist/Server/Utils/AI/Chat/AgentContextCompactor.js.map +1 -0
- package/build/dist/Server/Utils/AI/Chat/ChatAgentRunner.js +192 -50
- package/build/dist/Server/Utils/AI/Chat/ChatAgentRunner.js.map +1 -1
- package/build/dist/Server/Utils/AI/Chat/ChatRunCancellation.js +133 -0
- package/build/dist/Server/Utils/AI/Chat/ChatRunCancellation.js.map +1 -0
- package/build/dist/Server/Utils/AI/Chat/ObservabilityAssistant.js +53 -13
- package/build/dist/Server/Utils/AI/Chat/ObservabilityAssistant.js.map +1 -1
- package/build/dist/Server/Utils/AI/Chat/ObservabilityChatPrompt.js +1 -1
- package/build/dist/Server/Utils/AI/Chat/ToolOutputPager.js +206 -0
- package/build/dist/Server/Utils/AI/Chat/ToolOutputPager.js.map +1 -0
- package/build/dist/Server/Utils/AI/ClusterAccess/KubectlInvestigationToolkit.js +53 -26
- package/build/dist/Server/Utils/AI/ClusterAccess/KubectlInvestigationToolkit.js.map +1 -1
- package/build/dist/Server/Utils/AI/ClusterAccess/KubectlJobRunner.js +4 -2
- package/build/dist/Server/Utils/AI/ClusterAccess/KubectlJobRunner.js.map +1 -1
- package/build/dist/Server/Utils/AI/CodeFix/CodeFixReadiness.js +1 -29
- package/build/dist/Server/Utils/AI/CodeFix/CodeFixReadiness.js.map +1 -1
- package/build/dist/Server/Utils/AI/CodeFix/FixRunBudget.js +24 -24
- package/build/dist/Server/Utils/AI/CodeFix/FixRunBudget.js.map +1 -1
- package/build/dist/Server/Utils/AI/Remediation/RemediationCommandTools.js +7 -2
- package/build/dist/Server/Utils/AI/Remediation/RemediationCommandTools.js.map +1 -1
- package/build/dist/Server/Utils/AI/Remediation/RemediationExecutionRunner.js +29 -14
- package/build/dist/Server/Utils/AI/Remediation/RemediationExecutionRunner.js.map +1 -1
- package/build/dist/Server/Utils/AI/ResourceAccess/InfrastructureInvestigationToolkit.js +38 -14
- package/build/dist/Server/Utils/AI/ResourceAccess/InfrastructureInvestigationToolkit.js.map +1 -1
- package/build/dist/Server/Utils/AI/ResourceAccess/ResourceCommandJobRunner.js +2 -0
- package/build/dist/Server/Utils/AI/ResourceAccess/ResourceCommandJobRunner.js.map +1 -1
- package/build/dist/Server/Utils/AI/SRE/AIInvestigationEngine.js +40 -10
- package/build/dist/Server/Utils/AI/SRE/AIInvestigationEngine.js.map +1 -1
- package/build/dist/Server/Utils/AI/SRE/AlertInvestigationRunner.js +19 -7
- package/build/dist/Server/Utils/AI/SRE/AlertInvestigationRunner.js.map +1 -1
- package/build/dist/Server/Utils/AI/SRE/IncidentInvestigationRunner.js +19 -7
- package/build/dist/Server/Utils/AI/SRE/IncidentInvestigationRunner.js.map +1 -1
- package/build/dist/Server/Utils/AI/SRE/InvestigationQueue.js +15 -18
- package/build/dist/Server/Utils/AI/SRE/InvestigationQueue.js.map +1 -1
- package/build/dist/Server/Utils/AI/SRE/InvestigationThread.js +412 -0
- package/build/dist/Server/Utils/AI/SRE/InvestigationThread.js.map +1 -0
- package/build/dist/Server/Utils/AI/SRE/InvestigationThreadService.js +495 -0
- package/build/dist/Server/Utils/AI/SRE/InvestigationThreadService.js.map +1 -0
- package/build/dist/Server/Utils/AI/Toolbox/Serializer.js +10 -3
- package/build/dist/Server/Utils/AI/Toolbox/Serializer.js.map +1 -1
- package/build/dist/Server/Utils/EditionEnforcement.js +20 -158
- package/build/dist/Server/Utils/EditionEnforcement.js.map +1 -1
- package/build/dist/Server/Utils/LLM/LLMService.js +193 -54
- package/build/dist/Server/Utils/LLM/LLMService.js.map +1 -1
- package/build/dist/Server/Utils/RelaxedScimTeamLocksReport.js +160 -0
- package/build/dist/Server/Utils/RelaxedScimTeamLocksReport.js.map +1 -0
- package/build/dist/Server/Utils/Rules/RuleRun/RuleRunRegistry.js +25 -0
- package/build/dist/Server/Utils/Rules/RuleRun/RuleRunRegistry.js.map +1 -1
- package/build/dist/Server/Utils/SameOriginRequest.js +151 -0
- package/build/dist/Server/Utils/SameOriginRequest.js.map +1 -0
- package/build/dist/Server/Utils/TeamMember/ProjectLeaveResourceCleanup.js +2 -0
- package/build/dist/Server/Utils/TeamMember/ProjectLeaveResourceCleanup.js.map +1 -1
- package/build/dist/Server/Utils/Telemetry/EntityRegistry.js +4 -1
- package/build/dist/Server/Utils/Telemetry/EntityRegistry.js.map +1 -1
- package/build/dist/Server/Utils/Telemetry/MessageQueueDiscovery.js +1015 -0
- package/build/dist/Server/Utils/Telemetry/MessageQueueDiscovery.js.map +1 -0
- package/build/dist/Server/Utils/Telemetry/ResourceEntityFilter.js +4 -1
- package/build/dist/Server/Utils/Telemetry/ResourceEntityFilter.js.map +1 -1
- package/build/dist/Server/Utils/VendorAssets.js +3 -3
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Incident.js +3 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Incident.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/IncidentEpisode.js +3 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/IncidentEpisode.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js +10 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js.map +1 -1
- package/build/dist/Types/AI/AIAgentRunLimits.js +91 -0
- package/build/dist/Types/AI/AIAgentRunLimits.js.map +1 -0
- package/build/dist/Types/Code/CodeType.js +2 -0
- package/build/dist/Types/Code/CodeType.js.map +1 -1
- package/build/dist/Types/Code/JsonSyntax.js +604 -0
- package/build/dist/Types/Code/JsonSyntax.js.map +1 -0
- package/build/dist/Types/CustomField/CustomFieldCreateSettings.js +310 -0
- package/build/dist/Types/CustomField/CustomFieldCreateSettings.js.map +1 -0
- package/build/dist/Types/CustomField/CustomFieldMappingCatalog.js +38 -0
- package/build/dist/Types/CustomField/CustomFieldMappingCatalog.js.map +1 -1
- package/build/dist/Types/CustomField/CustomFieldValueValidator.js +10 -7
- package/build/dist/Types/CustomField/CustomFieldValueValidator.js.map +1 -1
- package/build/dist/Types/EnterpriseLicense/EnterpriseLicensePeriods.js +1 -1
- package/build/dist/Types/Icon/IconProp.js +2 -0
- package/build/dist/Types/Icon/IconProp.js.map +1 -1
- package/build/dist/Types/Incident/IncidentFormIpAllowlist.js +119 -0
- package/build/dist/Types/Incident/IncidentFormIpAllowlist.js.map +1 -0
- package/build/dist/Types/Incident/IncidentFormPublic.js +678 -0
- package/build/dist/Types/Incident/IncidentFormPublic.js.map +1 -0
- package/build/dist/Types/Kubernetes/KubernetesClusterAiAccess.js +10 -3
- package/build/dist/Types/Kubernetes/KubernetesClusterAiAccess.js.map +1 -1
- package/build/dist/Types/MessageQueue/MessageQueueIdentity.js +184 -0
- package/build/dist/Types/MessageQueue/MessageQueueIdentity.js.map +1 -0
- package/build/dist/Types/MessageQueue/MessageQueueManualIdentity.js +190 -0
- package/build/dist/Types/MessageQueue/MessageQueueManualIdentity.js.map +1 -0
- package/build/dist/Types/MessageQueue/MessageQueueMetricCatalog.js +1057 -0
- package/build/dist/Types/MessageQueue/MessageQueueMetricCatalog.js.map +1 -0
- package/build/dist/Types/MessageQueue/MessagingSystem.js +394 -0
- package/build/dist/Types/MessageQueue/MessagingSystem.js.map +1 -0
- package/build/dist/Types/MessageQueue/MessagingTelemetryResolver.js +1768 -0
- package/build/dist/Types/MessageQueue/MessagingTelemetryResolver.js.map +1 -0
- package/build/dist/Types/Monitor/MessageQueueAlertTemplates.js +1207 -0
- package/build/dist/Types/Monitor/MessageQueueAlertTemplates.js.map +1 -0
- package/build/dist/Types/Permission.js +274 -0
- package/build/dist/Types/Permission.js.map +1 -1
- package/build/dist/Types/ResourceAiAgent/ResourceAiAccess.js +10 -4
- package/build/dist/Types/ResourceAiAgent/ResourceAiAccess.js.map +1 -1
- package/build/dist/Types/Rules/RuleCriteriaFieldRegistry.js +12 -0
- package/build/dist/Types/Rules/RuleCriteriaFieldRegistry.js.map +1 -1
- package/build/dist/Types/Rules/RuleRun.js +4 -0
- package/build/dist/Types/Rules/RuleRun.js.map +1 -1
- package/build/dist/Types/Team/ComplianceNotificationChannel.js +4 -3
- package/build/dist/Types/Team/ComplianceNotificationChannel.js.map +1 -1
- package/build/dist/Types/Team/ComplianceRule.js +48 -14
- package/build/dist/Types/Team/ComplianceRule.js.map +1 -1
- package/build/dist/Types/Team/ComplianceRuleType.js +2 -2
- package/build/dist/Types/Telemetry/EntityType.js +16 -0
- package/build/dist/Types/Telemetry/EntityType.js.map +1 -1
- package/build/dist/Types/XML.js +23 -0
- package/build/dist/Types/XML.js.map +1 -1
- package/build/dist/UI/Components/CodeEditor/CodeEditor.js +641 -266
- package/build/dist/UI/Components/CodeEditor/CodeEditor.js.map +1 -1
- package/build/dist/UI/Components/CodeEditor/CodeEditorCommands.js +464 -0
- package/build/dist/UI/Components/CodeEditor/CodeEditorCommands.js.map +1 -0
- package/build/dist/UI/Components/CodeEditor/CodeEditorHighlight.js +69 -0
- package/build/dist/UI/Components/CodeEditor/CodeEditorHighlight.js.map +1 -0
- package/build/dist/UI/Components/CodeEditor/CodeEditorLanguages.js +108 -0
- package/build/dist/UI/Components/CodeEditor/CodeEditorLanguages.js.map +1 -0
- package/build/dist/UI/Components/CodeEditor/YamlEditor.js +14 -186
- package/build/dist/UI/Components/CodeEditor/YamlEditor.js.map +1 -1
- package/build/dist/UI/Components/CopyTextButton/CopyTextButton.js +5 -1
- package/build/dist/UI/Components/CopyTextButton/CopyTextButton.js.map +1 -1
- package/build/dist/UI/Components/CustomFields/CustomFieldModelFormFields.js +5 -14
- package/build/dist/UI/Components/CustomFields/CustomFieldModelFormFields.js.map +1 -1
- package/build/dist/UI/Components/EditionLabel/EditionLabel.js +14 -13
- package/build/dist/UI/Components/EditionLabel/EditionLabel.js.map +1 -1
- package/build/dist/UI/Components/ErrorMessage/ErrorMessage.js +1 -1
- package/build/dist/UI/Components/ErrorMessage/ErrorMessage.js.map +1 -1
- package/build/dist/UI/Components/Forms/Fields/FormField.js +8 -3
- package/build/dist/UI/Components/Forms/Fields/FormField.js.map +1 -1
- package/build/dist/UI/Components/Icon/Icon.js +8 -0
- package/build/dist/UI/Components/Icon/Icon.js.map +1 -1
- package/build/dist/UI/Components/Input/Input.js +11 -3
- package/build/dist/UI/Components/Input/Input.js.map +1 -1
- package/build/dist/UI/Components/LogsViewer/LogsViewer.js +2 -1
- package/build/dist/UI/Components/LogsViewer/LogsViewer.js.map +1 -1
- package/build/dist/UI/Components/LogsViewer/components/LogsFacetSidebar.js +14 -4
- package/build/dist/UI/Components/LogsViewer/components/LogsFacetSidebar.js.map +1 -1
- package/build/dist/UI/Components/Markdown.tsx/MarkdownConverters.js +0 -0
- package/build/dist/UI/Components/Markdown.tsx/MarkdownConverters.js.map +1 -1
- package/build/dist/UI/Components/Markdown.tsx/MarkdownEditor.js +710 -65
- package/build/dist/UI/Components/Markdown.tsx/MarkdownEditor.js.map +1 -1
- package/build/dist/UI/Components/Markdown.tsx/MarkdownEditorHistory.js +238 -0
- package/build/dist/UI/Components/Markdown.tsx/MarkdownEditorHistory.js.map +1 -0
- package/build/dist/UI/Components/Markdown.tsx/MarkdownListEditing.js +1028 -0
- package/build/dist/UI/Components/Markdown.tsx/MarkdownListEditing.js.map +1 -0
- package/build/dist/UI/Components/Markdown.tsx/MarkdownPaste.js +1088 -0
- package/build/dist/UI/Components/Markdown.tsx/MarkdownPaste.js.map +1 -0
- package/build/dist/UI/Components/Markdown.tsx/MarkdownViewer.js +70 -10
- package/build/dist/UI/Components/Markdown.tsx/MarkdownViewer.js.map +1 -1
- package/build/dist/UI/Components/Markdown.tsx/MarkdownVisualEditing.js +887 -0
- package/build/dist/UI/Components/Markdown.tsx/MarkdownVisualEditing.js.map +1 -0
- package/build/dist/UI/Components/ModelTable/BaseModelTable.js +57 -6
- package/build/dist/UI/Components/ModelTable/BaseModelTable.js.map +1 -1
- package/build/dist/UI/Components/ResetObjectID/ResetObjectID.js +7 -5
- package/build/dist/UI/Components/ResetObjectID/ResetObjectID.js.map +1 -1
- package/build/dist/UI/Components/Table/EmptyTableMessage.js +51 -0
- package/build/dist/UI/Components/Table/EmptyTableMessage.js.map +1 -0
- package/build/dist/UI/Components/Table/Table.js +30 -11
- package/build/dist/UI/Components/Table/Table.js.map +1 -1
- package/build/dist/UI/Components/Table/TableRow.js +9 -2
- package/build/dist/UI/Components/Table/TableRow.js.map +1 -1
- package/build/dist/UI/Components/TelemetryViewer/FacetVisibility.js +63 -1
- package/build/dist/UI/Components/TelemetryViewer/FacetVisibility.js.map +1 -1
- package/build/dist/UI/Components/TelemetryViewer/TelemetryViewer.js +4 -2
- package/build/dist/UI/Components/TelemetryViewer/TelemetryViewer.js.map +1 -1
- package/build/dist/UI/Components/TelemetryViewer/components/LockedFilterChip.js +91 -10
- package/build/dist/UI/Components/TelemetryViewer/components/LockedFilterChip.js.map +1 -1
- package/build/dist/UI/Components/TelemetryViewer/components/TelemetryFacetSidebar.js +14 -4
- package/build/dist/UI/Components/TelemetryViewer/components/TelemetryFacetSidebar.js.map +1 -1
- package/build/dist/UI/Components/TextArea/TextArea.js +9 -3
- package/build/dist/UI/Components/TextArea/TextArea.js.map +1 -1
- package/build/dist/UI/Components/Workflow/ModelFieldPicker.js +1 -2
- package/build/dist/UI/Components/Workflow/ModelFieldPicker.js.map +1 -1
- package/build/dist/Utils/LabelRuleImportExport.js +2 -0
- package/build/dist/Utils/LabelRuleImportExport.js.map +1 -1
- package/build/dist/Utils/Markdown/UntrustedMarkdown.js +988 -0
- package/build/dist/Utils/Markdown/UntrustedMarkdown.js.map +1 -0
- package/build/dist/Utils/Monitor/IncomingEmailMonitorRequestUtil.js +34 -0
- package/build/dist/Utils/Monitor/IncomingEmailMonitorRequestUtil.js.map +1 -0
- package/build/dist/Utils/Monitor/MonitorLogSummaryUtil.js +148 -0
- package/build/dist/Utils/Monitor/MonitorLogSummaryUtil.js.map +1 -0
- package/build/dist/Utils/Telemetry/EntityKey.js +36 -0
- package/build/dist/Utils/Telemetry/EntityKey.js.map +1 -1
- package/package.json +1 -3
- package/Server/Utils/CommunityEditionSsoReport.ts +0 -361
- package/Tests/App/Accounts/LoginSsoEdition.test.tsx +0 -616
- package/Tests/App/AdminDashboard/AdminAuthenticationSsoEdition.test.tsx +0 -217
- package/Tests/App/AdminDashboard/GlobalSSOEnterpriseShells.test.tsx +0 -271
- package/Tests/App/Dashboard/CloudDocumentationMarkdown.test.ts +0 -215
- package/Tests/App/Dashboard/TelemetryResourceRetentionSettings.test.tsx +0 -784
- package/Tests/Server/Middleware/UserAuthorizationEditionEnforcement.test.ts +0 -518
- package/Tests/Server/Services/SsoRequirementReadMasking.test.ts +0 -419
- package/Tests/Server/Services/SsoRequirementWriteGuard.test.ts +0 -769
- package/Tests/UI/Components/CodeEditor.test.tsx +0 -638
- package/Tests/UI/Components/MonacoLoader.test.ts +0 -67
- package/Tests/UI/Components/MonacoRuntime.test.ts +0 -121
- package/Tests/UI/Components/Telemetry/TelemetryRetentionConfigForm.test.tsx +0 -329
- package/Tests/UI/Components/YamlEditor.test.tsx +0 -847
- package/UI/Components/CodeEditor/MonacoLoader.ts +0 -36
- package/UI/Components/Telemetry/TelemetryRetentionConfigForm.tsx +0 -319
- package/UI/Components/Telemetry/TelemetryRetentionConfigSummary.tsx +0 -223
- package/build/dist/Server/Utils/CommunityEditionSsoReport.js +0 -223
- package/build/dist/Server/Utils/CommunityEditionSsoReport.js.map +0 -1
- package/build/dist/UI/Components/CodeEditor/MonacoLoader.js +0 -34
- package/build/dist/UI/Components/CodeEditor/MonacoLoader.js.map +0 -1
- package/build/dist/UI/Components/Telemetry/TelemetryRetentionConfigForm.js +0 -171
- package/build/dist/UI/Components/Telemetry/TelemetryRetentionConfigForm.js.map +0 -1
- package/build/dist/UI/Components/Telemetry/TelemetryRetentionConfigSummary.js +0 -119
- package/build/dist/UI/Components/Telemetry/TelemetryRetentionConfigSummary.js.map +0 -1
|
@@ -0,0 +1,1113 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CUSTOM_FIELD_CREATE_SETTINGS,
|
|
3
|
+
CUSTOM_FIELD_CREATE_SETTINGS_MAX_ENTRIES,
|
|
4
|
+
CustomFieldCreateSetting,
|
|
5
|
+
CustomFieldCreateSettings,
|
|
6
|
+
applyTemplateCustomFieldCreateSettings,
|
|
7
|
+
compactCustomFieldCreateSettings,
|
|
8
|
+
getCustomFieldCreateSetting,
|
|
9
|
+
getEffectiveCustomFieldCreateSetting,
|
|
10
|
+
getIncidentFormAskedDefinitions,
|
|
11
|
+
getIncidentFormCustomFieldSetting,
|
|
12
|
+
isCustomFieldCreateSetting,
|
|
13
|
+
readCustomFieldCreateSettings,
|
|
14
|
+
validateCustomFieldCreateSettings,
|
|
15
|
+
} from "../../../Types/CustomField/CustomFieldCreateSettings";
|
|
16
|
+
import { sortCustomFieldDefinitions } from "../../../Types/CustomField/CustomFieldOrder";
|
|
17
|
+
import CustomFieldType from "../../../Types/CustomField/CustomFieldType";
|
|
18
|
+
import { CUSTOM_FIELD_VARIABLE_KEY_MAX_LENGTH } from "../../../Types/CustomField/CustomFieldVariableKey";
|
|
19
|
+
import { LIMIT_PER_PROJECT } from "../../../Types/Database/LimitMax";
|
|
20
|
+
import { describe, expect, test } from "@jest/globals";
|
|
21
|
+
import fs from "fs";
|
|
22
|
+
import path from "path";
|
|
23
|
+
|
|
24
|
+
/*
|
|
25
|
+
* A template's (or a form's) say over which incident custom fields are asked
|
|
26
|
+
* when an incident is declared, and which must be filled in (issue #4114).
|
|
27
|
+
*
|
|
28
|
+
* What matters most here:
|
|
29
|
+
*
|
|
30
|
+
* - the server refuses a malformed value and never rewrites a good one
|
|
31
|
+
* (Terraform compares the column with its configuration);
|
|
32
|
+
* - a TEMPLATE only overrides: Default and unlisted fields keep their own
|
|
33
|
+
* Show on Create / Required on Create;
|
|
34
|
+
* - a FORM only asks what it lists as Required or Optional - never a field
|
|
35
|
+
* because of its project-wide switches, since the form is public;
|
|
36
|
+
* - nothing here changes the definitions it is handed.
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
interface Definition {
|
|
40
|
+
name: string;
|
|
41
|
+
variableKey?: string | null | undefined;
|
|
42
|
+
showOnCreate?: boolean | null | undefined;
|
|
43
|
+
isRequiredOnCreate?: boolean | null | undefined;
|
|
44
|
+
sortOrder?: number | null | undefined;
|
|
45
|
+
customFieldType?: CustomFieldType | undefined;
|
|
46
|
+
description?: string | undefined;
|
|
47
|
+
dropdownOptions?: string | undefined;
|
|
48
|
+
mapFromResourceType?: string | undefined;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
type DefinitionFunction = (
|
|
52
|
+
name: string,
|
|
53
|
+
variableKey: string | null | undefined,
|
|
54
|
+
switches?: {
|
|
55
|
+
showOnCreate?: boolean | null | undefined;
|
|
56
|
+
isRequiredOnCreate?: boolean | null | undefined;
|
|
57
|
+
sortOrder?: number | null | undefined;
|
|
58
|
+
},
|
|
59
|
+
) => Definition;
|
|
60
|
+
|
|
61
|
+
const definition: DefinitionFunction = (
|
|
62
|
+
name: string,
|
|
63
|
+
variableKey: string | null | undefined,
|
|
64
|
+
switches: {
|
|
65
|
+
showOnCreate?: boolean | null | undefined;
|
|
66
|
+
isRequiredOnCreate?: boolean | null | undefined;
|
|
67
|
+
sortOrder?: number | null | undefined;
|
|
68
|
+
} = {},
|
|
69
|
+
): Definition => {
|
|
70
|
+
return {
|
|
71
|
+
name: name,
|
|
72
|
+
variableKey: variableKey,
|
|
73
|
+
customFieldType: CustomFieldType.Text,
|
|
74
|
+
...switches,
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
// The project's fields, one of each project-wide behaviour.
|
|
79
|
+
type ProjectFieldsFunction = () => Array<Definition>;
|
|
80
|
+
|
|
81
|
+
const projectFields: ProjectFieldsFunction = (): Array<Definition> => {
|
|
82
|
+
return [
|
|
83
|
+
definition("Impact", "impact", {
|
|
84
|
+
showOnCreate: true,
|
|
85
|
+
isRequiredOnCreate: true,
|
|
86
|
+
sortOrder: 1,
|
|
87
|
+
}),
|
|
88
|
+
definition("Affected Location", "affected_location", {
|
|
89
|
+
showOnCreate: true,
|
|
90
|
+
isRequiredOnCreate: false,
|
|
91
|
+
sortOrder: 2,
|
|
92
|
+
}),
|
|
93
|
+
definition("Additional Information", "additional_information", {
|
|
94
|
+
showOnCreate: false,
|
|
95
|
+
isRequiredOnCreate: false,
|
|
96
|
+
sortOrder: 3,
|
|
97
|
+
}),
|
|
98
|
+
definition("Customer", "customer", {}),
|
|
99
|
+
];
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
type DeepFreezeFunction = <T>(value: T) => T;
|
|
103
|
+
|
|
104
|
+
// Frozen inputs make any write to them throw (modules run in strict mode).
|
|
105
|
+
const deepFreeze: DeepFreezeFunction = <T>(value: T): T => {
|
|
106
|
+
if (value && typeof value === "object") {
|
|
107
|
+
for (const child of Object.values(
|
|
108
|
+
value as unknown as Record<string, unknown>,
|
|
109
|
+
)) {
|
|
110
|
+
deepFreeze(child);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
Object.freeze(value);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return value;
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
type NamesFunction = (definitions: Array<{ name: string }>) => Array<string>;
|
|
120
|
+
|
|
121
|
+
const names: NamesFunction = (
|
|
122
|
+
definitions: Array<{ name: string }>,
|
|
123
|
+
): Array<string> => {
|
|
124
|
+
return definitions.map((entry: { name: string }): string => {
|
|
125
|
+
return entry.name;
|
|
126
|
+
});
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
type SwitchesFunction = (definitions: Array<Definition>) => Array<{
|
|
130
|
+
name: string;
|
|
131
|
+
showOnCreate: boolean | null | undefined;
|
|
132
|
+
isRequiredOnCreate: boolean | null | undefined;
|
|
133
|
+
}>;
|
|
134
|
+
|
|
135
|
+
const switchesOf: SwitchesFunction = (
|
|
136
|
+
definitions: Array<Definition>,
|
|
137
|
+
): Array<{
|
|
138
|
+
name: string;
|
|
139
|
+
showOnCreate: boolean | null | undefined;
|
|
140
|
+
isRequiredOnCreate: boolean | null | undefined;
|
|
141
|
+
}> => {
|
|
142
|
+
return definitions.map(
|
|
143
|
+
(
|
|
144
|
+
entry: Definition,
|
|
145
|
+
): {
|
|
146
|
+
name: string;
|
|
147
|
+
showOnCreate: boolean | null | undefined;
|
|
148
|
+
isRequiredOnCreate: boolean | null | undefined;
|
|
149
|
+
} => {
|
|
150
|
+
return {
|
|
151
|
+
name: entry.name,
|
|
152
|
+
showOnCreate: entry.showOnCreate,
|
|
153
|
+
isRequiredOnCreate: entry.isRequiredOnCreate,
|
|
154
|
+
};
|
|
155
|
+
},
|
|
156
|
+
);
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
const NOT_SETTINGS: Array<[string, unknown]> = [
|
|
160
|
+
["an array", ["impact"]],
|
|
161
|
+
["an empty array", []],
|
|
162
|
+
["a JSON string", '{"impact":"Required"}'],
|
|
163
|
+
["a string", "Required"],
|
|
164
|
+
["a number", 5],
|
|
165
|
+
["true", true],
|
|
166
|
+
["false", false],
|
|
167
|
+
["a date", new Date("2026-01-01T00:00:00.000Z")],
|
|
168
|
+
];
|
|
169
|
+
|
|
170
|
+
describe("CustomFieldCreateSetting", () => {
|
|
171
|
+
test("stores the four settings under these exact strings", () => {
|
|
172
|
+
/*
|
|
173
|
+
* They are what the JSON column holds and what API, MCP and Terraform
|
|
174
|
+
* users write: renaming one would strand every stored value.
|
|
175
|
+
*/
|
|
176
|
+
expect(CustomFieldCreateSetting.Default).toBe("Default");
|
|
177
|
+
expect(CustomFieldCreateSetting.Required).toBe("Required");
|
|
178
|
+
expect(CustomFieldCreateSetting.Optional).toBe("Optional");
|
|
179
|
+
expect(CustomFieldCreateSetting.Hidden).toBe("Hidden");
|
|
180
|
+
expect(Object.values(CustomFieldCreateSetting)).toHaveLength(4);
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
test("lists every setting once, Default first, for a picker", () => {
|
|
184
|
+
expect(CUSTOM_FIELD_CREATE_SETTINGS).toEqual([
|
|
185
|
+
CustomFieldCreateSetting.Default,
|
|
186
|
+
CustomFieldCreateSetting.Required,
|
|
187
|
+
CustomFieldCreateSetting.Optional,
|
|
188
|
+
CustomFieldCreateSetting.Hidden,
|
|
189
|
+
]);
|
|
190
|
+
expect([...CUSTOM_FIELD_CREATE_SETTINGS].sort()).toEqual(
|
|
191
|
+
Object.values(CustomFieldCreateSetting).sort(),
|
|
192
|
+
);
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
test("allows one entry per field a project can hold", () => {
|
|
196
|
+
expect(CUSTOM_FIELD_CREATE_SETTINGS_MAX_ENTRIES).toBe(LIMIT_PER_PROJECT);
|
|
197
|
+
expect(CUSTOM_FIELD_CREATE_SETTINGS_MAX_ENTRIES).toBe(10000);
|
|
198
|
+
});
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
describe("isCustomFieldCreateSetting", () => {
|
|
202
|
+
test.each(Object.values(CustomFieldCreateSetting))(
|
|
203
|
+
"%s is a setting",
|
|
204
|
+
(setting: string) => {
|
|
205
|
+
expect(isCustomFieldCreateSetting(setting)).toBe(true);
|
|
206
|
+
},
|
|
207
|
+
);
|
|
208
|
+
|
|
209
|
+
test.each([
|
|
210
|
+
"required",
|
|
211
|
+
"REQUIRED",
|
|
212
|
+
" Required",
|
|
213
|
+
"Required ",
|
|
214
|
+
"optional",
|
|
215
|
+
"hidden",
|
|
216
|
+
"default",
|
|
217
|
+
"",
|
|
218
|
+
"NotAsked",
|
|
219
|
+
"Not Asked",
|
|
220
|
+
"Shown",
|
|
221
|
+
])("%j is not: only the exact spelling is stored", (value: string) => {
|
|
222
|
+
expect(isCustomFieldCreateSetting(value)).toBe(false);
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
test.each([[null], [undefined], [1], [true], [{}], [["Required"]]])(
|
|
226
|
+
"%j is not a setting",
|
|
227
|
+
(value: unknown) => {
|
|
228
|
+
expect(isCustomFieldCreateSetting(value)).toBe(false);
|
|
229
|
+
},
|
|
230
|
+
);
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
describe("validateCustomFieldCreateSettings: what the API accepts", () => {
|
|
234
|
+
test("no value at all is fine: it clears the settings", () => {
|
|
235
|
+
expect(validateCustomFieldCreateSettings(null)).toBeNull();
|
|
236
|
+
expect(validateCustomFieldCreateSettings(undefined)).toBeNull();
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
test("an empty object is fine: every field is Default", () => {
|
|
240
|
+
expect(validateCustomFieldCreateSettings({})).toBeNull();
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
test("every setting, on valid keys, is fine", () => {
|
|
244
|
+
expect(
|
|
245
|
+
validateCustomFieldCreateSettings({
|
|
246
|
+
impact: "Required",
|
|
247
|
+
affected_location: "Optional",
|
|
248
|
+
additional_information: "Hidden",
|
|
249
|
+
customer: "Default",
|
|
250
|
+
"2fa_status": "Required",
|
|
251
|
+
severity_2: "Optional",
|
|
252
|
+
}),
|
|
253
|
+
).toBeNull();
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
test("a key as long as a template variable key may be is fine; one longer is not", () => {
|
|
257
|
+
const longest: string = "a".repeat(CUSTOM_FIELD_VARIABLE_KEY_MAX_LENGTH);
|
|
258
|
+
const tooLong: string = "a".repeat(
|
|
259
|
+
CUSTOM_FIELD_VARIABLE_KEY_MAX_LENGTH + 1,
|
|
260
|
+
);
|
|
261
|
+
|
|
262
|
+
expect(validateCustomFieldCreateSettings({ [longest]: "Required" })).toBe(
|
|
263
|
+
null,
|
|
264
|
+
);
|
|
265
|
+
expect(
|
|
266
|
+
validateCustomFieldCreateSettings({ [tooLong]: "Required" }),
|
|
267
|
+
).toContain("is not an incident custom field's template variable key");
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
/*
|
|
271
|
+
* A field named "Constructor" is given the key "constructor", which is a
|
|
272
|
+
* perfectly good key - and one that plain-object lookups trip over.
|
|
273
|
+
*/
|
|
274
|
+
test.each(["constructor", "hasownproperty", "prototype", "valueof"])(
|
|
275
|
+
"the key %j is a valid key like any other",
|
|
276
|
+
(key: string) => {
|
|
277
|
+
expect(validateCustomFieldCreateSettings({ [key]: "Hidden" })).toBeNull();
|
|
278
|
+
},
|
|
279
|
+
);
|
|
280
|
+
|
|
281
|
+
test.each([
|
|
282
|
+
["Impact", "uppercase"],
|
|
283
|
+
["affected location", "a space"],
|
|
284
|
+
["affected-location", "a hyphen"],
|
|
285
|
+
["_impact", "a leading underscore"],
|
|
286
|
+
["impact_", "a trailing underscore"],
|
|
287
|
+
["impact__level", "a doubled underscore"],
|
|
288
|
+
["customFields.impact", "the template placeholder"],
|
|
289
|
+
["{{customFields.impact}}", "a whole placeholder"],
|
|
290
|
+
["", "nothing"],
|
|
291
|
+
["__proto__", "the prototype key"],
|
|
292
|
+
["ímpact", "an accent"],
|
|
293
|
+
["影响", "another script"],
|
|
294
|
+
])(
|
|
295
|
+
"refuses the key %j (%s): it is not a template variable key",
|
|
296
|
+
(key: string) => {
|
|
297
|
+
const message: string | null = validateCustomFieldCreateSettings(
|
|
298
|
+
JSON.parse(JSON.stringify({ [key]: "Required" })),
|
|
299
|
+
);
|
|
300
|
+
|
|
301
|
+
expect(message).toContain(`"${key}"`);
|
|
302
|
+
expect(message).toContain(
|
|
303
|
+
"is not an incident custom field's template variable key",
|
|
304
|
+
);
|
|
305
|
+
expect(message).toContain('"affected_location"');
|
|
306
|
+
},
|
|
307
|
+
);
|
|
308
|
+
|
|
309
|
+
test.each([
|
|
310
|
+
["required"],
|
|
311
|
+
["REQUIRED"],
|
|
312
|
+
[" Required"],
|
|
313
|
+
["Mandatory"],
|
|
314
|
+
["Not Asked"],
|
|
315
|
+
[""],
|
|
316
|
+
[null],
|
|
317
|
+
[true],
|
|
318
|
+
[1],
|
|
319
|
+
[{}],
|
|
320
|
+
[["Required"]],
|
|
321
|
+
])(
|
|
322
|
+
"refuses the setting %j: only Required, Optional, Hidden or Default",
|
|
323
|
+
(setting: unknown) => {
|
|
324
|
+
const message: string | null = validateCustomFieldCreateSettings({
|
|
325
|
+
impact: setting,
|
|
326
|
+
});
|
|
327
|
+
|
|
328
|
+
expect(message).toContain('The setting for "impact"');
|
|
329
|
+
expect(message).toContain(
|
|
330
|
+
"must be Required, Optional, Hidden or Default",
|
|
331
|
+
);
|
|
332
|
+
expect(message).toContain(`but was sent "`);
|
|
333
|
+
},
|
|
334
|
+
);
|
|
335
|
+
|
|
336
|
+
test.each(NOT_SETTINGS)(
|
|
337
|
+
"refuses %s: the settings are an object keyed by template variable key",
|
|
338
|
+
(_label: string, value: unknown) => {
|
|
339
|
+
const message: string | null = validateCustomFieldCreateSettings(value);
|
|
340
|
+
|
|
341
|
+
expect(message).toContain(
|
|
342
|
+
"Custom Field Settings must be an object that maps each incident custom field's template variable key to Required, Optional, Hidden or Default",
|
|
343
|
+
);
|
|
344
|
+
expect(message).toContain('{"impact": "Required"}');
|
|
345
|
+
},
|
|
346
|
+
);
|
|
347
|
+
|
|
348
|
+
test("reports every problem at once, bounded to five", () => {
|
|
349
|
+
const five: string | null = validateCustomFieldCreateSettings({
|
|
350
|
+
a: "x1",
|
|
351
|
+
b: "x2",
|
|
352
|
+
c: "x3",
|
|
353
|
+
d: "x4",
|
|
354
|
+
e: "x5",
|
|
355
|
+
});
|
|
356
|
+
|
|
357
|
+
for (const value of ["x1", "x2", "x3", "x4", "x5"]) {
|
|
358
|
+
expect(five).toContain(`"${value}"`);
|
|
359
|
+
}
|
|
360
|
+
expect(five).not.toContain("not valid either");
|
|
361
|
+
|
|
362
|
+
const six: string | null = validateCustomFieldCreateSettings({
|
|
363
|
+
a: "x1",
|
|
364
|
+
b: "x2",
|
|
365
|
+
c: "x3",
|
|
366
|
+
d: "x4",
|
|
367
|
+
e: "x5",
|
|
368
|
+
f: "x6",
|
|
369
|
+
});
|
|
370
|
+
|
|
371
|
+
expect(six).not.toContain('"x6"');
|
|
372
|
+
expect(six).toContain("1 more entry is not valid either.");
|
|
373
|
+
|
|
374
|
+
const seven: string | null = validateCustomFieldCreateSettings({
|
|
375
|
+
a: "x1",
|
|
376
|
+
b: "x2",
|
|
377
|
+
c: "x3",
|
|
378
|
+
d: "x4",
|
|
379
|
+
e: "x5",
|
|
380
|
+
f: "x6",
|
|
381
|
+
g: "x7",
|
|
382
|
+
});
|
|
383
|
+
|
|
384
|
+
expect(seven).toContain("2 more entries are not valid either.");
|
|
385
|
+
});
|
|
386
|
+
|
|
387
|
+
test("valid entries next to invalid ones are not mentioned", () => {
|
|
388
|
+
const message: string | null = validateCustomFieldCreateSettings({
|
|
389
|
+
impact: "Required",
|
|
390
|
+
customer: "Sometimes",
|
|
391
|
+
});
|
|
392
|
+
|
|
393
|
+
expect(message).toContain('"customer"');
|
|
394
|
+
expect(message).not.toContain('"impact"');
|
|
395
|
+
});
|
|
396
|
+
|
|
397
|
+
test("quotes a pasted essay back cut short", () => {
|
|
398
|
+
const essay: string = "x".repeat(500);
|
|
399
|
+
|
|
400
|
+
const message: string = validateCustomFieldCreateSettings({
|
|
401
|
+
impact: essay,
|
|
402
|
+
})!;
|
|
403
|
+
|
|
404
|
+
expect(message).toContain(`"${"x".repeat(80)}..."`);
|
|
405
|
+
expect(message).not.toContain("x".repeat(81));
|
|
406
|
+
});
|
|
407
|
+
|
|
408
|
+
test("never throws on values JSON cannot quote", () => {
|
|
409
|
+
const circular: Record<string, unknown> = {};
|
|
410
|
+
circular["self"] = circular;
|
|
411
|
+
|
|
412
|
+
expect(validateCustomFieldCreateSettings({ impact: circular })).toContain(
|
|
413
|
+
'The setting for "impact"',
|
|
414
|
+
);
|
|
415
|
+
expect(validateCustomFieldCreateSettings({ impact: BigInt(10) })).toContain(
|
|
416
|
+
'but was sent "10"',
|
|
417
|
+
);
|
|
418
|
+
expect(
|
|
419
|
+
validateCustomFieldCreateSettings({ impact: Symbol("x") }),
|
|
420
|
+
).toContain('but was sent "Symbol(x)"');
|
|
421
|
+
expect(validateCustomFieldCreateSettings({ impact: undefined })).toContain(
|
|
422
|
+
'but was sent "undefined"',
|
|
423
|
+
);
|
|
424
|
+
});
|
|
425
|
+
|
|
426
|
+
test("a settings object with one entry per possible field is fine; one more is not", () => {
|
|
427
|
+
const full: Record<string, string> = {};
|
|
428
|
+
|
|
429
|
+
for (let index: number = 0; index < LIMIT_PER_PROJECT; index++) {
|
|
430
|
+
full[`field_${index}`] = "Optional";
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
expect(validateCustomFieldCreateSettings(full)).toBeNull();
|
|
434
|
+
|
|
435
|
+
full[`field_${LIMIT_PER_PROJECT}`] = "Optional";
|
|
436
|
+
|
|
437
|
+
expect(validateCustomFieldCreateSettings(full)).toBe(
|
|
438
|
+
`Custom Field Settings can list at most ${LIMIT_PER_PROJECT} fields, but lists ${
|
|
439
|
+
LIMIT_PER_PROJECT + 1
|
|
440
|
+
}.`,
|
|
441
|
+
);
|
|
442
|
+
});
|
|
443
|
+
|
|
444
|
+
test("judges without rewriting: the value is left exactly as it was sent", () => {
|
|
445
|
+
const sent: Record<string, unknown> = deepFreeze({
|
|
446
|
+
impact: "Required",
|
|
447
|
+
customer: "Default",
|
|
448
|
+
Broken: "nope",
|
|
449
|
+
});
|
|
450
|
+
const before: string = JSON.stringify(sent);
|
|
451
|
+
|
|
452
|
+
expect(validateCustomFieldCreateSettings(sent)).not.toBeNull();
|
|
453
|
+
expect(JSON.stringify(sent)).toBe(before);
|
|
454
|
+
});
|
|
455
|
+
|
|
456
|
+
test("an inherited key is not an entry", () => {
|
|
457
|
+
const inherited: Record<string, unknown> = Object.create({
|
|
458
|
+
Impact: "Mandatory",
|
|
459
|
+
}) as Record<string, unknown>;
|
|
460
|
+
|
|
461
|
+
expect(validateCustomFieldCreateSettings(inherited)).toBeNull();
|
|
462
|
+
});
|
|
463
|
+
});
|
|
464
|
+
|
|
465
|
+
describe("readCustomFieldCreateSettings: the lenient reader", () => {
|
|
466
|
+
test.each([["null", null], ["undefined", undefined], ...NOT_SETTINGS])(
|
|
467
|
+
"reads %s as no settings",
|
|
468
|
+
(_label: string, value: unknown) => {
|
|
469
|
+
expect(readCustomFieldCreateSettings(value)).toEqual({});
|
|
470
|
+
},
|
|
471
|
+
);
|
|
472
|
+
|
|
473
|
+
test("keeps every valid entry, Default included, and drops the rest", () => {
|
|
474
|
+
expect(
|
|
475
|
+
readCustomFieldCreateSettings({
|
|
476
|
+
impact: "Required",
|
|
477
|
+
affected_location: "Optional",
|
|
478
|
+
additional_information: "Hidden",
|
|
479
|
+
customer: "Default",
|
|
480
|
+
Broken_Key: "Required",
|
|
481
|
+
status: "required",
|
|
482
|
+
region: 5,
|
|
483
|
+
owner: null,
|
|
484
|
+
}),
|
|
485
|
+
).toEqual({
|
|
486
|
+
impact: CustomFieldCreateSetting.Required,
|
|
487
|
+
affected_location: CustomFieldCreateSetting.Optional,
|
|
488
|
+
additional_information: CustomFieldCreateSetting.Hidden,
|
|
489
|
+
customer: CustomFieldCreateSetting.Default,
|
|
490
|
+
});
|
|
491
|
+
});
|
|
492
|
+
|
|
493
|
+
test("returns a new object: changing it does not change the stored value", () => {
|
|
494
|
+
const stored: Record<string, unknown> = { impact: "Required" };
|
|
495
|
+
|
|
496
|
+
const read: CustomFieldCreateSettings =
|
|
497
|
+
readCustomFieldCreateSettings(stored);
|
|
498
|
+
|
|
499
|
+
read["impact"] = CustomFieldCreateSetting.Hidden;
|
|
500
|
+
|
|
501
|
+
expect(stored).toEqual({ impact: "Required" });
|
|
502
|
+
});
|
|
503
|
+
|
|
504
|
+
test("reads the key constructor as an ordinary entry", () => {
|
|
505
|
+
expect(readCustomFieldCreateSettings({ constructor: "Hidden" })).toEqual({
|
|
506
|
+
constructor: CustomFieldCreateSetting.Hidden,
|
|
507
|
+
});
|
|
508
|
+
});
|
|
509
|
+
|
|
510
|
+
test("never throws on a frozen or odd value", () => {
|
|
511
|
+
expect(
|
|
512
|
+
readCustomFieldCreateSettings(deepFreeze({ impact: "Optional" })),
|
|
513
|
+
).toEqual({ impact: CustomFieldCreateSetting.Optional });
|
|
514
|
+
expect(readCustomFieldCreateSettings(Object.create(null))).toEqual({});
|
|
515
|
+
});
|
|
516
|
+
});
|
|
517
|
+
|
|
518
|
+
describe("getCustomFieldCreateSetting", () => {
|
|
519
|
+
const settings: Record<string, unknown> = {
|
|
520
|
+
impact: "Required",
|
|
521
|
+
affected_location: "Optional",
|
|
522
|
+
additional_information: "Hidden",
|
|
523
|
+
customer: "Default",
|
|
524
|
+
status: "Mandatory",
|
|
525
|
+
};
|
|
526
|
+
|
|
527
|
+
test.each([
|
|
528
|
+
["impact", CustomFieldCreateSetting.Required],
|
|
529
|
+
["affected_location", CustomFieldCreateSetting.Optional],
|
|
530
|
+
["additional_information", CustomFieldCreateSetting.Hidden],
|
|
531
|
+
["customer", CustomFieldCreateSetting.Default],
|
|
532
|
+
])("%s is %s", (key: string, expected: CustomFieldCreateSetting) => {
|
|
533
|
+
expect(getCustomFieldCreateSetting(settings, key)).toBe(expected);
|
|
534
|
+
});
|
|
535
|
+
|
|
536
|
+
test("a field that is not listed is Default", () => {
|
|
537
|
+
expect(getCustomFieldCreateSetting(settings, "region")).toBe(
|
|
538
|
+
CustomFieldCreateSetting.Default,
|
|
539
|
+
);
|
|
540
|
+
});
|
|
541
|
+
|
|
542
|
+
test("a listed field with an invalid setting is Default", () => {
|
|
543
|
+
expect(getCustomFieldCreateSetting(settings, "status")).toBe(
|
|
544
|
+
CustomFieldCreateSetting.Default,
|
|
545
|
+
);
|
|
546
|
+
});
|
|
547
|
+
|
|
548
|
+
test.each([[undefined], [null], [""]])(
|
|
549
|
+
"a field with no key (%j) is Default, whatever the settings list",
|
|
550
|
+
(key: string | null | undefined) => {
|
|
551
|
+
expect(getCustomFieldCreateSetting({ "": "Required" }, key)).toBe(
|
|
552
|
+
CustomFieldCreateSetting.Default,
|
|
553
|
+
);
|
|
554
|
+
},
|
|
555
|
+
);
|
|
556
|
+
|
|
557
|
+
test("an invalid key is Default even when a raw value lists it", () => {
|
|
558
|
+
expect(getCustomFieldCreateSetting({ Impact: "Required" }, "Impact")).toBe(
|
|
559
|
+
CustomFieldCreateSetting.Default,
|
|
560
|
+
);
|
|
561
|
+
});
|
|
562
|
+
|
|
563
|
+
test.each([["null", null], ["undefined", undefined], ...NOT_SETTINGS])(
|
|
564
|
+
"with %s as the settings every field is Default",
|
|
565
|
+
(_label: string, value: unknown) => {
|
|
566
|
+
expect(getCustomFieldCreateSetting(value, "impact")).toBe(
|
|
567
|
+
CustomFieldCreateSetting.Default,
|
|
568
|
+
);
|
|
569
|
+
},
|
|
570
|
+
);
|
|
571
|
+
|
|
572
|
+
test("regression: a field keyed constructor that is not listed is Default, not Object.prototype.constructor", () => {
|
|
573
|
+
expect(getCustomFieldCreateSetting({}, "constructor")).toBe(
|
|
574
|
+
CustomFieldCreateSetting.Default,
|
|
575
|
+
);
|
|
576
|
+
expect(getCustomFieldCreateSetting({}, "valueof")).toBe(
|
|
577
|
+
CustomFieldCreateSetting.Default,
|
|
578
|
+
);
|
|
579
|
+
expect(
|
|
580
|
+
getCustomFieldCreateSetting({ constructor: "Required" }, "constructor"),
|
|
581
|
+
).toBe(CustomFieldCreateSetting.Required);
|
|
582
|
+
});
|
|
583
|
+
|
|
584
|
+
test("an inherited entry does not count", () => {
|
|
585
|
+
expect(
|
|
586
|
+
getCustomFieldCreateSetting(
|
|
587
|
+
Object.create({ impact: "Required" }) as Record<string, unknown>,
|
|
588
|
+
"impact",
|
|
589
|
+
),
|
|
590
|
+
).toBe(CustomFieldCreateSetting.Default);
|
|
591
|
+
});
|
|
592
|
+
});
|
|
593
|
+
|
|
594
|
+
describe("getEffectiveCustomFieldCreateSetting: what the Details step does with a field", () => {
|
|
595
|
+
test.each([
|
|
596
|
+
[true, true, CustomFieldCreateSetting.Required],
|
|
597
|
+
[true, false, CustomFieldCreateSetting.Optional],
|
|
598
|
+
[true, undefined, CustomFieldCreateSetting.Optional],
|
|
599
|
+
[false, false, CustomFieldCreateSetting.Hidden],
|
|
600
|
+
[undefined, undefined, CustomFieldCreateSetting.Hidden],
|
|
601
|
+
[null, null, CustomFieldCreateSetting.Hidden],
|
|
602
|
+
/*
|
|
603
|
+
* Required on Create without Show on Create asks for nothing: the
|
|
604
|
+
* Declare Incident form only puts shown fields on its Details step.
|
|
605
|
+
*/
|
|
606
|
+
[false, true, CustomFieldCreateSetting.Hidden],
|
|
607
|
+
])(
|
|
608
|
+
"with no settings, Show on Create %j and Required on Create %j make the field %s",
|
|
609
|
+
(
|
|
610
|
+
showOnCreate: boolean | null | undefined,
|
|
611
|
+
isRequiredOnCreate: boolean | null | undefined,
|
|
612
|
+
expected: CustomFieldCreateSetting,
|
|
613
|
+
) => {
|
|
614
|
+
expect(
|
|
615
|
+
getEffectiveCustomFieldCreateSetting(
|
|
616
|
+
definition("Impact", "impact", { showOnCreate, isRequiredOnCreate }),
|
|
617
|
+
),
|
|
618
|
+
).toBe(expected);
|
|
619
|
+
},
|
|
620
|
+
);
|
|
621
|
+
|
|
622
|
+
test.each([
|
|
623
|
+
[CustomFieldCreateSetting.Required, false, false],
|
|
624
|
+
[CustomFieldCreateSetting.Optional, true, true],
|
|
625
|
+
[CustomFieldCreateSetting.Hidden, true, true],
|
|
626
|
+
])(
|
|
627
|
+
"a template's %s beats the field's own switches",
|
|
628
|
+
(
|
|
629
|
+
setting: CustomFieldCreateSetting,
|
|
630
|
+
showOnCreate: boolean,
|
|
631
|
+
isRequiredOnCreate: boolean,
|
|
632
|
+
) => {
|
|
633
|
+
expect(
|
|
634
|
+
getEffectiveCustomFieldCreateSetting(
|
|
635
|
+
definition("Impact", "impact", { showOnCreate, isRequiredOnCreate }),
|
|
636
|
+
{ impact: setting },
|
|
637
|
+
),
|
|
638
|
+
).toBe(setting);
|
|
639
|
+
},
|
|
640
|
+
);
|
|
641
|
+
|
|
642
|
+
test("Default, or an invalid entry, leaves the field's own switches in charge", () => {
|
|
643
|
+
const required: Definition = definition("Impact", "impact", {
|
|
644
|
+
showOnCreate: true,
|
|
645
|
+
isRequiredOnCreate: true,
|
|
646
|
+
});
|
|
647
|
+
|
|
648
|
+
expect(
|
|
649
|
+
getEffectiveCustomFieldCreateSetting(required, { impact: "Default" }),
|
|
650
|
+
).toBe(CustomFieldCreateSetting.Required);
|
|
651
|
+
expect(
|
|
652
|
+
getEffectiveCustomFieldCreateSetting(required, { impact: "hidden" }),
|
|
653
|
+
).toBe(CustomFieldCreateSetting.Required);
|
|
654
|
+
});
|
|
655
|
+
|
|
656
|
+
test("a field with no key cannot be overridden", () => {
|
|
657
|
+
expect(
|
|
658
|
+
getEffectiveCustomFieldCreateSetting(
|
|
659
|
+
definition("Impact", undefined, { showOnCreate: true }),
|
|
660
|
+
{ impact: "Hidden" },
|
|
661
|
+
),
|
|
662
|
+
).toBe(CustomFieldCreateSetting.Optional);
|
|
663
|
+
});
|
|
664
|
+
});
|
|
665
|
+
|
|
666
|
+
describe("getIncidentFormCustomFieldSetting: a form asks only what it lists", () => {
|
|
667
|
+
test.each([
|
|
668
|
+
["Required", CustomFieldCreateSetting.Required],
|
|
669
|
+
["Optional", CustomFieldCreateSetting.Optional],
|
|
670
|
+
["Hidden", CustomFieldCreateSetting.Hidden],
|
|
671
|
+
["Default", CustomFieldCreateSetting.Hidden],
|
|
672
|
+
["required", CustomFieldCreateSetting.Hidden],
|
|
673
|
+
])(
|
|
674
|
+
"a field listed as %j is %s",
|
|
675
|
+
(stored: string, expected: CustomFieldCreateSetting) => {
|
|
676
|
+
expect(
|
|
677
|
+
getIncidentFormCustomFieldSetting({ impact: stored }, "impact"),
|
|
678
|
+
).toBe(expected);
|
|
679
|
+
},
|
|
680
|
+
);
|
|
681
|
+
|
|
682
|
+
test("a field that is not listed is not asked", () => {
|
|
683
|
+
expect(getIncidentFormCustomFieldSetting({}, "impact")).toBe(
|
|
684
|
+
CustomFieldCreateSetting.Hidden,
|
|
685
|
+
);
|
|
686
|
+
expect(getIncidentFormCustomFieldSetting(null, "impact")).toBe(
|
|
687
|
+
CustomFieldCreateSetting.Hidden,
|
|
688
|
+
);
|
|
689
|
+
expect(getIncidentFormCustomFieldSetting({ impact: "Required" })).toBe(
|
|
690
|
+
CustomFieldCreateSetting.Hidden,
|
|
691
|
+
);
|
|
692
|
+
});
|
|
693
|
+
});
|
|
694
|
+
|
|
695
|
+
describe("applyTemplateCustomFieldCreateSettings: a template only overrides", () => {
|
|
696
|
+
test("Required, Optional and Hidden set both switches; Default and unlisted fields keep theirs", () => {
|
|
697
|
+
const applied: Array<Definition> = applyTemplateCustomFieldCreateSettings(
|
|
698
|
+
projectFields(),
|
|
699
|
+
{
|
|
700
|
+
impact: "Optional",
|
|
701
|
+
affected_location: "Hidden",
|
|
702
|
+
additional_information: "Required",
|
|
703
|
+
customer: "Default",
|
|
704
|
+
},
|
|
705
|
+
);
|
|
706
|
+
|
|
707
|
+
expect(switchesOf(applied)).toEqual([
|
|
708
|
+
{ name: "Impact", showOnCreate: true, isRequiredOnCreate: false },
|
|
709
|
+
{
|
|
710
|
+
name: "Affected Location",
|
|
711
|
+
showOnCreate: false,
|
|
712
|
+
isRequiredOnCreate: false,
|
|
713
|
+
},
|
|
714
|
+
{
|
|
715
|
+
name: "Additional Information",
|
|
716
|
+
showOnCreate: true,
|
|
717
|
+
isRequiredOnCreate: true,
|
|
718
|
+
},
|
|
719
|
+
{
|
|
720
|
+
name: "Customer",
|
|
721
|
+
showOnCreate: undefined,
|
|
722
|
+
isRequiredOnCreate: undefined,
|
|
723
|
+
},
|
|
724
|
+
]);
|
|
725
|
+
});
|
|
726
|
+
|
|
727
|
+
test("with no settings every field is left as the project has it", () => {
|
|
728
|
+
for (const settings of [undefined, null, {}, [], "Required"]) {
|
|
729
|
+
expect(
|
|
730
|
+
applyTemplateCustomFieldCreateSettings(projectFields(), settings),
|
|
731
|
+
).toEqual(projectFields());
|
|
732
|
+
}
|
|
733
|
+
});
|
|
734
|
+
|
|
735
|
+
test("an invalid entry leaves its field as the project has it", () => {
|
|
736
|
+
expect(
|
|
737
|
+
switchesOf(
|
|
738
|
+
applyTemplateCustomFieldCreateSettings(projectFields(), {
|
|
739
|
+
impact: "hidden",
|
|
740
|
+
affected_location: 1,
|
|
741
|
+
}),
|
|
742
|
+
),
|
|
743
|
+
).toEqual(switchesOf(projectFields()));
|
|
744
|
+
});
|
|
745
|
+
|
|
746
|
+
test("a field with no key is never overridden", () => {
|
|
747
|
+
const fields: Array<Definition> = [
|
|
748
|
+
definition("Legacy", undefined, { showOnCreate: true }),
|
|
749
|
+
definition("Legacy Null", null, { showOnCreate: true }),
|
|
750
|
+
];
|
|
751
|
+
|
|
752
|
+
expect(
|
|
753
|
+
applyTemplateCustomFieldCreateSettings(fields, { legacy: "Hidden" }),
|
|
754
|
+
).toEqual(fields);
|
|
755
|
+
});
|
|
756
|
+
|
|
757
|
+
test("keeps the order it was given: ordering is the caller's", () => {
|
|
758
|
+
const fields: Array<Definition> = [
|
|
759
|
+
definition("Third", "third", { sortOrder: 3 }),
|
|
760
|
+
definition("First", "first", { sortOrder: 1 }),
|
|
761
|
+
definition("Unordered", "unordered"),
|
|
762
|
+
];
|
|
763
|
+
|
|
764
|
+
expect(
|
|
765
|
+
names(
|
|
766
|
+
applyTemplateCustomFieldCreateSettings(fields, { first: "Required" }),
|
|
767
|
+
),
|
|
768
|
+
).toEqual(["Third", "First", "Unordered"]);
|
|
769
|
+
});
|
|
770
|
+
|
|
771
|
+
test("keeps everything else about each field", () => {
|
|
772
|
+
const field: Definition = {
|
|
773
|
+
...definition("Region", "region", { sortOrder: 4 }),
|
|
774
|
+
customFieldType: CustomFieldType.Dropdown,
|
|
775
|
+
description: "Where it happened",
|
|
776
|
+
dropdownOptions: "EU\nUS",
|
|
777
|
+
mapFromResourceType: "Monitor",
|
|
778
|
+
};
|
|
779
|
+
|
|
780
|
+
expect(
|
|
781
|
+
applyTemplateCustomFieldCreateSettings([field], { region: "Required" }),
|
|
782
|
+
).toEqual([{ ...field, showOnCreate: true, isRequiredOnCreate: true }]);
|
|
783
|
+
});
|
|
784
|
+
|
|
785
|
+
test("returns new objects and never touches the definitions it is given", () => {
|
|
786
|
+
const fields: Array<Definition> = deepFreeze(projectFields());
|
|
787
|
+
const settings: Record<string, unknown> = deepFreeze({
|
|
788
|
+
impact: "Hidden",
|
|
789
|
+
customer: "Required",
|
|
790
|
+
affected_location: "Default",
|
|
791
|
+
});
|
|
792
|
+
|
|
793
|
+
const applied: Array<Definition> = applyTemplateCustomFieldCreateSettings(
|
|
794
|
+
fields,
|
|
795
|
+
settings,
|
|
796
|
+
);
|
|
797
|
+
|
|
798
|
+
expect(applied).not.toBe(fields);
|
|
799
|
+
|
|
800
|
+
for (let index: number = 0; index < fields.length; index++) {
|
|
801
|
+
expect(applied[index]).not.toBe(fields[index]);
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
expect(fields).toEqual(projectFields());
|
|
805
|
+
});
|
|
806
|
+
|
|
807
|
+
test("a model instance comes back as an instance of its own class", () => {
|
|
808
|
+
class FieldRow {
|
|
809
|
+
public name: string = "Impact";
|
|
810
|
+
public variableKey: string = "impact";
|
|
811
|
+
public showOnCreate: boolean = false;
|
|
812
|
+
public isRequiredOnCreate: boolean = false;
|
|
813
|
+
|
|
814
|
+
public describe(): string {
|
|
815
|
+
return `${this.name}: ${this.showOnCreate ? "shown" : "not shown"}`;
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
const [applied] = applyTemplateCustomFieldCreateSettings([new FieldRow()], {
|
|
820
|
+
impact: "Required",
|
|
821
|
+
});
|
|
822
|
+
|
|
823
|
+
expect(applied).toBeInstanceOf(FieldRow);
|
|
824
|
+
expect(applied!.describe()).toBe("Impact: shown");
|
|
825
|
+
});
|
|
826
|
+
|
|
827
|
+
test("fed to the Details step's own filter, it asks exactly the fields the template wants", () => {
|
|
828
|
+
// The dashboard's getDetailsStepDefinitions: shown fields, in order.
|
|
829
|
+
const detailsStep: Array<Definition> = sortCustomFieldDefinitions(
|
|
830
|
+
applyTemplateCustomFieldCreateSettings(projectFields(), {
|
|
831
|
+
impact: "Hidden",
|
|
832
|
+
customer: "Optional",
|
|
833
|
+
}).filter((field: Definition): boolean => {
|
|
834
|
+
return field.showOnCreate === true;
|
|
835
|
+
}),
|
|
836
|
+
);
|
|
837
|
+
|
|
838
|
+
expect(switchesOf(detailsStep)).toEqual([
|
|
839
|
+
{
|
|
840
|
+
name: "Affected Location",
|
|
841
|
+
showOnCreate: true,
|
|
842
|
+
isRequiredOnCreate: false,
|
|
843
|
+
},
|
|
844
|
+
{ name: "Customer", showOnCreate: true, isRequiredOnCreate: false },
|
|
845
|
+
]);
|
|
846
|
+
});
|
|
847
|
+
|
|
848
|
+
test("agrees with getEffectiveCustomFieldCreateSetting for every combination", () => {
|
|
849
|
+
const behaviours: Array<{
|
|
850
|
+
showOnCreate: boolean | undefined;
|
|
851
|
+
isRequiredOnCreate: boolean | undefined;
|
|
852
|
+
}> = [
|
|
853
|
+
{ showOnCreate: true, isRequiredOnCreate: true },
|
|
854
|
+
{ showOnCreate: true, isRequiredOnCreate: false },
|
|
855
|
+
{ showOnCreate: false, isRequiredOnCreate: true },
|
|
856
|
+
{ showOnCreate: false, isRequiredOnCreate: false },
|
|
857
|
+
{ showOnCreate: undefined, isRequiredOnCreate: undefined },
|
|
858
|
+
];
|
|
859
|
+
|
|
860
|
+
for (const behaviour of behaviours) {
|
|
861
|
+
for (const setting of [...CUSTOM_FIELD_CREATE_SETTINGS, undefined]) {
|
|
862
|
+
const field: Definition = definition("Impact", "impact", behaviour);
|
|
863
|
+
const settings: Record<string, unknown> = setting
|
|
864
|
+
? { impact: setting }
|
|
865
|
+
: {};
|
|
866
|
+
|
|
867
|
+
const [applied] = applyTemplateCustomFieldCreateSettings(
|
|
868
|
+
[field],
|
|
869
|
+
settings,
|
|
870
|
+
);
|
|
871
|
+
|
|
872
|
+
// What the applied switches make of the field, with no settings.
|
|
873
|
+
expect({
|
|
874
|
+
behaviour,
|
|
875
|
+
setting,
|
|
876
|
+
effect: getEffectiveCustomFieldCreateSetting(applied!),
|
|
877
|
+
}).toEqual({
|
|
878
|
+
behaviour,
|
|
879
|
+
setting,
|
|
880
|
+
effect: getEffectiveCustomFieldCreateSetting(field, settings),
|
|
881
|
+
});
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
});
|
|
885
|
+
});
|
|
886
|
+
|
|
887
|
+
describe("getIncidentFormAskedDefinitions: a public form asks only what it lists", () => {
|
|
888
|
+
test("asks the Required and Optional fields, with the form's own Required", () => {
|
|
889
|
+
const asked: Array<Definition> = getIncidentFormAskedDefinitions(
|
|
890
|
+
projectFields(),
|
|
891
|
+
{
|
|
892
|
+
additional_information: "Required",
|
|
893
|
+
customer: "Optional",
|
|
894
|
+
},
|
|
895
|
+
);
|
|
896
|
+
|
|
897
|
+
expect(switchesOf(asked)).toEqual([
|
|
898
|
+
{
|
|
899
|
+
name: "Additional Information",
|
|
900
|
+
showOnCreate: true,
|
|
901
|
+
isRequiredOnCreate: true,
|
|
902
|
+
},
|
|
903
|
+
{ name: "Customer", showOnCreate: true, isRequiredOnCreate: false },
|
|
904
|
+
]);
|
|
905
|
+
});
|
|
906
|
+
|
|
907
|
+
test("never asks a field because of its project-wide switches", () => {
|
|
908
|
+
/*
|
|
909
|
+
* Impact is shown and required on the dashboard's Declare Incident form,
|
|
910
|
+
* but this form does not list it, so its name and its options must not
|
|
911
|
+
* reach the public page.
|
|
912
|
+
*/
|
|
913
|
+
expect(names(getIncidentFormAskedDefinitions(projectFields(), {}))).toEqual(
|
|
914
|
+
[],
|
|
915
|
+
);
|
|
916
|
+
expect(
|
|
917
|
+
names(
|
|
918
|
+
getIncidentFormAskedDefinitions(projectFields(), {
|
|
919
|
+
impact: "Default",
|
|
920
|
+
affected_location: "Hidden",
|
|
921
|
+
}),
|
|
922
|
+
),
|
|
923
|
+
).toEqual([]);
|
|
924
|
+
});
|
|
925
|
+
|
|
926
|
+
test("a form's Optional does not become required because the project requires the field", () => {
|
|
927
|
+
const [asked] = getIncidentFormAskedDefinitions(projectFields(), {
|
|
928
|
+
impact: "Optional",
|
|
929
|
+
});
|
|
930
|
+
|
|
931
|
+
expect(asked!.name).toBe("Impact");
|
|
932
|
+
expect(asked!.isRequiredOnCreate).toBe(false);
|
|
933
|
+
});
|
|
934
|
+
|
|
935
|
+
test("puts the fields in the order fields are shown everywhere else", () => {
|
|
936
|
+
const fields: Array<Definition> = [
|
|
937
|
+
definition("Unordered B", "unordered_b"),
|
|
938
|
+
definition("Third", "third", { sortOrder: 3 }),
|
|
939
|
+
definition("Unordered A", "unordered_a"),
|
|
940
|
+
definition("First", "first", { sortOrder: 1 }),
|
|
941
|
+
];
|
|
942
|
+
|
|
943
|
+
expect(
|
|
944
|
+
names(
|
|
945
|
+
getIncidentFormAskedDefinitions(fields, {
|
|
946
|
+
unordered_b: "Optional",
|
|
947
|
+
third: "Required",
|
|
948
|
+
unordered_a: "Optional",
|
|
949
|
+
first: "Optional",
|
|
950
|
+
}),
|
|
951
|
+
),
|
|
952
|
+
).toEqual(["First", "Third", "Unordered B", "Unordered A"]);
|
|
953
|
+
});
|
|
954
|
+
|
|
955
|
+
test("never asks a field with no key, or anything with no valid settings", () => {
|
|
956
|
+
const fields: Array<Definition> = [
|
|
957
|
+
definition("Legacy", undefined, { showOnCreate: true }),
|
|
958
|
+
definition("Impact", "impact"),
|
|
959
|
+
];
|
|
960
|
+
|
|
961
|
+
expect(
|
|
962
|
+
getIncidentFormAskedDefinitions(fields, { legacy: "Required" }),
|
|
963
|
+
).toEqual([]);
|
|
964
|
+
|
|
965
|
+
for (const settings of [undefined, null, [], "Required", 5]) {
|
|
966
|
+
expect(getIncidentFormAskedDefinitions(fields, settings)).toEqual([]);
|
|
967
|
+
}
|
|
968
|
+
});
|
|
969
|
+
|
|
970
|
+
test("returns copies and never touches the definitions it is given", () => {
|
|
971
|
+
const fields: Array<Definition> = deepFreeze(projectFields());
|
|
972
|
+
|
|
973
|
+
const asked: Array<Definition> = getIncidentFormAskedDefinitions(fields, {
|
|
974
|
+
impact: "Optional",
|
|
975
|
+
});
|
|
976
|
+
|
|
977
|
+
expect(asked[0]).not.toBe(fields[0]);
|
|
978
|
+
expect(fields).toEqual(projectFields());
|
|
979
|
+
});
|
|
980
|
+
|
|
981
|
+
test("a model instance comes back as an instance of its own class", () => {
|
|
982
|
+
class FieldRow {
|
|
983
|
+
public name: string = "Impact";
|
|
984
|
+
public variableKey: string = "impact";
|
|
985
|
+
public sortOrder: number = 1;
|
|
986
|
+
|
|
987
|
+
public label(): string {
|
|
988
|
+
return this.name.toUpperCase();
|
|
989
|
+
}
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
const [asked] = getIncidentFormAskedDefinitions([new FieldRow()], {
|
|
993
|
+
impact: "Required",
|
|
994
|
+
});
|
|
995
|
+
|
|
996
|
+
expect(asked).toBeInstanceOf(FieldRow);
|
|
997
|
+
expect(asked!.label()).toBe("IMPACT");
|
|
998
|
+
});
|
|
999
|
+
});
|
|
1000
|
+
|
|
1001
|
+
describe("compactCustomFieldCreateSettings: the smallest value that means the same", () => {
|
|
1002
|
+
test("drops Default entries and invalid ones, keeps the rest", () => {
|
|
1003
|
+
expect(
|
|
1004
|
+
compactCustomFieldCreateSettings({
|
|
1005
|
+
impact: "Required",
|
|
1006
|
+
affected_location: "Optional",
|
|
1007
|
+
additional_information: "Hidden",
|
|
1008
|
+
customer: "Default",
|
|
1009
|
+
Broken: "Required",
|
|
1010
|
+
status: "nope",
|
|
1011
|
+
}),
|
|
1012
|
+
).toEqual({
|
|
1013
|
+
impact: "Required",
|
|
1014
|
+
affected_location: "Optional",
|
|
1015
|
+
additional_information: "Hidden",
|
|
1016
|
+
});
|
|
1017
|
+
});
|
|
1018
|
+
|
|
1019
|
+
test("for a form, drops Hidden too: it means not asked, as Default does", () => {
|
|
1020
|
+
expect(
|
|
1021
|
+
compactCustomFieldCreateSettings(
|
|
1022
|
+
{
|
|
1023
|
+
impact: "Required",
|
|
1024
|
+
affected_location: "Optional",
|
|
1025
|
+
additional_information: "Hidden",
|
|
1026
|
+
customer: "Default",
|
|
1027
|
+
},
|
|
1028
|
+
{ dropHidden: true },
|
|
1029
|
+
),
|
|
1030
|
+
).toEqual({
|
|
1031
|
+
impact: "Required",
|
|
1032
|
+
affected_location: "Optional",
|
|
1033
|
+
});
|
|
1034
|
+
});
|
|
1035
|
+
|
|
1036
|
+
test.each([["null", null], ["undefined", undefined], ...NOT_SETTINGS])(
|
|
1037
|
+
"compacts %s to no settings",
|
|
1038
|
+
(_label: string, value: unknown) => {
|
|
1039
|
+
expect(compactCustomFieldCreateSettings(value)).toEqual({});
|
|
1040
|
+
},
|
|
1041
|
+
);
|
|
1042
|
+
|
|
1043
|
+
test("returns a new object and leaves the one it was given alone", () => {
|
|
1044
|
+
const settings: Record<string, unknown> = deepFreeze({
|
|
1045
|
+
impact: "Required",
|
|
1046
|
+
customer: "Default",
|
|
1047
|
+
});
|
|
1048
|
+
|
|
1049
|
+
const compacted: CustomFieldCreateSettings =
|
|
1050
|
+
compactCustomFieldCreateSettings(settings);
|
|
1051
|
+
|
|
1052
|
+
expect(compacted).not.toBe(settings);
|
|
1053
|
+
expect(settings).toEqual({ impact: "Required", customer: "Default" });
|
|
1054
|
+
});
|
|
1055
|
+
|
|
1056
|
+
test("a compacted value is one the server accepts, and means exactly the same", () => {
|
|
1057
|
+
const settings: Record<string, unknown> = {
|
|
1058
|
+
impact: "Hidden",
|
|
1059
|
+
affected_location: "Default",
|
|
1060
|
+
additional_information: "Required",
|
|
1061
|
+
customer: "Optional",
|
|
1062
|
+
region: "Default",
|
|
1063
|
+
};
|
|
1064
|
+
|
|
1065
|
+
const compacted: CustomFieldCreateSettings =
|
|
1066
|
+
compactCustomFieldCreateSettings(settings);
|
|
1067
|
+
const compactedForForm: CustomFieldCreateSettings =
|
|
1068
|
+
compactCustomFieldCreateSettings(settings, { dropHidden: true });
|
|
1069
|
+
|
|
1070
|
+
expect(validateCustomFieldCreateSettings(compacted)).toBeNull();
|
|
1071
|
+
expect(validateCustomFieldCreateSettings(compactedForForm)).toBeNull();
|
|
1072
|
+
|
|
1073
|
+
expect(
|
|
1074
|
+
applyTemplateCustomFieldCreateSettings(projectFields(), compacted),
|
|
1075
|
+
).toEqual(
|
|
1076
|
+
applyTemplateCustomFieldCreateSettings(projectFields(), settings),
|
|
1077
|
+
);
|
|
1078
|
+
expect(
|
|
1079
|
+
getIncidentFormAskedDefinitions(projectFields(), compactedForForm),
|
|
1080
|
+
).toEqual(getIncidentFormAskedDefinitions(projectFields(), settings));
|
|
1081
|
+
});
|
|
1082
|
+
});
|
|
1083
|
+
|
|
1084
|
+
// A relative import: another pure module of Common.
|
|
1085
|
+
const RELATIVE_IMPORT: RegExp = /^\.\.?\//;
|
|
1086
|
+
|
|
1087
|
+
describe("the module stays pure", () => {
|
|
1088
|
+
test("imports nothing from React, the database, the server or the UI", () => {
|
|
1089
|
+
const source: string = fs.readFileSync(
|
|
1090
|
+
path.join(
|
|
1091
|
+
__dirname,
|
|
1092
|
+
"../../../Types/CustomField/CustomFieldCreateSettings.ts",
|
|
1093
|
+
),
|
|
1094
|
+
"utf8",
|
|
1095
|
+
);
|
|
1096
|
+
|
|
1097
|
+
const imports: Array<string> = Array.from(
|
|
1098
|
+
source.matchAll(/from\s+"([^"]+)"/g),
|
|
1099
|
+
).map((match: RegExpMatchArray): string => {
|
|
1100
|
+
return match[1]!;
|
|
1101
|
+
});
|
|
1102
|
+
|
|
1103
|
+
expect(imports.length).toBeGreaterThan(0);
|
|
1104
|
+
|
|
1105
|
+
for (const imported of imports) {
|
|
1106
|
+
expect({ imported, pure: RELATIVE_IMPORT.test(imported) }).toEqual({
|
|
1107
|
+
imported,
|
|
1108
|
+
pure: true,
|
|
1109
|
+
});
|
|
1110
|
+
expect(imported).not.toMatch(/react|typeorm|Server|UI|Models/i);
|
|
1111
|
+
}
|
|
1112
|
+
});
|
|
1113
|
+
});
|