@oneuptime/common 9.2.11 → 9.2.14

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.
Files changed (193) hide show
  1. package/Models/DatabaseModels/AlertInternalNote.ts +29 -0
  2. package/Models/DatabaseModels/IncidentInternalNote.ts +29 -0
  3. package/Models/DatabaseModels/IncidentPublicNote.ts +29 -0
  4. package/Models/DatabaseModels/Index.ts +3 -11
  5. package/Models/DatabaseModels/{CopilotPullRequest.ts → LlmProvider.ts} +243 -248
  6. package/Models/DatabaseModels/ScheduledMaintenanceInternalNote.ts +29 -0
  7. package/Models/DatabaseModels/ScheduledMaintenancePublicNote.ts +29 -0
  8. package/Server/API/LlmProviderAPI.ts +57 -0
  9. package/Server/API/MicrosoftTeamsAPI.ts +2 -146
  10. package/Server/API/SlackAPI.ts +105 -0
  11. package/Server/API/StatusPageAPI.ts +6 -0
  12. package/Server/Infrastructure/Postgres/SchemaMigrations/1765477339178-MigrationName.ts +71 -0
  13. package/Server/Infrastructure/Postgres/SchemaMigrations/1765540325149-MigrationName.ts +45 -0
  14. package/Server/Infrastructure/Postgres/SchemaMigrations/1765540549739-MigrationName.ts +61 -0
  15. package/Server/Infrastructure/Postgres/SchemaMigrations/1765544010078-MigrationName.ts +35 -0
  16. package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +8 -0
  17. package/Server/Middleware/SlackAuthorization.ts +4 -1
  18. package/Server/Services/AlertInternalNoteService.ts +26 -0
  19. package/Server/Services/IncidentInternalNoteService.ts +26 -0
  20. package/Server/Services/IncidentPublicNoteService.ts +26 -0
  21. package/Server/Services/Index.ts +2 -11
  22. package/Server/Services/LlmProviderService.ts +100 -0
  23. package/Server/Services/ScheduledMaintenanceInternalNoteService.ts +26 -0
  24. package/Server/Services/ScheduledMaintenancePublicNoteService.ts +26 -0
  25. package/Server/Services/StatusPageService.ts +3 -0
  26. package/Server/Utils/Express.ts +1 -0
  27. package/Server/Utils/StartServer.ts +5 -0
  28. package/Server/Utils/StatusPageResource.ts +89 -0
  29. package/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.ts +96 -55
  30. package/Server/Utils/Workspace/Slack/Actions/ActionTypes.ts +16 -0
  31. package/Server/Utils/Workspace/Slack/Actions/Alert.ts +184 -1
  32. package/Server/Utils/Workspace/Slack/Actions/Incident.ts +224 -1
  33. package/Server/Utils/Workspace/Slack/Actions/ScheduledMaintenance.ts +232 -1
  34. package/Server/Utils/Workspace/Slack/Slack.ts +113 -0
  35. package/Server/Utils/Workspace/Slack/app-manifest.json +13 -2
  36. package/Tests/Server/Utils/StatusPageResource.test.ts +161 -0
  37. package/Types/Icon/IconProp.ts +1 -0
  38. package/Types/LLM/Index.ts +4 -0
  39. package/Types/LLM/LlmType.ts +7 -0
  40. package/Types/Monitor/MonitorStep.ts +14 -0
  41. package/Types/Permission.ts +38 -113
  42. package/UI/Components/Icon/Icon.tsx +8 -0
  43. package/UI/Components/Link/Link.tsx +5 -1
  44. package/build/dist/Models/DatabaseModels/AlertInternalNote.js +30 -0
  45. package/build/dist/Models/DatabaseModels/AlertInternalNote.js.map +1 -1
  46. package/build/dist/Models/DatabaseModels/IncidentInternalNote.js +30 -0
  47. package/build/dist/Models/DatabaseModels/IncidentInternalNote.js.map +1 -1
  48. package/build/dist/Models/DatabaseModels/IncidentPublicNote.js +30 -0
  49. package/build/dist/Models/DatabaseModels/IncidentPublicNote.js.map +1 -1
  50. package/build/dist/Models/DatabaseModels/Index.js +2 -10
  51. package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
  52. package/build/dist/Models/DatabaseModels/{CopilotPullRequest.js → LlmProvider.js} +263 -255
  53. package/build/dist/Models/DatabaseModels/LlmProvider.js.map +1 -0
  54. package/build/dist/Models/DatabaseModels/ScheduledMaintenanceInternalNote.js +30 -0
  55. package/build/dist/Models/DatabaseModels/ScheduledMaintenanceInternalNote.js.map +1 -1
  56. package/build/dist/Models/DatabaseModels/ScheduledMaintenancePublicNote.js +30 -0
  57. package/build/dist/Models/DatabaseModels/ScheduledMaintenancePublicNote.js.map +1 -1
  58. package/build/dist/Server/API/LlmProviderAPI.js +36 -0
  59. package/build/dist/Server/API/LlmProviderAPI.js.map +1 -0
  60. package/build/dist/Server/API/MicrosoftTeamsAPI.js +2 -91
  61. package/build/dist/Server/API/MicrosoftTeamsAPI.js.map +1 -1
  62. package/build/dist/Server/API/SlackAPI.js +74 -0
  63. package/build/dist/Server/API/SlackAPI.js.map +1 -1
  64. package/build/dist/Server/API/StatusPageAPI.js +6 -0
  65. package/build/dist/Server/API/StatusPageAPI.js.map +1 -1
  66. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1765477339178-MigrationName.js +30 -0
  67. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1765477339178-MigrationName.js.map +1 -0
  68. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1765540325149-MigrationName.js +22 -0
  69. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1765540325149-MigrationName.js.map +1 -0
  70. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1765540549739-MigrationName.js +39 -0
  71. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1765540549739-MigrationName.js.map +1 -0
  72. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1765544010078-MigrationName.js +18 -0
  73. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1765544010078-MigrationName.js.map +1 -0
  74. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +8 -0
  75. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
  76. package/build/dist/Server/Middleware/SlackAuthorization.js +4 -1
  77. package/build/dist/Server/Middleware/SlackAuthorization.js.map +1 -1
  78. package/build/dist/Server/Services/AlertInternalNoteService.js +24 -0
  79. package/build/dist/Server/Services/AlertInternalNoteService.js.map +1 -1
  80. package/build/dist/Server/Services/IncidentInternalNoteService.js +24 -0
  81. package/build/dist/Server/Services/IncidentInternalNoteService.js.map +1 -1
  82. package/build/dist/Server/Services/IncidentPublicNoteService.js +24 -0
  83. package/build/dist/Server/Services/IncidentPublicNoteService.js.map +1 -1
  84. package/build/dist/Server/Services/Index.js +2 -10
  85. package/build/dist/Server/Services/Index.js.map +1 -1
  86. package/build/dist/Server/Services/LlmProviderService.js +85 -0
  87. package/build/dist/Server/Services/LlmProviderService.js.map +1 -0
  88. package/build/dist/Server/Services/ScheduledMaintenanceInternalNoteService.js +24 -0
  89. package/build/dist/Server/Services/ScheduledMaintenanceInternalNoteService.js.map +1 -1
  90. package/build/dist/Server/Services/ScheduledMaintenancePublicNoteService.js +24 -0
  91. package/build/dist/Server/Services/ScheduledMaintenancePublicNoteService.js.map +1 -1
  92. package/build/dist/Server/Services/StatusPageService.js +3 -0
  93. package/build/dist/Server/Services/StatusPageService.js.map +1 -1
  94. package/build/dist/Server/Utils/Express.js.map +1 -1
  95. package/build/dist/Server/Utils/StartServer.js +5 -0
  96. package/build/dist/Server/Utils/StartServer.js.map +1 -1
  97. package/build/dist/Server/Utils/StatusPageResource.js +68 -0
  98. package/build/dist/Server/Utils/StatusPageResource.js.map +1 -0
  99. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js +73 -42
  100. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js.map +1 -1
  101. package/build/dist/Server/Utils/Workspace/Slack/Actions/ActionTypes.js +13 -0
  102. package/build/dist/Server/Utils/Workspace/Slack/Actions/ActionTypes.js.map +1 -1
  103. package/build/dist/Server/Utils/Workspace/Slack/Actions/Alert.js +143 -1
  104. package/build/dist/Server/Utils/Workspace/Slack/Actions/Alert.js.map +1 -1
  105. package/build/dist/Server/Utils/Workspace/Slack/Actions/Incident.js +173 -1
  106. package/build/dist/Server/Utils/Workspace/Slack/Actions/Incident.js.map +1 -1
  107. package/build/dist/Server/Utils/Workspace/Slack/Actions/ScheduledMaintenance.js +173 -1
  108. package/build/dist/Server/Utils/Workspace/Slack/Actions/ScheduledMaintenance.js.map +1 -1
  109. package/build/dist/Server/Utils/Workspace/Slack/Slack.js +92 -0
  110. package/build/dist/Server/Utils/Workspace/Slack/Slack.js.map +1 -1
  111. package/build/dist/Server/Utils/Workspace/Slack/app-manifest.json +12 -2
  112. package/build/dist/Tests/Server/Utils/StatusPageResource.test.js +122 -0
  113. package/build/dist/Tests/Server/Utils/StatusPageResource.test.js.map +1 -0
  114. package/build/dist/Types/Icon/IconProp.js +1 -0
  115. package/build/dist/Types/Icon/IconProp.js.map +1 -1
  116. package/build/dist/Types/LLM/Index.js +4 -0
  117. package/build/dist/Types/LLM/Index.js.map +1 -0
  118. package/build/dist/Types/LLM/LlmType.js +8 -0
  119. package/build/dist/Types/LLM/LlmType.js.map +1 -0
  120. package/build/dist/Types/Monitor/MonitorStep.js +10 -0
  121. package/build/dist/Types/Monitor/MonitorStep.js.map +1 -1
  122. package/build/dist/Types/Permission.js +32 -97
  123. package/build/dist/Types/Permission.js.map +1 -1
  124. package/build/dist/UI/Components/Icon/Icon.js +3 -0
  125. package/build/dist/UI/Components/Icon/Icon.js.map +1 -1
  126. package/build/dist/UI/Components/Link/Link.js +4 -1
  127. package/build/dist/UI/Components/Link/Link.js.map +1 -1
  128. package/package.json +5 -1
  129. package/Models/DatabaseModels/CopilotAction.ts +0 -772
  130. package/Models/DatabaseModels/CopilotActionTypePriority.ts +0 -340
  131. package/Models/DatabaseModels/CopilotCodeRepository.ts +0 -637
  132. package/Models/DatabaseModels/ServiceCopilotCodeRepository.ts +0 -544
  133. package/Server/API/CopilotActionAPI.ts +0 -418
  134. package/Server/API/CopilotCodeRepositoryAPI.ts +0 -127
  135. package/Server/API/CopilotPullRequestAPI.ts +0 -243
  136. package/Server/Docs/CodeRepository.md +0 -43
  137. package/Server/Middleware/CodeRepositoryAuthorization.ts +0 -50
  138. package/Server/Services/CopilotActionService.ts +0 -10
  139. package/Server/Services/CopilotActionTypePriorityService.ts +0 -67
  140. package/Server/Services/CopilotCodeRepositoryService.ts +0 -62
  141. package/Server/Services/CopilotPullRequestService.ts +0 -10
  142. package/Server/Services/ServiceCopilotCodeRepositoryService.ts +0 -10
  143. package/Types/Copilot/CopilotActionProps/DirectoryActionProp.ts +0 -3
  144. package/Types/Copilot/CopilotActionProps/ExceptionActionProp.ts +0 -4
  145. package/Types/Copilot/CopilotActionProps/FileActionProp.ts +0 -7
  146. package/Types/Copilot/CopilotActionProps/FunctionActionProp.ts +0 -5
  147. package/Types/Copilot/CopilotActionProps/Index.ts +0 -96
  148. package/Types/Copilot/CopilotActionProps/SpanActionProp.ts +0 -4
  149. package/Types/Copilot/CopilotActionStatus.ts +0 -114
  150. package/Types/Copilot/CopilotActionType.ts +0 -212
  151. package/build/dist/Models/DatabaseModels/CopilotAction.js +0 -793
  152. package/build/dist/Models/DatabaseModels/CopilotAction.js.map +0 -1
  153. package/build/dist/Models/DatabaseModels/CopilotActionTypePriority.js +0 -358
  154. package/build/dist/Models/DatabaseModels/CopilotActionTypePriority.js.map +0 -1
  155. package/build/dist/Models/DatabaseModels/CopilotCodeRepository.js +0 -656
  156. package/build/dist/Models/DatabaseModels/CopilotCodeRepository.js.map +0 -1
  157. package/build/dist/Models/DatabaseModels/CopilotPullRequest.js.map +0 -1
  158. package/build/dist/Models/DatabaseModels/ServiceCopilotCodeRepository.js +0 -561
  159. package/build/dist/Models/DatabaseModels/ServiceCopilotCodeRepository.js.map +0 -1
  160. package/build/dist/Server/API/CopilotActionAPI.js +0 -295
  161. package/build/dist/Server/API/CopilotActionAPI.js.map +0 -1
  162. package/build/dist/Server/API/CopilotCodeRepositoryAPI.js +0 -91
  163. package/build/dist/Server/API/CopilotCodeRepositoryAPI.js.map +0 -1
  164. package/build/dist/Server/API/CopilotPullRequestAPI.js +0 -166
  165. package/build/dist/Server/API/CopilotPullRequestAPI.js.map +0 -1
  166. package/build/dist/Server/Middleware/CodeRepositoryAuthorization.js +0 -48
  167. package/build/dist/Server/Middleware/CodeRepositoryAuthorization.js.map +0 -1
  168. package/build/dist/Server/Services/CopilotActionService.js +0 -9
  169. package/build/dist/Server/Services/CopilotActionService.js.map +0 -1
  170. package/build/dist/Server/Services/CopilotActionTypePriorityService.js +0 -61
  171. package/build/dist/Server/Services/CopilotActionTypePriorityService.js.map +0 -1
  172. package/build/dist/Server/Services/CopilotCodeRepositoryService.js +0 -61
  173. package/build/dist/Server/Services/CopilotCodeRepositoryService.js.map +0 -1
  174. package/build/dist/Server/Services/CopilotPullRequestService.js +0 -9
  175. package/build/dist/Server/Services/CopilotPullRequestService.js.map +0 -1
  176. package/build/dist/Server/Services/ServiceCopilotCodeRepositoryService.js +0 -9
  177. package/build/dist/Server/Services/ServiceCopilotCodeRepositoryService.js.map +0 -1
  178. package/build/dist/Types/Copilot/CopilotActionProps/DirectoryActionProp.js +0 -2
  179. package/build/dist/Types/Copilot/CopilotActionProps/DirectoryActionProp.js.map +0 -1
  180. package/build/dist/Types/Copilot/CopilotActionProps/ExceptionActionProp.js +0 -2
  181. package/build/dist/Types/Copilot/CopilotActionProps/ExceptionActionProp.js.map +0 -1
  182. package/build/dist/Types/Copilot/CopilotActionProps/FileActionProp.js +0 -2
  183. package/build/dist/Types/Copilot/CopilotActionProps/FileActionProp.js.map +0 -1
  184. package/build/dist/Types/Copilot/CopilotActionProps/FunctionActionProp.js +0 -2
  185. package/build/dist/Types/Copilot/CopilotActionProps/FunctionActionProp.js.map +0 -1
  186. package/build/dist/Types/Copilot/CopilotActionProps/Index.js +0 -64
  187. package/build/dist/Types/Copilot/CopilotActionProps/Index.js.map +0 -1
  188. package/build/dist/Types/Copilot/CopilotActionProps/SpanActionProp.js +0 -2
  189. package/build/dist/Types/Copilot/CopilotActionProps/SpanActionProp.js.map +0 -1
  190. package/build/dist/Types/Copilot/CopilotActionStatus.js +0 -96
  191. package/build/dist/Types/Copilot/CopilotActionStatus.js.map +0 -1
  192. package/build/dist/Types/Copilot/CopilotActionType.js +0 -175
  193. package/build/dist/Types/Copilot/CopilotActionType.js.map +0 -1
