@hawk.so/types 0.1.38 → 0.3.0

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 (73) hide show
  1. package/.github/workflows/bump-version.yml +4 -4
  2. package/.github/workflows/lint-and-build.yml +4 -4
  3. package/.github/workflows/npm-publish.yml +4 -4
  4. package/.nvmrc +1 -0
  5. package/build/index.js +5 -1
  6. package/build/src/base/businessOperation/businessOperation.d.ts +4 -4
  7. package/build/src/base/businessOperation/businessOperation.js +4 -4
  8. package/build/src/base/event/addons/default.d.ts +1 -1
  9. package/build/src/base/event/addons/index.d.ts +9 -9
  10. package/build/src/base/event/addons/javascript.d.ts +2 -2
  11. package/build/src/base/event/addons/php.d.ts +1 -1
  12. package/build/src/base/event/addons/sentry.js +1 -0
  13. package/build/src/base/event/backtraceFrame.d.ts +1 -1
  14. package/build/src/base/event/breadcrumb.d.ts +3 -6
  15. package/build/src/base/event/event.d.ts +5 -10
  16. package/build/src/base/integrations/integrationToken.d.ts +1 -1
  17. package/build/src/catchers/catcher-message.d.ts +30 -9
  18. package/build/src/dbScheme/businessOperation.d.ts +2 -2
  19. package/build/src/dbScheme/groupedEvent.d.ts +12 -6
  20. package/build/src/dbScheme/membership.d.ts +2 -2
  21. package/build/src/dbScheme/notificationsChannels.d.ts +1 -1
  22. package/build/src/dbScheme/plan.d.ts +1 -1
  23. package/build/src/dbScheme/project.d.ts +3 -4
  24. package/build/src/dbScheme/projectEventGroupingPattern.d.ts +5 -1
  25. package/build/src/dbScheme/projectNotificationsRule.d.ts +3 -3
  26. package/build/src/dbScheme/release.d.ts +2 -7
  27. package/build/src/dbScheme/repetition.d.ts +13 -4
  28. package/build/src/dbScheme/sourceMap.d.ts +3 -7
  29. package/build/src/dbScheme/user.d.ts +3 -3
  30. package/build/src/dbScheme/userNotifications.d.ts +1 -1
  31. package/build/src/dbScheme/workspace.d.ts +5 -1
  32. package/build/src/notifications/createProjectNotifications.d.ts +2 -2
  33. package/build/src/notifications/receiveTypes.js +1 -1
  34. package/build/src/notifications/updateProjectNotifications.d.ts +2 -2
  35. package/build/src/notifications/userNotification.js +1 -1
  36. package/build/src/utils/index.d.ts +2 -2
  37. package/eslint.config.mjs +34 -0
  38. package/package.json +11 -6
  39. package/src/auth/tokensPair.ts +9 -9
  40. package/src/base/businessOperation/businessOperation.ts +8 -8
  41. package/src/base/event/addons/default.ts +1 -1
  42. package/src/base/event/addons/index.ts +11 -12
  43. package/src/base/event/addons/javascript.ts +2 -2
  44. package/src/base/event/addons/php.ts +1 -1
  45. package/src/base/event/addons/sentry.ts +3 -1
  46. package/src/base/event/affectedUser.ts +16 -16
  47. package/src/base/event/backtraceFrame.ts +25 -25
  48. package/src/base/event/breadcrumb.ts +5 -9
  49. package/src/base/event/event.ts +53 -59
  50. package/src/base/event/sourceCodeLine.ts +8 -8
  51. package/src/base/performance/performance.ts +1 -1
  52. package/src/catchers/catcher-message.ts +29 -8
  53. package/src/dbScheme/businessOperation.ts +26 -26
  54. package/src/dbScheme/groupedEvent.ts +52 -46
  55. package/src/dbScheme/membership.ts +24 -27
  56. package/src/dbScheme/notificationsChannelSettings.ts +12 -12
  57. package/src/dbScheme/notificationsChannels.ts +25 -25
  58. package/src/dbScheme/plan.ts +30 -30
  59. package/src/dbScheme/project.ts +3 -4
  60. package/src/dbScheme/projectEventGroupingPattern.ts +8 -4
  61. package/src/dbScheme/projectNotificationsRule.ts +52 -52
  62. package/src/dbScheme/release.ts +3 -8
  63. package/src/dbScheme/repetition.ts +39 -30
  64. package/src/dbScheme/sourceMap.ts +4 -8
  65. package/src/dbScheme/user.ts +3 -3
  66. package/src/dbScheme/userNotifications.ts +9 -9
  67. package/src/dbScheme/workspace.ts +65 -60
  68. package/src/notifications/createProjectNotifications.ts +27 -27
  69. package/src/notifications/receiveTypes.ts +8 -8
  70. package/src/notifications/updateProjectNotifications.ts +26 -26
  71. package/src/notifications/userNotification.ts +12 -12
  72. package/src/utils/index.ts +1 -1
  73. package/.eslintrc +0 -12
