@blocklet/sdk 1.16.24-beta-6975c2c0 → 1.16.24-beta-30f58f8d
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.
|
@@ -2,6 +2,7 @@ import { TNotification, TNotificationInput, TSendOptions } from '../types/notifi
|
|
|
2
2
|
export type TNotificationSender = {
|
|
3
3
|
appDid: string;
|
|
4
4
|
appSk: string;
|
|
5
|
+
type?: 'server' | 'blocklet';
|
|
5
6
|
};
|
|
6
7
|
/**
|
|
7
8
|
* @param {String|Array} receiver
|
|
@@ -14,12 +15,12 @@ export type TNotificationSender = {
|
|
|
14
15
|
* @param {Object} options
|
|
15
16
|
* @returns
|
|
16
17
|
*/
|
|
17
|
-
declare const sendToUser: (receiver: string | string[], notification: TNotification | TNotificationInput, { appDid, appSk }: TNotificationSender, port?: string, options?: {}, pathname?: string) => Promise<any>;
|
|
18
|
+
declare const sendToUser: (receiver: string | string[], notification: TNotification | TNotificationInput, { appDid, appSk, type }: TNotificationSender, port?: string, options?: {}, pathname?: string) => Promise<any>;
|
|
18
19
|
declare const sendToAppChannel: (channel: string, event: string, notification: TNotificationInput, { appDid, appSk }: TNotificationSender, port?: string, options?: TSendOptions) => Promise<any>;
|
|
19
20
|
declare const sendToRelay: (topic: string, event: string, data: any, { appDid, appSk }: TNotificationSender, port?: string) => Promise<any>;
|
|
20
21
|
export { sendToUser, sendToAppChannel, sendToRelay };
|
|
21
22
|
declare const _default: {
|
|
22
|
-
sendToUser: (receiver: string | string[], notification: TNotification | TNotificationInput, { appDid, appSk }: TNotificationSender, port?: string, options?: {}, pathname?: string) => Promise<any>;
|
|
23
|
+
sendToUser: (receiver: string | string[], notification: TNotification | TNotificationInput, { appDid, appSk, type }: TNotificationSender, port?: string, options?: {}, pathname?: string) => Promise<any>;
|
|
23
24
|
sendToAppChannel: (channel: string, event: string, notification: TNotificationInput, { appDid, appSk }: TNotificationSender, port?: string, options?: TSendOptions) => Promise<any>;
|
|
24
25
|
sendToRelay: (topic: string, event: string, data: any, { appDid, appSk }: TNotificationSender, port?: string) => Promise<any>;
|
|
25
26
|
};
|
|
@@ -51,7 +51,7 @@ const getRequestHeaders = () => ({ 'User-Agent': `BlockletSDK/${VERSION}` });
|
|
|
51
51
|
* @param {Object} options
|
|
52
52
|
* @returns
|
|
53
53
|
*/
|
|
54
|
-
const sendToUser = async (receiver, notification, { appDid, appSk }, port = process.env.ABT_NODE_SERVICE_PORT, options = {}, pathname = 'send-to-user') => {
|
|
54
|
+
const sendToUser = async (receiver, notification, { appDid, appSk, type }, port = process.env.ABT_NODE_SERVICE_PORT, options = {}, pathname = 'send-to-user') => {
|
|
55
55
|
if (pathname === 'send-to-user') {
|
|
56
56
|
await (0, index_1.validateReceiver)(receiver);
|
|
57
57
|
}
|
|
@@ -67,7 +67,11 @@ const sendToUser = async (receiver, notification, { appDid, appSk }, port = proc
|
|
|
67
67
|
const { data: res } = await axios.post(`http://127.0.0.1:${port}${constants_1.SERVICE_PREFIX}/api/${pathname}`, {
|
|
68
68
|
apiVersion: VERSION,
|
|
69
69
|
data: {
|
|
70
|
-
sender: {
|
|
70
|
+
sender: {
|
|
71
|
+
appDid,
|
|
72
|
+
type,
|
|
73
|
+
token: JWT.sign(appDid, appSk),
|
|
74
|
+
},
|
|
71
75
|
receiver,
|
|
72
76
|
notification,
|
|
73
77
|
options: opt,
|
|
@@ -171,7 +171,7 @@ const notificationSchema = Joi.object({
|
|
|
171
171
|
checkUrl: Joi.string(),
|
|
172
172
|
source: Joi.string(),
|
|
173
173
|
// notification type
|
|
174
|
-
title: Joi.string(),
|
|
174
|
+
title: Joi.string().allow(''),
|
|
175
175
|
body: Joi.string(),
|
|
176
176
|
severity: Joi.string().valid(...Object.values(SEVERITIES)),
|
|
177
177
|
blocks: Joi.array().items(attachmentSchema).default([]),
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.16.24-beta-
|
|
6
|
+
"version": "1.16.24-beta-30f58f8d",
|
|
7
7
|
"description": "graphql client to read/write data on abt node",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"typings": "lib/index.d.ts",
|
|
@@ -27,15 +27,15 @@
|
|
|
27
27
|
"author": "linchen1987 <linchen.1987@foxmail.com> (http://github.com/linchen1987)",
|
|
28
28
|
"license": "Apache-2.0",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@abtnode/client": "1.16.24-beta-
|
|
31
|
-
"@abtnode/constant": "1.16.24-beta-
|
|
30
|
+
"@abtnode/client": "1.16.24-beta-30f58f8d",
|
|
31
|
+
"@abtnode/constant": "1.16.24-beta-30f58f8d",
|
|
32
32
|
"@arcblock/did": "1.18.110",
|
|
33
33
|
"@arcblock/did-auth": "1.18.110",
|
|
34
34
|
"@arcblock/jwt": "1.18.110",
|
|
35
35
|
"@arcblock/ws": "1.18.110",
|
|
36
|
-
"@blocklet/constant": "1.16.24-beta-
|
|
37
|
-
"@blocklet/env": "1.16.24-beta-
|
|
38
|
-
"@blocklet/meta": "1.16.24-beta-
|
|
36
|
+
"@blocklet/constant": "1.16.24-beta-30f58f8d",
|
|
37
|
+
"@blocklet/env": "1.16.24-beta-30f58f8d",
|
|
38
|
+
"@blocklet/meta": "1.16.24-beta-30f58f8d",
|
|
39
39
|
"@did-connect/authenticator": "^2.2.1",
|
|
40
40
|
"@did-connect/handler": "^2.2.1",
|
|
41
41
|
"@nedb/core": "^2.1.5",
|
|
@@ -76,5 +76,5 @@
|
|
|
76
76
|
"ts-node": "^10.9.1",
|
|
77
77
|
"typescript": "^5.0.4"
|
|
78
78
|
},
|
|
79
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "95f8e79898d7901f0665f3883e3c014c36f16668"
|
|
80
80
|
}
|