@blocklet/sdk 1.8.65-beta-db7f2529 → 1.8.65
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.
|
@@ -59,7 +59,19 @@ export interface TMessage {
|
|
|
59
59
|
};
|
|
60
60
|
type: string;
|
|
61
61
|
}
|
|
62
|
-
export
|
|
62
|
+
export interface TNotification {
|
|
63
|
+
actions?: TNotificationAction[];
|
|
64
|
+
attachments?: TNotificationAttachment[];
|
|
65
|
+
blocks?: TNotificationAttachment[];
|
|
66
|
+
body?: string;
|
|
67
|
+
checkUrl?: string;
|
|
68
|
+
data?: object;
|
|
69
|
+
feedType?: string;
|
|
70
|
+
severity?: 'normal' | 'success' | 'error' | 'warning';
|
|
71
|
+
title?: string;
|
|
72
|
+
type?: 'notification' | 'connect' | 'feed' | 'hi';
|
|
73
|
+
url?: string;
|
|
74
|
+
}
|
|
63
75
|
export interface TNotificationAction {
|
|
64
76
|
bgColor?: string;
|
|
65
77
|
color?: string;
|
|
@@ -67,39 +79,11 @@ export interface TNotificationAction {
|
|
|
67
79
|
name: string;
|
|
68
80
|
title?: string;
|
|
69
81
|
}
|
|
70
|
-
export
|
|
71
|
-
data
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
type: 'vc';
|
|
76
|
-
} | {
|
|
77
|
-
data: TDataToken;
|
|
78
|
-
type: 'token';
|
|
79
|
-
} | {
|
|
80
|
-
data: TDataText;
|
|
81
|
-
type: 'text';
|
|
82
|
-
} | {
|
|
83
|
-
data: TDataImage;
|
|
84
|
-
type: 'image';
|
|
85
|
-
} | {
|
|
86
|
-
data: TDataTransaction;
|
|
87
|
-
type: 'transaction';
|
|
88
|
-
} | {
|
|
89
|
-
data: TDataDapp;
|
|
90
|
-
type: 'dapp';
|
|
91
|
-
} | {
|
|
92
|
-
data: TDataLink;
|
|
93
|
-
type: 'link';
|
|
94
|
-
} | {
|
|
95
|
-
fields?: {
|
|
96
|
-
data: TDataText;
|
|
97
|
-
type: 'text';
|
|
98
|
-
}[];
|
|
99
|
-
type: 'section';
|
|
100
|
-
} | {
|
|
101
|
-
type: 'divider';
|
|
102
|
-
};
|
|
82
|
+
export interface TNotificationAttachment {
|
|
83
|
+
data?: any;
|
|
84
|
+
fields?: any;
|
|
85
|
+
type: 'asset' | 'vc' | 'token' | 'text' | 'image' | 'divider' | 'transaction' | 'dapp' | 'link' | 'section';
|
|
86
|
+
}
|
|
103
87
|
export interface TNotificationConnect {
|
|
104
88
|
checkUrl?: string;
|
|
105
89
|
type?: 'connect';
|
|
@@ -110,7 +94,7 @@ export interface TNotificationFeed {
|
|
|
110
94
|
feedType: string;
|
|
111
95
|
type?: 'feed';
|
|
112
96
|
}
|
|
113
|
-
export type TNotificationInput = TNotification[]
|
|
97
|
+
export type TNotificationInput = TNotification[];
|
|
114
98
|
export interface TNotificationItem {
|
|
115
99
|
actions?: TNotificationAction[];
|
|
116
100
|
attachments?: TNotificationAttachment[];
|
|
@@ -14,13 +14,13 @@ declare const transactionSchema: JOI.ObjectSchema<any>;
|
|
|
14
14
|
declare const dappSchema: JOI.ObjectSchema<any>;
|
|
15
15
|
declare const linkSchema: JOI.ObjectSchema<any>;
|
|
16
16
|
declare const actionSchema: JOI.ObjectSchema<any>;
|
|
17
|
-
declare const attachmentSchema: JOI.
|
|
17
|
+
declare const attachmentSchema: JOI.ObjectSchema<any>;
|
|
18
18
|
declare const notificationTypeSchema: JOI.ObjectSchema<any>;
|
|
19
19
|
declare const connectTypeSchema: JOI.ObjectSchema<any>;
|
|
20
20
|
declare const feedTypeSchema: JOI.ObjectSchema<any>;
|
|
21
|
-
declare const notificationSchema: JOI.
|
|
21
|
+
declare const notificationSchema: JOI.ObjectSchema<any>;
|
|
22
22
|
declare const messageSchema: JOI.ObjectSchema<any>;
|
|
23
|
-
declare const inputNotificationSchema: JOI.
|
|
23
|
+
declare const inputNotificationSchema: JOI.ArraySchema<any[]>;
|
|
24
24
|
declare const optionSchema: JOI.ObjectSchema<any>;
|
|
25
25
|
declare const channelEventSchema: JOI.StringSchema<string>;
|
|
26
26
|
export declare const validateReceiver: any;
|
|
@@ -59,8 +59,8 @@ declare const _default: {
|
|
|
59
59
|
linkSchema: JOI.ObjectSchema<any>;
|
|
60
60
|
imageSchema: JOI.ObjectSchema<any>;
|
|
61
61
|
dappSchema: JOI.ObjectSchema<any>;
|
|
62
|
-
attachmentSchema: JOI.
|
|
63
|
-
notificationSchema: JOI.
|
|
62
|
+
attachmentSchema: JOI.ObjectSchema<any>;
|
|
63
|
+
notificationSchema: JOI.ObjectSchema<any>;
|
|
64
64
|
messageSchema: JOI.ObjectSchema<any>;
|
|
65
65
|
optionSchema: JOI.ObjectSchema<any>;
|
|
66
66
|
channelEventSchema: JOI.StringSchema<string>;
|
|
@@ -107,42 +107,31 @@ const actionSchema = Joi.object({
|
|
|
107
107
|
link: Joi.string().uri(),
|
|
108
108
|
}).meta({ className: 'TNotificationAction' });
|
|
109
109
|
exports.actionSchema = actionSchema;
|
|
110
|
-
const attachmentSchema = Joi.
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
}),
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
}),
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
}), Joi.object({
|
|
136
|
-
type: Joi.string().valid(ATTACHMENT_TYPES.SECTION).required(),
|
|
137
|
-
fields: Joi.array().items(Joi.object({
|
|
138
|
-
type: Joi.string().valid(ATTACHMENT_TYPES.TEXT).required(),
|
|
139
|
-
data: textSchema,
|
|
140
|
-
})),
|
|
141
|
-
}), Joi.object({
|
|
142
|
-
type: Joi.string().valid(ATTACHMENT_TYPES.DIVIDER).required(),
|
|
143
|
-
}))
|
|
144
|
-
.required()
|
|
145
|
-
.meta({ className: 'TNotificationAttachment' });
|
|
110
|
+
const attachmentSchema = Joi.object({
|
|
111
|
+
type: Joi.string()
|
|
112
|
+
.valid(...Object.values(ATTACHMENT_TYPES))
|
|
113
|
+
.required(),
|
|
114
|
+
data: Joi.when('type', {
|
|
115
|
+
switch: [
|
|
116
|
+
{ is: ATTACHMENT_TYPES.ASSET, then: assetSchema },
|
|
117
|
+
{ is: ATTACHMENT_TYPES.VC, then: vcSchema },
|
|
118
|
+
{ is: ATTACHMENT_TYPES.TOKEN, then: tokenSchema },
|
|
119
|
+
{ is: ATTACHMENT_TYPES.TEXT, then: textSchema },
|
|
120
|
+
{ is: ATTACHMENT_TYPES.IMAGE, then: imageSchema },
|
|
121
|
+
{ is: ATTACHMENT_TYPES.TRANSACTION, then: transactionSchema },
|
|
122
|
+
{ is: ATTACHMENT_TYPES.DAPP, then: dappSchema },
|
|
123
|
+
{ is: ATTACHMENT_TYPES.LINK, then: linkSchema },
|
|
124
|
+
{ is: ATTACHMENT_TYPES.DIVIDER, then: Joi.object({}) },
|
|
125
|
+
],
|
|
126
|
+
}),
|
|
127
|
+
fields: Joi.when('type', {
|
|
128
|
+
is: ATTACHMENT_TYPES.SECTION,
|
|
129
|
+
then: Joi.array().items(Joi.object({
|
|
130
|
+
type: Joi.string().valid(ATTACHMENT_TYPES.TEXT).required(),
|
|
131
|
+
data: textSchema,
|
|
132
|
+
})),
|
|
133
|
+
}),
|
|
134
|
+
}).meta({ className: 'TNotificationAttachment' });
|
|
146
135
|
exports.attachmentSchema = attachmentSchema;
|
|
147
136
|
const notificationTypeSchema = Joi.object({
|
|
148
137
|
type: Joi.string().valid(TYPES.NOTIFICATION),
|
|
@@ -172,8 +161,22 @@ const feedTypeSchema = Joi.object({
|
|
|
172
161
|
.required()
|
|
173
162
|
.meta({ className: 'TNotificationFeed' });
|
|
174
163
|
exports.feedTypeSchema = feedTypeSchema;
|
|
175
|
-
const notificationSchema = Joi.
|
|
176
|
-
.
|
|
164
|
+
const notificationSchema = Joi.object({
|
|
165
|
+
type: Joi.string().valid(...Object.values(TYPES)),
|
|
166
|
+
// feed type
|
|
167
|
+
feedType: Joi.string(),
|
|
168
|
+
data: Joi.object(),
|
|
169
|
+
// connect type
|
|
170
|
+
url: Joi.string().uri(),
|
|
171
|
+
checkUrl: Joi.string(),
|
|
172
|
+
// notification type
|
|
173
|
+
title: Joi.string(),
|
|
174
|
+
body: Joi.string(),
|
|
175
|
+
severity: Joi.string().valid(...Object.values(SEVERITIES)),
|
|
176
|
+
blocks: Joi.array().items(attachmentSchema).default([]),
|
|
177
|
+
attachments: Joi.array().items(attachmentSchema).default([]),
|
|
178
|
+
actions: Joi.array().items(actionSchema).default([]),
|
|
179
|
+
})
|
|
177
180
|
.required()
|
|
178
181
|
.meta({ className: 'TNotification' });
|
|
179
182
|
exports.notificationSchema = notificationSchema;
|
|
@@ -190,15 +193,13 @@ const messageSchema = Joi.object({
|
|
|
190
193
|
.meta({ className: 'TMessage', unknownType: 'any' });
|
|
191
194
|
exports.messageSchema = messageSchema;
|
|
192
195
|
const receiverSchema = Joi.DID().trim().required().meta({ className: 'TReceiver' });
|
|
193
|
-
const inputNotificationSchema = Joi.
|
|
194
|
-
.
|
|
196
|
+
const inputNotificationSchema = Joi.array()
|
|
197
|
+
.items(notificationSchema)
|
|
198
|
+
.single()
|
|
195
199
|
.required()
|
|
196
200
|
.meta({ className: 'TNotificationInput' });
|
|
197
201
|
exports.inputNotificationSchema = inputNotificationSchema;
|
|
198
|
-
const inputReceiverSchema = Joi.
|
|
199
|
-
.try(Joi.array().items(receiverSchema), receiverSchema)
|
|
200
|
-
.required()
|
|
201
|
-
.meta({ className: 'TReceiverInput' });
|
|
202
|
+
const inputReceiverSchema = Joi.array().items(receiverSchema).single().required().meta({ className: 'TReceiverInput' });
|
|
202
203
|
const optionSchema = Joi.object({
|
|
203
204
|
keepForOfflineUser: Joi.boolean(),
|
|
204
205
|
})
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.8.65
|
|
6
|
+
"version": "1.8.65",
|
|
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",
|
|
@@ -26,13 +26,13 @@
|
|
|
26
26
|
"author": "linchen1987 <linchen.1987@foxmail.com> (http://github.com/linchen1987)",
|
|
27
27
|
"license": "MIT",
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@abtnode/client": "1.8.65
|
|
30
|
-
"@abtnode/constant": "1.8.65
|
|
29
|
+
"@abtnode/client": "1.8.65",
|
|
30
|
+
"@abtnode/constant": "1.8.65",
|
|
31
31
|
"@arcblock/did-auth": "1.18.42",
|
|
32
32
|
"@arcblock/jwt": "1.18.42",
|
|
33
33
|
"@arcblock/ws": "1.18.42",
|
|
34
|
-
"@blocklet/constant": "1.8.65
|
|
35
|
-
"@blocklet/meta": "1.8.65
|
|
34
|
+
"@blocklet/constant": "1.8.65",
|
|
35
|
+
"@blocklet/meta": "1.8.65",
|
|
36
36
|
"@did-connect/authenticator": "^2.1.34",
|
|
37
37
|
"@did-connect/handler": "^2.1.34",
|
|
38
38
|
"@nedb/core": "^2.1.5",
|
|
@@ -68,5 +68,5 @@
|
|
|
68
68
|
"ts-node": "^10.9.1",
|
|
69
69
|
"typescript": "^4.8.4"
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "69b608353fbbdb7c61f9ccb10965a1d0c55c45f2"
|
|
72
72
|
}
|