@hawk.so/types 0.2.0 → 0.4.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 (78) 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.d.ts +1 -0
  6. package/build/index.js +6 -1
  7. package/build/src/base/businessOperation/businessOperation.d.ts +4 -4
  8. package/build/src/base/businessOperation/businessOperation.js +4 -4
  9. package/build/src/base/event/addons/default.d.ts +1 -1
  10. package/build/src/base/event/addons/index.d.ts +9 -9
  11. package/build/src/base/event/addons/javascript.d.ts +2 -2
  12. package/build/src/base/event/addons/php.d.ts +1 -1
  13. package/build/src/base/event/addons/sentry.js +1 -0
  14. package/build/src/base/event/backtraceFrame.d.ts +1 -1
  15. package/build/src/base/event/breadcrumb.d.ts +3 -6
  16. package/build/src/base/event/event.d.ts +5 -10
  17. package/build/src/base/integrations/integrationToken.d.ts +1 -1
  18. package/build/src/catchers/catcher-message.d.ts +30 -9
  19. package/build/src/dbScheme/businessOperation.d.ts +2 -2
  20. package/build/src/dbScheme/groupedEvent.d.ts +12 -6
  21. package/build/src/dbScheme/membership.d.ts +2 -2
  22. package/build/src/dbScheme/notificationsChannels.d.ts +1 -1
  23. package/build/src/dbScheme/plan.d.ts +1 -1
  24. package/build/src/dbScheme/project.d.ts +3 -4
  25. package/build/src/dbScheme/projectEventGroupingPattern.d.ts +5 -1
  26. package/build/src/dbScheme/projectNotificationsRule.d.ts +3 -3
  27. package/build/src/dbScheme/release.d.ts +2 -7
  28. package/build/src/dbScheme/repetition.d.ts +13 -4
  29. package/build/src/dbScheme/sourceMap.d.ts +3 -7
  30. package/build/src/dbScheme/sso.d.ts +77 -0
  31. package/build/src/dbScheme/sso.js +5 -0
  32. package/build/src/dbScheme/user.d.ts +23 -3
  33. package/build/src/dbScheme/userNotifications.d.ts +1 -1
  34. package/build/src/dbScheme/workspace.d.ts +6 -1
  35. package/build/src/notifications/createProjectNotifications.d.ts +2 -2
  36. package/build/src/notifications/receiveTypes.js +1 -1
  37. package/build/src/notifications/updateProjectNotifications.d.ts +2 -2
  38. package/build/src/notifications/userNotification.js +1 -1
  39. package/build/src/utils/index.d.ts +2 -2
  40. package/eslint.config.mjs +34 -0
  41. package/index.ts +1 -0
  42. package/package.json +11 -6
  43. package/src/auth/tokensPair.ts +9 -9
  44. package/src/base/businessOperation/businessOperation.ts +8 -8
  45. package/src/base/event/addons/default.ts +1 -1
  46. package/src/base/event/addons/index.ts +11 -12
  47. package/src/base/event/addons/javascript.ts +2 -2
  48. package/src/base/event/addons/php.ts +1 -1
  49. package/src/base/event/addons/sentry.ts +3 -1
  50. package/src/base/event/affectedUser.ts +16 -16
  51. package/src/base/event/backtraceFrame.ts +25 -25
  52. package/src/base/event/breadcrumb.ts +5 -9
  53. package/src/base/event/event.ts +53 -59
  54. package/src/base/event/sourceCodeLine.ts +8 -8
  55. package/src/base/performance/performance.ts +1 -1
  56. package/src/catchers/catcher-message.ts +29 -8
  57. package/src/dbScheme/businessOperation.ts +26 -26
  58. package/src/dbScheme/groupedEvent.ts +52 -46
  59. package/src/dbScheme/membership.ts +24 -27
  60. package/src/dbScheme/notificationsChannelSettings.ts +12 -12
  61. package/src/dbScheme/notificationsChannels.ts +25 -25
  62. package/src/dbScheme/plan.ts +30 -30
  63. package/src/dbScheme/project.ts +3 -4
  64. package/src/dbScheme/projectEventGroupingPattern.ts +8 -4
  65. package/src/dbScheme/projectNotificationsRule.ts +52 -52
  66. package/src/dbScheme/release.ts +3 -8
  67. package/src/dbScheme/repetition.ts +39 -30
  68. package/src/dbScheme/sourceMap.ts +4 -8
  69. package/src/dbScheme/sso.ts +88 -0
  70. package/src/dbScheme/user.ts +25 -3
  71. package/src/dbScheme/userNotifications.ts +9 -9
  72. package/src/dbScheme/workspace.ts +84 -78
  73. package/src/notifications/createProjectNotifications.ts +27 -27
  74. package/src/notifications/receiveTypes.ts +8 -8
  75. package/src/notifications/updateProjectNotifications.ts +26 -26
  76. package/src/notifications/userNotification.ts +12 -12
  77. package/src/utils/index.ts +1 -1
  78. package/.eslintrc +0 -12
