@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,48 +1,57 @@
1
- import { ObjectId } from "mongodb";
2
- import { DecodedEventData, EncodedEventData, EventData } from '../base/event/event';
3
- 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 { EventAddons } from '../base/event/addons/index.ts';
4
4
 
5
+ /**
6
+ * Repetition - is a record about event that was already processed. It stores only difference between original event and repetition.
7
+ */
5
8
  export interface RepetitionDBScheme {
6
- /**
7
- * Internal mongo id
8
- */
9
- _id?: ObjectId;
9
+ /**
10
+ * Internal mongo id
11
+ */
12
+ _id?: ObjectId;
13
+
14
+ /**
15
+ * Hash for grouping similar events
16
+ */
17
+ groupHash: string;
10
18
 
11
- /**
12
- * Hash for grouping similar events
13
- */
14
- groupHash: string;
19
+ /**
20
+ * @deprecated use delta instead
21
+ * And any of EventData field with diff
22
+ * except fields that used in groupHash
23
+ */
24
+ payload?: EventData<EventAddons>;
15
25
 
16
- /**
17
- * @deprecated, use delta instead
18
- * And any of EventData field with diff
19
- * except fields that used in groupHash
20
- */
21
- payload?: EventData<EventAddons>;
26
+ /**
27
+ * Delta between original event and repetition
28
+ */
29
+ delta?: string;
22
30
 
23
- /**
24
- * Delta between original event and repetition
25
- */
26
- delta?: string,
27
-
28
- /**
29
- * Occurrence time
30
- * Unix timestamp in seconds (example: 1567009247.576)
31
- * (created by the Collector)
32
- */
33
- timestamp: number;
31
+ /**
32
+ * Occurrence time
33
+ * Unix timestamp in seconds (example: 1567009247.576)
34
+ * (created by the Collector)
35
+ */
36
+ timestamp: number;
34
37
  }
35
38
 
36
39
  /**
37
40
  * Repetition with decoded event data
38
41
  */
39
42
  export interface DecodedRepetition {
40
- payload: DecodedEventData<EventAddons>
43
+ /**
44
+ * Event data where 'context' and 'addons' are objects
45
+ */
46
+ payload: DecodedEventData<EventAddons>;
41
47
  }
42
48
 
43
49
  /**
44
50
  * Repetition with decoded event data
45
51
  */
46
52
  export interface EncodedRepetition {
47
- payload: EncodedEventData
53
+ /**
54
+ * Event data where 'context' and 'addons' are json strings
55
+ */
56
+ payload: EncodedEventData;
48
57
  }
@@ -1,4 +1,4 @@
1
- import { ObjectID, Timestamp } from 'mongodb';
1
+ import type { ObjectId, Timestamp } from 'bson';
2
2
 
3
3
  /**
4
4
  * Source map with parsed file names, stored in the release
@@ -6,14 +6,12 @@ import { ObjectID, Timestamp } from 'mongodb';
6
6
  export interface SourceMapDataExtended {
7
7
  /**
8
8
  * Name of source-map file
9
- *
10
9
  * @example main.min.js.map
11
10
  */
12
11
  mapFileName: string;
13
12
 
14
13
  /**
15
14
  * Bundle or chunk name
16
- *
17
15
  * @example main.min.js
18
16
  */
19
17
  originFileName: string;
@@ -27,19 +25,18 @@ export interface SourceMapDataExtended {
27
25
  /**
28
26
  * When file will be saved to GridFS, there will be its id instead of 'content'
29
27
  */
30
- _id?: ObjectID;
28
+ _id?: ObjectId;
31
29
  }
32
30
 
33
31
  /**
34
32
  * Object represents a file structure stored in Mongo GridFS
35
- *
36
33
  * @see https://github.com/mongodb/specifications/blob/master/source/gridfs/gridfs-spec.rst#definitions
37
34
  */