@@ -1,37 +1,37 @@
1
- import { ObjectId } from "mongodb";
2
- import { BusinessOperationStatus, BusinessOperationType, BusinessOperationPayloadType } from "../base/businessOperation/businessOperation";
1
+ import type { ObjectId } from 'bson';
2
+ import type { BusinessOperationStatus, BusinessOperationType, BusinessOperationPayloadType } from '../base/businessOperation/businessOperation.ts';
3
3
 
4
4
  /**
5
5
  * Structure represents a Business operation in DataBase
6
6
  */
7
7
  export interface BusinessOperationDBScheme<T extends BusinessOperationPayloadType = BusinessOperationPayloadType> {
8
- /**
9
- * Business operation ID
10
- */
11
- _id?: ObjectId;
8
+ /**
9
+ * Business operation ID
10
+ */
11
+ _id?: ObjectId;
12
12
 
13
- /**
14
- * Business operation Transaction ID
15
- */
16
- transactionId: string;
13
+ /**
14
+ * Business operation Transaction ID
15
+ */
16
+ transactionId: string;
17
17
 
18
- /**
19
- * Business operation type
20
- */
21
- type: BusinessOperationType;
18
+ /**
19
+ * Business operation type
20
+ */
21
+ type: BusinessOperationType;
22
22
 
23
- /**
24
- * Business operation status
25
- */
26
- status: BusinessOperationStatus;
23
+ /**
24
+ * Business operation status
25
+ */
26
+ status: BusinessOperationStatus;
27
27
 
28
- /**
29
- * Business operation payload
30
- */
31
- payload: T;
28
+ /**
29
+ * Business operation payload
30
+ */
31
+ payload: T;
32
32
 
33
- /**
34
- * Date when operation was created
35
- */
36
- dtCreated: Date;
33
+ /**
34
+ * Date when operation was created
35
+ */
36
+ dtCreated: Date;
37
37
  }
@@ -1,7 +1,7 @@
1
- import { ObjectId } from "mongodb";
2
- import { DecodedEventData, EncodedEventData, EventData } from "../base/event/event";
3
- import { UserDBScheme } from "./user";
4
- import { EventAddons } from '../base/event/addons';
1
+ import type { ObjectId } from 'bson';
2
+ import type { DecodedEventData, EncodedEventData, EventData } from '../base/event/event.ts';
3
+ import type { UserDBScheme } from './user.ts';
4
+ import type { EventAddons } from '../base/event/addons/index.ts';
5
5
 
6
6
  /**
7
7
  * Event marks interface for tracking event status
@@ -17,64 +17,70 @@ export interface EventMarks {
17
17
  * Event data after grouper-worker transformation to store it in database
18
18
  */
