@oneuptime/common 14.0.7 → 14.0.8
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/Incident.ts +267 -1
- package/Models/DatabaseModels/IncidentCustomField.ts +202 -0
- package/Models/DatabaseModels/IncidentEpisode.ts +30 -0
- package/Models/DatabaseModels/IncidentTemplate.ts +126 -1
- package/Models/DatabaseModels/StatusPage.ts +55 -0
- package/Models/DatabaseModels/StatusPageSubscriber.ts +128 -0
- package/Server/API/IncidentAPI.ts +162 -0
- package/Server/API/StatusPageAPI.ts +487 -171
- package/Server/API/StatusPageSubscriberAPI.ts +63 -15
- package/Server/Infrastructure/Postgres/SchemaMigrations/1795300000000-SkipHiddenIncidentCreatedNotifications.ts +49 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1795400000000-AddIncidentStatusPageScope.ts +108 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1795500000000-AddIncidentTemplateStatusPageScopeFlag.ts +33 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1795600000000-AddStatusPageSubscriberUnsubscribeToken.ts +51 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1795700000000-AddStatusPageSubscriberIsAddedByTeam.ts +33 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1795800000000-AddIncidentCustomFieldCreateAndNotificationSettings.ts +168 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1795900000000-AddSubscriberNotificationClaimedAt.ts +44 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +14 -0
- package/Server/Infrastructure/Semaphore.ts +10 -0
- package/Server/Middleware/IdentityRateLimit.ts +108 -3
- package/Server/Middleware/SubscriberNotificationPreviewRateLimit.ts +237 -0
- package/Server/Middleware/SubscriberNotificationTestSendRateLimit.ts +304 -0
- package/Server/Services/DatabaseService.ts +93 -10
- package/Server/Services/IncidentCustomFieldService.ts +276 -1
- package/Server/Services/IncidentEpisodePublicNoteService.ts +28 -0
- package/Server/Services/IncidentEpisodeService.ts +15 -0
- package/Server/Services/IncidentEpisodeStateTimelineService.ts +27 -1
- package/Server/Services/IncidentPublicNoteService.ts +30 -1
- package/Server/Services/IncidentService.ts +1535 -65
- package/Server/Services/IncidentStateTimelineService.ts +13 -0
- package/Server/Services/IncidentTemplateService.ts +109 -0
- package/Server/Services/ScheduledMaintenancePublicNoteService.ts +30 -1
- package/Server/Services/ScheduledMaintenanceService.ts +68 -18
- package/Server/Services/SmsService.ts +10 -0
- package/Server/Services/StatusPageService.ts +65 -8
- package/Server/Services/StatusPageSubscriberNotificationTemplateService.ts +299 -37
- package/Server/Services/StatusPageSubscriberNotificationTemplateStatusPageService.ts +129 -0
- package/Server/Services/StatusPageSubscriberService.ts +1161 -64
- package/Server/Types/Markdown.ts +153 -6
- package/Server/Types/Workflow/Components/Email.ts +61 -2
- package/Server/Utils/CustomField/CustomFieldRename.ts +378 -0
- package/Server/Utils/DataSource/EgressGuard.ts +66 -21
- package/Server/Utils/Mail/PinnedSmtpSocket.ts +130 -0
- package/Server/Utils/Monitor/MonitorCriteriaObservationBuilder.ts +10 -0
- package/Server/Utils/SSRFProtection.ts +76 -16
- package/Server/Utils/StatusPage/IncidentStatusPageScope.ts +948 -0
- package/Server/Utils/StatusPage/IncidentSubscriberAudienceBuilder.ts +656 -0
- package/Server/Utils/StatusPage/IncidentTemplateVariableBuilder.ts +805 -0
- package/Server/Utils/StatusPage/StatusPageExclusion.ts +18 -0
- package/Server/Utils/StatusPage/StatusPageReadAccess.ts +125 -0
- package/Server/Utils/StatusPage/StatusPageSubscriberUnsubscribeNotice.ts +151 -0
- package/Server/Utils/StatusPage/StatusPageSubscriberUnsubscribeToken.ts +70 -0
- package/Server/Utils/StatusPage/SubscriberIncidentEmailBuilder.ts +421 -0
- package/Server/Utils/StatusPage/SubscriberNotificationClaim.ts +107 -0
- package/Server/Utils/StatusPage/SubscriberNotificationDeliveryRecord.ts +1049 -0
- package/Server/Utils/StatusPage/SubscriberNotificationFanOut.ts +180 -0
- package/Server/Utils/StatusPage/SubscriberNotificationPreviewBuilder.ts +839 -0
- package/Server/Utils/StatusPage/SubscriberNotificationResendAccess.ts +393 -0
- package/Server/Utils/StatusPage/SubscriberNotificationRunLimit.ts +246 -0
- package/Server/Utils/StatusPage/SubscriberNotificationTiming.ts +133 -0
- package/Server/Utils/StatusPage/SubscriberTemplateIncidentRecordAccess.ts +215 -0
- package/Server/Utils/StatusPageResource.ts +51 -20
- package/Server/Utils/VM/VMAPI.ts +1 -0
- package/Server/Utils/VM/VMRunner.ts +10 -0
- package/Server/Utils/Workflow/OAuth2TokenClient.ts +10 -0
- package/Server/Views/Partials/SensitiveUrlToken.ejs +8 -5
- package/Tests/App/Accounts/RegisterVerifyEmail.test.tsx +748 -0
- package/Tests/App/Accounts/ResendVerificationEmail.test.tsx +1222 -0
- package/Tests/App/Accounts/VerificationEmailResendUtils.test.ts +797 -0
- package/Tests/App/Accounts/VerifyEmailPending.test.tsx +538 -0
- package/Tests/App/Accounts/VerifyEmailResend.test.tsx +779 -0
- package/Tests/App/Dashboard/CustomFieldsSettingsIncidentOptions.test.tsx +357 -0
- package/Tests/App/Dashboard/EventNotes.test.tsx +776 -0
- package/Tests/App/Dashboard/EventNotesPages.test.tsx +119 -0
- package/Tests/App/Dashboard/EventNotesUtil.test.ts +116 -17
- package/Tests/App/Dashboard/EventOverviewPages.test.tsx +242 -5
- package/Tests/App/Dashboard/IncidentChangeStateNotifyDefault.test.tsx +91 -1
- package/Tests/App/Dashboard/IncidentCreateDetailsStep.test.tsx +643 -0
- package/Tests/App/Dashboard/IncidentCreateFromAlerts.test.tsx +8 -1
- package/Tests/App/Dashboard/IncidentCreateStatusPageScope.test.tsx +601 -0
- package/Tests/App/Dashboard/IncidentCustomFieldTemplateVariables.test.tsx +386 -0
- package/Tests/App/Dashboard/IncidentNoteTemplatePlaceholders.test.tsx +124 -0
- package/Tests/App/Dashboard/IncidentNoteTemplateVariablesLoader.test.ts +305 -0
- package/Tests/App/Dashboard/IncidentOverviewNotifyDefault.test.tsx +112 -0
- package/Tests/App/Dashboard/IncidentSettingsRenotifyOnPublish.test.tsx +674 -0
- package/Tests/App/Dashboard/IncidentSettingsStatusPageScope.test.tsx +1051 -0
- package/Tests/App/Dashboard/IncidentTemplateCustomFields.test.tsx +384 -0
- package/Tests/App/Dashboard/IncidentTemplateStatusPageScopeCard.test.tsx +215 -0
- package/Tests/App/Dashboard/PublicNotePagesNotifyDefault.test.tsx +113 -1
- package/Tests/App/Dashboard/SubscriberAudienceSummary.test.tsx +512 -0
- package/Tests/App/Dashboard/SubscriberNotificationPreviewModal.test.tsx +837 -0
- package/Tests/App/Dashboard/SubscriberNotificationStatusLabel.test.tsx +88 -0
- package/Tests/App/Dashboard/SubscriberNotificationStatusResend.test.tsx +473 -0
- package/Tests/App/Dashboard/SubscriberTemplateLivePreview.test.tsx +196 -0
- package/Tests/App/Dashboard/TeamAddedSubscribersUnsubscribedNotice.test.tsx +248 -0
- package/Tests/App/SensitiveUrlTokenBootstrap.test.ts +64 -3
- package/Tests/App/StatusPage/StatusPageUnsubscribePage.test.tsx +412 -0
- package/Tests/Models/IncidentCustomFieldApiSchemaContract.test.ts +217 -0
- package/Tests/Models/IncidentCustomFieldCreateSettingsColumns.test.ts +252 -0
- package/Tests/Models/StatusPageSubscriberUnsubscribeColumns.test.ts +218 -0
- package/Tests/Server/API/ExpiredSessionRouteGuards.test.ts +7 -0
- package/Tests/Server/API/IncidentSubscriberAudienceAPI.test.ts +1408 -0
- package/Tests/Server/API/StatusPageIncidentScope.test.ts +1868 -0
- package/Tests/Server/API/StatusPageIncidentScopePostgres.test.ts +790 -0
- package/Tests/Server/API/StatusPageManageSubscriptionRecipient.test.ts +10 -1
- package/Tests/Server/API/StatusPageManageSubscriptionTemplateVariables.test.ts +206 -18
- package/Tests/Server/API/StatusPagePostmortemVisibility.test.ts +14 -2
- package/Tests/Server/API/StatusPageSubscriberCreateResponse.test.ts +217 -0
- package/Tests/Server/API/StatusPageSubscriberOwnership.test.ts +103 -2
- package/Tests/Server/API/StatusPageUnsubscribeAPI.test.ts +396 -0
- package/Tests/Server/Infrastructure/Postgres/AddIncidentStatusPageScopeMigration.test.ts +395 -0
- package/Tests/Server/Infrastructure/Postgres/AddIncidentTemplateStatusPageScopeFlagMigration.test.ts +150 -0
- package/Tests/Server/Infrastructure/Postgres/AddSubscriberNotificationClaimedAtMigration.test.ts +156 -0
- package/Tests/Server/Infrastructure/Postgres/SkipHiddenIncidentCreatedNotificationsMigration.test.ts +410 -0
- package/Tests/Server/Middleware/IdentityRateLimit.test.ts +551 -1
- package/Tests/Server/Middleware/SubscriberNotificationPreviewRateLimit.test.ts +238 -0
- package/Tests/Server/Middleware/SubscriberNotificationTestSendRateLimit.test.ts +245 -0
- package/Tests/Server/Services/AddStatusPageSubscriberUnsubscribeTokenMigration.test.ts +152 -0
- package/Tests/Server/Services/CrossProjectRelationWriteGuard.test.ts +221 -36
- package/Tests/Server/Services/DatabaseServiceCompareAndSetColumns.test.ts +191 -0
- package/Tests/Server/Services/IncidentCreatedRenotifyOnPublish.test.ts +681 -0
- package/Tests/Server/Services/IncidentCreatedResend.test.ts +775 -0
- package/Tests/Server/Services/IncidentCustomFieldRenamePostgres.test.ts +713 -0
- package/Tests/Server/Services/IncidentCustomFieldService.test.ts +751 -0
- package/Tests/Server/Services/IncidentCustomFieldValueValidation.test.ts +556 -0
- package/Tests/Server/Services/IncidentStatusPageScope.test.ts +2971 -0
- package/Tests/Server/Services/IncidentStatusPageScopeFeed.test.ts +131 -0
- package/Tests/Server/Services/IncidentStatusPageScopePostgres.test.ts +625 -0
- package/Tests/Server/Services/IncidentTemplateCustomFieldsCopy.test.ts +311 -0
- package/Tests/Server/Services/IncidentTemplateStatusPageScope.test.ts +363 -0
- package/Tests/Server/Services/PublicNoteEditFeedEventType.test.ts +213 -0
- package/Tests/Server/Services/PublicNoteResendAccess.test.ts +994 -0
- package/Tests/Server/Services/ScheduledMaintenanceSubscriberTemplateFormats.test.ts +289 -9
- package/Tests/Server/Services/SmsServiceFailIfNotSent.test.ts +67 -0
- package/Tests/Server/Services/StatusPageReportIncidentCounts.test.ts +610 -0
- package/Tests/Server/Services/StatusPageSubscriberAudienceCounts.test.ts +201 -0
- package/Tests/Server/Services/StatusPageSubscriberAudienceCountsPostgres.test.ts +271 -0
- package/Tests/Server/Services/StatusPageSubscriberConfirmationTemplateEscaping.test.ts +200 -0
- package/Tests/Server/Services/StatusPageSubscriberNotificationLogRedaction.test.ts +54 -0
- package/Tests/Server/Services/StatusPageSubscriberNotificationTemplateCompile.test.ts +37 -0
- package/Tests/Server/Services/StatusPageSubscriberNotificationTemplateIncidentRecordAccess.test.ts +772 -0
- package/Tests/Server/Services/StatusPageSubscriberNotificationTemplateLookup.test.ts +506 -0
- package/Tests/Server/Services/StatusPageSubscriberNotificationTemplateLookupPostgres.test.ts +261 -0
- package/Tests/Server/Services/StatusPageSubscriberReport.test.ts +21 -5
- package/Tests/Server/Services/StatusPageSubscriberUnsubscribe.test.ts +1618 -0
- package/Tests/Server/Services/StatusPageSubscriberUnsubscribeLinkSenders.test.ts +373 -0
- package/Tests/Server/Services/StatusPageSubscriberUnsubscribePostgres.test.ts +388 -0
- package/Tests/Server/Services/SubscriberNotificationInFlightRequeue.test.ts +500 -0
- package/Tests/Server/Types/MarkdownEmailLinks.test.ts +320 -0
- package/Tests/Server/Types/Workflow/Components/Email.test.ts +491 -1
- package/Tests/Server/Types/Workflow/Components/EmailSmtpPinning.test.ts +398 -0
- package/Tests/Server/Utils/CustomField/CustomFieldRename.test.ts +586 -0
- package/Tests/Server/Utils/DataSource/EgressGuard.test.ts +246 -10
- package/Tests/Server/Utils/DataSource/EgressGuardDeploymentConfig.test.ts +226 -0
- package/Tests/Server/Utils/DataSource/EgressGuardPinning.test.ts +131 -0
- package/Tests/Server/Utils/DataSource/HttpFetch.test.ts +4 -0
- package/Tests/Server/Utils/EgressPolicyEnvironment.ts +45 -0
- package/Tests/Server/Utils/Mail/PinnedSmtpSocket.test.ts +409 -0
- package/Tests/Server/Utils/Monitor/MonitorCriteriaObservationBuilderUnits.test.ts +23 -0
- package/Tests/Server/Utils/SSRFProtection.test.ts +4 -0
- package/Tests/Server/Utils/SSRFProtectionCloudServiceAddresses.test.ts +4 -0
- package/Tests/Server/Utils/SSRFProtectionPrivateNetwork.test.ts +4 -0
- package/Tests/Server/Utils/SSRFProtectionResolutionDetail.test.ts +314 -0
- package/Tests/Server/Utils/StatusPage/IncidentStatusPageScope.test.ts +1699 -0
- package/Tests/Server/Utils/StatusPage/IncidentStatusPageScopeQueriesPostgres.test.ts +508 -0
- package/Tests/Server/Utils/StatusPage/IncidentSubscriberAudienceCallerPermission.test.ts +246 -0
- package/Tests/Server/Utils/StatusPage/IncidentTemplateVariableBuilder.test.ts +1348 -0
- package/Tests/Server/Utils/StatusPage/StatusPageReadAccess.test.ts +221 -0
- package/Tests/Server/Utils/StatusPage/StatusPageSubscriberUnsubscribeNotice.test.ts +132 -0
- package/Tests/Server/Utils/StatusPage/StatusPageSubscriberUnsubscribeToken.test.ts +155 -0
- package/Tests/Server/Utils/StatusPage/SubscriberIncidentEmailBuilder.test.ts +708 -0
- package/Tests/Server/Utils/StatusPage/SubscriberNotificationClaim.test.ts +255 -0
- package/Tests/Server/Utils/StatusPage/SubscriberNotificationClaimPostgres.test.ts +528 -0
- package/Tests/Server/Utils/StatusPage/SubscriberNotificationDeliveryRecord.test.ts +1238 -0
- package/Tests/Server/Utils/StatusPage/SubscriberNotificationFanOut.test.ts +472 -0
- package/Tests/Server/Utils/StatusPage/SubscriberNotificationPreviewBuilder.test.ts +1168 -0
- package/Tests/Server/Utils/StatusPage/SubscriberNotificationRunLimit.test.ts +275 -0
- package/Tests/Server/Utils/StatusPage/SubscriberNotificationTiming.test.ts +131 -0
- package/Tests/Server/Utils/StatusPageResource.test.ts +98 -0
- package/Tests/Server/Utils/VM/VMRunnerPrivateNetworkWiring.test.ts +17 -0
- package/Tests/Server/Utils/VM/VMRunnerSsrf.test.ts +75 -0
- package/Tests/Types/CustomField/CustomFieldSavedViews.test.ts +247 -0
- package/Tests/Types/CustomField/CustomFieldTemplateValues.test.ts +186 -0
- package/Tests/Types/CustomField/CustomFieldTypeCorrespondence.test.ts +48 -0
- package/Tests/Types/CustomField/CustomFieldValueFormat.test.ts +215 -0
- package/Tests/Types/CustomField/CustomFieldValueValidator.test.ts +343 -0
- package/Tests/Types/CustomField/CustomFieldVariableKey.test.ts +364 -0
- package/Tests/Types/SafeHtml.test.ts +102 -0
- package/Tests/Types/StatusPage/IncidentCreatedRenotify.test.ts +419 -0
- package/Tests/Types/StatusPage/IncidentCreatedResend.test.ts +118 -0
- package/Tests/Types/StatusPage/IncidentScopeAddedPagesNotification.test.ts +558 -0
- package/Tests/Types/StatusPage/IncidentSubscriberAudience.test.ts +284 -0
- package/Tests/Types/StatusPage/StatusPageSubscriberUnsubscribe.test.ts +341 -0
- package/Tests/Types/StatusPage/SubscriberNotificationPreview.test.ts +196 -0
- package/Tests/Types/StatusPage/SubscriberNotificationResend.test.ts +201 -0
- package/Tests/Types/StatusPage/SubscriberNotificationTemplateCompiler.test.ts +277 -0
- package/Tests/Types/StatusPage/SubscriberNotificationTemplatePreview.test.ts +179 -0
- package/Tests/Types/StatusPage/SubscriberNotificationTemplateVariables.test.ts +324 -0
- package/Tests/Types/StatusPage/SubscriberUpdateNotification.test.ts +60 -13
- package/Tests/UI/Components/CustomFields/CustomFieldFormFields.test.ts +432 -0
- package/Tests/UI/Components/CustomFields/CustomFieldModelFormFields.test.tsx +685 -0
- package/Tests/UI/Components/CustomFields/CustomFieldsDetailOrder.test.tsx +469 -0
- package/Tests/UI/Components/Forms/ModelFormCustomFieldInputs.test.tsx +325 -0
- package/Tests/UI/Components/Forms/ModelFormDropdownOptionsRefused.test.tsx +358 -0
- package/Tests/UI/Components/ModelTable/CustomFieldColumns.test.tsx +22 -0
- package/Tests/UI/Monitor/NetworkPathView.test.tsx +289 -0
- package/Tests/Utils/Incident/IncidentNoteTemplateVariables.test.ts +623 -0
- package/Tests/Utils/Markdown/MarkdownEscape.test.ts +89 -0
- package/Tests/Utils/ProbeNetworkFailureUtil.test.ts +992 -0
- package/Tests/Utils/RequestFailedDetails.test.ts +575 -0
- package/Types/CustomField/CustomFieldOrder.ts +55 -0
- package/Types/CustomField/CustomFieldSavedViews.ts +225 -0
- package/Types/CustomField/CustomFieldTemplateMerge.ts +71 -0
- package/Types/CustomField/CustomFieldType.ts +14 -0
- package/Types/CustomField/CustomFieldValueFormat.ts +161 -0
- package/Types/CustomField/CustomFieldValueValidator.ts +488 -0
- package/Types/CustomField/CustomFieldVariableKey.ts +211 -0
- package/Types/SafeHtml.ts +93 -0
- package/Types/StatusPage/IncidentCreatedRenotify.ts +224 -0
- package/Types/StatusPage/IncidentCreatedResend.ts +108 -0
- package/Types/StatusPage/IncidentScopeAddedPagesNotification.ts +343 -0
- package/Types/StatusPage/IncidentSubscriberAudience.ts +332 -0
- package/Types/StatusPage/StatusPageSubscriberUnsubscribe.ts +405 -0
- package/Types/StatusPage/SubscriberNotificationInterruption.ts +32 -0
- package/Types/StatusPage/SubscriberNotificationPreview.ts +322 -0
- package/Types/StatusPage/SubscriberNotificationResend.ts +132 -0
- package/Types/StatusPage/SubscriberNotificationTemplateCompiler.ts +180 -0
- package/Types/StatusPage/SubscriberNotificationTemplatePreview.ts +301 -0
- package/Types/StatusPage/SubscriberNotificationTemplateVariables.ts +217 -4
- package/Types/StatusPage/SubscriberUpdateNotification.ts +32 -11
- package/UI/Components/CustomFields/CustomFieldFormFields.ts +317 -0
- package/UI/Components/CustomFields/CustomFieldModelFormFields.tsx +395 -0
- package/UI/Components/CustomFields/CustomFieldsDetail.tsx +95 -55
- package/UI/Components/Forms/ModelForm.tsx +70 -8
- package/UI/Components/Forms/Validation.ts +1 -1
- package/UI/Components/ModelFormModal/ModelFormModal.tsx +2 -4
- package/UI/Components/ModelTable/AnalyticsModelTable.tsx +2 -6
- package/UI/Components/ModelTable/BaseModelTable.tsx +9 -8
- package/UI/Components/ModelTable/CustomFieldColumns.tsx +14 -1
- package/UI/Components/ModelTable/ModelTable.tsx +6 -7
- package/UI/Utils/SensitiveUrlToken.ts +10 -5
- package/Utils/API.ts +247 -2
- package/Utils/Incident/IncidentNoteTemplateVariables.ts +304 -0
- package/Utils/Markdown/MarkdownEscape.ts +65 -0
- package/Utils/ProbeNetworkFailureUtil.ts +673 -0
- package/build/dist/Models/DatabaseModels/Incident.js +267 -1
- package/build/dist/Models/DatabaseModels/Incident.js.map +1 -1
- package/build/dist/Models/DatabaseModels/IncidentCustomField.js +207 -1
- package/build/dist/Models/DatabaseModels/IncidentCustomField.js.map +1 -1
- package/build/dist/Models/DatabaseModels/IncidentEpisode.js +31 -0
- package/build/dist/Models/DatabaseModels/IncidentEpisode.js.map +1 -1
- package/build/dist/Models/DatabaseModels/IncidentTemplate.js +124 -1
- package/build/dist/Models/DatabaseModels/IncidentTemplate.js.map +1 -1
- package/build/dist/Models/DatabaseModels/StatusPage.js +56 -0
- package/build/dist/Models/DatabaseModels/StatusPage.js.map +1 -1
- package/build/dist/Models/DatabaseModels/StatusPageSubscriber.js +131 -0
- package/build/dist/Models/DatabaseModels/StatusPageSubscriber.js.map +1 -1
- package/build/dist/Server/API/IncidentAPI.js +100 -1
- package/build/dist/Server/API/IncidentAPI.js.map +1 -1
- package/build/dist/Server/API/StatusPageAPI.js +417 -176
- package/build/dist/Server/API/StatusPageAPI.js.map +1 -1
- package/build/dist/Server/API/StatusPageSubscriberAPI.js +52 -13
- package/build/dist/Server/API/StatusPageSubscriberAPI.js.map +1 -1
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1795300000000-SkipHiddenIncidentCreatedNotifications.js +41 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1795300000000-SkipHiddenIncidentCreatedNotifications.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1795400000000-AddIncidentStatusPageScope.js +57 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1795400000000-AddIncidentStatusPageScope.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1795500000000-AddIncidentTemplateStatusPageScopeFlag.js +23 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1795500000000-AddIncidentTemplateStatusPageScopeFlag.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1795600000000-AddStatusPageSubscriberUnsubscribeToken.js +40 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1795600000000-AddStatusPageSubscriberUnsubscribeToken.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1795700000000-AddStatusPageSubscriberIsAddedByTeam.js +26 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1795700000000-AddStatusPageSubscriberIsAddedByTeam.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1795800000000-AddIncidentCustomFieldCreateAndNotificationSettings.js +89 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1795800000000-AddIncidentCustomFieldCreateAndNotificationSettings.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1795900000000-AddSubscriberNotificationClaimedAt.js +29 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1795900000000-AddSubscriberNotificationClaimedAt.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +14 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
- package/build/dist/Server/Infrastructure/Semaphore.js +3 -0
- package/build/dist/Server/Infrastructure/Semaphore.js.map +1 -1
- package/build/dist/Server/Middleware/IdentityRateLimit.js +89 -3
- package/build/dist/Server/Middleware/IdentityRateLimit.js.map +1 -1
- package/build/dist/Server/Middleware/SubscriberNotificationPreviewRateLimit.js +149 -0
- package/build/dist/Server/Middleware/SubscriberNotificationPreviewRateLimit.js.map +1 -0
- package/build/dist/Server/Middleware/SubscriberNotificationTestSendRateLimit.js +190 -0
- package/build/dist/Server/Middleware/SubscriberNotificationTestSendRateLimit.js.map +1 -0
- package/build/dist/Server/Services/DatabaseService.js +56 -7
- package/build/dist/Server/Services/DatabaseService.js.map +1 -1
- package/build/dist/Server/Services/IncidentCustomFieldService.js +204 -8
- package/build/dist/Server/Services/IncidentCustomFieldService.js.map +1 -1
- package/build/dist/Server/Services/IncidentEpisodePublicNoteService.js +24 -0
- package/build/dist/Server/Services/IncidentEpisodePublicNoteService.js.map +1 -1
- package/build/dist/Server/Services/IncidentEpisodeService.js +14 -0
- package/build/dist/Server/Services/IncidentEpisodeService.js.map +1 -1
- package/build/dist/Server/Services/IncidentEpisodeStateTimelineService.js +26 -0
- package/build/dist/Server/Services/IncidentEpisodeStateTimelineService.js.map +1 -1
- package/build/dist/Server/Services/IncidentPublicNoteService.js +26 -1
- package/build/dist/Server/Services/IncidentPublicNoteService.js.map +1 -1
- package/build/dist/Server/Services/IncidentService.js +1052 -0
- package/build/dist/Server/Services/IncidentService.js.map +1 -1
- package/build/dist/Server/Services/IncidentStateTimelineService.js +12 -0
- package/build/dist/Server/Services/IncidentStateTimelineService.js.map +1 -1
- package/build/dist/Server/Services/IncidentTemplateService.js +83 -0
- package/build/dist/Server/Services/IncidentTemplateService.js.map +1 -1
- package/build/dist/Server/Services/ScheduledMaintenancePublicNoteService.js +26 -1
- package/build/dist/Server/Services/ScheduledMaintenancePublicNoteService.js.map +1 -1
- package/build/dist/Server/Services/ScheduledMaintenanceService.js +47 -17
- package/build/dist/Server/Services/ScheduledMaintenanceService.js.map +1 -1
- package/build/dist/Server/Services/SmsService.js +2 -22
- package/build/dist/Server/Services/SmsService.js.map +1 -1
- package/build/dist/Server/Services/StatusPageService.js +47 -9
- package/build/dist/Server/Services/StatusPageService.js.map +1 -1
- package/build/dist/Server/Services/StatusPageSubscriberNotificationTemplateService.js +237 -32
- package/build/dist/Server/Services/StatusPageSubscriberNotificationTemplateService.js.map +1 -1
- package/build/dist/Server/Services/StatusPageSubscriberNotificationTemplateStatusPageService.js +109 -0
- package/build/dist/Server/Services/StatusPageSubscriberNotificationTemplateStatusPageService.js.map +1 -1
- package/build/dist/Server/Services/StatusPageSubscriberService.js +925 -99
- package/build/dist/Server/Services/StatusPageSubscriberService.js.map +1 -1
- package/build/dist/Server/Types/Markdown.js +110 -6
- package/build/dist/Server/Types/Markdown.js.map +1 -1
- package/build/dist/Server/Types/Workflow/Components/Email.js +55 -6
- package/build/dist/Server/Types/Workflow/Components/Email.js.map +1 -1
- package/build/dist/Server/Utils/CustomField/CustomFieldRename.js +211 -0
- package/build/dist/Server/Utils/CustomField/CustomFieldRename.js.map +1 -0
- package/build/dist/Server/Utils/DataSource/EgressGuard.js +41 -12
- package/build/dist/Server/Utils/DataSource/EgressGuard.js.map +1 -1
- package/build/dist/Server/Utils/Mail/PinnedSmtpSocket.js +101 -0
- package/build/dist/Server/Utils/Mail/PinnedSmtpSocket.js.map +1 -0
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaObservationBuilder.js +9 -0
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaObservationBuilder.js.map +1 -1
- package/build/dist/Server/Utils/SSRFProtection.js +48 -6
- package/build/dist/Server/Utils/SSRFProtection.js.map +1 -1
- package/build/dist/Server/Utils/StatusPage/IncidentStatusPageScope.js +631 -0
- package/build/dist/Server/Utils/StatusPage/IncidentStatusPageScope.js.map +1 -0
- package/build/dist/Server/Utils/StatusPage/IncidentSubscriberAudienceBuilder.js +403 -0
- package/build/dist/Server/Utils/StatusPage/IncidentSubscriberAudienceBuilder.js.map +1 -0
- package/build/dist/Server/Utils/StatusPage/IncidentTemplateVariableBuilder.js +451 -0
- package/build/dist/Server/Utils/StatusPage/IncidentTemplateVariableBuilder.js.map +1 -0
- package/build/dist/Server/Utils/StatusPage/StatusPageExclusion.js +13 -0
- package/build/dist/Server/Utils/StatusPage/StatusPageExclusion.js.map +1 -0
- package/build/dist/Server/Utils/StatusPage/StatusPageReadAccess.js +91 -0
- package/build/dist/Server/Utils/StatusPage/StatusPageReadAccess.js.map +1 -0
- package/build/dist/Server/Utils/StatusPage/StatusPageSubscriberUnsubscribeNotice.js +101 -0
- package/build/dist/Server/Utils/StatusPage/StatusPageSubscriberUnsubscribeNotice.js.map +1 -0
- package/build/dist/Server/Utils/StatusPage/StatusPageSubscriberUnsubscribeToken.js +47 -0
- package/build/dist/Server/Utils/StatusPage/StatusPageSubscriberUnsubscribeToken.js.map +1 -0
- package/build/dist/Server/Utils/StatusPage/SubscriberIncidentEmailBuilder.js +273 -0
- package/build/dist/Server/Utils/StatusPage/SubscriberIncidentEmailBuilder.js.map +1 -0
- package/build/dist/Server/Utils/StatusPage/SubscriberNotificationClaim.js +73 -0
- package/build/dist/Server/Utils/StatusPage/SubscriberNotificationClaim.js.map +1 -0
- package/build/dist/Server/Utils/StatusPage/SubscriberNotificationDeliveryRecord.js +722 -0
- package/build/dist/Server/Utils/StatusPage/SubscriberNotificationDeliveryRecord.js.map +1 -0
- package/build/dist/Server/Utils/StatusPage/SubscriberNotificationFanOut.js +102 -0
- package/build/dist/Server/Utils/StatusPage/SubscriberNotificationFanOut.js.map +1 -0
- package/build/dist/Server/Utils/StatusPage/SubscriberNotificationPreviewBuilder.js +527 -0
- package/build/dist/Server/Utils/StatusPage/SubscriberNotificationPreviewBuilder.js.map +1 -0
- package/build/dist/Server/Utils/StatusPage/SubscriberNotificationResendAccess.js +278 -0
- package/build/dist/Server/Utils/StatusPage/SubscriberNotificationResendAccess.js.map +1 -0
- package/build/dist/Server/Utils/StatusPage/SubscriberNotificationRunLimit.js +137 -0
- package/build/dist/Server/Utils/StatusPage/SubscriberNotificationRunLimit.js.map +1 -0
- package/build/dist/Server/Utils/StatusPage/SubscriberNotificationTiming.js +103 -0
- package/build/dist/Server/Utils/StatusPage/SubscriberNotificationTiming.js.map +1 -0
- package/build/dist/Server/Utils/StatusPage/SubscriberTemplateIncidentRecordAccess.js +114 -0
- package/build/dist/Server/Utils/StatusPage/SubscriberTemplateIncidentRecordAccess.js.map +1 -0
- package/build/dist/Server/Utils/StatusPageResource.js +39 -7
- package/build/dist/Server/Utils/StatusPageResource.js.map +1 -1
- package/build/dist/Server/Utils/VM/VMAPI.js.map +1 -1
- package/build/dist/Server/Utils/VM/VMRunner.js +1 -0
- package/build/dist/Server/Utils/VM/VMRunner.js.map +1 -1
- package/build/dist/Server/Utils/Workflow/OAuth2TokenClient.js +3 -0
- package/build/dist/Server/Utils/Workflow/OAuth2TokenClient.js.map +1 -1
- package/build/dist/Types/CustomField/CustomFieldOrder.js +36 -0
- package/build/dist/Types/CustomField/CustomFieldOrder.js.map +1 -0
- package/build/dist/Types/CustomField/CustomFieldSavedViews.js +135 -0
- package/build/dist/Types/CustomField/CustomFieldSavedViews.js.map +1 -0
- package/build/dist/Types/CustomField/CustomFieldTemplateMerge.js +27 -0
- package/build/dist/Types/CustomField/CustomFieldTemplateMerge.js.map +1 -0
- package/build/dist/Types/CustomField/CustomFieldType.js +12 -0
- package/build/dist/Types/CustomField/CustomFieldType.js.map +1 -1
- package/build/dist/Types/CustomField/CustomFieldValueFormat.js +126 -0
- package/build/dist/Types/CustomField/CustomFieldValueFormat.js.map +1 -0
- package/build/dist/Types/CustomField/CustomFieldValueValidator.js +280 -0
- package/build/dist/Types/CustomField/CustomFieldValueValidator.js.map +1 -0
- package/build/dist/Types/CustomField/CustomFieldVariableKey.js +150 -0
- package/build/dist/Types/CustomField/CustomFieldVariableKey.js.map +1 -0
- package/build/dist/Types/SafeHtml.js +84 -0
- package/build/dist/Types/SafeHtml.js.map +1 -0
- package/build/dist/Types/StatusPage/IncidentCreatedRenotify.js +117 -0
- package/build/dist/Types/StatusPage/IncidentCreatedRenotify.js.map +1 -0
- package/build/dist/Types/StatusPage/IncidentCreatedResend.js +86 -0
- package/build/dist/Types/StatusPage/IncidentCreatedResend.js.map +1 -0
- package/build/dist/Types/StatusPage/IncidentScopeAddedPagesNotification.js +246 -0
- package/build/dist/Types/StatusPage/IncidentScopeAddedPagesNotification.js.map +1 -0
- package/build/dist/Types/StatusPage/IncidentSubscriberAudience.js +183 -0
- package/build/dist/Types/StatusPage/IncidentSubscriberAudience.js.map +1 -0
- package/build/dist/Types/StatusPage/StatusPageSubscriberUnsubscribe.js +277 -0
- package/build/dist/Types/StatusPage/StatusPageSubscriberUnsubscribe.js.map +1 -0
- package/build/dist/Types/StatusPage/SubscriberNotificationInterruption.js +27 -0
- package/build/dist/Types/StatusPage/SubscriberNotificationInterruption.js.map +1 -0
- package/build/dist/Types/StatusPage/SubscriberNotificationPreview.js +190 -0
- package/build/dist/Types/StatusPage/SubscriberNotificationPreview.js.map +1 -0
- package/build/dist/Types/StatusPage/SubscriberNotificationResend.js +102 -0
- package/build/dist/Types/StatusPage/SubscriberNotificationResend.js.map +1 -0
- package/build/dist/Types/StatusPage/SubscriberNotificationTemplateCompiler.js +97 -0
- package/build/dist/Types/StatusPage/SubscriberNotificationTemplateCompiler.js.map +1 -0
- package/build/dist/Types/StatusPage/SubscriberNotificationTemplatePreview.js +175 -0
- package/build/dist/Types/StatusPage/SubscriberNotificationTemplatePreview.js.map +1 -0
- package/build/dist/Types/StatusPage/SubscriberNotificationTemplateVariables.js +144 -4
- package/build/dist/Types/StatusPage/SubscriberNotificationTemplateVariables.js.map +1 -1
- package/build/dist/Types/StatusPage/SubscriberUpdateNotification.js +29 -9
- package/build/dist/Types/StatusPage/SubscriberUpdateNotification.js.map +1 -1
- package/build/dist/UI/Components/CustomFields/CustomFieldFormFields.js +169 -0
- package/build/dist/UI/Components/CustomFields/CustomFieldFormFields.js.map +1 -0
- package/build/dist/UI/Components/CustomFields/CustomFieldModelFormFields.js +212 -0
- package/build/dist/UI/Components/CustomFields/CustomFieldModelFormFields.js.map +1 -0
- package/build/dist/UI/Components/CustomFields/CustomFieldsDetail.js +64 -49
- package/build/dist/UI/Components/CustomFields/CustomFieldsDetail.js.map +1 -1
- package/build/dist/UI/Components/Forms/ModelForm.js +39 -5
- package/build/dist/UI/Components/Forms/ModelForm.js.map +1 -1
- package/build/dist/UI/Components/Forms/Validation.js +1 -1
- package/build/dist/UI/Components/Forms/Validation.js.map +1 -1
- package/build/dist/UI/Components/ModelFormModal/ModelFormModal.js.map +1 -1
- package/build/dist/UI/Components/ModelTable/AnalyticsModelTable.js.map +1 -1
- package/build/dist/UI/Components/ModelTable/BaseModelTable.js +2 -2
- package/build/dist/UI/Components/ModelTable/BaseModelTable.js.map +1 -1
- package/build/dist/UI/Components/ModelTable/CustomFieldColumns.js +13 -1
- package/build/dist/UI/Components/ModelTable/CustomFieldColumns.js.map +1 -1
- package/build/dist/UI/Components/ModelTable/ModelTable.js +1 -1
- package/build/dist/UI/Components/ModelTable/ModelTable.js.map +1 -1
- package/build/dist/UI/Utils/SensitiveUrlToken.js +10 -5
- package/build/dist/UI/Utils/SensitiveUrlToken.js.map +1 -1
- package/build/dist/Utils/API.js +177 -1
- package/build/dist/Utils/API.js.map +1 -1
- package/build/dist/Utils/Incident/IncidentNoteTemplateVariables.js +155 -0
- package/build/dist/Utils/Incident/IncidentNoteTemplateVariables.js.map +1 -0
- package/build/dist/Utils/Markdown/MarkdownEscape.js +48 -0
- package/build/dist/Utils/Markdown/MarkdownEscape.js.map +1 -1
- package/build/dist/Utils/ProbeNetworkFailureUtil.js +460 -0
- package/build/dist/Utils/ProbeNetworkFailureUtil.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
/** @timezone UTC */
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
afterEach,
|
|
5
|
+
beforeEach,
|
|
6
|
+
describe,
|
|
7
|
+
expect,
|
|
8
|
+
jest,
|
|
9
|
+
test,
|
|
10
|
+
} from "@jest/globals";
|
|
11
|
+
import getJestMockFunction, { MockFunction } from "../../MockType";
|
|
12
|
+
|
|
13
|
+
/*
|
|
14
|
+
* The values an incident's note templates are filled with when one is picked
|
|
15
|
+
* (Components/Incident/IncidentNoteTemplateVariables): the incident, its
|
|
16
|
+
* custom fields and the status pages it reaches, each read on its own. What
|
|
17
|
+
* is pinned: what is read, and that whatever cannot be read leaves its
|
|
18
|
+
* placeholders as written rather than failing the rest.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
const getItemMock: MockFunction = getJestMockFunction();
|
|
22
|
+
const getListMock: MockFunction = getJestMockFunction();
|
|
23
|
+
const postMock: MockFunction = getJestMockFunction();
|
|
24
|
+
|
|
25
|
+
jest.mock("../../../UI/Utils/ModelAPI/ModelAPI", () => {
|
|
26
|
+
return {
|
|
27
|
+
__esModule: true,
|
|
28
|
+
default: {
|
|
29
|
+
getItem: (...args: Array<unknown>): unknown => {
|
|
30
|
+
return getItemMock(...args);
|
|
31
|
+
},
|
|
32
|
+
getList: (...args: Array<unknown>): unknown => {
|
|
33
|
+
return getListMock(...args);
|
|
34
|
+
},
|
|
35
|
+
getCommonHeaders: (): Record<string, string> => {
|
|
36
|
+
return { tenantid: "11111111-1111-4111-8111-111111111111" };
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
jest.mock("../../../UI/Utils/API/API", () => {
|
|
43
|
+
return {
|
|
44
|
+
__esModule: true,
|
|
45
|
+
default: {
|
|
46
|
+
post: (...args: Array<unknown>): unknown => {
|
|
47
|
+
return postMock(...args);
|
|
48
|
+
},
|
|
49
|
+
getFriendlyMessage: (): string => {
|
|
50
|
+
return "Something went wrong";
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
jest.mock("../../../UI/Utils/Project", () => {
|
|
57
|
+
return {
|
|
58
|
+
__esModule: true,
|
|
59
|
+
default: {
|
|
60
|
+
getCurrentProjectId: (): unknown => {
|
|
61
|
+
const ObjectIDClass: any = jest.requireActual(
|
|
62
|
+
"../../../Types/ObjectID",
|
|
63
|
+
) as any;
|
|
64
|
+
return new ObjectIDClass.default(
|
|
65
|
+
"11111111-1111-4111-8111-111111111111",
|
|
66
|
+
);
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
import { fetchIncidentNoteTemplateVariables } from "../../../../App/FeatureSet/Dashboard/src/Components/Incident/IncidentNoteTemplateVariables";
|
|
73
|
+
import Incident from "../../../Models/DatabaseModels/Incident";
|
|
74
|
+
import IncidentCustomField from "../../../Models/DatabaseModels/IncidentCustomField";
|
|
75
|
+
import IncidentSeverity from "../../../Models/DatabaseModels/IncidentSeverity";
|
|
76
|
+
import IncidentState from "../../../Models/DatabaseModels/IncidentState";
|
|
77
|
+
import Label from "../../../Models/DatabaseModels/Label";
|
|
78
|
+
import HTTPErrorResponse from "../../../Types/API/HTTPErrorResponse";
|
|
79
|
+
import HTTPResponse from "../../../Types/API/HTTPResponse";
|
|
80
|
+
import CustomFieldType from "../../../Types/CustomField/CustomFieldType";
|
|
81
|
+
import { JSONObject } from "../../../Types/JSON";
|
|
82
|
+
import ObjectID from "../../../Types/ObjectID";
|
|
83
|
+
import IncidentSubscriberAudience from "../../../Types/StatusPage/IncidentSubscriberAudience";
|
|
84
|
+
import { NoteTemplateVariables } from "../../../Utils/Incident/IncidentNoteTemplateVariables";
|
|
85
|
+
|
|
86
|
+
const INCIDENT_ID: ObjectID = new ObjectID(
|
|
87
|
+
"22222222-2222-4222-8222-222222222222",
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
function label(name: string): Label {
|
|
91
|
+
const result: Label = new Label();
|
|
92
|
+
result.name = name;
|
|
93
|
+
return result;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function buildIncident(): Incident {
|
|
97
|
+
const incident: Incident = new Incident();
|
|
98
|
+
incident._id = INCIDENT_ID.toString();
|
|
99
|
+
incident.title = "Payments are failing";
|
|
100
|
+
incident.incidentNumber = 42;
|
|
101
|
+
incident.incidentNumberWithPrefix = "INC-42";
|
|
102
|
+
incident.declaredAt = new Date("2026-09-27T09:30:00.000Z");
|
|
103
|
+
incident.customFields = {
|
|
104
|
+
Impact: "High",
|
|
105
|
+
"Estimated Duration": 0,
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
const severity: IncidentSeverity = new IncidentSeverity();
|
|
109
|
+
severity.name = "Critical";
|
|
110
|
+
incident.incidentSeverity = severity;
|
|
111
|
+
|
|
112
|
+
const state: IncidentState = new IncidentState();
|
|
113
|
+
state.name = "Investigating";
|
|
114
|
+
incident.currentIncidentState = state;
|
|
115
|
+
|
|
116
|
+
incident.labels = [label("Region East"), label("Payments")];
|
|
117
|
+
|
|
118
|
+
return incident;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function definition(
|
|
122
|
+
name: string,
|
|
123
|
+
variableKey: string,
|
|
124
|
+
customFieldType: CustomFieldType,
|
|
125
|
+
): IncidentCustomField {
|
|
126
|
+
const field: IncidentCustomField = new IncidentCustomField();
|
|
127
|
+
field.name = name;
|
|
128
|
+
field.variableKey = variableKey;
|
|
129
|
+
field.customFieldType = customFieldType;
|
|
130
|
+
return field;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function audienceResponse(): HTTPResponse<JSONObject> {
|
|
134
|
+
return new HTTPResponse<JSONObject>(
|
|
135
|
+
200,
|
|
136
|
+
IncidentSubscriberAudience.toJSON({
|
|
137
|
+
hasMonitors: true,
|
|
138
|
+
isScoped: true,
|
|
139
|
+
isHiddenFromStatusPages: false,
|
|
140
|
+
statusPages: [
|
|
141
|
+
{
|
|
142
|
+
statusPageId: "b0000000-0000-4000-8000-000000000003",
|
|
143
|
+
name: "Site 03",
|
|
144
|
+
subscriberCounts: IncidentSubscriberAudience.getEmptyCounts(),
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
statusPageId: "b0000000-0000-4000-8000-000000000007",
|
|
148
|
+
name: "Site 07",
|
|
149
|
+
subscriberCounts: IncidentSubscriberAudience.getEmptyCounts(),
|
|
150
|
+
},
|
|
151
|
+
],
|
|
152
|
+
hiddenStatusPageCount: 1,
|
|
153
|
+
excludedStatusPages: [],
|
|
154
|
+
selectedStatusPagesNotListingMonitors: [],
|
|
155
|
+
}),
|
|
156
|
+
{},
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
beforeEach(() => {
|
|
161
|
+
getItemMock.mockReset();
|
|
162
|
+
getItemMock.mockResolvedValue(buildIncident() as never);
|
|
163
|
+
getListMock.mockReset();
|
|
164
|
+
getListMock.mockResolvedValue({
|
|
165
|
+
data: [
|
|
166
|
+
definition("Impact", "impact", CustomFieldType.Dropdown),
|
|
167
|
+
definition(
|
|
168
|
+
"Estimated Duration",
|
|
169
|
+
"estimated_duration",
|
|
170
|
+
CustomFieldType.Number,
|
|
171
|
+
),
|
|
172
|
+
],
|
|
173
|
+
count: 2,
|
|
174
|
+
skip: 0,
|
|
175
|
+
limit: 2,
|
|
176
|
+
} as never);
|
|
177
|
+
postMock.mockReset();
|
|
178
|
+
postMock.mockResolvedValue(audienceResponse() as never);
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
afterEach(() => {
|
|
182
|
+
jest.restoreAllMocks();
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
describe("fetchIncidentNoteTemplateVariables", () => {
|
|
186
|
+
test("fills every placeholder from the incident", async () => {
|
|
187
|
+
const variables: NoteTemplateVariables =
|
|
188
|
+
await fetchIncidentNoteTemplateVariables(INCIDENT_ID);
|
|
189
|
+
|
|
190
|
+
expect(variables["incident.title"]).toBe("Payments are failing");
|
|
191
|
+
expect(variables["incident.number"]).toBe("INC-42");
|
|
192
|
+
expect(variables["incident.severity"]).toBe("Critical");
|
|
193
|
+
expect(variables["incident.state"]).toBe("Investigating");
|
|
194
|
+
expect(variables["incident.startedAt"]).toMatch(/^Sep 27 2026, /);
|
|
195
|
+
expect(variables["incident.labels"]).toBe("Region East, Payments");
|
|
196
|
+
// Only the pages the author can see are named.
|
|
197
|
+
expect(variables["incident.affectedStatusPages"]).toBe("Site 03, Site 07");
|
|
198
|
+
expect(variables["customFields.impact"]).toBe("High");
|
|
199
|
+
expect(variables["customFields.estimated_duration"]).toBe("0");
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
test("reads this incident, with the related names the placeholders need", async () => {
|
|
203
|
+
await fetchIncidentNoteTemplateVariables(INCIDENT_ID);
|
|
204
|
+
|
|
205
|
+
const request: {
|
|
206
|
+
modelType: unknown;
|
|
207
|
+
id: ObjectID;
|
|
208
|
+
select: JSONObject;
|
|
209
|
+
} = getItemMock.mock.calls[0]![0] as {
|
|
210
|
+
modelType: unknown;
|
|
211
|
+
id: ObjectID;
|
|
212
|
+
select: JSONObject;
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
expect(request.modelType).toBe(Incident);
|
|
216
|
+
expect(request.id.toString()).toBe(INCIDENT_ID.toString());
|
|
217
|
+
expect(request.select).toEqual({
|
|
218
|
+
title: true,
|
|
219
|
+
incidentNumber: true,
|
|
220
|
+
incidentNumberWithPrefix: true,
|
|
221
|
+
declaredAt: true,
|
|
222
|
+
customFields: true,
|
|
223
|
+
incidentSeverity: { name: true },
|
|
224
|
+
currentIncidentState: { name: true },
|
|
225
|
+
labels: { name: true },
|
|
226
|
+
});
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
test("reads the custom fields' template keys", async () => {
|
|
230
|
+
await fetchIncidentNoteTemplateVariables(INCIDENT_ID);
|
|
231
|
+
|
|
232
|
+
const request: { modelType: unknown; select: JSONObject } = getListMock.mock
|
|
233
|
+
.calls[0]![0] as { modelType: unknown; select: JSONObject };
|
|
234
|
+
|
|
235
|
+
expect(request.modelType).toBe(IncidentCustomField);
|
|
236
|
+
expect(request.select["variableKey"]).toBe(true);
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
test("asks who the incident reaches the same way the audience summary does", async () => {
|
|
240
|
+
await fetchIncidentNoteTemplateVariables(INCIDENT_ID);
|
|
241
|
+
|
|
242
|
+
const request: {
|
|
243
|
+
url: { toString: () => string };
|
|
244
|
+
data: JSONObject;
|
|
245
|
+
headers: JSONObject;
|
|
246
|
+
} = postMock.mock.calls[0]![0] as {
|
|
247
|
+
url: { toString: () => string };
|
|
248
|
+
data: JSONObject;
|
|
249
|
+
headers: JSONObject;
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
expect(request.url.toString()).toContain("/incident/subscriber-audience");
|
|
253
|
+
expect(request.data).toEqual({ incidentId: INCIDENT_ID.toString() });
|
|
254
|
+
expect(request.headers["tenantid"]).toBeDefined();
|
|
255
|
+
});
|
|
256
|
+
|
|
257
|
+
test("an incident that cannot be read fills nothing", async () => {
|
|
258
|
+
getItemMock.mockResolvedValue(null as never);
|
|
259
|
+
|
|
260
|
+
expect(await fetchIncidentNoteTemplateVariables(INCIDENT_ID)).toEqual({});
|
|
261
|
+
|
|
262
|
+
getItemMock.mockRejectedValue(new Error("Not allowed.") as never);
|
|
263
|
+
|
|
264
|
+
expect(await fetchIncidentNoteTemplateVariables(INCIDENT_ID)).toEqual({});
|
|
265
|
+
});
|
|
266
|
+
|
|
267
|
+
test("custom fields that cannot be read leave their placeholders, and nothing else", async () => {
|
|
268
|
+
getListMock.mockRejectedValue(
|
|
269
|
+
new Error("Custom fields are not on your plan.") as never,
|
|
270
|
+
);
|
|
271
|
+
|
|
272
|
+
const variables: NoteTemplateVariables =
|
|
273
|
+
await fetchIncidentNoteTemplateVariables(INCIDENT_ID);
|
|
274
|
+
|
|
275
|
+
expect(variables["incident.title"]).toBe("Payments are failing");
|
|
276
|
+
expect(
|
|
277
|
+
Object.keys(variables).some((name: string) => {
|
|
278
|
+
return name.startsWith("customFields.");
|
|
279
|
+
}),
|
|
280
|
+
).toBe(false);
|
|
281
|
+
});
|
|
282
|
+
|
|
283
|
+
test("status pages that cannot be read leave their placeholder, and nothing else", async () => {
|
|
284
|
+
postMock.mockResolvedValue(
|
|
285
|
+
new HTTPErrorResponse(403, { message: "No access." }, {}) as never,
|
|
286
|
+
);
|
|
287
|
+
|
|
288
|
+
const variables: NoteTemplateVariables =
|
|
289
|
+
await fetchIncidentNoteTemplateVariables(INCIDENT_ID);
|
|
290
|
+
|
|
291
|
+
expect(variables).not.toHaveProperty(["incident.affectedStatusPages"]);
|
|
292
|
+
expect(variables["customFields.impact"]).toBe("High");
|
|
293
|
+
});
|
|
294
|
+
|
|
295
|
+
test("an incident with no labels fills the placeholder with nothing", async () => {
|
|
296
|
+
const incident: Incident = buildIncident();
|
|
297
|
+
incident.labels = [];
|
|
298
|
+
getItemMock.mockResolvedValue(incident as never);
|
|
299
|
+
|
|
300
|
+
const variables: NoteTemplateVariables =
|
|
301
|
+
await fetchIncidentNoteTemplateVariables(INCIDENT_ID);
|
|
302
|
+
|
|
303
|
+
expect(variables["incident.labels"]).toBe("");
|
|
304
|
+
});
|
|
305
|
+
});
|
|
@@ -277,6 +277,8 @@ import Route from "../../../Types/API/Route";
|
|
|
277
277
|
import Color from "../../../Types/Color";
|
|
278
278
|
import ObjectID from "../../../Types/ObjectID";
|
|
279
279
|
import Navigation from "../../../UI/Utils/Navigation";
|
|
280
|
+
import IncidentCreatedRenotify from "../../../Types/StatusPage/IncidentCreatedRenotify";
|
|
281
|
+
import StatusPageSubscriberNotificationStatus from "../../../Types/StatusPage/StatusPageSubscriberNotificationStatus";
|
|
280
282
|
|
|
281
283
|
const INCIDENT_ID: string = "11111111-1111-4111-8111-111111111111";
|
|
282
284
|
const OTHER_INCIDENT_ID: string = "22222222-2222-4222-8222-222222222222";
|
|
@@ -856,3 +858,113 @@ describe("incident overview: where Notify Status Page Subscribers starts", () =>
|
|
|
856
858
|
});
|
|
857
859
|
});
|
|
858
860
|
});
|
|
861
|
+
|
|
862
|
+
/*
|
|
863
|
+
* The 'created' notification badge in the details card. A notification the
|
|
864
|
+
* worker skipped because the incident was hidden from status pages says so
|
|
865
|
+
* in the badge itself; every other status keeps the badge's own wording.
|
|
866
|
+
*/
|
|
867
|
+
describe("incident overview: the created notification badge", () => {
|
|
868
|
+
interface DetailField {
|
|
869
|
+
field?: Record<string, unknown>;
|
|
870
|
+
getElement?: (item: Incident) => ReactElement;
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
interface BadgeProps {
|
|
874
|
+
status?: StatusPageSubscriberNotificationStatus;
|
|
875
|
+
subscriberNotificationStatusMessage?: string;
|
|
876
|
+
statusText?: string;
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
function renderBadge(
|
|
880
|
+
status: StatusPageSubscriberNotificationStatus,
|
|
881
|
+
message: string | undefined,
|
|
882
|
+
): BadgeProps {
|
|
883
|
+
const cards: Array<Record<string, unknown>> =
|
|
884
|
+
recordedProps["CardModelDetail:Incident Details"] || [];
|
|
885
|
+
expect(cards.length).toBeGreaterThan(0);
|
|
886
|
+
|
|
887
|
+
const fields: Array<DetailField> = (
|
|
888
|
+
cards[cards.length - 1]!["modelDetailProps"] as {
|
|
889
|
+
fields: Array<DetailField>;
|
|
890
|
+
}
|
|
891
|
+
).fields;
|
|
892
|
+
const badgeField: DetailField | undefined = fields.find(
|
|
893
|
+
(field: DetailField): boolean => {
|
|
894
|
+
return Boolean(
|
|
895
|
+
field.field?.["subscriberNotificationStatusOnIncidentCreated"],
|
|
896
|
+
);
|
|
897
|
+
},
|
|
898
|
+
);
|
|
899
|
+
expect(badgeField?.getElement).toBeDefined();
|
|
900
|
+
|
|
901
|
+
const item: Incident = buildIncident({});
|
|
902
|
+
item.subscriberNotificationStatusOnIncidentCreated = status;
|
|
903
|
+
if (message !== undefined) {
|
|
904
|
+
item.subscriberNotificationStatusMessage = message;
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
render(badgeField!.getElement!(item));
|
|
908
|
+
|
|
909
|
+
const badges: Array<Record<string, unknown>> =
|
|
910
|
+
recordedProps["SubscriberNotificationStatus"] || [];
|
|
911
|
+
return badges[badges.length - 1] as BadgeProps;
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
test("names the hidden-from-status-pages skip in the badge", async () => {
|
|
915
|
+
serve({});
|
|
916
|
+
renderPage();
|
|
917
|
+
await waitForPage();
|
|
918
|
+
|
|
919
|
+
const badge: BadgeProps = renderBadge(
|
|
920
|
+
StatusPageSubscriberNotificationStatus.Skipped,
|
|
921
|
+
IncidentCreatedRenotify.hiddenFromStatusPagesMessage,
|
|
922
|
+
);
|
|
923
|
+
|
|
924
|
+
expect(badge.statusText).toBe(
|
|
925
|
+
IncidentCreatedRenotify.hiddenFromStatusPagesLabel,
|
|
926
|
+
);
|
|
927
|
+
// The full reason is still there behind "more details".
|
|
928
|
+
expect(badge.subscriberNotificationStatusMessage).toBe(
|
|
929
|
+
IncidentCreatedRenotify.hiddenFromStatusPagesMessage,
|
|
930
|
+
);
|
|
931
|
+
});
|
|
932
|
+
|
|
933
|
+
test.each([
|
|
934
|
+
[
|
|
935
|
+
"another skip reason",
|
|
936
|
+
StatusPageSubscriberNotificationStatus.Skipped,
|
|
937
|
+
"No monitors are attached to this incident. Skipping notifications to subscribers.",
|
|
938
|
+
],
|
|
939
|
+
[
|
|
940
|
+
"a skip without a reason",
|
|
941
|
+
StatusPageSubscriberNotificationStatus.Skipped,
|
|
942
|
+
undefined,
|
|
943
|
+
],
|
|
944
|
+
[
|
|
945
|
+
"a pending notification",
|
|
946
|
+
StatusPageSubscriberNotificationStatus.Pending,
|
|
947
|
+
IncidentCreatedRenotify.queuedMessage,
|
|
948
|
+
],
|
|
949
|
+
[
|
|
950
|
+
"a sent notification",
|
|
951
|
+
StatusPageSubscriberNotificationStatus.Success,
|
|
952
|
+
"Notifications sent successfully to all subscribers",
|
|
953
|
+
],
|
|
954
|
+
] as Array<
|
|
955
|
+
[string, StatusPageSubscriberNotificationStatus, string | undefined]
|
|
956
|
+
>)(
|
|
957
|
+
"keeps the badge's own label for %s",
|
|
958
|
+
async (
|
|
959
|
+
_label: string,
|
|
960
|
+
status: StatusPageSubscriberNotificationStatus,
|
|
961
|
+
message: string | undefined,
|
|
962
|
+
) => {
|
|
963
|
+
serve({});
|
|
964
|
+
renderPage();
|
|
965
|
+
await waitForPage();
|
|
966
|
+
|
|
967
|
+
expect(renderBadge(status, message).statusText).toBeUndefined();
|
|
968
|
+
},
|
|
969
|
+
);
|
|
970
|
+
});
|