38
35
  export interface SourceMapFileChunk {
39
36
  /**
40
37
  * Unique id of a file chunk
41
38
  */
42
- _id: ObjectID;
39
+ _id: ObjectId;
43
40
 
44
41
  /**
45
42
  * Chunk size in bytes
@@ -53,7 +50,6 @@ export interface SourceMapFileChunk {
53
50
 
54
51
  /**
55
52
  * Uploading date stored as a BSON datetime value 'Timestamp'.
56
- *
57
53
  * @example 2020-02-18T14:51:40.400Z
58
54
  */
59
55
  uploadDate: Timestamp;
@@ -82,4 +78,4 @@ export interface SourcemapCollectedData {
82
78
  * Source map body
83
79
  */
84
80
  payload: string;
85
- }
81
+ }
@@ -1,6 +1,6 @@
1
- import { ObjectId } from 'mongodb';
2
- import { UserNotificationsDBScheme } from '../../index';
3
- import { BankCard } from './bankCard';
1
+ import type { ObjectId } from 'bson';
2
+ import type { UserNotificationsDBScheme } from '../../index.ts';
3
+ import type { BankCard } from './bankCard.ts';
4
4
 
5
5
  /**
6
6
  * Interface representing how user is stored in DB
@@ -1,16 +1,16 @@
1
- import { NotificationsChannelsDBScheme, UserNotificationType } from "../../index";
1
+ import type { NotificationsChannelsDBScheme, UserNotificationType } from '../../index.ts';
2
2
 
3
3
  /**
4
4
  * This structure represents how user notifications are stored at the DB (in 'users' collection)
5
5
  */
6
6
  export interface UserNotificationsDBScheme {
7
- /**
8
- * Channels with their settings
9
- */
10
- channels: NotificationsChannelsDBScheme;
7
+ /**
8
+ * Channels with their settings
9
+ */
10
+ channels: NotificationsChannelsDBScheme;
11
11
 
12
- /**
13
- * Types of notifications to receive
14
- */
15
- whatToReceive: {[key in UserNotificationType]: boolean};
12
+ /**
13
+ * Types of notifications to receive
14
+ */
15
+ whatToReceive: { [key in UserNotificationType]: boolean };
16
16
  }
@@ -1,79 +1,84 @@
1
- import { ObjectId } from "mongodb";
1
+ import type { ObjectId } from 'bson';
2
2
 
3
3
  /**
4
4
  * Workspace representation in DataBase
5
5
  */
6
6
  export interface WorkspaceDBScheme {
7
- /**
8
- * Workspace's id
9
- */
10
- _id: ObjectId;
7
+ /**
8
+ * Workspace's id
9
+ */
10
+ _id: ObjectId;
11
11
 
12
- /**
13
- * Workspace's name
14
- */
15
- name: string;
12
+ /**
13
+ * Workspace's name
14
+ */
15
+ name: string;
16
16
 
17
- /**
18
- * Workspace's invite hash
19
- */
20
- inviteHash: string;
17
+ /**
18
+ * Workspace's invite hash
19
+ */
20
+ inviteHash: string;
21
21
 
22
- /**
23
- * Workspace account uuid in accounting microservice
24
- */
25
- accountId: string;
22
+ /**
23
+ * Workspace account uuid in accounting microservice
24
+ */
25
+ accountId: string;
26
26
 
27
- /**
28
- * Workspace's description
29
- */
30
- description?: string;
27
+ /**
28
+ * Workspace's description
29
+ */
30
+ description?: string;
31
31
 
32
- /**
33
- * Workspace's image URL
34
- */
35
- image?: string;
32
+ /**
33
+ * Workspace's image URL
34
+ */
35
+ image?: string;
36
36
 
37
- /**
38
- * Id of the Workspace's plan
39
- */
40
- tariffPlanId: ObjectId;
37
+ /**
38
+ * Id of the Workspace's plan
39
+ */
40
+ tariffPlanId: ObjectId;
41
41
 
42
- /**
43
- * Workspace balance
44
- */
45
- balance: number;
42
+ /**
43
+ * Workspace balance
44
+ */
45
+ balance: number;
46
46
 
47
- /**
48
- * Date when workspace was charged last time
49
- */
50
- lastChargeDate: Date;
47
+ /**
48
+ * Date when workspace was charged last time
49
+ */
50
+ lastChargeDate: Date;
51
51
 
52
- /**
53
- * Date when subscription will be expired
54
- * Used for pre-paid plans for several months
55
- */
56
- paidUntil?: Date;
52
+ /**
53
+ * Date when subscription will be expired
54
+ * Used for pre-paid plans for several months
55
+ */
56
+ paidUntil?: Date;
57
57
 
58
- /**
59
- * Total number of errors since the last charge date
60
- */
61
- billingPeriodEventsCount: number;
58
+ /**
59
+ * Total number of errors since the last charge date
60
+ */
61
+ billingPeriodEventsCount: number;
62
62
 
63
- /**
64
- * ID of subscription if it subscribed
65
- * Returns from CloudPayments
66
- */
67
- subscriptionId?: string;
63
+ /**
64
+ * ID of subscription if it subscribed
65
+ * Returns from CloudPayments
66
+ */
67
+ subscriptionId?: string;
68
68
 
69
- /**
70
- * Is workspace blocked for catching new events
71
- */
72
- isBlocked?: boolean;
69
+ /**
70
+ * Is workspace blocked for catching new events
71
+ */
72
+ isBlocked?: boolean;
73
73
 
74
- /**
75
- * List of last dates for notifications
76
- * Used to reduce frequency of some system messages
77
- */
78
- lastNotificationDate?: {[key: string]: Date};
74
+ /**
75
+ * Date when workspace was blocked
76
+ */
77
+ blockedDate?: Date;
78
+
79
+ /**
80
+ * List of last dates for notifications
81
+ * Used to reduce frequency of some system messages
82
+ */
83
+ lastNotificationDate?: { [key: string]: Date };
79
84
  }