19
19
  export interface GroupedEventDBScheme {
20
- /**
21
- * Internal mongo id
22
- */
23
- _id?: ObjectId;
20
+ /**
21
+ * Internal mongo id
22
+ */
23
+ _id?: ObjectId;
24
24
 
25
- /**
26
- * Hash for grouping similar events
27
- */
28
- groupHash: string;
25
+ /**
26
+ * Hash for grouping similar events
27
+ */
28
+ groupHash: string;
29
29
 
30
- /**
31
- * Number of events repetitions
32
- */
33
- totalCount: number;
30
+ /**
31
+ * Number of events repetitions
32
+ */
33
+ totalCount: number;
34
34
 
35
- /**
36
- * Error language type
37
- */
38
- catcherType: string;
35
+ /**
36
+ * Error language type
37
+ */
38
+ catcherType: string;
39
39
 
40
- /**
41
- * Event data
42
- */
43
- payload: EventData<EventAddons>;
40
+ /**
41
+ * Event data
42
+ */
43
+ payload: EventData<EventAddons>;
44
44
 
45
- /**
46
- * How many users catch this error
47
- */
48
- usersAffected: number;
45
+ /**
46
+ * How many users catch this error
47
+ */
48
+ usersAffected: number;
49
49
 
50
- /**
51
- * Array of users who visited this event
52
- */
53
- visitedBy: UserDBScheme[];
50
+ /**
51
+ * Array of users who visited this event
52
+ */
53
+ visitedBy: UserDBScheme[];
54
54
 
55
- /**
56
- * Occurrence time
57
- * Unix timestamp in seconds (example: 1567009247.576)
58
- * (created by the Collector)
59
- */
60
- timestamp: number;
55
+ /**
56
+ * Occurrence time
57
+ * Unix timestamp in seconds (example: 1567009247.576)
58
+ * (created by the Collector)
59
+ */
60
+ timestamp: number;
61
61
 
62
- /**
63
- * Event marks for tracking status
64
- */
65
- marks?: EventMarks;
62
+ /**
63
+ * Event marks for tracking status
64
+ */
65
+ marks?: EventMarks;
66
66
  }
67
67
 
68
68
  /**
69
- * Grouped event with decoded event data
69
+ * Event where 'context' and 'addons' are decoded from json strings to objects
70
70
  */
71
71
  export interface DecodedGroupedEvent extends GroupedEventDBScheme {
72
- payload: DecodedEventData<EventAddons>;
72
+ /**
73
+ * Event data where 'context' and 'addons' are objects
74
+ */
75
+ payload: DecodedEventData<EventAddons>;
73
76
  }
74
77
 
75
78
  /**
76
- * Grouped event with encoded event data
79
+ * In database we store 'context' and 'addons' as json strings to avoind mongo keys conflict
77
80
  */
78
81
  export interface EncodedGroupedEvent extends GroupedEventDBScheme {
79
- payload: EncodedEventData;
82
+ /**
83
+ * Event data where 'context' and 'addons' are json strings
84
+ */
85
+ payload: EncodedEventData;
80
86
  }
@@ -1,44 +1,41 @@
1
- import { ObjectId } from "mongodb";
1
+ import type { ObjectId } from 'bson';
2
2
 
3
3
  /**
4
4
  * Represents confirmed member info in DB
5
5
  */
6
6
  export interface ConfirmedMemberDBScheme {
7
- /**
8
- * Document id
9
- */
10
- _id: ObjectId;
11
-
12
- /**
13
- * Id of the member of workspace
14
- */
15
- userId: ObjectId;
16
-
17
- /**
18
- * Is user admin in workspace
19
- */
20
- isAdmin?: boolean;
7
+ /**
8
+ * Document id
9
+ */
10
+ _id: ObjectId;
11
+
12
+ /**
13
+ * Id of the member of workspace
14
+ */
15
+ userId: ObjectId;
16
+
17
+ /**
18
+ * Is user admin in workspace
19
+ */
20
+ isAdmin?: boolean;
21
21
  }
22
22
 
23
-
24
23
  /**
25
24
  * Represents pending member info in DB
26
25
  */
