@abtnode/blocklet-services 1.16.39-beta-20250218-132815-6baaf20e → 1.16.39-beta-20250220-073620-4f1d9e2b
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/api/libs/push-kit/index.js +2 -2
- package/api/services/notification/notification-queue.js +77 -165
- package/api/socket/channel/did.js +44 -32
- package/dist/assets/{Add-meGhscd6.js → Add-DFSveMnk.js} +1 -1
- package/dist/assets/{ArrowDropDown-B7S4xnEe.js → ArrowDropDown-7bhybSNS.js} +1 -1
- package/dist/assets/{CheckCircle-CnvZ4oB1.js → CheckCircle-v1VkHRMG.js} +1 -1
- package/dist/assets/{ChevronLeft-D1qkw0FM.js → ChevronLeft-DRxUR95x.js} +1 -1
- package/dist/assets/{ChevronRight-CEkTH0up.js → ChevronRight-i646QaQM.js} +1 -1
- package/dist/assets/{DeleteOutline-BjrgG_HY.js → DeleteOutline-Bz_v29yL.js} +1 -1
- package/dist/assets/{Done-7hvoRcVZ.js → Done-DgXsjFiE.js} +1 -1
- package/dist/assets/{Download-CMvqPsK9.js → Download-B4jg-r_R.js} +1 -1
- package/dist/assets/{EditIcon-BOr0kf6I.js → EditIcon-Mm3W5DE6.js} +1 -1
- package/dist/assets/{Error-D3I1nNnO.js → Error-BmZqW6ED.js} +1 -1
- package/dist/assets/{Google-TNOfJ3uU.js → Google-DommwMxL.js} +1 -1
- package/dist/assets/{InfoOutlined-CwoytfGr.js → InfoOutlined-O-yom1i3.js} +1 -1
- package/dist/assets/{Launch-wyBVNKfb.js → Launch-DdeGpTqR.js} +1 -1
- package/dist/assets/{LaunchOutlined-B2ZU9fkg.js → LaunchOutlined-CqCuGAlJ.js} +1 -1
- package/dist/assets/{LockIcon-D-W4Rph6.js → LockIcon-BbWIWjve.js} +1 -1
- package/dist/assets/{Loop-CQAI5rIS.js → Loop-BLtclgGI.js} +1 -1
- package/dist/assets/{MoreHoriz-CyCcv2bV.js → MoreHoriz-ZQMFN5Xr.js} +1 -1
- package/dist/assets/{PlayArrow-B5ZFUKPq.js → PlayArrow-BwPeitOG.js} +1 -1
- package/dist/assets/{QuestionMarkCircle-BvUTckGB.js → QuestionMarkCircle-D5Im4T0u.js} +1 -1
- package/dist/assets/{ServerLogo-BDEZRDcg.js → ServerLogo-DWgX8KHy.js} +1 -1
- package/dist/assets/{ViewList-C8AcRueZ.js → ViewList-DXzyy-yJ.js} +1 -1
- package/dist/assets/access-control-DyE6zHOK.js +13 -0
- package/dist/assets/{actions-C0a0eUYM.js → actions-CnBTZ7ol.js} +1 -1
- package/dist/assets/{add-component-core-CK3SAdlQ.js → add-component-core-D7dzV3Qd.js} +35 -35
- package/dist/assets/add-resource-D05K6Dv6.js +1 -0
- package/dist/assets/{addon-C7fx4MJ0.js → addon-CgdcWRru.js} +1 -1
- package/dist/assets/{analytics-CjaAB5m2.js → analytics-C8YyBJKc.js} +1 -1
- package/dist/assets/ar-CEnzg81O.js +3 -0
- package/dist/assets/{ar-DoIWDL3Q.js → ar-cJwIGRaP.js} +1 -1
- package/dist/assets/{audit-logs-bl5st5Lr.js → audit-logs-P3wQXAao.js} +1 -1
- package/dist/assets/{base32-9oQoOkFy.js → base32-CJh0eRRM.js} +1 -1
- package/dist/assets/branding-Ncf_YrEF.js +40 -0
- package/dist/assets/{bundle-avatar-Dnk7mw7b.js → bundle-avatar-CWErnWDS.js} +1 -1
- package/dist/assets/button-D8dCYKMu.js +1 -0
- package/dist/assets/{click-to-copy-C9X-UQyL.js → click-to-copy-U6qR4HAG.js} +1 -1
- package/dist/assets/{complete-C3yyjx_N.js → complete-CWreL5lV.js} +1 -1
- package/dist/assets/{component-B0WI6_H4.js → component-CVXkLilJ.js} +96 -88
- package/dist/assets/{config-DINcJX6A.js → config-BursEDKY.js} +1 -1
- package/dist/assets/{config-C0wq7rMr.js → config-CEnHCyaW.js} +1 -1
- package/dist/assets/{config-navigation-Dskr7Yic.js → config-navigation-7bbsR1c5.js} +3 -3
- package/dist/assets/{config-space-BYYAVRcS.js → config-space-DWTUkGA7.js} +1 -1
- package/dist/assets/{confirm-BmLsHbj9.js → confirm-R-3mjfrE.js} +1 -1
- package/dist/assets/{connect-hhGPDSK8.js → connect-D99JO5F1.js} +1 -1
- package/dist/assets/{connect-06lWrPrR.js → connect-DeAQgH0y.js} +1 -1
- package/dist/assets/{connect-to-DIJ57-hM.js → connect-to-B_177EMY.js} +1 -1
- package/dist/assets/{content-layout-cWwRTmIc.js → content-layout-CE2kjm54.js} +1 -1
- package/dist/assets/{dashboard-PlqPcVrd.js → dashboard-DvxSnwfd.js} +10 -10
- package/dist/assets/{de-BVgb1fEg.js → de-CwhZYhES.js} +1 -1
- package/dist/assets/de-nDH0KZYC.js +3 -0
- package/dist/assets/delete-confirm-CO-OBmsy.js +1 -0
- package/dist/assets/{did-address-Bl2N44vc.js → did-address-Cg3bCLTF.js} +1 -1
- package/dist/assets/domain-DjAqr47g.js +9 -0
- package/dist/assets/domain-action-card-CtYAFJMQ.js +15 -0
- package/dist/assets/domains-BAkyeUtK.js +1 -0
- package/dist/assets/{email-9CbD02fM.js → email-DubyyWP-.js} +1 -1
- package/dist/assets/{es-CWcVPAna.js → es-Cw5ZN2jL.js} +1 -1
- package/dist/assets/es-NUrGcplI.js +3 -0
- package/dist/assets/{exchange-passport-ZTeqENxf.js → exchange-passport-C0_ELMge.js} +1 -1
- package/dist/assets/{form-text-input-DEadnM80.js → form-text-input-DXbUuC1I.js} +1 -1
- package/dist/assets/fr-8uzI0ztX.js +3 -0
- package/dist/assets/{fr-C8Jr_C8u.js → fr-au5rpiTp.js} +1 -1
- package/dist/assets/{fuel-AxStjHWS.js → fuel-DJOYYGMp.js} +1 -1
- package/dist/assets/{fullpage-BXvfrD1C.js → fullpage-D4VuPAFa.js} +1 -1
- package/dist/assets/{get-safe-url-BVjMxmwp.js → get-safe-url-D9gDTOPT.js} +1 -1
- package/dist/assets/{get-safe-url-BxZD1oA_.js → get-safe-url-DQLIWkQo.js} +1 -1
- package/dist/assets/{hi-DTqZQNNB.js → hi-DBPvM90p.js} +1 -1
- package/dist/assets/hi-DsL0Qpdc.js +1 -0
- package/dist/assets/{home-CrkVy1DG.js → home-dxFc3wRZ.js} +1 -1
- package/dist/assets/id-BbsIe6fu.js +3 -0
- package/dist/assets/{id-CUsGyKYW.js → id-CmJlzYVA.js} +1 -1
- package/dist/assets/{iframe-BcWepstA.js → iframe-6gS_ODJa.js} +1 -1
- package/dist/assets/{index-uYcwdGZL.js → index-B7_xeF0z.js} +21 -21
- package/dist/assets/index-BdfFmrlk.js +52 -0
- package/dist/assets/{index-CDvqNewi.js → index-BkvRoX7I.js} +1 -1
- package/dist/assets/{index-Be9vrMiA.js → index-C3vLeBLv.js} +1 -1
- package/dist/assets/{index-CHFvfli7.js → index-CF4Aobpk.js} +1 -1
- package/dist/assets/{index-BXlJ03I_.js → index-CPQbFQvu.js} +1 -1
- package/dist/assets/{index-DIQ33Q8Z.js → index-CbY5jzJ1.js} +1 -1
- package/dist/assets/index-ClijH1KU.js +228 -0
- package/dist/assets/index-Cx-u2b1r.js +192 -0
- package/dist/assets/{index-DtwN19zv.js → index-DIP3om2u.js} +1 -1
- package/dist/assets/{index-C-D-nCB1.js → index-DQ3_atB3.js} +1 -1
- package/dist/assets/{index-ChSPqVLh.js → index-DcvnbXW2.js} +1 -1
- package/dist/assets/{index-BSC2apzE.js → index-PMG7ikk5.js} +1 -1
- package/dist/assets/index-T6-QS5Qh.js +109 -0
- package/dist/assets/{index-DfBNyFsV.js → index-XGnyowjM.js} +1 -1
- package/dist/assets/{index-DkVoxpR-.js → index-g5Holpv4.js} +7 -7
- package/dist/assets/{index-BBOSdbE7.js → index-jjJ9S0nm.js} +1 -1
- package/dist/assets/{index-DgaUl_lv.js → index-jkazPG2A.js} +1 -1
- package/dist/assets/{index-BtFCAsqh.js → index-oxDvnRnk.js} +1 -1
- package/dist/assets/{invitation-BzHMoDRH.js → invitation-CRTc-7F5.js} +6 -6
- package/dist/assets/{invite-BBcuJaUv.js → invite-BpFDZ5-a.js} +1 -1
- package/dist/assets/{issue-passport-sgBfFZ4Y.js → issue-passport-fnOu8MGg.js} +1 -1
- package/dist/assets/item-C5q00bCP.js +2 -0
- package/dist/assets/{ja-B0U7M2t1.js → ja-DqY-EkRB.js} +1 -1
- package/dist/assets/ja-bjSIThln.js +3 -0
- package/dist/assets/ko-BjX8mQKL.js +3 -0
- package/dist/assets/{ko-CpDA9JjF.js → ko-CZIpaPXf.js} +1 -1
- package/dist/assets/{launch-result-message-keU5grqY.js → launch-result-message-B237vj_f.js} +1 -1
- package/dist/assets/{layout-CGas_HfS.js → layout-DztchTRR.js} +1 -1
- package/dist/assets/{list-cZ-OXxN0.js → list-CM99uwf8.js} +1 -1
- package/dist/assets/{list-header-Dd4BEf4y.js → list-header-Bvl4MqSl.js} +1 -1
- package/dist/assets/localization-Ddv2MmrZ.js +1 -0
- package/dist/assets/{log-BFj6TDz5.js → log-BJ_7gOwg.js} +1 -1
- package/dist/assets/{login-B-6s411x.js → login-Bkg5cKeY.js} +1 -1
- package/dist/assets/login-oauth-callback-5wm53L-h.js +1 -0
- package/dist/assets/{logo-uploader-pyVqJwKp.js → logo-uploader-BDepocdq.js} +3 -3
- package/dist/assets/{lost-passport-DKkxzCH8.js → lost-passport-DPzX8lrb.js} +1 -1
- package/dist/assets/{open-window-Cvetj9Mn.js → open-window-DhCTV7Bc.js} +1 -1
- package/dist/assets/overview-VqjuJhSH.js +12 -0
- package/dist/assets/{page-header--y63DY5K.js → page-header-BltW3zCL.js} +1 -1
- package/dist/assets/{permission-Be_APIVZ.js → permission-BlstaDqI.js} +1 -1
- package/dist/assets/{preferences-D-NDmLhf.js → preferences-DXoyvj-J.js} +1 -1
- package/dist/assets/{pt-7r06GaNd.js → pt-D8E5L8AA.js} +1 -1
- package/dist/assets/pt-FXpLOB0Y.js +1 -0
- package/dist/assets/publish-resource-4NNLT144.js +1 -0
- package/dist/assets/{react-beautiful-dnd.esm-Czr1mmuu.js → react-beautiful-dnd.esm-C4CQz9M9.js} +1 -1
- package/dist/assets/{relative-time-D0P0AJUI.js → relative-time-D6fIGce1.js} +1 -1
- package/dist/assets/ru-BnGih0Ix.js +1 -0
- package/dist/assets/{ru-MS-ksi2g.js → ru-D3jVM1bn.js} +1 -1
- package/dist/assets/sdk-9YRmE3Kk.js +1 -0
- package/dist/assets/{session-CV6ez46v.js → session-BwIJ2AMz.js} +1 -1
- package/dist/assets/setup-XOZiTiWW.js +19 -0
- package/dist/assets/{shorten-label-J69eHfMN.js → shorten-label-la5sIm_0.js} +1 -1
- package/dist/assets/{simple-select-D06JmA0a.js → simple-select-Cu-p9eCv.js} +1 -1
- package/dist/assets/{slicedToArray-CXBLQZX4.js → slicedToArray-DBh5Z78L.js} +2 -2
- package/dist/assets/{start-BjFFihjS.js → start-DqBWR6sD.js} +1 -1
- package/dist/assets/{step-actions-qXq3r5tX.js → step-actions-B0Ln8Y3M.js} +1 -1
- package/dist/assets/{studio-BNGylnt7.js → studio-D2tmKoYZ.js} +1 -1
- package/dist/assets/{switch-control-DmKC0hpm.js → switch-control-DUPDUbJY.js} +1 -1
- package/dist/assets/th-C1ZTykFq.js +1 -0
- package/dist/assets/{th-gcuRSNHo.js → th-PmtZzBF0.js} +1 -1
- package/dist/assets/{traffic-Djmt2Ph8.js → traffic-CtRInz6z.js} +1 -1
- package/dist/assets/{transfer-B9ohZjja.js → transfer-CFQNTYY4.js} +1 -1
- package/dist/assets/{unsubscribe-6xRksnNz.js → unsubscribe-CucwJ1I1.js} +1 -1
- package/dist/assets/{use-mobile-DnWfrhc7.js → use-mobile-B7gJcr5J.js} +1 -1
- package/dist/assets/{useAsync-Ua5iss51.js → useAsync-CEZQNMFX.js} +1 -1
- package/dist/assets/{useAsyncRetry-Bmo6a1Zp.js → useAsyncRetry-BEB-tWmQ.js} +2 -2
- package/dist/assets/{useLocalStorage-B5t6MEw6.js → useLocalStorage-DyOKhTaE.js} +1 -1
- package/dist/assets/{user-center-DEGm9vzv.js → user-center-ByJfst4h.js} +1 -1
- package/dist/assets/{util-Bl4vyFsm.js → util-BpyQ3K0Z.js} +1 -1
- package/dist/assets/util-lWapOC8r.js +1 -0
- package/dist/assets/{vendor-arcblock-BFUPp1Ez.js → vendor-arcblock-EnQG-qe7.js} +14 -14
- package/dist/assets/{vendor-hooks-BKxTDk_P.js → vendor-hooks-ZnvK17j8.js} +2 -2
- package/dist/assets/vendor-mui-core-DrGFkjqr.js +266 -0
- package/dist/assets/{vendor-mui-x-CSUdon8K.js → vendor-mui-x-vjsTA-wt.js} +1 -1
- package/dist/assets/vi-I3mwa-6h.js +1 -0
- package/dist/assets/{vi-CGYOhf_R.js → vi-mGKYGc30.js} +1 -1
- package/dist/assets/wrap-locale-DUxawgkX.js +1 -0
- package/dist/assets/zh-DB42-Qer.js +4 -0
- package/dist/assets/zh-tw-9ERTu6uD.js +3 -0
- package/dist/assets/{zh-tw-BR5CO3an.js → zh-tw-Bq7yIqtg.js} +1 -1
- package/dist/assets/{zh-BYS_9r4v.js → zh-wUbdzdUJ.js} +1 -1
- package/dist/index.html +4 -4
- package/dist/service-worker.js +1 -1
- package/package.json +31 -31
- package/dist/assets/access-control-ClVHa3J1.js +0 -13
- package/dist/assets/add-resource-hs_iM1xk.js +0 -1
- package/dist/assets/ar-BFUPmTkR.js +0 -3
- package/dist/assets/branding-5S3zjZlC.js +0 -40
- package/dist/assets/button-BTVoaDd7.js +0 -1
- package/dist/assets/de-hV0yD3gq.js +0 -3
- package/dist/assets/domain-DDa_Ldun.js +0 -9
- package/dist/assets/domain-list-DXbfS21Z.js +0 -15
- package/dist/assets/es-BcSAobJW.js +0 -3
- package/dist/assets/fr-8qti32p1.js +0 -3
- package/dist/assets/hi-DDEUhQcX.js +0 -1
- package/dist/assets/id-DkUYINLx.js +0 -3
- package/dist/assets/index-BJA4YPaC.js +0 -243
- package/dist/assets/index-CoxJ8G1A.js +0 -77
- package/dist/assets/index-DcfIKM1A.js +0 -9
- package/dist/assets/index-DkufOgYs.js +0 -125
- package/dist/assets/index-MxM82EtU.js +0 -228
- package/dist/assets/item-C5sAxGxS.js +0 -2
- package/dist/assets/ja-C2LP4WQG.js +0 -3
- package/dist/assets/ko-C-DMeONa.js +0 -3
- package/dist/assets/localization-Z_CTe1Z8.js +0 -1
- package/dist/assets/login-oauth-callback-aKbzfltj.js +0 -1
- package/dist/assets/overview-BxbJCUbS.js +0 -12
- package/dist/assets/pt-CbxvF__Z.js +0 -1
- package/dist/assets/publish-resource-CxkiI4_n.js +0 -1
- package/dist/assets/ru-DLHrAeE7.js +0 -1
- package/dist/assets/sdk-NKQJT0FS.js +0 -1
- package/dist/assets/setup-CF2VhAxD.js +0 -19
- package/dist/assets/th-Dil9kwjH.js +0 -1
- package/dist/assets/util-PzCAH0nE.js +0 -1
- package/dist/assets/vendor-mui-core-xF5F4eT7.js +0 -266
- package/dist/assets/vi-B46hyfUM.js +0 -1
- package/dist/assets/wrap-locale-6MxBCfA2.js +0 -1
- package/dist/assets/zh-DWWuPzr1.js +0 -4
- package/dist/assets/zh-tw-Ci21sS2Y.js +0 -3
|
@@ -11,14 +11,14 @@ async function sendPush(receiver, notification, { node, teamDid }) {
|
|
|
11
11
|
const blocklet = await node.getBlocklet({ did: teamDid, useCache: true });
|
|
12
12
|
if (!blocklet) {
|
|
13
13
|
logger.warn(`Failed to get blocklet: ${teamDid}`);
|
|
14
|
-
|
|
14
|
+
throw new Error(`Failed to get blocklet: ${teamDid}`);
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
const config = blocklet.settings?.notification?.pushKit || {};
|
|
18
18
|
|
|
19
19
|
if (!config.enabled || !config.endpoint) {
|
|
20
20
|
// skip send email
|
|
21
|
-
|
|
21
|
+
throw new Error('Push Kit Service is not Enabled.');
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
const pushKitConfig = {
|
|
@@ -60,26 +60,14 @@ const init = ({ node, notificationService }) => {
|
|
|
60
60
|
retryDelay: 0,
|
|
61
61
|
},
|
|
62
62
|
async (job) => {
|
|
63
|
-
const { receiver, notification, sender, options } = job;
|
|
63
|
+
const { receiver, notification, sender, options, isResend } = job;
|
|
64
64
|
|
|
65
65
|
if (!receiver) {
|
|
66
66
|
logger.error('Invalid receiver', { did: receiver });
|
|
67
67
|
throw new Error('Invalid receiver');
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
if (nodeInfo.mode !== NODE_MODES.DEBUG) {
|
|
73
|
-
try {
|
|
74
|
-
await validateNotification(notification);
|
|
75
|
-
} catch (error) {
|
|
76
|
-
logger.error('Failed to validate notification', { error });
|
|
77
|
-
// 抛出错误,阻止后续执行
|
|
78
|
-
throw error;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
if (sender.type === 'server' && !sender.token) {
|
|
70
|
+
if ((sender.type === 'server' || isResend) && !sender.token) {
|
|
83
71
|
sender.token = JWT.sign(sender.appDid, sender.appSk);
|
|
84
72
|
}
|
|
85
73
|
|
|
@@ -97,26 +85,14 @@ const init = ({ node, notificationService }) => {
|
|
|
97
85
|
* Push Kit 推送队列
|
|
98
86
|
*/
|
|
99
87
|
const pushKitPushQueue = createNotificationQueue('send-notification-push', {}, async (job) => {
|
|
100
|
-
const { notification, receiver, sender } = job;
|
|
88
|
+
const { notification, receiver, sender, isResend } = job;
|
|
101
89
|
|
|
102
90
|
if (!receiver) {
|
|
103
91
|
logger.error('Invalid receiver', { did: receiver });
|
|
104
92
|
throw new Error('Invalid receiver');
|
|
105
93
|
}
|
|
106
94
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
if (nodeInfo.mode !== NODE_MODES.DEBUG) {
|
|
110
|
-
try {
|
|
111
|
-
await validateNotification(notification);
|
|
112
|
-
} catch (error) {
|
|
113
|
-
logger.error('Failed to validate notification', { error });
|
|
114
|
-
// 抛出错误,阻止后续执行
|
|
115
|
-
throw error;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
if (sender.type === 'server' && !sender.token) {
|
|
95
|
+
if ((sender.type === 'server' || isResend) && !sender.token) {
|
|
120
96
|
sender.token = JWT.sign(sender.appDid, sender.appSk);
|
|
121
97
|
}
|
|
122
98
|
|
|
@@ -154,26 +130,14 @@ const init = ({ node, notificationService }) => {
|
|
|
154
130
|
throw new Error('Email address is missing. Unable to send email notification');
|
|
155
131
|
}
|
|
156
132
|
|
|
157
|
-
const { notification, sender, teamDid, receivers = [], userInfo } = input;
|
|
133
|
+
const { notification, sender, teamDid, receivers = [], userInfo, isResend } = input;
|
|
158
134
|
|
|
159
135
|
if (!userInfo) {
|
|
160
136
|
logger.error('Invalid receiver', { dids: userInfo.did });
|
|
161
137
|
throw new Error('Invalid receiver');
|
|
162
138
|
}
|
|
163
139
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
if (nodeInfo.mode !== NODE_MODES.DEBUG) {
|
|
167
|
-
try {
|
|
168
|
-
await validateNotification(notification);
|
|
169
|
-
} catch (error) {
|
|
170
|
-
logger.error('Failed to validate notification', { error });
|
|
171
|
-
// 抛出错误,阻止后续执行
|
|
172
|
-
throw error;
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
if (sender.type === 'server' && !sender.token) {
|
|
140
|
+
if ((sender.type === 'server' || isResend) && !sender.token) {
|
|
177
141
|
sender.token = JWT.sign(sender.appDid, sender.appSk);
|
|
178
142
|
}
|
|
179
143
|
|
|
@@ -227,35 +191,23 @@ const init = ({ node, notificationService }) => {
|
|
|
227
191
|
throw new Error('Invalid job');
|
|
228
192
|
}
|
|
229
193
|
|
|
230
|
-
const { notification, webhook, sender, receivers = [] } = input;
|
|
194
|
+
const { notification, webhook, sender, receivers = [], isResend } = input;
|
|
231
195
|
|
|
232
196
|
if (!receivers.length) {
|
|
233
197
|
logger.error('Invalid receiver', { dids: receivers });
|
|
234
198
|
throw new Error('Invalid receiver');
|
|
235
199
|
}
|
|
236
200
|
|
|
237
|
-
const nodeInfo = await node.getNodeInfo({ useCache: true });
|
|
238
|
-
|
|
239
|
-
if (nodeInfo.mode !== NODE_MODES.DEBUG) {
|
|
240
|
-
try {
|
|
241
|
-
await validateNotification(notification);
|
|
242
|
-
} catch (error) {
|
|
243
|
-
logger.error('Failed to validate notification', { error });
|
|
244
|
-
// 抛出错误,阻止后续执行
|
|
245
|
-
throw error;
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
|
|
249
201
|
if (!webhook || !webhook.url) {
|
|
250
202
|
logger.error('Invalid webhook', { webhook });
|
|
251
203
|
throw new Error('Invalid webhook');
|
|
252
204
|
}
|
|
253
205
|
|
|
254
|
-
if (sender.type === 'server' && !sender.token) {
|
|
206
|
+
if ((sender.type === 'server' || isResend) && !sender.token) {
|
|
255
207
|
sender.token = JWT.sign(sender.appDid, sender.appSk);
|
|
256
208
|
}
|
|
257
209
|
|
|
258
|
-
notificationService.sendToWebhook.exec({
|
|
210
|
+
await notificationService.sendToWebhook.exec({
|
|
259
211
|
sender,
|
|
260
212
|
receiver: receivers,
|
|
261
213
|
notification: {
|
|
@@ -269,7 +221,7 @@ const init = ({ node, notificationService }) => {
|
|
|
269
221
|
}
|
|
270
222
|
);
|
|
271
223
|
|
|
272
|
-
const insertToEmailPushQueue = (props, nodeInfo,
|
|
224
|
+
const insertToEmailPushQueue = (props, nodeInfo, isResend) => {
|
|
273
225
|
const { channels, notification, sender, userInfo, teamDid } = props;
|
|
274
226
|
|
|
275
227
|
const commonParams = {
|
|
@@ -286,14 +238,14 @@ const init = ({ node, notificationService }) => {
|
|
|
286
238
|
|
|
287
239
|
const channelEnabled = emailEnabled && channels.includes(NOTIFICATION_SEND_CHANNEL.EMAIL);
|
|
288
240
|
|
|
289
|
-
const { receivers, pushUser } = emailMap.get(email) || { receivers: [], pushUser: {} };
|
|
241
|
+
// const { receivers, pushUser } = emailMap.get(email) || { receivers: [], pushUser: {} };
|
|
290
242
|
|
|
291
|
-
const pushUserDid = getWalletDid(pushUser) || pushUser.did;
|
|
243
|
+
// const pushUserDid = getWalletDid(pushUser) || pushUser.did;
|
|
292
244
|
|
|
293
|
-
// 如果 receivers 中已经存在 receiverDid,并且 pushUserDid 和 receiverDid 不一致,则不发送
|
|
294
|
-
if (receivers.includes(receiverDid) && pushUserDid !== receiverDid) {
|
|
295
|
-
|
|
296
|
-
}
|
|
245
|
+
// // 如果 receivers 中已经存在 receiverDid,并且 pushUserDid 和 receiverDid 不一致,则不发送
|
|
246
|
+
// if (receivers.includes(receiverDid) && pushUserDid !== receiverDid) {
|
|
247
|
+
// return;
|
|
248
|
+
// }
|
|
297
249
|
|
|
298
250
|
if (channelEnabled && email) {
|
|
299
251
|
const _userInfo = {
|
|
@@ -309,27 +261,32 @@ const init = ({ node, notificationService }) => {
|
|
|
309
261
|
notification,
|
|
310
262
|
sender,
|
|
311
263
|
teamDid,
|
|
312
|
-
receivers,
|
|
264
|
+
receivers: [receiverDid],
|
|
313
265
|
userInfo: _userInfo,
|
|
266
|
+
isResend,
|
|
314
267
|
},
|
|
315
268
|
},
|
|
316
269
|
delay: 5,
|
|
317
270
|
});
|
|
318
271
|
} else {
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
272
|
+
// eslint-disable-next-line no-lonely-if
|
|
273
|
+
if (!isResend) {
|
|
274
|
+
updateNotificationSendStatus({
|
|
275
|
+
...commonParams,
|
|
276
|
+
email,
|
|
277
|
+
receivers: [receiverDid],
|
|
278
|
+
channel: NOTIFICATION_SEND_CHANNEL.EMAIL,
|
|
279
|
+
status: NOTIFICATION_SEND_STATUS.FAILED,
|
|
280
|
+
failedReason:
|
|
281
|
+
!emailEnabled || !email
|
|
282
|
+
? NOTIFICATION_SEND_FAILED_REASON.USER_DISABLED
|
|
283
|
+
: NOTIFICATION_SEND_FAILED_REASON.CHANNEL_DISABLED,
|
|
284
|
+
});
|
|
285
|
+
}
|
|
329
286
|
}
|
|
330
287
|
};
|
|
331
288
|
|
|
332
|
-
const insertToWebhookPushQueue = async (props, nodeInfo,
|
|
289
|
+
const insertToWebhookPushQueue = async (props, nodeInfo, isResend) => {
|
|
333
290
|
const { channels, notification, sender, userInfo, teamDid } = props;
|
|
334
291
|
|
|
335
292
|
const receiverDid = getWalletDid(userInfo) || userInfo.did;
|
|
@@ -347,30 +304,11 @@ const init = ({ node, notificationService }) => {
|
|
|
347
304
|
webhooks = await getServerWebhooks();
|
|
348
305
|
}
|
|
349
306
|
|
|
350
|
-
const webhookList = uniqBy(webhooks, 'url')
|
|
351
|
-
.map((webhook) => {
|
|
352
|
-
const { url, type } = webhook;
|
|
353
|
-
const { receivers, pushUser } = webhookMap.get(url) || {
|
|
354
|
-
type: type ?? 'api',
|
|
355
|
-
receivers: [],
|
|
356
|
-
pushUser: {},
|
|
357
|
-
};
|
|
358
|
-
const pushUserDid = getWalletDid(pushUser) || pushUser.did;
|
|
359
|
-
if (receivers.includes(receiverDid) && pushUserDid !== receiverDid) {
|
|
360
|
-
return false;
|
|
361
|
-
}
|
|
362
|
-
return {
|
|
363
|
-
url,
|
|
364
|
-
type,
|
|
365
|
-
receivers,
|
|
366
|
-
pushUser,
|
|
367
|
-
};
|
|
368
|
-
})
|
|
369
|
-
.filter(Boolean);
|
|
307
|
+
const webhookList = uniqBy(webhooks, 'url');
|
|
370
308
|
|
|
371
309
|
if (webhookList.length > 0 && channels.includes(NOTIFICATION_SEND_CHANNEL.WEBHOOK)) {
|
|
372
310
|
for (const webhook of webhookList) {
|
|
373
|
-
const { url, type
|
|
311
|
+
const { url, type } = webhook;
|
|
374
312
|
webhookQueue.push({
|
|
375
313
|
job: {
|
|
376
314
|
url,
|
|
@@ -378,7 +316,8 @@ const init = ({ node, notificationService }) => {
|
|
|
378
316
|
input: {
|
|
379
317
|
notification,
|
|
380
318
|
sender,
|
|
381
|
-
receivers:
|
|
319
|
+
receivers: [receiverDid],
|
|
320
|
+
isResend,
|
|
382
321
|
webhook: {
|
|
383
322
|
url,
|
|
384
323
|
type,
|
|
@@ -390,10 +329,10 @@ const init = ({ node, notificationService }) => {
|
|
|
390
329
|
}
|
|
391
330
|
} else {
|
|
392
331
|
// eslint-disable-next-line no-lonely-if
|
|
393
|
-
if (webhookList.length > 0) {
|
|
332
|
+
if (webhookList.length > 0 && !isResend) {
|
|
394
333
|
const webhookParams = {};
|
|
395
334
|
|
|
396
|
-
for (const { url, type
|
|
335
|
+
for (const { url, type } of webhookList) {
|
|
397
336
|
webhookParams[url] = {
|
|
398
337
|
type,
|
|
399
338
|
sendAt: new Date(),
|
|
@@ -404,7 +343,7 @@ const init = ({ node, notificationService }) => {
|
|
|
404
343
|
// eslint-disable-next-line no-await-in-loop
|
|
405
344
|
await updateNotificationSendStatus({
|
|
406
345
|
...commonParams,
|
|
407
|
-
receivers:
|
|
346
|
+
receivers: [receiverDid],
|
|
408
347
|
channel: NOTIFICATION_SEND_CHANNEL.WEBHOOK,
|
|
409
348
|
status: NOTIFICATION_SEND_STATUS.FAILED,
|
|
410
349
|
webhookParams: { [url]: webhookParams[url] },
|
|
@@ -414,7 +353,7 @@ const init = ({ node, notificationService }) => {
|
|
|
414
353
|
}
|
|
415
354
|
};
|
|
416
355
|
|
|
417
|
-
const insertToPushKitPushQueue = (props, nodeInfo) => {
|
|
356
|
+
const insertToPushKitPushQueue = (props, nodeInfo, isResend) => {
|
|
418
357
|
const { channels, notification, sender, userInfo, teamDid, options = {} } = props;
|
|
419
358
|
|
|
420
359
|
const receiverDid = getWalletDid(userInfo) || userInfo.did;
|
|
@@ -431,21 +370,25 @@ const init = ({ node, notificationService }) => {
|
|
|
431
370
|
sender,
|
|
432
371
|
options,
|
|
433
372
|
receiver: receiverDid,
|
|
373
|
+
isResend,
|
|
434
374
|
});
|
|
435
375
|
} else {
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
:
|
|
444
|
-
|
|
376
|
+
// eslint-disable-next-line no-lonely-if
|
|
377
|
+
if (!isResend) {
|
|
378
|
+
updateNotificationSendStatus({
|
|
379
|
+
...commonParams,
|
|
380
|
+
receivers: [receiverDid],
|
|
381
|
+
channel: NOTIFICATION_SEND_CHANNEL.PUSH,
|
|
382
|
+
status: NOTIFICATION_SEND_STATUS.FAILED,
|
|
383
|
+
failedReason: !pushEnabled
|
|
384
|
+
? NOTIFICATION_SEND_FAILED_REASON.CHANNEL_DISABLED
|
|
385
|
+
: NOTIFICATION_SEND_FAILED_REASON.USER_DISABLED,
|
|
386
|
+
});
|
|
387
|
+
}
|
|
445
388
|
}
|
|
446
389
|
};
|
|
447
390
|
|
|
448
|
-
const insertToWalletPushQueue = (props, nodeInfo) => {
|
|
391
|
+
const insertToWalletPushQueue = (props, nodeInfo, isResend) => {
|
|
449
392
|
const { channels, notification, sender, userInfo, teamDid, options = {} } = props;
|
|
450
393
|
|
|
451
394
|
const receiverDid = getWalletDid(userInfo) || userInfo.did;
|
|
@@ -463,21 +406,26 @@ const init = ({ node, notificationService }) => {
|
|
|
463
406
|
sender,
|
|
464
407
|
options,
|
|
465
408
|
receiver: receiverDid,
|
|
409
|
+
isResend,
|
|
466
410
|
});
|
|
467
411
|
} else {
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
:
|
|
476
|
-
|
|
412
|
+
// 如果是重发的消息,只需要更新推送状态,不需要更新 channel状态
|
|
413
|
+
// eslint-disable-next-line no-lonely-if
|
|
414
|
+
if (!isResend) {
|
|
415
|
+
updateNotificationSendStatus({
|
|
416
|
+
...commonParams,
|
|
417
|
+
receivers: [receiverDid],
|
|
418
|
+
channel: NOTIFICATION_SEND_CHANNEL.WALLET,
|
|
419
|
+
status: NOTIFICATION_SEND_STATUS.FAILED,
|
|
420
|
+
failedReason: !walletEnabled
|
|
421
|
+
? NOTIFICATION_SEND_FAILED_REASON.CHANNEL_DISABLED
|
|
422
|
+
: NOTIFICATION_SEND_FAILED_REASON.USER_DISABLED,
|
|
423
|
+
});
|
|
424
|
+
}
|
|
477
425
|
}
|
|
478
426
|
};
|
|
479
427
|
|
|
480
|
-
const insertToNotificationReceiver = async (nodeInfo, userInfo, teamDid, notificationId
|
|
428
|
+
const insertToNotificationReceiver = async (nodeInfo, userInfo, teamDid, notificationId) => {
|
|
481
429
|
const receiverDid = getWalletDid(userInfo) || userInfo.did;
|
|
482
430
|
|
|
483
431
|
const receiverInstance = {
|
|
@@ -488,7 +436,7 @@ const init = ({ node, notificationService }) => {
|
|
|
488
436
|
const emailEnabled = get(userInfo, 'extra.notifications.email', true);
|
|
489
437
|
const email = userInfo?.email;
|
|
490
438
|
|
|
491
|
-
if (emailEnabled && email
|
|
439
|
+
if (emailEnabled && email) {
|
|
492
440
|
receiverInstance.email = email;
|
|
493
441
|
}
|
|
494
442
|
const isServer = teamDid === nodeInfo.did;
|
|
@@ -504,7 +452,7 @@ const init = ({ node, notificationService }) => {
|
|
|
504
452
|
}
|
|
505
453
|
});
|
|
506
454
|
|
|
507
|
-
if (webhookMap.size > 0
|
|
455
|
+
if (webhookMap.size > 0) {
|
|
508
456
|
receiverInstance.webhookUrls = Array.from(webhookMap.keys()).join('#');
|
|
509
457
|
}
|
|
510
458
|
|
|
@@ -523,8 +471,7 @@ const init = ({ node, notificationService }) => {
|
|
|
523
471
|
* }
|
|
524
472
|
*/
|
|
525
473
|
const queue = createNotificationQueue('notification-receivers', {}, async (job) => {
|
|
526
|
-
const { teamDid, channels, receiver, sender, notification, nodeInfo, userInfo,
|
|
527
|
-
job;
|
|
474
|
+
const { teamDid, channels, receiver, sender, notification, nodeInfo, userInfo, ...rest } = job;
|
|
528
475
|
|
|
529
476
|
try {
|
|
530
477
|
if (!userInfo) {
|
|
@@ -550,27 +497,27 @@ const init = ({ node, notificationService }) => {
|
|
|
550
497
|
// 每个渠道之间的推送不会影响
|
|
551
498
|
// 添加到 wallet 推送队列
|
|
552
499
|
try {
|
|
553
|
-
insertToWalletPushQueue(baseParams, nodeInfo);
|
|
500
|
+
insertToWalletPushQueue(baseParams, nodeInfo, job.isExist);
|
|
554
501
|
} catch (error) {
|
|
555
502
|
logger.error('Failed to insert to wallet push queue', { error });
|
|
556
503
|
}
|
|
557
504
|
// 添加到 push 推送队列
|
|
558
505
|
try {
|
|
559
|
-
insertToPushKitPushQueue(baseParams, nodeInfo);
|
|
506
|
+
insertToPushKitPushQueue(baseParams, nodeInfo, job.isExist);
|
|
560
507
|
} catch (error) {
|
|
561
508
|
logger.error('Failed to insert to push kit push queue', { error });
|
|
562
509
|
}
|
|
563
510
|
|
|
564
511
|
// 添加到 email 推送队列
|
|
565
512
|
try {
|
|
566
|
-
insertToEmailPushQueue(baseParams, nodeInfo,
|
|
513
|
+
insertToEmailPushQueue(baseParams, nodeInfo, job.isExist);
|
|
567
514
|
} catch (error) {
|
|
568
515
|
logger.error('Failed to insert to email push queue', { error });
|
|
569
516
|
}
|
|
570
517
|
|
|
571
518
|
//
|
|
572
519
|
try {
|
|
573
|
-
insertToWebhookPushQueue(baseParams, nodeInfo,
|
|
520
|
+
insertToWebhookPushQueue(baseParams, nodeInfo, job.isExist);
|
|
574
521
|
} catch (error) {
|
|
575
522
|
logger.error('Failed to insert to webhook push queue', { error });
|
|
576
523
|
}
|
|
@@ -609,45 +556,12 @@ const init = ({ node, notificationService }) => {
|
|
|
609
556
|
type: 'server',
|
|
610
557
|
};
|
|
611
558
|
|
|
612
|
-
const isServer = teamDid === nodeInfo.did;
|
|
613
|
-
|
|
614
559
|
const users = await node.getNotificationReceivers({
|
|
615
560
|
teamDid,
|
|
616
561
|
userDids: receivers,
|
|
617
562
|
enableConnectedAccounts: true,
|
|
618
563
|
});
|
|
619
564
|
|
|
620
|
-
const webhookMap = new Map();
|
|
621
|
-
const emailMap = new Map();
|
|
622
|
-
const serverWebhooks = await getServerWebhooks();
|
|
623
|
-
|
|
624
|
-
users.forEach((userInfo) => {
|
|
625
|
-
const receiverDid = getWalletDid(userInfo) || userInfo.did;
|
|
626
|
-
|
|
627
|
-
// 获取 email 列表
|
|
628
|
-
const { email } = userInfo;
|
|
629
|
-
const enabledEmail = get(userInfo, 'extra.notifications.email', true);
|
|
630
|
-
if (enabledEmail && email) {
|
|
631
|
-
const emailEntry = emailMap.get(email) || { receivers: [], pushUser: userInfo };
|
|
632
|
-
emailEntry.receivers = [...emailEntry.receivers, receiverDid];
|
|
633
|
-
emailEntry.pushUser = userInfo;
|
|
634
|
-
emailMap.set(email, emailEntry);
|
|
635
|
-
}
|
|
636
|
-
|
|
637
|
-
// 获取 webhook 列表
|
|
638
|
-
const webhooks = isServer ? serverWebhooks : get(userInfo, 'extra.webhooks', []);
|
|
639
|
-
webhooks.forEach((webhook) => {
|
|
640
|
-
const webhookEntry = webhookMap.get(webhook.url) || {
|
|
641
|
-
type: webhook.type ?? 'api',
|
|
642
|
-
receivers: [],
|
|
643
|
-
pushUser: userInfo,
|
|
644
|
-
};
|
|
645
|
-
webhookEntry.receivers = [...webhookEntry.receivers, receiverDid];
|
|
646
|
-
webhookEntry.pushUser = userInfo;
|
|
647
|
-
webhookMap.set(webhook.url, webhookEntry);
|
|
648
|
-
});
|
|
649
|
-
});
|
|
650
|
-
|
|
651
565
|
users.forEach((userInfo) => {
|
|
652
566
|
const receiverDid = getWalletDid(userInfo) || userInfo.did;
|
|
653
567
|
queue.push({
|
|
@@ -658,8 +572,6 @@ const init = ({ node, notificationService }) => {
|
|
|
658
572
|
sender,
|
|
659
573
|
nodeInfo,
|
|
660
574
|
userInfo,
|
|
661
|
-
emailMap,
|
|
662
|
-
webhookMap,
|
|
663
575
|
});
|
|
664
576
|
});
|
|
665
577
|
} catch (error) {
|
|
@@ -40,6 +40,7 @@ const updateNotificationSendStatus = async ({
|
|
|
40
40
|
status,
|
|
41
41
|
failedReason = '',
|
|
42
42
|
webhookParams = {},
|
|
43
|
+
email = '',
|
|
43
44
|
}) => {
|
|
44
45
|
if (!node || !notificationId || !receivers.length) {
|
|
45
46
|
return undefined;
|
|
@@ -68,12 +69,7 @@ const updateNotificationSendStatus = async ({
|
|
|
68
69
|
[at]: new Date(),
|
|
69
70
|
...(failedReason ? { [reasonField]: failedReason } : {}),
|
|
70
71
|
};
|
|
71
|
-
|
|
72
|
-
receivers,
|
|
73
|
-
teamDid,
|
|
74
|
-
notificationId,
|
|
75
|
-
updates,
|
|
76
|
-
};
|
|
72
|
+
|
|
77
73
|
updates.record = {
|
|
78
74
|
field: recordField,
|
|
79
75
|
content: {
|
|
@@ -83,6 +79,20 @@ const updateNotificationSendStatus = async ({
|
|
|
83
79
|
},
|
|
84
80
|
};
|
|
85
81
|
|
|
82
|
+
if (channel === NOTIFICATION_SEND_CHANNEL.EMAIL) {
|
|
83
|
+
if (!email) {
|
|
84
|
+
throw new Error('Invalid email: empty');
|
|
85
|
+
}
|
|
86
|
+
updates.email = email;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const updateParams = {
|
|
90
|
+
receivers,
|
|
91
|
+
teamDid,
|
|
92
|
+
notificationId,
|
|
93
|
+
updates,
|
|
94
|
+
};
|
|
95
|
+
|
|
86
96
|
const res = await node.updateNotificationStatus(updateParams);
|
|
87
97
|
return res;
|
|
88
98
|
};
|
|
@@ -132,18 +142,19 @@ const sendToUserDid = async ({ sender, receiver: rawDid, notification, options,
|
|
|
132
142
|
|
|
133
143
|
await Promise.all(
|
|
134
144
|
notifications.map((_notification) => {
|
|
145
|
+
// 如果是 passthrough hi connect,则不创建通知,只需要通知 wallet
|
|
135
146
|
const pushOnly = ['passthrough', 'connect', 'hi'].includes(_notification.type?.toLowerCase());
|
|
136
147
|
|
|
137
148
|
return node.createNotification({
|
|
138
149
|
teamDid,
|
|
139
|
-
|
|
150
|
+
..._notification,
|
|
140
151
|
receiver: rawDid,
|
|
141
152
|
componentDid: sender.componentDid,
|
|
142
153
|
// 这两个字段用于 socket 通知
|
|
143
154
|
entityType: notification.entityType || 'blocklet',
|
|
144
155
|
entityId: notification.entityId || sender.appDid,
|
|
145
156
|
source: notification.source || 'component',
|
|
146
|
-
channels,
|
|
157
|
+
channels: pushOnly ? [NOTIFICATION_SEND_CHANNEL.WALLET] : channels,
|
|
147
158
|
sender,
|
|
148
159
|
options: { ...rest },
|
|
149
160
|
pushOnly,
|
|
@@ -289,7 +300,7 @@ const sendToWebhook = async ({ sender, receiver, notification, node }) => {
|
|
|
289
300
|
const webhooks = appInfo?.webhooks ?? [];
|
|
290
301
|
const receivers = Array.isArray(receiver) ? receiver : [receiver];
|
|
291
302
|
if (!webhooks.length) {
|
|
292
|
-
throw new Error('Invalid webhook: empty');
|
|
303
|
+
throw new Error('Invalid webhook: empty target');
|
|
293
304
|
}
|
|
294
305
|
if (webhooks.every((webhook) => !webhook.url)) {
|
|
295
306
|
throw new Error('Invalid webhook: url empty');
|
|
@@ -306,8 +317,8 @@ const sendToWebhook = async ({ sender, receiver, notification, node }) => {
|
|
|
306
317
|
const notifications = parseNotification({ id, ...rest }, senderInfo);
|
|
307
318
|
const webhookSenderMap = new Map();
|
|
308
319
|
|
|
309
|
-
|
|
310
|
-
|
|
320
|
+
const webhookList = webhooks.filter((w) => w.url);
|
|
321
|
+
const webhookPromises = webhookList.map(async (webhook) => {
|
|
311
322
|
let webhookSender = webhookSenderMap.get(webhook.type);
|
|
312
323
|
if (!webhookSender) {
|
|
313
324
|
webhookSender = node.getMessageSender(webhook.type);
|
|
@@ -320,14 +331,12 @@ const sendToWebhook = async ({ sender, receiver, notification, node }) => {
|
|
|
320
331
|
},
|
|
321
332
|
};
|
|
322
333
|
try {
|
|
323
|
-
// eslint-disable-next-line no-await-in-loop
|
|
324
334
|
const res = await webhookSender.sendNotification(webhook.url, notifications[0]);
|
|
325
335
|
webhookParams[webhook.url] = {
|
|
326
336
|
...webhookParams[webhook.url],
|
|
327
337
|
status: res ? NOTIFICATION_SEND_STATUS.SENT : NOTIFICATION_SEND_STATUS.FAILED,
|
|
328
338
|
failedReason: res ? '' : NOTIFICATION_SEND_FAILED_REASON.CHANNEL_UNAVAILABLE,
|
|
329
339
|
};
|
|
330
|
-
// eslint-disable-next-line no-await-in-loop
|
|
331
340
|
await updateNotificationSendStatus({
|
|
332
341
|
node,
|
|
333
342
|
teamDid,
|
|
@@ -344,7 +353,6 @@ const sendToWebhook = async ({ sender, receiver, notification, node }) => {
|
|
|
344
353
|
status: NOTIFICATION_SEND_STATUS.FAILED,
|
|
345
354
|
failedReason: error.message,
|
|
346
355
|
};
|
|
347
|
-
// eslint-disable-next-line no-await-in-loop
|
|
348
356
|
await updateNotificationSendStatus({
|
|
349
357
|
node,
|
|
350
358
|
teamDid,
|
|
@@ -357,8 +365,9 @@ const sendToWebhook = async ({ sender, receiver, notification, node }) => {
|
|
|
357
365
|
err.details = error;
|
|
358
366
|
throw err;
|
|
359
367
|
}
|
|
360
|
-
}
|
|
361
|
-
|
|
368
|
+
});
|
|
369
|
+
|
|
370
|
+
return Promise.all(webhookPromises);
|
|
362
371
|
};
|
|
363
372
|
|
|
364
373
|
/**
|
|
@@ -402,7 +411,6 @@ const sendToMail = async ({ sender, receiver, notification, options, node }) =>
|
|
|
402
411
|
|
|
403
412
|
const senderInfo = await ensureSenderApp({ sender, node, nodeInfo });
|
|
404
413
|
|
|
405
|
-
// 发送消息前要移除 appInfo 内容。否则邮件中没有 blocklet 的信息
|
|
406
414
|
const notifications = parseNotification({ id, ...rest }, senderInfo);
|
|
407
415
|
|
|
408
416
|
const { locale = 'en' } = options || {};
|
|
@@ -419,21 +427,24 @@ const sendToMail = async ({ sender, receiver, notification, options, node }) =>
|
|
|
419
427
|
);
|
|
420
428
|
return results.map((item) => {
|
|
421
429
|
if (!isServer && (receiverDid || sameEmailReceivers.length > 0)) {
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
?
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
430
|
+
receivers.forEach((email) => {
|
|
431
|
+
updateNotificationSendStatus({
|
|
432
|
+
node,
|
|
433
|
+
teamDid,
|
|
434
|
+
email,
|
|
435
|
+
notificationId: id,
|
|
436
|
+
receivers: sameEmailReceivers.length > 0 ? sameEmailReceivers : [receiverDid],
|
|
437
|
+
channel: NOTIFICATION_SEND_CHANNEL.EMAIL,
|
|
438
|
+
status: item.status === 'rejected' ? NOTIFICATION_SEND_STATUS.FAILED : NOTIFICATION_SEND_STATUS.SENT,
|
|
439
|
+
...(item.status === 'rejected'
|
|
440
|
+
? {
|
|
441
|
+
failedReason:
|
|
442
|
+
item.reason instanceof Error
|
|
443
|
+
? item.reason?.message
|
|
444
|
+
: item.reason || NOTIFICATION_SEND_FAILED_REASON.CHANNEL_UNAVAILABLE,
|
|
445
|
+
}
|
|
446
|
+
: {}),
|
|
447
|
+
});
|
|
437
448
|
});
|
|
438
449
|
}
|
|
439
450
|
if (item.status === 'rejected') {
|
|
@@ -505,6 +516,7 @@ const sendToPush = async ({ sender, receiver, notification, options, node }) =>
|
|
|
505
516
|
status: NOTIFICATION_SEND_STATUS.FAILED,
|
|
506
517
|
failedReason: err.message,
|
|
507
518
|
});
|
|
519
|
+
throw err;
|
|
508
520
|
});
|
|
509
521
|
};
|
|
510
522
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a1 as r,j as a}from"./vendor-mui-core-
|
|
1
|
+
import{a1 as r,j as a}from"./vendor-mui-core-DrGFkjqr.js";import{a0 as t}from"./vendor-arcblock-EnQG-qe7.js";var e={},o=r;Object.defineProperty(e,"__esModule",{value:!0});var u=e.default=void 0,d=o(t()),v=a;u=e.default=(0,d.default)((0,v.jsx)("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6z"}),"Add");export{u as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a1 as r,j as a}from"./vendor-mui-core-
|
|
1
|
+
import{a1 as r,j as a}from"./vendor-mui-core-DrGFkjqr.js";import{a0 as t}from"./vendor-arcblock-EnQG-qe7.js";var e={},o=r;Object.defineProperty(e,"__esModule",{value:!0});var u=e.default=void 0,i=o(t()),p=a;u=e.default=(0,i.default)((0,p.jsx)("path",{d:"m7 10 5 5 5-5z"}),"ArrowDropDown");export{u as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a1 as r,j as a}from"./vendor-mui-core-
|
|
1
|
+
import{a1 as r,j as a}from"./vendor-mui-core-DrGFkjqr.js";import{a0 as t}from"./vendor-arcblock-EnQG-qe7.js";var e={},o=r;Object.defineProperty(e,"__esModule",{value:!0});var u=e.default=void 0,i=o(t()),l=a;u=e.default=(0,i.default)((0,l.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m-2 15-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8z"}),"CheckCircle");export{u as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a1 as r,j as t}from"./vendor-mui-core-
|
|
1
|
+
import{a1 as r,j as t}from"./vendor-mui-core-DrGFkjqr.js";import{a0 as a}from"./vendor-arcblock-EnQG-qe7.js";var e={},o=r;Object.defineProperty(e,"__esModule",{value:!0});var u=e.default=void 0,f=o(a()),i=t;u=e.default=(0,f.default)((0,i.jsx)("path",{d:"M15.41 7.41 14 6l-6 6 6 6 1.41-1.41L10.83 12z"}),"ChevronLeft");export{u as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a1 as r,j as t}from"./vendor-mui-core-
|
|
1
|
+
import{a1 as r,j as t}from"./vendor-mui-core-DrGFkjqr.js";import{a0 as a}from"./vendor-arcblock-EnQG-qe7.js";var e={},o=r;Object.defineProperty(e,"__esModule",{value:!0});var u=e.default=void 0,i=o(a()),v=t;u=e.default=(0,i.default)((0,v.jsx)("path",{d:"M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"}),"ChevronRight");export{u as d};
|