@oneuptime/common 7.0.4395 → 7.0.4415
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Models/AnalyticsModels/AnalyticsBaseModel/CommonModel.ts +2 -2
- package/Server/API/StatusPageAPI.ts +5 -0
- package/Server/Middleware/NotificationMiddleware.ts +2 -0
- package/Server/Middleware/UserAuthorization.ts +1 -0
- package/Server/Services/OpenTelemetryIngestService.ts +3 -3
- package/Server/Services/StatusPageDomainService.ts +1 -0
- package/Server/Types/Database/QueryHelper.ts +22 -22
- package/Server/Types/Workflow/Components/JSON/JsonToText.ts +2 -0
- package/Server/Types/Workflow/Components/JSON/TextToJson.ts +2 -0
- package/Server/Utils/CronTab.ts +2 -0
- package/Server/Utils/JsonWebToken.ts +2 -0
- package/Server/Utils/Monitor/Criteria/CustomCodeMonitorCriteria.ts +2 -0
- package/Server/Utils/Monitor/MonitorResource.ts +1 -0
- package/Server/Utils/VM/VMAPI.ts +3 -0
- package/Server/Utils/VM/VMRunner.ts +1 -1
- package/Tests/Server/API/BaseAPI.test.ts +1 -3
- package/Tests/Server/Middleware/ProjectAuthorization.test.ts +5 -1
- package/Tests/Server/Services/AnalyticsDatabaseService.test.ts +55 -55
- package/Tests/Server/Services/BillingService.test.ts +16 -17
- package/Tests/Server/Services/TeamMemberService.test.ts +16 -1
- package/Tests/Server/TestingUtils/Services/BillingServiceHelper.ts +6 -6
- package/Tests/Server/Utils/AnalyticsDatabase/StatementGenerator.test.ts +5 -6
- package/Tests/UI/Components/404.test.tsx +12 -7
- package/Tests/UI/Components/ConfirmModal.test.tsx +1 -1
- package/Tests/UI/Components/DuplicateModel.test.tsx +14 -6
- package/Tests/UI/Components/OrderedStatesList.test.tsx +1 -1
- package/Types/API/EmptyResponse.ts +2 -1
- package/Types/API/StatusCode.ts +1 -1
- package/Types/BaseDatabase/QueryOperator.ts +1 -1
- package/Types/GenericFunction.ts +1 -1
- package/Types/GenericObject.ts +1 -1
- package/Types/IP/IP.ts +1 -1
- package/Types/Port.ts +1 -1
- package/UI/Components/Accordion/Accordion.tsx +7 -5
- package/UI/Components/BulkUpdate/BulkUpdateForm.tsx +6 -2
- package/UI/Components/Button/Button.tsx +3 -1
- package/UI/Components/CategoryCheckbox/CheckboxList.tsx +6 -2
- package/UI/Components/CodeEditor/CodeEditor.tsx +12 -4
- package/UI/Components/ColorViewer/ColorViewer.tsx +1 -1
- package/UI/Components/Date/StartAndEndDate.tsx +36 -48
- package/UI/Components/Detail/Detail.tsx +3 -1
- package/UI/Components/Dropdown/Dropdown.tsx +12 -13
- package/UI/Components/DuplicateModel/DuplicateModel.tsx +1 -1
- package/UI/Components/Events/RecurringArrayFieldElement.tsx +2 -2
- package/UI/Components/FilePicker/FilePicker.tsx +5 -5
- package/UI/Components/Filters/FilterViewer.tsx +3 -3
- package/UI/Components/FormModal/BasicFormModal.tsx +1 -1
- package/UI/Components/Forms/BasicForm.tsx +1 -1
- package/UI/Components/Forms/Fields/FormField.tsx +5 -4
- package/UI/Components/Forms/ModelForm.tsx +2 -2
- package/UI/Components/Forms/Validation.ts +2 -0
- package/UI/Components/FullPageModal/FullPageModal.tsx +1 -1
- package/UI/Components/Header/HeaderIconDropdownButton.tsx +2 -2
- package/UI/Components/HeaderAlert/HeaderAlert.tsx +1 -1
- package/UI/Components/Icon/Icon.tsx +3 -1
- package/UI/Components/Image/Image.tsx +1 -1
- package/UI/Components/Input/Input.tsx +1 -1
- package/UI/Components/List/List.tsx +4 -4
- package/UI/Components/LogsViewer/LogItem.tsx +2 -0
- package/UI/Components/Modal/ModalFooter.tsx +1 -1
- package/UI/Components/ModelDelete/ModelDelete.tsx +1 -1
- package/UI/Components/ModelDetail/ModelDetail.tsx +3 -3
- package/UI/Components/ModelFormModal/ModelFormModal.tsx +2 -1
- package/UI/Components/ModelList/ModelList.tsx +2 -2
- package/UI/Components/ModelList/StaticModelList.tsx +4 -4
- package/UI/Components/ModelTable/BaseModelTable.tsx +2 -2
- package/UI/Components/ModelTable/TableView.tsx +3 -3
- package/UI/Components/ObjectID/IDGenerator.tsx +1 -1
- package/UI/Components/OrderedStatesList/OrderedStatesList.tsx +4 -2
- package/UI/Components/ProgressBar/ProgressBar.tsx +2 -0
- package/UI/Components/Radio/Radio.tsx +10 -4
- package/UI/Components/Table/Table.tsx +8 -7
- package/UI/Components/TableColumnList/TableColumnListComponent.tsx +1 -1
- package/UI/Components/Tabs/Tabs.tsx +2 -2
- package/UI/Components/TextArea/TextArea.tsx +3 -1
- package/UI/Utils/AnalyticsModelAPI/AnalyticsModelAPI.ts +2 -2
- package/UI/Utils/Cookie.ts +2 -0
- package/UI/Utils/LocalStorage.ts +2 -0
- package/UI/Utils/Logger.ts +10 -8
- package/UI/Utils/ModelAPI/ModelAPI.ts +2 -2
- package/UI/Utils/SessionStorage.ts +2 -0
- package/build/dist/Models/AnalyticsModels/AnalyticsBaseModel/CommonModel.js +2 -2
- package/build/dist/Models/AnalyticsModels/AnalyticsBaseModel/CommonModel.js.map +1 -1
- package/build/dist/Server/API/StatusPageAPI.js +3 -0
- package/build/dist/Server/API/StatusPageAPI.js.map +1 -1
- package/build/dist/Server/Middleware/NotificationMiddleware.js +2 -0
- package/build/dist/Server/Middleware/NotificationMiddleware.js.map +1 -1
- package/build/dist/Server/Middleware/UserAuthorization.js +1 -0
- package/build/dist/Server/Middleware/UserAuthorization.js.map +1 -1
- package/build/dist/Server/Services/StatusPageDomainService.js +1 -0
- package/build/dist/Server/Services/StatusPageDomainService.js.map +1 -1
- package/build/dist/Server/Types/Database/QueryHelper.js.map +1 -1
- package/build/dist/Server/Types/Workflow/Components/JSON/JsonToText.js +2 -0
- package/build/dist/Server/Types/Workflow/Components/JSON/JsonToText.js.map +1 -1
- package/build/dist/Server/Types/Workflow/Components/JSON/TextToJson.js +2 -0
- package/build/dist/Server/Types/Workflow/Components/JSON/TextToJson.js.map +1 -1
- package/build/dist/Server/Utils/CronTab.js +2 -0
- package/build/dist/Server/Utils/CronTab.js.map +1 -1
- package/build/dist/Server/Utils/JsonWebToken.js +2 -0
- package/build/dist/Server/Utils/JsonWebToken.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/Criteria/CustomCodeMonitorCriteria.js +2 -0
- package/build/dist/Server/Utils/Monitor/Criteria/CustomCodeMonitorCriteria.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorResource.js +1 -0
- package/build/dist/Server/Utils/Monitor/MonitorResource.js.map +1 -1
- package/build/dist/Server/Utils/VM/VMAPI.js +3 -0
- package/build/dist/Server/Utils/VM/VMAPI.js.map +1 -1
- package/build/dist/Tests/Server/API/BaseAPI.test.js +1 -3
- package/build/dist/Tests/Server/API/BaseAPI.test.js.map +1 -1
- package/build/dist/Tests/Server/Middleware/ProjectAuthorization.test.js +4 -1
- package/build/dist/Tests/Server/Middleware/ProjectAuthorization.test.js.map +1 -1
- package/build/dist/Tests/Server/Services/AnalyticsDatabaseService.test.js +51 -41
- package/build/dist/Tests/Server/Services/AnalyticsDatabaseService.test.js.map +1 -1
- package/build/dist/Tests/Server/Services/BillingService.test.js +16 -17
- package/build/dist/Tests/Server/Services/BillingService.test.js.map +1 -1
- package/build/dist/Tests/Server/Services/TeamMemberService.test.js +15 -1
- package/build/dist/Tests/Server/Services/TeamMemberService.test.js.map +1 -1
- package/build/dist/Tests/Server/TestingUtils/Services/BillingServiceHelper.js +2 -2
- package/build/dist/Tests/Server/TestingUtils/Services/BillingServiceHelper.js.map +1 -1
- package/build/dist/Tests/Server/Utils/AnalyticsDatabase/StatementGenerator.test.js +5 -5
- package/build/dist/Tests/Server/Utils/AnalyticsDatabase/StatementGenerator.test.js.map +1 -1
- package/build/dist/Tests/UI/Components/404.test.js +8 -3
- package/build/dist/Tests/UI/Components/404.test.js.map +1 -1
- package/build/dist/Tests/UI/Components/ConfirmModal.test.js +1 -1
- package/build/dist/Tests/UI/Components/ConfirmModal.test.js.map +1 -1
- package/build/dist/Tests/UI/Components/DuplicateModel.test.js +7 -2
- package/build/dist/Tests/UI/Components/DuplicateModel.test.js.map +1 -1
- package/build/dist/Tests/UI/Components/OrderedStatesList.test.js +1 -1
- package/build/dist/Tests/UI/Components/OrderedStatesList.test.js.map +1 -1
- package/build/dist/Types/API/StatusCode.js +1 -1
- package/build/dist/Types/API/StatusCode.js.map +1 -1
- package/build/dist/Types/IP/IP.js +1 -1
- package/build/dist/Types/IP/IP.js.map +1 -1
- package/build/dist/Types/Port.js +1 -1
- package/build/dist/Types/Port.js.map +1 -1
- package/build/dist/UI/Components/Accordion/Accordion.js +7 -5
- package/build/dist/UI/Components/Accordion/Accordion.js.map +1 -1
- package/build/dist/UI/Components/BulkUpdate/BulkUpdateForm.js +6 -2
- package/build/dist/UI/Components/BulkUpdate/BulkUpdateForm.js.map +1 -1
- package/build/dist/UI/Components/Button/Button.js +3 -1
- package/build/dist/UI/Components/Button/Button.js.map +1 -1
- package/build/dist/UI/Components/CategoryCheckbox/CheckboxList.js +6 -2
- package/build/dist/UI/Components/CategoryCheckbox/CheckboxList.js.map +1 -1
- package/build/dist/UI/Components/CodeEditor/CodeEditor.js +12 -4
- package/build/dist/UI/Components/CodeEditor/CodeEditor.js.map +1 -1
- package/build/dist/UI/Components/ColorViewer/ColorViewer.js +2 -1
- package/build/dist/UI/Components/ColorViewer/ColorViewer.js.map +1 -1
- package/build/dist/UI/Components/Date/StartAndEndDate.js +22 -24
- package/build/dist/UI/Components/Date/StartAndEndDate.js.map +1 -1
- package/build/dist/UI/Components/Detail/Detail.js +3 -1
- package/build/dist/UI/Components/Detail/Detail.js.map +1 -1
- package/build/dist/UI/Components/Dropdown/Dropdown.js +14 -11
- package/build/dist/UI/Components/Dropdown/Dropdown.js.map +1 -1
- package/build/dist/UI/Components/DuplicateModel/DuplicateModel.js +2 -1
- package/build/dist/UI/Components/DuplicateModel/DuplicateModel.js.map +1 -1
- package/build/dist/UI/Components/Events/RecurringArrayFieldElement.js +4 -2
- package/build/dist/UI/Components/Events/RecurringArrayFieldElement.js.map +1 -1
- package/build/dist/UI/Components/FilePicker/FilePicker.js +8 -5
- package/build/dist/UI/Components/FilePicker/FilePicker.js.map +1 -1
- package/build/dist/UI/Components/Filters/FilterViewer.js +6 -3
- package/build/dist/UI/Components/Filters/FilterViewer.js.map +1 -1
- package/build/dist/UI/Components/FormModal/BasicFormModal.js +2 -1
- package/build/dist/UI/Components/FormModal/BasicFormModal.js.map +1 -1
- package/build/dist/UI/Components/Forms/BasicForm.js +2 -1
- package/build/dist/UI/Components/Forms/BasicForm.js.map +1 -1
- package/build/dist/UI/Components/Forms/Fields/FormField.js +8 -4
- package/build/dist/UI/Components/Forms/Fields/FormField.js.map +1 -1
- package/build/dist/UI/Components/Forms/ModelForm.js +4 -2
- package/build/dist/UI/Components/Forms/ModelForm.js.map +1 -1
- package/build/dist/UI/Components/Forms/Validation.js +2 -0
- package/build/dist/UI/Components/Forms/Validation.js.map +1 -1
- package/build/dist/UI/Components/FullPageModal/FullPageModal.js +2 -1
- package/build/dist/UI/Components/FullPageModal/FullPageModal.js.map +1 -1
- package/build/dist/UI/Components/Header/HeaderIconDropdownButton.js +4 -2
- package/build/dist/UI/Components/Header/HeaderIconDropdownButton.js.map +1 -1
- package/build/dist/UI/Components/HeaderAlert/HeaderAlert.js +2 -1
- package/build/dist/UI/Components/HeaderAlert/HeaderAlert.js.map +1 -1
- package/build/dist/UI/Components/Icon/Icon.js +3 -1
- package/build/dist/UI/Components/Icon/Icon.js.map +1 -1
- package/build/dist/UI/Components/Image/Image.js +2 -1
- package/build/dist/UI/Components/Image/Image.js.map +1 -1
- package/build/dist/UI/Components/Input/Input.js +2 -1
- package/build/dist/UI/Components/Input/Input.js.map +1 -1
- package/build/dist/UI/Components/List/List.js +6 -4
- package/build/dist/UI/Components/List/List.js.map +1 -1
- package/build/dist/UI/Components/LogsViewer/LogItem.js +2 -0
- package/build/dist/UI/Components/LogsViewer/LogItem.js.map +1 -1
- package/build/dist/UI/Components/Modal/ModalFooter.js +2 -1
- package/build/dist/UI/Components/Modal/ModalFooter.js.map +1 -1
- package/build/dist/UI/Components/ModelDelete/ModelDelete.js +2 -1
- package/build/dist/UI/Components/ModelDelete/ModelDelete.js.map +1 -1
- package/build/dist/UI/Components/ModelDetail/ModelDetail.js +5 -5
- package/build/dist/UI/Components/ModelDetail/ModelDetail.js.map +1 -1
- package/build/dist/UI/Components/ModelFormModal/ModelFormModal.js +2 -1
- package/build/dist/UI/Components/ModelFormModal/ModelFormModal.js.map +1 -1
- package/build/dist/UI/Components/ModelList/ModelList.js +4 -2
- package/build/dist/UI/Components/ModelList/ModelList.js.map +1 -1
- package/build/dist/UI/Components/ModelList/StaticModelList.js +7 -5
- package/build/dist/UI/Components/ModelList/StaticModelList.js.map +1 -1
- package/build/dist/UI/Components/ModelTable/BaseModelTable.js +4 -2
- package/build/dist/UI/Components/ModelTable/BaseModelTable.js.map +1 -1
- package/build/dist/UI/Components/ModelTable/TableView.js +6 -3
- package/build/dist/UI/Components/ModelTable/TableView.js.map +1 -1
- package/build/dist/UI/Components/ObjectID/IDGenerator.js +2 -1
- package/build/dist/UI/Components/ObjectID/IDGenerator.js.map +1 -1
- package/build/dist/UI/Components/OrderedStatesList/OrderedStatesList.js +4 -2
- package/build/dist/UI/Components/OrderedStatesList/OrderedStatesList.js.map +1 -1
- package/build/dist/UI/Components/ProgressBar/ProgressBar.js +2 -0
- package/build/dist/UI/Components/ProgressBar/ProgressBar.js.map +1 -1
- package/build/dist/UI/Components/Radio/Radio.js +9 -3
- package/build/dist/UI/Components/Radio/Radio.js.map +1 -1
- package/build/dist/UI/Components/Table/Table.js +12 -7
- package/build/dist/UI/Components/Table/Table.js.map +1 -1
- package/build/dist/UI/Components/Tabs/Tabs.js +2 -2
- package/build/dist/UI/Components/Tabs/Tabs.js.map +1 -1
- package/build/dist/UI/Components/TextArea/TextArea.js +3 -1
- package/build/dist/UI/Components/TextArea/TextArea.js.map +1 -1
- package/build/dist/UI/Utils/Cookie.js +2 -0
- package/build/dist/UI/Utils/Cookie.js.map +1 -1
- package/build/dist/UI/Utils/LocalStorage.js +2 -0
- package/build/dist/UI/Utils/LocalStorage.js.map +1 -1
- package/build/dist/UI/Utils/Logger.js.map +1 -1
- package/build/dist/UI/Utils/SessionStorage.js +2 -0
- package/build/dist/UI/Utils/SessionStorage.js.map +1 -1
- package/package.json +1 -1
|
@@ -76,7 +76,7 @@ export default class CommonModel {
|
|
|
76
76
|
if (column.type === TableColumnType.JSON && typeof value === "string") {
|
|
77
77
|
try {
|
|
78
78
|
value = JSONFunctions.parse(value);
|
|
79
|
-
} catch
|
|
79
|
+
} catch {
|
|
80
80
|
value = {};
|
|
81
81
|
}
|
|
82
82
|
}
|
|
@@ -91,7 +91,7 @@ export default class CommonModel {
|
|
|
91
91
|
if (!Array.isArray(value)) {
|
|
92
92
|
throw new BadDataException("Not an array");
|
|
93
93
|
}
|
|
94
|
-
} catch
|
|
94
|
+
} catch {
|
|
95
95
|
value = [];
|
|
96
96
|
}
|
|
97
97
|
}
|
|
@@ -142,6 +142,10 @@ export default class StatusPageAPI extends BaseAPI<
|
|
|
142
142
|
try {
|
|
143
143
|
statusPageId = new ObjectID(statusPageIdOrDomain);
|
|
144
144
|
} catch (err) {
|
|
145
|
+
logger.error(
|
|
146
|
+
`Error converting statusPageIdOrDomain to ObjectID: ${statusPageIdOrDomain}`,
|
|
147
|
+
);
|
|
148
|
+
logger.error(err);
|
|
145
149
|
return Response.sendErrorResponse(
|
|
146
150
|
req,
|
|
147
151
|
res,
|
|
@@ -224,6 +228,7 @@ export default class StatusPageAPI extends BaseAPI<
|
|
|
224
228
|
try {
|
|
225
229
|
statusPageId = new ObjectID(statusPageIdOrDomain);
|
|
226
230
|
} catch (err) {
|
|
231
|
+
logger.error(err);
|
|
227
232
|
return Response.sendErrorResponse(
|
|
228
233
|
req,
|
|
229
234
|
res,
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
} from "../Utils/Express";
|
|
7
7
|
import JSONWebToken from "../Utils/JsonWebToken";
|
|
8
8
|
import Response from "../Utils/Response";
|
|
9
|
+
import logger from "../Utils/Logger";
|
|
9
10
|
import { OnCallInputRequest } from "../../Types/Call/CallRequest";
|
|
10
11
|
import BadDataException from "../../Types/Exception/BadDataException";
|
|
11
12
|
import JSONFunctions from "../../Types/JSONFunctions";
|
|
@@ -61,6 +62,7 @@ export default class NotificationMiddleware {
|
|
|
61
62
|
JSONWebToken.decodeJsonPayload(token),
|
|
62
63
|
);
|
|
63
64
|
} catch (e) {
|
|
65
|
+
logger.error(e);
|
|
64
66
|
return Response.sendErrorResponse(
|
|
65
67
|
req,
|
|
66
68
|
res,
|
|
@@ -173,6 +173,7 @@ export default class UserMiddleware {
|
|
|
173
173
|
oneuptimeRequest.userAuthorization = JSONWebToken.decode(accessToken);
|
|
174
174
|
} catch (err) {
|
|
175
175
|
// if the token is invalid or expired, it'll throw this error.
|
|
176
|
+
logger.error(err);
|
|
176
177
|
oneuptimeRequest.userType = UserType.Public;
|
|
177
178
|
return next();
|
|
178
179
|
}
|
|
@@ -125,20 +125,20 @@ export default class OTelIngestService {
|
|
|
125
125
|
|
|
126
126
|
const newDbMetric: Metric = Metric.fromJSON(
|
|
127
127
|
dbMetric.toJSON(),
|
|
128
|
-
Metric
|
|
128
|
+
Metric,
|
|
129
129
|
) as Metric;
|
|
130
130
|
|
|
131
131
|
if (datapoint["startTimeUnixNano"]) {
|
|
132
132
|
newDbMetric.startTimeUnixNano = datapoint["startTimeUnixNano"] as number;
|
|
133
133
|
newDbMetric.startTime = OneUptimeDate.fromUnixNano(
|
|
134
|
-
datapoint["startTimeUnixNano"] as number
|
|
134
|
+
datapoint["startTimeUnixNano"] as number,
|
|
135
135
|
);
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
if (datapoint["timeUnixNano"]) {
|
|
139
139
|
newDbMetric.timeUnixNano = datapoint["timeUnixNano"] as number;
|
|
140
140
|
newDbMetric.time = OneUptimeDate.fromUnixNano(
|
|
141
|
-
datapoint["timeUnixNano"] as number
|
|
141
|
+
datapoint["timeUnixNano"] as number,
|
|
142
142
|
);
|
|
143
143
|
}
|
|
144
144
|
|
|
@@ -271,7 +271,7 @@ export default class QueryHelper {
|
|
|
271
271
|
@CaptureSpan()
|
|
272
272
|
public static greaterThanEqualTo<T extends number | Date>(
|
|
273
273
|
value: T,
|
|
274
|
-
): FindWhereProperty<
|
|
274
|
+
): FindWhereProperty<any> {
|
|
275
275
|
const rid: string = Text.generateRandomText(10);
|
|
276
276
|
return Raw(
|
|
277
277
|
(alias: string) => {
|
|
@@ -280,13 +280,13 @@ export default class QueryHelper {
|
|
|
280
280
|
{
|
|
281
281
|
[rid]: value,
|
|
282
282
|
},
|
|
283
|
-
) as FindWhereProperty<
|
|
283
|
+
) as FindWhereProperty<any>;
|
|
284
284
|
}
|
|
285
285
|
|
|
286
286
|
@CaptureSpan()
|
|
287
287
|
public static greaterThanEqualToOrNull<T extends number | Date>(
|
|
288
288
|
value: T,
|
|
289
|
-
): FindWhereProperty<
|
|
289
|
+
): FindWhereProperty<any> {
|
|
290
290
|
const rid: string = Text.generateRandomText(10);
|
|
291
291
|
return Raw(
|
|
292
292
|
(alias: string) => {
|
|
@@ -295,13 +295,13 @@ export default class QueryHelper {
|
|
|
295
295
|
{
|
|
296
296
|
[rid]: value,
|
|
297
297
|
},
|
|
298
|
-
) as FindWhereProperty<
|
|
298
|
+
) as FindWhereProperty<any>;
|
|
299
299
|
}
|
|
300
300
|
|
|
301
301
|
@CaptureSpan()
|
|
302
302
|
public static lessThanEqualTo<T extends number | Date>(
|
|
303
303
|
value: T,
|
|
304
|
-
): FindWhereProperty<
|
|
304
|
+
): FindWhereProperty<any> {
|
|
305
305
|
const rid: string = Text.generateRandomText(10);
|
|
306
306
|
return Raw(
|
|
307
307
|
(alias: string) => {
|
|
@@ -310,13 +310,13 @@ export default class QueryHelper {
|
|
|
310
310
|
{
|
|
311
311
|
[rid]: value,
|
|
312
312
|
},
|
|
313
|
-
) as FindWhereProperty<
|
|
313
|
+
) as FindWhereProperty<any>;
|
|
314
314
|
}
|
|
315
315
|
|
|
316
316
|
@CaptureSpan()
|
|
317
317
|
public static lessThanOrNull<T extends number | Date>(
|
|
318
318
|
value: T,
|
|
319
|
-
): FindWhereProperty<
|
|
319
|
+
): FindWhereProperty<any> {
|
|
320
320
|
const rid: string = Text.generateRandomText(10);
|
|
321
321
|
return Raw(
|
|
322
322
|
(alias: string) => {
|
|
@@ -325,13 +325,13 @@ export default class QueryHelper {
|
|
|
325
325
|
{
|
|
326
326
|
[rid]: value,
|
|
327
327
|
},
|
|
328
|
-
) as FindWhereProperty<
|
|
328
|
+
) as FindWhereProperty<any>;
|
|
329
329
|
}
|
|
330
330
|
|
|
331
331
|
@CaptureSpan()
|
|
332
332
|
public static lessThanEqualToOrNull<T extends number | Date>(
|
|
333
333
|
value: T,
|
|
334
|
-
): FindWhereProperty<
|
|
334
|
+
): FindWhereProperty<any> {
|
|
335
335
|
const rid: string = Text.generateRandomText(10);
|
|
336
336
|
return Raw(
|
|
337
337
|
(alias: string) => {
|
|
@@ -340,13 +340,13 @@ export default class QueryHelper {
|
|
|
340
340
|
{
|
|
341
341
|
[rid]: value,
|
|
342
342
|
},
|
|
343
|
-
) as FindWhereProperty<
|
|
343
|
+
) as FindWhereProperty<any>;
|
|
344
344
|
}
|
|
345
345
|
|
|
346
346
|
@CaptureSpan()
|
|
347
347
|
public static greaterThan<T extends number | Date>(
|
|
348
348
|
value: T,
|
|
349
|
-
): FindWhereProperty<
|
|
349
|
+
): FindWhereProperty<any> {
|
|
350
350
|
const rid: string = Text.generateRandomText(10);
|
|
351
351
|
return Raw(
|
|
352
352
|
(alias: string) => {
|
|
@@ -355,13 +355,13 @@ export default class QueryHelper {
|
|
|
355
355
|
{
|
|
356
356
|
[rid]: value,
|
|
357
357
|
},
|
|
358
|
-
) as FindWhereProperty<
|
|
358
|
+
) as FindWhereProperty<any>;
|
|
359
359
|
}
|
|
360
360
|
|
|
361
361
|
@CaptureSpan()
|
|
362
362
|
public static greaterThanOrNull<T extends number | Date>(
|
|
363
363
|
value: T,
|
|
364
|
-
): FindWhereProperty<
|
|
364
|
+
): FindWhereProperty<any> {
|
|
365
365
|
const rid: string = Text.generateRandomText(10);
|
|
366
366
|
return Raw(
|
|
367
367
|
(alias: string) => {
|
|
@@ -370,14 +370,14 @@ export default class QueryHelper {
|
|
|
370
370
|
{
|
|
371
371
|
[rid]: value,
|
|
372
372
|
},
|
|
373
|
-
) as FindWhereProperty<
|
|
373
|
+
) as FindWhereProperty<any>;
|
|
374
374
|
}
|
|
375
375
|
|
|
376
376
|
@CaptureSpan()
|
|
377
377
|
public static inBetween<T extends number | Date>(
|
|
378
378
|
startValue: T,
|
|
379
379
|
endValue: T,
|
|
380
|
-
): FindWhereProperty<
|
|
380
|
+
): FindWhereProperty<any> {
|
|
381
381
|
const rid1: string = Text.generateRandomText(10);
|
|
382
382
|
const rid2: string = Text.generateRandomText(10);
|
|
383
383
|
return Raw(
|
|
@@ -388,14 +388,14 @@ export default class QueryHelper {
|
|
|
388
388
|
[rid1]: startValue,
|
|
389
389
|
[rid2]: endValue,
|
|
390
390
|
},
|
|
391
|
-
) as FindWhereProperty<
|
|
391
|
+
) as FindWhereProperty<any>;
|
|
392
392
|
}
|
|
393
393
|
|
|
394
394
|
@CaptureSpan()
|
|
395
395
|
public static inBetweenOrNull<T extends number | Date>(
|
|
396
396
|
startValue: T,
|
|
397
397
|
endValue: T,
|
|
398
|
-
): FindWhereProperty<
|
|
398
|
+
): FindWhereProperty<any> {
|
|
399
399
|
const rid1: string = Text.generateRandomText(10);
|
|
400
400
|
const rid2: string = Text.generateRandomText(10);
|
|
401
401
|
return Raw(
|
|
@@ -406,14 +406,14 @@ export default class QueryHelper {
|
|
|
406
406
|
[rid1]: startValue,
|
|
407
407
|
[rid2]: endValue,
|
|
408
408
|
},
|
|
409
|
-
) as FindWhereProperty<
|
|
409
|
+
) as FindWhereProperty<any>;
|
|
410
410
|
}
|
|
411
411
|
|
|
412
412
|
@CaptureSpan()
|
|
413
413
|
public static notInBetween<T extends number | Date>(
|
|
414
414
|
startValue: T,
|
|
415
415
|
endValue: T,
|
|
416
|
-
): FindWhereProperty<
|
|
416
|
+
): FindWhereProperty<any> {
|
|
417
417
|
const rid1: string = Text.generateRandomText(10);
|
|
418
418
|
const rid2: string = Text.generateRandomText(10);
|
|
419
419
|
return Raw(
|
|
@@ -424,7 +424,7 @@ export default class QueryHelper {
|
|
|
424
424
|
[rid1]: startValue,
|
|
425
425
|
[rid2]: endValue,
|
|
426
426
|
},
|
|
427
|
-
) as FindWhereProperty<
|
|
427
|
+
) as FindWhereProperty<any>;
|
|
428
428
|
}
|
|
429
429
|
|
|
430
430
|
@CaptureSpan()
|
|
@@ -481,7 +481,7 @@ export default class QueryHelper {
|
|
|
481
481
|
@CaptureSpan()
|
|
482
482
|
public static lessThan<T extends number | Date>(
|
|
483
483
|
value: T,
|
|
484
|
-
): FindWhereProperty<
|
|
484
|
+
): FindWhereProperty<any> {
|
|
485
485
|
const rid: string = Text.generateRandomText(10);
|
|
486
486
|
return Raw(
|
|
487
487
|
(alias: string) => {
|
|
@@ -490,6 +490,6 @@ export default class QueryHelper {
|
|
|
490
490
|
{
|
|
491
491
|
[rid]: value,
|
|
492
492
|
},
|
|
493
|
-
) as FindWhereProperty<
|
|
493
|
+
) as FindWhereProperty<any>;
|
|
494
494
|
}
|
|
495
495
|
}
|
|
@@ -2,6 +2,7 @@ import ComponentCode, { RunOptions, RunReturnType } from "../../ComponentCode";
|
|
|
2
2
|
import BadDataException from "../../../../../Types/Exception/BadDataException";
|
|
3
3
|
import { JSONObject } from "../../../../../Types/JSON";
|
|
4
4
|
import JSONFunctions from "../../../../../Types/JSONFunctions";
|
|
5
|
+
import logger from "../../../../Utils/Logger";
|
|
5
6
|
import ComponentMetadata, {
|
|
6
7
|
Port,
|
|
7
8
|
} from "../../../../../Types/Workflow/Component";
|
|
@@ -74,6 +75,7 @@ export default class JsonToText extends ComponentCode {
|
|
|
74
75
|
executePort: successPort,
|
|
75
76
|
});
|
|
76
77
|
} catch (err) {
|
|
78
|
+
logger.error(err);
|
|
77
79
|
options.log("JSON is not in the correct format.");
|
|
78
80
|
return Promise.resolve({
|
|
79
81
|
returnValues: {},
|
|
@@ -2,6 +2,7 @@ import ComponentCode, { RunOptions, RunReturnType } from "../../ComponentCode";
|
|
|
2
2
|
import BadDataException from "../../../../../Types/Exception/BadDataException";
|
|
3
3
|
import { JSONObject } from "../../../../../Types/JSON";
|
|
4
4
|
import JSONFunctions from "../../../../../Types/JSONFunctions";
|
|
5
|
+
import logger from "../../../../Utils/Logger";
|
|
5
6
|
import ComponentMetadata, {
|
|
6
7
|
Port,
|
|
7
8
|
} from "../../../../../Types/Workflow/Component";
|
|
@@ -72,6 +73,7 @@ export default class TextToJSON extends ComponentCode {
|
|
|
72
73
|
executePort: successPort,
|
|
73
74
|
});
|
|
74
75
|
} catch (err) {
|
|
76
|
+
logger.error(err);
|
|
75
77
|
options.log("text is not in the correct format.");
|
|
76
78
|
return Promise.resolve({
|
|
77
79
|
returnValues: {},
|
package/Server/Utils/CronTab.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import BadDataException from "../../Types/Exception/BadDataException";
|
|
2
2
|
import CronParser, { CronExpression } from "cron-parser";
|
|
3
|
+
import logger from "./Logger";
|
|
3
4
|
import CaptureSpan from "./Telemetry/CaptureSpan";
|
|
4
5
|
|
|
5
6
|
export default class CronTab {
|
|
@@ -10,6 +11,7 @@ export default class CronTab {
|
|
|
10
11
|
const nextExecutionTime: Date = interval.next().toDate();
|
|
11
12
|
return nextExecutionTime;
|
|
12
13
|
} catch (error) {
|
|
14
|
+
logger.error(error);
|
|
13
15
|
throw new BadDataException(`Invalid cron expression: ${crontab}`);
|
|
14
16
|
}
|
|
15
17
|
}
|
|
@@ -10,6 +10,7 @@ import Timezone from "../../Types/Timezone";
|
|
|
10
10
|
import StatusPagePrivateUser from "../../Models/DatabaseModels/StatusPagePrivateUser";
|
|
11
11
|
import User from "../../Models/DatabaseModels/User";
|
|
12
12
|
import jwt from "jsonwebtoken";
|
|
13
|
+
import logger from "./Logger";
|
|
13
14
|
import CaptureSpan from "./Telemetry/CaptureSpan";
|
|
14
15
|
|
|
15
16
|
class JSONWebToken {
|
|
@@ -119,6 +120,7 @@ class JSONWebToken {
|
|
|
119
120
|
isGlobalLogin: Boolean(decoded["isGlobalLogin"]),
|
|
120
121
|
};
|
|
121
122
|
} catch (e) {
|
|
123
|
+
logger.error(e);
|
|
122
124
|
throw new BadDataException("AccessToken is invalid or expired");
|
|
123
125
|
}
|
|
124
126
|
}
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
CriteriaFilter,
|
|
5
5
|
} from "../../../../Types/Monitor/CriteriaFilter";
|
|
6
6
|
import CustomCodeMonitorResponse from "../../../../Types/Monitor/CustomCodeMonitor/CustomCodeMonitorResponse";
|
|
7
|
+
import logger from "../../Logger";
|
|
7
8
|
import CaptureSpan from "../../Telemetry/CaptureSpan";
|
|
8
9
|
|
|
9
10
|
export default class CustomCodeMonitoringCriteria {
|
|
@@ -78,6 +79,7 @@ export default class CustomCodeMonitoringCriteria {
|
|
|
78
79
|
thresholdAsNumber = parseFloat(threshold.toString());
|
|
79
80
|
}
|
|
80
81
|
} catch (err) {
|
|
82
|
+
logger.error(err);
|
|
81
83
|
thresholdAsNumber = null;
|
|
82
84
|
}
|
|
83
85
|
|
package/Server/Utils/VM/VMAPI.ts
CHANGED
|
@@ -8,6 +8,7 @@ import URL from "../../../Types/API/URL";
|
|
|
8
8
|
import ReturnResult from "../../../Types/IsolatedVM/ReturnResult";
|
|
9
9
|
import { JSONObject, JSONValue } from "../../../Types/JSON";
|
|
10
10
|
import API from "../../../Utils/API";
|
|
11
|
+
import logger from "../Logger";
|
|
11
12
|
import CaptureSpan from "../Telemetry/CaptureSpan";
|
|
12
13
|
|
|
13
14
|
export default class VMUtil {
|
|
@@ -57,6 +58,7 @@ export default class VMUtil {
|
|
|
57
58
|
valueToReplaceInPlace = JSON.stringify(valueToReplaceInPlace);
|
|
58
59
|
didStringify = true;
|
|
59
60
|
} catch (err) {
|
|
61
|
+
logger.error(err);
|
|
60
62
|
return valueToReplaceInPlace;
|
|
61
63
|
}
|
|
62
64
|
}
|
|
@@ -104,6 +106,7 @@ export default class VMUtil {
|
|
|
104
106
|
try {
|
|
105
107
|
valueToReplaceInPlace = JSON.parse(valueToReplaceInPlace);
|
|
106
108
|
} catch (err) {
|
|
109
|
+
logger.error(err);
|
|
107
110
|
return valueToReplaceInPlace;
|
|
108
111
|
}
|
|
109
112
|
}
|
|
@@ -16,7 +16,7 @@ export default class VMRunner {
|
|
|
16
16
|
options: {
|
|
17
17
|
timeout?: number;
|
|
18
18
|
args?: JSONObject | undefined;
|
|
19
|
-
context?: Dictionary<GenericObject> | undefined;
|
|
19
|
+
context?: Dictionary<GenericObject | string> | undefined;
|
|
20
20
|
};
|
|
21
21
|
}): Promise<ReturnResult> {
|
|
22
22
|
const { code, options } = data;
|
|
@@ -25,7 +25,6 @@ import { UserPermission } from "../../../Types/Permission";
|
|
|
25
25
|
import PositiveNumber from "../../../Types/PositiveNumber";
|
|
26
26
|
import UserType from "../../../Types/UserType";
|
|
27
27
|
import getJestMockFunction, { MockFunction } from "../../MockType";
|
|
28
|
-
import ConfigLogLevel from "../../../Server/Types/ConfigLogLevel";
|
|
29
28
|
|
|
30
29
|
jest.mock("../../../Server/Utils/Express", () => {
|
|
31
30
|
return {
|
|
@@ -105,8 +104,7 @@ jest.mock("../../../Server/Services/ProjectService", () => {
|
|
|
105
104
|
jest.mock("../../../Server/EnvironmentConfig", () => {
|
|
106
105
|
return {
|
|
107
106
|
IsBillingEnabled: true,
|
|
108
|
-
LogLevel:
|
|
109
|
-
ConfigLogLevel: ConfigLogLevel,
|
|
107
|
+
LogLevel: "INFO", // Use string literal instead of ConfigLogLevel.INFO
|
|
110
108
|
DisableTelemetry: true,
|
|
111
109
|
};
|
|
112
110
|
});
|
|
@@ -144,6 +144,7 @@ describe("ProjectMiddleware", () => {
|
|
|
144
144
|
|
|
145
145
|
const mockedApiModel: ApiKey = {
|
|
146
146
|
id: mockedObjectId,
|
|
147
|
+
projectId: mockedObjectId,
|
|
147
148
|
} as ApiKey;
|
|
148
149
|
|
|
149
150
|
beforeEach(
|
|
@@ -167,6 +168,9 @@ describe("ProjectMiddleware", () => {
|
|
|
167
168
|
});
|
|
168
169
|
|
|
169
170
|
test("should throw BadDataException when getProjectId returns null", async () => {
|
|
171
|
+
// Mock ApiKeyService.findOneBy to return null first
|
|
172
|
+
getJestSpyOn(ApiKeyService, "findOneBy").mockResolvedValue(null);
|
|
173
|
+
|
|
170
174
|
const spyFindOneBy: jest.SpyInstance = getJestSpyOn(
|
|
171
175
|
GlobalConfigService,
|
|
172
176
|
"findOneBy",
|
|
@@ -232,12 +236,12 @@ describe("ProjectMiddleware", () => {
|
|
|
232
236
|
|
|
233
237
|
expect(spyFindOneBy).toHaveBeenCalledWith({
|
|
234
238
|
query: {
|
|
235
|
-
projectId: mockedObjectId,
|
|
236
239
|
apiKey: mockedObjectId,
|
|
237
240
|
expiresAt: QueryHelper.greaterThan(OneUptimeDate.getCurrentDate()),
|
|
238
241
|
},
|
|
239
242
|
select: {
|
|
240
243
|
_id: true,
|
|
244
|
+
projectId: true,
|
|
241
245
|
},
|
|
242
246
|
props: { isRoot: true },
|
|
243
247
|
});
|
|
@@ -82,13 +82,13 @@ describe("AnalyticsDatabaseService", () => {
|
|
|
82
82
|
|
|
83
83
|
test("should return count statement", () => {
|
|
84
84
|
const statement: Statement = service.toCountStatement({
|
|
85
|
-
query: "
|
|
86
|
-
props: "
|
|
85
|
+
query: { field: "value" } as GenericObject,
|
|
86
|
+
props: { prop: "test" } as GenericObject,
|
|
87
87
|
});
|
|
88
88
|
|
|
89
|
-
expect(service.statementGenerator.toWhereStatement).toBeCalledWith(
|
|
90
|
-
"
|
|
91
|
-
);
|
|
89
|
+
expect(service.statementGenerator.toWhereStatement).toBeCalledWith({
|
|
90
|
+
field: "value",
|
|
91
|
+
});
|
|
92
92
|
|
|
93
93
|
expect(logger.debug).toHaveBeenCalledTimes(2);
|
|
94
94
|
expect(logger.debug).toHaveBeenNthCalledWith(
|
|
@@ -111,8 +111,8 @@ describe("AnalyticsDatabaseService", () => {
|
|
|
111
111
|
|
|
112
112
|
test("optionally adds LIMIT", () => {
|
|
113
113
|
const statement: Statement = service.toCountStatement({
|
|
114
|
-
query: "
|
|
115
|
-
props: "
|
|
114
|
+
query: { field: "value" } as GenericObject,
|
|
115
|
+
props: { prop: "test" } as GenericObject,
|
|
116
116
|
limit: 123,
|
|
117
117
|
});
|
|
118
118
|
|
|
@@ -132,8 +132,8 @@ describe("AnalyticsDatabaseService", () => {
|
|
|
132
132
|
|
|
133
133
|
test("optionally adds OFFSET", () => {
|
|
134
134
|
const statement: Statement = service.toCountStatement({
|
|
135
|
-
query: "
|
|
136
|
-
props: "
|
|
135
|
+
query: { field: "value" } as GenericObject,
|
|
136
|
+
props: { prop: "test" } as GenericObject,
|
|
137
137
|
skip: 123,
|
|
138
138
|
});
|
|
139
139
|
|
|
@@ -177,23 +177,23 @@ describe("AnalyticsDatabaseService", () => {
|
|
|
177
177
|
|
|
178
178
|
test("should return find statement", () => {
|
|
179
179
|
const { statement, columns } = service.toFindStatement({
|
|
180
|
-
select: "
|
|
181
|
-
query: "
|
|
182
|
-
props: "
|
|
183
|
-
sort: "
|
|
180
|
+
select: { columns: ["col1", "col2"] } as GenericObject,
|
|
181
|
+
query: { field: "value" } as GenericObject,
|
|
182
|
+
props: { prop: "test" } as GenericObject,
|
|
183
|
+
sort: { field: "asc" } as GenericObject,
|
|
184
184
|
limit: 123,
|
|
185
185
|
skip: 234,
|
|
186
186
|
});
|
|
187
187
|
|
|
188
|
-
expect(service.statementGenerator.toSelectStatement).toBeCalledWith(
|
|
189
|
-
"
|
|
190
|
-
);
|
|
191
|
-
expect(service.statementGenerator.toWhereStatement).toBeCalledWith(
|
|
192
|
-
"
|
|
193
|
-
);
|
|
194
|
-
expect(service.statementGenerator.toSortStatement).toBeCalledWith(
|
|
195
|
-
"
|
|
196
|
-
);
|
|
188
|
+
expect(service.statementGenerator.toSelectStatement).toBeCalledWith({
|
|
189
|
+
columns: ["col1", "col2"],
|
|
190
|
+
});
|
|
191
|
+
expect(service.statementGenerator.toWhereStatement).toBeCalledWith({
|
|
192
|
+
field: "value",
|
|
193
|
+
});
|
|
194
|
+
expect(service.statementGenerator.toSortStatement).toBeCalledWith({
|
|
195
|
+
field: "asc",
|
|
196
|
+
});
|
|
197
197
|
|
|
198
198
|
expect(jest.mocked(logger.debug)).toHaveBeenCalledTimes(2);
|
|
199
199
|
expect(jest.mocked(logger.debug)).toHaveBeenNthCalledWith(
|
|
@@ -213,46 +213,46 @@ describe("AnalyticsDatabaseService", () => {
|
|
|
213
213
|
});
|
|
214
214
|
expect(columns).toStrictEqual(["<column-1>", "<column-2>"]);
|
|
215
215
|
});
|
|
216
|
+
});
|
|
216
217
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
});
|
|
222
|
-
jest.spyOn(logger, "debug").mockImplementation(() => {
|
|
223
|
-
return undefined!;
|
|
224
|
-
});
|
|
218
|
+
describe("toDeleteStatement", () => {
|
|
219
|
+
beforeEach(() => {
|
|
220
|
+
service.statementGenerator.toWhereStatement = jest.fn(() => {
|
|
221
|
+
return SQL`<where-statement>`;
|
|
225
222
|
});
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
jest.restoreAllMocks();
|
|
223
|
+
jest.spyOn(logger, "debug").mockImplementation(() => {
|
|
224
|
+
return undefined!;
|
|
229
225
|
});
|
|
226
|
+
});
|
|
230
227
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
228
|
+
afterEach(() => {
|
|
229
|
+
jest.restoreAllMocks();
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
test("should return delete statement", () => {
|
|
233
|
+
const statement: Statement = service.toDeleteStatement({
|
|
234
|
+
query: { field: "value" } as GenericObject,
|
|
235
|
+
props: { prop: "test" } as GenericObject,
|
|
236
|
+
});
|
|
236
237
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
238
|
+
expect(service.statementGenerator.toWhereStatement).toBeCalledWith({
|
|
239
|
+
field: "value",
|
|
240
|
+
});
|
|
240
241
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
242
|
+
expect(logger.debug).toHaveBeenCalledTimes(2);
|
|
243
|
+
expect(logger.debug).toHaveBeenNthCalledWith(
|
|
244
|
+
1,
|
|
245
|
+
"<table-name> Delete Statement",
|
|
246
|
+
);
|
|
247
|
+
expect(logger.debug).toHaveBeenNthCalledWith(2, statement);
|
|
247
248
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
});
|
|
249
|
+
expect(statement.query).toBe(
|
|
250
|
+
"ALTER TABLE {p0:Identifier}.{p1:Identifier}\n" +
|
|
251
|
+
"DELETE WHERE TRUE <where-statement>",
|
|
252
|
+
);
|
|
253
|
+
expect(statement.query_params).toStrictEqual({
|
|
254
|
+
p0: "oneuptime",
|
|
255
|
+
p1: "<table-name>",
|
|
256
256
|
});
|
|
257
257
|
});
|
|
258
258
|
});
|