27
26
  export interface PendingMemberDBScheme {
28
- /**
29
- * Document id
30
- */
31
- _id: ObjectId;
32
-
33
- /**
34
- * User email for invitation
35
- */
36
- userEmail: string;
27
+ /**
28
+ * Document id
29
+ */
30
+ _id: ObjectId;
31
+
32
+ /**
33
+ * User email for invitation
34
+ */
35
+ userEmail: string;
37
36
  }
38
37
 
39
-
40
38
  /**
41
39
  * Represents full structure of team collection documents
42
40
  */
43
41
  export type MemberDBScheme = ConfirmedMemberDBScheme | PendingMemberDBScheme;
44
-
@@ -2,18 +2,18 @@
2
2
  * Setting of a channel
3
3
  */
4
4
  export interface NotificationsChannelSettingsDBScheme {
5
- /**
6
- * Allows to disable channel without removing endpoint
7
- */
8
- isEnabled: boolean;
5
+ /**
6
+ * Allows to disable channel without removing endpoint
7
+ */
8
+ isEnabled: boolean;
9
9
 
10
- /**
11
- * Endpoint: email, slack webhook, telegram bot webhook, push subscription id, etc
12
- */
13
- endpoint: string;
10
+ /**
11
+ * Endpoint: email, slack webhook, telegram bot webhook, push subscription id, etc
12
+ */
13
+ endpoint: string;
14
14
 
15
- /**
16
- * Minimal pause between second notification, in seconds
17
- */
18
- minPeriod: number;
15
+ /**
16
+ * Minimal pause between second notification, in seconds
17
+ */
18
+ minPeriod: number;
19
19
  }
@@ -1,36 +1,36 @@
1
- import { NotificationsChannelSettingsDBScheme } from "../../index";
1
+ import type { NotificationsChannelSettingsDBScheme } from '../../index.ts';
2
2
 
3
3
  /**
4
4
  * Available channels
5
5
  */
6
6
  export interface NotificationsChannelsDBScheme {
7
- /**
8
- * Alerts on email
9
- */
10
- email?: NotificationsChannelSettingsDBScheme;
7
+ /**
8
+ * Alerts on email
9
+ */
10
+ email?: NotificationsChannelSettingsDBScheme;
11
11
 
12
- /**
13
- * Alerts through the Slack
14
- */
15
- slack?: NotificationsChannelSettingsDBScheme;
12
+ /**
13
+ * Alerts through the Slack
14
+ */
15
+ slack?: NotificationsChannelSettingsDBScheme;
16
16
 
17
- /**
18
- * Alerts through the Telegram
19
- */
20
- telegram?: NotificationsChannelSettingsDBScheme;
17
+ /**
18
+ * Alerts through the Telegram
19
+ */
20
+ telegram?: NotificationsChannelSettingsDBScheme;
21
21
 
22
- /**
23
- * Browser pushes
24
- */
25
- webPush?: NotificationsChannelSettingsDBScheme;
22
+ /**
23
+ * Browser pushes
24
+ */
25
+ webPush?: NotificationsChannelSettingsDBScheme;
26
26
 
27
- /**
28
- * Pushes through the Hawk Desktop app
29
- */
30
- desktopPush?: NotificationsChannelSettingsDBScheme;
27
+ /**
28
+ * Pushes through the Hawk Desktop app
29
+ */
30
+ desktopPush?: NotificationsChannelSettingsDBScheme;
31
31
 
32
- /**
33
- * Alerts through the Loop
34
- */
35
- loop?: NotificationsChannelSettingsDBScheme;
32
+ /**
33
+ * Alerts through the Loop
34
+ */
35
+ loop?: NotificationsChannelSettingsDBScheme;
36
36
  }
@@ -1,42 +1,42 @@
1
- import { ObjectId } from "mongodb";
1
+ import type { ObjectId } from 'bson';
2
2
 
3
3
  /**
4
4
  * Plan representation in DataBase
5
5
  */