@@ -1,37 +1,37 @@
1
- import { ReceiveTypes } from "../../index";
2
- import { NotificationsChannelsDBScheme } from "../dbScheme/notificationsChannels";
1
+ import type { ReceiveTypes } from '../../index.ts';
2
+ import type { NotificationsChannelsDBScheme } from '../dbScheme/notificationsChannels.ts';
3
3
 
4
4
  /**
5
5
  * Payload for creating new notification rule
6
6
  */
7
7
  export interface CreateProjectNotificationsRulePayload {
8
- /**
9
- * Allows to disable rule without removing
10
- */
11
- isEnabled: true;
8
+ /**
9
+ * Allows to disable rule without removing
10
+ */
11
+ isEnabled: true;
12
12
 
13
- /**
14
- * Receive type: 'ALL' or 'ONLY_NEW'
15
- */
16
- whatToReceive: ReceiveTypes;
13
+ /**
14
+ * Receive type: 'ALL' or 'ONLY_NEW'
15
+ */
16
+ whatToReceive: ReceiveTypes;
17
17
 
18
- /**
19
- * Only those which contains passed words
20
- */
21
- including: string[];
18
+ /**
19
+ * Only those which contains passed words
20
+ */
21
+ including: string[];
22
22
 
23
- /**
24
- * Skip those which contains passed words
25
- */
26
- excluding: string[];
23
+ /**
24
+ * Skip those which contains passed words
25
+ */
26
+ excluding: string[];
27
27
 
28
- /**
29
- * Creator of the rule
30
- */
31
- uidAdded: string;
28
+ /**
29
+ * Creator of the rule
30
+ */
31
+ uidAdded: string;
32
32
 
33
- /**
34
- * Available channels to receive
35
- */
36
- channels: NotificationsChannelsDBScheme;
37
- }
33
+ /**
34
+ * Available channels to receive
35
+ */
36
+ channels: NotificationsChannelsDBScheme;
37
+ }
@@ -2,13 +2,13 @@
2
2
  * Available options of 'What to receive'
3
3
  */
