@oneuptime/common 9.3.22 → 9.4.1

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 (130) hide show
  1. package/Models/DatabaseModels/IncomingCallLog.ts +521 -0
  2. package/Models/DatabaseModels/IncomingCallLogItem.ts +463 -0
  3. package/Models/DatabaseModels/IncomingCallPolicy.ts +811 -0
  4. package/Models/DatabaseModels/IncomingCallPolicyEscalationRule.ts +597 -0
  5. package/Models/DatabaseModels/Index.ts +18 -0
  6. package/Models/DatabaseModels/ProjectSCIMLog.ts +422 -0
  7. package/Models/DatabaseModels/StatusPageDomain.ts +2 -0
  8. package/Models/DatabaseModels/StatusPageSCIMLog.ts +455 -0
  9. package/Models/DatabaseModels/User.ts +0 -15
  10. package/Models/DatabaseModels/UserIncomingCallNumber.ts +296 -0
  11. package/Server/API/UserIncomingCallNumberAPI.ts +128 -0
  12. package/Server/Infrastructure/Postgres/SchemaMigrations/1768583966447-MigrationName.ts +121 -0
  13. package/Server/Infrastructure/Postgres/SchemaMigrations/1768825402472-MigrationName.ts +317 -0
  14. package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +4 -0
  15. package/Server/Services/DatabaseService.ts +23 -1
  16. package/Server/Services/DomainService.ts +26 -15
  17. package/Server/Services/IncomingCallLogItemService.ts +10 -0
  18. package/Server/Services/IncomingCallLogService.ts +10 -0
  19. package/Server/Services/IncomingCallPolicyEscalationRuleService.ts +267 -0
  20. package/Server/Services/IncomingCallPolicyService.ts +10 -0
  21. package/Server/Services/Index.ts +7 -0
  22. package/Server/Services/MonitorProbeService.ts +96 -1
  23. package/Server/Services/ProjectSCIMLogService.ts +11 -0
  24. package/Server/Services/StatusPageSCIMLogService.ts +11 -0
  25. package/Server/Services/UserCallService.ts +31 -0
  26. package/Server/Services/UserIncomingCallNumberService.ts +258 -0
  27. package/Server/Services/UserSmsService.ts +31 -0
  28. package/Server/Utils/StartServer.ts +5 -0
  29. package/Types/Call/CallProvider.ts +99 -0
  30. package/Types/Call/CallProviderType.ts +6 -0
  31. package/Types/Domain.ts +23 -0
  32. package/Types/Icon/IconProp.ts +1 -0
  33. package/Types/IncomingCall/IncomingCallStatus.ts +13 -0
  34. package/Types/Permission.ts +126 -0
  35. package/Types/Phone.ts +53 -4
  36. package/Types/SCIM/SCIMLogStatus.ts +7 -0
  37. package/UI/Components/Diagram/ConceptCards.tsx +74 -0
  38. package/UI/Components/Diagram/HorizontalStepChain.tsx +92 -0
  39. package/UI/Components/Diagram/Index.ts +11 -0
  40. package/UI/Components/Diagram/NumberedSteps.tsx +77 -0
  41. package/UI/Components/Diagram/VerticalFlowSteps.tsx +59 -0
  42. package/UI/Components/Icon/Icon.tsx +10 -0
  43. package/UI/Components/SimpleLogViewer/SimpleLogViewer.tsx +86 -2
  44. package/build/dist/Models/DatabaseModels/IncomingCallLog.js +565 -0
  45. package/build/dist/Models/DatabaseModels/IncomingCallLog.js.map +1 -0
  46. package/build/dist/Models/DatabaseModels/IncomingCallLogItem.js +497 -0
  47. package/build/dist/Models/DatabaseModels/IncomingCallLogItem.js.map +1 -0
  48. package/build/dist/Models/DatabaseModels/IncomingCallPolicy.js +840 -0
  49. package/build/dist/Models/DatabaseModels/IncomingCallPolicy.js.map +1 -0
  50. package/build/dist/Models/DatabaseModels/IncomingCallPolicyEscalationRule.js +619 -0
  51. package/build/dist/Models/DatabaseModels/IncomingCallPolicyEscalationRule.js.map +1 -0
  52. package/build/dist/Models/DatabaseModels/Index.js +16 -0
  53. package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
  54. package/build/dist/Models/DatabaseModels/ProjectSCIMLog.js +455 -0
  55. package/build/dist/Models/DatabaseModels/ProjectSCIMLog.js.map +1 -0
  56. package/build/dist/Models/DatabaseModels/StatusPageDomain.js +2 -0
  57. package/build/dist/Models/DatabaseModels/StatusPageDomain.js.map +1 -1
  58. package/build/dist/Models/DatabaseModels/StatusPageSCIMLog.js +486 -0
  59. package/build/dist/Models/DatabaseModels/StatusPageSCIMLog.js.map +1 -0
  60. package/build/dist/Models/DatabaseModels/User.js +0 -16
  61. package/build/dist/Models/DatabaseModels/User.js.map +1 -1
  62. package/build/dist/Models/DatabaseModels/UserIncomingCallNumber.js +315 -0
  63. package/build/dist/Models/DatabaseModels/UserIncomingCallNumber.js.map +1 -0
  64. package/build/dist/Server/API/UserIncomingCallNumberAPI.js +72 -0
  65. package/build/dist/Server/API/UserIncomingCallNumberAPI.js.map +1 -0
  66. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1768583966447-MigrationName.js +48 -0
  67. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1768583966447-MigrationName.js.map +1 -0
  68. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1768825402472-MigrationName.js +116 -0
  69. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1768825402472-MigrationName.js.map +1 -0
  70. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +4 -0
  71. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
  72. package/build/dist/Server/Services/DatabaseService.js +12 -0
  73. package/build/dist/Server/Services/DatabaseService.js.map +1 -1
  74. package/build/dist/Server/Services/DomainService.js +19 -8
  75. package/build/dist/Server/Services/DomainService.js.map +1 -1
  76. package/build/dist/Server/Services/IncomingCallLogItemService.js +9 -0
  77. package/build/dist/Server/Services/IncomingCallLogItemService.js.map +1 -0
  78. package/build/dist/Server/Services/IncomingCallLogService.js +9 -0
  79. package/build/dist/Server/Services/IncomingCallLogService.js.map +1 -0
  80. package/build/dist/Server/Services/IncomingCallPolicyEscalationRuleService.js +197 -0
  81. package/build/dist/Server/Services/IncomingCallPolicyEscalationRuleService.js.map +1 -0
  82. package/build/dist/Server/Services/IncomingCallPolicyService.js +9 -0
  83. package/build/dist/Server/Services/IncomingCallPolicyService.js.map +1 -0
  84. package/build/dist/Server/Services/Index.js +6 -0
  85. package/build/dist/Server/Services/Index.js.map +1 -1
  86. package/build/dist/Server/Services/MonitorProbeService.js +77 -0
  87. package/build/dist/Server/Services/MonitorProbeService.js.map +1 -1
  88. package/build/dist/Server/Services/ProjectSCIMLogService.js +10 -0
  89. package/build/dist/Server/Services/ProjectSCIMLogService.js.map +1 -0
  90. package/build/dist/Server/Services/StatusPageSCIMLogService.js +10 -0
  91. package/build/dist/Server/Services/StatusPageSCIMLogService.js.map +1 -0
  92. package/build/dist/Server/Services/UserCallService.js +21 -0
  93. package/build/dist/Server/Services/UserCallService.js.map +1 -1
  94. package/build/dist/Server/Services/UserIncomingCallNumberService.js +225 -0
  95. package/build/dist/Server/Services/UserIncomingCallNumberService.js.map +1 -0
  96. package/build/dist/Server/Services/UserSmsService.js +21 -0
  97. package/build/dist/Server/Services/UserSmsService.js.map +1 -1
  98. package/build/dist/Server/Utils/StartServer.js +5 -0
  99. package/build/dist/Server/Utils/StartServer.js.map +1 -1
  100. package/build/dist/Types/Call/CallProvider.js +2 -0
  101. package/build/dist/Types/Call/CallProvider.js.map +1 -0
  102. package/build/dist/Types/Call/CallProviderType.js +7 -0
  103. package/build/dist/Types/Call/CallProviderType.js.map +1 -0
  104. package/build/dist/Types/Domain.js +23 -1
  105. package/build/dist/Types/Domain.js.map +1 -1
  106. package/build/dist/Types/Icon/IconProp.js +1 -0
  107. package/build/dist/Types/Icon/IconProp.js.map +1 -1
  108. package/build/dist/Types/IncomingCall/IncomingCallStatus.js +14 -0
  109. package/build/dist/Types/IncomingCall/IncomingCallStatus.js.map +1 -0
  110. package/build/dist/Types/Permission.js +104 -0
  111. package/build/dist/Types/Permission.js.map +1 -1
  112. package/build/dist/Types/Phone.js +47 -3
  113. package/build/dist/Types/Phone.js.map +1 -1
  114. package/build/dist/Types/SCIM/SCIMLogStatus.js +8 -0
  115. package/build/dist/Types/SCIM/SCIMLogStatus.js.map +1 -0
  116. package/build/dist/UI/Components/Diagram/ConceptCards.js +30 -0
  117. package/build/dist/UI/Components/Diagram/ConceptCards.js.map +1 -0
  118. package/build/dist/UI/Components/Diagram/HorizontalStepChain.js +30 -0
  119. package/build/dist/UI/Components/Diagram/HorizontalStepChain.js.map +1 -0
  120. package/build/dist/UI/Components/Diagram/Index.js +5 -0
  121. package/build/dist/UI/Components/Diagram/Index.js.map +1 -0
  122. package/build/dist/UI/Components/Diagram/NumberedSteps.js +18 -0
  123. package/build/dist/UI/Components/Diagram/NumberedSteps.js.map +1 -0
  124. package/build/dist/UI/Components/Diagram/VerticalFlowSteps.js +16 -0
  125. package/build/dist/UI/Components/Diagram/VerticalFlowSteps.js.map +1 -0
  126. package/build/dist/UI/Components/Icon/Icon.js +4 -0
  127. package/build/dist/UI/Components/Icon/Icon.js.map +1 -1
  128. package/build/dist/UI/Components/SimpleLogViewer/SimpleLogViewer.js +30 -1
  129. package/build/dist/UI/Components/SimpleLogViewer/SimpleLogViewer.js.map +1 -1
  130. package/package.json +1 -1
