@oneuptime/common 14.0.106 → 14.0.107
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/AnalyticsModels/AuditLog.js +1 -1
- package/Models/AnalyticsModels/Index.js +3 -0
- package/Models/AnalyticsModels/RumProductAnalyticsEvent.d.mts +5 -0
- package/Models/AnalyticsModels/RumProductAnalyticsEvent.d.ts +5 -0
- package/Models/AnalyticsModels/RumProductAnalyticsEvent.js +300 -0
- package/Models/AnalyticsModels/RumProductAnalyticsEvent.mjs +3 -0
- package/Models/DatabaseModels/CallLog.d.mts +4 -0
- package/Models/DatabaseModels/CallLog.d.ts +4 -0
- package/Models/DatabaseModels/CallLog.js +85 -0
- package/Models/DatabaseModels/DataBiConnection.d.mts +3 -0
- package/Models/DatabaseModels/DataBiConnection.d.ts +3 -0
- package/Models/DatabaseModels/DataBiConnection.js +47 -1
- package/Models/DatabaseModels/DataDashboard.d.mts +10 -0
- package/Models/DatabaseModels/DataDashboard.d.ts +10 -0
- package/Models/DatabaseModels/DataDashboard.js +129 -2
- package/Models/DatabaseModels/Index.js +6 -0
- package/Models/DatabaseModels/NetworkDevice.d.mts +1 -0
- package/Models/DatabaseModels/NetworkDevice.d.ts +1 -0
- package/Models/DatabaseModels/NetworkDevice.js +55 -0
- package/Models/DatabaseModels/NetworkDeviceNamingRule.d.mts +26 -0
- package/Models/DatabaseModels/NetworkDeviceNamingRule.d.ts +26 -0
- package/Models/DatabaseModels/NetworkDeviceNamingRule.js +536 -0
- package/Models/DatabaseModels/NetworkDeviceNamingRule.mjs +2 -0
- package/Models/DatabaseModels/NetworkSite.d.mts +1 -0
- package/Models/DatabaseModels/NetworkSite.d.ts +1 -0
- package/Models/DatabaseModels/NetworkSite.js +51 -0
- package/Models/DatabaseModels/OnCallDutyPolicyExecutionLogTimeline.d.mts +2 -0
- package/Models/DatabaseModels/OnCallDutyPolicyExecutionLogTimeline.d.ts +2 -0
- package/Models/DatabaseModels/OnCallDutyPolicyExecutionLogTimeline.js +41 -0
- package/Models/DatabaseModels/ProjectCallSMSConfig.d.mts +2 -0
- package/Models/DatabaseModels/ProjectCallSMSConfig.d.ts +2 -0
- package/Models/DatabaseModels/ProjectCallSMSConfig.js +80 -1
- package/Models/DatabaseModels/RumApplication.d.mts +2 -0
- package/Models/DatabaseModels/RumApplication.d.ts +2 -0
- package/Models/DatabaseModels/RumApplication.js +108 -0
- package/Models/DatabaseModels/Team.js +10 -2
- package/Models/DatabaseModels/TeamComplianceSetting.js +8 -1
- package/Models/DatabaseModels/TeamCustomRole.js +9 -1
- package/Models/DatabaseModels/TeamMember.js +15 -1
- package/Models/DatabaseModels/TeamOwnerTeam.d.mts +17 -0
- package/Models/DatabaseModels/TeamOwnerTeam.d.ts +17 -0
- package/Models/DatabaseModels/TeamOwnerTeam.js +325 -0
- package/Models/DatabaseModels/TeamOwnerTeam.mjs +2 -0
- package/Models/DatabaseModels/TeamOwnerUser.d.mts +17 -0
- package/Models/DatabaseModels/TeamOwnerUser.d.ts +17 -0
- package/Models/DatabaseModels/TeamOwnerUser.js +331 -0
- package/Models/DatabaseModels/TeamOwnerUser.mjs +2 -0
- package/Models/DatabaseModels/TeamPermission.js +12 -1
- package/Models/DatabaseModels/TelemetryUsageBilling.d.mts +1 -0
- package/Models/DatabaseModels/TelemetryUsageBilling.d.ts +1 -0
- package/Models/DatabaseModels/TelemetryUsageBilling.js +34 -0
- package/Types/AI/AIActionWords.d.mts +1 -0
- package/Types/AI/AIActionWords.d.ts +1 -0
- package/Types/AI/AIActionWords.js +15 -4
- package/Types/AI/AIChatRecordSeen.d.mts +3 -0
- package/Types/AI/AIChatRecordSeen.d.ts +3 -0
- package/Types/AI/AIChatRecordSeen.js +28 -3
- package/Types/AI/AIChatRecordSeen.mjs +1 -0
- package/Types/AnalyticsDatabase/AnalyticsTableName.d.mts +2 -1
- package/Types/AnalyticsDatabase/AnalyticsTableName.d.ts +2 -1
- package/Types/AnalyticsDatabase/AnalyticsTableName.js +7 -0
- package/Types/AuditLog/AuditLogRetention.d.mts +10 -0
- package/Types/AuditLog/AuditLogRetention.d.ts +10 -0
- package/Types/AuditLog/AuditLogRetention.js +91 -0
- package/Types/AuditLog/AuditLogRetention.mjs +8 -0
- package/Types/CallAndSMS/TwilioConfigDefaults.d.mts +37 -0
- package/Types/CallAndSMS/TwilioConfigDefaults.d.ts +37 -0
- package/Types/CallAndSMS/TwilioConfigDefaults.js +224 -0
- package/Types/CallAndSMS/TwilioConfigDefaults.mjs +3 -0
- package/Types/CodeRepository/CodeFileSeen.d.mts +3 -0
- package/Types/CodeRepository/CodeFileSeen.d.ts +3 -0
- package/Types/CodeRepository/CodeFileSeen.js +61 -3
- package/Types/DataObservability/DataDashboardActivity.d.mts +40 -0
- package/Types/DataObservability/DataDashboardActivity.d.ts +40 -0
- package/Types/DataObservability/DataDashboardActivity.js +119 -0
- package/Types/DataObservability/DataDashboardActivity.mjs +12 -0
- package/Types/DataObservability/DataObservabilityApiTypes.d.mts +7 -0
- package/Types/DataObservability/DataObservabilityApiTypes.d.ts +7 -0
- package/Types/DataObservability/DataObservabilityApiTypes.js +2 -0
- package/Types/DataObservability/DataTableLineage.d.mts +87 -0
- package/Types/DataObservability/DataTableLineage.d.ts +87 -0
- package/Types/DataObservability/DataTableLineage.js +111 -0
- package/Types/DataObservability/DataTableLineage.mjs +19 -0
- package/Types/DataSecurity/DataStoreKind.d.mts +1 -0
- package/Types/DataSecurity/DataStoreKind.d.ts +1 -0
- package/Types/DataSecurity/DataStoreKind.js +3 -0
- package/Types/Database/AccessControl/PermissionScopeNarrowing.js +6 -0
- package/Types/DatabaseServer/DatabaseServerMetricCatalog.js +71 -82
- package/Types/Date.d.mts +4 -0
- package/Types/Date.d.ts +4 -0
- package/Types/Date.js +47 -2
- package/Types/Date.mjs +2 -0
- package/Types/DateLanguage.d.mts +9 -0
- package/Types/DateLanguage.d.ts +9 -0
- package/Types/DateLanguage.js +79 -1
- package/Types/DateLanguage.mjs +4 -0
- package/Types/MessageQueue/MessageQueueMetricCatalog.js +61 -61
- package/Types/Monitor/CriteriaFilterTerms.d.mts +4 -0
- package/Types/Monitor/CriteriaFilterTerms.d.ts +4 -0
- package/Types/Monitor/CriteriaFilterTerms.js +166 -0
- package/Types/Monitor/CriteriaFilterTerms.mjs +4 -0
- package/Types/Monitor/EvaluationSentence.d.mts +37 -0
- package/Types/Monitor/EvaluationSentence.d.ts +37 -0
- package/Types/Monitor/EvaluationSentence.js +298 -0
- package/Types/Monitor/EvaluationSentence.mjs +12 -0
- package/Types/Monitor/MonitorCriteria.d.mts +2 -0
- package/Types/Monitor/MonitorCriteria.d.ts +2 -0
- package/Types/Monitor/MonitorCriteria.js +8 -0
- package/Types/Monitor/MonitorCriteriaInstance.d.mts +5 -0
- package/Types/Monitor/MonitorCriteriaInstance.d.ts +5 -0
- package/Types/Monitor/MonitorCriteriaInstance.js +243 -194
- package/Types/Monitor/MonitorEvaluationDetails.d.mts +2 -0
- package/Types/Monitor/MonitorEvaluationDetails.d.ts +2 -0
- package/Types/Monitor/MonitorEvaluationSummary.d.mts +4 -0
- package/Types/Monitor/MonitorEvaluationSummary.d.ts +4 -0
- package/Types/Monitor/MonitorStep.d.mts +2 -0
- package/Types/Monitor/MonitorStep.d.ts +2 -0
- package/Types/Monitor/MonitorSteps.d.mts +2 -0
- package/Types/Monitor/MonitorSteps.d.ts +2 -0
- package/Types/Monitor/MonitorType.d.mts +1 -0
- package/Types/Monitor/MonitorType.d.ts +1 -0
- package/Types/Monitor/MonitorType.js +12 -0
- package/Types/Monitor/TelemetryObservation.d.mts +15 -0
- package/Types/Monitor/TelemetryObservation.d.ts +15 -0
- package/Types/Monitor/TelemetryObservation.js +28 -0
- package/Types/Monitor/TelemetryObservation.mjs +2 -0
- package/Types/NetworkDevice/DeviceNaming.d.mts +87 -0
- package/Types/NetworkDevice/DeviceNaming.d.ts +87 -0
- package/Types/NetworkDevice/DeviceNaming.js +279 -0
- package/Types/NetworkDevice/DeviceNaming.mjs +24 -0
- package/Types/NetworkDevice/DiscoveredDevice.d.mts +1 -0
- package/Types/NetworkDevice/DiscoveredDevice.d.ts +1 -0
- package/Types/NetworkDevice/DiscoveredDevice.js +4 -0
- package/Types/OnCallDutyPolicy/OnCallPageChannel.d.mts +68 -0
- package/Types/OnCallDutyPolicy/OnCallPageChannel.d.ts +68 -0
- package/Types/OnCallDutyPolicy/OnCallPageChannel.js +351 -0
- package/Types/OnCallDutyPolicy/OnCallPageChannel.mjs +15 -0
- package/Types/Permission.d.mts +5 -0
- package/Types/Permission.d.ts +5 -0
- package/Types/Permission.js +61 -5
- package/Types/Rules/RuleCriteriaFieldRegistry.js +12 -0
- package/Types/Rules/RuleCriteriaSubject.js +1 -0
- package/Types/Rum/ProductAnalyticsEventReads.d.mts +115 -0
- package/Types/Rum/ProductAnalyticsEventReads.d.ts +115 -0
- package/Types/Rum/ProductAnalyticsEventReads.js +166 -0
- package/Types/Rum/ProductAnalyticsEventReads.mjs +27 -0
- package/Types/Rum/ProductAnalyticsEvents.d.mts +121 -0
- package/Types/Rum/ProductAnalyticsEvents.d.ts +121 -0
- package/Types/Rum/ProductAnalyticsEvents.js +477 -0
- package/Types/Rum/ProductAnalyticsEvents.mjs +40 -0
- package/Types/Rum/SessionReplay.d.mts +4 -0
- package/Types/Rum/SessionReplay.d.ts +4 -0
- package/Types/Rum/SessionReplayHealth.js +1 -1
- package/Types/ServiceLevelObjective/SloErrorBudgetPolicyChange.d.mts +10 -0
- package/Types/ServiceLevelObjective/SloErrorBudgetPolicyChange.d.ts +10 -0
- package/Types/ServiceLevelObjective/SloErrorBudgetPolicyChange.js +51 -0
- package/Types/ServiceLevelObjective/SloErrorBudgetPolicyChange.mjs +4 -0
- package/Types/Team/BuiltInTeam.d.mts +1 -0
- package/Types/Team/BuiltInTeam.d.ts +1 -0
- package/Types/Team/BuiltInTeam.js +14 -1
- package/Types/Team/BuiltInTeam.mjs +1 -0
- package/Types/Telemetry/TelemetryUsage.d.mts +7 -2
- package/Types/Telemetry/TelemetryUsage.d.ts +7 -2
- package/Types/Telemetry/TelemetryUsage.js +24 -5
- package/Types/Telemetry/TelemetryUsage.mjs +3 -0
- package/Types/UserNotification/UserNotificationStatus.d.mts +2 -1
- package/Types/UserNotification/UserNotificationStatus.d.ts +2 -1
- package/Types/UserNotification/UserNotificationStatus.js +8 -0
- package/Types/Workspace/NotificationRules/EventType.d.mts +2 -1
- package/Types/Workspace/NotificationRules/EventType.d.ts +2 -1
- package/Types/Workspace/NotificationRules/EventType.js +8 -0
- package/Types/Workspace/NotificationRules/NotificationRuleCondition.d.mts +7 -1
- package/Types/Workspace/NotificationRules/NotificationRuleCondition.d.ts +7 -1
- package/Types/Workspace/NotificationRules/NotificationRuleInvites.js +5 -1
- package/Types/Workspace/NotificationRules/NotificationRuleTypes/ServiceLevelObjectiveNotificationRule.d.mts +4 -0
- package/Types/Workspace/NotificationRules/NotificationRuleTypes/ServiceLevelObjectiveNotificationRule.d.ts +4 -0
- package/Types/Workspace/NotificationRules/NotificationRuleTypes/ServiceLevelObjectiveNotificationRule.js +2 -0
- package/Types/Workspace/NotificationRules/NotificationRuleTypes/ServiceLevelObjectiveNotificationRule.mjs +1 -0
- package/Utils/AI/InvestigationReport.js +93 -21
- package/Utils/AI/InvestigationReportLanguages.d.mts +25 -0
- package/Utils/AI/InvestigationReportLanguages.d.ts +25 -0
- package/Utils/AI/InvestigationReportLanguages.js +603 -0
- package/Utils/AI/InvestigationReportLanguages.mjs +11 -0
- package/Utils/Dashboard/TableThresholds.js +5 -2
- package/Utils/Monitor/MonitorLogSummaryUtil.d.mts +8 -0
- package/Utils/Monitor/MonitorLogSummaryUtil.d.ts +8 -0
- package/Utils/Monitor/MonitorLogSummaryUtil.js +170 -0
- package/Utils/Monitor/MonitorRootCauseWording.d.mts +17 -0
- package/Utils/Monitor/MonitorRootCauseWording.d.ts +17 -0
- package/Utils/Monitor/MonitorRootCauseWording.js +242 -0
- package/Utils/Monitor/MonitorRootCauseWording.mjs +2 -0
- package/Utils/Monitor/MonitorSummarySnapshotUtil.d.mts +3 -0
- package/Utils/Monitor/MonitorSummarySnapshotUtil.d.ts +3 -0
- package/Utils/Monitor/MonitorSummarySnapshotUtil.js +5 -2
- package/Utils/NetworkDevice/Naming/DeviceNamingPlanner.d.mts +75 -0
- package/Utils/NetworkDevice/Naming/DeviceNamingPlanner.d.ts +75 -0
- package/Utils/NetworkDevice/Naming/DeviceNamingPlanner.js +303 -0
- package/Utils/NetworkDevice/Naming/DeviceNamingPlanner.mjs +8 -0
- package/Utils/NetworkDevice/Naming/NamePattern.d.mts +122 -0
- package/Utils/NetworkDevice/Naming/NamePattern.d.ts +122 -0
- package/Utils/NetworkDevice/Naming/NamePattern.js +649 -0
- package/Utils/NetworkDevice/Naming/NamePattern.mjs +22 -0
- package/Utils/NetworkDevice/Naming/NamingLookup.d.mts +77 -0
- package/Utils/NetworkDevice/Naming/NamingLookup.d.ts +77 -0
- package/Utils/NetworkDevice/Naming/NamingLookup.js +467 -0
- package/Utils/NetworkDevice/Naming/NamingLookup.mjs +14 -0
- package/Utils/NetworkDevice/Naming/NamingRuleMatcher.d.mts +26 -0
- package/Utils/NetworkDevice/Naming/NamingRuleMatcher.d.ts +26 -0
- package/Utils/NetworkDevice/Naming/NamingRuleMatcher.js +327 -0
- package/Utils/NetworkDevice/Naming/NamingRuleMatcher.mjs +7 -0
- package/Utils/NetworkDiscovery/DiscoveredNameUpgrade.d.mts +1 -0
- package/Utils/NetworkDiscovery/DiscoveredNameUpgrade.d.ts +1 -0
- package/Utils/NetworkDiscovery/DiscoveredNameUpgrade.js +8 -0
- package/Utils/NetworkDiscovery/PingMonitorBuilder.d.mts +2 -0
- package/Utils/NetworkDiscovery/PingMonitorBuilder.d.ts +2 -0
- package/Utils/NetworkDiscovery/PingMonitorBuilder.js +1 -0
- package/Utils/{Rum → SessionReplay}/SessionReplayHealth.d.mts +7 -6
- package/Utils/{Rum → SessionReplay}/SessionReplayHealth.d.ts +7 -6
- package/Utils/SessionReplay/SessionReplayHealth.js +703 -0
- package/Utils/Slo/SloErrorBudgetPolicy.d.mts +7 -0
- package/Utils/Slo/SloErrorBudgetPolicy.d.ts +7 -0
- package/Utils/Slo/SloErrorBudgetPolicy.js +39 -0
- package/Utils/Slo/SloErrorBudgetPolicy.mjs +1 -0
- package/Utils/Slo/SloFeedMarkdown.d.mts +19 -4
- package/Utils/Slo/SloFeedMarkdown.d.ts +19 -4
- package/Utils/Slo/SloFeedMarkdown.js +64 -17
- package/Utils/Slo/SloFeedMarkdown.mjs +4 -0
- package/Utils/StatusPage/ResourceExplorer.js +9 -8
- package/Utils/TotpSetupKey.d.mts +3 -0
- package/Utils/TotpSetupKey.d.ts +3 -0
- package/Utils/TotpSetupKey.js +72 -0
- package/Utils/TotpSetupKey.mjs +4 -0
- package/Utils/Workspace/WorkspaceChannelName.js +5 -1
- package/package.json +1 -1
- package/Utils/Rum/SessionReplayHealth.js +0 -558
- /package/Utils/{Rum → SessionReplay}/SessionReplayHealth.mjs +0 -0
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.TWILIO_MESSAGE_KINDS = void 0;
|
|
7
|
+
const TwilioConfigUse_1 = __importDefault(require("./TwilioConfigUse"));
|
|
8
|
+
const TwilioAccount_1 = require("../../Utils/Project/TwilioAccount");
|
|
9
|
+
/*
|
|
10
|
+
* WHICH OF A PROJECT'S TWILIO CONFIGS ITS SMS GO THROUGH, AND WHICH ITS CALLS.
|
|
11
|
+
*
|
|
12
|
+
* SMS and calls to the people in a project - on-call alerts, notifications,
|
|
13
|
+
* verification codes - go through the project's default Twilio config. A
|
|
14
|
+
* config is used for calls and SMS, for SMS only or for calls only
|
|
15
|
+
* (TwilioConfigUse), and a project used to have exactly one default. So a
|
|
16
|
+
* project whose numbers could not do both - in some countries no one number
|
|
17
|
+
* does, and Twilio sells numbers for calls only and numbers for SMS only -
|
|
18
|
+
* made a config for each, and then could make only one of them its default:
|
|
19
|
+
* making the calls config the default took the default from the SMS config,
|
|
20
|
+
* and its SMS went through OneUptime's own account (issue #6574).
|
|
21
|
+
*
|
|
22
|
+
* So a project has a default for SMS and a default for calls, and a config
|
|
23
|
+
* is the default for what it is used for:
|
|
24
|
+
*
|
|
25
|
+
* - Set as Project Default (ProjectCallSMSConfig.isProjectDefault written
|
|
26
|
+
* true) makes a config the default for everything it is used for, and
|
|
27
|
+
* takes that - and only that - from the configs that had it. A config
|
|
28
|
+
* used for SMS only and one used for calls only are the default
|
|
29
|
+
* together; a config used for calls and SMS takes both;
|
|
30
|
+
* - a config keeps what it is the default for while it is a default and
|
|
31
|
+
* is used for it: a config made "SMS only" stops being the default for
|
|
32
|
+
* calls;
|
|
33
|
+
* - SMS or calls that no config is the default for go to a default config
|
|
34
|
+
* that is used for them: when the SMS default is deleted or stops being
|
|
35
|
+
* the default, a default config used for calls and SMS takes the SMS
|
|
36
|
+
* back, and a default that starts being used for calls too takes the
|
|
37
|
+
* calls when no config has them. Nothing moves from one config to
|
|
38
|
+
* another by itself;
|
|
39
|
+
* - a config that is the default for nothing is not a default.
|
|
40
|
+
*
|
|
41
|
+
* What a config is the default for is kept in isProjectDefaultForSms and
|
|
42
|
+
* isProjectDefaultForCalls, which only the server writes, by this rule,
|
|
43
|
+
* once a write has been saved (ProjectCallSMSConfigService); isProjectDefault
|
|
44
|
+
* reads true while it is the default for either. The senders read the
|
|
45
|
+
* default for the kind of message they send.
|
|
46
|
+
*
|
|
47
|
+
* Kept free of server and React code: the server, the dashboards and the
|
|
48
|
+
* tests read the same rule.
|
|
49
|
+
*/
|
|
50
|
+
// SMS first, as every list of the two in the product names them.
|
|
51
|
+
exports.TWILIO_MESSAGE_KINDS = [
|
|
52
|
+
TwilioAccount_1.TwilioMessageKind.SMS,
|
|
53
|
+
TwilioAccount_1.TwilioMessageKind.Call,
|
|
54
|
+
];
|
|
55
|
+
const isTrue = (value) => {
|
|
56
|
+
return value === true;
|
|
57
|
+
};
|
|
58
|
+
// Ids compared as the database compares them: a uuid in any case.
|
|
59
|
+
const sameId = (left, right) => {
|
|
60
|
+
return left.toLowerCase() === right.toLowerCase();
|
|
61
|
+
};
|
|
62
|
+
class TwilioConfigDefaults {
|
|
63
|
+
static getDefaultColumn(kind) {
|
|
64
|
+
return kind === TwilioAccount_1.TwilioMessageKind.SMS
|
|
65
|
+
? "isProjectDefaultForSms"
|
|
66
|
+
: "isProjectDefaultForCalls";
|
|
67
|
+
}
|
|
68
|
+
// Whether a config used for this sends this kind of message.
|
|
69
|
+
static isUsedFor(use, kind) {
|
|
70
|
+
return kind === TwilioAccount_1.TwilioMessageKind.SMS
|
|
71
|
+
? TwilioConfigUse_1.default.sendsSms(use)
|
|
72
|
+
: TwilioConfigUse_1.default.makesCalls(use);
|
|
73
|
+
}
|
|
74
|
+
// What a config used for this sends: SMS, calls, or both - SMS first.
|
|
75
|
+
static getKindsUsedFor(use) {
|
|
76
|
+
return exports.TWILIO_MESSAGE_KINDS.filter((kind) => {
|
|
77
|
+
return TwilioConfigDefaults.isUsedFor(use, kind);
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
// Whether the project's messages of this kind go through the config.
|
|
81
|
+
static isDefaultFor(config, kind) {
|
|
82
|
+
return isTrue(config[TwilioConfigDefaults.getDefaultColumn(kind)]);
|
|
83
|
+
}
|
|
84
|
+
// What the config is the project default for: SMS, calls, both or nothing.
|
|
85
|
+
static getDefaultKinds(config) {
|
|
86
|
+
return exports.TWILIO_MESSAGE_KINDS.filter((kind) => {
|
|
87
|
+
return TwilioConfigDefaults.isDefaultFor(config, kind);
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
/*
|
|
91
|
+
* What Set as Project Default would make the config the default for, that
|
|
92
|
+
* it is not yet: everything it is used for, less what it already is the
|
|
93
|
+
* default for. Empty when it is the default for everything it is used for.
|
|
94
|
+
*/
|
|
95
|
+
static getKindsToTake(config) {
|
|
96
|
+
return TwilioConfigDefaults.getKindsUsedFor(config.use).filter((kind) => {
|
|
97
|
+
return !TwilioConfigDefaults.isDefaultFor(config, kind);
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
/*
|
|
101
|
+
* THE RULE. Given every config of one project as it stands once a write
|
|
102
|
+
* has been saved - in the order they were made - and the configs that
|
|
103
|
+
* write made the default, what each config should hold:
|
|
104
|
+
*
|
|
105
|
+
* 1. a config the write made the default takes everything it is used
|
|
106
|
+
* for (of several made the default by one write, the first takes
|
|
107
|
+
* what both are used for);
|
|
108
|
+
* 2. a config keeps what it is the default for, while it is a default
|
|
109
|
+
* and is used for it;
|
|
110
|
+
* 3. what no config is the default for goes to a default used for it;
|
|
111
|
+
* 4. a config that is the default for nothing is not a default.
|
|
112
|
+
*
|
|
113
|
+
* A config the write made the default that no longer reads as one - a
|
|
114
|
+
* later write turned it off - takes nothing: what the table holds now is
|
|
115
|
+
* what counts.
|
|
116
|
+
*/
|
|
117
|
+
static getProjectDefaults(data) {
|
|
118
|
+
const madeDefaultIds = data.madeDefaultIds || [];
|
|
119
|
+
const isMadeDefault = (config) => {
|
|
120
|
+
return (isTrue(config.isProjectDefault) &&
|
|
121
|
+
madeDefaultIds.some((id) => {
|
|
122
|
+
return sameId(id, config.id);
|
|
123
|
+
}));
|
|
124
|
+
};
|
|
125
|
+
// The config each kind of message goes through, by its id.
|
|
126
|
+
const holders = new Map();
|
|
127
|
+
// 1. Taken by a config the write made the default.
|
|
128
|
+
for (const config of data.configs) {
|
|
129
|
+
if (!isMadeDefault(config)) {
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
for (const kind of TwilioConfigDefaults.getKindsUsedFor(config.use)) {
|
|
133
|
+
if (!holders.has(kind)) {
|
|
134
|
+
holders.set(kind, config.id);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
// 2. Kept by the config that is the default for it, while it still can be.
|
|
139
|
+
for (const kind of exports.TWILIO_MESSAGE_KINDS) {
|
|
140
|
+
if (holders.has(kind)) {
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
143
|
+
const keeper = data.configs.find((config) => {
|
|
144
|
+
return (isTrue(config.isProjectDefault) &&
|
|
145
|
+
TwilioConfigDefaults.isDefaultFor(config, kind) &&
|
|
146
|
+
TwilioConfigDefaults.isUsedFor(config.use, kind));
|
|
147
|
+
});
|
|
148
|
+
if (keeper) {
|
|
149
|
+
holders.set(kind, keeper.id);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
// 3. Left to nobody: a default used for it takes it.
|
|
153
|
+
for (const kind of exports.TWILIO_MESSAGE_KINDS) {
|
|
154
|
+
if (holders.has(kind)) {
|
|
155
|
+
continue;
|
|
156
|
+
}
|
|
157
|
+
const taker = data.configs.find((config) => {
|
|
158
|
+
return (isTrue(config.isProjectDefault) &&
|
|
159
|
+
TwilioConfigDefaults.isUsedFor(config.use, kind));
|
|
160
|
+
});
|
|
161
|
+
if (taker) {
|
|
162
|
+
holders.set(kind, taker.id);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
// 4. Each config's flags; a default for nothing is not a default.
|
|
166
|
+
const defaults = new Map();
|
|
167
|
+
for (const config of data.configs) {
|
|
168
|
+
const isProjectDefaultForSms = holders.get(TwilioAccount_1.TwilioMessageKind.SMS) === config.id;
|
|
169
|
+
const isProjectDefaultForCalls = holders.get(TwilioAccount_1.TwilioMessageKind.Call) === config.id;
|
|
170
|
+
defaults.set(config.id, {
|
|
171
|
+
isProjectDefault: isProjectDefaultForSms || isProjectDefaultForCalls,
|
|
172
|
+
isProjectDefaultForSms,
|
|
173
|
+
isProjectDefaultForCalls,
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
return defaults;
|
|
177
|
+
}
|
|
178
|
+
/*
|
|
179
|
+
* The writes that bring the configs to what the rule says, in the order
|
|
180
|
+
* they are made: first every config gives up what it is no longer the
|
|
181
|
+
* default for, then each takes what it newly is. So no two configs are
|
|
182
|
+
* the default for one kind of message while the writes are made one by
|
|
183
|
+
* one - not even when two configs swap what they hold (one made "SMS
|
|
184
|
+
* only" and the default in one write, while the other default takes its
|
|
185
|
+
* calls). A config that only gives something up, or only takes, is
|
|
186
|
+
* written once; one that does both, twice. A config whose flags stay as
|
|
187
|
+
* they are is not written.
|
|
188
|
+
*/
|
|
189
|
+
static getProjectDefaultChanges(data) {
|
|
190
|
+
const defaults = TwilioConfigDefaults.getProjectDefaults(data);
|
|
191
|
+
const givingUp = [];
|
|
192
|
+
const taking = [];
|
|
193
|
+
for (const config of data.configs) {
|
|
194
|
+
const flags = defaults.get(config.id);
|
|
195
|
+
if (!flags) {
|
|
196
|
+
continue;
|
|
197
|
+
}
|
|
198
|
+
const stored = {
|
|
199
|
+
isProjectDefault: isTrue(config.isProjectDefault),
|
|
200
|
+
isProjectDefaultForSms: isTrue(config.isProjectDefaultForSms),
|
|
201
|
+
isProjectDefaultForCalls: isTrue(config.isProjectDefaultForCalls),
|
|
202
|
+
};
|
|
203
|
+
// What it holds both now and once settled: what it keeps.
|
|
204
|
+
const kept = {
|
|
205
|
+
isProjectDefault: stored.isProjectDefault && flags.isProjectDefault,
|
|
206
|
+
isProjectDefaultForSms: stored.isProjectDefaultForSms && flags.isProjectDefaultForSms,
|
|
207
|
+
isProjectDefaultForCalls: stored.isProjectDefaultForCalls && flags.isProjectDefaultForCalls,
|
|
208
|
+
};
|
|
209
|
+
if (!areSameFlags(kept, stored)) {
|
|
210
|
+
givingUp.push({ id: config.id, flags: kept });
|
|
211
|
+
}
|
|
212
|
+
if (!areSameFlags(flags, kept)) {
|
|
213
|
+
taking.push({ id: config.id, flags: flags });
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
return [...givingUp, ...taking];
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
exports.default = TwilioConfigDefaults;
|
|
220
|
+
function areSameFlags(left, right) {
|
|
221
|
+
return (left.isProjectDefault === right.isProjectDefault &&
|
|
222
|
+
left.isProjectDefaultForSms === right.isProjectDefaultForSms &&
|
|
223
|
+
left.isProjectDefaultForCalls === right.isProjectDefaultForCalls);
|
|
224
|
+
}
|
|
@@ -40,6 +40,7 @@ type CodeFileViewsFunction = (data: {
|
|
|
40
40
|
records: ReadonlyArray<unknown> | null | undefined;
|
|
41
41
|
repositoryId: string;
|
|
42
42
|
filePath: string;
|
|
43
|
+
inHandOnly?: boolean | undefined;
|
|
43
44
|
}) => Array<CodeFileView>;
|
|
44
45
|
export declare const getCodeFileViews: CodeFileViewsFunction;
|
|
45
46
|
export type CodeFileOnBranch = {
|
|
@@ -55,6 +56,7 @@ export declare enum CodeFileUnseen {
|
|
|
55
56
|
ChangedSinceRead = "ChangedSinceRead",
|
|
56
57
|
ReadOnAnotherBranch = "ReadOnAnotherBranch",
|
|
57
58
|
NotRead = "NotRead",
|
|
59
|
+
ReadInEarlierAnswer = "ReadInEarlierAnswer",
|
|
58
60
|
ReadInPart = "ReadInPart",
|
|
59
61
|
NotChecked = "NotChecked",
|
|
60
62
|
ValuesHidden = "ValuesHidden"
|
|
@@ -72,6 +74,7 @@ type FindCodeFileUnseenFunction = (data: {
|
|
|
72
74
|
views: ReadonlyArray<CodeFileView>;
|
|
73
75
|
branchName: string;
|
|
74
76
|
now: CodeFileOnBranch;
|
|
77
|
+
viewsInHand?: ReadonlyArray<CodeFileView> | undefined;
|
|
75
78
|
}) => Omit<CodeFileUnseenFinding, "filePath"> | null;
|
|
76
79
|
export declare const findCodeFileUnseen: FindCodeFileUnseenFunction;
|
|
77
80
|
type FindCodeFilesUnseenFunction = (data: {
|
|
@@ -40,6 +40,7 @@ type CodeFileViewsFunction = (data: {
|
|
|
40
40
|
records: ReadonlyArray<unknown> | null | undefined;
|
|
41
41
|
repositoryId: string;
|
|
42
42
|
filePath: string;
|
|
43
|
+
inHandOnly?: boolean | undefined;
|
|
43
44
|
}) => Array<CodeFileView>;
|
|
44
45
|
export declare const getCodeFileViews: CodeFileViewsFunction;
|
|
45
46
|
export type CodeFileOnBranch = {
|
|
@@ -55,6 +56,7 @@ export declare enum CodeFileUnseen {
|
|
|
55
56
|
ChangedSinceRead = "ChangedSinceRead",
|
|
56
57
|
ReadOnAnotherBranch = "ReadOnAnotherBranch",
|
|
57
58
|
NotRead = "NotRead",
|
|
59
|
+
ReadInEarlierAnswer = "ReadInEarlierAnswer",
|
|
58
60
|
ReadInPart = "ReadInPart",
|
|
59
61
|
NotChecked = "NotChecked",
|
|
60
62
|
ValuesHidden = "ValuesHidden"
|
|
@@ -72,6 +74,7 @@ type FindCodeFileUnseenFunction = (data: {
|
|
|
72
74
|
views: ReadonlyArray<CodeFileView>;
|
|
73
75
|
branchName: string;
|
|
74
76
|
now: CodeFileOnBranch;
|
|
77
|
+
viewsInHand?: ReadonlyArray<CodeFileView> | undefined;
|
|
75
78
|
}) => Omit<CodeFileUnseenFinding, "filePath"> | null;
|
|
76
79
|
export declare const findCodeFileUnseen: FindCodeFileUnseenFunction;
|
|
77
80
|
type FindCodeFilesUnseenFunction = (data: {
|
|
@@ -43,6 +43,14 @@ const CodeFileValuesHidden_1 = require("./CodeFileValuesHidden");
|
|
|
43
43
|
* unseen. A commit of Ask AI's own wrote all of a file, and a citation
|
|
44
44
|
* from before OneUptime kept lines reads as all of it.
|
|
45
45
|
*
|
|
46
|
+
* And a version Ask AI saw is one it still has only in the turn that read
|
|
47
|
+
* it (issue #6365): a new turn replays the earlier turns' answers, never the
|
|
48
|
+
* files their tools read. A record from an earlier answer still says what
|
|
49
|
+
* Ask AI saw of the version - a change since is still a change since - but
|
|
50
|
+
* only this turn's reads and writes count as the lines in hand. With none
|
|
51
|
+
* of the version in hand, Ask AI writes it from memory; with some, it
|
|
52
|
+
* reads it in part, as above.
|
|
53
|
+
*
|
|
46
54
|
* And a line Ask AI saw is not every value in it (issue #6364): what looks
|
|
47
55
|
* like a secret or personal data reads as a placeholder, "[redacted-ip]",
|
|
48
56
|
* so a version Ask AI writes whole puts the placeholder where the value
|
|
@@ -251,7 +259,8 @@ const getCodeFileViews = (data) => {
|
|
|
251
259
|
const record = (0, AIChatRecordSeen_1.readAIChatRecordSeen)(value);
|
|
252
260
|
if (!record ||
|
|
253
261
|
record.recordType !== AIChatRecordSeen_1.AIChatRecordSeenType.CodeFile ||
|
|
254
|
-
record.isPartial
|
|
262
|
+
record.isPartial ||
|
|
263
|
+
(data.inHandOnly && record.fromEarlierAnswer)) {
|
|
255
264
|
continue;
|
|
256
265
|
}
|
|
257
266
|
const address = (0, exports.readCodeFileRecordId)(record.recordId);
|
|
@@ -289,6 +298,13 @@ var CodeFileUnseen;
|
|
|
289
298
|
CodeFileUnseen["ReadOnAnotherBranch"] = "ReadOnAnotherBranch";
|
|
290
299
|
// Ask AI never saw it, and the branch has it.
|
|
291
300
|
CodeFileUnseen["NotRead"] = "NotRead";
|
|
301
|
+
/*
|
|
302
|
+
* Ask AI saw this version - read it, or wrote it itself - only in an
|
|
303
|
+
* earlier answer (issue #6365), and no longer has its text: a new turn
|
|
304
|
+
* replays the answers, never the files. The change writes all of it from
|
|
305
|
+
* memory.
|
|
306
|
+
*/
|
|
307
|
+
CodeFileUnseen["ReadInEarlierAnswer"] = "ReadInEarlierAnswer";
|
|
292
308
|
/*
|
|
293
309
|
* Ask AI saw this version, but only some of its lines (issue #6330): the
|
|
294
310
|
* change writes all of it, and drops what Ask AI never saw.
|
|
@@ -337,6 +353,33 @@ const findLinesNotRead = (data) => {
|
|
|
337
353
|
linesNotRead: linesNotRead,
|
|
338
354
|
};
|
|
339
355
|
};
|
|
356
|
+
/*
|
|
357
|
+
* What Ask AI does not have in front of it of a version it saw, to write
|
|
358
|
+
* it whole (issue #6365): the lines its views of that version showed in
|
|
359
|
+
* this turn - a view from an earlier answer says only that it saw the
|
|
360
|
+
* version. None of it in hand: read in an earlier answer.
|
|
361
|
+
*/
|
|
362
|
+
const findLinesNotInHand = (data) => {
|
|
363
|
+
if (!data.viewsInHand) {
|
|
364
|
+
return findLinesNotRead({
|
|
365
|
+
views: data.views,
|
|
366
|
+
fingerprint: data.fingerprint,
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
if (data.fingerprint === null) {
|
|
370
|
+
return null;
|
|
371
|
+
}
|
|
372
|
+
const fingerprint = data.fingerprint;
|
|
373
|
+
if (!data.viewsInHand.some((view) => {
|
|
374
|
+
return view.fingerprint === fingerprint;
|
|
375
|
+
})) {
|
|
376
|
+
return { unseen: CodeFileUnseen.ReadInEarlierAnswer };
|
|
377
|
+
}
|
|
378
|
+
return findLinesNotRead({
|
|
379
|
+
views: data.viewsInHand,
|
|
380
|
+
fingerprint: fingerprint,
|
|
381
|
+
});
|
|
382
|
+
};
|
|
340
383
|
/*
|
|
341
384
|
* What writing a file whole would undo that Ask AI never saw, or null for
|
|
342
385
|
* nothing: the rules at the top of this file. Ask AI's last view of the
|
|
@@ -354,7 +397,11 @@ const findCodeFileUnseen = (data) => {
|
|
|
354
397
|
});
|
|
355
398
|
if (onBranch) {
|
|
356
399
|
return onBranch.fingerprint === fingerprintNow
|
|
357
|
-
?
|
|
400
|
+
? findLinesNotInHand({
|
|
401
|
+
views: data.views,
|
|
402
|
+
viewsInHand: data.viewsInHand,
|
|
403
|
+
fingerprint: fingerprintNow,
|
|
404
|
+
})
|
|
358
405
|
: { unseen: CodeFileUnseen.ChangedSinceRead };
|
|
359
406
|
}
|
|
360
407
|
// Not on the branch: the change adds it, and undoes nothing.
|
|
@@ -367,7 +414,11 @@ const findCodeFileUnseen = (data) => {
|
|
|
367
414
|
if (elsewhere.some((view) => {
|
|
368
415
|
return view.fingerprint === fingerprintNow;
|
|
369
416
|
})) {
|
|
370
|
-
return
|
|
417
|
+
return findLinesNotInHand({
|
|
418
|
+
views: data.views,
|
|
419
|
+
viewsInHand: data.viewsInHand,
|
|
420
|
+
fingerprint: fingerprintNow,
|
|
421
|
+
});
|
|
371
422
|
}
|
|
372
423
|
let latestWithFile = null;
|
|
373
424
|
for (const view of elsewhere) {
|
|
@@ -396,6 +447,13 @@ const findCodeFilesUnseen = (data) => {
|
|
|
396
447
|
}),
|
|
397
448
|
branchName: data.branchName,
|
|
398
449
|
now: file.now,
|
|
450
|
+
// Only this turn's lines are in hand (issue #6365).
|
|
451
|
+
viewsInHand: (0, exports.getCodeFileViews)({
|
|
452
|
+
records: data.records,
|
|
453
|
+
repositoryId: data.repositoryId,
|
|
454
|
+
filePath: file.filePath,
|
|
455
|
+
inHandOnly: true,
|
|
456
|
+
}),
|
|
399
457
|
});
|
|
400
458
|
if (found) {
|
|
401
459
|
findings.push(Object.assign({ filePath: file.filePath }, found));
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export declare const DATA_DASHBOARD_USAGE_WINDOW_DAYS: number;
|
|
2
|
+
export declare const DATA_DASHBOARD_REFRESH_WINDOW_DAYS: number;
|
|
3
|
+
export declare const MAX_DATA_DASHBOARD_TOP_VIEWERS: number;
|
|
4
|
+
export declare const MAX_DATA_DASHBOARD_REFRESHES: number;
|
|
5
|
+
export declare enum DataBiRefreshStatus {
|
|
6
|
+
Completed = "Completed",
|
|
7
|
+
Failed = "Failed",
|
|
8
|
+
Cancelled = "Cancelled",
|
|
9
|
+
Disabled = "Disabled",
|
|
10
|
+
InProgress = "In Progress",
|
|
11
|
+
Unknown = "Unknown"
|
|
12
|
+
}
|
|
13
|
+
export declare const DATA_BI_REFRESH_STATUSES: ReadonlyArray<DataBiRefreshStatus>;
|
|
14
|
+
export interface DataDashboardViewer {
|
|
15
|
+
viewer: string;
|
|
16
|
+
views: number;
|
|
17
|
+
lastViewedAt: string;
|
|
18
|
+
}
|
|
19
|
+
export interface DataDashboardUsageSummary {
|
|
20
|
+
since: string | null;
|
|
21
|
+
topViewers: Array<DataDashboardViewer>;
|
|
22
|
+
}
|
|
23
|
+
export interface DataDashboardRefresh {
|
|
24
|
+
status: DataBiRefreshStatus;
|
|
25
|
+
startedAt: string | null;
|
|
26
|
+
endedAt: string | null;
|
|
27
|
+
type: string | null;
|
|
28
|
+
error: string | null;
|
|
29
|
+
}
|
|
30
|
+
export interface DataDashboardRefreshHistory {
|
|
31
|
+
last: DataDashboardRefresh | null;
|
|
32
|
+
refreshCount: number | null;
|
|
33
|
+
failureCount: number | null;
|
|
34
|
+
refreshes: Array<DataDashboardRefresh>;
|
|
35
|
+
}
|
|
36
|
+
export declare function readDataBiRefreshStatus(value: unknown): DataBiRefreshStatus | null;
|
|
37
|
+
export declare function readDataDashboardRefresh(value: unknown): DataDashboardRefresh | null;
|
|
38
|
+
export declare function readDataDashboardRefreshHistory(value: unknown): DataDashboardRefreshHistory | null;
|
|
39
|
+
export declare function readDataDashboardUsageSummary(value: unknown): DataDashboardUsageSummary | null;
|
|
40
|
+
export declare function getDataDashboardRefreshTime(refresh: DataDashboardRefresh | null): string | null;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export declare const DATA_DASHBOARD_USAGE_WINDOW_DAYS: number;
|
|
2
|
+
export declare const DATA_DASHBOARD_REFRESH_WINDOW_DAYS: number;
|
|
3
|
+
export declare const MAX_DATA_DASHBOARD_TOP_VIEWERS: number;
|
|
4
|
+
export declare const MAX_DATA_DASHBOARD_REFRESHES: number;
|
|
5
|
+
export declare enum DataBiRefreshStatus {
|
|
6
|
+
Completed = "Completed",
|
|
7
|
+
Failed = "Failed",
|
|
8
|
+
Cancelled = "Cancelled",
|
|
9
|
+
Disabled = "Disabled",
|
|
10
|
+
InProgress = "In Progress",
|
|
11
|
+
Unknown = "Unknown"
|
|
12
|
+
}
|
|
13
|
+
export declare const DATA_BI_REFRESH_STATUSES: ReadonlyArray<DataBiRefreshStatus>;
|
|
14
|
+
export interface DataDashboardViewer {
|
|
15
|
+
viewer: string;
|
|
16
|
+
views: number;
|
|
17
|
+
lastViewedAt: string;
|
|
18
|
+
}
|
|
19
|
+
export interface DataDashboardUsageSummary {
|
|
20
|
+
since: string | null;
|
|
21
|
+
topViewers: Array<DataDashboardViewer>;
|
|
22
|
+
}
|
|
23
|
+
export interface DataDashboardRefresh {
|
|
24
|
+
status: DataBiRefreshStatus;
|
|
25
|
+
startedAt: string | null;
|
|
26
|
+
endedAt: string | null;
|
|
27
|
+
type: string | null;
|
|
28
|
+
error: string | null;
|
|
29
|
+
}
|
|
30
|
+
export interface DataDashboardRefreshHistory {
|
|
31
|
+
last: DataDashboardRefresh | null;
|
|
32
|
+
refreshCount: number | null;
|
|
33
|
+
failureCount: number | null;
|
|
34
|
+
refreshes: Array<DataDashboardRefresh>;
|
|
35
|
+
}
|
|
36
|
+
export declare function readDataBiRefreshStatus(value: unknown): DataBiRefreshStatus | null;
|
|
37
|
+
export declare function readDataDashboardRefresh(value: unknown): DataDashboardRefresh | null;
|
|
38
|
+
export declare function readDataDashboardRefreshHistory(value: unknown): DataDashboardRefreshHistory | null;
|
|
39
|
+
export declare function readDataDashboardUsageSummary(value: unknown): DataDashboardUsageSummary | null;
|
|
40
|
+
export declare function getDataDashboardRefreshTime(refresh: DataDashboardRefresh | null): string | null;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* HOW A BI DASHBOARD IS USED, AND HOW FRESH ITS DATA IS.
|
|
4
|
+
*
|
|
5
|
+
* Read from its tool with its dashboards (DataBiSync): how often people
|
|
6
|
+
* opened it in the last 28 days and who, and the latest refreshes of the
|
|
7
|
+
* data it charts. Power BI says both: views from its activity log, and
|
|
8
|
+
* refreshes from its datasets' refresh history. What is kept as JSON on a
|
|
9
|
+
* dashboard is read back through the readers below, which take anything and
|
|
10
|
+
* return what fits.
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.DATA_BI_REFRESH_STATUSES = exports.DataBiRefreshStatus = exports.MAX_DATA_DASHBOARD_REFRESHES = exports.MAX_DATA_DASHBOARD_TOP_VIEWERS = exports.DATA_DASHBOARD_REFRESH_WINDOW_DAYS = exports.DATA_DASHBOARD_USAGE_WINDOW_DAYS = void 0;
|
|
14
|
+
exports.readDataBiRefreshStatus = readDataBiRefreshStatus;
|
|
15
|
+
exports.readDataDashboardRefresh = readDataDashboardRefresh;
|
|
16
|
+
exports.readDataDashboardRefreshHistory = readDataDashboardRefreshHistory;
|
|
17
|
+
exports.readDataDashboardUsageSummary = readDataDashboardUsageSummary;
|
|
18
|
+
exports.getDataDashboardRefreshTime = getDataDashboardRefreshTime;
|
|
19
|
+
// The days a dashboard's views are counted over: as far back as Power BI's activity log reads.
|
|
20
|
+
exports.DATA_DASHBOARD_USAGE_WINDOW_DAYS = 28;
|
|
21
|
+
// The days a dataset's refreshes are counted over: as long as Power BI keeps them.
|
|
22
|
+
exports.DATA_DASHBOARD_REFRESH_WINDOW_DAYS = 7;
|
|
23
|
+
// The people listed as who views a dashboard most.
|
|
24
|
+
exports.MAX_DATA_DASHBOARD_TOP_VIEWERS = 10;
|
|
25
|
+
// The latest refreshes kept with a dashboard.
|
|
26
|
+
exports.MAX_DATA_DASHBOARD_REFRESHES = 10;
|
|
27
|
+
const MAX_TEXT_LENGTH = 500;
|
|
28
|
+
var DataBiRefreshStatus;
|
|
29
|
+
(function (DataBiRefreshStatus) {
|
|
30
|
+
DataBiRefreshStatus["Completed"] = "Completed";
|
|
31
|
+
DataBiRefreshStatus["Failed"] = "Failed";
|
|
32
|
+
DataBiRefreshStatus["Cancelled"] = "Cancelled";
|
|
33
|
+
// Turned off before it ran (Power BI's selective refresh).
|
|
34
|
+
DataBiRefreshStatus["Disabled"] = "Disabled";
|
|
35
|
+
DataBiRefreshStatus["InProgress"] = "In Progress";
|
|
36
|
+
DataBiRefreshStatus["Unknown"] = "Unknown";
|
|
37
|
+
})(DataBiRefreshStatus || (exports.DataBiRefreshStatus = DataBiRefreshStatus = {}));
|
|
38
|
+
exports.DATA_BI_REFRESH_STATUSES = Object.values(DataBiRefreshStatus);
|
|
39
|
+
function readObject(value) {
|
|
40
|
+
return value && typeof value === "object" && !Array.isArray(value)
|
|
41
|
+
? value
|
|
42
|
+
: null;
|
|
43
|
+
}
|
|
44
|
+
function readText(value) {
|
|
45
|
+
return typeof value === "string" && value.trim()
|
|
46
|
+
? value.trim().slice(0, MAX_TEXT_LENGTH)
|
|
47
|
+
: null;
|
|
48
|
+
}
|
|
49
|
+
function readCount(value) {
|
|
50
|
+
return typeof value === "number" && Number.isFinite(value) && value >= 0
|
|
51
|
+
? Math.floor(value)
|
|
52
|
+
: null;
|
|
53
|
+
}
|
|
54
|
+
function readTime(value) {
|
|
55
|
+
const text = readText(value);
|
|
56
|
+
return text && !Number.isNaN(Date.parse(text)) ? text : null;
|
|
57
|
+
}
|
|
58
|
+
function readDataBiRefreshStatus(value) {
|
|
59
|
+
return exports.DATA_BI_REFRESH_STATUSES.includes(value)
|
|
60
|
+
? value
|
|
61
|
+
: null;
|
|
62
|
+
}
|
|
63
|
+
function readDataDashboardRefresh(value) {
|
|
64
|
+
const refresh = readObject(value);
|
|
65
|
+
const status = readDataBiRefreshStatus(refresh === null || refresh === void 0 ? void 0 : refresh["status"]);
|
|
66
|
+
if (!refresh || !status) {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
return {
|
|
70
|
+
status,
|
|
71
|
+
startedAt: readTime(refresh["startedAt"]),
|
|
72
|
+
endedAt: readTime(refresh["endedAt"]),
|
|
73
|
+
type: readText(refresh["type"]),
|
|
74
|
+
error: readText(refresh["error"]),
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
function readDataDashboardRefreshHistory(value) {
|
|
78
|
+
const history = readObject(value);
|
|
79
|
+
if (!history) {
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
return {
|
|
83
|
+
last: readDataDashboardRefresh(history["last"]),
|
|
84
|
+
refreshCount: readCount(history["refreshCount"]),
|
|
85
|
+
failureCount: readCount(history["failureCount"]),
|
|
86
|
+
refreshes: (Array.isArray(history["refreshes"]) ? history["refreshes"] : [])
|
|
87
|
+
.map(readDataDashboardRefresh)
|
|
88
|
+
.filter((refresh) => {
|
|
89
|
+
return refresh !== null;
|
|
90
|
+
})
|
|
91
|
+
.slice(0, exports.MAX_DATA_DASHBOARD_REFRESHES),
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
function readDataDashboardUsageSummary(value) {
|
|
95
|
+
const summary = readObject(value);
|
|
96
|
+
if (!summary) {
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
const topViewers = [];
|
|
100
|
+
for (const item of Array.isArray(summary["topViewers"])
|
|
101
|
+
? summary["topViewers"]
|
|
102
|
+
: []) {
|
|
103
|
+
const viewer = readObject(item);
|
|
104
|
+
const name = readText(viewer === null || viewer === void 0 ? void 0 : viewer["viewer"]);
|
|
105
|
+
const views = readCount(viewer === null || viewer === void 0 ? void 0 : viewer["views"]);
|
|
106
|
+
const lastViewedAt = readTime(viewer === null || viewer === void 0 ? void 0 : viewer["lastViewedAt"]);
|
|
107
|
+
if (name && views !== null && lastViewedAt) {
|
|
108
|
+
topViewers.push({ viewer: name, views, lastViewedAt });
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return {
|
|
112
|
+
since: readTime(summary["since"]),
|
|
113
|
+
topViewers: topViewers.slice(0, exports.MAX_DATA_DASHBOARD_TOP_VIEWERS),
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
// The time a refresh is known by: when it ended, or when it started while it runs.
|
|
117
|
+
function getDataDashboardRefreshTime(refresh) {
|
|
118
|
+
return refresh ? refresh.endedAt || refresh.startedAt : null;
|
|
119
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import commonJsModule from "./DataDashboardActivity.js";
|
|
2
|
+
export const DATA_BI_REFRESH_STATUSES = commonJsModule.DATA_BI_REFRESH_STATUSES;
|
|
3
|
+
export const DATA_DASHBOARD_REFRESH_WINDOW_DAYS = commonJsModule.DATA_DASHBOARD_REFRESH_WINDOW_DAYS;
|
|
4
|
+
export const DATA_DASHBOARD_USAGE_WINDOW_DAYS = commonJsModule.DATA_DASHBOARD_USAGE_WINDOW_DAYS;
|
|
5
|
+
export const DataBiRefreshStatus = commonJsModule.DataBiRefreshStatus;
|
|
6
|
+
export const MAX_DATA_DASHBOARD_REFRESHES = commonJsModule.MAX_DATA_DASHBOARD_REFRESHES;
|
|
7
|
+
export const MAX_DATA_DASHBOARD_TOP_VIEWERS = commonJsModule.MAX_DATA_DASHBOARD_TOP_VIEWERS;
|
|
8
|
+
export const getDataDashboardRefreshTime = commonJsModule.getDataDashboardRefreshTime;
|
|
9
|
+
export const readDataBiRefreshStatus = commonJsModule.readDataBiRefreshStatus;
|
|
10
|
+
export const readDataDashboardRefresh = commonJsModule.readDataDashboardRefresh;
|
|
11
|
+
export const readDataDashboardRefreshHistory = commonJsModule.readDataDashboardRefreshHistory;
|
|
12
|
+
export const readDataDashboardUsageSummary = commonJsModule.readDataDashboardUsageSummary;
|
|
@@ -24,6 +24,7 @@ export declare const DATA_OBSERVABILITY_API_ROUTES: {
|
|
|
24
24
|
tableFreshness: string;
|
|
25
25
|
biSync: (dataBiConnectionId: string) => string;
|
|
26
26
|
tableDashboards: string;
|
|
27
|
+
tableLineage: string;
|
|
27
28
|
tableSensitivity: string;
|
|
28
29
|
tableErrors: string;
|
|
29
30
|
aiAppTables: string;
|
|
@@ -73,6 +74,12 @@ export interface DataObservabilityTableDashboard {
|
|
|
73
74
|
dataAssetId: string;
|
|
74
75
|
table: string;
|
|
75
76
|
} | null;
|
|
77
|
+
viewCount?: number | null;
|
|
78
|
+
viewerCount?: number | null;
|
|
79
|
+
lastViewedAt?: string | null;
|
|
80
|
+
lastRefreshStatus?: string | null;
|
|
81
|
+
lastRefreshAt?: string | null;
|
|
82
|
+
lastRefreshError?: string | null;
|
|
76
83
|
}
|
|
77
84
|
export interface DataObservabilityCheckSuggestRequest {
|
|
78
85
|
dataAssetId: string;
|
|
@@ -24,6 +24,7 @@ export declare const DATA_OBSERVABILITY_API_ROUTES: {
|
|
|
24
24
|
tableFreshness: string;
|
|
25
25
|
biSync: (dataBiConnectionId: string) => string;
|
|
26
26
|
tableDashboards: string;
|
|
27
|
+
tableLineage: string;
|
|
27
28
|
tableSensitivity: string;
|
|
28
29
|
tableErrors: string;
|
|
29
30
|
aiAppTables: string;
|
|
@@ -73,6 +74,12 @@ export interface DataObservabilityTableDashboard {
|
|
|
73
74
|
dataAssetId: string;
|
|
74
75
|
table: string;
|
|
75
76
|
} | null;
|
|
77
|
+
viewCount?: number | null;
|
|
78
|
+
viewerCount?: number | null;
|
|
79
|
+
lastViewedAt?: string | null;
|
|
80
|
+
lastRefreshStatus?: string | null;
|
|
81
|
+
lastRefreshAt?: string | null;
|
|
82
|
+
lastRefreshError?: string | null;
|
|
76
83
|
}
|
|
77
84
|
export interface DataObservabilityCheckSuggestRequest {
|
|
78
85
|
dataAssetId: string;
|
|
@@ -74,6 +74,8 @@ exports.DATA_OBSERVABILITY_API_ROUTES = {
|
|
|
74
74
|
},
|
|
75
75
|
// The dashboards built on a table, and on the tables built from it.
|
|
76
76
|
tableDashboards: "/data-observability/tables/dashboards",
|
|
77
|
+
// A table's lineage several steps each way, with how each table is now: what its Lineage tab draws.
|
|
78
|
+
tableLineage: "/data-observability/tables/lineage",
|
|
77
79
|
// What Data Security knows each of a table's columns holds.
|
|
78
80
|
tableSensitivity: "/data-observability/tables/sensitivity",
|
|
79
81
|
// The errors in the services that write a table, naming it.
|