6
6
  export interface PlanDBScheme {
7
- /**
8
- * Plan's id
9
- */
10
- _id: ObjectId;
7
+ /**
8
+ * Plan's id
9
+ */
10
+ _id: ObjectId;
11
11
 
12
- /**
13
- * Plan's name
14
- */
15
- name: string;
12
+ /**
13
+ * Plan's name
14
+ */
15
+ name: string;
16
16
 
17
- /**
18
- * Monthly charge for plan in currencry specified in `monthlyChargeCurrency`
19
- */
20
- monthlyCharge: number;
17
+ /**
18
+ * Monthly charge for plan in currencry specified in `monthlyChargeCurrency`
19
+ */
20
+ monthlyCharge: number;
21
21
 
22
- /**
23
- * Currency of `monthlyCharge`
24
- */
25
- monthlyChargeCurrency: string;
22
+ /**
23
+ * Currency of `monthlyCharge`
24
+ */
25
+ monthlyChargeCurrency: string;
26
26
 
27
- /**
28
- * Maximum amount of events available for plan
29
- */
30
- eventsLimit: number;
27
+ /**
28
+ * Maximum amount of events available for plan
29
+ */
30
+ eventsLimit: number;
31
31
 
32
- /**
33
- * Is this plan used by default?
34
- */
35
- isDefault: boolean;
32
+ /**
33
+ * Is this plan used by default?
34
+ */
35
+ isDefault: boolean;
36
36
 
37
- /**
38
- * Special plans to be selected manually
39
- * No one cannot be switched to this plan by api
40
- */
41
- isHidden?: boolean;
37
+ /**
38
+ * Special plans to be selected manually
39
+ * No one cannot be switched to this plan by api
40
+ */
41
+ isHidden?: boolean;
42
42
  }
@@ -1,6 +1,6 @@
1
- import { ObjectId } from 'mongodb';
2
- import { ProjectNotificationsRuleDBScheme } from '../../index';
3
- import { ProjectEventGroupingPatternsDBScheme } from '../../index';
1
+ import type { ObjectId } from 'bson';
2
+ import type { ProjectNotificationsRuleDBScheme } from '../../index.ts';
3
+ import type { ProjectEventGroupingPatternsDBScheme } from '../../index.ts';
4
4
 
5
5
  /**
6
6
  * Structure represents a Project in DataBase
@@ -13,7 +13,6 @@ export interface ProjectDBScheme {
13
13
 
14
14
  /**
15
15
  * Unique integration id, that's used as collector domain url for sending events
16
- *
17
16
  * @example `wss://${integrationId}.k1.hawk.so/ws`
18
17
  */
19
18
  integrationId: string;
@@ -1,13 +1,17 @@
1
- import { ObjectId } from "mongodb";
1
+ import type { ObjectId } from 'bson';
2
2
 
3
+ /**
4
+ * Project admin can specify regular expression patterns to group events into categories.
5
+ * We store them in the database to be able to use them in the UI.
6
+ */
3
7
  export interface ProjectEventGroupingPatternsDBScheme {
4
8
  /**
5
9
  * If of the pattern
6
10
  */
7
- _id: ObjectId,
11
+ _id: ObjectId;
8
12
 
9
13
  /**
10
14
  * String that represents regular expression pattern
11
15
  */
12
- pattern: string,
13
- }
16
+ pattern: string;
17
+ }
@@ -1,58 +1,58 @@
1
- import { ObjectId } from "mongodb";
2
- import { ReceiveTypes } from "../../index";
3
- import { NotificationsChannelsDBScheme } from "./notificationsChannels";
1
+ import type { ObjectId } from 'bson';
2
+ import type { ReceiveTypes } from '../../index.ts';
3
+ import type { NotificationsChannelsDBScheme } from './notificationsChannels.ts';
4
4
 
5
5
  /**
6
6
  * This structure represents a single rule of notifications settings
7
7
  */
