@oneuptime/common 11.3.24 → 11.3.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Models/DatabaseModels/AIConversation.ts +322 -0
- package/Models/DatabaseModels/AIConversationMessage.ts +495 -0
- package/Models/DatabaseModels/AIRun.ts +584 -0
- package/Models/DatabaseModels/AIRunEvent.ts +443 -0
- package/Models/DatabaseModels/Index.ts +8 -0
- package/Models/DatabaseModels/LlmLog.ts +26 -0
- package/Models/DatabaseModels/LlmProvider.ts +2 -2
- package/Server/API/AIChatAPI.ts +693 -0
- package/Server/API/LlmProviderAPI.ts +169 -0
- package/Server/API/MicrosoftTeamsAPI.ts +5 -0
- package/Server/API/SlackAPI.ts +663 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1783363279075-AddAIChatModels.ts +245 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1783443471795-AddLlmProviderToAIConversation.ts +36 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1783453297388-AddAIChatWriteActionsAndWidgets.ts +46 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1783461767405-MigrationName.ts +119 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +8 -0
- package/Server/Services/AIConversationMessageService.ts +39 -0
- package/Server/Services/AIConversationService.ts +63 -0
- package/Server/Services/AIRunEventService.ts +39 -0
- package/Server/Services/AIRunService.ts +39 -0
- package/Server/Services/AIService.ts +53 -31
- package/Server/Services/DatabaseService.ts +19 -0
- package/Server/Services/LlmProviderService.ts +110 -0
- package/Server/Services/ProjectService.ts +24 -0
- package/Server/Types/AnalyticsDatabase/ModelPermission.ts +74 -9
- package/Server/Utils/AI/AIChatPrivacyFilter.ts +28 -0
- package/Server/Utils/AI/Chat/ChatAgentRunner.ts +1054 -0
- package/Server/Utils/AI/Chat/ObservabilityAssistant.ts +239 -0
- package/Server/Utils/AI/Chat/ObservabilityChatPrompt.ts +51 -0
- package/Server/Utils/AI/Toolbox/AlertTools.ts +201 -0
- package/Server/Utils/AI/Toolbox/AlertWriteTools.ts +174 -0
- package/Server/Utils/AI/Toolbox/ContextTools.ts +189 -0
- package/Server/Utils/AI/Toolbox/ExceptionTools.ts +149 -0
- package/Server/Utils/AI/Toolbox/IncidentTools.ts +204 -0
- package/Server/Utils/AI/Toolbox/IncidentWriteTools.ts +350 -0
- package/Server/Utils/AI/Toolbox/Index.ts +228 -0
- package/Server/Utils/AI/Toolbox/LogTools.ts +339 -0
- package/Server/Utils/AI/Toolbox/MetricTools.ts +179 -0
- package/Server/Utils/AI/Toolbox/MonitorTools.ts +193 -0
- package/Server/Utils/AI/Toolbox/Serializer.ts +257 -0
- package/Server/Utils/AI/Toolbox/ToolTypes.ts +249 -0
- package/Server/Utils/AI/Toolbox/TraceTools.ts +402 -0
- package/Server/Utils/AI/Toolbox/WidgetBuilder.ts +189 -0
- package/Server/Utils/LLM/LLMService.ts +502 -92
- package/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.ts +512 -19
- package/Server/Utils/Workspace/Slack/Slack.ts +80 -0
- package/Server/Utils/Workspace/Slack/app-manifest.json +16 -1
- package/Tests/Server/Utils/AI/AIChatModelACL.test.ts +42 -0
- package/Tests/Server/Utils/AI/ChatAgentHelpers.test.ts +89 -0
- package/Tests/Server/Utils/AI/LLMServiceBaseUrl.test.ts +139 -0
- package/Tests/Server/Utils/AI/LLMServiceToolCalling.test.ts +308 -0
- package/Tests/Server/Utils/AI/ToolArgsGetTimeRange.test.ts +62 -0
- package/Tests/Server/Utils/AI/ToolArgsScopeServiceIds.test.ts +79 -0
- package/Tests/Server/Utils/AI/ToolResultSerializer.test.ts +155 -0
- package/Tests/Types/Billing/SubscriptionStatus.test.ts +127 -0
- package/Tests/Types/Metrics/RecordingRuleDefinition.test.ts +213 -0
- package/Types/AI/AIChatMessageRole.ts +6 -0
- package/Types/AI/AIChatMessageStatus.ts +32 -0
- package/Types/AI/AIChatPermissionMode.ts +69 -0
- package/Types/AI/AIChatTypes.ts +231 -0
- package/Types/AI/AIRunEventType.ts +17 -0
- package/Types/AI/AIRunStatus.ts +28 -0
- package/Types/AI/AIRunType.ts +6 -0
- package/Types/LLM/LlmType.ts +6 -0
- package/UI/Components/Header/HeaderIconDropdownButton.tsx +22 -12
- package/UI/Components/Markdown.tsx/MarkdownViewer.tsx +35 -3
- package/UI/Components/Page/Page.tsx +14 -0
- package/UI/Utils/LlmTypeDropdownOptions.ts +40 -0
- package/UI/Utils/TestLLMProvider.ts +59 -0
- package/build/dist/Models/DatabaseModels/AIConversation.js +345 -0
- package/build/dist/Models/DatabaseModels/AIConversation.js.map +1 -0
- package/build/dist/Models/DatabaseModels/AIConversationMessage.js +521 -0
- package/build/dist/Models/DatabaseModels/AIConversationMessage.js.map +1 -0
- package/build/dist/Models/DatabaseModels/AIRun.js +619 -0
- package/build/dist/Models/DatabaseModels/AIRun.js.map +1 -0
- package/build/dist/Models/DatabaseModels/AIRunEvent.js +469 -0
- package/build/dist/Models/DatabaseModels/AIRunEvent.js.map +1 -0
- package/build/dist/Models/DatabaseModels/Index.js +8 -0
- package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
- package/build/dist/Models/DatabaseModels/LlmLog.js +28 -0
- package/build/dist/Models/DatabaseModels/LlmLog.js.map +1 -1
- package/build/dist/Models/DatabaseModels/LlmProvider.js +2 -2
- package/build/dist/Models/DatabaseModels/LlmProvider.js.map +1 -1
- package/build/dist/Server/API/AIChatAPI.js +498 -0
- package/build/dist/Server/API/AIChatAPI.js.map +1 -0
- package/build/dist/Server/API/LlmProviderAPI.js +107 -1
- package/build/dist/Server/API/LlmProviderAPI.js.map +1 -1
- package/build/dist/Server/API/MicrosoftTeamsAPI.js +4 -0
- package/build/dist/Server/API/MicrosoftTeamsAPI.js.map +1 -1
- package/build/dist/Server/API/SlackAPI.js +442 -0
- package/build/dist/Server/API/SlackAPI.js.map +1 -1
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783363279075-AddAIChatModels.js +96 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783363279075-AddAIChatModels.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783443471795-AddLlmProviderToAIConversation.js +25 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783443471795-AddLlmProviderToAIConversation.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783453297388-AddAIChatWriteActionsAndWidgets.js +31 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783453297388-AddAIChatWriteActionsAndWidgets.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783461767405-MigrationName.js +46 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783461767405-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +8 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
- package/build/dist/Server/Services/AIConversationMessageService.js +34 -0
- package/build/dist/Server/Services/AIConversationMessageService.js.map +1 -0
- package/build/dist/Server/Services/AIConversationService.js +42 -0
- package/build/dist/Server/Services/AIConversationService.js.map +1 -0
- package/build/dist/Server/Services/AIRunEventService.js +34 -0
- package/build/dist/Server/Services/AIRunEventService.js.map +1 -0
- package/build/dist/Server/Services/AIRunService.js +34 -0
- package/build/dist/Server/Services/AIRunService.js.map +1 -0
- package/build/dist/Server/Services/AIService.js +31 -23
- package/build/dist/Server/Services/AIService.js.map +1 -1
- package/build/dist/Server/Services/DatabaseService.js +10 -0
- package/build/dist/Server/Services/DatabaseService.js.map +1 -1
- package/build/dist/Server/Services/LlmProviderService.js +108 -0
- package/build/dist/Server/Services/LlmProviderService.js.map +1 -1
- package/build/dist/Server/Services/ProjectService.js +25 -0
- package/build/dist/Server/Services/ProjectService.js.map +1 -1
- package/build/dist/Server/Types/AnalyticsDatabase/ModelPermission.js +50 -7
- package/build/dist/Server/Types/AnalyticsDatabase/ModelPermission.js.map +1 -1
- package/build/dist/Server/Utils/AI/AIChatPrivacyFilter.js +18 -0
- package/build/dist/Server/Utils/AI/AIChatPrivacyFilter.js.map +1 -0
- package/build/dist/Server/Utils/AI/Chat/ChatAgentRunner.js +745 -0
- package/build/dist/Server/Utils/AI/Chat/ChatAgentRunner.js.map +1 -0
- package/build/dist/Server/Utils/AI/Chat/ObservabilityAssistant.js +165 -0
- package/build/dist/Server/Utils/AI/Chat/ObservabilityAssistant.js.map +1 -0
- package/build/dist/Server/Utils/AI/Chat/ObservabilityChatPrompt.js +44 -0
- package/build/dist/Server/Utils/AI/Chat/ObservabilityChatPrompt.js.map +1 -0
- package/build/dist/Server/Utils/AI/Toolbox/AlertTools.js +167 -0
- package/build/dist/Server/Utils/AI/Toolbox/AlertTools.js.map +1 -0
- package/build/dist/Server/Utils/AI/Toolbox/AlertWriteTools.js +136 -0
- package/build/dist/Server/Utils/AI/Toolbox/AlertWriteTools.js.map +1 -0
- package/build/dist/Server/Utils/AI/Toolbox/ContextTools.js +141 -0
- package/build/dist/Server/Utils/AI/Toolbox/ContextTools.js.map +1 -0
- package/build/dist/Server/Utils/AI/Toolbox/ExceptionTools.js +117 -0
- package/build/dist/Server/Utils/AI/Toolbox/ExceptionTools.js.map +1 -0
- package/build/dist/Server/Utils/AI/Toolbox/IncidentTools.js +167 -0
- package/build/dist/Server/Utils/AI/Toolbox/IncidentTools.js.map +1 -0
- package/build/dist/Server/Utils/AI/Toolbox/IncidentWriteTools.js +280 -0
- package/build/dist/Server/Utils/AI/Toolbox/IncidentWriteTools.js.map +1 -0
- package/build/dist/Server/Utils/AI/Toolbox/Index.js +150 -0
- package/build/dist/Server/Utils/AI/Toolbox/Index.js.map +1 -0
- package/build/dist/Server/Utils/AI/Toolbox/LogTools.js +246 -0
- package/build/dist/Server/Utils/AI/Toolbox/LogTools.js.map +1 -0
- package/build/dist/Server/Utils/AI/Toolbox/MetricTools.js +120 -0
- package/build/dist/Server/Utils/AI/Toolbox/MetricTools.js.map +1 -0
- package/build/dist/Server/Utils/AI/Toolbox/MonitorTools.js +158 -0
- package/build/dist/Server/Utils/AI/Toolbox/MonitorTools.js.map +1 -0
- package/build/dist/Server/Utils/AI/Toolbox/Serializer.js +188 -0
- package/build/dist/Server/Utils/AI/Toolbox/Serializer.js.map +1 -0
- package/build/dist/Server/Utils/AI/Toolbox/ToolTypes.js +142 -0
- package/build/dist/Server/Utils/AI/Toolbox/ToolTypes.js.map +1 -0
- package/build/dist/Server/Utils/AI/Toolbox/TraceTools.js +309 -0
- package/build/dist/Server/Utils/AI/Toolbox/TraceTools.js.map +1 -0
- package/build/dist/Server/Utils/AI/Toolbox/WidgetBuilder.js +120 -0
- package/build/dist/Server/Utils/AI/Toolbox/WidgetBuilder.js.map +1 -0
- package/build/dist/Server/Utils/LLM/LLMService.js +372 -88
- package/build/dist/Server/Utils/LLM/LLMService.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js +378 -15
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/Slack/Slack.js +59 -0
- package/build/dist/Server/Utils/Workspace/Slack/Slack.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/Slack/app-manifest.json +16 -1
- package/build/dist/Types/AI/AIChatMessageRole.js +7 -0
- package/build/dist/Types/AI/AIChatMessageRole.js.map +1 -0
- package/build/dist/Types/AI/AIChatMessageStatus.js +27 -0
- package/build/dist/Types/AI/AIChatMessageStatus.js.map +1 -0
- package/build/dist/Types/AI/AIChatPermissionMode.js +53 -0
- package/build/dist/Types/AI/AIChatPermissionMode.js.map +1 -0
- package/build/dist/Types/AI/AIChatTypes.js +74 -0
- package/build/dist/Types/AI/AIChatTypes.js.map +1 -0
- package/build/dist/Types/AI/AIRunEventType.js +18 -0
- package/build/dist/Types/AI/AIRunEventType.js.map +1 -0
- package/build/dist/Types/AI/AIRunStatus.js +26 -0
- package/build/dist/Types/AI/AIRunStatus.js.map +1 -0
- package/build/dist/Types/AI/AIRunType.js +7 -0
- package/build/dist/Types/AI/AIRunType.js.map +1 -0
- package/build/dist/Types/LLM/LlmType.js +6 -0
- package/build/dist/Types/LLM/LlmType.js.map +1 -1
- package/build/dist/UI/Components/Header/HeaderIconDropdownButton.js +10 -5
- package/build/dist/UI/Components/Header/HeaderIconDropdownButton.js.map +1 -1
- package/build/dist/UI/Components/Markdown.tsx/MarkdownViewer.js +18 -4
- package/build/dist/UI/Components/Markdown.tsx/MarkdownViewer.js.map +1 -1
- package/build/dist/UI/Components/Page/Page.js +3 -1
- package/build/dist/UI/Components/Page/Page.js.map +1 -1
- package/build/dist/UI/Utils/LlmTypeDropdownOptions.js +38 -0
- package/build/dist/UI/Utils/LlmTypeDropdownOptions.js.map +1 -0
- package/build/dist/UI/Utils/TestLLMProvider.js +37 -0
- package/build/dist/UI/Utils/TestLLMProvider.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner } from "typeorm";
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Generated via `npm run generate-postgres-migration`, then trimmed to only
|
|
5
|
+
* the statements belonging to this feature (the generator also emitted
|
|
6
|
+
* unrelated constraint-name drift on IncidentReminderRuleLabel /
|
|
7
|
+
* AlertReminderRuleLabel / OnCallDutyPolicyScheduleLayer, which was removed).
|
|
8
|
+
*/
|
|
9
|
+
export class AddAIChatModels1783363279075 implements MigrationInterface {
|
|
10
|
+
public name = "AddAIChatModels1783363279075";
|
|
11
|
+
|
|
12
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
13
|
+
await queryRunner.query(
|
|
14
|
+
`CREATE TABLE "AIConversation" ("_id" uuid NOT NULL DEFAULT uuid_generate_v4(), "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, "version" integer NOT NULL, "projectId" uuid NOT NULL, "title" character varying(100), "lastMessageAt" TIMESTAMP WITH TIME ZONE, "deletedByUserId" uuid, "createdByUserId" uuid, CONSTRAINT "PK_f9ae2849d2382ff411b526a1645" PRIMARY KEY ("_id"))`,
|
|
15
|
+
);
|
|
16
|
+
await queryRunner.query(
|
|
17
|
+
`CREATE INDEX "IDX_1fc2d5528985dbd00d3243ef77" ON "AIConversation" ("projectId") `,
|
|
18
|
+
);
|
|
19
|
+
await queryRunner.query(
|
|
20
|
+
`CREATE INDEX "IDX_19e03fd4c8ae71e0a5c64a8701" ON "AIConversation" ("createdByUserId") `,
|
|
21
|
+
);
|
|
22
|
+
await queryRunner.query(
|
|
23
|
+
`CREATE TABLE "AIConversationMessage" ("_id" uuid NOT NULL DEFAULT uuid_generate_v4(), "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, "version" integer NOT NULL, "projectId" uuid NOT NULL, "conversationId" uuid NOT NULL, "userId" uuid, "role" character varying(100) NOT NULL, "contentInMarkdown" text, "status" character varying(100) NOT NULL DEFAULT 'Pending', "aiRunId" uuid, "citations" jsonb, "errorMessage" character varying(500), "deletedByUserId" uuid, "createdByUserId" uuid, CONSTRAINT "PK_a6f2d3fc75abcec2c7237fd42cc" PRIMARY KEY ("_id"))`,
|
|
24
|
+
);
|
|
25
|
+
await queryRunner.query(
|
|
26
|
+
`CREATE INDEX "IDX_0bbb53963364a2c8153a891a9e" ON "AIConversationMessage" ("projectId") `,
|
|
27
|
+
);
|
|
28
|
+
await queryRunner.query(
|
|
29
|
+
`CREATE INDEX "IDX_e660119718045d3396ef56f67c" ON "AIConversationMessage" ("conversationId") `,
|
|
30
|
+
);
|
|
31
|
+
await queryRunner.query(
|
|
32
|
+
`CREATE INDEX "IDX_4533fdeffdf903fc39d84962db" ON "AIConversationMessage" ("userId") `,
|
|
33
|
+
);
|
|
34
|
+
await queryRunner.query(
|
|
35
|
+
`CREATE INDEX "IDX_5769a1fdc026fa498ca31b8d5c" ON "AIConversationMessage" ("status") `,
|
|
36
|
+
);
|
|
37
|
+
await queryRunner.query(
|
|
38
|
+
`CREATE INDEX "IDX_1beee3451a31dc92b12683565b" ON "AIConversationMessage" ("aiRunId") `,
|
|
39
|
+
);
|
|
40
|
+
await queryRunner.query(
|
|
41
|
+
`CREATE TABLE "AIRun" ("_id" uuid NOT NULL DEFAULT uuid_generate_v4(), "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, "version" integer NOT NULL, "projectId" uuid NOT NULL, "runType" character varying(100) NOT NULL, "status" character varying(100) NOT NULL DEFAULT 'Running', "userId" uuid, "conversationId" uuid, "startedAt" TIMESTAMP WITH TIME ZONE, "completedAt" TIMESTAMP WITH TIME ZONE, "lastHeartbeatAt" TIMESTAMP WITH TIME ZONE, "llmCallCount" integer DEFAULT '0', "toolCallCount" integer DEFAULT '0', "totalTokens" integer DEFAULT '0', "totalCostInUSDCents" integer DEFAULT '0', "egressManifest" jsonb, "errorMessage" character varying(500), "deletedByUserId" uuid, "createdByUserId" uuid, CONSTRAINT "PK_a71750bd07ca6019818ed65a2c5" PRIMARY KEY ("_id"))`,
|
|
42
|
+
);
|
|
43
|
+
await queryRunner.query(
|
|
44
|
+
`CREATE INDEX "IDX_23729c7401ec1b0daf86a724da" ON "AIRun" ("projectId") `,
|
|
45
|
+
);
|
|
46
|
+
await queryRunner.query(
|
|
47
|
+
`CREATE INDEX "IDX_d6744710383a6aac64954eede2" ON "AIRun" ("runType") `,
|
|
48
|
+
);
|
|
49
|
+
await queryRunner.query(
|
|
50
|
+
`CREATE INDEX "IDX_7bd25907183e34a6f349135c19" ON "AIRun" ("status") `,
|
|
51
|
+
);
|
|
52
|
+
await queryRunner.query(
|
|
53
|
+
`CREATE INDEX "IDX_8cd3e8e58dc28ca23e9b924dbc" ON "AIRun" ("userId") `,
|
|
54
|
+
);
|
|
55
|
+
await queryRunner.query(
|
|
56
|
+
`CREATE INDEX "IDX_349eb329160e8d711ef05a65b4" ON "AIRun" ("conversationId") `,
|
|
57
|
+
);
|
|
58
|
+
await queryRunner.query(
|
|
59
|
+
`CREATE TABLE "AIRunEvent" ("_id" uuid NOT NULL DEFAULT uuid_generate_v4(), "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, "version" integer NOT NULL, "projectId" uuid NOT NULL, "aiRunId" uuid NOT NULL, "userId" uuid, "sequence" integer NOT NULL DEFAULT '0', "eventType" character varying(100) NOT NULL, "toolName" character varying(100), "toolArguments" jsonb, "resultSummary" jsonb, "citationId" character varying(100), "deletedByUserId" uuid, "createdByUserId" uuid, CONSTRAINT "PK_19b30c343e59e5e016b96e8e6a3" PRIMARY KEY ("_id"))`,
|
|
60
|
+
);
|
|
61
|
+
await queryRunner.query(
|
|
62
|
+
`CREATE INDEX "IDX_fdbbcfad6f57e0bae84a500338" ON "AIRunEvent" ("projectId") `,
|
|
63
|
+
);
|
|
64
|
+
await queryRunner.query(
|
|
65
|
+
`CREATE INDEX "IDX_dce6a1de62fcb9d2048193eec7" ON "AIRunEvent" ("aiRunId") `,
|
|
66
|
+
);
|
|
67
|
+
await queryRunner.query(
|
|
68
|
+
`CREATE INDEX "IDX_277cea453e287633b7b459e373" ON "AIRunEvent" ("userId") `,
|
|
69
|
+
);
|
|
70
|
+
await queryRunner.query(
|
|
71
|
+
`CREATE INDEX "IDX_4896cb21f9b5d4a72b353e2cc5" ON "AIRunEvent" ("eventType") `,
|
|
72
|
+
);
|
|
73
|
+
await queryRunner.query(`ALTER TABLE "LlmLog" ADD "aiRunId" uuid`);
|
|
74
|
+
await queryRunner.query(
|
|
75
|
+
`CREATE INDEX "IDX_0f6b41bb3c1f675ac55f5e9a06" ON "LlmLog" ("aiRunId") `,
|
|
76
|
+
);
|
|
77
|
+
await queryRunner.query(
|
|
78
|
+
`ALTER TABLE "AIConversation" ADD CONSTRAINT "FK_1fc2d5528985dbd00d3243ef771" FOREIGN KEY ("projectId") REFERENCES "Project"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
|
79
|
+
);
|
|
80
|
+
await queryRunner.query(
|
|
81
|
+
`ALTER TABLE "AIConversation" ADD CONSTRAINT "FK_17a3378eefeacaaff1aac421a75" FOREIGN KEY ("deletedByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
|
|
82
|
+
);
|
|
83
|
+
await queryRunner.query(
|
|
84
|
+
`ALTER TABLE "AIConversation" ADD CONSTRAINT "FK_19e03fd4c8ae71e0a5c64a87013" FOREIGN KEY ("createdByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
|
|
85
|
+
);
|
|
86
|
+
await queryRunner.query(
|
|
87
|
+
`ALTER TABLE "AIConversationMessage" ADD CONSTRAINT "FK_0bbb53963364a2c8153a891a9ec" FOREIGN KEY ("projectId") REFERENCES "Project"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
|
88
|
+
);
|
|
89
|
+
await queryRunner.query(
|
|
90
|
+
`ALTER TABLE "AIConversationMessage" ADD CONSTRAINT "FK_e660119718045d3396ef56f67c0" FOREIGN KEY ("conversationId") REFERENCES "AIConversation"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
|
91
|
+
);
|
|
92
|
+
await queryRunner.query(
|
|
93
|
+
`ALTER TABLE "AIConversationMessage" ADD CONSTRAINT "FK_4533fdeffdf903fc39d84962db7" FOREIGN KEY ("userId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
|
|
94
|
+
);
|
|
95
|
+
await queryRunner.query(
|
|
96
|
+
`ALTER TABLE "AIConversationMessage" ADD CONSTRAINT "FK_86d4a9000d6505b1df390835582" FOREIGN KEY ("deletedByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
|
|
97
|
+
);
|
|
98
|
+
await queryRunner.query(
|
|
99
|
+
`ALTER TABLE "AIConversationMessage" ADD CONSTRAINT "FK_bbb0e64455f8db0cf88a1a6e41c" FOREIGN KEY ("createdByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
|
|
100
|
+
);
|
|
101
|
+
await queryRunner.query(
|
|
102
|
+
`ALTER TABLE "AIRun" ADD CONSTRAINT "FK_23729c7401ec1b0daf86a724dad" FOREIGN KEY ("projectId") REFERENCES "Project"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
|
103
|
+
);
|
|
104
|
+
await queryRunner.query(
|
|
105
|
+
`ALTER TABLE "AIRun" ADD CONSTRAINT "FK_8cd3e8e58dc28ca23e9b924dbc4" FOREIGN KEY ("userId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
|
|
106
|
+
);
|
|
107
|
+
await queryRunner.query(
|
|
108
|
+
`ALTER TABLE "AIRun" ADD CONSTRAINT "FK_349eb329160e8d711ef05a65b4c" FOREIGN KEY ("conversationId") REFERENCES "AIConversation"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
|
109
|
+
);
|
|
110
|
+
await queryRunner.query(
|
|
111
|
+
`ALTER TABLE "AIRun" ADD CONSTRAINT "FK_d43a154faca8c5073d3072b9a14" FOREIGN KEY ("deletedByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
|
|
112
|
+
);
|
|
113
|
+
await queryRunner.query(
|
|
114
|
+
`ALTER TABLE "AIRun" ADD CONSTRAINT "FK_81b7bd8f4b697f16ff85dbe0b19" FOREIGN KEY ("createdByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
|
|
115
|
+
);
|
|
116
|
+
await queryRunner.query(
|
|
117
|
+
`ALTER TABLE "AIRunEvent" ADD CONSTRAINT "FK_fdbbcfad6f57e0bae84a5003383" FOREIGN KEY ("projectId") REFERENCES "Project"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
|
118
|
+
);
|
|
119
|
+
await queryRunner.query(
|
|
120
|
+
`ALTER TABLE "AIRunEvent" ADD CONSTRAINT "FK_dce6a1de62fcb9d2048193eec70" FOREIGN KEY ("aiRunId") REFERENCES "AIRun"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
|
121
|
+
);
|
|
122
|
+
await queryRunner.query(
|
|
123
|
+
`ALTER TABLE "AIRunEvent" ADD CONSTRAINT "FK_277cea453e287633b7b459e373d" FOREIGN KEY ("userId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
|
|
124
|
+
);
|
|
125
|
+
await queryRunner.query(
|
|
126
|
+
`ALTER TABLE "AIRunEvent" ADD CONSTRAINT "FK_23c6b5f0bfd37523850372f7828" FOREIGN KEY ("deletedByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
|
|
127
|
+
);
|
|
128
|
+
await queryRunner.query(
|
|
129
|
+
`ALTER TABLE "AIRunEvent" ADD CONSTRAINT "FK_a11507527559882e51476fff1fe" FOREIGN KEY ("createdByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
134
|
+
await queryRunner.query(
|
|
135
|
+
`ALTER TABLE "AIRunEvent" DROP CONSTRAINT "FK_a11507527559882e51476fff1fe"`,
|
|
136
|
+
);
|
|
137
|
+
await queryRunner.query(
|
|
138
|
+
`ALTER TABLE "AIRunEvent" DROP CONSTRAINT "FK_23c6b5f0bfd37523850372f7828"`,
|
|
139
|
+
);
|
|
140
|
+
await queryRunner.query(
|
|
141
|
+
`ALTER TABLE "AIRunEvent" DROP CONSTRAINT "FK_277cea453e287633b7b459e373d"`,
|
|
142
|
+
);
|
|
143
|
+
await queryRunner.query(
|
|
144
|
+
`ALTER TABLE "AIRunEvent" DROP CONSTRAINT "FK_dce6a1de62fcb9d2048193eec70"`,
|
|
145
|
+
);
|
|
146
|
+
await queryRunner.query(
|
|
147
|
+
`ALTER TABLE "AIRunEvent" DROP CONSTRAINT "FK_fdbbcfad6f57e0bae84a5003383"`,
|
|
148
|
+
);
|
|
149
|
+
await queryRunner.query(
|
|
150
|
+
`ALTER TABLE "AIRun" DROP CONSTRAINT "FK_81b7bd8f4b697f16ff85dbe0b19"`,
|
|
151
|
+
);
|
|
152
|
+
await queryRunner.query(
|
|
153
|
+
`ALTER TABLE "AIRun" DROP CONSTRAINT "FK_d43a154faca8c5073d3072b9a14"`,
|
|
154
|
+
);
|
|
155
|
+
await queryRunner.query(
|
|
156
|
+
`ALTER TABLE "AIRun" DROP CONSTRAINT "FK_349eb329160e8d711ef05a65b4c"`,
|
|
157
|
+
);
|
|
158
|
+
await queryRunner.query(
|
|
159
|
+
`ALTER TABLE "AIRun" DROP CONSTRAINT "FK_8cd3e8e58dc28ca23e9b924dbc4"`,
|
|
160
|
+
);
|
|
161
|
+
await queryRunner.query(
|
|
162
|
+
`ALTER TABLE "AIRun" DROP CONSTRAINT "FK_23729c7401ec1b0daf86a724dad"`,
|
|
163
|
+
);
|
|
164
|
+
await queryRunner.query(
|
|
165
|
+
`ALTER TABLE "AIConversationMessage" DROP CONSTRAINT "FK_bbb0e64455f8db0cf88a1a6e41c"`,
|
|
166
|
+
);
|
|
167
|
+
await queryRunner.query(
|
|
168
|
+
`ALTER TABLE "AIConversationMessage" DROP CONSTRAINT "FK_86d4a9000d6505b1df390835582"`,
|
|
169
|
+
);
|
|
170
|
+
await queryRunner.query(
|
|
171
|
+
`ALTER TABLE "AIConversationMessage" DROP CONSTRAINT "FK_4533fdeffdf903fc39d84962db7"`,
|
|
172
|
+
);
|
|
173
|
+
await queryRunner.query(
|
|
174
|
+
`ALTER TABLE "AIConversationMessage" DROP CONSTRAINT "FK_e660119718045d3396ef56f67c0"`,
|
|
175
|
+
);
|
|
176
|
+
await queryRunner.query(
|
|
177
|
+
`ALTER TABLE "AIConversationMessage" DROP CONSTRAINT "FK_0bbb53963364a2c8153a891a9ec"`,
|
|
178
|
+
);
|
|
179
|
+
await queryRunner.query(
|
|
180
|
+
`ALTER TABLE "AIConversation" DROP CONSTRAINT "FK_19e03fd4c8ae71e0a5c64a87013"`,
|
|
181
|
+
);
|
|
182
|
+
await queryRunner.query(
|
|
183
|
+
`ALTER TABLE "AIConversation" DROP CONSTRAINT "FK_17a3378eefeacaaff1aac421a75"`,
|
|
184
|
+
);
|
|
185
|
+
await queryRunner.query(
|
|
186
|
+
`ALTER TABLE "AIConversation" DROP CONSTRAINT "FK_1fc2d5528985dbd00d3243ef771"`,
|
|
187
|
+
);
|
|
188
|
+
await queryRunner.query(
|
|
189
|
+
`DROP INDEX "public"."IDX_0f6b41bb3c1f675ac55f5e9a06"`,
|
|
190
|
+
);
|
|
191
|
+
await queryRunner.query(`ALTER TABLE "LlmLog" DROP COLUMN "aiRunId"`);
|
|
192
|
+
await queryRunner.query(
|
|
193
|
+
`DROP INDEX "public"."IDX_4896cb21f9b5d4a72b353e2cc5"`,
|
|
194
|
+
);
|
|
195
|
+
await queryRunner.query(
|
|
196
|
+
`DROP INDEX "public"."IDX_277cea453e287633b7b459e373"`,
|
|
197
|
+
);
|
|
198
|
+
await queryRunner.query(
|
|
199
|
+
`DROP INDEX "public"."IDX_dce6a1de62fcb9d2048193eec7"`,
|
|
200
|
+
);
|
|
201
|
+
await queryRunner.query(
|
|
202
|
+
`DROP INDEX "public"."IDX_fdbbcfad6f57e0bae84a500338"`,
|
|
203
|
+
);
|
|
204
|
+
await queryRunner.query(`DROP TABLE "AIRunEvent"`);
|
|
205
|
+
await queryRunner.query(
|
|
206
|
+
`DROP INDEX "public"."IDX_349eb329160e8d711ef05a65b4"`,
|
|
207
|
+
);
|
|
208
|
+
await queryRunner.query(
|
|
209
|
+
`DROP INDEX "public"."IDX_8cd3e8e58dc28ca23e9b924dbc"`,
|
|
210
|
+
);
|
|
211
|
+
await queryRunner.query(
|
|
212
|
+
`DROP INDEX "public"."IDX_7bd25907183e34a6f349135c19"`,
|
|
213
|
+
);
|
|
214
|
+
await queryRunner.query(
|
|
215
|
+
`DROP INDEX "public"."IDX_d6744710383a6aac64954eede2"`,
|
|
216
|
+
);
|
|
217
|
+
await queryRunner.query(
|
|
218
|
+
`DROP INDEX "public"."IDX_23729c7401ec1b0daf86a724da"`,
|
|
219
|
+
);
|
|
220
|
+
await queryRunner.query(`DROP TABLE "AIRun"`);
|
|
221
|
+
await queryRunner.query(
|
|
222
|
+
`DROP INDEX "public"."IDX_1beee3451a31dc92b12683565b"`,
|
|
223
|
+
);
|
|
224
|
+
await queryRunner.query(
|
|
225
|
+
`DROP INDEX "public"."IDX_5769a1fdc026fa498ca31b8d5c"`,
|
|
226
|
+
);
|
|
227
|
+
await queryRunner.query(
|
|
228
|
+
`DROP INDEX "public"."IDX_4533fdeffdf903fc39d84962db"`,
|
|
229
|
+
);
|
|
230
|
+
await queryRunner.query(
|
|
231
|
+
`DROP INDEX "public"."IDX_e660119718045d3396ef56f67c"`,
|
|
232
|
+
);
|
|
233
|
+
await queryRunner.query(
|
|
234
|
+
`DROP INDEX "public"."IDX_0bbb53963364a2c8153a891a9e"`,
|
|
235
|
+
);
|
|
236
|
+
await queryRunner.query(`DROP TABLE "AIConversationMessage"`);
|
|
237
|
+
await queryRunner.query(
|
|
238
|
+
`DROP INDEX "public"."IDX_19e03fd4c8ae71e0a5c64a8701"`,
|
|
239
|
+
);
|
|
240
|
+
await queryRunner.query(
|
|
241
|
+
`DROP INDEX "public"."IDX_1fc2d5528985dbd00d3243ef77"`,
|
|
242
|
+
);
|
|
243
|
+
await queryRunner.query(`DROP TABLE "AIConversation"`);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner } from "typeorm";
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Generated via `npm run generate-postgres-migration`, then trimmed to only the
|
|
5
|
+
* statements belonging to this feature (the generator also re-emitted unrelated
|
|
6
|
+
* constraint-name drift on IncidentReminderRuleLabel / AlertReminderRuleLabel
|
|
7
|
+
* and default drift on OnCallDutyPolicyScheduleLayer, which was removed).
|
|
8
|
+
*
|
|
9
|
+
* Adds the per-conversation LLM provider selection column that powers the
|
|
10
|
+
* in-chat provider/model switcher. Plain uuid (no FK) so it can point at a
|
|
11
|
+
* global provider and so deleting a provider degrades to the default rather
|
|
12
|
+
* than cascading.
|
|
13
|
+
*/
|
|
14
|
+
export class AddLlmProviderToAIConversation1783443471795
|
|
15
|
+
implements MigrationInterface
|
|
16
|
+
{
|
|
17
|
+
public name = "AddLlmProviderToAIConversation1783443471795";
|
|
18
|
+
|
|
19
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
20
|
+
await queryRunner.query(
|
|
21
|
+
`ALTER TABLE "AIConversation" ADD "llmProviderId" uuid`,
|
|
22
|
+
);
|
|
23
|
+
await queryRunner.query(
|
|
24
|
+
`CREATE INDEX "IDX_7d2d5dac9e8e8fd9f33e629787" ON "AIConversation" ("llmProviderId") `,
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
29
|
+
await queryRunner.query(
|
|
30
|
+
`DROP INDEX "public"."IDX_7d2d5dac9e8e8fd9f33e629787"`,
|
|
31
|
+
);
|
|
32
|
+
await queryRunner.query(
|
|
33
|
+
`ALTER TABLE "AIConversation" DROP COLUMN "llmProviderId"`,
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner } from "typeorm";
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Generated via `npm run generate-postgres-migration`, then trimmed to only the
|
|
5
|
+
* statements belonging to this feature (the generator also re-emitted unrelated
|
|
6
|
+
* constraint-name drift on IncidentReminderRuleLabel / AlertReminderRuleLabel
|
|
7
|
+
* and default drift on OnCallDutyPolicyScheduleLayer, which was removed).
|
|
8
|
+
*
|
|
9
|
+
* Turns the AI copilot from read-only into an agent that can act:
|
|
10
|
+
* - AIConversation.permissionMode: per-conversation autonomy for mutating tools
|
|
11
|
+
* (AskForApproval | AutoRun | ReadOnly).
|
|
12
|
+
* - AIConversationMessage.widgets: inline charts/tables/traces rendered in chat.
|
|
13
|
+
* - AIConversationMessage.toolActions: mutating actions + their approval status.
|
|
14
|
+
* - AIRun.pausedState: serialized turn state saved while awaiting approval.
|
|
15
|
+
*/
|
|
16
|
+
export class AddAIChatWriteActionsAndWidgets1783453297388
|
|
17
|
+
implements MigrationInterface
|
|
18
|
+
{
|
|
19
|
+
public name = "AddAIChatWriteActionsAndWidgets1783453297388";
|
|
20
|
+
|
|
21
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
22
|
+
await queryRunner.query(
|
|
23
|
+
`ALTER TABLE "AIConversation" ADD "permissionMode" character varying(100)`,
|
|
24
|
+
);
|
|
25
|
+
await queryRunner.query(
|
|
26
|
+
`ALTER TABLE "AIConversationMessage" ADD "widgets" jsonb`,
|
|
27
|
+
);
|
|
28
|
+
await queryRunner.query(
|
|
29
|
+
`ALTER TABLE "AIConversationMessage" ADD "toolActions" jsonb`,
|
|
30
|
+
);
|
|
31
|
+
await queryRunner.query(`ALTER TABLE "AIRun" ADD "pausedState" jsonb`);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
35
|
+
await queryRunner.query(`ALTER TABLE "AIRun" DROP COLUMN "pausedState"`);
|
|
36
|
+
await queryRunner.query(
|
|
37
|
+
`ALTER TABLE "AIConversationMessage" DROP COLUMN "toolActions"`,
|
|
38
|
+
);
|
|
39
|
+
await queryRunner.query(
|
|
40
|
+
`ALTER TABLE "AIConversationMessage" DROP COLUMN "widgets"`,
|
|
41
|
+
);
|
|
42
|
+
await queryRunner.query(
|
|
43
|
+
`ALTER TABLE "AIConversation" DROP COLUMN "permissionMode"`,
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner } from "typeorm";
|
|
2
|
+
|
|
3
|
+
export class MigrationName1783461767405 implements MigrationInterface {
|
|
4
|
+
public name = "MigrationName1783461767405";
|
|
5
|
+
|
|
6
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
7
|
+
await queryRunner.query(
|
|
8
|
+
`ALTER TABLE "IncidentReminderRuleLabel" DROP CONSTRAINT "FK_ce1b7a4d3f0e8c2a9b5d6e14f21"`,
|
|
9
|
+
);
|
|
10
|
+
await queryRunner.query(
|
|
11
|
+
`ALTER TABLE "IncidentReminderRuleLabel" DROP CONSTRAINT "FK_da5c8e6f2b1a4d7c093e5f18a37"`,
|
|
12
|
+
);
|
|
13
|
+
await queryRunner.query(
|
|
14
|
+
`ALTER TABLE "AlertReminderRuleLabel" DROP CONSTRAINT "FK_bf4d6e8a0c2153749b5c7d9e0f2"`,
|
|
15
|
+
);
|
|
16
|
+
await queryRunner.query(
|
|
17
|
+
`ALTER TABLE "AlertReminderRuleLabel" DROP CONSTRAINT "FK_cd7e9f1b3a5062748c6d8e0f193"`,
|
|
18
|
+
);
|
|
19
|
+
await queryRunner.query(
|
|
20
|
+
`DROP INDEX "public"."IDX_ce1b7a4d3f0e8c2a9b5d6e14f21"`,
|
|
21
|
+
);
|
|
22
|
+
await queryRunner.query(
|
|
23
|
+
`DROP INDEX "public"."IDX_da5c8e6f2b1a4d7c093e5f18a37"`,
|
|
24
|
+
);
|
|
25
|
+
await queryRunner.query(
|
|
26
|
+
`DROP INDEX "public"."IDX_bf4d6e8a0c2153749b5c7d9e0f2"`,
|
|
27
|
+
);
|
|
28
|
+
await queryRunner.query(
|
|
29
|
+
`DROP INDEX "public"."IDX_cd7e9f1b3a5062748c6d8e0f193"`,
|
|
30
|
+
);
|
|
31
|
+
await queryRunner.query(
|
|
32
|
+
`ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "rotation" SET DEFAULT '{"_type":"Recurring","value":{"intervalType":"Day","intervalCount":{"_type":"PositiveNumber","value":1}}}'`,
|
|
33
|
+
);
|
|
34
|
+
await queryRunner.query(
|
|
35
|
+
`ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "restrictionTimes" SET DEFAULT '{"_type":"RestrictionTimes","value":{"restictionType":"None","dayRestrictionTimes":null,"weeklyRestrictionTimes":[]}}'`,
|
|
36
|
+
);
|
|
37
|
+
await queryRunner.query(
|
|
38
|
+
`CREATE INDEX "IDX_2c8a45bfcf02645455551c4edd" ON "IncidentReminderRuleLabel" ("incidentReminderRuleId") `,
|
|
39
|
+
);
|
|
40
|
+
await queryRunner.query(
|
|
41
|
+
`CREATE INDEX "IDX_87d4d1b6ba59d3407d2f9de85a" ON "IncidentReminderRuleLabel" ("labelId") `,
|
|
42
|
+
);
|
|
43
|
+
await queryRunner.query(
|
|
44
|
+
`CREATE INDEX "IDX_ae5faeec76bb9eae5350efad6f" ON "AlertReminderRuleLabel" ("alertReminderRuleId") `,
|
|
45
|
+
);
|
|
46
|
+
await queryRunner.query(
|
|
47
|
+
`CREATE INDEX "IDX_5d531edf3ddca07b03d352a60f" ON "AlertReminderRuleLabel" ("labelId") `,
|
|
48
|
+
);
|
|
49
|
+
await queryRunner.query(
|
|
50
|
+
`ALTER TABLE "IncidentReminderRuleLabel" ADD CONSTRAINT "FK_2c8a45bfcf02645455551c4edda" FOREIGN KEY ("incidentReminderRuleId") REFERENCES "IncidentReminderRule"("_id") ON DELETE CASCADE ON UPDATE CASCADE`,
|
|
51
|
+
);
|
|
52
|
+
await queryRunner.query(
|
|
53
|
+
`ALTER TABLE "IncidentReminderRuleLabel" ADD CONSTRAINT "FK_87d4d1b6ba59d3407d2f9de85a1" FOREIGN KEY ("labelId") REFERENCES "Label"("_id") ON DELETE CASCADE ON UPDATE CASCADE`,
|
|
54
|
+
);
|
|
55
|
+
await queryRunner.query(
|
|
56
|
+
`ALTER TABLE "AlertReminderRuleLabel" ADD CONSTRAINT "FK_ae5faeec76bb9eae5350efad6fa" FOREIGN KEY ("alertReminderRuleId") REFERENCES "AlertReminderRule"("_id") ON DELETE CASCADE ON UPDATE CASCADE`,
|
|
57
|
+
);
|
|
58
|
+
await queryRunner.query(
|
|
59
|
+
`ALTER TABLE "AlertReminderRuleLabel" ADD CONSTRAINT "FK_5d531edf3ddca07b03d352a60f5" FOREIGN KEY ("labelId") REFERENCES "Label"("_id") ON DELETE CASCADE ON UPDATE CASCADE`,
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
64
|
+
await queryRunner.query(
|
|
65
|
+
`ALTER TABLE "AlertReminderRuleLabel" DROP CONSTRAINT "FK_5d531edf3ddca07b03d352a60f5"`,
|
|
66
|
+
);
|
|
67
|
+
await queryRunner.query(
|
|
68
|
+
`ALTER TABLE "AlertReminderRuleLabel" DROP CONSTRAINT "FK_ae5faeec76bb9eae5350efad6fa"`,
|
|
69
|
+
);
|
|
70
|
+
await queryRunner.query(
|
|
71
|
+
`ALTER TABLE "IncidentReminderRuleLabel" DROP CONSTRAINT "FK_87d4d1b6ba59d3407d2f9de85a1"`,
|
|
72
|
+
);
|
|
73
|
+
await queryRunner.query(
|
|
74
|
+
`ALTER TABLE "IncidentReminderRuleLabel" DROP CONSTRAINT "FK_2c8a45bfcf02645455551c4edda"`,
|
|
75
|
+
);
|
|
76
|
+
await queryRunner.query(
|
|
77
|
+
`DROP INDEX "public"."IDX_5d531edf3ddca07b03d352a60f"`,
|
|
78
|
+
);
|
|
79
|
+
await queryRunner.query(
|
|
80
|
+
`DROP INDEX "public"."IDX_ae5faeec76bb9eae5350efad6f"`,
|
|
81
|
+
);
|
|
82
|
+
await queryRunner.query(
|
|
83
|
+
`DROP INDEX "public"."IDX_87d4d1b6ba59d3407d2f9de85a"`,
|
|
84
|
+
);
|
|
85
|
+
await queryRunner.query(
|
|
86
|
+
`DROP INDEX "public"."IDX_2c8a45bfcf02645455551c4edd"`,
|
|
87
|
+
);
|
|
88
|
+
await queryRunner.query(
|
|
89
|
+
`ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "restrictionTimes" SET DEFAULT '{"_type": "RestrictionTimes", "value": {"restictionType": "None", "dayRestrictionTimes": null, "weeklyRestrictionTimes": []}}'`,
|
|
90
|
+
);
|
|
91
|
+
await queryRunner.query(
|
|
92
|
+
`ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "rotation" SET DEFAULT '{"_type": "Recurring", "value": {"intervalType": "Day", "intervalCount": {"_type": "PositiveNumber", "value": 1}}}'`,
|
|
93
|
+
);
|
|
94
|
+
await queryRunner.query(
|
|
95
|
+
`CREATE INDEX "IDX_cd7e9f1b3a5062748c6d8e0f193" ON "AlertReminderRuleLabel" ("labelId") `,
|
|
96
|
+
);
|
|
97
|
+
await queryRunner.query(
|
|
98
|
+
`CREATE INDEX "IDX_bf4d6e8a0c2153749b5c7d9e0f2" ON "AlertReminderRuleLabel" ("alertReminderRuleId") `,
|
|
99
|
+
);
|
|
100
|
+
await queryRunner.query(
|
|
101
|
+
`CREATE INDEX "IDX_da5c8e6f2b1a4d7c093e5f18a37" ON "IncidentReminderRuleLabel" ("labelId") `,
|
|
102
|
+
);
|
|
103
|
+
await queryRunner.query(
|
|
104
|
+
`CREATE INDEX "IDX_ce1b7a4d3f0e8c2a9b5d6e14f21" ON "IncidentReminderRuleLabel" ("incidentReminderRuleId") `,
|
|
105
|
+
);
|
|
106
|
+
await queryRunner.query(
|
|
107
|
+
`ALTER TABLE "AlertReminderRuleLabel" ADD CONSTRAINT "FK_cd7e9f1b3a5062748c6d8e0f193" FOREIGN KEY ("labelId") REFERENCES "Label"("_id") ON DELETE CASCADE ON UPDATE CASCADE`,
|
|
108
|
+
);
|
|
109
|
+
await queryRunner.query(
|
|
110
|
+
`ALTER TABLE "AlertReminderRuleLabel" ADD CONSTRAINT "FK_bf4d6e8a0c2153749b5c7d9e0f2" FOREIGN KEY ("alertReminderRuleId") REFERENCES "AlertReminderRule"("_id") ON DELETE CASCADE ON UPDATE CASCADE`,
|
|
111
|
+
);
|
|
112
|
+
await queryRunner.query(
|
|
113
|
+
`ALTER TABLE "IncidentReminderRuleLabel" ADD CONSTRAINT "FK_da5c8e6f2b1a4d7c093e5f18a37" FOREIGN KEY ("labelId") REFERENCES "Label"("_id") ON DELETE CASCADE ON UPDATE CASCADE`,
|
|
114
|
+
);
|
|
115
|
+
await queryRunner.query(
|
|
116
|
+
`ALTER TABLE "IncidentReminderRuleLabel" ADD CONSTRAINT "FK_ce1b7a4d3f0e8c2a9b5d6e14f21" FOREIGN KEY ("incidentReminderRuleId") REFERENCES "IncidentReminderRule"("_id") ON DELETE CASCADE ON UPDATE CASCADE`,
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
@@ -409,6 +409,10 @@ import { AddIncidentAlertReminderRules1783234451106 } from "./1783234451106-AddI
|
|
|
409
409
|
import { AddScheduledMaintenanceReminderRules1783320000000 } from "./1783320000000-AddScheduledMaintenanceReminderRules";
|
|
410
410
|
import { AddRemindWhileScheduledToScheduledMaintenanceReminderRule1783330000000 } from "./1783330000000-AddRemindWhileScheduledToScheduledMaintenanceReminderRule";
|
|
411
411
|
import { AddLabelsToIncidentAndAlertReminderRules1783340000000 } from "./1783340000000-AddLabelsToIncidentAndAlertReminderRules";
|
|
412
|
+
import { AddAIChatModels1783363279075 } from "./1783363279075-AddAIChatModels";
|
|
413
|
+
import { AddLlmProviderToAIConversation1783443471795 } from "./1783443471795-AddLlmProviderToAIConversation";
|
|
414
|
+
import { AddAIChatWriteActionsAndWidgets1783453297388 } from "./1783453297388-AddAIChatWriteActionsAndWidgets";
|
|
415
|
+
import { MigrationName1783461767405 } from "./1783461767405-MigrationName";
|
|
412
416
|
|
|
413
417
|
export default [
|
|
414
418
|
InitialMigration,
|
|
@@ -822,4 +826,8 @@ export default [
|
|
|
822
826
|
AddScheduledMaintenanceReminderRules1783320000000,
|
|
823
827
|
AddRemindWhileScheduledToScheduledMaintenanceReminderRule1783330000000,
|
|
824
828
|
AddLabelsToIncidentAndAlertReminderRules1783340000000,
|
|
829
|
+
AddAIChatModels1783363279075,
|
|
830
|
+
AddLlmProviderToAIConversation1783443471795,
|
|
831
|
+
AddAIChatWriteActionsAndWidgets1783453297388,
|
|
832
|
+
MigrationName1783461767405,
|
|
825
833
|
];
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import PositiveNumber from "../../Types/PositiveNumber";
|
|
2
|
+
import CountBy from "../Types/Database/CountBy";
|
|
3
|
+
import FindBy from "../Types/Database/FindBy";
|
|
4
|
+
import { OnFind } from "../Types/Database/Hooks";
|
|
5
|
+
import DatabaseService from "./DatabaseService";
|
|
6
|
+
import Model from "../../Models/DatabaseModels/AIConversationMessage";
|
|
7
|
+
import { pinQueryToRequestingUser } from "../Utils/AI/AIChatPrivacyFilter";
|
|
8
|
+
import CaptureSpan from "../Utils/Telemetry/CaptureSpan";
|
|
9
|
+
|
|
10
|
+
export class Service extends DatabaseService<Model> {
|
|
11
|
+
public constructor() {
|
|
12
|
+
super(Model);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
protected override async onBeforeFind(
|
|
16
|
+
findBy: FindBy<Model>,
|
|
17
|
+
): Promise<OnFind<Model>> {
|
|
18
|
+
findBy.query = pinQueryToRequestingUser(
|
|
19
|
+
findBy.query,
|
|
20
|
+
findBy.props,
|
|
21
|
+
"userId",
|
|
22
|
+
);
|
|
23
|
+
return { findBy, carryForward: null };
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@CaptureSpan()
|
|
27
|
+
public override async countBy(
|
|
28
|
+
countBy: CountBy<Model>,
|
|
29
|
+
): Promise<PositiveNumber> {
|
|
30
|
+
countBy.query = pinQueryToRequestingUser(
|
|
31
|
+
countBy.query,
|
|
32
|
+
countBy.props,
|
|
33
|
+
"userId",
|
|
34
|
+
);
|
|
35
|
+
return super.countBy(countBy);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export default new Service();
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import PositiveNumber from "../../Types/PositiveNumber";
|
|
2
|
+
import CountBy from "../Types/Database/CountBy";
|
|
3
|
+
import DeleteBy from "../Types/Database/DeleteBy";
|
|
4
|
+
import FindBy from "../Types/Database/FindBy";
|
|
5
|
+
import UpdateBy from "../Types/Database/UpdateBy";
|
|
6
|
+
import { OnDelete, OnFind, OnUpdate } from "../Types/Database/Hooks";
|
|
7
|
+
import DatabaseService from "./DatabaseService";
|
|
8
|
+
import Model from "../../Models/DatabaseModels/AIConversation";
|
|
9
|
+
import { pinQueryToRequestingUser } from "../Utils/AI/AIChatPrivacyFilter";
|
|
10
|
+
import CaptureSpan from "../Utils/Telemetry/CaptureSpan";
|
|
11
|
+
|
|
12
|
+
export class Service extends DatabaseService<Model> {
|
|
13
|
+
public constructor() {
|
|
14
|
+
super(Model);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
protected override async onBeforeFind(
|
|
18
|
+
findBy: FindBy<Model>,
|
|
19
|
+
): Promise<OnFind<Model>> {
|
|
20
|
+
findBy.query = pinQueryToRequestingUser(
|
|
21
|
+
findBy.query,
|
|
22
|
+
findBy.props,
|
|
23
|
+
"createdByUserId",
|
|
24
|
+
);
|
|
25
|
+
return { findBy, carryForward: null };
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@CaptureSpan()
|
|
29
|
+
public override async countBy(
|
|
30
|
+
countBy: CountBy<Model>,
|
|
31
|
+
): Promise<PositiveNumber> {
|
|
32
|
+
countBy.query = pinQueryToRequestingUser(
|
|
33
|
+
countBy.query,
|
|
34
|
+
countBy.props,
|
|
35
|
+
"createdByUserId",
|
|
36
|
+
);
|
|
37
|
+
return super.countBy(countBy);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
protected override async onBeforeUpdate(
|
|
41
|
+
updateBy: UpdateBy<Model>,
|
|
42
|
+
): Promise<OnUpdate<Model>> {
|
|
43
|
+
updateBy.query = pinQueryToRequestingUser(
|
|
44
|
+
updateBy.query,
|
|
45
|
+
updateBy.props,
|
|
46
|
+
"createdByUserId",
|
|
47
|
+
);
|
|
48
|
+
return { updateBy, carryForward: null };
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
protected override async onBeforeDelete(
|
|
52
|
+
deleteBy: DeleteBy<Model>,
|
|
53
|
+
): Promise<OnDelete<Model>> {
|
|
54
|
+
deleteBy.query = pinQueryToRequestingUser(
|
|
55
|
+
deleteBy.query,
|
|
56
|
+
deleteBy.props,
|
|
57
|
+
"createdByUserId",
|
|
58
|
+
);
|
|
59
|
+
return { deleteBy, carryForward: null };
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export default new Service();
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import PositiveNumber from "../../Types/PositiveNumber";
|
|
2
|
+
import CountBy from "../Types/Database/CountBy";
|
|
3
|
+
import FindBy from "../Types/Database/FindBy";
|
|
4
|
+
import { OnFind } from "../Types/Database/Hooks";
|
|
5
|
+
import DatabaseService from "./DatabaseService";
|
|
6
|
+
import Model from "../../Models/DatabaseModels/AIRunEvent";
|
|
7
|
+
import { pinQueryToRequestingUser } from "../Utils/AI/AIChatPrivacyFilter";
|
|
8
|
+
import CaptureSpan from "../Utils/Telemetry/CaptureSpan";
|
|
9
|
+
|
|
10
|
+
export class Service extends DatabaseService<Model> {
|
|
11
|
+
public constructor() {
|
|
12
|
+
super(Model);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
protected override async onBeforeFind(
|
|
16
|
+
findBy: FindBy<Model>,
|
|
17
|
+
): Promise<OnFind<Model>> {
|
|
18
|
+
findBy.query = pinQueryToRequestingUser(
|
|
19
|
+
findBy.query,
|
|
20
|
+
findBy.props,
|
|
21
|
+
"userId",
|
|
22
|
+
);
|
|
23
|
+
return { findBy, carryForward: null };
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@CaptureSpan()
|
|
27
|
+
public override async countBy(
|
|
28
|
+
countBy: CountBy<Model>,
|
|
29
|
+
): Promise<PositiveNumber> {
|
|
30
|
+
countBy.query = pinQueryToRequestingUser(
|
|
31
|
+
countBy.query,
|
|
32
|
+
countBy.props,
|
|
33
|
+
"userId",
|
|
34
|
+
);
|
|
35
|
+
return super.countBy(countBy);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export default new Service();
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import PositiveNumber from "../../Types/PositiveNumber";
|
|
2
|
+
import CountBy from "../Types/Database/CountBy";
|
|
3
|
+
import FindBy from "../Types/Database/FindBy";
|
|
4
|
+
import { OnFind } from "../Types/Database/Hooks";
|
|
5
|
+
import DatabaseService from "./DatabaseService";
|
|
6
|
+
import Model from "../../Models/DatabaseModels/AIRun";
|
|
7
|
+
import { pinQueryToRequestingUser } from "../Utils/AI/AIChatPrivacyFilter";
|
|
8
|
+
import CaptureSpan from "../Utils/Telemetry/CaptureSpan";
|
|
9
|
+
|
|
10
|
+
export class Service extends DatabaseService<Model> {
|
|
11
|
+
public constructor() {
|
|
12
|
+
super(Model);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
protected override async onBeforeFind(
|
|
16
|
+
findBy: FindBy<Model>,
|
|
17
|
+
): Promise<OnFind<Model>> {
|
|
18
|
+
findBy.query = pinQueryToRequestingUser(
|
|
19
|
+
findBy.query,
|
|
20
|
+
findBy.props,
|
|
21
|
+
"userId",
|
|
22
|
+
);
|
|
23
|
+
return { findBy, carryForward: null };
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@CaptureSpan()
|
|
27
|
+
public override async countBy(
|
|
28
|
+
countBy: CountBy<Model>,
|
|
29
|
+
): Promise<PositiveNumber> {
|
|
30
|
+
countBy.query = pinQueryToRequestingUser(
|
|
31
|
+
countBy.query,
|
|
32
|
+
countBy.props,
|
|
33
|
+
"userId",
|
|
34
|
+
);
|
|
35
|
+
return super.countBy(countBy);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export default new Service();
|