@@ -1,18 +1,16 @@
1
- import CodeRepository from "./CopilotCodeRepository";
2
1
  import Project from "./Project";
3
- import ServiceCatalog from "./ServiceCatalog";
4
- import ServiceCopilotCodeRepository from "./ServiceCopilotCodeRepository";
5
2
  import User from "./User";
6
3
  import BaseModel from "./DatabaseBaseModel/DatabaseBaseModel";
7
4
  import Route from "../../Types/API/Route";
8
- import PullRequestState from "../../Types/CodeRepository/PullRequestState";
5
+ import { PlanType } from "../../Types/Billing/SubscriptionPlan";
9
6
  import ColumnAccessControl from "../../Types/Database/AccessControl/ColumnAccessControl";
10
7
  import TableAccessControl from "../../Types/Database/AccessControl/TableAccessControl";
11
- import CanAccessIfCanReadOn from "../../Types/Database/CanAccessIfCanReadOn";
8
+ import TableBillingAccessControl from "../../Types/Database/AccessControl/TableBillingAccessControl";
9
+ import ColumnLength from "../../Types/Database/ColumnLength";
12
10
  import ColumnType from "../../Types/Database/ColumnType";
13
11
  import CrudApiEndpoint from "../../Types/Database/CrudApiEndpoint";