4
4
  export enum ReceiveTypes {
5
- /**
6
- * If event seen more than threshold in thresholdPeriod
7
- */
8
- SEEN_MORE = 'SEEN_MORE',
5
+ /**
6
+ * If event seen more than threshold in thresholdPeriod
7
+ */
8
+ SEEN_MORE = 'SEEN_MORE',
9
9
 
10
- /**
11
- * Only first occurrence
12
- */
13
- ONLY_NEW = 'ONLY_NEW',
10
+ /**
11
+ * Only first occurrence
12
+ */
13
+ ONLY_NEW = 'ONLY_NEW'
14
14
  }
@@ -1,37 +1,37 @@
1
- import { ReceiveTypes } from "../../index";
2
- import { NotificationsChannelsDBScheme } from "../dbScheme/notificationsChannels";
1
+ import type { ReceiveTypes } from '../../index.ts';
2
+ import type { NotificationsChannelsDBScheme } from '../dbScheme/notificationsChannels.ts';
3
3
 
4
4
  /**
5
5
  * Payload for updating existing notifications rule
6
6
  */
7
7
  export interface UpdateProjectNotificationsRulePayload {
8
- /**
9
- * Rule id to update
10
- */
11
- ruleId: string;
8
+ /**
9
+ * Rule id to update
10
+ */
11
+ ruleId: string;
12
12
 
13
- /**
14
- * Allows to disable rule without removing
15
- */
16
- isEnabled: true;
13
+ /**
14
+ * Allows to disable rule without removing
15
+ */
16
+ isEnabled: true;
17
17
 
18
- /**
19
- * Receive type: 'ALL' or 'ONLY_NEW'
20
- */
21
- whatToReceive: ReceiveTypes;
18
+ /**
19
+ * Receive type: 'ALL' or 'ONLY_NEW'
20
+ */
21
+ whatToReceive: ReceiveTypes;
22
22
 
23
- /**
24
- * Only those which contains passed words
25
- */
26
- including: string[];
23
+ /**
24
+ * Only those which contains passed words
25
+ */
26
+ including: string[];
27
27
 
28
- /**
29
- * Skip those which contains passed words
30
- */
31
- excluding: string[];
28
+ /**
29
+ * Skip those which contains passed words
30
+ */
31
+ excluding: string[];
32
32
 
33
- /**
34
- * Available channels to receive
35
- */
36
- channels: NotificationsChannelsDBScheme;
33
+ /**
34
+ * Available channels to receive
35
+ */
36
+ channels: NotificationsChannelsDBScheme;
37
37
  }
@@ -2,18 +2,18 @@
2
2
  * Available options of 'What to receive'
3
3
  */
4
4
  export enum UserNotificationType {
5
- /**
6
- * When user is assigned to the issue (event)
7
- */
8
- IssueAssigning = 'IssueAssigning',
5
+ /**
6
+ * When user is assigned to the issue (event)
7
+ */
8
+ IssueAssigning = 'IssueAssigning',
9
9
 
10
- /**
11
- * Regular digest of what happened on the project for the week
12
- */
13
- WeeklyDigest = 'WeeklyDigest',
10
+ /**
11
+ * Regular digest of what happened on the project for the week
12
+ */
13
+ WeeklyDigest = 'WeeklyDigest',
14
14
 
15
- /**
16
- * Only important messages from Hawk team
17
- */
18
- SystemMessages = 'SystemMessages',
15
+ /**
16
+ * Only important messages from Hawk team
17
+ */
18
+ SystemMessages = 'SystemMessages'
19
19
  }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Represents simple JSON-like document
3
3
  */
4
- export type Json = {[key: string]: JsonNode};
4
+ export type Json = { [key: string]: JsonNode };
5
5
 
6
6
  /**
7
7
  * Represents possible field values in Dict
package/.eslintrc DELETED
@@ -1,12 +0,0 @@
1
- {
2
- "parser": "@typescript-eslint/parser",
3
- "plugins": ["@typescript-eslint"],
4
- "extends": [
5
- "eslint:recommended",
6
- "plugin:@typescript-eslint/recommended"
7
- ],
8
- "rules": {
9
- "object-curly-spacing": ["error", "always"],
10
- "@typescript-eslint/no-empty-interface": ["off"]
11
- }
12
- }