@@ -0,0 +1,317 @@
1
+ import { MigrationInterface, QueryRunner } from "typeorm";
2
+
3
+ export class MigrationName1768825402472 implements MigrationInterface {
4
+ public name = "MigrationName1768825402472";
5
+
6
+ public async up(queryRunner: QueryRunner): Promise<void> {
7
+ await queryRunner.query(
8
+ `CREATE TABLE "IncomingCallPolicy" ("_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, "name" character varying(100) NOT NULL, "description" character varying(500), "slug" character varying(100) NOT NULL, "routingPhoneNumber" character varying(30), "callProviderPhoneNumberId" character varying(100), "phoneNumberCountryCode" character varying(100), "phoneNumberAreaCode" character varying(100), "phoneNumberPurchasedAt" TIMESTAMP WITH TIME ZONE, "greetingMessage" character varying(500) DEFAULT 'Please wait while we connect you to the on-call engineer.', "noAnswerMessage" character varying(500) DEFAULT 'No one is available. Please try again later.', "noOneAvailableMessage" character varying(500) DEFAULT 'We are sorry, but no on-call engineer is currently available. Please try again later or contact support.', "isEnabled" boolean NOT NULL DEFAULT true, "repeatPolicyIfNoOneAnswers" boolean NOT NULL DEFAULT false, "repeatPolicyIfNoOneAnswersTimes" integer NOT NULL DEFAULT '1', "projectCallSMSConfigId" uuid, "createdByUserId" uuid, "deletedByUserId" uuid, CONSTRAINT "UQ_5242e2cffd7f4050e6189e569d5" UNIQUE ("slug"), CONSTRAINT "PK_1cce87f0549b0284e23492d0910" PRIMARY KEY ("_id"))`,
9
+ );
10
+ await queryRunner.query(
11
+ `CREATE INDEX "IDX_3c52bf3d9f9aca2ac74848fc0f" ON "IncomingCallPolicy" ("projectId") `,
12
+ );
13
+ await queryRunner.query(
14
+ `CREATE INDEX "IDX_f2f54dca4c8c0bbdea4c37edb2" ON "IncomingCallPolicy" ("name") `,
15
+ );
16
+ await queryRunner.query(
17
+ `CREATE INDEX "IDX_5242e2cffd7f4050e6189e569d" ON "IncomingCallPolicy" ("slug") `,
18
+ );
19
+ await queryRunner.query(
20
+ `CREATE INDEX "IDX_6680fc89e547525f8051bb2599" ON "IncomingCallPolicy" ("routingPhoneNumber") `,
21
+ );
22
+ await queryRunner.query(
23
+ `CREATE TABLE "IncomingCallPolicyEscalationRule" ("_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, "incomingCallPolicyId" uuid NOT NULL, "name" character varying(100), "description" character varying(500), "order" integer NOT NULL, "escalateAfterSeconds" integer NOT NULL DEFAULT '30', "onCallDutyPolicyScheduleId" uuid, "userId" uuid, "createdByUserId" uuid, "deletedByUserId" uuid, CONSTRAINT "PK_162e367fb58da2aea22a14057e1" PRIMARY KEY ("_id"))`,
24
+ );
25
+ await queryRunner.query(
26
+ `CREATE INDEX "IDX_3ff7e49f61d10020a7298c3dc6" ON "IncomingCallPolicyEscalationRule" ("projectId") `,
27
+ );
28
+ await queryRunner.query(
29
+ `CREATE INDEX "IDX_d9358a64a7d4a3f48804844e69" ON "IncomingCallPolicyEscalationRule" ("incomingCallPolicyId") `,
30
+ );
31
+ await queryRunner.query(
32
+ `CREATE INDEX "IDX_2940b1f9392441bcff1a33ebc4" ON "IncomingCallPolicyEscalationRule" ("order") `,
33
+ );
34
+ await queryRunner.query(
35
+ `CREATE TABLE "IncomingCallLog" ("_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, "incomingCallPolicyId" uuid NOT NULL, "callerPhoneNumber" character varying(30), "routingPhoneNumber" character varying(30), "callProviderCallId" character varying(100), "status" character varying(100) NOT NULL DEFAULT 'Initiated', "statusMessage" character varying(500), "callDurationInSeconds" integer DEFAULT '0', "callCostInUSDCents" integer DEFAULT '0', "incomingCallCostInUSDCents" integer DEFAULT '0', "outgoingCallCostInUSDCents" integer DEFAULT '0', "startedAt" TIMESTAMP WITH TIME ZONE, "endedAt" TIMESTAMP WITH TIME ZONE, "answeredByUserId" uuid, "currentEscalationRuleOrder" integer DEFAULT '1', "repeatCount" integer DEFAULT '0', CONSTRAINT "PK_c1fd81ebc16e88b441dd8d19108" PRIMARY KEY ("_id"))`,
36
+ );
37
+ await queryRunner.query(
38
+ `CREATE INDEX "IDX_915f3d5f9bf60430bbd89a1efc" ON "IncomingCallLog" ("projectId") `,
39
+ );
40
+ await queryRunner.query(
41
+ `CREATE INDEX "IDX_18e2254401cd580a906808d690" ON "IncomingCallLog" ("incomingCallPolicyId") `,
42
+ );
43
+ await queryRunner.query(
44
+ `CREATE INDEX "IDX_4769731b4e40dd238410b47337" ON "IncomingCallLog" ("callProviderCallId") `,
45
+ );
46
+ await queryRunner.query(
47
+ `CREATE INDEX "IDX_bac28bb0cfff30703cb79e4a9c" ON "IncomingCallLog" ("status") `,
48
+ );
49
+ await queryRunner.query(
50
+ `CREATE INDEX "IDX_0821fb47819572b56836b06102" ON "IncomingCallLog" ("startedAt") `,
51
+ );
52
+ await queryRunner.query(
53
+ `CREATE TABLE "IncomingCallLogItem" ("_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, "incomingCallLogId" uuid NOT NULL, "incomingCallPolicyEscalationRuleId" uuid, "userId" uuid, "userPhoneNumber" character varying(30), "status" character varying(100) NOT NULL DEFAULT 'Ringing', "statusMessage" character varying(500), "dialDurationInSeconds" integer DEFAULT '0', "callCostInUSDCents" integer DEFAULT '0', "startedAt" TIMESTAMP WITH TIME ZONE, "endedAt" TIMESTAMP WITH TIME ZONE, "isAnswered" boolean NOT NULL DEFAULT false, CONSTRAINT "PK_00c152a3a8f417339c18000d197" PRIMARY KEY ("_id"))`,
54
+ );
55
+ await queryRunner.query(
56
+ `CREATE INDEX "IDX_4d0e67775a87ffdf8b1413d5bc" ON "IncomingCallLogItem" ("projectId") `,
57
+ );
58
+ await queryRunner.query(
59
+ `CREATE INDEX "IDX_d11a949952998081bed04512a7" ON "IncomingCallLogItem" ("incomingCallLogId") `,
60
+ );
61
+ await queryRunner.query(
62
+ `CREATE INDEX "IDX_cb196303d93ee4044d0a4f076e" ON "IncomingCallLogItem" ("userId") `,
63
+ );
64
+ await queryRunner.query(
65
+ `CREATE INDEX "IDX_5ecd45b8e5c05322459b01f37e" ON "IncomingCallLogItem" ("status") `,
66
+ );
67
+ await queryRunner.query(
68
+ `CREATE INDEX "IDX_c2f339131713708082a01cd880" ON "IncomingCallLogItem" ("startedAt") `,
69
+ );
70
+ await queryRunner.query(
71
+ `CREATE TABLE "UserIncomingCallNumber" ("_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, "phone" character varying(30) NOT NULL, "userId" uuid, "createdByUserId" uuid, "deletedByUserId" uuid, "isVerified" boolean NOT NULL DEFAULT false, "verificationCode" character varying(100) NOT NULL, CONSTRAINT "PK_6e487c7ce740c2f21f83904afbe" PRIMARY KEY ("_id"))`,
72
+ );
73
+ await queryRunner.query(
74
+ `CREATE INDEX "IDX_af7375987850451a60f0002ae4" ON "UserIncomingCallNumber" ("projectId") `,
75
+ );
76
+ await queryRunner.query(
77
+ `CREATE INDEX "IDX_3b7f38fb56ffd49e972205cb48" ON "UserIncomingCallNumber" ("userId") `,
78
+ );
79
+ await queryRunner.query(
80
+ `CREATE TABLE "IncomingCallPolicyLabel" ("incomingCallPolicyId" uuid NOT NULL, "labelId" uuid NOT NULL, CONSTRAINT "PK_dbe36f4c556e85705e2ff19e4a5" PRIMARY KEY ("incomingCallPolicyId", "labelId"))`,
81
+ );
82
+ await queryRunner.query(
83
+ `CREATE INDEX "IDX_fb7de9bbc395452347629e9131" ON "IncomingCallPolicyLabel" ("incomingCallPolicyId") `,
84
+ );
85
+ await queryRunner.query(
86
+ `CREATE INDEX "IDX_fb6335122b06a052c29d3d6d8b" ON "IncomingCallPolicyLabel" ("labelId") `,
87
+ );
88
+ await queryRunner.query(
89
+ `ALTER TABLE "User" DROP COLUMN "alertPhoneNumber"`,
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
+ `ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "restrictionTimes" SET DEFAULT '{"_type":"RestrictionTimes","value":{"restictionType":"None","dayRestrictionTimes":null,"weeklyRestrictionTimes":[]}}'`,
96
+ );
97
+ await queryRunner.query(
98
+ `ALTER TABLE "IncomingCallPolicy" ADD CONSTRAINT "FK_3c52bf3d9f9aca2ac74848fc0f7" FOREIGN KEY ("projectId") REFERENCES "Project"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
99
+ );
100
+ await queryRunner.query(
101
+ `ALTER TABLE "IncomingCallPolicy" ADD CONSTRAINT "FK_08a214983b56f6102a4fdecfa65" FOREIGN KEY ("projectCallSMSConfigId") REFERENCES "ProjectCallSMSConfig"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
102
+ );
103
+ await queryRunner.query(
104
+ `ALTER TABLE "IncomingCallPolicy" ADD CONSTRAINT "FK_fb8001e77d8907b8e089afa6193" FOREIGN KEY ("createdByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
105
+ );
106
+ await queryRunner.query(
107
+ `ALTER TABLE "IncomingCallPolicy" ADD CONSTRAINT "FK_197d35d96152cbaa101afa670bd" FOREIGN KEY ("deletedByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
108
+ );
109
+ await queryRunner.query(
110
+ `ALTER TABLE "IncomingCallPolicyEscalationRule" ADD CONSTRAINT "FK_3ff7e49f61d10020a7298c3dc64" FOREIGN KEY ("projectId") REFERENCES "Project"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
111
+ );
112
+ await queryRunner.query(
113
+ `ALTER TABLE "IncomingCallPolicyEscalationRule" ADD CONSTRAINT "FK_d9358a64a7d4a3f48804844e698" FOREIGN KEY ("incomingCallPolicyId") REFERENCES "IncomingCallPolicy"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
114
+ );
115
+ await queryRunner.query(
116
+ `ALTER TABLE "IncomingCallPolicyEscalationRule" ADD CONSTRAINT "FK_5e2f646a84077a5fd4969ef090b" FOREIGN KEY ("onCallDutyPolicyScheduleId") REFERENCES "OnCallDutyPolicySchedule"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
117
+ );
118
+ await queryRunner.query(
119
+ `ALTER TABLE "IncomingCallPolicyEscalationRule" ADD CONSTRAINT "FK_c0c7ea3cb722a94e074c4486b29" FOREIGN KEY ("userId") REFERENCES "User"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
120
+ );
121
+ await queryRunner.query(
122
+ `ALTER TABLE "IncomingCallPolicyEscalationRule" ADD CONSTRAINT "FK_c0726b90365656bd869ad821b3b" FOREIGN KEY ("createdByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
123
+ );
124
+ await queryRunner.query(
125
+ `ALTER TABLE "IncomingCallPolicyEscalationRule" ADD CONSTRAINT "FK_c434cfc9ca11de56e1b5a316559" FOREIGN KEY ("deletedByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
126
+ );
127
+ await queryRunner.query(
128
+ `ALTER TABLE "IncomingCallLog" ADD CONSTRAINT "FK_915f3d5f9bf60430bbd89a1efce" FOREIGN KEY ("projectId") REFERENCES "Project"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
129
+ );
130
+ await queryRunner.query(
131
+ `ALTER TABLE "IncomingCallLog" ADD CONSTRAINT "FK_18e2254401cd580a906808d6908" FOREIGN KEY ("incomingCallPolicyId") REFERENCES "IncomingCallPolicy"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
132
+ );
133
+ await queryRunner.query(
134
+ `ALTER TABLE "IncomingCallLog" ADD CONSTRAINT "FK_fb2531b7d8c44e4cad026fb8662" FOREIGN KEY ("answeredByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
135
+ );
136
+ await queryRunner.query(
137
+ `ALTER TABLE "IncomingCallLogItem" ADD CONSTRAINT "FK_4d0e67775a87ffdf8b1413d5bcb" FOREIGN KEY ("projectId") REFERENCES "Project"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
138
+ );
139
+ await queryRunner.query(
140
+ `ALTER TABLE "IncomingCallLogItem" ADD CONSTRAINT "FK_d11a949952998081bed04512a77" FOREIGN KEY ("incomingCallLogId") REFERENCES "IncomingCallLog"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
141
+ );
142
+ await queryRunner.query(
143
+ `ALTER TABLE "IncomingCallLogItem" ADD CONSTRAINT "FK_b1fbb2661c86de72ffd61f807b9" FOREIGN KEY ("incomingCallPolicyEscalationRuleId") REFERENCES "IncomingCallPolicyEscalationRule"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
144
+ );
145
+ await queryRunner.query(
146
+ `ALTER TABLE "IncomingCallLogItem" ADD CONSTRAINT "FK_cb196303d93ee4044d0a4f076e5" FOREIGN KEY ("userId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
147
+ );
148
+ await queryRunner.query(
149
+ `ALTER TABLE "UserIncomingCallNumber" ADD CONSTRAINT "FK_af7375987850451a60f0002ae43" FOREIGN KEY ("projectId") REFERENCES "Project"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
150
+ );
151
+ await queryRunner.query(
152
+ `ALTER TABLE "UserIncomingCallNumber" ADD CONSTRAINT "FK_3b7f38fb56ffd49e972205cb483" FOREIGN KEY ("userId") REFERENCES "User"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
153
+ );
154
+ await queryRunner.query(
155
+ `ALTER TABLE "UserIncomingCallNumber" ADD CONSTRAINT "FK_4565a75d2ff8c3f363ac2a9c056" FOREIGN KEY ("createdByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
156
+ );
157
+ await queryRunner.query(
158
+ `ALTER TABLE "UserIncomingCallNumber" ADD CONSTRAINT "FK_cab048905c4eb8f87aff75feaa7" FOREIGN KEY ("deletedByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
159
+ );
160
+ await queryRunner.query(
161
+ `ALTER TABLE "IncomingCallPolicyLabel" ADD CONSTRAINT "FK_fb7de9bbc395452347629e91318" FOREIGN KEY ("incomingCallPolicyId") REFERENCES "IncomingCallPolicy"("_id") ON DELETE CASCADE ON UPDATE CASCADE`,
162
+ );
163
+ await queryRunner.query(
164
+ `ALTER TABLE "IncomingCallPolicyLabel" ADD CONSTRAINT "FK_fb6335122b06a052c29d3d6d8b5" FOREIGN KEY ("labelId") REFERENCES "Label"("_id") ON DELETE CASCADE ON UPDATE CASCADE`,
165
+ );
166
+ }
167
+
168
+ public async down(queryRunner: QueryRunner): Promise<void> {
169
+ await queryRunner.query(
170
+ `ALTER TABLE "IncomingCallPolicyLabel" DROP CONSTRAINT "FK_fb6335122b06a052c29d3d6d8b5"`,
171
+ );
172
+ await queryRunner.query(
173
+ `ALTER TABLE "IncomingCallPolicyLabel" DROP CONSTRAINT "FK_fb7de9bbc395452347629e91318"`,
174
+ );
175
+ await queryRunner.query(
176
+ `ALTER TABLE "UserIncomingCallNumber" DROP CONSTRAINT "FK_cab048905c4eb8f87aff75feaa7"`,
177
+ );
178
+ await queryRunner.query(
179
+ `ALTER TABLE "UserIncomingCallNumber" DROP CONSTRAINT "FK_4565a75d2ff8c3f363ac2a9c056"`,
180
+ );
181
+ await queryRunner.query(
182
+ `ALTER TABLE "UserIncomingCallNumber" DROP CONSTRAINT "FK_3b7f38fb56ffd49e972205cb483"`,
183
+ );
184
+ await queryRunner.query(
185
+ `ALTER TABLE "UserIncomingCallNumber" DROP CONSTRAINT "FK_af7375987850451a60f0002ae43"`,
186
+ );
187
+ await queryRunner.query(
188
+ `ALTER TABLE "IncomingCallLogItem" DROP CONSTRAINT "FK_cb196303d93ee4044d0a4f076e5"`,
189
+ );
190
+ await queryRunner.query(
191
+ `ALTER TABLE "IncomingCallLogItem" DROP CONSTRAINT "FK_b1fbb2661c86de72ffd61f807b9"`,
192
+ );
193
+ await queryRunner.query(
194
+ `ALTER TABLE "IncomingCallLogItem" DROP CONSTRAINT "FK_d11a949952998081bed04512a77"`,
195
+ );
196
+ await queryRunner.query(
197
+ `ALTER TABLE "IncomingCallLogItem" DROP CONSTRAINT "FK_4d0e67775a87ffdf8b1413d5bcb"`,
198
+ );
199
+ await queryRunner.query(
200
+ `ALTER TABLE "IncomingCallLog" DROP CONSTRAINT "FK_fb2531b7d8c44e4cad026fb8662"`,
201
+ );
202
+ await queryRunner.query(
203
+ `ALTER TABLE "IncomingCallLog" DROP CONSTRAINT "FK_18e2254401cd580a906808d6908"`,
204
+ );
205
+ await queryRunner.query(
206
+ `ALTER TABLE "IncomingCallLog" DROP CONSTRAINT "FK_915f3d5f9bf60430bbd89a1efce"`,
207
+ );
208
+ await queryRunner.query(
209
+ `ALTER TABLE "IncomingCallPolicyEscalationRule" DROP CONSTRAINT "FK_c434cfc9ca11de56e1b5a316559"`,
210
+ );
211
+ await queryRunner.query(
212
+ `ALTER TABLE "IncomingCallPolicyEscalationRule" DROP CONSTRAINT "FK_c0726b90365656bd869ad821b3b"`,
213
+ );
214
+ await queryRunner.query(
215
+ `ALTER TABLE "IncomingCallPolicyEscalationRule" DROP CONSTRAINT "FK_c0c7ea3cb722a94e074c4486b29"`,
216
+ );
217
+ await queryRunner.query(
218
+ `ALTER TABLE "IncomingCallPolicyEscalationRule" DROP CONSTRAINT "FK_5e2f646a84077a5fd4969ef090b"`,
219
+ );
220
+ await queryRunner.query(
221
+ `ALTER TABLE "IncomingCallPolicyEscalationRule" DROP CONSTRAINT "FK_d9358a64a7d4a3f48804844e698"`,
222
+ );
223
+ await queryRunner.query(
224
+ `ALTER TABLE "IncomingCallPolicyEscalationRule" DROP CONSTRAINT "FK_3ff7e49f61d10020a7298c3dc64"`,
225
+ );
226
+ await queryRunner.query(
227
+ `ALTER TABLE "IncomingCallPolicy" DROP CONSTRAINT "FK_197d35d96152cbaa101afa670bd"`,
228
+ );
229
+ await queryRunner.query(
230
+ `ALTER TABLE "IncomingCallPolicy" DROP CONSTRAINT "FK_fb8001e77d8907b8e089afa6193"`,
231
+ );
232
+ await queryRunner.query(
233
+ `ALTER TABLE "IncomingCallPolicy" DROP CONSTRAINT "FK_08a214983b56f6102a4fdecfa65"`,
234
+ );
235
+ await queryRunner.query(
236
+ `ALTER TABLE "IncomingCallPolicy" DROP CONSTRAINT "FK_3c52bf3d9f9aca2ac74848fc0f7"`,
237
+ );
238
+ await queryRunner.query(
239
+ `ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "restrictionTimes" SET DEFAULT '{"_type": "RestrictionTimes", "value": {"restictionType": "None", "dayRestrictionTimes": null, "weeklyRestrictionTimes": []}}'`,
240
+ );
241
+ await queryRunner.query(
242
+ `ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "rotation" SET DEFAULT '{"_type": "Recurring", "value": {"intervalType": "Day", "intervalCount": {"_type": "PositiveNumber", "value": 1}}}'`,
243
+ );
244
+ await queryRunner.query(
245
+ `ALTER TABLE "User" ADD "alertPhoneNumber" character varying(30)`,
246
+ );
247
+ await queryRunner.query(
248
+ `DROP INDEX "public"."IDX_fb6335122b06a052c29d3d6d8b"`,
249
+ );
250
+ await queryRunner.query(
251
+ `DROP INDEX "public"."IDX_fb7de9bbc395452347629e9131"`,
252
+ );
253
+ await queryRunner.query(`DROP TABLE "IncomingCallPolicyLabel"`);
254
+ await queryRunner.query(
255
+ `DROP INDEX "public"."IDX_3b7f38fb56ffd49e972205cb48"`,
256
+ );
257
+ await queryRunner.query(
258
+ `DROP INDEX "public"."IDX_af7375987850451a60f0002ae4"`,
259
+ );
260
+ await queryRunner.query(`DROP TABLE "UserIncomingCallNumber"`);
261
+ await queryRunner.query(
262
+ `DROP INDEX "public"."IDX_c2f339131713708082a01cd880"`,
263
+ );
264
+ await queryRunner.query(
265
+ `DROP INDEX "public"."IDX_5ecd45b8e5c05322459b01f37e"`,
266
+ );
267
+ await queryRunner.query(
268
+ `DROP INDEX "public"."IDX_cb196303d93ee4044d0a4f076e"`,
269
+ );
270
+ await queryRunner.query(
271
+ `DROP INDEX "public"."IDX_d11a949952998081bed04512a7"`,
272
+ );
273
+ await queryRunner.query(
274
+ `DROP INDEX "public"."IDX_4d0e67775a87ffdf8b1413d5bc"`,
275
+ );
276
+ await queryRunner.query(`DROP TABLE "IncomingCallLogItem"`);
277
+ await queryRunner.query(
278
+ `DROP INDEX "public"."IDX_0821fb47819572b56836b06102"`,
279
+ );
280
+ await queryRunner.query(
281
+ `DROP INDEX "public"."IDX_bac28bb0cfff30703cb79e4a9c"`,
282
+ );
283
+ await queryRunner.query(
284
+ `DROP INDEX "public"."IDX_4769731b4e40dd238410b47337"`,
285
+ );
286
+ await queryRunner.query(
287
+ `DROP INDEX "public"."IDX_18e2254401cd580a906808d690"`,
288
+ );
289
+ await queryRunner.query(
290
+ `DROP INDEX "public"."IDX_915f3d5f9bf60430bbd89a1efc"`,
291
+ );
292
+ await queryRunner.query(`DROP TABLE "IncomingCallLog"`);
293
+ await queryRunner.query(
294
+ `DROP INDEX "public"."IDX_2940b1f9392441bcff1a33ebc4"`,
295
+ );
296
+ await queryRunner.query(
297
+ `DROP INDEX "public"."IDX_d9358a64a7d4a3f48804844e69"`,
298
+ );
299
+ await queryRunner.query(
300
+ `DROP INDEX "public"."IDX_3ff7e49f61d10020a7298c3dc6"`,
301
+ );
302
+ await queryRunner.query(`DROP TABLE "IncomingCallPolicyEscalationRule"`);
303
+ await queryRunner.query(
304
+ `DROP INDEX "public"."IDX_6680fc89e547525f8051bb2599"`,
305
+ );
306
+ await queryRunner.query(
307
+ `DROP INDEX "public"."IDX_5242e2cffd7f4050e6189e569d"`,
308
+ );
309
+ await queryRunner.query(
310
+ `DROP INDEX "public"."IDX_f2f54dca4c8c0bbdea4c37edb2"`,
311
+ );
312
+ await queryRunner.query(
313
+ `DROP INDEX "public"."IDX_3c52bf3d9f9aca2ac74848fc0f"`,
314
+ );
315
+ await queryRunner.query(`DROP TABLE "IncomingCallPolicy"`);
316
+ }
317
+ }
@@ -221,6 +221,8 @@ import { IncreaseClientSecretLength1768216593272 } from "./1768216593272-Increas
221
221
  import { AddOAuthProviderType1768217403078 } from "./1768217403078-AddOAuthProviderType";
222
222
  import { AddIncomingEmailMonitor1768335589018 } from "./1768335589018-AddIncomingEmailMonitor";
223
223
  import { MigrationName1768422356713 } from "./1768422356713-MigrationName";
224
+ import { MigrationName1768583966447 } from "./1768583966447-MigrationName";
225
+ import { MigrationName1768825402472 } from "./1768825402472-MigrationName";
224
226
 
225
227
  export default [
226
228
  InitialMigration,
@@ -446,4 +448,6 @@ export default [
446
448
  AddOAuthProviderType1768217403078,
447
449
  AddIncomingEmailMonitor1768335589018,
448
450
  MigrationName1768422356713,
451
+ MigrationName1768583966447,
452
+ MigrationName1768825402472,
449
453
  ];
@@ -59,7 +59,12 @@ import Text from "../../Types/Text";
59
59
  import Typeof from "../../Types/Typeof";
60
60
  import API from "../../Utils/API";
61
61
  import Slug from "../../Utils/Slug";
62
- import { DataSource, Repository, SelectQueryBuilder } from "typeorm";
62
+ import {
63
+ DataSource,
64
+ EntityManager,
65
+ Repository,
66
+ SelectQueryBuilder,
67
+ } from "typeorm";
63
68
  import { FindWhere } from "../../Types/BaseDatabase/Query";
64
69
  import Realtime from "../Utils/Realtime";
65
70
  import ModelEventType from "../../Types/Realtime/ModelEventType";
@@ -129,6 +134,22 @@ class DatabaseService<TBaseModel extends BaseModel> extends BaseService {
129
134
  throw new DatabaseNotConnectedException();
130
135
  }
131
136
 
137
+ public async executeTransaction<TResult>(
138
+ runInTransaction: (entityManager: EntityManager) => Promise<TResult>,
139
+ ): Promise<TResult> {
140
+ if (!PostgresAppInstance.isConnected()) {
141
+ throw new DatabaseNotConnectedException();
142
+ }
143
+
144
+ const dataSource: DataSource | null = PostgresAppInstance.getDataSource();
145
+
146
+ if (!dataSource) {
147
+ throw new DatabaseNotConnectedException();
148
+ }
149
+
150
+ return await dataSource.transaction(runInTransaction);
151
+ }
152
+
132
153
  protected isValid(data: TBaseModel): boolean {
133
154
  if (!data) {
134
155
  throw new BadDataException("Data cannot be null");
@@ -1691,3 +1712,4 @@ class DatabaseService<TBaseModel extends BaseModel> extends BaseService {
1691
1712
  }
1692
1713
 
1693
1714
  export default DatabaseService;
1715
+ export { EntityManager };
@@ -35,10 +35,18 @@ export class Service extends DatabaseService<Model> {
35
35
  createBy.data.domain = new Domain(domain.trim().toLowerCase());
36
36
  }
37
37
 
38
+ /*
39
+ * Prevent setting isVerified during creation, EXCEPT for test domains
40
+ * Test domains can be auto-verified since they are reserved TLDs that can't have real DNS records
41
+ */
38
42
  if (!createBy.props.isRoot && createBy.data.isVerified) {
39
- throw new BadDataException(
40
- "Domain cannot be verified during creation. Please verify the domain after creation. Please set isVerified to false.",
41
- );
43
+ const domainStr: string = createBy.data.domain?.toString() || "";
44
+
45
+ if (!Domain.isTestDomain(domainStr)) {
46
+ throw new BadDataException(
47
+ "Domain cannot be verified during creation. Please verify the domain after creation. Please set isVerified to false.",
48
+ );
49
+ }
42
50
  }
43
51
 
44
52
  createBy.data.domainVerificationText =
@@ -96,19 +104,22 @@ export class Service extends DatabaseService<Model> {
96
104
  );
97
105
  }
98
106
 
99
- const isVerified: boolean = await Domain.verifyTxtRecord(
100
- domain,
101
- verificationText,
102
- );
103
-
104
- if (!isVerified) {
105
- throw new BadDataException(
106
- "Verification TXT record " +
107
- verificationText +
108
- " not found in domain " +
109
- domain +
110
- ". Please add a TXT record to verify the domain. If you have already added the TXT record, please wait for few hours to let DNS to propagate.",
107
+ // Skip DNS verification for test domains (reserved TLDs for testing)
108
+ if (!Domain.isTestDomain(domain)) {
109
+ const isVerified: boolean = await Domain.verifyTxtRecord(
110
+ domain,
111
+ verificationText,
111
112
  );
113
+
114
+ if (!isVerified) {
115
+ throw new BadDataException(
116
+ "Verification TXT record " +
117
+ verificationText +
118
+ " not found in domain " +
119
+ domain +
120
+ ". Please add a TXT record to verify the domain. If you have already added the TXT record, please wait for few hours to let DNS to propagate.",
121
+ );
122
+ }
112
123
  }
113
124
  }
114
125
  }
@@ -0,0 +1,10 @@
1
+ import DatabaseService from "./DatabaseService";
2
+ import IncomingCallLogItem from "../../Models/DatabaseModels/IncomingCallLogItem";
3
+
4
+ export class Service extends DatabaseService<IncomingCallLogItem> {
5
+ public constructor() {
6
+ super(IncomingCallLogItem);
7
+ }
8
+ }
9
+
10
+ export default new Service();
@@ -0,0 +1,10 @@
1
+ import DatabaseService from "./DatabaseService";
2
+ import IncomingCallLog from "../../Models/DatabaseModels/IncomingCallLog";
3
+
4
+ export class Service extends DatabaseService<IncomingCallLog> {
5
+ public constructor() {
6
+ super(IncomingCallLog);
7
+ }
8
+ }
9
+
10
+ export default new Service();