14
- import EnableDocumentation from "../../Types/Database/EnableDocumentation";
15
- import EnableWorkflow from "../../Types/Database/EnableWorkflow";
12
+ import IsPermissionsIf from "../../Types/Database/IsPermissionsIf";
13
+ import SlugifyColumn from "../../Types/Database/SlugifyColumn";
16
14
  import TableColumn from "../../Types/Database/TableColumn";
17
15
  import TableColumnType from "../../Types/Database/TableColumnType";
18
16
  import TableMetadata from "../../Types/Database/TableMetadata";
@@ -20,451 +18,448 @@ import TenantColumn from "../../Types/Database/TenantColumn";
20
18
  import IconProp from "../../Types/Icon/IconProp";
21
19
  import ObjectID from "../../Types/ObjectID";
22
20
  import Permission from "../../Types/Permission";
23
- import { Column, Entity, Index, JoinColumn, ManyToOne } from "typeorm";
21
+ import { Column, Entity, JoinColumn, ManyToOne } from "typeorm";
22
+ import EnableDocumentation from "../../Types/Database/EnableDocumentation";
23
+ import LlmType from "../../Types/LLM/LlmType";
24
24
 
25
- @CanAccessIfCanReadOn("codeRepository")
26
25
  @EnableDocumentation()
