@@ -14,17 +14,36 @@ import type { RawGitHubNotification } from './types';
1414
1515import { getReasonDetails } from '../reason' ;
1616
17+ /**
18+ * Transform all raw notifications from Atlassian types to Atlassify types.
19+ *
20+ * @param rawNotifications - The Atlassian notifications.
21+ * @param account - The account.
22+ * @returns Transformed Atlassify notifications.
23+ */
24+ export function transformNotifications (
25+ rawNotifications : RawGitHubNotification [ ] ,
26+ account : Account ,
27+ ) : GitifyNotification [ ] {
28+ return rawNotifications . map ( ( raw ) => {
29+ return transformNotification ( raw , account ) ;
30+ } ) ;
31+ }
32+
1733/**
1834 * Transform a raw GitHub notification to GitifyNotification.
1935 * Called immediately after REST API response is received.
2036 *
2137 * This is the ONLY place where raw GitHub types should be converted
2238 * to Gitify's internal notification type.
39+ *
40+ * @param raw - The GitHub notification.
41+ * @param account - The account.
42+ * @returns A transformed Gitify notification.
2343 */
24- export function transformNotification (
44+ function transformNotification (
2545 raw : RawGitHubNotification ,
2646 account : Account ,
27- order = 0 ,
2847) : GitifyNotification {
2948 return {
3049 id : raw . id ,
@@ -33,10 +52,9 @@ export function transformNotification(
3352 reason : transformReason ( raw . reason ) ,
3453 subject : transformSubject ( raw . subject ) ,
3554 repository : transformRepository ( raw . repository ) ,
36- account,
37- order,
38- // Display fields start as undefined, populated by formatNotification post-enrichment
39- display : undefined ,
55+ account : account ,
56+ order : 0 , // Will be set later in stabilizeNotificationsOrder
57+ display : undefined , // Display fields start as undefined, populated by formatNotification post-enrichment
4058 } ;
4159}
4260
0 commit comments