8
8
  export interface ProjectNotificationsRuleDBScheme {
9
- /**
10
- * Id of Rule
11
- */
12
- _id: ObjectId;
13
-
14
- /**
15
- * Allows to disable rule without removing
16
- */
17
- isEnabled: boolean;
18
-
19
- /**
20
- * Creator of the rule
21
- */
22
- uidAdded: ObjectId;
23
-
24
- /**
25
- * Receive type: 'SEEN_MORE' or 'ONLY_NEW'
26
- */
27
- whatToReceive: ReceiveTypes;
28
-
29
- /**
30
- * Only those which contains passed words
31
- */
32
- including: string[];
33
-
34
- /**
35
- * Skip those which contains passed words
36
- */
37
- excluding: string[];
38
-
39
- /**
40
- * Available channels to receive
41
- */
42
- channels: NotificationsChannelsDBScheme;
43
-
44
- /**
45
- * If this number of events is reached in the eventThresholdPeriod, the rule will be triggered
46
- */
47
- threshold?: number;
48
-
49
- /**
50
- * Size of period (in milliseconds) to count events to compare to rule threshold
51
- */
52
- thresholdPeriod?: number;
53
-
54
- /**
55
- * If rule is created automatically (on project creation or conversion of old projects)
56
- */
57
- autoAdded?: string;
9
+ /**
10
+ * Id of Rule
11
+ */
12
+ _id: ObjectId;
13
+
14
+ /**
15
+ * Allows to disable rule without removing
16
+ */
17
+ isEnabled: boolean;
18
+
19
+ /**
20
+ * Creator of the rule
21
+ */
22
+ uidAdded: ObjectId;
23
+
24
+ /**
25
+ * Receive type: 'SEEN_MORE' or 'ONLY_NEW'
26
+ */
27
+ whatToReceive: ReceiveTypes;
28
+
29
+ /**
30
+ * Only those which contains passed words
31
+ */
32
+ including: string[];
33
+
34
+ /**
35
+ * Skip those which contains passed words
36
+ */
37
+ excluding: string[];
38
+
39
+ /**
40
+ * Available channels to receive
41
+ */
42
+ channels: NotificationsChannelsDBScheme;
43
+
44
+ /**
45
+ * If this number of events is reached in the eventThresholdPeriod, the rule will be triggered
46
+ */
47
+ threshold?: number;
48
+
49
+ /**
50
+ * Size of period (in milliseconds) to count events to compare to rule threshold
51
+ */
52
+ thresholdPeriod?: number;
53
+
54
+ /**
55
+ * If rule is created automatically (on project creation or conversion of old projects)
56
+ */
57
+ autoAdded?: string;
58
58
  }
@@ -1,5 +1,5 @@
1
- import { ObjectId } from "mongodb";
2
- import { SourceMapDataExtended } from './sourceMap';
1
+ import type { ObjectId } from 'bson';
2
+ import type { SourceMapDataExtended } from './sourceMap.ts';
3
3
 
4
4
  /**
5
5
  * Git commit data stored in the release
@@ -7,28 +7,24 @@ import { SourceMapDataExtended } from './sourceMap';
7
7
  export interface CommitData {
8
8
  /**
9
9
  * Commit hash
10
- *
11
10
  * @example 599575d00e62924d08b031defe0a6b10133a75fc
12
11
  */
13
12
  hash: string;
14
13
 
15
14
  /**
16
15
  * Title of the commit
17
- *
18
16
  * @example Hot fix
19
17
  */
20
18
  title: string;
21
19
 
22
20
  /**
23
21
  * Commit author
24
- *
25
22
  * @example codex-team@codex.so
26
23
  */
27
24
  author: string;
28
25
 
29
26
  /**
30
27
  * Commit date
31
- *
32
28
  * @example 2021-04-23T10:54:01.000+00:00
33
29
  */
34
30
  date: Date;
@@ -44,13 +40,12 @@ export interface ReleaseDBScheme {
44
40
  _id: ObjectId;
45
41
 
46
42
  /**
47
- * ProjectId associated with the release
43
+ * ProjectId associated with the release
48
44
  */
49
45
  projectId: string;
50
46
 
51
47
  /**
52
48
  * Release name
53
- *
54
49
  * @example Version 1.0
55
50
  */
56
51
  release: string;