@@ -1,89 +1,83 @@
1
- import { BacktraceFrame } from './backtraceFrame';
2
- import { AffectedUser } from './affectedUser';
3
- import { EventAddons } from './addons';
4
- import { Breadcrumb } from './breadcrumb';
5
- import { Json } from '../../utils';
1
+ import type { BacktraceFrame } from './backtraceFrame.ts';
2
+ import type { AffectedUser } from './affectedUser.ts';
3
+ import type { EventAddons } from './addons/index.ts';
4
+ import type { Json } from '../../utils/index.ts';
6
5
 
7
6
  /**
8
7
  * Information about event (Payload of the event)
9
8
  * That object will be sent as 'payload' from the Collector to the workers
10
9
  */
11
10
  export interface EventData<Addons extends EventAddons> {
12
- /**
13
- * Event title
14
- */
15
- title: string;
11
+ /**
12
+ * Event title
13
+ */
14
+ title: string;
16
15
 
17
- /**
18
- * Event type (severity level)
19
- */
20
- type?: string;
16
+ /**
17
+ * Event type (severity level)
18
+ */
19
+ type?: string;
21
20
 
22
- /**
23
- * Stack
24
- * From the latest call to the earliest
25
- */
26
- backtrace?: BacktraceFrame[];
21
+ /**
22
+ * Stack
23
+ * From the latest call to the earliest
24
+ */
25
+ backtrace?: BacktraceFrame[];
27
26
 
28
- /**
29
- * Catcher-specific information
30
- */
31
- addons?: Addons;
27
+ /**
28
+ * Catcher-specific information
29
+ */
30
+ addons?: Addons;
32
31
 
33
- /**
34
- * Current release (aka version, revision) of an application
35
- */
36
- release?: string;
32
+ /**
33
+ * Current release (aka version, revision) of an application
34
+ */
35
+ release?: string;
37
36
 
38
- /**
39
- * Breadcrumbs - chronological trail of events before the error
40
- */
41
- breadcrumbs?: Breadcrumb[];
37
+ /**
38
+ * Current authenticated user
39
+ */
40
+ user?: AffectedUser;
42
41
 
43
- /**
44
- * Current authenticated user
45
- */
46
- user?: AffectedUser;
42
+ /**
43
+ * Any other information collected and passed by user
44
+ */
45
+ context?: EventContext | string;
47
46
 
48
- /**
49
- * Any other information collected and passed by user
50
- */
51
- context?: EventContext | string;
52
-
53
- /**
54
- * Catcher version
55
- */
56
- catcherVersion?: string;
47
+ /**
48
+ * Catcher version
49
+ */
50
+ catcherVersion?: string;
57
51
  }
58
52
 
59
53
  /**
60
54
  * Event data with decoded unsafe fields
61
55
  */
62
56
  export interface DecodedEventData<Addons extends EventAddons> extends EventData<Addons> {
63
- /**
64
- * Json parsed context string
65
- */
66
- context?: EventContext;
57
+ /**
58
+ * Json parsed context string
59
+ */
60
+ context?: EventContext;
67
61
 
68
- /**
69
- * Json parsed addons string
70
- */
71
- addons?: Addons;
62
+ /**
63
+ * Json parsed addons string
64
+ */
65
+ addons?: Addons;
72
66
  }
