@satorijs/adapter-dingtalk 2.0.3 → 2.0.4
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/lib/http.d.ts +3 -2
- package/lib/index.js +10 -8
- package/lib/index.js.map +1 -2
- package/package.json +8 -4
- package/src/api/.eslintrc.yml +2 -0
- package/src/api/alitrip.ts +467 -0
- package/src/api/attendance.ts +81 -0
- package/src/api/badge.ts +285 -0
- package/src/api/blackboard.ts +28 -0
- package/src/api/calendar.ts +817 -0
- package/src/api/card.ts +215 -0
- package/src/api/conference.ts +561 -0
- package/src/api/connector.ts +97 -0
- package/src/api/contact.ts +56 -0
- package/src/api/convFile.ts +166 -0
- package/src/api/crm.ts +830 -0
- package/src/api/customerService.ts +156 -0
- package/src/api/datacenter.ts +672 -0
- package/src/api/devicemng.ts +202 -0
- package/src/api/diot.ts +19 -0
- package/src/api/doc.ts +232 -0
- package/src/api/drive.ts +109 -0
- package/src/api/edu.ts +30 -0
- package/src/api/esign.ts +44 -0
- package/src/api/exclusive.ts +372 -0
- package/src/api/h3yun.ts +537 -0
- package/src/api/hrm.ts +272 -0
- package/src/api/im.ts +978 -0
- package/src/api/industry.ts +153 -0
- package/src/api/jzcrm.ts +304 -0
- package/src/api/link.ts +94 -0
- package/src/api/live.ts +162 -0
- package/src/api/microApp.ts +309 -0
- package/src/api/oapi.ts +4083 -0
- package/src/api/oauth2.ts +146 -0
- package/src/api/pedia.ts +222 -0
- package/src/api/project.ts +1519 -0
- package/src/api/resident.ts +133 -0
- package/src/api/robot.ts +326 -0
- package/src/api/rooms.ts +334 -0
- package/src/api/serviceGroup.ts +216 -0
- package/src/api/storage.ts +1701 -0
- package/src/api/swform.ts +94 -0
- package/src/api/todo.ts +220 -0
- package/src/api/wiki.ts +231 -0
- package/src/api/workbench.ts +73 -0
- package/src/api/yida.ts +2165 -0
- package/src/bot.ts +111 -0
- package/src/http.ts +44 -0
- package/src/index.ts +9 -0
- package/src/internal.ts +47 -0
- package/src/message.ts +141 -0
- package/src/types/index.ts +140 -0
- package/src/utils.ts +51 -0
- package/src/ws.ts +55 -0
package/lib/http.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { Adapter, Context
|
|
1
|
+
import { Adapter, Context } from '@satorijs/satori';
|
|
2
2
|
import { DingtalkBot } from './bot';
|
|
3
3
|
export declare class HttpServer<C extends Context = Context> extends Adapter<C, DingtalkBot<C>> {
|
|
4
4
|
static inject: string[];
|
|
5
|
-
logger
|
|
5
|
+
private logger;
|
|
6
|
+
constructor(ctx: C, bot: DingtalkBot<C>);
|
|
6
7
|
connect(bot: DingtalkBot<C>): Promise<void>;
|
|
7
8
|
}
|
package/lib/index.js
CHANGED
|
@@ -104,7 +104,11 @@ __name(decodeMessage, "decodeMessage");
|
|
|
104
104
|
|
|
105
105
|
// satori/adapters/dingtalk/src/http.ts
|
|
106
106
|
var _HttpServer = class _HttpServer extends import_satori2.Adapter {
|
|
107
|
-
logger
|
|
107
|
+
logger;
|
|
108
|
+
constructor(ctx, bot) {
|
|
109
|
+
super(ctx);
|
|
110
|
+
this.logger = ctx.logger("dingtalk");
|
|
111
|
+
}
|
|
108
112
|
async connect(bot) {
|
|
109
113
|
await bot.refreshToken();
|
|
110
114
|
await bot.getLogin();
|
|
@@ -279,7 +283,7 @@ var _WsClient = class _WsClient extends import_satori4.Adapter.WsClient {
|
|
|
279
283
|
this.bot.online();
|
|
280
284
|
this.socket.addEventListener("message", async ({ data }) => {
|
|
281
285
|
const parsed = JSON.parse(data.toString());
|
|
282
|
-
this.
|
|
286
|
+
this.bot.logger.debug(parsed);
|
|
283
287
|
if (parsed.type === "SYSTEM") {
|
|
284
288
|
if (parsed.headers.topic === "ping") {
|
|
285
289
|
this.socket.send(JSON.stringify({
|
|
@@ -290,11 +294,11 @@ var _WsClient = class _WsClient extends import_satori4.Adapter.WsClient {
|
|
|
290
294
|
}));
|
|
291
295
|
}
|
|
292
296
|
} else if (parsed.type === "CALLBACK") {
|
|
293
|
-
this.
|
|
297
|
+
this.bot.logger.debug(JSON.parse(parsed.data));
|
|
294
298
|
const session = await decodeMessage(this.bot, JSON.parse(parsed.data));
|
|
295
299
|
if (session)
|
|
296
300
|
this.bot.dispatch(session);
|
|
297
|
-
this.
|
|
301
|
+
this.bot.logger.debug(session);
|
|
298
302
|
}
|
|
299
303
|
});
|
|
300
304
|
}
|
|
@@ -360,15 +364,13 @@ __name(_Internal, "Internal");
|
|
|
360
364
|
var Internal = _Internal;
|
|
361
365
|
|
|
362
366
|
// satori/adapters/dingtalk/src/bot.ts
|
|
363
|
-
var logger = new import_satori6.Logger("dingtalk");
|
|
364
367
|
var _DingtalkBot = class _DingtalkBot extends import_satori6.Bot {
|
|
365
368
|
oldHttp;
|
|
366
369
|
http;
|
|
367
370
|
internal;
|
|
368
371
|
refreshTokenTimer;
|
|
369
372
|
constructor(ctx, config) {
|
|
370
|
-
super(ctx, config);
|
|
371
|
-
this.platform = "dingtalk";
|
|
373
|
+
super(ctx, config, "dingtalk");
|
|
372
374
|
this.selfId = config.appkey;
|
|
373
375
|
this.http = ctx.http.extend(config.api);
|
|
374
376
|
this.oldHttp = ctx.http.extend(config.oldApi);
|
|
@@ -396,7 +398,7 @@ var _DingtalkBot = class _DingtalkBot extends import_satori6.Bot {
|
|
|
396
398
|
appKey: this.config.appkey,
|
|
397
399
|
appSecret: this.config.secret
|
|
398
400
|
});
|
|
399
|
-
logger.debug("gettoken result: %o", data);
|
|
401
|
+
this.logger.debug("gettoken result: %o", data);
|
|
400
402
|
this.token = data.accessToken;
|
|
401
403
|
this.http = this.http.extend({
|
|
402
404
|
headers: {
|