26
+ @TableBillingAccessControl({
27
+ create: PlanType.Growth,
28
+ read: PlanType.Free,
29
+ update: PlanType.Growth,
30
+ delete: PlanType.Free,
31
+ })
32
+ @IsPermissionsIf(Permission.Public, "projectId", null)
27
33
  @TenantColumn("projectId")
34
+ @CrudApiEndpoint(new Route("/llm-provider"))
35
+ @SlugifyColumn("name", "slug")
36
+ @Entity({
37
+ name: "LlmProvider",
38
+ })
39
+ @TableMetadata({
40
+ tableName: "LlmProvider",
41
+ singularName: "LLM Provider",
42
+ pluralName: "LLM Providers",
43
+ icon: IconProp.Bolt,
44
+ tableDescription:
45
+ "Manage LLM Provider configurations. Connect to OpenAI, Anthropic, Ollama, or other LLM providers to enable AI features.",
46
+ })
28
47
  @TableAccessControl({
29
- create: [],
48
+ create: [
49
+ Permission.ProjectOwner,
50
+ Permission.ProjectAdmin,
51
+ Permission.ProjectMember,
52
+ Permission.CreateProjectLlm,
53
+ ],
30
54
  read: [
55
+ Permission.Public,
31
56
  Permission.ProjectOwner,
32
57
  Permission.ProjectAdmin,
33
58
  Permission.ProjectMember,
34
- Permission.ReadCopilotPullRequest,
59
+ Permission.ReadProjectLlm,
60
+ ],
61
+ delete: [
62
+ Permission.ProjectOwner,
63
+ Permission.ProjectAdmin,
64
+ Permission.ProjectMember,
65
+ Permission.DeleteProjectLlm,
66
+ ],
67
+ update: [
68
+ Permission.ProjectOwner,
69
+ Permission.ProjectAdmin,
70
+ Permission.ProjectMember,
71
+ Permission.EditProjectLlm,
35
72
  ],
36
- delete: [],
37
- update: [],
38
- })
39
- @EnableWorkflow({
40
- create: true,
41
- delete: false,
42
- update: true,
43
- })
44
- @CrudApiEndpoint(new Route("/copilot-pull-request"))
45
- @TableMetadata({
46
- tableName: "CopilotPullRequest",
47
- singularName: "Copilot Pull Request",
48
- pluralName: "Copilot Pull Requests",
49
- icon: IconProp.Bolt,
50
- tableDescription:
51
- "List of pull requests created by Copilot and status of those requests.",
52
- })
53
- @Entity({
54
- name: "CopilotPullRequest",
55
73
  })
