@abyss-project/tools 1.1.1 → 1.2.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.
- package/.eslintrc.js +33 -33
- package/.prettierrc +5 -5
- package/README.md +32 -32
- package/dist/api/extraction-plan-preset.api.js +1 -1
- package/dist/api/extraction-plan-preset.api.js.map +1 -1
- package/dist/api/extraction-settings.api.js +1 -1
- package/dist/api/extraction-settings.api.js.map +1 -1
- package/dist/api/extraction.api.js +1 -1
- package/dist/api/extraction.api.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/utils/shape.utils.js +18 -18
- package/package.json +14 -9
- package/src/api/abyss.admin.api.ts +54 -54
- package/src/api/atlas-document.api.ts +68 -68
- package/src/api/atlas-group.api.ts +69 -69
- package/src/api/atlas-page.api.ts +124 -124
- package/src/api/atlas.api.ts +103 -103
- package/src/api/atlas.public.api.ts +42 -42
- package/src/api/board-card-checklist.api.ts +99 -99
- package/src/api/board-card-comment.api.ts +57 -57
- package/src/api/board-card-document.api.ts +57 -57
- package/src/api/board-card.api.ts +137 -137
- package/src/api/board-column.api.ts +54 -54
- package/src/api/board-label.api.ts +87 -87
- package/src/api/board.api.ts +122 -122
- package/src/api/draw.api.ts +97 -97
- package/src/api/draw.public.api.ts +48 -48
- package/src/api/extraction-plan-preset.api.ts +1 -1
- package/src/api/extraction-settings.api.ts +1 -1
- package/src/api/extraction.api.ts +1 -1
- package/src/api/memo.api.ts +97 -97
- package/src/api/metrics.api.ts +27 -27
- package/src/api/monitor.api.ts +6 -6
- package/src/api/organization.api.ts +14 -14
- package/src/api/retrospective-card.api.ts +74 -74
- package/src/api/retrospective-member.api.ts +54 -54
- package/src/api/retrospective-section.api.ts +74 -74
- package/src/api/retrospective.api.ts +124 -124
- package/src/api/retrospective.public.api.ts +147 -147
- package/src/api/short-link.admin.api.ts +39 -39
- package/src/api/short-link.api.ts +125 -125
- package/src/api/short-link.public.api.ts +60 -60
- package/src/api/tag.api.ts +72 -72
- package/src/constants/atlas.constants.ts +2 -2
- package/src/constants/board.constants.ts +7 -7
- package/src/constants/memo.constants.ts +3 -3
- package/src/constants/short-link.constants.ts +11 -11
- package/src/constants/tag.constants.ts +3 -3
- package/src/index.ts +1 -1
- package/src/server-sent-events/index.ts +13 -13
- package/src/server-sent-events/protocols/atlas/atlas.sse-protocol.ts +90 -90
- package/src/server-sent-events/protocols/atlas/index.ts +1 -1
- package/src/server-sent-events/protocols/board/board.sse-protocol.ts +115 -115
- package/src/server-sent-events/protocols/board/index.ts +1 -1
- package/src/server-sent-events/protocols/board-card/board-card.sse-protocol.ts +26 -26
- package/src/server-sent-events/protocols/board-card/index.ts +1 -1
- package/src/server-sent-events/protocols/index.ts +26 -26
- package/src/server-sent-events/protocols/retrospective/index.ts +1 -1
- package/src/server-sent-events/protocols/retrospective/retrospective.sse-protocol.ts +92 -92
- package/src/server-sent-events/server-sent-events.manager.ts +73 -73
- package/src/types/draw.type.ts +173 -173
- package/src/types/enum/api-error.enum.ts +23 -23
- package/src/types/enum/board-activity.enum.ts +189 -189
- package/src/types/enum/board-column-type.enum.ts +6 -6
- package/src/types/enum/pdf-operation.enum.ts +98 -98
- package/src/types/enum/rcb-bank.enum.ts +137 -137
- package/src/types/index.ts +5 -5
- package/src/types/interface/api/index.ts +5 -5
- package/src/types/interface/api/requests/abyss.admin.request.ts +20 -20
- package/src/types/interface/api/requests/atlas-document.request.ts +32 -32
- package/src/types/interface/api/requests/atlas-group.request.ts +45 -45
- package/src/types/interface/api/requests/atlas-page.request.ts +84 -84
- package/src/types/interface/api/requests/atlas.public.request.ts +21 -21
- package/src/types/interface/api/requests/atlas.request.ts +52 -52
- package/src/types/interface/api/requests/board-card-checklist.request.ts +61 -61
- package/src/types/interface/api/requests/board-card-comment.request.ts +28 -28
- package/src/types/interface/api/requests/board-card-document.request.ts +29 -29
- package/src/types/interface/api/requests/board-card.request.ts +86 -86
- package/src/types/interface/api/requests/board-column.request.ts +30 -30
- package/src/types/interface/api/requests/board-label.request.ts +42 -42
- package/src/types/interface/api/requests/board.request.ts +61 -61
- package/src/types/interface/api/requests/draw.public.request.ts +20 -20
- package/src/types/interface/api/requests/draw.request.ts +49 -49
- package/src/types/interface/api/requests/memo.request.ts +49 -49
- package/src/types/interface/api/requests/metrics.request.ts +7 -7
- package/src/types/interface/api/requests/retrospective-card.request.ts +38 -38
- package/src/types/interface/api/requests/retrospective-member.request.ts +20 -20
- package/src/types/interface/api/requests/retrospective-section.request.ts +43 -43
- package/src/types/interface/api/requests/retrospective.public.request.ts +84 -84
- package/src/types/interface/api/requests/retrospective.request.ts +59 -59
- package/src/types/interface/api/requests/short-link.admin.request.ts +35 -35
- package/src/types/interface/api/requests/short-link.public.request.ts +40 -40
- package/src/types/interface/api/requests/short-link.request.ts +71 -71
- package/src/types/interface/api/requests/tag.request.ts +54 -54
- package/src/types/interface/api/requests/transfer.request.ts +3 -3
- package/src/types/interface/api/responses/abyss.admin.response.ts +28 -28
- package/src/types/interface/api/responses/atlas-document.response.ts +24 -24
- package/src/types/interface/api/responses/atlas-group.response.ts +23 -23
- package/src/types/interface/api/responses/atlas-page.response.ts +53 -53
- package/src/types/interface/api/responses/atlas.public.response.ts +21 -21
- package/src/types/interface/api/responses/atlas.response.ts +32 -32
- package/src/types/interface/api/responses/board-card-checklist.response.ts +31 -31
- package/src/types/interface/api/responses/board-card-comment.response.ts +20 -20
- package/src/types/interface/api/responses/board-card-document.response.ts +21 -21
- package/src/types/interface/api/responses/board-card.response.ts +55 -55
- package/src/types/interface/api/responses/board-column.response.ts +20 -20
- package/src/types/interface/api/responses/board-label.response.ts +31 -31
- package/src/types/interface/api/responses/board.response.ts +81 -81
- package/src/types/interface/api/responses/count.response.ts +9 -9
- package/src/types/interface/api/responses/draw.public.response.ts +22 -22
- package/src/types/interface/api/responses/draw.response.ts +32 -32
- package/src/types/interface/api/responses/enriched-paginate.response.ts +11 -11
- package/src/types/interface/api/responses/memo.response.ts +32 -32
- package/src/types/interface/api/responses/metrics.response.ts +22 -22
- package/src/types/interface/api/responses/monitor.response.ts +8 -8
- package/src/types/interface/api/responses/recent.response.ts +18 -18
- package/src/types/interface/api/responses/retrospective-card.response.ts +23 -23
- package/src/types/interface/api/responses/retrospective-member.response.ts +22 -22
- package/src/types/interface/api/responses/retrospective-section.response.ts +23 -23
- package/src/types/interface/api/responses/retrospective.public.response.ts +57 -57
- package/src/types/interface/api/responses/retrospective.response.ts +32 -32
- package/src/types/interface/api/responses/short-link.admin.response.ts +21 -21
- package/src/types/interface/api/responses/short-link.public.response.ts +26 -26
- package/src/types/interface/api/responses/short-link.response.ts +38 -38
- package/src/types/interface/api/responses/tag.response.ts +38 -38
- package/src/types/interface/api/responses/transfer.response.ts +14 -14
- package/src/types/interface/api/type-message/api-error.ts +7 -7
- package/src/types/interface/api/type-message/base-paginate.ts +11 -11
- package/src/types/interface/api/type-message/response.ts +6 -6
- package/src/types/interface/index.ts +2 -2
- package/src/types/interface/models/atlas-document.dto.ts +22 -22
- package/src/types/interface/models/atlas-group.dto.ts +21 -21
- package/src/types/interface/models/atlas-page-content.dto.ts +17 -17
- package/src/types/interface/models/atlas-page.dto.ts +26 -26
- package/src/types/interface/models/atlas.dto.ts +34 -34
- package/src/types/interface/models/board-activity.dto.ts +20 -20
- package/src/types/interface/models/board-card-checklist-row.dto.ts +14 -14
- package/src/types/interface/models/board-card-checklist.dto.ts +16 -16
- package/src/types/interface/models/board-card-comment.dto.ts +15 -15
- package/src/types/interface/models/board-card-document.dto.ts +22 -22
- package/src/types/interface/models/board-card-label.dto.ts +14 -14
- package/src/types/interface/models/board-card-member.dto.ts +14 -14
- package/src/types/interface/models/board-card.dto.ts +37 -37
- package/src/types/interface/models/board-column.dto.ts +17 -17
- package/src/types/interface/models/board-label.dto.ts +13 -13
- package/src/types/interface/models/board.dto.ts +33 -33
- package/src/types/interface/models/content-share.dto.ts +16 -16
- package/src/types/interface/models/draw.dto.ts +30 -30
- package/src/types/interface/models/memo.dto.ts +23 -23
- package/src/types/interface/models/project.dto.ts +25 -25
- package/src/types/interface/models/retrospective-card.dto.ts +17 -17
- package/src/types/interface/models/retrospective-member.dto.ts +15 -15
- package/src/types/interface/models/retrospective-section.dto.ts +16 -16
- package/src/types/interface/models/retrospective.dto.ts +32 -32
- package/src/types/interface/models/short-link-click.dto.ts +33 -33
- package/src/types/interface/models/short-link.dto.ts +49 -49
- package/src/types/interface/models/tag.dto.ts +26 -26
- package/src/types/interface/models/team.dto.ts +12 -12
- package/src/types/interface/models/user.dto.ts +26 -26
- package/src/utils/board.utils.ts +57 -57
- package/src/utils/enum.utils.ts +5 -5
- package/src/utils/error.utils.ts +30 -30
- package/src/utils/icons.utils.ts +96 -96
- package/src/utils/shape.utils.ts +292 -292
|
@@ -1,115 +1,115 @@
|
|
|
1
|
-
import { SystemSSEMessageContent } from '..';
|
|
2
|
-
import {
|
|
3
|
-
IBoardCardChecklist,
|
|
4
|
-
IBoardCardComment,
|
|
5
|
-
IBoardCardDocument,
|
|
6
|
-
IBoardCardMember,
|
|
7
|
-
IGetBoardData,
|
|
8
|
-
IListBoardLabelData,
|
|
9
|
-
ValueOf,
|
|
10
|
-
} from '../../../types';
|
|
11
|
-
|
|
12
|
-
export enum BoardSSEEvent {
|
|
13
|
-
BOARD_UPDATE = 'BOARD_UPDATE',
|
|
14
|
-
BOARD_DELETE = 'BOARD_DELETE',
|
|
15
|
-
|
|
16
|
-
BOARD_LABELS = 'BOARD_LABELS',
|
|
17
|
-
|
|
18
|
-
BOARD_CARD_MEMBER_CREATE = 'BOARD_CARD_MEMBER_CREATE',
|
|
19
|
-
BOARD_CARD_MEMBER_DELETE = 'BOARD_CARD_MEMBER_DELETE',
|
|
20
|
-
|
|
21
|
-
BOARD_CARD_DOCUMENT_CREATE = 'BOARD_CARD_DOCUMENT_CREATE',
|
|
22
|
-
BOARD_CARD_DOCUMENT_DELETE = 'BOARD_CARD_DOCUMENT_DELETE',
|
|
23
|
-
|
|
24
|
-
BOARD_CARD_COMMENT_CREATE = 'BOARD_CARD_COMMENT_CREATE',
|
|
25
|
-
BOARD_CARD_COMMENT_DELETE = 'BOARD_CARD_COMMENT_DELETE',
|
|
26
|
-
BOARD_CARD_COMMENT_UPDATE = 'BOARD_CARD_COMMENT_UPDATE',
|
|
27
|
-
|
|
28
|
-
BOARD_CARD_CHECKLIST_CREATE = 'BOARD_CARD_CHECKLIST_CREATE',
|
|
29
|
-
BOARD_CARD_CHECKLIST_DELETE = 'BOARD_CARD_CHECKLIST_DELETE',
|
|
30
|
-
BOARD_CARD_CHECKLIST_UPDATE = 'BOARD_CARD_CHECKLIST_UPDATE',
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export type BoardSSEMessageContent = ValueOf<
|
|
34
|
-
{
|
|
35
|
-
[K in BoardSSEEvent]: {
|
|
36
|
-
type: K;
|
|
37
|
-
payload: SourceBoardSSEEventPayload[K];
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
>;
|
|
41
|
-
|
|
42
|
-
export class SourceBoardSSEEventPayload implements Record<BoardSSEEvent, Record<string, any>> {
|
|
43
|
-
[BoardSSEEvent.BOARD_UPDATE]!: {
|
|
44
|
-
boardId: string;
|
|
45
|
-
boardData: IGetBoardData;
|
|
46
|
-
};
|
|
47
|
-
[BoardSSEEvent.BOARD_DELETE]!: {
|
|
48
|
-
boardId: string;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
[BoardSSEEvent.BOARD_LABELS]!: {
|
|
52
|
-
boardId: string;
|
|
53
|
-
boardLabels: IListBoardLabelData['boardLabels'];
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
[BoardSSEEvent.BOARD_CARD_MEMBER_CREATE]!: {
|
|
57
|
-
boardId: string;
|
|
58
|
-
boardCardMember: IBoardCardMember;
|
|
59
|
-
boardData: IGetBoardData;
|
|
60
|
-
};
|
|
61
|
-
[BoardSSEEvent.BOARD_CARD_MEMBER_DELETE]!: {
|
|
62
|
-
boardId: string;
|
|
63
|
-
boardCardId: string;
|
|
64
|
-
userId: string;
|
|
65
|
-
boardData: IGetBoardData;
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
[BoardSSEEvent.BOARD_CARD_DOCUMENT_CREATE]!: {
|
|
69
|
-
boardId: string;
|
|
70
|
-
boardCardDocument: IBoardCardDocument;
|
|
71
|
-
boardData: IGetBoardData;
|
|
72
|
-
};
|
|
73
|
-
[BoardSSEEvent.BOARD_CARD_DOCUMENT_DELETE]!: {
|
|
74
|
-
boardId: string;
|
|
75
|
-
boardCardId: string;
|
|
76
|
-
boardCardDocumentId: string;
|
|
77
|
-
boardData: IGetBoardData;
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
[BoardSSEEvent.BOARD_CARD_COMMENT_CREATE]!: {
|
|
81
|
-
boardId: string;
|
|
82
|
-
boardCardComment: IBoardCardComment;
|
|
83
|
-
boardData: IGetBoardData;
|
|
84
|
-
};
|
|
85
|
-
[BoardSSEEvent.BOARD_CARD_COMMENT_DELETE]!: {
|
|
86
|
-
boardId: string;
|
|
87
|
-
boardCardId: string;
|
|
88
|
-
boardCardCommentId: string;
|
|
89
|
-
boardData: IGetBoardData;
|
|
90
|
-
};
|
|
91
|
-
[BoardSSEEvent.BOARD_CARD_COMMENT_UPDATE]!: {
|
|
92
|
-
boardId: string;
|
|
93
|
-
boardCardComment: IBoardCardComment;
|
|
94
|
-
boardData: IGetBoardData;
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
[BoardSSEEvent.BOARD_CARD_CHECKLIST_CREATE]!: {
|
|
98
|
-
boardId: string;
|
|
99
|
-
boardCardChecklist: IBoardCardChecklist;
|
|
100
|
-
boardData: IGetBoardData;
|
|
101
|
-
};
|
|
102
|
-
[BoardSSEEvent.BOARD_CARD_CHECKLIST_DELETE]!: {
|
|
103
|
-
boardId: string;
|
|
104
|
-
boardCardId: string;
|
|
105
|
-
boardCardChecklistId: string;
|
|
106
|
-
boardData: IGetBoardData;
|
|
107
|
-
};
|
|
108
|
-
[BoardSSEEvent.BOARD_CARD_CHECKLIST_UPDATE]!: {
|
|
109
|
-
boardId: string;
|
|
110
|
-
boardCardChecklist: IBoardCardChecklist;
|
|
111
|
-
boardData: IGetBoardData;
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
export type BoardSSEEventContent = BoardSSEMessageContent | SystemSSEMessageContent;
|
|
1
|
+
import { SystemSSEMessageContent } from '..';
|
|
2
|
+
import {
|
|
3
|
+
IBoardCardChecklist,
|
|
4
|
+
IBoardCardComment,
|
|
5
|
+
IBoardCardDocument,
|
|
6
|
+
IBoardCardMember,
|
|
7
|
+
IGetBoardData,
|
|
8
|
+
IListBoardLabelData,
|
|
9
|
+
ValueOf,
|
|
10
|
+
} from '../../../types';
|
|
11
|
+
|
|
12
|
+
export enum BoardSSEEvent {
|
|
13
|
+
BOARD_UPDATE = 'BOARD_UPDATE',
|
|
14
|
+
BOARD_DELETE = 'BOARD_DELETE',
|
|
15
|
+
|
|
16
|
+
BOARD_LABELS = 'BOARD_LABELS',
|
|
17
|
+
|
|
18
|
+
BOARD_CARD_MEMBER_CREATE = 'BOARD_CARD_MEMBER_CREATE',
|
|
19
|
+
BOARD_CARD_MEMBER_DELETE = 'BOARD_CARD_MEMBER_DELETE',
|
|
20
|
+
|
|
21
|
+
BOARD_CARD_DOCUMENT_CREATE = 'BOARD_CARD_DOCUMENT_CREATE',
|
|
22
|
+
BOARD_CARD_DOCUMENT_DELETE = 'BOARD_CARD_DOCUMENT_DELETE',
|
|
23
|
+
|
|
24
|
+
BOARD_CARD_COMMENT_CREATE = 'BOARD_CARD_COMMENT_CREATE',
|
|
25
|
+
BOARD_CARD_COMMENT_DELETE = 'BOARD_CARD_COMMENT_DELETE',
|
|
26
|
+
BOARD_CARD_COMMENT_UPDATE = 'BOARD_CARD_COMMENT_UPDATE',
|
|
27
|
+
|
|
28
|
+
BOARD_CARD_CHECKLIST_CREATE = 'BOARD_CARD_CHECKLIST_CREATE',
|
|
29
|
+
BOARD_CARD_CHECKLIST_DELETE = 'BOARD_CARD_CHECKLIST_DELETE',
|
|
30
|
+
BOARD_CARD_CHECKLIST_UPDATE = 'BOARD_CARD_CHECKLIST_UPDATE',
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export type BoardSSEMessageContent = ValueOf<
|
|
34
|
+
{
|
|
35
|
+
[K in BoardSSEEvent]: {
|
|
36
|
+
type: K;
|
|
37
|
+
payload: SourceBoardSSEEventPayload[K];
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
>;
|
|
41
|
+
|
|
42
|
+
export class SourceBoardSSEEventPayload implements Record<BoardSSEEvent, Record<string, any>> {
|
|
43
|
+
[BoardSSEEvent.BOARD_UPDATE]!: {
|
|
44
|
+
boardId: string;
|
|
45
|
+
boardData: IGetBoardData;
|
|
46
|
+
};
|
|
47
|
+
[BoardSSEEvent.BOARD_DELETE]!: {
|
|
48
|
+
boardId: string;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
[BoardSSEEvent.BOARD_LABELS]!: {
|
|
52
|
+
boardId: string;
|
|
53
|
+
boardLabels: IListBoardLabelData['boardLabels'];
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
[BoardSSEEvent.BOARD_CARD_MEMBER_CREATE]!: {
|
|
57
|
+
boardId: string;
|
|
58
|
+
boardCardMember: IBoardCardMember;
|
|
59
|
+
boardData: IGetBoardData;
|
|
60
|
+
};
|
|
61
|
+
[BoardSSEEvent.BOARD_CARD_MEMBER_DELETE]!: {
|
|
62
|
+
boardId: string;
|
|
63
|
+
boardCardId: string;
|
|
64
|
+
userId: string;
|
|
65
|
+
boardData: IGetBoardData;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
[BoardSSEEvent.BOARD_CARD_DOCUMENT_CREATE]!: {
|
|
69
|
+
boardId: string;
|
|
70
|
+
boardCardDocument: IBoardCardDocument;
|
|
71
|
+
boardData: IGetBoardData;
|
|
72
|
+
};
|
|
73
|
+
[BoardSSEEvent.BOARD_CARD_DOCUMENT_DELETE]!: {
|
|
74
|
+
boardId: string;
|
|
75
|
+
boardCardId: string;
|
|
76
|
+
boardCardDocumentId: string;
|
|
77
|
+
boardData: IGetBoardData;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
[BoardSSEEvent.BOARD_CARD_COMMENT_CREATE]!: {
|
|
81
|
+
boardId: string;
|
|
82
|
+
boardCardComment: IBoardCardComment;
|
|
83
|
+
boardData: IGetBoardData;
|
|
84
|
+
};
|
|
85
|
+
[BoardSSEEvent.BOARD_CARD_COMMENT_DELETE]!: {
|
|
86
|
+
boardId: string;
|
|
87
|
+
boardCardId: string;
|
|
88
|
+
boardCardCommentId: string;
|
|
89
|
+
boardData: IGetBoardData;
|
|
90
|
+
};
|
|
91
|
+
[BoardSSEEvent.BOARD_CARD_COMMENT_UPDATE]!: {
|
|
92
|
+
boardId: string;
|
|
93
|
+
boardCardComment: IBoardCardComment;
|
|
94
|
+
boardData: IGetBoardData;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
[BoardSSEEvent.BOARD_CARD_CHECKLIST_CREATE]!: {
|
|
98
|
+
boardId: string;
|
|
99
|
+
boardCardChecklist: IBoardCardChecklist;
|
|
100
|
+
boardData: IGetBoardData;
|
|
101
|
+
};
|
|
102
|
+
[BoardSSEEvent.BOARD_CARD_CHECKLIST_DELETE]!: {
|
|
103
|
+
boardId: string;
|
|
104
|
+
boardCardId: string;
|
|
105
|
+
boardCardChecklistId: string;
|
|
106
|
+
boardData: IGetBoardData;
|
|
107
|
+
};
|
|
108
|
+
[BoardSSEEvent.BOARD_CARD_CHECKLIST_UPDATE]!: {
|
|
109
|
+
boardId: string;
|
|
110
|
+
boardCardChecklist: IBoardCardChecklist;
|
|
111
|
+
boardData: IGetBoardData;
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export type BoardSSEEventContent = BoardSSEMessageContent | SystemSSEMessageContent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './board.sse-protocol';
|
|
1
|
+
export * from './board.sse-protocol';
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { SystemSSEMessageContent } from '..';
|
|
2
|
-
import { IGetBoardCardData, ValueOf } from '../../../types';
|
|
3
|
-
|
|
4
|
-
export enum BoardCardSSEEvent {
|
|
5
|
-
BOARD_CARD_UPDATE = 'BOARD_CARD_UPDATE',
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export type BoardCardSSEMessageContent = ValueOf<
|
|
9
|
-
{
|
|
10
|
-
[K in BoardCardSSEEvent]: {
|
|
11
|
-
type: K;
|
|
12
|
-
payload: SourceBoardCardSSEEventPayload[K];
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
>;
|
|
16
|
-
|
|
17
|
-
export class SourceBoardCardSSEEventPayload
|
|
18
|
-
implements Record<BoardCardSSEEvent, Record<string, any>>
|
|
19
|
-
{
|
|
20
|
-
[BoardCardSSEEvent.BOARD_CARD_UPDATE]!: {
|
|
21
|
-
boardCardId: string;
|
|
22
|
-
boardData: IGetBoardCardData;
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export type BoardCardSSEEventContent = BoardCardSSEMessageContent | SystemSSEMessageContent;
|
|
1
|
+
import { SystemSSEMessageContent } from '..';
|
|
2
|
+
import { IGetBoardCardData, ValueOf } from '../../../types';
|
|
3
|
+
|
|
4
|
+
export enum BoardCardSSEEvent {
|
|
5
|
+
BOARD_CARD_UPDATE = 'BOARD_CARD_UPDATE',
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export type BoardCardSSEMessageContent = ValueOf<
|
|
9
|
+
{
|
|
10
|
+
[K in BoardCardSSEEvent]: {
|
|
11
|
+
type: K;
|
|
12
|
+
payload: SourceBoardCardSSEEventPayload[K];
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
>;
|
|
16
|
+
|
|
17
|
+
export class SourceBoardCardSSEEventPayload
|
|
18
|
+
implements Record<BoardCardSSEEvent, Record<string, any>>
|
|
19
|
+
{
|
|
20
|
+
[BoardCardSSEEvent.BOARD_CARD_UPDATE]!: {
|
|
21
|
+
boardCardId: string;
|
|
22
|
+
boardData: IGetBoardCardData;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export type BoardCardSSEEventContent = BoardCardSSEMessageContent | SystemSSEMessageContent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './board-card.sse-protocol';
|
|
1
|
+
export * from './board-card.sse-protocol';
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { ValueOf } from '../..';
|
|
2
|
-
|
|
3
|
-
export * from './board';
|
|
4
|
-
export * from './board-card';
|
|
5
|
-
export * from './retrospective';
|
|
6
|
-
export * from './atlas';
|
|
7
|
-
|
|
8
|
-
export enum SYSTEM_PROTOCOL_EVENTS {
|
|
9
|
-
PING = 'PING',
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export type SystemSSEMessageContent = ValueOf<
|
|
13
|
-
{
|
|
14
|
-
[K in SYSTEM_PROTOCOL_EVENTS]: {
|
|
15
|
-
type: K;
|
|
16
|
-
payload: SystemSSEEventPayload[K];
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
>;
|
|
20
|
-
|
|
21
|
-
export class SystemSSEEventPayload implements Record<SYSTEM_PROTOCOL_EVENTS, Record<string, any>> {
|
|
22
|
-
[SYSTEM_PROTOCOL_EVENTS.PING]!: {
|
|
23
|
-
openedAt: number;
|
|
24
|
-
timestamp: number;
|
|
25
|
-
};
|
|
26
|
-
}
|
|
1
|
+
import { ValueOf } from '../..';
|
|
2
|
+
|
|
3
|
+
export * from './board';
|
|
4
|
+
export * from './board-card';
|
|
5
|
+
export * from './retrospective';
|
|
6
|
+
export * from './atlas';
|
|
7
|
+
|
|
8
|
+
export enum SYSTEM_PROTOCOL_EVENTS {
|
|
9
|
+
PING = 'PING',
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type SystemSSEMessageContent = ValueOf<
|
|
13
|
+
{
|
|
14
|
+
[K in SYSTEM_PROTOCOL_EVENTS]: {
|
|
15
|
+
type: K;
|
|
16
|
+
payload: SystemSSEEventPayload[K];
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
>;
|
|
20
|
+
|
|
21
|
+
export class SystemSSEEventPayload implements Record<SYSTEM_PROTOCOL_EVENTS, Record<string, any>> {
|
|
22
|
+
[SYSTEM_PROTOCOL_EVENTS.PING]!: {
|
|
23
|
+
openedAt: number;
|
|
24
|
+
timestamp: number;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './retrospective.sse-protocol';
|
|
1
|
+
export * from './retrospective.sse-protocol';
|
|
@@ -1,92 +1,92 @@
|
|
|
1
|
-
import { SystemSSEMessageContent } from '..';
|
|
2
|
-
import { ValueOf } from '../../../types';
|
|
3
|
-
import {
|
|
4
|
-
IRetrospective,
|
|
5
|
-
IRetrospectiveCard,
|
|
6
|
-
IRetrospectiveSection,
|
|
7
|
-
IRetrospectiveMember,
|
|
8
|
-
} from '../../../types/interface';
|
|
9
|
-
|
|
10
|
-
export enum RetrospectiveSSEEvent {
|
|
11
|
-
RETROSPECTIVE_UPDATED = 'RETROSPECTIVE_UPDATED',
|
|
12
|
-
RETROSPECTIVE_DELETED = 'RETROSPECTIVE_DELETED',
|
|
13
|
-
CARD_CREATED = 'CARD_CREATED',
|
|
14
|
-
CARD_UPDATED = 'CARD_UPDATED',
|
|
15
|
-
CARD_DELETED = 'CARD_DELETED',
|
|
16
|
-
SECTION_CREATED = 'SECTION_CREATED',
|
|
17
|
-
SECTION_UPDATED = 'SECTION_UPDATED',
|
|
18
|
-
SECTION_DELETED = 'SECTION_DELETED',
|
|
19
|
-
MEMBER_JOINED = 'MEMBER_JOINED',
|
|
20
|
-
MEMBER_UPDATED = 'MEMBER_UPDATED',
|
|
21
|
-
MEMBER_LEFT = 'MEMBER_LEFT',
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export type RetrospectiveSSEMessageContent = ValueOf<
|
|
25
|
-
{
|
|
26
|
-
[K in RetrospectiveSSEEvent]: {
|
|
27
|
-
type: K;
|
|
28
|
-
payload: SourceRetrospectiveSSEEventPayload[K];
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
>;
|
|
32
|
-
|
|
33
|
-
export class SourceRetrospectiveSSEEventPayload
|
|
34
|
-
implements Record<RetrospectiveSSEEvent, Record<string, any>>
|
|
35
|
-
{
|
|
36
|
-
[RetrospectiveSSEEvent.RETROSPECTIVE_UPDATED]!: {
|
|
37
|
-
retrospectiveId: string;
|
|
38
|
-
retrospective: IRetrospective;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
[RetrospectiveSSEEvent.RETROSPECTIVE_DELETED]!: {
|
|
42
|
-
retrospectiveId: string;
|
|
43
|
-
userId?: string;
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
[RetrospectiveSSEEvent.CARD_CREATED]!: {
|
|
47
|
-
retrospectiveId: string;
|
|
48
|
-
card: IRetrospectiveCard;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
[RetrospectiveSSEEvent.CARD_UPDATED]!: {
|
|
52
|
-
retrospectiveId: string;
|
|
53
|
-
card: IRetrospectiveCard;
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
[RetrospectiveSSEEvent.CARD_DELETED]!: {
|
|
57
|
-
retrospectiveId: string;
|
|
58
|
-
cardId: string;
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
[RetrospectiveSSEEvent.SECTION_CREATED]!: {
|
|
62
|
-
retrospectiveId: string;
|
|
63
|
-
section: IRetrospectiveSection;
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
[RetrospectiveSSEEvent.SECTION_UPDATED]!: {
|
|
67
|
-
retrospectiveId: string;
|
|
68
|
-
section: IRetrospectiveSection;
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
[RetrospectiveSSEEvent.SECTION_DELETED]!: {
|
|
72
|
-
retrospectiveId: string;
|
|
73
|
-
sectionId: string;
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
[RetrospectiveSSEEvent.MEMBER_JOINED]!: {
|
|
77
|
-
retrospectiveId: string;
|
|
78
|
-
member: IRetrospectiveMember;
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
[RetrospectiveSSEEvent.MEMBER_UPDATED]!: {
|
|
82
|
-
retrospectiveId: string;
|
|
83
|
-
member: IRetrospectiveMember;
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
[RetrospectiveSSEEvent.MEMBER_LEFT]!: {
|
|
87
|
-
retrospectiveId: string;
|
|
88
|
-
memberId: string;
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export type RetrospectiveSSEEventContent = RetrospectiveSSEMessageContent | SystemSSEMessageContent;
|
|
1
|
+
import { SystemSSEMessageContent } from '..';
|
|
2
|
+
import { ValueOf } from '../../../types';
|
|
3
|
+
import {
|
|
4
|
+
IRetrospective,
|
|
5
|
+
IRetrospectiveCard,
|
|
6
|
+
IRetrospectiveSection,
|
|
7
|
+
IRetrospectiveMember,
|
|
8
|
+
} from '../../../types/interface';
|
|
9
|
+
|
|
10
|
+
export enum RetrospectiveSSEEvent {
|
|
11
|
+
RETROSPECTIVE_UPDATED = 'RETROSPECTIVE_UPDATED',
|
|
12
|
+
RETROSPECTIVE_DELETED = 'RETROSPECTIVE_DELETED',
|
|
13
|
+
CARD_CREATED = 'CARD_CREATED',
|
|
14
|
+
CARD_UPDATED = 'CARD_UPDATED',
|
|
15
|
+
CARD_DELETED = 'CARD_DELETED',
|
|
16
|
+
SECTION_CREATED = 'SECTION_CREATED',
|
|
17
|
+
SECTION_UPDATED = 'SECTION_UPDATED',
|
|
18
|
+
SECTION_DELETED = 'SECTION_DELETED',
|
|
19
|
+
MEMBER_JOINED = 'MEMBER_JOINED',
|
|
20
|
+
MEMBER_UPDATED = 'MEMBER_UPDATED',
|
|
21
|
+
MEMBER_LEFT = 'MEMBER_LEFT',
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export type RetrospectiveSSEMessageContent = ValueOf<
|
|
25
|
+
{
|
|
26
|
+
[K in RetrospectiveSSEEvent]: {
|
|
27
|
+
type: K;
|
|
28
|
+
payload: SourceRetrospectiveSSEEventPayload[K];
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
>;
|
|
32
|
+
|
|
33
|
+
export class SourceRetrospectiveSSEEventPayload
|
|
34
|
+
implements Record<RetrospectiveSSEEvent, Record<string, any>>
|
|
35
|
+
{
|
|
36
|
+
[RetrospectiveSSEEvent.RETROSPECTIVE_UPDATED]!: {
|
|
37
|
+
retrospectiveId: string;
|
|
38
|
+
retrospective: IRetrospective;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
[RetrospectiveSSEEvent.RETROSPECTIVE_DELETED]!: {
|
|
42
|
+
retrospectiveId: string;
|
|
43
|
+
userId?: string;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
[RetrospectiveSSEEvent.CARD_CREATED]!: {
|
|
47
|
+
retrospectiveId: string;
|
|
48
|
+
card: IRetrospectiveCard;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
[RetrospectiveSSEEvent.CARD_UPDATED]!: {
|
|
52
|
+
retrospectiveId: string;
|
|
53
|
+
card: IRetrospectiveCard;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
[RetrospectiveSSEEvent.CARD_DELETED]!: {
|
|
57
|
+
retrospectiveId: string;
|
|
58
|
+
cardId: string;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
[RetrospectiveSSEEvent.SECTION_CREATED]!: {
|
|
62
|
+
retrospectiveId: string;
|
|
63
|
+
section: IRetrospectiveSection;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
[RetrospectiveSSEEvent.SECTION_UPDATED]!: {
|
|
67
|
+
retrospectiveId: string;
|
|
68
|
+
section: IRetrospectiveSection;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
[RetrospectiveSSEEvent.SECTION_DELETED]!: {
|
|
72
|
+
retrospectiveId: string;
|
|
73
|
+
sectionId: string;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
[RetrospectiveSSEEvent.MEMBER_JOINED]!: {
|
|
77
|
+
retrospectiveId: string;
|
|
78
|
+
member: IRetrospectiveMember;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
[RetrospectiveSSEEvent.MEMBER_UPDATED]!: {
|
|
82
|
+
retrospectiveId: string;
|
|
83
|
+
member: IRetrospectiveMember;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
[RetrospectiveSSEEvent.MEMBER_LEFT]!: {
|
|
87
|
+
retrospectiveId: string;
|
|
88
|
+
memberId: string;
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export type RetrospectiveSSEEventContent = RetrospectiveSSEMessageContent | SystemSSEMessageContent;
|
|
@@ -1,73 +1,73 @@
|
|
|
1
|
-
import { Request, Response } from 'express-serve-static-core';
|
|
2
|
-
import { v4 as uuidv4 } from 'uuid';
|
|
3
|
-
import { SYSTEM_PROTOCOL_EVENTS, SystemSSEMessageContent } from './protocols';
|
|
4
|
-
|
|
5
|
-
export class ServerSentEventBaseContext {
|
|
6
|
-
id = uuidv4();
|
|
7
|
-
createdAt = new Date();
|
|
8
|
-
|
|
9
|
-
req!: Request;
|
|
10
|
-
res!: Response;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export type RedisSSEMessage = {
|
|
14
|
-
key: string;
|
|
15
|
-
data: unknown;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export class ServerSentEventsManager<
|
|
19
|
-
T extends ServerSentEventBaseContext,
|
|
20
|
-
P extends { type: string; payload: unknown },
|
|
21
|
-
> {
|
|
22
|
-
private channel: string;
|
|
23
|
-
private contexts: Map<string, Set<T>>;
|
|
24
|
-
|
|
25
|
-
constructor(channelName: string) {
|
|
26
|
-
this.channel = channelName;
|
|
27
|
-
this.contexts = new Map();
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
add(key: string, context: T, onClose: () => void) {
|
|
31
|
-
context.res.setHeader('Content-Type', 'text/event-stream');
|
|
32
|
-
context.res.setHeader('Cache-Control', 'no-cache');
|
|
33
|
-
context.res.setHeader('Connection', 'keep-alive');
|
|
34
|
-
context.res.flushHeaders?.(); // Support Express
|
|
35
|
-
|
|
36
|
-
const row = this.contexts.get(key);
|
|
37
|
-
if (!row) {
|
|
38
|
-
this.contexts.set(key, new Set([context]));
|
|
39
|
-
} else {
|
|
40
|
-
row.add(context);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const pingTimeout = setInterval(() => {
|
|
44
|
-
const payload: SystemSSEMessageContent = {
|
|
45
|
-
type: SYSTEM_PROTOCOL_EVENTS.PING,
|
|
46
|
-
payload: {
|
|
47
|
-
openedAt: context.createdAt.getTime(),
|
|
48
|
-
timestamp: Date.now(),
|
|
49
|
-
},
|
|
50
|
-
};
|
|
51
|
-
context.res.write(`data: ${JSON.stringify(payload)}\n\n`);
|
|
52
|
-
}, 10_000);
|
|
53
|
-
|
|
54
|
-
context.res.on('close', () => {
|
|
55
|
-
clearInterval(pingTimeout);
|
|
56
|
-
onClose();
|
|
57
|
-
const row = this.contexts.get(key);
|
|
58
|
-
row?.delete(context);
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
sendToContext(key: string, data: P, { senderId }: { senderId?: string } = {}): void {
|
|
63
|
-
const payload = JSON.stringify({ ...data, date: new Date() });
|
|
64
|
-
|
|
65
|
-
const clients = this.contexts.get(key);
|
|
66
|
-
clients?.forEach((client) => {
|
|
67
|
-
if (client.id === senderId) {
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
client.res.write(`data: ${payload}\n\n`);
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
}
|
|
1
|
+
import { Request, Response } from 'express-serve-static-core';
|
|
2
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
3
|
+
import { SYSTEM_PROTOCOL_EVENTS, SystemSSEMessageContent } from './protocols';
|
|
4
|
+
|
|
5
|
+
export class ServerSentEventBaseContext {
|
|
6
|
+
id = uuidv4();
|
|
7
|
+
createdAt = new Date();
|
|
8
|
+
|
|
9
|
+
req!: Request;
|
|
10
|
+
res!: Response;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export type RedisSSEMessage = {
|
|
14
|
+
key: string;
|
|
15
|
+
data: unknown;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export class ServerSentEventsManager<
|
|
19
|
+
T extends ServerSentEventBaseContext,
|
|
20
|
+
P extends { type: string; payload: unknown },
|
|
21
|
+
> {
|
|
22
|
+
private channel: string;
|
|
23
|
+
private contexts: Map<string, Set<T>>;
|
|
24
|
+
|
|
25
|
+
constructor(channelName: string) {
|
|
26
|
+
this.channel = channelName;
|
|
27
|
+
this.contexts = new Map();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
add(key: string, context: T, onClose: () => void) {
|
|
31
|
+
context.res.setHeader('Content-Type', 'text/event-stream');
|
|
32
|
+
context.res.setHeader('Cache-Control', 'no-cache');
|
|
33
|
+
context.res.setHeader('Connection', 'keep-alive');
|
|
34
|
+
context.res.flushHeaders?.(); // Support Express
|
|
35
|
+
|
|
36
|
+
const row = this.contexts.get(key);
|
|
37
|
+
if (!row) {
|
|
38
|
+
this.contexts.set(key, new Set([context]));
|
|
39
|
+
} else {
|
|
40
|
+
row.add(context);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const pingTimeout = setInterval(() => {
|
|
44
|
+
const payload: SystemSSEMessageContent = {
|
|
45
|
+
type: SYSTEM_PROTOCOL_EVENTS.PING,
|
|
46
|
+
payload: {
|
|
47
|
+
openedAt: context.createdAt.getTime(),
|
|
48
|
+
timestamp: Date.now(),
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
context.res.write(`data: ${JSON.stringify(payload)}\n\n`);
|
|
52
|
+
}, 10_000);
|
|
53
|
+
|
|
54
|
+
context.res.on('close', () => {
|
|
55
|
+
clearInterval(pingTimeout);
|
|
56
|
+
onClose();
|
|
57
|
+
const row = this.contexts.get(key);
|
|
58
|
+
row?.delete(context);
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
sendToContext(key: string, data: P, { senderId }: { senderId?: string } = {}): void {
|
|
63
|
+
const payload = JSON.stringify({ ...data, date: new Date() });
|
|
64
|
+
|
|
65
|
+
const clients = this.contexts.get(key);
|
|
66
|
+
clients?.forEach((client) => {
|
|
67
|
+
if (client.id === senderId) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
client.res.write(`data: ${payload}\n\n`);
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|