73
67
 
74
68
  /**
75
69
  * Event data with encoded unsafe fields
76
70
  */
77
71
  export interface EncodedEventData extends EventData<EventAddons> {
78
- /**
79
- * Stringified context object
80
- */
81
- context?: string;
72
+ /**
73
+ * Stringified context object
74
+ */
75
+ context?: string;
82
76
 
83
- /**
84
- * Stringified addons object
85
- */
86
- addons?: string;
77
+ /**
78
+ * Stringified addons object
79
+ */
80
+ addons?: string;
87
81
  }
88
82
 
89
83
  /**
@@ -3,13 +3,13 @@
3
3
  * Used in event.payload.backtrace[].sourceCode
4
4
  */
5
5
  export interface SourceCodeLine {
6
- /**
7
- * Line number
8
- */
9
- line: number;
6
+ /**
7
+ * Line number
8
+ */
9
+ line: number;
10
10
 
11
- /**
12
- * Line content
13
- */
14
- content: string;
11
+ /**
12
+ * Line content
13
+ */
14
+ content: string;
15
15
  }
@@ -2,4 +2,4 @@
2
2
  * Interface representing the structure of performance CatcherMessage payload.
3
3
  * This interface is for payload of the CatcherMessages with CatcherType 'performance'.
4
4
  */
5
- export interface PerformanceData {}
5
+ export interface PerformanceData {}
@@ -1,14 +1,14 @@
1
- import { DecodedEventData, EventData } from '../base/event/event';
2
- import { PerformanceData } from '../base/performance/performance';
1
+ import type { DecodedEventData, EventData } from '../base/event/event.ts';
2
+ import type { PerformanceData } from '../base/performance/performance.ts';
3
3
 
4
- import type {
5
- JavaScriptAddons,
4
+ import type {
5
+ JavaScriptAddons,
6
6
  PhpAddons,
7
7
  NodeJSAddons,
8
8
  GoAddons,
9
9
  PythonAddons,
10
- DefaultAddons,
11
- } from '../base/event/addons';
10
+ DefaultAddons
11
+ } from '../base/event/addons/index.ts';
12
12
 
13
13
  /**
14
14
  * Type that represents all supported Catcher message types for events
@@ -18,7 +18,7 @@ export type ErrorsCatcherType = 'errors/javascript'
18
18
  | 'errors/nodejs'
19
19
  | 'errors/go'
20
20
  | 'errors/python'
21
- | 'errors/default'
21
+ | 'errors/default';
22
22
 
23
23
  /**
24
24
  * Type that represents all supported Catcher message types for performance
@@ -34,13 +34,34 @@ export type CatcherMessageType = ErrorsCatcherType | MetricsCatcherType;
34
34
  * Type that represents the payload of a Catcher message based on its type
35
35
  */
36
36
  export type CatcherMessagePayload<Type extends CatcherMessageType> = {
37
+ /**
38
+ * Addons that can be added to all errors except those which have a separate workers
39
+ */
37
40
  'errors/default': DecodedEventData<DefaultAddons>;
41
+ /**
42
+ * Added by JavaScript SDK
43
+ */
38
44
  'errors/javascript': DecodedEventData<JavaScriptAddons>;
45
+ /**
46
+ * Added by PHP SDK
47
+ */
39
48
  'errors/php': EventData<PhpAddons>;
49
+ /**
50
+ * Added by Node.js SDK
51
+ */
40
52
  'errors/nodejs': EventData<NodeJSAddons>;
53
+ /**
54
+ * Added by Go SDK
55
+ */
41
56
  'errors/go': EventData<GoAddons>;
57
+ /**
58
+ * Added by Python SDK
59
+ */
42
60
  'errors/python': EventData<PythonAddons>;
43
- 'performance': PerformanceData;
61
+ /**
62
+ * Performance monitoring data
63
+ */
64
+ performance: PerformanceData;
44
65
  }[Type];
45
66
 
46
67
  /**
@@ -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
  }