@oneuptime/common 12.0.11 → 12.0.13
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/DatabaseBaseModel/DatabaseBaseModel.ts +32 -5
- package/Models/DatabaseModels/NetworkDevice.ts +64 -0
- package/Models/DatabaseModels/StatusPage.ts +59 -0
- package/Models/DatabaseModels/StatusPageOidc.ts +2 -0
- package/Models/DatabaseModels/WorkspaceProjectAuthToken.ts +19 -2
- package/Server/API/AIChatAPI.ts +55 -56
- package/Server/API/CommonAPI.ts +89 -0
- package/Server/API/MicrosoftTeamsAPI.ts +20 -9
- package/Server/API/SlackAPI.ts +13 -10
- package/Server/API/StatusPageAPI.ts +2197 -2128
- package/Server/API/TelemetryAPI.ts +72 -3
- package/Server/Infrastructure/Postgres/SchemaMigrations/1787500000000-AddEnableSearchEngineIndexingToStatusPage.ts +30 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1787600000000-AddNetworkDeviceReachabilityColumns.ts +47 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +4 -0
- package/Server/Middleware/UserAuthorization.ts +11 -2
- package/Server/Services/ApiKeyPermissionService.ts +116 -2
- package/Server/Services/DatabaseService.ts +17 -6
- package/Server/Services/LogAggregationService.ts +34 -0
- package/Server/Services/LogService.ts +21 -0
- package/Server/Services/NetworkSiteService.ts +12 -0
- package/Server/Services/SpanService.ts +21 -0
- package/Server/Services/TraceAggregationService.ts +15 -0
- package/Server/Services/WorkspaceNotificationRuleService.ts +172 -220
- package/Server/Types/AnalyticsDatabase/ModelPermission.ts +9 -0
- package/Server/Types/Database/Permissions/AccessControlPermission.ts +47 -16
- package/Server/Types/Workflow/Components/Conditions/IfElse.ts +9 -0
- package/Server/Types/Workflow/Components/JavaScript.ts +9 -0
- package/Server/Utils/APIKey/AccessPermission.ts +16 -40
- package/Server/Utils/AnalyticsDatabase/StatementGenerator.ts +144 -0
- package/Server/Utils/LogRedaction.ts +576 -0
- package/Server/Utils/Logger.ts +123 -46
- package/Server/Utils/Monitor/Criteria/SSLMonitorCriteria.ts +94 -23
- package/Server/Utils/Monitor/MonitorCriteriaEvaluator.ts +12 -0
- package/Server/Utils/Monitor/MonitorResource.ts +29 -9
- package/Server/Utils/Monitor/NetworkInventoryUtil.ts +28 -7
- package/Server/Utils/SessionReplay/SessionReplayGateCacheStore.ts +56 -10
- package/Server/Utils/StartServer.ts +30 -9
- package/Server/Utils/StatusPageSearchEngineIndexing.ts +33 -0
- package/Server/Utils/Telemetry/ResourceEntityFilter.ts +441 -0
- package/Server/Utils/VM/VMRunner.ts +693 -874
- package/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.ts +488 -46
- package/Tests/App/Dashboard/MonitorTypePicker.test.tsx +300 -0
- package/Tests/App/StatusPage/StatusPageIndexPageRobotsMeta.test.ts +130 -0
- package/Tests/Models/DatabaseModels/DatabaseBaseModelToJSONObjectCache.test.ts +180 -0
- package/Tests/Models/StatusPageEnableSearchEngineIndexing.test.ts +157 -0
- package/Tests/Server/API/AIChatCancelAndFeedback.test.ts +23 -1
- package/Tests/Server/API/AIChatRouteAuthorization.test.ts +785 -0
- package/Tests/Server/API/BaseAPIApiKeyAuth.test.ts +21 -8
- package/Tests/Server/API/CommonAPIAuthGuard.test.ts +290 -0
- package/Tests/Server/API/MicrosoftTeamsManifest.test.ts +7 -1
- package/Tests/Server/API/StatusPageOverviewCache.test.ts +474 -0
- package/Tests/Server/API/StatusPageSeoSearchEngineIndexing.test.ts +189 -0
- package/Tests/Server/Infrastructure/InMemoryTTLCache.test.ts +158 -0
- package/Tests/Server/Infrastructure/Postgres/DeviceRoleAndDeclaredLinkParentMigration.test.ts +9 -60
- package/Tests/Server/Middleware/ProjectAuthorizationApiKeyMiddleware.test.ts +24 -15
- package/Tests/Server/Middleware/UserAuthorization.test.ts +79 -0
- package/Tests/Server/Services/AddNetworkDeviceReachabilityColumnsMigration.test.ts +332 -0
- package/Tests/Server/Services/ApiKeyPermissionService.test.ts +347 -0
- package/Tests/Server/Services/DatabaseServiceUpdateDebugLogging.test.ts +282 -0
- package/Tests/Server/Services/NetworkSiteService.test.ts +56 -2
- package/Tests/Server/Services/TelemetryResourceFacetFilters.test.ts +267 -0
- package/Tests/Server/Services/WorkspaceNotificationRuleTestRuleChannels.test.ts +702 -0
- package/Tests/Server/Types/Database/Permissions/AccessControlPermission.test.ts +165 -0
- package/Tests/Server/Types/Workflow/Components/CustomCodeScriptError.test.ts +121 -0
- package/Tests/Server/Utils/APIKey/AccessPermission.test.ts +48 -36
- package/Tests/Server/Utils/AnalyticsDatabase/StatementGenerator.test.ts +213 -0
- package/Tests/Server/Utils/LogRedaction.test.ts +415 -0
- package/Tests/Server/Utils/LoggerCredentialLeak.test.ts +245 -0
- package/Tests/Server/Utils/Monitor/Criteria/SSLMonitorCriteria.test.ts +374 -4
- package/Tests/Server/Utils/Monitor/MonitorCriteriaEvaluatorJavascriptExpression.test.ts +92 -0
- package/Tests/Server/Utils/Monitor/MonitorResourceIngestedStepSelection.test.ts +455 -0
- package/Tests/Server/Utils/Monitor/NetworkDeviceReachabilityRoundTrip.test.ts +369 -0
- package/Tests/Server/Utils/Monitor/NetworkInventoryUtil.test.ts +86 -8
- package/Tests/Server/Utils/PrivacyFilterUtil.test.ts +64 -0
- package/Tests/Server/Utils/SessionReplay/SessionReplayGateCacheStore.test.ts +207 -0
- package/Tests/Server/Utils/StartServerBodyVerify.test.ts +335 -0
- package/Tests/Server/Utils/StatusPageSearchEngineIndexing.test.ts +60 -0
- package/Tests/Server/Utils/Telemetry/ResourceEntityFilter.test.ts +435 -0
- package/Tests/Server/Utils/VM/VMRunnerIsolation.test.ts +385 -0
- package/Tests/Server/Utils/VM/VMRunnerSsrf.test.ts +3 -0
- package/Tests/Server/Utils/Workspace/MicrosoftTeamsChannelSend.test.ts +607 -62
- package/Tests/Server/Utils/Workspace/MicrosoftTeamsInstalledTeamIdSpace.test.ts +778 -0
- package/Tests/Server/Utils/Workspace/MicrosoftTeamsTeamInstalls.test.ts +44 -10
- package/Tests/Types/API/HostnameFromAuthority.test.ts +164 -0
- package/Tests/Types/Database/AccessControl/ColumnAccessControlCache.test.ts +344 -0
- package/Tests/Types/Database/DatabasePropertyFindOperator.test.ts +518 -0
- package/Tests/Types/Database/TableColumnMetadataCache.test.ts +286 -0
- package/Tests/Types/Monitor/MonitorStep.test.ts +100 -0
- package/Tests/Types/Monitor/MonitorTypeKeywords.test.ts +360 -0
- package/Tests/Types/StatusPage/SearchEngineIndexing.test.ts +86 -0
- package/Tests/Types/Telemetry/ResourceEntityFacet.test.ts +254 -0
- package/Tests/UI/Components/CardSelect.test.tsx +1021 -0
- package/Tests/UI/Components/MasterPage.test.tsx +36 -1
- package/Tests/Utils/Monitor/MonitorMetricType.test.ts +66 -1
- package/Tests/Utils/Monitor/NetworkTopologyUtil.test.ts +115 -6
- package/Tests/Utils/NetworkDevice/DeviceReachabilityUtil.test.ts +610 -0
- package/Tests/Utils/NetworkSite/SiteStatusRollupUtil.test.ts +114 -45
- package/Types/API/Hostname.ts +79 -0
- package/Types/Database/AccessControl/ColumnAccessControl.ts +33 -11
- package/Types/Database/AccessControl/ColumnBillingAccessControl.ts +33 -11
- package/Types/Database/DatabaseProperty.ts +38 -0
- package/Types/Database/TableColumn.ts +34 -7
- package/Types/Events/Recurring.ts +16 -1
- package/Types/Monitor/CustomCodeMonitor/CustomCodeMonitorResponse.ts +14 -2
- package/Types/Monitor/MonitorStep.ts +13 -1
- package/Types/Monitor/MonitorType.ts +345 -40
- package/Types/Monitor/SSLMonitor/SslMonitorResponse.ts +43 -0
- package/Types/StatusPage/SearchEngineIndexing.ts +61 -0
- package/Types/Telemetry/ResourceEntityFacet.ts +211 -0
- package/UI/Components/CardSelect/CardSelect.tsx +714 -105
- package/UI/Components/EmptyState/EmptyState.tsx +8 -1
- package/UI/Components/Footer/Footer.tsx +32 -6
- package/UI/Components/Forms/Fields/FormField.tsx +3 -0
- package/UI/Components/Forms/Types/Field.ts +8 -0
- package/UI/Components/Loader/PageLoader.tsx +29 -8
- package/UI/Components/LogsViewer/components/LogsAnalyticsView.tsx +26 -4
- package/UI/Components/Markdown.tsx/LazyMarkdownViewer.tsx +17 -1
- package/UI/Components/MasterPage/MasterPage.tsx +24 -11
- package/Utils/Monitor/MonitorMetricType.ts +16 -1
- package/Utils/Monitor/NetworkTopologyUtil.ts +60 -8
- package/Utils/NetworkDevice/DeviceReachabilityUtil.ts +262 -0
- package/Utils/NetworkSite/SiteStatusRollupUtil.ts +41 -24
- package/Utils/Telemetry/CrossSignalScope.ts +75 -4
- package/build/dist/Models/DatabaseModels/DatabaseBaseModel/DatabaseBaseModel.js +20 -4
- package/build/dist/Models/DatabaseModels/DatabaseBaseModel/DatabaseBaseModel.js.map +1 -1
- package/build/dist/Models/DatabaseModels/NetworkDevice.js +66 -0
- package/build/dist/Models/DatabaseModels/NetworkDevice.js.map +1 -1
- package/build/dist/Models/DatabaseModels/StatusPage.js +60 -0
- package/build/dist/Models/DatabaseModels/StatusPage.js.map +1 -1
- package/build/dist/Models/DatabaseModels/StatusPageOidc.js +2 -0
- package/build/dist/Models/DatabaseModels/StatusPageOidc.js.map +1 -1
- package/build/dist/Models/DatabaseModels/WorkspaceProjectAuthToken.js.map +1 -1
- package/build/dist/Server/API/AIChatAPI.js +48 -35
- package/build/dist/Server/API/AIChatAPI.js.map +1 -1
- package/build/dist/Server/API/CommonAPI.js +59 -0
- package/build/dist/Server/API/CommonAPI.js.map +1 -1
- package/build/dist/Server/API/MicrosoftTeamsAPI.js +20 -6
- package/build/dist/Server/API/MicrosoftTeamsAPI.js.map +1 -1
- package/build/dist/Server/API/SlackAPI.js +13 -10
- package/build/dist/Server/API/SlackAPI.js.map +1 -1
- package/build/dist/Server/API/StatusPageAPI.js +745 -673
- package/build/dist/Server/API/StatusPageAPI.js.map +1 -1
- package/build/dist/Server/API/TelemetryAPI.js +34 -3
- package/build/dist/Server/API/TelemetryAPI.js.map +1 -1
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1787500000000-AddEnableSearchEngineIndexingToStatusPage.js +23 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1787500000000-AddEnableSearchEngineIndexingToStatusPage.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1787600000000-AddNetworkDeviceReachabilityColumns.js +34 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1787600000000-AddNetworkDeviceReachabilityColumns.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +4 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
- package/build/dist/Server/Middleware/UserAuthorization.js +6 -2
- package/build/dist/Server/Middleware/UserAuthorization.js.map +1 -1
- package/build/dist/Server/Services/ApiKeyPermissionService.js +90 -1
- package/build/dist/Server/Services/ApiKeyPermissionService.js.map +1 -1
- package/build/dist/Server/Services/DatabaseService.js +15 -6
- package/build/dist/Server/Services/DatabaseService.js.map +1 -1
- package/build/dist/Server/Services/LogAggregationService.js +2 -0
- package/build/dist/Server/Services/LogAggregationService.js.map +1 -1
- package/build/dist/Server/Services/LogService.js +16 -0
- package/build/dist/Server/Services/LogService.js.map +1 -1
- package/build/dist/Server/Services/NetworkSiteService.js +12 -0
- package/build/dist/Server/Services/NetworkSiteService.js.map +1 -1
- package/build/dist/Server/Services/SpanService.js +16 -0
- package/build/dist/Server/Services/SpanService.js.map +1 -1
- package/build/dist/Server/Services/TraceAggregationService.js +2 -0
- package/build/dist/Server/Services/TraceAggregationService.js.map +1 -1
- package/build/dist/Server/Services/WorkspaceNotificationRuleService.js +137 -164
- package/build/dist/Server/Services/WorkspaceNotificationRuleService.js.map +1 -1
- package/build/dist/Server/Types/AnalyticsDatabase/ModelPermission.js +9 -0
- package/build/dist/Server/Types/AnalyticsDatabase/ModelPermission.js.map +1 -1
- package/build/dist/Server/Types/Database/Permissions/AccessControlPermission.js +21 -13
- package/build/dist/Server/Types/Database/Permissions/AccessControlPermission.js.map +1 -1
- package/build/dist/Server/Types/Workflow/Components/Conditions/IfElse.js +8 -0
- package/build/dist/Server/Types/Workflow/Components/Conditions/IfElse.js.map +1 -1
- package/build/dist/Server/Types/Workflow/Components/JavaScript.js +8 -0
- package/build/dist/Server/Types/Workflow/Components/JavaScript.js.map +1 -1
- package/build/dist/Server/Utils/APIKey/AccessPermission.js +9 -32
- package/build/dist/Server/Utils/APIKey/AccessPermission.js.map +1 -1
- package/build/dist/Server/Utils/AnalyticsDatabase/StatementGenerator.js +87 -0
- package/build/dist/Server/Utils/AnalyticsDatabase/StatementGenerator.js.map +1 -1
- package/build/dist/Server/Utils/LogRedaction.js +449 -0
- package/build/dist/Server/Utils/LogRedaction.js.map +1 -0
- package/build/dist/Server/Utils/Logger.js +98 -45
- package/build/dist/Server/Utils/Logger.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/Criteria/SSLMonitorCriteria.js +65 -13
- package/build/dist/Server/Utils/Monitor/Criteria/SSLMonitorCriteria.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js +12 -1
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorResource.js +20 -3
- package/build/dist/Server/Utils/Monitor/MonitorResource.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/NetworkInventoryUtil.js +27 -7
- package/build/dist/Server/Utils/Monitor/NetworkInventoryUtil.js.map +1 -1
- package/build/dist/Server/Utils/SessionReplay/SessionReplayGateCacheStore.js +29 -10
- package/build/dist/Server/Utils/SessionReplay/SessionReplayGateCacheStore.js.map +1 -1
- package/build/dist/Server/Utils/StartServer.js +10 -7
- package/build/dist/Server/Utils/StartServer.js.map +1 -1
- package/build/dist/Server/Utils/StatusPageSearchEngineIndexing.js +24 -0
- package/build/dist/Server/Utils/StatusPageSearchEngineIndexing.js.map +1 -0
- package/build/dist/Server/Utils/Telemetry/ResourceEntityFilter.js +311 -0
- package/build/dist/Server/Utils/Telemetry/ResourceEntityFilter.js.map +1 -0
- package/build/dist/Server/Utils/VM/VMRunner.js +402 -525
- package/build/dist/Server/Utils/VM/VMRunner.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js +366 -37
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js.map +1 -1
- package/build/dist/Types/API/Hostname.js +63 -0
- package/build/dist/Types/API/Hostname.js.map +1 -1
- package/build/dist/Types/Database/AccessControl/ColumnAccessControl.js +20 -6
- package/build/dist/Types/Database/AccessControl/ColumnAccessControl.js.map +1 -1
- package/build/dist/Types/Database/AccessControl/ColumnBillingAccessControl.js +20 -6
- package/build/dist/Types/Database/AccessControl/ColumnBillingAccessControl.js.map +1 -1
- package/build/dist/Types/Database/DatabaseProperty.js +38 -0
- package/build/dist/Types/Database/DatabaseProperty.js.map +1 -1
- package/build/dist/Types/Database/TableColumn.js +24 -6
- package/build/dist/Types/Database/TableColumn.js.map +1 -1
- package/build/dist/Types/Events/Recurring.js +13 -1
- package/build/dist/Types/Events/Recurring.js.map +1 -1
- package/build/dist/Types/Monitor/MonitorStep.js +9 -1
- package/build/dist/Types/Monitor/MonitorStep.js.map +1 -1
- package/build/dist/Types/Monitor/MonitorType.js +330 -31
- package/build/dist/Types/Monitor/MonitorType.js.map +1 -1
- package/build/dist/Types/StatusPage/SearchEngineIndexing.js +55 -0
- package/build/dist/Types/StatusPage/SearchEngineIndexing.js.map +1 -0
- package/build/dist/Types/Telemetry/ResourceEntityFacet.js +156 -0
- package/build/dist/Types/Telemetry/ResourceEntityFacet.js.map +1 -0
- package/build/dist/UI/Components/CardSelect/CardSelect.js +360 -40
- package/build/dist/UI/Components/CardSelect/CardSelect.js.map +1 -1
- package/build/dist/UI/Components/EmptyState/EmptyState.js +1 -1
- package/build/dist/UI/Components/EmptyState/EmptyState.js.map +1 -1
- package/build/dist/UI/Components/Footer/Footer.js +7 -4
- package/build/dist/UI/Components/Footer/Footer.js.map +1 -1
- package/build/dist/UI/Components/Forms/Fields/FormField.js +1 -1
- package/build/dist/UI/Components/Forms/Fields/FormField.js.map +1 -1
- package/build/dist/UI/Components/Loader/PageLoader.js +15 -5
- package/build/dist/UI/Components/Loader/PageLoader.js.map +1 -1
- package/build/dist/UI/Components/LogsViewer/components/LogsAnalyticsView.js +16 -3
- package/build/dist/UI/Components/LogsViewer/components/LogsAnalyticsView.js.map +1 -1
- package/build/dist/UI/Components/Markdown.tsx/LazyMarkdownViewer.js +13 -1
- package/build/dist/UI/Components/Markdown.tsx/LazyMarkdownViewer.js.map +1 -1
- package/build/dist/UI/Components/MasterPage/MasterPage.js +10 -2
- package/build/dist/UI/Components/MasterPage/MasterPage.js.map +1 -1
- package/build/dist/Utils/Monitor/MonitorMetricType.js +13 -1
- package/build/dist/Utils/Monitor/MonitorMetricType.js.map +1 -1
- package/build/dist/Utils/Monitor/NetworkTopologyUtil.js +34 -7
- package/build/dist/Utils/Monitor/NetworkTopologyUtil.js.map +1 -1
- package/build/dist/Utils/NetworkDevice/DeviceReachabilityUtil.js +177 -0
- package/build/dist/Utils/NetworkDevice/DeviceReachabilityUtil.js.map +1 -0
- package/build/dist/Utils/NetworkSite/SiteStatusRollupUtil.js +23 -27
- package/build/dist/Utils/NetworkSite/SiteStatusRollupUtil.js.map +1 -1
- package/build/dist/Utils/Telemetry/CrossSignalScope.js +44 -4
- package/build/dist/Utils/Telemetry/CrossSignalScope.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* StatusPage.enableSearchEngineIndexing column contract.
|
|
3
|
+
*
|
|
4
|
+
* The promise is "status pages stay indexable unless the owner turns indexing
|
|
5
|
+
* off". Three separate mechanisms carry that promise, and they are easy to
|
|
6
|
+
* confuse:
|
|
7
|
+
* - NEW rows get true from the Postgres column default, declared by
|
|
8
|
+
* @Column({ default: true }) and stored in TypeORM's metadata
|
|
9
|
+
* - EXISTING rows got true from the migration's NOT NULL DEFAULT true
|
|
10
|
+
* - @TableColumn({ defaultValue: true }) is documentation only - it feeds the
|
|
11
|
+
* generated API schema and form metadata, and defaults nothing at runtime
|
|
12
|
+
*
|
|
13
|
+
* All three are pinned below, because a one-word edit to any of them silently
|
|
14
|
+
* flips the default for everyone - and this is a default nobody notices going
|
|
15
|
+
* wrong until their status page has dropped out of Google.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import StatusPage from "../../Models/DatabaseModels/StatusPage";
|
|
19
|
+
import { TableColumnMetadata } from "../../Types/Database/TableColumn";
|
|
20
|
+
import TableColumnType from "../../Types/Database/TableColumnType";
|
|
21
|
+
import Permission from "../../Types/Permission";
|
|
22
|
+
import { SEARCH_ENGINE_INDEXING_FLAG_NAME } from "../../Types/StatusPage/SearchEngineIndexing";
|
|
23
|
+
import { describe, expect, test } from "@jest/globals";
|
|
24
|
+
import { getMetadataArgsStorage } from "typeorm";
|
|
25
|
+
import { ColumnMetadataArgs } from "typeorm/metadata-args/ColumnMetadataArgs";
|
|
26
|
+
import fs from "fs";
|
|
27
|
+
import path from "path";
|
|
28
|
+
|
|
29
|
+
const COLUMN: string = "enableSearchEngineIndexing";
|
|
30
|
+
|
|
31
|
+
const MIGRATIONS_DIR: string = path.join(
|
|
32
|
+
__dirname,
|
|
33
|
+
"..",
|
|
34
|
+
"..",
|
|
35
|
+
"Server",
|
|
36
|
+
"Infrastructure",
|
|
37
|
+
"Postgres",
|
|
38
|
+
"SchemaMigrations",
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
const MIGRATION_PATH: string = path.join(
|
|
42
|
+
MIGRATIONS_DIR,
|
|
43
|
+
"1787500000000-AddEnableSearchEngineIndexingToStatusPage.ts",
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
function metadata(): TableColumnMetadata {
|
|
47
|
+
return new StatusPage().getTableColumnMetadata(COLUMN);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function typeOrmColumn(): ColumnMetadataArgs | undefined {
|
|
51
|
+
return getMetadataArgsStorage().columns.find((column: ColumnMetadataArgs) => {
|
|
52
|
+
return column.target === StatusPage && column.propertyName === COLUMN;
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
describe("StatusPage.enableSearchEngineIndexing", () => {
|
|
57
|
+
test("exists as a boolean column", () => {
|
|
58
|
+
expect(metadata()).toBeDefined();
|
|
59
|
+
expect(metadata().type).toBe(TableColumnType.Boolean);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
test("is named exactly what the API and the template look for", () => {
|
|
63
|
+
expect(COLUMN).toBe(SEARCH_ENGINE_INDEXING_FLAG_NAME);
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
test("a newly created status page is indexable", () => {
|
|
67
|
+
/*
|
|
68
|
+
* This is the assertion that actually protects new status pages: the
|
|
69
|
+
* Postgres column default. Nothing else populates the column when a
|
|
70
|
+
* create omits it, and every create in the product omits it.
|
|
71
|
+
*/
|
|
72
|
+
expect(typeOrmColumn()).toBeDefined();
|
|
73
|
+
expect(typeOrmColumn()?.options.default).toBe(true);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
test("the column is NOT NULL, so no row can be ambiguous", () => {
|
|
77
|
+
expect(typeOrmColumn()?.options.nullable).toBe(false);
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
test("every pre-existing status page was backfilled as indexable", () => {
|
|
81
|
+
/*
|
|
82
|
+
* The migration is the only thing that decided the value for status pages
|
|
83
|
+
* that existed before this feature shipped. DEFAULT true in the same
|
|
84
|
+
* statement fills every existing row, so no page silently loses its search
|
|
85
|
+
* traffic on upgrade.
|
|
86
|
+
*/
|
|
87
|
+
const migration: string = fs.readFileSync(MIGRATION_PATH, "utf8");
|
|
88
|
+
|
|
89
|
+
expect(migration).toContain('ALTER TABLE "StatusPage"');
|
|
90
|
+
expect(migration).toContain(
|
|
91
|
+
`ADD "${COLUMN}" boolean NOT NULL DEFAULT true`,
|
|
92
|
+
);
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
test("the migration is registered, so it actually runs on boot", () => {
|
|
96
|
+
/*
|
|
97
|
+
* A migration file that is not in Index.ts is dead code: the column never
|
|
98
|
+
* appears in Postgres, and every read of it fails at runtime rather than
|
|
99
|
+
* at compile time.
|
|
100
|
+
*/
|
|
101
|
+
const index: string = fs.readFileSync(
|
|
102
|
+
path.join(MIGRATIONS_DIR, "Index.ts"),
|
|
103
|
+
"utf8",
|
|
104
|
+
);
|
|
105
|
+
|
|
106
|
+
expect(index).toContain(
|
|
107
|
+
"AddEnableSearchEngineIndexingToStatusPage1787500000000",
|
|
108
|
+
);
|
|
109
|
+
/* Imported AND listed in the exported array - the import alone does nothing. */
|
|
110
|
+
expect(
|
|
111
|
+
index.match(/AddEnableSearchEngineIndexingToStatusPage1787500000000/g)
|
|
112
|
+
?.length,
|
|
113
|
+
).toBeGreaterThanOrEqual(2);
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
test("is documented as defaulting to enabled", () => {
|
|
117
|
+
/*
|
|
118
|
+
* Feeds the generated API schema and the dashboard form metadata.
|
|
119
|
+
* Documentation only - see the tests above for the defaults that actually
|
|
120
|
+
* apply.
|
|
121
|
+
*/
|
|
122
|
+
expect(metadata().defaultValue).toBe(true);
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
test("is a default-value column, so create may omit it", () => {
|
|
126
|
+
expect(new StatusPage().isDefaultValueColumn(COLUMN)).toBe(true);
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
test("is not required, so existing create calls keep working", () => {
|
|
130
|
+
expect(metadata().required).toBeFalsy();
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
test("is readable by status page viewers", () => {
|
|
134
|
+
const accessControl: Array<Permission> | undefined =
|
|
135
|
+
new StatusPage().getColumnAccessControlFor(COLUMN)?.read;
|
|
136
|
+
|
|
137
|
+
expect(accessControl).toContain(Permission.ProjectMember);
|
|
138
|
+
expect(accessControl).toContain(Permission.StatusPageAdmin);
|
|
139
|
+
expect(accessControl).toContain(Permission.ReadProjectStatusPage);
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
test("is editable by status page editors", () => {
|
|
143
|
+
const accessControl: Array<Permission> | undefined =
|
|
144
|
+
new StatusPage().getColumnAccessControlFor(COLUMN)?.update;
|
|
145
|
+
|
|
146
|
+
expect(accessControl).toContain(Permission.EditProjectStatusPage);
|
|
147
|
+
expect(accessControl).toContain(Permission.StatusPageAdmin);
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
test("is not editable by a read-only viewer", () => {
|
|
151
|
+
const accessControl: Array<Permission> | undefined =
|
|
152
|
+
new StatusPage().getColumnAccessControlFor(COLUMN)?.update;
|
|
153
|
+
|
|
154
|
+
expect(accessControl).not.toContain(Permission.Viewer);
|
|
155
|
+
expect(accessControl).not.toContain(Permission.StatusPageViewer);
|
|
156
|
+
});
|
|
157
|
+
});
|
|
@@ -26,6 +26,7 @@ import AIRunStatus from "../../../Types/AI/AIRunStatus";
|
|
|
26
26
|
import BadDataException from "../../../Types/Exception/BadDataException";
|
|
27
27
|
import { JSONObject } from "../../../Types/JSON";
|
|
28
28
|
import ObjectID from "../../../Types/ObjectID";
|
|
29
|
+
import Permission from "../../../Types/Permission";
|
|
29
30
|
import {
|
|
30
31
|
afterEach,
|
|
31
32
|
beforeEach,
|
|
@@ -61,10 +62,31 @@ const MESSAGE_ID: ObjectID = new ObjectID(
|
|
|
61
62
|
"eeeeeeee-eeee-4eee-8eee-eeeeeeeeeeee",
|
|
62
63
|
);
|
|
63
64
|
|
|
65
|
+
/*
|
|
66
|
+
* A real member of PROJECT_ID. The tenant access permission entry is not
|
|
67
|
+
* decoration: every AI chat route asserts membership of the project named in
|
|
68
|
+
* the `tenantid` header (CommonAPI.assertAuthenticatedProjectMember), so props
|
|
69
|
+
* carrying only a user id and a tenant id are exactly what an outsider sends
|
|
70
|
+
* and are refused before the handler does anything. AIChatRouteAuthorization
|
|
71
|
+
* covers that refusal; these tests are about what a legitimate member gets.
|
|
72
|
+
*/
|
|
64
73
|
const props: DatabaseCommonInteractionProps = {
|
|
65
74
|
userId: USER_ID,
|
|
66
75
|
tenantId: PROJECT_ID,
|
|
67
|
-
|
|
76
|
+
userTenantAccessPermission: {
|
|
77
|
+
[PROJECT_ID.toString()]: {
|
|
78
|
+
_type: "UserTenantAccessPermission",
|
|
79
|
+
projectId: PROJECT_ID,
|
|
80
|
+
permissions: [
|
|
81
|
+
{
|
|
82
|
+
_type: "UserPermission",
|
|
83
|
+
permission: Permission.ProjectMember,
|
|
84
|
+
labelIds: [],
|
|
85
|
+
},
|
|
86
|
+
],
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
} as unknown as DatabaseCommonInteractionProps;
|
|
68
90
|
|
|
69
91
|
function requestFor(body: JSONObject): ExpressRequest {
|
|
70
92
|
return {
|