56
- export default class CopilotPullRequest extends BaseModel {
74
+ export default class LlmProvider extends BaseModel {
57
75
  @ColumnAccessControl({
58
- create: [],
59
- read: [
76
+ create: [
60
77
  Permission.ProjectOwner,
61
78
  Permission.ProjectAdmin,
62
79
  Permission.ProjectMember,
63
- Permission.ReadCopilotPullRequest,
80
+ Permission.CreateProjectLlm,
81
+ ],
82
+ read: [Permission.Public],
83
+ update: [
84
+ Permission.ProjectOwner,
85
+ Permission.ProjectAdmin,
86
+ Permission.ProjectMember,
87
+ Permission.EditProjectLlm,
64
88
  ],
65
- update: [],
66
89
  })
67
90
  @TableColumn({
68
- manyToOneRelationColumn: "projectId",
69
- type: TableColumnType.Entity,
70
- modelType: Project,
71
- title: "Project",
72
- description: "Relation to Project Resource in which this object belongs",
91
+ required: true,
92
+ type: TableColumnType.Name,
93
+ canReadOnRelationQuery: true,
94
+ title: "Name",
95
+ description: "A friendly name for this LLM configuration.",
73
96
  })
74
- @ManyToOne(
75
- () => {
76
- return Project;
77
- },
78
- {
79
- eager: false,
80
- nullable: false,
81
- onDelete: "CASCADE",
82
- orphanedRowAction: "nullify",
83
- },
84
- )
85
- @JoinColumn({ name: "projectId" })
86
- public project?: Project = undefined;
97
+ @Column({
98
+ nullable: false,
99
+ type: ColumnType.Name,
100
+ length: ColumnLength.Name,
101
+ })
102
+ public name?: string = undefined;
87
103
 
88
104
  @ColumnAccessControl({
89
- create: [],
90
- read: [
105
+ create: [
91
106
  Permission.ProjectOwner,
92
107
  Permission.ProjectAdmin,
93
108
  Permission.ProjectMember,
94
- Permission.ReadCopilotPullRequest,
109
+ Permission.CreateProjectLlm,
95
110
  ],
111
+ read: [Permission.Public],
112
+ update: [
113
+ Permission.ProjectOwner,
114
+ Permission.ProjectAdmin,
115
+ Permission.ProjectMember,
116
+ Permission.EditProjectLlm,
117
+ ],
118
+ })
119
+ @TableColumn({
120
+ required: false,
121
+ type: TableColumnType.LongText,
122
+ title: "Description",
123
+ description: "Description of this LLM configuration.",
124
+ })
125
+ @Column({
126
+ nullable: true,
127
+ type: ColumnType.LongText,
128
+ })
129
+ public description?: string = undefined;
130
+
131
+ @ColumnAccessControl({
132
+ create: [],
133
+ read: [Permission.Public],
96
134
  update: [],
97
135
  })
98
- @Index()
99
136
  @TableColumn({
100
- type: TableColumnType.ObjectID,
101
137
  required: true,
102
- canReadOnRelationQuery: true,
103
- title: "Project ID",
104
- description: "ID of your OneUptime Project in which this object belongs",
138
+ unique: true,
139
+ type: TableColumnType.Slug,
140
+ computed: true,
141
+ title: "Slug",
142
+ description: "Friendly globally unique name for your object",
105
143
  })
106
144
  @Column({
107
- type: ColumnType.ObjectID,
108
145
  nullable: false,
109
- transformer: ObjectID.getDatabaseTransformer(),
146
+ type: ColumnType.Slug,
147
+ length: ColumnLength.Slug,
110
148
  })
111
- public projectId?: ObjectID = undefined;
149
+ public slug?: string = undefined;
112
150
 
113
151
  @ColumnAccessControl({
114
- create: [],
115
- read: [
152
+ create: [
116
153
  Permission.ProjectOwner,
117
154
  Permission.ProjectAdmin,
118
155
  Permission.ProjectMember,
119
- Permission.ReadCopilotPullRequest,
156
+ Permission.CreateProjectLlm,
157
+ ],
158
+ read: [Permission.Public],
159
+ update: [
160
+ Permission.ProjectOwner,
161
+ Permission.ProjectAdmin,
162
+ Permission.ProjectMember,
163
+ Permission.EditProjectLlm,
120
164
  ],
121
- update: [],
122
165
  })
123
166
  @TableColumn({
124
- manyToOneRelationColumn: "codeRepositoryId",
125
- type: TableColumnType.Entity,
126
- modelType: CodeRepository,
127
- title: "Code Repository",
128
- description:
129
- "Relation to CodeRepository Resource in which this object belongs",
167
+ required: true,
168
+ type: TableColumnType.ShortText,
169
+ title: "LLM Type",
170
+ description: "The type of LLM provider (OpenAI, Anthropic, Ollama, etc.)",
130
171
  })
131
- @ManyToOne(
132
- () => {
133
- return CodeRepository;
134
- },
135
- {
136
- eager: false,
137
- nullable: true,
138
- onDelete: "CASCADE",
139
- orphanedRowAction: "nullify",
140
- },
141
- )
142
- @JoinColumn({ name: "codeRepositoryId" })
143
- public codeRepository?: CodeRepository = undefined;
172
+ @Column({
173
+ nullable: false,
174
+ type: ColumnType.ShortText,
175
+ length: ColumnLength.ShortText,
176
+ })
177
+ public llmType?: LlmType = undefined;
144
178
 
145
179
  @ColumnAccessControl({
146
- create: [],
147
- read: [
180
+ create: [
148
181
  Permission.ProjectOwner,
149
182
  Permission.ProjectAdmin,
150
183
  Permission.ProjectMember,
151
- Permission.ReadCopilotPullRequest,
184
+ Permission.CreateProjectLlm,
185
+ ],
186
+ read: [Permission.ProjectOwner, Permission.ProjectAdmin],
187
+ update: [
188
+ Permission.ProjectOwner,
189
+ Permission.ProjectAdmin,
190
+ Permission.ProjectMember,
191
+ Permission.EditProjectLlm,
152
192
  ],
153
- update: [],
154
193
  })
155
- @Index()
156
194
  @TableColumn({
157
- type: TableColumnType.ObjectID,
158
- required: true,
159
- canReadOnRelationQuery: true,
160
- title: "Code Repository ID",
195
+ required: false,
196
+ type: TableColumnType.LongText,
197
+ title: "API Key",
161
198
  description:
162
- "ID of your OneUptime Code Repository in which this object belongs",
199
+ "The API key for the LLM provider. Required for OpenAI and Anthropic.",
200
+ encrypted: true,
163
201
  })
164
202
  @Column({
165
- type: ColumnType.ObjectID,
166
- nullable: false,
167
- transformer: ObjectID.getDatabaseTransformer(),
203
+ nullable: true,
204
+ type: ColumnType.LongText,
168
205
  })
169
- public codeRepositoryId?: ObjectID = undefined;
206
+ public apiKey?: string = undefined;
170
207
 
171
208
  @ColumnAccessControl({
172
- create: [],
173
- read: [
209
+ create: [
174
210
  Permission.ProjectOwner,
175
211
  Permission.ProjectAdmin,
176
212
  Permission.ProjectMember,
177
- Permission.ReadCopilotPullRequest,
213
+ Permission.CreateProjectLlm,
214
+ ],
215
+ read: [Permission.Public],
216
+ update: [
217
+ Permission.ProjectOwner,
218
+ Permission.ProjectAdmin,
219
+ Permission.ProjectMember,
220
+ Permission.EditProjectLlm,
178
221
  ],
179
- update: [],
180
222
  })
181
223
  @TableColumn({
182
- manyToOneRelationColumn: "createdByUserId",
183
- type: TableColumnType.Entity,
184
- modelType: User,
185
- title: "Created by User",
224
+ required: false,
225
+ type: TableColumnType.ShortText,
226
+ title: "Model Name",
186
227
  description:
187
- "Relation to User who created this object (if this object was created by a User)",
228
+ "The name of the model to use (e.g., gpt-4, claude-3-opus, llama2).",
188
229
  })
189
- @ManyToOne(
190
- () => {
191
- return User;
192
- },
193
- {
194
- eager: false,
195
- nullable: true,
196
- onDelete: "SET NULL",
197
- orphanedRowAction: "nullify",
198
- },
199
- )
200
- @JoinColumn({ name: "createdByUserId" })
201
- public createdByUser?: User = undefined;
230
+ @Column({
231
+ nullable: true,
232
+ type: ColumnType.ShortText,
233
+ length: ColumnLength.ShortText,
234
+ })
235
+ public modelName?: string = undefined;
202
236
 
203
237
  @ColumnAccessControl({
204
- create: [],
205
- read: [
238
+ create: [
206
239
  Permission.ProjectOwner,
207
240
  Permission.ProjectAdmin,
208
241
  Permission.ProjectMember,
209
- Permission.ReadCopilotPullRequest,
242
+ Permission.CreateProjectLlm,
243
+ ],
244
+ read: [Permission.Public],
245
+ update: [
246
+ Permission.ProjectOwner,
247
+ Permission.ProjectAdmin,
248
+ Permission.ProjectMember,
249
+ Permission.EditProjectLlm,
210
250
  ],
211
- update: [],
212
251
  })
213
252
  @TableColumn({
214
- type: TableColumnType.ObjectID,
215
- title: "Created by User ID",
253
+ required: false,
254
+ type: TableColumnType.ShortURL,
255
+ title: "Base URL",
216
256
  description:
217
- "User ID who created this object (if this object was created by a User)",
257
+ "The base URL for the LLM API. Required for Ollama, optional for others.",
218
258
  })
219
259
  @Column({
220
- type: ColumnType.ObjectID,
221
260
  nullable: true,
222
- transformer: ObjectID.getDatabaseTransformer(),
261
+ type: ColumnType.ShortURL,
262
+ length: ColumnLength.ShortURL,
223
263
  })
224
- public createdByUserId?: ObjectID = undefined;
264
+ public baseUrl?: string = undefined;
225
265
 
226
266
  @ColumnAccessControl({
227
- create: [],
228
- read: [
267
+ create: [
229
268
  Permission.ProjectOwner,
230
269
  Permission.ProjectAdmin,
231
270
  Permission.ProjectMember,
232
- Permission.ReadCopilotPullRequest,
271
+ Permission.CreateProjectLlm,
233
272
  ],
273
+ read: [Permission.Public],
234
274
  update: [],
235
275
  })
236
276
  @TableColumn({
237
- manyToOneRelationColumn: "deletedByUserId",
238
277
  type: TableColumnType.Entity,
239
- title: "Deleted by User",
240
- modelType: User,
278
+ required: false,
279
+ modelType: Project,
280
+ title: "Project",
241
281
  description:
242
- "Relation to User who deleted this object (if this object was deleted by a User)",
282
+ "The project this LLM belongs to. If null, it is a global LLM.",
243
283
  })
244
284
  @ManyToOne(
245
285
  () => {
246
- return User;
286
+ return Project;
247
287
  },
248
288
  {
249
289
  cascade: false,
250
290
  eager: false,
251
291
  nullable: true,
252
- onDelete: "SET NULL",
292
+ onDelete: "CASCADE",
253
293
  orphanedRowAction: "nullify",
254
294
  },
255
295
  )
256
- @JoinColumn({ name: "deletedByUserId" })
257
- public deletedByUser?: User = undefined;
296
+ @JoinColumn({ name: "projectId" })
297
+ public project?: Project = undefined;
258
298
 
259
299
  @ColumnAccessControl({
260
- create: [],
261
- read: [
300
+ create: [
262
301
  Permission.ProjectOwner,
263
302
  Permission.ProjectAdmin,
264
303
  Permission.ProjectMember,
265
- Permission.ReadCopilotPullRequest,
304
+ Permission.CreateProjectLlm,
266
305
  ],
306
+ read: [Permission.Public],
267
307
  update: [],
268
308
  })
269
309
  @TableColumn({
270
310
  type: TableColumnType.ObjectID,
271
- title: "Deleted by User ID",
311
+ required: false,
312
+ canReadOnRelationQuery: true,
313
+ title: "Project ID",
272
314
  description:
273
- "User ID who deleted this object (if this object was deleted by a User)",
315
+ "ID of the project this LLM belongs to. If null, it is a global LLM.",
274
316
  })
275
317
  @Column({
276
318
  type: ColumnType.ObjectID,
277
319
  nullable: true,
278
320
  transformer: ObjectID.getDatabaseTransformer(),
279
321
  })
280
- public deletedByUserId?: ObjectID = undefined;
322
+ public projectId?: ObjectID = undefined;
281
323
 
282
324
  @ColumnAccessControl({
283
325
  create: [],
284
- read: [
285
- Permission.ProjectOwner,
286
- Permission.ProjectAdmin,
287
- Permission.ProjectMember,
288
- Permission.ReadCopilotPullRequest,
289
- ],
326
+ read: [],
290
327
  update: [],
291
328
  })
292
- @TableColumn({
293
- manyToOneRelationColumn: "serviceCatalogId",
294
- type: TableColumnType.Entity,
295
- required: false,
296
- modelType: ServiceCatalog,
297
- title: "Service Catalog",
298
- description:
299
- "Relation to Service Catalog Resource in which this object belongs",
300
- })
329
+ @TableColumn({ type: TableColumnType.Entity, modelType: User })
301
330
  @ManyToOne(
302
331
  () => {
303
- return ServiceCatalog;
332
+ return User;
304
333
  },
305
334
  {
335
+ cascade: false,
306
336
  eager: false,
307
337
  nullable: true,
308
- onDelete: "CASCADE",
338
+ onDelete: "SET NULL",
309
339
  orphanedRowAction: "nullify",
310
340
  },
311
341
  )
312
- @JoinColumn({ name: "serviceCatalogId" })
313
- public serviceCatalog?: ServiceCatalog = undefined;
342
+ @JoinColumn({ name: "deletedByUserId" })
343
+ public deletedByUser?: User = undefined;
314
344
 
315
345
  @ColumnAccessControl({
316
346
  create: [],
317
- read: [
318
- Permission.ProjectOwner,
319
- Permission.ProjectAdmin,
320
- Permission.ProjectMember,
321
- Permission.ReadCopilotPullRequest,
322
- ],
347
+ read: [],
323
348
  update: [],
324
349
  })
325
- @Index()
326
350
  @TableColumn({
327
351
  type: TableColumnType.ObjectID,
328
- required: false,
329
- canReadOnRelationQuery: true,
330
- title: "Service Catalog ID",
352
+ title: "Deleted by User ID",
331
353
  description:
332
- "ID of your OneUptime ServiceCatalog in which this object belongs",
354
+ "User ID who deleted this object (if this object was deleted by a User)",
333
355
  })
334
356
  @Column({
335
357
  type: ColumnType.ObjectID,
336
358
  nullable: true,
337
359
  transformer: ObjectID.getDatabaseTransformer(),
338
360
  })
339
- public serviceCatalogId?: ObjectID = undefined;
361
+ public deletedByUserId?: ObjectID = undefined;
340
362
 
341
363
  @ColumnAccessControl({
342
- create: [],
343
- read: [
364
+ create: [
344
365
  Permission.ProjectOwner,
345
366
  Permission.ProjectAdmin,
346
367
  Permission.ProjectMember,
347
- Permission.ReadCopilotPullRequest,
368
+ Permission.CreateProjectLlm,
348
369
  ],
370
+ read: [Permission.ProjectOwner],
349
371
  update: [],
350
372
  })
351
- @TableColumn({
352
- manyToOneRelationColumn: "serviceRepositoryId",
353
- type: TableColumnType.Entity,
354
- required: false,
355
- modelType: ServiceCopilotCodeRepository,
356
- title: "Service Repository",
357
- description:
358
- "Relation to Service Repository Resource in which this object belongs",
359
- })
373
+ @TableColumn({ type: TableColumnType.Entity, modelType: User })
360
374
  @ManyToOne(
361
375
  () => {
362
- return ServiceCopilotCodeRepository;
376
+ return User;
363
377
  },
364
378
  {
365
379
  eager: false,
366
380
  nullable: true,
367
- onDelete: "CASCADE",
381
+ onDelete: "SET NULL",
368
382
  orphanedRowAction: "nullify",
369
383
  },
370
384
  )
371
- @JoinColumn({ name: "serviceRepositoryId" })
372
- public serviceRepository?: ServiceCopilotCodeRepository = undefined;
385
+ @JoinColumn({ name: "createdByUserId" })
386
+ public createdByUser?: User = undefined;
373
387
 
374
388
  @ColumnAccessControl({
375
- create: [],
376
- read: [
389
+ create: [
377
390
  Permission.ProjectOwner,
378
391
  Permission.ProjectAdmin,
379
392
  Permission.ProjectMember,
380
- Permission.ReadCopilotPullRequest,
393
+ Permission.CreateProjectLlm,
381
394
  ],
395
+ read: [Permission.ProjectOwner],
382
396
  update: [],
383
397
  })
384
- @Index()
385
398
  @TableColumn({
386
399
  type: TableColumnType.ObjectID,
387
- required: false,
388
- canReadOnRelationQuery: true,
389
- title: "Service Repository ID",
400
+ title: "Created by User ID",
390
401
  description:
391
- "ID of your OneUptime Service Repository in which this object belongs",
402
+ "User ID who created this object (if this object was created by a User)",
392
403
  })
393
404
  @Column({
394
405
  type: ColumnType.ObjectID,
395
406
  nullable: true,
396
407
  transformer: ObjectID.getDatabaseTransformer(),
397
408
  })
398
- public serviceRepositoryId?: ObjectID = undefined;
409
+ public createdByUserId?: ObjectID = undefined;
399
410
 
400
411
  @ColumnAccessControl({
401
412
  create: [],
402
- read: [
403
- Permission.ProjectOwner,
404
- Permission.ProjectAdmin,
405
- Permission.ProjectMember,
406
- Permission.ReadCopilotPullRequest,
407
- ],
413
+ read: [],
408
414
  update: [],
409
415
  })
410
416
  @TableColumn({
411
- type: TableColumnType.ShortText,
412
- required: false,
413
- isDefaultValueColumn: false,
417
+ isDefaultValueColumn: true,
418
+ required: true,
419
+ type: TableColumnType.Boolean,
414
420
  canReadOnRelationQuery: true,
415
- title: "Pull Request ID",
421
+ title: "Is Global LLM",
416
422
  description:
417
- "ID of Pull Request in the repository where this event was executed and then PR was created.",
423
+ "Is this a global LLM that is available to all projects? Only admins can create global LLMs.",
424
+ defaultValue: false,
418
425
  })
419
426
  @Column({
420
- type: ColumnType.ShortText,
421
- nullable: true,
427
+ type: ColumnType.Boolean,
428
+ nullable: false,
429
+ unique: false,
430
+ default: false,
422
431
  })
423
- public pullRequestId?: string = undefined;
432
+ public isGlobalLlm?: boolean = undefined;
424
433
 
425
434
  @ColumnAccessControl({
426
- create: [],
427
- read: [
435
+ create: [
428
436
  Permission.ProjectOwner,
429
437
  Permission.ProjectAdmin,
430
438
  Permission.ProjectMember,
431
- Permission.ReadCopilotPullRequest,
439
+ Permission.CreateProjectLlm,
432
440
  ],
433
- update: [],
434
- })
435
- @TableColumn({
436
- type: TableColumnType.ShortText,
437
- title: "Copilot Event Status",
438
- canReadOnRelationQuery: true,
439
- description:
440
- "Status of Copilot Event that was triggered for this file in Code Repository",
441
- })
442
- @Column({
443
- type: ColumnType.ShortText,
444
- nullable: false,
445
- })
446
- public copilotPullRequestStatus?: PullRequestState = undefined;
447
-
448
- @ColumnAccessControl({
449
- create: [],
450
- read: [
441
+ read: [Permission.Public],
442
+ update: [
451
443
  Permission.ProjectOwner,
452
444
  Permission.ProjectAdmin,
453
445
  Permission.ProjectMember,
454
- Permission.ReadCopilotPullRequest,
446
+ Permission.EditProjectLlm,
455
447
  ],
456
- update: [],
457
448
  })
458
449
  @TableColumn({
450
+ isDefaultValueColumn: true,
451
+ required: true,
459
452
  type: TableColumnType.Boolean,
460
- title: "Is Setup Pull Request",
461
- required: false,
453
+ title: "Is Default",
462
454
  description:
463
- "Is this pull request created by Copilot for setting up the repository?",
455
+ "Is this the default LLM provider for the project? When set, the global LLM provider will not be used.",
456
+ defaultValue: false,
464
457
  })
465
458
  @Column({
466
459
  type: ColumnType.Boolean,
467
- nullable: true,
460
+ nullable: false,
461
+ unique: false,
462
+ default: false,
468
463
  })
469
- public isSetupPullRequest?: boolean = undefined;
464
+ public isDefault?: boolean = undefined;
470
465
  }