@juzi/wechaty-puppet-service 1.0.122 → 1.0.124
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/dist/cjs/src/client/grpc-manager.d.ts +1 -0
- package/dist/cjs/src/client/grpc-manager.d.ts.map +1 -1
- package/dist/cjs/src/client/grpc-manager.js +49 -47
- package/dist/cjs/src/client/grpc-manager.js.map +1 -1
- package/dist/cjs/src/client/payload-store.d.ts +3 -0
- package/dist/cjs/src/client/payload-store.d.ts.map +1 -1
- package/dist/cjs/src/client/payload-store.js +8 -6
- package/dist/cjs/src/client/payload-store.js.map +1 -1
- package/dist/cjs/src/client/puppet-service.d.ts +14 -0
- package/dist/cjs/src/client/puppet-service.d.ts.map +1 -1
- package/dist/cjs/src/client/puppet-service.js +284 -219
- package/dist/cjs/src/client/puppet-service.js.map +1 -1
- package/dist/cjs/src/package-json.d.ts.map +1 -1
- package/dist/cjs/src/package-json.js +4 -3
- package/dist/cjs/src/package-json.js.map +1 -1
- package/dist/cjs/tests/fast-dirty-room-member.spec.js +123 -21
- package/dist/cjs/tests/fast-dirty-room-member.spec.js.map +1 -1
- package/dist/cjs/tests/grpc-stream-dirty-order.spec.d.ts +3 -0
- package/dist/cjs/tests/grpc-stream-dirty-order.spec.d.ts.map +1 -0
- package/dist/cjs/tests/grpc-stream-dirty-order.spec.js +135 -0
- package/dist/cjs/tests/grpc-stream-dirty-order.spec.js.map +1 -0
- package/dist/esm/src/client/grpc-manager.d.ts +1 -0
- package/dist/esm/src/client/grpc-manager.d.ts.map +1 -1
- package/dist/esm/src/client/grpc-manager.js +50 -48
- package/dist/esm/src/client/grpc-manager.js.map +1 -1
- package/dist/esm/src/client/payload-store.d.ts +3 -0
- package/dist/esm/src/client/payload-store.d.ts.map +1 -1
- package/dist/esm/src/client/payload-store.js +8 -6
- package/dist/esm/src/client/payload-store.js.map +1 -1
- package/dist/esm/src/client/puppet-service.d.ts +14 -0
- package/dist/esm/src/client/puppet-service.d.ts.map +1 -1
- package/dist/esm/src/client/puppet-service.js +284 -219
- package/dist/esm/src/client/puppet-service.js.map +1 -1
- package/dist/esm/src/package-json.d.ts.map +1 -1
- package/dist/esm/src/package-json.js +4 -3
- package/dist/esm/src/package-json.js.map +1 -1
- package/dist/esm/tests/fast-dirty-room-member.spec.js +123 -21
- package/dist/esm/tests/fast-dirty-room-member.spec.js.map +1 -1
- package/dist/esm/tests/grpc-stream-dirty-order.spec.d.ts +3 -0
- package/dist/esm/tests/grpc-stream-dirty-order.spec.d.ts.map +1 -0
- package/dist/esm/tests/grpc-stream-dirty-order.spec.js +110 -0
- package/dist/esm/tests/grpc-stream-dirty-order.spec.js.map +1 -0
- package/package.json +4 -3
- package/src/client/grpc-manager.ts +54 -48
- package/src/client/payload-store.ts +13 -7
- package/src/client/puppet-service.ts +283 -220
- package/src/package-json.ts +4 -3
|
@@ -76,6 +76,20 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
76
76
|
options;
|
|
77
77
|
static VERSION = config_js_1.VERSION;
|
|
78
78
|
_payloadStore;
|
|
79
|
+
/**
|
|
80
|
+
* Per-roomId serialization chain for RoomMember compound dirty events.
|
|
81
|
+
*
|
|
82
|
+
* The compound RoomMember handler is a `get → mutate → set` sequence
|
|
83
|
+
* across an async FlashStore. Two dirty events for the same roomId
|
|
84
|
+
* (e.g. member-A and member-B, arriving back-to-back) would otherwise
|
|
85
|
+
* both read the same snapshot and each write back with only their own
|
|
86
|
+
* key removed -- losing one of the deletes.
|
|
87
|
+
*
|
|
88
|
+
* Keyed by roomId, each entry chains the pending handler run so a
|
|
89
|
+
* follow-up dirty for the same room waits for the in-flight one to
|
|
90
|
+
* finish. Entries self-clean after their tail resolves.
|
|
91
|
+
*/
|
|
92
|
+
_roomMemberDirtyChain = new Map();
|
|
79
93
|
timeoutMilliseconds;
|
|
80
94
|
_grpcManager;
|
|
81
95
|
get grpcManager() {
|
|
@@ -96,6 +110,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
96
110
|
this.options = options;
|
|
97
111
|
this._payloadStore = new payload_store_js_1.PayloadStore({
|
|
98
112
|
token: config_js_1.envVars.WECHATY_PUPPET_SERVICE_TOKEN(this.options.token),
|
|
113
|
+
logger: this.options.logger,
|
|
99
114
|
});
|
|
100
115
|
this.hookPayloadStore();
|
|
101
116
|
this.FileBoxUuid = (0, mod_js_1.uuidifyFileBoxGrpc)(() => this.grpcManager.client);
|
|
@@ -125,77 +140,77 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
125
140
|
return package_json_js_1.packageJson.version || '0.0.0';
|
|
126
141
|
}
|
|
127
142
|
async onStart() {
|
|
128
|
-
|
|
143
|
+
this.log.verbose('PuppetService', 'onStart()');
|
|
129
144
|
this.waitingForLogin = false;
|
|
130
145
|
this.waitingForReady = false;
|
|
131
146
|
if (this._grpcManager) {
|
|
132
|
-
|
|
147
|
+
this.log.warn('PuppetService', 'onStart() found this.grpc is already existed. dropped.');
|
|
133
148
|
this._grpcManager = undefined;
|
|
134
149
|
}
|
|
135
|
-
|
|
150
|
+
this.log.info('PuppetService', 'start() instanciating GrpcManager ...');
|
|
136
151
|
const grpcManager = new grpc_manager_js_1.GrpcManager(this.options);
|
|
137
|
-
|
|
152
|
+
this.log.info('PuppetService', 'start() instanciating GrpcManager ... done');
|
|
138
153
|
/**
|
|
139
154
|
* Huan(202108): when we started the event stream,
|
|
140
155
|
* the `this.grpc` need to be available for all listeners.
|
|
141
156
|
*/
|
|
142
157
|
this._grpcManager = grpcManager;
|
|
143
|
-
|
|
158
|
+
this.log.info('PuppetService', 'start() setting up bridge grpc event stream ...');
|
|
144
159
|
this.bridgeGrpcEventStream(grpcManager);
|
|
145
|
-
|
|
146
|
-
|
|
160
|
+
this.log.info('PuppetService', 'start() setting up bridge grpc event stream ... done');
|
|
161
|
+
this.log.info('PuppetService', 'start() starting grpc manager...');
|
|
147
162
|
const { lastEventSeq, accountId } = await this.getMiscellaneousStoreData();
|
|
148
163
|
await grpcManager.start(lastEventSeq, accountId);
|
|
149
|
-
|
|
150
|
-
|
|
164
|
+
this.log.info('PuppetService', 'start() starting grpc manager... done');
|
|
165
|
+
this.log.info('PuppetService', 'start healthCheck');
|
|
151
166
|
this.startHealthCheck();
|
|
152
|
-
|
|
167
|
+
this.log.info('PuppetService', 'onStart() ... done');
|
|
153
168
|
}
|
|
154
169
|
async onStop() {
|
|
155
|
-
|
|
170
|
+
this.log.info('PuppetService', 'onStop()');
|
|
156
171
|
if (this._grpcManager) {
|
|
157
|
-
|
|
172
|
+
this.log.info('PuppetService', 'onStop() stopping grpc manager ...');
|
|
158
173
|
const grpcManager = this._grpcManager;
|
|
159
174
|
this._grpcManager = undefined;
|
|
160
175
|
await grpcManager.stop();
|
|
161
|
-
|
|
176
|
+
this.log.info('PuppetService', 'onStop() stopping grpc manager ... done');
|
|
162
177
|
}
|
|
163
|
-
|
|
164
|
-
|
|
178
|
+
this.log.info('PuppetService', 'onStop() ... done');
|
|
179
|
+
this.log.info('PuppetService', 'stop healthCheck');
|
|
165
180
|
this.stopHealthCheck();
|
|
166
181
|
}
|
|
167
182
|
hookPayloadStore() {
|
|
168
|
-
|
|
183
|
+
this.log.verbose('PuppetService', 'hookPayloadStore()');
|
|
169
184
|
this.on('login', async ({ contactId }) => {
|
|
170
185
|
try {
|
|
171
|
-
|
|
186
|
+
this.log.verbose('PuppetService', 'hookPayloadStore() this.on(login) contactId: "%s"', contactId);
|
|
172
187
|
await this._payloadStore.start(contactId);
|
|
173
188
|
}
|
|
174
189
|
catch (e) {
|
|
175
|
-
|
|
190
|
+
this.log.verbose('PuppetService', 'hookPayloadStore() this.on(login) rejection "%s"', e.message);
|
|
176
191
|
}
|
|
177
192
|
});
|
|
178
193
|
this.on('logout', async ({ contactId }) => {
|
|
179
|
-
|
|
194
|
+
this.log.verbose('PuppetService', 'hookPayloadStore() this.on(logout) contactId: "%s"', contactId);
|
|
180
195
|
try {
|
|
181
196
|
await this._payloadStore.stop();
|
|
182
197
|
}
|
|
183
198
|
catch (e) {
|
|
184
|
-
|
|
199
|
+
this.log.verbose('PuppetService', 'hookPayloadStore() this.on(logout) rejection "%s"', e.message);
|
|
185
200
|
}
|
|
186
201
|
});
|
|
187
202
|
}
|
|
188
203
|
bridgeGrpcEventStream(client) {
|
|
189
|
-
|
|
204
|
+
this.log.verbose('PuppetService', 'bridgeGrpcEventStream(client)');
|
|
190
205
|
client
|
|
191
206
|
.on('data', this.onGrpcStreamEvent.bind(this))
|
|
192
207
|
.on('end', () => {
|
|
193
|
-
|
|
208
|
+
this.log.verbose('PuppetService', 'bridgeGrpcEventStream() eventStream.on(end)');
|
|
194
209
|
})
|
|
195
210
|
.on('error', (e) => {
|
|
196
211
|
this.emit('error', e);
|
|
197
212
|
// https://github.com/wechaty/wechaty-puppet-service/issues/16
|
|
198
|
-
// log.verbose('PuppetService', 'bridgeGrpcEventStream() eventStream.on(error) %s', e)
|
|
213
|
+
// this.log.verbose('PuppetService', 'bridgeGrpcEventStream() eventStream.on(error) %s', e)
|
|
199
214
|
// const reason = 'bridgeGrpcEventStream() eventStream.on(error) ' + e
|
|
200
215
|
/**
|
|
201
216
|
* Huan(202110): simple reset puppet when grpc client has error? (or not?)
|
|
@@ -210,7 +225,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
210
225
|
// }
|
|
211
226
|
})
|
|
212
227
|
.on('cancel', (...args) => {
|
|
213
|
-
|
|
228
|
+
this.log.verbose('PuppetService', 'bridgeGrpcEventStream() eventStream.on(cancel), %s', JSON.stringify(args));
|
|
214
229
|
});
|
|
215
230
|
}
|
|
216
231
|
async onGrpcStreamEvent(event) {
|
|
@@ -219,9 +234,9 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
219
234
|
const seq = event.getSeq();
|
|
220
235
|
const timestamp = String(Date.now());
|
|
221
236
|
if (!config_js_1.NO_LOG_EVENTS.includes(type)) {
|
|
222
|
-
|
|
237
|
+
this.log.info('PuppetService', `received grpc event ${event_type_rev_js_1.EventTypeRev[type]} on ${new Date().toString()}, content: ${JSON.stringify(payload)}, seq: ${seq}, timestamp: ${timestamp}`);
|
|
223
238
|
}
|
|
224
|
-
|
|
239
|
+
this.log.silly('PuppetService', 'onGrpcStreamEvent({type:%s(%s), payload:"%s"})', event_type_rev_js_1.EventTypeRev[type], type, payload);
|
|
225
240
|
if (type !== wechaty_grpc_1.puppet.EventType.EVENT_TYPE_HEARTBEAT) {
|
|
226
241
|
this.emit('heartbeat', {
|
|
227
242
|
data: `onGrpcStreamEvent(${event_type_rev_js_1.EventTypeRev[type]})`,
|
|
@@ -252,7 +267,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
252
267
|
case wechaty_grpc_1.puppet.EventType.EVENT_TYPE_LOGIN:
|
|
253
268
|
{
|
|
254
269
|
if (this.waitingForLogin && this.isLoggedIn) {
|
|
255
|
-
|
|
270
|
+
this.log.warn('PuppetService', 'this login event is ignored because the it is expected by event stream reconnect and this puppet is already logged in');
|
|
256
271
|
return;
|
|
257
272
|
}
|
|
258
273
|
const loginPayload = JSON.parse(payload);
|
|
@@ -265,7 +280,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
265
280
|
});
|
|
266
281
|
}
|
|
267
282
|
}
|
|
268
|
-
(async () => this.login(loginPayload.contactId))().catch(e =>
|
|
283
|
+
(async () => this.login(loginPayload.contactId))().catch(e => this.log.error('PuppetService', 'onGrpcStreamEvent() this.login() rejection %s', e.message));
|
|
269
284
|
}
|
|
270
285
|
break;
|
|
271
286
|
case wechaty_grpc_1.puppet.EventType.EVENT_TYPE_LOGOUT:
|
|
@@ -275,7 +290,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
275
290
|
await this.resetMiscellaneousStoreData();
|
|
276
291
|
}
|
|
277
292
|
;
|
|
278
|
-
(async () => this.logout(logoutPayload.data))().catch(e =>
|
|
293
|
+
(async () => this.logout(logoutPayload.data))().catch(e => this.log.error('PuppetService', 'onGrpcStreamEvent() this.logout() rejection %s', e.message));
|
|
279
294
|
}
|
|
280
295
|
break;
|
|
281
296
|
case wechaty_grpc_1.puppet.EventType.EVENT_TYPE_DIRTY: {
|
|
@@ -298,7 +313,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
298
313
|
break;
|
|
299
314
|
case wechaty_grpc_1.puppet.EventType.EVENT_TYPE_READY:
|
|
300
315
|
if (this.waitingForReady && this.readyIndicator.value()) {
|
|
301
|
-
|
|
316
|
+
this.log.warn('PuppetService', 'this ready event is ignored because the it is expected by event stream reconnect and this puppet is already ready');
|
|
302
317
|
return;
|
|
303
318
|
}
|
|
304
319
|
this.emit('ready', JSON.parse(payload));
|
|
@@ -328,14 +343,14 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
328
343
|
this.emit('tag-group', JSON.parse(payload));
|
|
329
344
|
break;
|
|
330
345
|
case wechaty_grpc_1.puppet.EventType.EVENT_TYPE_RESET:
|
|
331
|
-
|
|
346
|
+
this.log.warn('PuppetService', 'onGrpcStreamEvent() got an EventType.EVENT_TYPE_RESET ?');
|
|
332
347
|
// the `reset` event should be dealed not send out
|
|
333
348
|
break;
|
|
334
349
|
case wechaty_grpc_1.puppet.EventType.EVENT_TYPE_VERIFY_CODE:
|
|
335
350
|
this.emit('verify-code', JSON.parse(payload));
|
|
336
351
|
break;
|
|
337
352
|
case wechaty_grpc_1.puppet.EventType.EVENT_TYPE_UNSPECIFIED:
|
|
338
|
-
|
|
353
|
+
this.log.error('PuppetService', 'onGrpcStreamEvent() got an EventType.EVENT_TYPE_UNSPECIFIED ?');
|
|
339
354
|
break;
|
|
340
355
|
case wechaty_grpc_1.puppet.EventType.EVENT_TYPE_VERIFY_SLIDE:
|
|
341
356
|
this.emit('verify-slide', JSON.parse(payload));
|
|
@@ -345,27 +360,27 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
345
360
|
break;
|
|
346
361
|
default:
|
|
347
362
|
// Huan(202003): in default, the `type` type should be `never`, please check.
|
|
348
|
-
|
|
363
|
+
this.log.error(`eventType ${type} unsupported! data: ${payload}`);
|
|
349
364
|
}
|
|
350
365
|
}
|
|
351
366
|
async logout(reason) {
|
|
352
|
-
|
|
367
|
+
this.log.verbose('PuppetService', 'logout(%s)', reason ? `"${reason}"` : '');
|
|
353
368
|
await super.logout(reason);
|
|
354
369
|
try {
|
|
355
370
|
await util_1.default.promisify(this.grpcManager.client.logout
|
|
356
371
|
.bind(this.grpcManager.client))(new wechaty_grpc_1.puppet.LogoutRequest());
|
|
357
372
|
}
|
|
358
373
|
catch (e) {
|
|
359
|
-
|
|
374
|
+
this.log.silly('PuppetService', 'logout() no grpc client');
|
|
360
375
|
}
|
|
361
376
|
}
|
|
362
377
|
ding(data) {
|
|
363
|
-
|
|
378
|
+
this.log.silly('PuppetService', 'ding(%s)', data);
|
|
364
379
|
const request = new wechaty_grpc_1.puppet.DingRequest();
|
|
365
380
|
request.setData(data || '');
|
|
366
381
|
this.grpcManager.client.ding(request, (error, _response) => {
|
|
367
382
|
if (error) {
|
|
368
|
-
|
|
383
|
+
this.log.error('PuppetService', 'ding() rejection: %s', error);
|
|
369
384
|
}
|
|
370
385
|
});
|
|
371
386
|
}
|
|
@@ -378,7 +393,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
378
393
|
*
|
|
379
394
|
*/
|
|
380
395
|
async dirtyPayload(type, id) {
|
|
381
|
-
|
|
396
|
+
this.log.verbose('PuppetService', 'dirtyPayload(%s, %s)', type, id);
|
|
382
397
|
const request = new wechaty_grpc_1.puppet.DirtyPayloadRequest();
|
|
383
398
|
request.setId(id);
|
|
384
399
|
request.setType(type);
|
|
@@ -387,7 +402,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
387
402
|
.bind(this.grpcManager.client))(request);
|
|
388
403
|
}
|
|
389
404
|
catch (e) {
|
|
390
|
-
|
|
405
|
+
this.log.error('PuppetService', 'dirtyPayload() rejection: %s', e && e.message);
|
|
391
406
|
throw e;
|
|
392
407
|
}
|
|
393
408
|
}
|
|
@@ -411,9 +426,55 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
411
426
|
[PUPPET.types.Dirty.Post]: async (_) => { },
|
|
412
427
|
[PUPPET.types.Dirty.Room]: async (id) => this._payloadStore.room?.delete(id),
|
|
413
428
|
[PUPPET.types.Dirty.RoomMember]: async (id) => {
|
|
414
|
-
const [roomId] = id.split(PUPPET.STRING_SPLITTER);
|
|
415
|
-
if (roomId) {
|
|
416
|
-
|
|
429
|
+
const [roomId, memberId] = id.split(PUPPET.STRING_SPLITTER);
|
|
430
|
+
if (!roomId) {
|
|
431
|
+
return;
|
|
432
|
+
}
|
|
433
|
+
const store = this._payloadStore.roomMember;
|
|
434
|
+
if (!store) {
|
|
435
|
+
return;
|
|
436
|
+
}
|
|
437
|
+
// Bare roomId: the whole member set is stale, drop the row.
|
|
438
|
+
// Row-level delete is idempotent so it does not need serialization.
|
|
439
|
+
if (memberId === undefined) {
|
|
440
|
+
await store.delete(roomId);
|
|
441
|
+
return;
|
|
442
|
+
}
|
|
443
|
+
// Compound id: `get → mutate → set` is a read-modify-write across
|
|
444
|
+
// an async store. Serialize per roomId so two concurrent compound
|
|
445
|
+
// dirties don't each read the same snapshot and each drop only
|
|
446
|
+
// their own key -- which would lose one of the two deletes.
|
|
447
|
+
const previous = this._roomMemberDirtyChain.get(roomId) ?? Promise.resolve();
|
|
448
|
+
const next = (async () => {
|
|
449
|
+
// Swallow the previous link's rejection so a failure upstream
|
|
450
|
+
// does not silently skip our own mutation. The prior handler
|
|
451
|
+
// already reported its error via fastDirty()'s try/catch.
|
|
452
|
+
try {
|
|
453
|
+
await previous;
|
|
454
|
+
}
|
|
455
|
+
catch (_) { /* ignore, upstream already reported */ }
|
|
456
|
+
const current = await store.get(roomId);
|
|
457
|
+
if (!current || !Object.prototype.hasOwnProperty.call(current, memberId)) {
|
|
458
|
+
return;
|
|
459
|
+
}
|
|
460
|
+
const { [memberId]: _drop, ...rest } = current;
|
|
461
|
+
if (Object.keys(rest).length === 0) {
|
|
462
|
+
await store.delete(roomId);
|
|
463
|
+
}
|
|
464
|
+
else {
|
|
465
|
+
await store.set(roomId, rest);
|
|
466
|
+
}
|
|
467
|
+
})();
|
|
468
|
+
this._roomMemberDirtyChain.set(roomId, next);
|
|
469
|
+
try {
|
|
470
|
+
await next;
|
|
471
|
+
}
|
|
472
|
+
finally {
|
|
473
|
+
// Only clear the slot if we are still the tail; otherwise a
|
|
474
|
+
// later handler has already extended the chain and owns cleanup.
|
|
475
|
+
if (this._roomMemberDirtyChain.get(roomId) === next) {
|
|
476
|
+
this._roomMemberDirtyChain.delete(roomId);
|
|
477
|
+
}
|
|
417
478
|
}
|
|
418
479
|
},
|
|
419
480
|
[PUPPET.types.Dirty.Tag]: async (id) => this._payloadStore.tag?.delete(id),
|
|
@@ -423,7 +484,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
423
484
|
[PUPPET.types.Dirty.Call]: async (_) => { },
|
|
424
485
|
[PUPPET.types.Dirty.Unspecified]: async (id) => {
|
|
425
486
|
const msg = `fastDirty() received Unspecified dirty type (id=${id}); upstream puppet is leaking protobuf default — this is a server-side contract bug`;
|
|
426
|
-
|
|
487
|
+
this.log.error('PuppetService', msg);
|
|
427
488
|
this.emit('error', new Error(msg));
|
|
428
489
|
},
|
|
429
490
|
};
|
|
@@ -433,14 +494,14 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
433
494
|
* the event listener will be registered in `start()` from the `PuppetAbstract` class
|
|
434
495
|
*/
|
|
435
496
|
async fastDirty({ payloadType, payloadId, }) {
|
|
436
|
-
|
|
497
|
+
this.log.verbose('PuppetService', 'fastDirty(%s<%s>, %s)', PUPPET.types.Dirty[payloadType], payloadType, payloadId);
|
|
437
498
|
// payloadType is typed as the enum, but at runtime the server may emit a
|
|
438
499
|
// value outside our enum (forward-compat). Look it up via a
|
|
439
500
|
// possibly-undefined view so the runtime guard stays meaningful.
|
|
440
501
|
const lookup = this._dirtyHandlerMap;
|
|
441
502
|
const handler = lookup[payloadType];
|
|
442
503
|
if (!handler) {
|
|
443
|
-
|
|
504
|
+
this.log.warn('PuppetService', 'fastDirty() no handler for payloadType=%s', payloadType);
|
|
444
505
|
return;
|
|
445
506
|
}
|
|
446
507
|
try {
|
|
@@ -451,7 +512,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
451
512
|
}
|
|
452
513
|
}
|
|
453
514
|
async enterVerifyCode(id, code) {
|
|
454
|
-
|
|
515
|
+
this.log.verbose('PuppetService', 'enterVerifyCode(%s, %s)', id, code);
|
|
455
516
|
const request = new wechaty_grpc_1.puppet.EnterVerifyCodeRequest();
|
|
456
517
|
request.setId(id);
|
|
457
518
|
request.setCode(code);
|
|
@@ -459,20 +520,20 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
459
520
|
.bind(this.grpcManager.client))(request);
|
|
460
521
|
}
|
|
461
522
|
async cancelVerifyCode(id) {
|
|
462
|
-
|
|
523
|
+
this.log.verbose('PuppetService', 'cancelVerifyCode(%s)', id);
|
|
463
524
|
const request = new wechaty_grpc_1.puppet.CancelVerifyCodeRequest();
|
|
464
525
|
request.setId(id);
|
|
465
526
|
await util_1.default.promisify(this.grpcManager.client.cancelVerifyCode
|
|
466
527
|
.bind(this.grpcManager.client))(request);
|
|
467
528
|
}
|
|
468
529
|
async refreshQRCode() {
|
|
469
|
-
|
|
530
|
+
this.log.verbose('PuppetService', 'refreshQRCode(%s)');
|
|
470
531
|
const request = new wechaty_grpc_1.puppet.RefreshQRCodeRequest();
|
|
471
532
|
await util_1.default.promisify(this.grpcManager.client.refreshQRCode
|
|
472
533
|
.bind(this.grpcManager.client))(request);
|
|
473
534
|
}
|
|
474
535
|
async contactAlias(contactId, alias) {
|
|
475
|
-
|
|
536
|
+
this.log.verbose('PuppetService', 'contactAlias(%s, %s)', contactId, alias);
|
|
476
537
|
/**
|
|
477
538
|
* Get alias
|
|
478
539
|
*/
|
|
@@ -510,7 +571,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
510
571
|
.bind(this.grpcManager.client))(request);
|
|
511
572
|
}
|
|
512
573
|
async contactPhone(contactId, phoneList) {
|
|
513
|
-
|
|
574
|
+
this.log.verbose('PuppetService', 'contactPhone(%s, %s)', contactId, phoneList);
|
|
514
575
|
const request = new wechaty_grpc_1.puppet.ContactPhoneRequest();
|
|
515
576
|
request.setContactId(contactId);
|
|
516
577
|
request.setPhonesList(phoneList);
|
|
@@ -518,7 +579,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
518
579
|
.bind(this.grpcManager.client))(request);
|
|
519
580
|
}
|
|
520
581
|
async contactCorporationRemark(contactId, corporationRemark) {
|
|
521
|
-
|
|
582
|
+
this.log.verbose('PuppetService', 'contactCorporationRemark(%s, %s)', contactId, corporationRemark);
|
|
522
583
|
const request = new wechaty_grpc_1.puppet.ContactCorporationRemarkRequest();
|
|
523
584
|
request.setContactId(contactId);
|
|
524
585
|
if (corporationRemark) {
|
|
@@ -536,7 +597,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
536
597
|
.bind(this.grpcManager.client))(request);
|
|
537
598
|
}
|
|
538
599
|
async contactDescription(contactId, description) {
|
|
539
|
-
|
|
600
|
+
this.log.verbose('PuppetService', 'contactDescription(%s, %s)', contactId, description);
|
|
540
601
|
const request = new wechaty_grpc_1.puppet.ContactDescriptionRequest();
|
|
541
602
|
request.setContactId(contactId);
|
|
542
603
|
if (description) {
|
|
@@ -554,13 +615,13 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
554
615
|
.bind(this.grpcManager.client))(request);
|
|
555
616
|
}
|
|
556
617
|
async contactList() {
|
|
557
|
-
|
|
618
|
+
this.log.verbose('PuppetService', 'contactList()');
|
|
558
619
|
const response = await util_1.default.promisify(this.grpcManager.client.contactList
|
|
559
620
|
.bind(this.grpcManager.client))(new wechaty_grpc_1.puppet.ContactListRequest());
|
|
560
621
|
return response.getIdsList();
|
|
561
622
|
}
|
|
562
623
|
async contactAvatar(contactId, fileBox) {
|
|
563
|
-
|
|
624
|
+
this.log.verbose('PuppetService', 'contactAvatar(%s)', contactId);
|
|
564
625
|
/**
|
|
565
626
|
* 1. set
|
|
566
627
|
*/
|
|
@@ -597,10 +658,10 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
597
658
|
return this.FileBoxUuid.fromJSON(jsonText);
|
|
598
659
|
}
|
|
599
660
|
async contactRawPayload(id) {
|
|
600
|
-
|
|
661
|
+
this.log.verbose('PuppetService', 'contactRawPayload(%s)', id);
|
|
601
662
|
const cachedPayload = await this._payloadStore.contact?.get(id);
|
|
602
663
|
if (cachedPayload) {
|
|
603
|
-
|
|
664
|
+
this.log.silly('PuppetService', 'contactRawPayload(%s) cache HIT', id);
|
|
604
665
|
return cachedPayload;
|
|
605
666
|
}
|
|
606
667
|
const request = new wechaty_grpc_1.puppet.ContactPayloadRequest();
|
|
@@ -641,16 +702,16 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
641
702
|
aka: response.getAka(),
|
|
642
703
|
};
|
|
643
704
|
await this._payloadStore.contact?.set(id, payload);
|
|
644
|
-
|
|
705
|
+
this.log.silly('PuppetService', 'contactRawPayload(%s) cache SET', id);
|
|
645
706
|
return payload;
|
|
646
707
|
}
|
|
647
708
|
async contactRawPayloadParser(payload) {
|
|
648
|
-
// log.silly('PuppetService', 'contactRawPayloadParser({id:%s})', payload.id)
|
|
709
|
+
// this.log.silly('PuppetService', 'contactRawPayloadParser({id:%s})', payload.id)
|
|
649
710
|
// passthrough
|
|
650
711
|
return payload;
|
|
651
712
|
}
|
|
652
713
|
async batchContactRawPayload(contactIdList) {
|
|
653
|
-
|
|
714
|
+
this.log.verbose('PuppetService', 'batchContactRawPayload(%s)', contactIdList);
|
|
654
715
|
const result = new Map();
|
|
655
716
|
const contactIdSet = new Set(contactIdList);
|
|
656
717
|
const needGetSet = new Set();
|
|
@@ -678,7 +739,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
678
739
|
}
|
|
679
740
|
}
|
|
680
741
|
catch (e) {
|
|
681
|
-
|
|
742
|
+
this.log.error('PuppetService', 'batchContactRawPayload(%s, %s) error: %s, use one by one method', contactIdList, needGetSet, e);
|
|
682
743
|
for (const contactId of needGetSet) {
|
|
683
744
|
const payload = await this.contactRawPayload(contactId);
|
|
684
745
|
result.set(contactId, payload);
|
|
@@ -688,7 +749,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
688
749
|
return result;
|
|
689
750
|
}
|
|
690
751
|
async contactPayloadModify(contactId, payload) {
|
|
691
|
-
|
|
752
|
+
this.log.verbose('PuppetService', 'contactPayloadModify(%s, %s)', contactId, JSON.stringify(payload));
|
|
692
753
|
const request = new wechaty_grpc_1.puppet.ContactPayloadModifyRequest();
|
|
693
754
|
request.setId(contactId);
|
|
694
755
|
if (payload.id) {
|
|
@@ -758,41 +819,41 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
758
819
|
.bind(this.grpcManager.client))(request);
|
|
759
820
|
}
|
|
760
821
|
async contactSelfName(name) {
|
|
761
|
-
|
|
822
|
+
this.log.verbose('PuppetService', 'contactSelfName(%s)', name);
|
|
762
823
|
const request = new wechaty_grpc_1.puppet.ContactSelfNameRequest();
|
|
763
824
|
request.setName(name);
|
|
764
825
|
await util_1.default.promisify(this.grpcManager.client.contactSelfName
|
|
765
826
|
.bind(this.grpcManager.client))(request);
|
|
766
827
|
}
|
|
767
828
|
async contactSelfRealName(realName) {
|
|
768
|
-
|
|
829
|
+
this.log.verbose('PuppetService', 'contactSelfRealName(%s)', realName);
|
|
769
830
|
const request = new wechaty_grpc_1.puppet.ContactSelfRealNameRequest();
|
|
770
831
|
request.setRealName(realName);
|
|
771
832
|
await util_1.default.promisify(this.grpcManager.client.contactSelfRealName
|
|
772
833
|
.bind(this.grpcManager.client))(request);
|
|
773
834
|
}
|
|
774
835
|
async contactSelfAka(aka) {
|
|
775
|
-
|
|
836
|
+
this.log.verbose('PuppetService', 'contactSelfAka(%s)', aka);
|
|
776
837
|
const request = new wechaty_grpc_1.puppet.ContactSelfAkaRequest();
|
|
777
838
|
request.setAka(aka);
|
|
778
839
|
await util_1.default.promisify(this.grpcManager.client.contactSelfAka
|
|
779
840
|
.bind(this.grpcManager.client))(request);
|
|
780
841
|
}
|
|
781
842
|
async contactSelfQRCode() {
|
|
782
|
-
|
|
843
|
+
this.log.verbose('PuppetService', 'contactSelfQRCode()');
|
|
783
844
|
const response = await util_1.default.promisify(this.grpcManager.client.contactSelfQRCode
|
|
784
845
|
.bind(this.grpcManager.client))(new wechaty_grpc_1.puppet.ContactSelfQRCodeRequest());
|
|
785
846
|
return response.getQrcode();
|
|
786
847
|
}
|
|
787
848
|
async contactSelfSignature(signature) {
|
|
788
|
-
|
|
849
|
+
this.log.verbose('PuppetService', 'contactSelfSignature(%s)', signature);
|
|
789
850
|
const request = new wechaty_grpc_1.puppet.ContactSelfSignatureRequest();
|
|
790
851
|
request.setSignature(signature);
|
|
791
852
|
await util_1.default.promisify(this.grpcManager.client.contactSelfSignature
|
|
792
853
|
.bind(this.grpcManager.client))(request);
|
|
793
854
|
}
|
|
794
855
|
async contactSelfRoomAlias(roomId, alias) {
|
|
795
|
-
|
|
856
|
+
this.log.verbose('PuppetService', 'contactSelfRoomAlias(%s, %s)', roomId, alias);
|
|
796
857
|
const request = new wechaty_grpc_1.puppet.ContactSelfRoomAliasRequest();
|
|
797
858
|
request.setRoomId(roomId);
|
|
798
859
|
request.setAlias(alias);
|
|
@@ -800,7 +861,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
800
861
|
.bind(this.grpcManager.client))(request);
|
|
801
862
|
}
|
|
802
863
|
async contactDelete(contactId) {
|
|
803
|
-
|
|
864
|
+
this.log.verbose('PuppetService', 'contactDelete(%s)', contactId);
|
|
804
865
|
const request = new wechaty_grpc_1.puppet.ContactDeleteRequest();
|
|
805
866
|
request.setContactId(contactId);
|
|
806
867
|
await util_1.default.promisify(this.grpcManager.client.contactDelete
|
|
@@ -812,7 +873,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
812
873
|
*
|
|
813
874
|
*/
|
|
814
875
|
async conversationReadMark(conversationId, hasRead = true) {
|
|
815
|
-
|
|
876
|
+
this.log.verbose('PuppetService', 'conversationMarkRead(%s, %s)', conversationId, hasRead);
|
|
816
877
|
const request = new wechaty_grpc_1.puppet.ConversationReadRequest();
|
|
817
878
|
request.setConversationId(conversationId);
|
|
818
879
|
request.setHasRead(hasRead);
|
|
@@ -825,7 +886,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
825
886
|
*
|
|
826
887
|
*/
|
|
827
888
|
async messageMiniProgram(messageId) {
|
|
828
|
-
|
|
889
|
+
this.log.verbose('PuppetService', 'messageMiniProgram(%s)', messageId);
|
|
829
890
|
const request = new wechaty_grpc_1.puppet.MessageMiniProgramRequest();
|
|
830
891
|
request.setId(messageId);
|
|
831
892
|
const response = await util_1.default.promisify(this.grpcManager.client.messageMiniProgram
|
|
@@ -844,7 +905,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
844
905
|
return payload;
|
|
845
906
|
}
|
|
846
907
|
async messageLocation(messageId) {
|
|
847
|
-
|
|
908
|
+
this.log.verbose('PuppetService', 'messageLocation(%s)', messageId);
|
|
848
909
|
const request = new wechaty_grpc_1.puppet.MessageLocationRequest();
|
|
849
910
|
request.setId(messageId);
|
|
850
911
|
const response = await util_1.default.promisify(this.grpcManager.client.messageLocation
|
|
@@ -860,7 +921,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
860
921
|
return payload;
|
|
861
922
|
}
|
|
862
923
|
async messageImage(messageId, imageType) {
|
|
863
|
-
|
|
924
|
+
this.log.verbose('PuppetService', 'messageImage(%s, %s[%s])', messageId, imageType, PUPPET.types.Image[imageType]);
|
|
864
925
|
const request = new wechaty_grpc_1.puppet.MessageImageRequest();
|
|
865
926
|
request.setId(messageId);
|
|
866
927
|
request.setType(imageType);
|
|
@@ -873,7 +934,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
873
934
|
throw new Error(`failed to get image filebox for message ${messageId}`);
|
|
874
935
|
}
|
|
875
936
|
async messageContact(messageId) {
|
|
876
|
-
|
|
937
|
+
this.log.verbose('PuppetService', 'messageContact(%s)', messageId);
|
|
877
938
|
const request = new wechaty_grpc_1.puppet.MessageContactRequest();
|
|
878
939
|
request.setId(messageId);
|
|
879
940
|
const response = await util_1.default.promisify(this.grpcManager.client.messageContact
|
|
@@ -882,7 +943,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
882
943
|
return contactId;
|
|
883
944
|
}
|
|
884
945
|
async messageChannel(messageId) {
|
|
885
|
-
|
|
946
|
+
this.log.verbose('PuppetService', 'messageChannel(%s)', messageId);
|
|
886
947
|
const request = new wechaty_grpc_1.puppet.MessageChannelRequest();
|
|
887
948
|
request.setId(messageId);
|
|
888
949
|
const response = await util_1.default.promisify(this.grpcManager.client.messageChannel
|
|
@@ -891,7 +952,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
891
952
|
return payload;
|
|
892
953
|
}
|
|
893
954
|
async messageChannelCard(messageId) {
|
|
894
|
-
|
|
955
|
+
this.log.verbose('PuppetService', 'messageChannelCard(%s)', messageId);
|
|
895
956
|
const request = new wechaty_grpc_1.puppet.MessageChannelCardRequest();
|
|
896
957
|
request.setId(messageId);
|
|
897
958
|
const response = await util_1.default.promisify(this.grpcManager.client.messageChannelCard
|
|
@@ -900,7 +961,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
900
961
|
return payload;
|
|
901
962
|
}
|
|
902
963
|
async messageCallRecord(messageId) {
|
|
903
|
-
|
|
964
|
+
this.log.verbose('PuppetService', 'messageCallRecord(%s)', messageId);
|
|
904
965
|
const request = new wechaty_grpc_1.puppet.MessageCallRecordRequest();
|
|
905
966
|
request.setId(messageId);
|
|
906
967
|
const response = await util_1.default.promisify(this.grpcManager.client.messageCallRecord
|
|
@@ -909,7 +970,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
909
970
|
return payload;
|
|
910
971
|
}
|
|
911
972
|
async callInvite(contactIds, media) {
|
|
912
|
-
|
|
973
|
+
this.log.verbose('PuppetService', 'callInvite(%s, %s)', contactIds, media);
|
|
913
974
|
const request = new wechaty_grpc_1.puppet.CallInviteRequest();
|
|
914
975
|
request.setContactIdsList(contactIds);
|
|
915
976
|
request.setMedia((0, call_media_mapping_js_1.puppetCallMediaTypeToGrpc)(media));
|
|
@@ -922,20 +983,20 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
922
983
|
return callId;
|
|
923
984
|
}
|
|
924
985
|
async callAdd(callId, contactIds) {
|
|
925
|
-
|
|
986
|
+
this.log.verbose('PuppetService', 'callAdd(%s, %s)', callId, contactIds);
|
|
926
987
|
const request = new wechaty_grpc_1.puppet.CallAddRequest();
|
|
927
988
|
request.setCallId(callId);
|
|
928
989
|
request.setContactIdsList(contactIds);
|
|
929
990
|
await this.grpcUnary(this.grpcManager.client.callAdd, request);
|
|
930
991
|
}
|
|
931
992
|
async callAccept(callId) {
|
|
932
|
-
|
|
993
|
+
this.log.verbose('PuppetService', 'callAccept(%s)', callId);
|
|
933
994
|
const request = new wechaty_grpc_1.puppet.CallAcceptRequest();
|
|
934
995
|
request.setCallId(callId);
|
|
935
996
|
await this.grpcUnary(this.grpcManager.client.callAccept, request);
|
|
936
997
|
}
|
|
937
998
|
async callReject(callId, reason) {
|
|
938
|
-
|
|
999
|
+
this.log.verbose('PuppetService', 'callReject(%s, %s)', callId, reason);
|
|
939
1000
|
const request = new wechaty_grpc_1.puppet.CallRejectRequest();
|
|
940
1001
|
request.setCallId(callId);
|
|
941
1002
|
if (reason !== undefined && reason !== '') {
|
|
@@ -944,13 +1005,13 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
944
1005
|
await this.grpcUnary(this.grpcManager.client.callReject, request);
|
|
945
1006
|
}
|
|
946
1007
|
async callCancel(callId) {
|
|
947
|
-
|
|
1008
|
+
this.log.verbose('PuppetService', 'callCancel(%s)', callId);
|
|
948
1009
|
const request = new wechaty_grpc_1.puppet.CallCancelRequest();
|
|
949
1010
|
request.setCallId(callId);
|
|
950
1011
|
await this.grpcUnary(this.grpcManager.client.callCancel, request);
|
|
951
1012
|
}
|
|
952
1013
|
async callHangup(callId, reason) {
|
|
953
|
-
|
|
1014
|
+
this.log.verbose('PuppetService', 'callHangup(%s, %s)', callId, reason);
|
|
954
1015
|
const request = new wechaty_grpc_1.puppet.CallHangupRequest();
|
|
955
1016
|
request.setCallId(callId);
|
|
956
1017
|
if (reason !== undefined && reason !== '') {
|
|
@@ -959,7 +1020,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
959
1020
|
await this.grpcUnary(this.grpcManager.client.callHangup, request);
|
|
960
1021
|
}
|
|
961
1022
|
async callMediaEndpoint(callId) {
|
|
962
|
-
|
|
1023
|
+
this.log.verbose('PuppetService', 'callMediaEndpoint(%s)', callId);
|
|
963
1024
|
const request = new wechaty_grpc_1.puppet.CallMediaEndpointRequest();
|
|
964
1025
|
request.setCallId(callId);
|
|
965
1026
|
const response = await util_1.default.promisify(this.grpcManager.client.callMediaEndpoint
|
|
@@ -983,7 +1044,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
983
1044
|
return payload;
|
|
984
1045
|
}
|
|
985
1046
|
async callRawPayload(callId) {
|
|
986
|
-
|
|
1047
|
+
this.log.verbose('PuppetService', 'callRawPayload(%s)', callId);
|
|
987
1048
|
const request = new wechaty_grpc_1.puppet.CallPayloadRequest();
|
|
988
1049
|
request.setId(callId);
|
|
989
1050
|
const response = await util_1.default.promisify(this.grpcManager.client.callPayload
|
|
@@ -991,6 +1052,10 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
991
1052
|
return response.toObject();
|
|
992
1053
|
}
|
|
993
1054
|
async callRawPayloadParser(rawPayload) {
|
|
1055
|
+
// Intentionally uses the module-level `log` instead of `this.log`: the
|
|
1056
|
+
// matching unit spec invokes this parser via `prototype.call({}, raw)` and
|
|
1057
|
+
// never binds a real PuppetService instance. Keep this `this`-free so that
|
|
1058
|
+
// contract survives the pluggable-logger migration.
|
|
994
1059
|
config_js_1.log.verbose('PuppetService', 'callRawPayloadParser({id:%s})', rawPayload.id);
|
|
995
1060
|
const media = (0, call_media_mapping_js_1.grpcCallTypeToPuppetMedia)(rawPayload.media);
|
|
996
1061
|
if (media === undefined) {
|
|
@@ -1014,7 +1079,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
1014
1079
|
return payload;
|
|
1015
1080
|
}
|
|
1016
1081
|
async messageChatHistory(messageId) {
|
|
1017
|
-
|
|
1082
|
+
this.log.verbose('PuppetService', 'messageChatHistory(%s)', messageId);
|
|
1018
1083
|
const request = new wechaty_grpc_1.puppet.MessageChatHistoryRequest();
|
|
1019
1084
|
request.setId(messageId);
|
|
1020
1085
|
const response = await util_1.default.promisify(this.grpcManager.client.messageChatHistory
|
|
@@ -1023,7 +1088,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
1023
1088
|
return payload;
|
|
1024
1089
|
}
|
|
1025
1090
|
async messageSendMiniProgram(conversationId, miniProgramPayload) {
|
|
1026
|
-
|
|
1091
|
+
this.log.verbose('PuppetService', 'messageSendMiniProgram(%s, "%s")', conversationId, JSON.stringify(miniProgramPayload));
|
|
1027
1092
|
const request = new wechaty_grpc_1.puppet.MessageSendMiniProgramRequest();
|
|
1028
1093
|
request.setConversationId(conversationId);
|
|
1029
1094
|
const pbMiniProgramPayload = new wechaty_grpc_1.puppet.MiniProgramPayload();
|
|
@@ -1059,11 +1124,11 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
1059
1124
|
* Deprecated: will be removed after Dec 31, 2022
|
|
1060
1125
|
*/
|
|
1061
1126
|
request.setMiniProgramDeprecated(JSON.stringify(miniProgramPayload));
|
|
1062
|
-
|
|
1127
|
+
this.log.info('PuppetService', `messageSendMiniProgram(${conversationId}, ${miniProgramPayload.description}) about to call grpc`);
|
|
1063
1128
|
const response = await util_1.default.promisify(this.grpcManager.client.messageSendMiniProgram
|
|
1064
1129
|
.bind(this.grpcManager.client))(request);
|
|
1065
1130
|
const messageId = response.getId();
|
|
1066
|
-
|
|
1131
|
+
this.log.info('PuppetService', `messageSendMiniProgram(${conversationId}, ${miniProgramPayload.description}) grpc called, messageId: ${messageId}`);
|
|
1067
1132
|
if (messageId) {
|
|
1068
1133
|
return messageId;
|
|
1069
1134
|
}
|
|
@@ -1078,7 +1143,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
1078
1143
|
}
|
|
1079
1144
|
}
|
|
1080
1145
|
async messageSendLocation(conversationId, locationPayload) {
|
|
1081
|
-
|
|
1146
|
+
this.log.verbose('PuppetService', 'messageSendLocation(%s)', conversationId, JSON.stringify(locationPayload));
|
|
1082
1147
|
const request = new wechaty_grpc_1.puppet.MessageSendLocationRequest();
|
|
1083
1148
|
request.setConversationId(conversationId);
|
|
1084
1149
|
const pbLocationPayload = new wechaty_grpc_1.puppet.LocationPayload();
|
|
@@ -1088,47 +1153,47 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
1088
1153
|
pbLocationPayload.setLongitude(locationPayload.longitude);
|
|
1089
1154
|
pbLocationPayload.setName(locationPayload.name);
|
|
1090
1155
|
request.setLocation(pbLocationPayload);
|
|
1091
|
-
|
|
1156
|
+
this.log.info('PuppetService', `messageSendLocation(${conversationId}, ${locationPayload.name}) about to call grpc`);
|
|
1092
1157
|
const response = await util_1.default.promisify(this.grpcManager.client.messageSendLocation
|
|
1093
1158
|
.bind(this.grpcManager.client))(request);
|
|
1094
1159
|
const id = response.getId();
|
|
1095
|
-
|
|
1160
|
+
this.log.info('PuppetService', `messageSendMiniProgram(${conversationId}, ${locationPayload.name}) grpc called, messageId: ${id}`);
|
|
1096
1161
|
if (id) {
|
|
1097
1162
|
return id;
|
|
1098
1163
|
}
|
|
1099
1164
|
}
|
|
1100
1165
|
async messageSendChannel(conversationId, channelPayload) {
|
|
1101
|
-
|
|
1166
|
+
this.log.verbose('PuppetService', 'messageSendChannel(%s, "%s")', conversationId, JSON.stringify(channelPayload));
|
|
1102
1167
|
const request = new wechaty_grpc_1.puppet.MessageSendChannelRequest();
|
|
1103
1168
|
request.setConversationId(conversationId);
|
|
1104
1169
|
const pbChannelPayload = (0, pb_payload_helper_js_1.channelPayloadToPb)(wechaty_grpc_1.puppet, channelPayload);
|
|
1105
1170
|
request.setChannel(pbChannelPayload);
|
|
1106
|
-
|
|
1171
|
+
this.log.info('PuppetService', `messageSendChannel(${conversationId}, ${channelPayload.desc}) about to call grpc`);
|
|
1107
1172
|
const response = await util_1.default.promisify(this.grpcManager.client.messageSendChannel
|
|
1108
1173
|
.bind(this.grpcManager.client))(request);
|
|
1109
1174
|
const messageId = response.getId();
|
|
1110
|
-
|
|
1175
|
+
this.log.info('PuppetService', `messageSendChannel(${conversationId}, ${channelPayload.desc}) grpc called, messageId: ${messageId}`);
|
|
1111
1176
|
if (messageId) {
|
|
1112
1177
|
return messageId;
|
|
1113
1178
|
}
|
|
1114
1179
|
}
|
|
1115
1180
|
async messageSendChannelCard(conversationId, channelCardPayload) {
|
|
1116
|
-
|
|
1181
|
+
this.log.verbose('PuppetService', 'messageSendChannelCard(%s, "%s")', conversationId, JSON.stringify(channelCardPayload));
|
|
1117
1182
|
const request = new wechaty_grpc_1.puppet.MessageSendChannelCardRequest();
|
|
1118
1183
|
request.setConversationId(conversationId);
|
|
1119
1184
|
const pbChannelCardPayload = (0, pb_payload_helper_js_1.channelCardPayloadToPb)(wechaty_grpc_1.puppet, channelCardPayload);
|
|
1120
1185
|
request.setChannelCard(pbChannelCardPayload);
|
|
1121
|
-
|
|
1186
|
+
this.log.info('PuppetService', `messageSendChannelCard(${conversationId}, ${channelCardPayload.nickname}) about to call grpc`);
|
|
1122
1187
|
const response = await util_1.default.promisify(this.grpcManager.client.messageSendChannelCard
|
|
1123
1188
|
.bind(this.grpcManager.client))(request);
|
|
1124
1189
|
const messageId = response.getId();
|
|
1125
|
-
|
|
1190
|
+
this.log.info('PuppetService', `messageSendChannelCard(${conversationId}, ${channelCardPayload.nickname}) grpc called, messageId: ${messageId}`);
|
|
1126
1191
|
if (messageId) {
|
|
1127
1192
|
return messageId;
|
|
1128
1193
|
}
|
|
1129
1194
|
}
|
|
1130
1195
|
async messageRecall(messageId) {
|
|
1131
|
-
|
|
1196
|
+
this.log.verbose('PuppetService', 'messageRecall(%s)', messageId);
|
|
1132
1197
|
const request = new wechaty_grpc_1.puppet.MessageRecallRequest();
|
|
1133
1198
|
request.setId(messageId);
|
|
1134
1199
|
const response = await util_1.default.promisify(this.grpcManager.client.messageRecall
|
|
@@ -1136,7 +1201,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
1136
1201
|
return response.getSuccess();
|
|
1137
1202
|
}
|
|
1138
1203
|
async messageFile(id) {
|
|
1139
|
-
|
|
1204
|
+
this.log.verbose('PuppetService', 'messageFile(%s)', id);
|
|
1140
1205
|
const request = new wechaty_grpc_1.puppet.MessageFileRequest();
|
|
1141
1206
|
request.setId(id);
|
|
1142
1207
|
const response = await util_1.default.promisify(this.grpcManager.client.messageFile
|
|
@@ -1148,7 +1213,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
1148
1213
|
throw new Error(`failed to get filebox for message ${id}`);
|
|
1149
1214
|
}
|
|
1150
1215
|
async messageVoice(id) {
|
|
1151
|
-
|
|
1216
|
+
this.log.verbose('PuppetService', 'messageVoice(%s)', id);
|
|
1152
1217
|
const request = new wechaty_grpc_1.puppet.MessageVoiceRequest();
|
|
1153
1218
|
request.setId(id);
|
|
1154
1219
|
const response = await util_1.default.promisify(this.grpcManager.client.messageVoice
|
|
@@ -1160,7 +1225,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
1160
1225
|
throw new Error(`failed to get voice filebox for message ${id}`);
|
|
1161
1226
|
}
|
|
1162
1227
|
async messageVoiceText(id) {
|
|
1163
|
-
|
|
1228
|
+
this.log.verbose('PuppetService', 'messageVoiceText(%s)', id);
|
|
1164
1229
|
const request = new wechaty_grpc_1.puppet.MessageVoiceTextRequest();
|
|
1165
1230
|
request.setId(id);
|
|
1166
1231
|
const response = await util_1.default.promisify(this.grpcManager.client.messageVoiceText
|
|
@@ -1171,7 +1236,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
1171
1236
|
};
|
|
1172
1237
|
}
|
|
1173
1238
|
async messagePreview(id) {
|
|
1174
|
-
|
|
1239
|
+
this.log.verbose('PuppetService', 'messagePreview(%s)', id);
|
|
1175
1240
|
const request = new wechaty_grpc_1.puppet.MessagePreviewRequest();
|
|
1176
1241
|
request.setId(id);
|
|
1177
1242
|
const response = await util_1.default.promisify(this.grpcManager.client.messagePreview
|
|
@@ -1183,7 +1248,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
1183
1248
|
return undefined;
|
|
1184
1249
|
}
|
|
1185
1250
|
async messageForward(conversationId, messageIds) {
|
|
1186
|
-
|
|
1251
|
+
this.log.verbose('PuppetService', 'messageForward(%s, %s)', conversationId, messageIds);
|
|
1187
1252
|
const request = new wechaty_grpc_1.puppet.MessageForwardRequest();
|
|
1188
1253
|
request.setConversationId(conversationId);
|
|
1189
1254
|
if (Array.isArray(messageIds)) {
|
|
@@ -1195,11 +1260,11 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
1195
1260
|
else {
|
|
1196
1261
|
request.setMessageId(messageIds);
|
|
1197
1262
|
}
|
|
1198
|
-
|
|
1263
|
+
this.log.info('PuppetService', `messageForward(${conversationId}, ${messageIds}) about to call grpc`);
|
|
1199
1264
|
const response = await util_1.default.promisify(this.grpcManager.client.messageForward
|
|
1200
1265
|
.bind(this.grpcManager.client))(request);
|
|
1201
1266
|
const forwardedMessageId = response.getId();
|
|
1202
|
-
|
|
1267
|
+
this.log.info('PuppetService', `messageForward(${conversationId}, ${messageIds}) grpc called, messageId: ${forwardedMessageId}`);
|
|
1203
1268
|
if (forwardedMessageId) {
|
|
1204
1269
|
return forwardedMessageId;
|
|
1205
1270
|
}
|
|
@@ -1214,10 +1279,10 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
1214
1279
|
}
|
|
1215
1280
|
}
|
|
1216
1281
|
async messageRawPayload(id) {
|
|
1217
|
-
|
|
1282
|
+
this.log.verbose('PuppetService', 'messageRawPayload(%s)', id);
|
|
1218
1283
|
// const cachedPayload = await this.payloadStore.message?.get(id)
|
|
1219
1284
|
// if (cachedPayload) {
|
|
1220
|
-
// log.silly('PuppetService', 'messageRawPayload(%s) cache HIT', id)
|
|
1285
|
+
// this.log.silly('PuppetService', 'messageRawPayload(%s) cache HIT', id)
|
|
1221
1286
|
// return cachedPayload
|
|
1222
1287
|
// }
|
|
1223
1288
|
const request = new wechaty_grpc_1.puppet.MessagePayloadRequest();
|
|
@@ -1266,21 +1331,21 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
1266
1331
|
break;
|
|
1267
1332
|
}
|
|
1268
1333
|
default:
|
|
1269
|
-
|
|
1334
|
+
this.log.warn('PuppetService', `unknown text content type ${type}`);
|
|
1270
1335
|
}
|
|
1271
1336
|
payload.textContent?.push(contentData);
|
|
1272
1337
|
}
|
|
1273
|
-
// log.silly('PuppetService', 'messageRawPayload(%s) cache SET', id)
|
|
1338
|
+
// this.log.silly('PuppetService', 'messageRawPayload(%s) cache SET', id)
|
|
1274
1339
|
// await this.payloadStore.message?.set(id, payload)
|
|
1275
1340
|
return payload;
|
|
1276
1341
|
}
|
|
1277
1342
|
async messageRawPayloadParser(payload) {
|
|
1278
|
-
// log.silly('PuppetService', 'messagePayload({id:%s})', payload.id)
|
|
1343
|
+
// this.log.silly('PuppetService', 'messagePayload({id:%s})', payload.id)
|
|
1279
1344
|
// passthrough
|
|
1280
1345
|
return payload;
|
|
1281
1346
|
}
|
|
1282
1347
|
async messageSendText(conversationId, text, options) {
|
|
1283
|
-
|
|
1348
|
+
this.log.verbose('PuppetService', 'messageSend(%s, %s)', conversationId, text);
|
|
1284
1349
|
let mentionIdList;
|
|
1285
1350
|
let quoteId;
|
|
1286
1351
|
if (Array.isArray(options)) {
|
|
@@ -1299,11 +1364,11 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
1299
1364
|
if (typeof quoteId !== 'undefined') {
|
|
1300
1365
|
request.setQuoteId(quoteId);
|
|
1301
1366
|
}
|
|
1302
|
-
|
|
1367
|
+
this.log.info('PuppetService', `messageSend(${conversationId}, ${text}) about to call grpc`);
|
|
1303
1368
|
const response = await util_1.default.promisify(this.grpcManager.client.messageSendText
|
|
1304
1369
|
.bind(this.grpcManager.client))(request);
|
|
1305
1370
|
const messageId = response.getId();
|
|
1306
|
-
|
|
1371
|
+
this.log.info('PuppetService', `messageSend(${conversationId}, ${text}) grpc called, messageId: ${messageId}`);
|
|
1307
1372
|
if (messageId) {
|
|
1308
1373
|
return messageId;
|
|
1309
1374
|
}
|
|
@@ -1318,7 +1383,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
1318
1383
|
}
|
|
1319
1384
|
}
|
|
1320
1385
|
async messageBatchSendText(conversationIds, text, batchTaskId) {
|
|
1321
|
-
|
|
1386
|
+
this.log.verbose('PuppetService', 'messageBatchSendText(%s)', conversationIds.join(','));
|
|
1322
1387
|
const request = new wechaty_grpc_1.puppet.MessageBatchSendTextRequest();
|
|
1323
1388
|
request.setConversationIdsList(conversationIds);
|
|
1324
1389
|
request.setText(text);
|
|
@@ -1329,7 +1394,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
1329
1394
|
return grpcBatchResultsToPayload(response);
|
|
1330
1395
|
}
|
|
1331
1396
|
async messageBatchSendFile(conversationIds, fileBox, batchTaskId) {
|
|
1332
|
-
|
|
1397
|
+
this.log.verbose('PuppetService', 'messageBatchSendFile(%s)', conversationIds.join(','));
|
|
1333
1398
|
const request = new wechaty_grpc_1.puppet.MessageBatchSendFileRequest();
|
|
1334
1399
|
request.setConversationIdsList(conversationIds);
|
|
1335
1400
|
request.setFileBox(await this.serializeFileBox(fileBox));
|
|
@@ -1340,7 +1405,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
1340
1405
|
return grpcBatchResultsToPayload(response);
|
|
1341
1406
|
}
|
|
1342
1407
|
async messageBatchForward(conversationIds, messageIds, batchTaskId) {
|
|
1343
|
-
|
|
1408
|
+
this.log.verbose('PuppetService', 'messageBatchForward(%s, %s)', conversationIds.join(','), messageIds);
|
|
1344
1409
|
const request = new wechaty_grpc_1.puppet.MessageBatchForwardRequest();
|
|
1345
1410
|
request.setConversationIdsList(conversationIds);
|
|
1346
1411
|
if (Array.isArray(messageIds)) {
|
|
@@ -1359,7 +1424,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
1359
1424
|
return grpcBatchResultsToPayload(response);
|
|
1360
1425
|
}
|
|
1361
1426
|
async messageBatchSendContact(conversationIds, contactId, batchTaskId) {
|
|
1362
|
-
|
|
1427
|
+
this.log.verbose('PuppetService', 'messageBatchSendContact(%s, %s)', conversationIds.join(','), contactId);
|
|
1363
1428
|
const request = new wechaty_grpc_1.puppet.MessageBatchSendContactRequest();
|
|
1364
1429
|
request.setConversationIdsList(conversationIds);
|
|
1365
1430
|
request.setContactId(contactId);
|
|
@@ -1370,7 +1435,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
1370
1435
|
return grpcBatchResultsToPayload(response);
|
|
1371
1436
|
}
|
|
1372
1437
|
async messageBatchSendUrl(conversationIds, urlLinkPayload, batchTaskId) {
|
|
1373
|
-
|
|
1438
|
+
this.log.verbose('PuppetService', 'messageBatchSendUrl(%s)', conversationIds.join(','));
|
|
1374
1439
|
const request = new wechaty_grpc_1.puppet.MessageBatchSendUrlRequest();
|
|
1375
1440
|
request.setConversationIdsList(conversationIds);
|
|
1376
1441
|
request.setUrlLink((0, pb_payload_helper_js_1.urlLinkPayloadToPb)(wechaty_grpc_1.puppet, urlLinkPayload));
|
|
@@ -1381,7 +1446,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
1381
1446
|
return grpcBatchResultsToPayload(response);
|
|
1382
1447
|
}
|
|
1383
1448
|
async messageBatchSendMiniProgram(conversationIds, miniProgramPayload, batchTaskId) {
|
|
1384
|
-
|
|
1449
|
+
this.log.verbose('PuppetService', 'messageBatchSendMiniProgram(%s)', conversationIds.join(','));
|
|
1385
1450
|
const request = new wechaty_grpc_1.puppet.MessageBatchSendMiniProgramRequest();
|
|
1386
1451
|
request.setConversationIdsList(conversationIds);
|
|
1387
1452
|
request.setMiniProgram((0, pb_payload_helper_js_1.miniProgramPayloadToPb)(wechaty_grpc_1.puppet, miniProgramPayload));
|
|
@@ -1392,7 +1457,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
1392
1457
|
return grpcBatchResultsToPayload(response);
|
|
1393
1458
|
}
|
|
1394
1459
|
async messageBatchSendLocation(conversationIds, locationPayload, batchTaskId) {
|
|
1395
|
-
|
|
1460
|
+
this.log.verbose('PuppetService', 'messageBatchSendLocation(%s)', conversationIds.join(','));
|
|
1396
1461
|
const request = new wechaty_grpc_1.puppet.MessageBatchSendLocationRequest();
|
|
1397
1462
|
request.setConversationIdsList(conversationIds);
|
|
1398
1463
|
request.setLocation((0, pb_payload_helper_js_1.locationPayloadToPb)(wechaty_grpc_1.puppet, locationPayload));
|
|
@@ -1403,7 +1468,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
1403
1468
|
return grpcBatchResultsToPayload(response);
|
|
1404
1469
|
}
|
|
1405
1470
|
async messageBatchSendChannel(conversationIds, channelPayload, batchTaskId) {
|
|
1406
|
-
|
|
1471
|
+
this.log.verbose('PuppetService', 'messageBatchSendChannel(%s)', conversationIds.join(','));
|
|
1407
1472
|
const request = new wechaty_grpc_1.puppet.MessageBatchSendChannelRequest();
|
|
1408
1473
|
request.setConversationIdsList(conversationIds);
|
|
1409
1474
|
request.setChannel((0, pb_payload_helper_js_1.channelPayloadToPb)(wechaty_grpc_1.puppet, channelPayload));
|
|
@@ -1414,7 +1479,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
1414
1479
|
return grpcBatchResultsToPayload(response);
|
|
1415
1480
|
}
|
|
1416
1481
|
async messageBatchSendChannelCard(conversationIds, channelCardPayload, batchTaskId) {
|
|
1417
|
-
|
|
1482
|
+
this.log.verbose('PuppetService', 'messageBatchSendChannelCard(%s)', conversationIds.join(','));
|
|
1418
1483
|
const request = new wechaty_grpc_1.puppet.MessageBatchSendChannelCardRequest();
|
|
1419
1484
|
request.setConversationIdsList(conversationIds);
|
|
1420
1485
|
request.setChannelCard((0, pb_payload_helper_js_1.channelCardPayloadToPb)(wechaty_grpc_1.puppet, channelCardPayload));
|
|
@@ -1425,16 +1490,16 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
1425
1490
|
return grpcBatchResultsToPayload(response);
|
|
1426
1491
|
}
|
|
1427
1492
|
async messageSendFile(conversationId, fileBox) {
|
|
1428
|
-
|
|
1493
|
+
this.log.verbose('PuppetService', 'messageSendFile(%s, %s)', conversationId, fileBox);
|
|
1429
1494
|
const request = new wechaty_grpc_1.puppet.MessageSendFileRequest();
|
|
1430
1495
|
request.setConversationId(conversationId);
|
|
1431
1496
|
const serializedFileBox = await this.serializeFileBox(fileBox);
|
|
1432
1497
|
request.setFileBox(serializedFileBox);
|
|
1433
|
-
|
|
1498
|
+
this.log.info('PuppetService', `messageSendFile(${conversationId}, ${fileBox}) about to call grpc`);
|
|
1434
1499
|
const response = await util_1.default.promisify(this.grpcManager.client.messageSendFile
|
|
1435
1500
|
.bind(this.grpcManager.client))(request);
|
|
1436
1501
|
const messageId = response.getId();
|
|
1437
|
-
|
|
1502
|
+
this.log.info('PuppetService', `messageSendFile(${conversationId}, ${fileBox}) grpc called, messageId: ${messageId}`);
|
|
1438
1503
|
if (messageId) {
|
|
1439
1504
|
return messageId;
|
|
1440
1505
|
}
|
|
@@ -1449,15 +1514,15 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
1449
1514
|
}
|
|
1450
1515
|
}
|
|
1451
1516
|
async messageSendContact(conversationId, contactId) {
|
|
1452
|
-
|
|
1517
|
+
this.log.verbose('PuppetService', 'messageSend("%s", %s)', conversationId, contactId);
|
|
1453
1518
|
const request = new wechaty_grpc_1.puppet.MessageSendContactRequest();
|
|
1454
1519
|
request.setConversationId(conversationId);
|
|
1455
1520
|
request.setContactId(contactId);
|
|
1456
|
-
|
|
1521
|
+
this.log.info('PuppetService', `messageSendContact(${conversationId}, ${contactId}) about to call grpc`);
|
|
1457
1522
|
const response = await util_1.default.promisify(this.grpcManager.client.messageSendContact
|
|
1458
1523
|
.bind(this.grpcManager.client))(request);
|
|
1459
1524
|
const messageId = response.getId();
|
|
1460
|
-
|
|
1525
|
+
this.log.info('PuppetService', `messageSendContact(${conversationId}, ${contactId}) grpc called, messageId: ${messageId}`);
|
|
1461
1526
|
if (messageId) {
|
|
1462
1527
|
return messageId;
|
|
1463
1528
|
}
|
|
@@ -1472,7 +1537,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
1472
1537
|
}
|
|
1473
1538
|
}
|
|
1474
1539
|
async messageSendUrl(conversationId, urlLinkPayload) {
|
|
1475
|
-
|
|
1540
|
+
this.log.verbose('PuppetService', 'messageSendUrl("%s", %s)', conversationId, JSON.stringify(urlLinkPayload));
|
|
1476
1541
|
const request = new wechaty_grpc_1.puppet.MessageSendUrlRequest();
|
|
1477
1542
|
request.setConversationId(conversationId);
|
|
1478
1543
|
const pbUrlLinkPayload = new wechaty_grpc_1.puppet.UrlLinkPayload();
|
|
@@ -1487,11 +1552,11 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
1487
1552
|
request.setUrlLink(pbUrlLinkPayload);
|
|
1488
1553
|
// Deprecated: will be removed after Dec 31, 2022
|
|
1489
1554
|
request.setUrlLinkDeprecated(JSON.stringify(urlLinkPayload));
|
|
1490
|
-
|
|
1555
|
+
this.log.info('PuppetService', `messageSendUrl(${conversationId}, ${urlLinkPayload}) about to call grpc`);
|
|
1491
1556
|
const response = await util_1.default.promisify(this.grpcManager.client.messageSendUrl
|
|
1492
1557
|
.bind(this.grpcManager.client))(request);
|
|
1493
1558
|
const messageId = response.getId();
|
|
1494
|
-
|
|
1559
|
+
this.log.info('PuppetService', `messageSendUrl(${conversationId}, ${urlLinkPayload}) grpc called, messageId: ${messageId}`);
|
|
1495
1560
|
if (messageId) {
|
|
1496
1561
|
return messageId;
|
|
1497
1562
|
}
|
|
@@ -1506,22 +1571,22 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
1506
1571
|
}
|
|
1507
1572
|
}
|
|
1508
1573
|
async messageSendPost(conversationId, postPayload) {
|
|
1509
|
-
|
|
1574
|
+
this.log.verbose('PuppetService', 'messageSendPost("%s", %s)', conversationId, JSON.stringify(postPayload));
|
|
1510
1575
|
const request = new wechaty_grpc_1.puppet.MessageSendPostRequest();
|
|
1511
1576
|
const post = await (0, pb_payload_helper_js_1.postPayloadToPb)(wechaty_grpc_1.puppet, postPayload, this.serializeFileBox.bind(this));
|
|
1512
1577
|
request.setContent(post);
|
|
1513
1578
|
request.setConversationId(conversationId);
|
|
1514
|
-
|
|
1579
|
+
this.log.info('PuppetService', `messageSendPost(${conversationId}, ${postPayload}) about to call grpc`);
|
|
1515
1580
|
const response = await util_1.default.promisify(this.grpcManager.client.messageSendPost
|
|
1516
1581
|
.bind(this.grpcManager.client))(request);
|
|
1517
1582
|
const messageId = response.getId();
|
|
1518
|
-
|
|
1583
|
+
this.log.info('PuppetService', `messageSendPost(${conversationId}, ${postPayload}) grpc called, messageId: ${messageId}`);
|
|
1519
1584
|
if (messageId) {
|
|
1520
1585
|
return messageId;
|
|
1521
1586
|
}
|
|
1522
1587
|
}
|
|
1523
1588
|
async messageUrl(messageId) {
|
|
1524
|
-
|
|
1589
|
+
this.log.verbose('PuppetService', 'messageUrl(%s)', messageId);
|
|
1525
1590
|
const request = new wechaty_grpc_1.puppet.MessageUrlRequest();
|
|
1526
1591
|
request.setId(messageId);
|
|
1527
1592
|
const response = await util_1.default.promisify(this.grpcManager.client.messageUrl
|
|
@@ -1540,7 +1605,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
1540
1605
|
return payload;
|
|
1541
1606
|
}
|
|
1542
1607
|
async getMessageBroadcastTarget() {
|
|
1543
|
-
|
|
1608
|
+
this.log.verbose('PuppetService', 'getMessageBroadcastTarget()');
|
|
1544
1609
|
const request = new wechaty_grpc_1.puppet.GetMessageBroadcastTargetRequest();
|
|
1545
1610
|
const response = await util_1.default.promisify(this.grpcManager.client.getMessageBroadcastTarget.bind(this.grpcManager.client))(request);
|
|
1546
1611
|
return {
|
|
@@ -1549,7 +1614,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
1549
1614
|
};
|
|
1550
1615
|
}
|
|
1551
1616
|
async createMessageBroadcast(targets, content) {
|
|
1552
|
-
|
|
1617
|
+
this.log.verbose('PuppetService', 'createMessageBroadcast()');
|
|
1553
1618
|
if (!PUPPET.payloads.isPostClient(content)) {
|
|
1554
1619
|
throw new Error('can only create broadcast with client post');
|
|
1555
1620
|
}
|
|
@@ -1561,7 +1626,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
1561
1626
|
return response.getId();
|
|
1562
1627
|
}
|
|
1563
1628
|
async getMessageBroadcastStatus(id) {
|
|
1564
|
-
|
|
1629
|
+
this.log.verbose('PuppetService', 'getMessageBroadcastStatus()');
|
|
1565
1630
|
const request = new wechaty_grpc_1.puppet.GetMessageBroadcastStatusRequest();
|
|
1566
1631
|
request.setId(id);
|
|
1567
1632
|
const response = await util_1.default.promisify(this.grpcManager.client.getMessageBroadcastStatus.bind(this.grpcManager.client))(request);
|
|
@@ -1585,10 +1650,10 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
1585
1650
|
*
|
|
1586
1651
|
*/
|
|
1587
1652
|
async roomRawPayload(id) {
|
|
1588
|
-
|
|
1653
|
+
this.log.verbose('PuppetService', 'roomRawPayload(%s)', id);
|
|
1589
1654
|
const cachedPayload = await this._payloadStore.room?.get(id);
|
|
1590
1655
|
if (cachedPayload) {
|
|
1591
|
-
|
|
1656
|
+
this.log.silly('PuppetService', 'roomRawPayload(%s) cache HIT', id);
|
|
1592
1657
|
return cachedPayload;
|
|
1593
1658
|
}
|
|
1594
1659
|
const request = new wechaty_grpc_1.puppet.RoomPayloadRequest();
|
|
@@ -1612,16 +1677,16 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
1612
1677
|
payload.createTime = (0, timestamp_js_1.millisecondsFromTimestamp)(createTime);
|
|
1613
1678
|
}
|
|
1614
1679
|
await this._payloadStore.room?.set(id, payload);
|
|
1615
|
-
|
|
1680
|
+
this.log.silly('PuppetService', 'roomRawPayload(%s) cache SET', id);
|
|
1616
1681
|
return payload;
|
|
1617
1682
|
}
|
|
1618
1683
|
async roomRawPayloadParser(payload) {
|
|
1619
|
-
// log.silly('PuppetService', 'roomRawPayloadParser({id:%s})', payload.id)
|
|
1684
|
+
// this.log.silly('PuppetService', 'roomRawPayloadParser({id:%s})', payload.id)
|
|
1620
1685
|
// passthrough
|
|
1621
1686
|
return payload;
|
|
1622
1687
|
}
|
|
1623
1688
|
async batchRoomRawPayload(roomIdList) {
|
|
1624
|
-
|
|
1689
|
+
this.log.verbose('PuppetService', 'batchRoomRawPayload(%s)', roomIdList);
|
|
1625
1690
|
const result = new Map();
|
|
1626
1691
|
const roomIdSet = new Set(roomIdList);
|
|
1627
1692
|
const needGetSet = new Set();
|
|
@@ -1664,7 +1729,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
1664
1729
|
}
|
|
1665
1730
|
}
|
|
1666
1731
|
catch (e) {
|
|
1667
|
-
|
|
1732
|
+
this.log.error('PuppetService', 'batchRoomRawPayload(%s, %s) error: %s, use one by one method', roomIdList, needGetSet, e);
|
|
1668
1733
|
for (const roomId of needGetSet) {
|
|
1669
1734
|
const payload = await this.roomRawPayload(roomId);
|
|
1670
1735
|
result.set(roomId, payload);
|
|
@@ -1674,13 +1739,13 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
1674
1739
|
return result;
|
|
1675
1740
|
}
|
|
1676
1741
|
async roomList() {
|
|
1677
|
-
|
|
1742
|
+
this.log.verbose('PuppetService', 'roomList()');
|
|
1678
1743
|
const response = await util_1.default.promisify(this.grpcManager.client.roomList
|
|
1679
1744
|
.bind(this.grpcManager.client))(new wechaty_grpc_1.puppet.RoomListRequest());
|
|
1680
1745
|
return response.getIdsList();
|
|
1681
1746
|
}
|
|
1682
1747
|
async roomDel(roomId, contactIds) {
|
|
1683
|
-
|
|
1748
|
+
this.log.verbose('PuppetService', 'roomDel(%s, %s)', roomId, contactIds);
|
|
1684
1749
|
const request = new wechaty_grpc_1.puppet.RoomDelRequest();
|
|
1685
1750
|
request.setId(roomId);
|
|
1686
1751
|
if (Array.isArray(contactIds)) {
|
|
@@ -1696,7 +1761,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
1696
1761
|
.bind(this.grpcManager.client))(request);
|
|
1697
1762
|
}
|
|
1698
1763
|
async roomDelV2(roomId, contactIds) {
|
|
1699
|
-
|
|
1764
|
+
this.log.verbose('PuppetService', 'roomDelV2(%s, %s)', roomId, contactIds);
|
|
1700
1765
|
const request = new wechaty_grpc_1.puppet.RoomDelV2Request();
|
|
1701
1766
|
request.setId(roomId);
|
|
1702
1767
|
request.setContactIdsList(contactIds);
|
|
@@ -1709,7 +1774,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
1709
1774
|
};
|
|
1710
1775
|
}
|
|
1711
1776
|
async roomAvatar(roomId) {
|
|
1712
|
-
|
|
1777
|
+
this.log.verbose('PuppetService', 'roomAvatar(%s)', roomId);
|
|
1713
1778
|
const request = new wechaty_grpc_1.puppet.RoomAvatarRequest();
|
|
1714
1779
|
request.setId(roomId);
|
|
1715
1780
|
const response = await util_1.default.promisify(this.grpcManager.client.roomAvatar
|
|
@@ -1718,7 +1783,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
1718
1783
|
return this.FileBoxUuid.fromJSON(jsonText);
|
|
1719
1784
|
}
|
|
1720
1785
|
async roomAdd(roomId, contactId, inviteOnly, quoteIds) {
|
|
1721
|
-
|
|
1786
|
+
this.log.verbose('PuppetService', 'roomAdd(%s, %s)', roomId, contactId);
|
|
1722
1787
|
const request = new wechaty_grpc_1.puppet.RoomAddRequest();
|
|
1723
1788
|
request.setId(roomId);
|
|
1724
1789
|
if (Array.isArray(contactId)) {
|
|
@@ -1733,7 +1798,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
1733
1798
|
.bind(this.grpcManager.client))(request);
|
|
1734
1799
|
}
|
|
1735
1800
|
async roomAddV2(roomId, contactIds, inviteOnly, quoteIds) {
|
|
1736
|
-
|
|
1801
|
+
this.log.verbose('PuppetService', 'roomAddV2(%s, %s)', roomId, contactIds);
|
|
1737
1802
|
const request = new wechaty_grpc_1.puppet.RoomAddV2Request();
|
|
1738
1803
|
request.setId(roomId);
|
|
1739
1804
|
request.setContactIdsList(contactIds);
|
|
@@ -1748,7 +1813,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
1748
1813
|
};
|
|
1749
1814
|
}
|
|
1750
1815
|
async roomTopic(roomId, topic) {
|
|
1751
|
-
|
|
1816
|
+
this.log.verbose('PuppetService', 'roomTopic(%s, %s)', roomId, topic);
|
|
1752
1817
|
/**
|
|
1753
1818
|
* Get
|
|
1754
1819
|
*/
|
|
@@ -1786,7 +1851,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
1786
1851
|
.bind(this.grpcManager.client))(request);
|
|
1787
1852
|
}
|
|
1788
1853
|
async roomRemark(roomId, remark) {
|
|
1789
|
-
|
|
1854
|
+
this.log.verbose('PuppetService', 'roomRemark(%s)', roomId);
|
|
1790
1855
|
const request = new wechaty_grpc_1.puppet.RoomRemarkRequest();
|
|
1791
1856
|
request.setId(roomId);
|
|
1792
1857
|
request.setRemark(remark);
|
|
@@ -1794,7 +1859,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
1794
1859
|
.bind(this.grpcManager.client))(request);
|
|
1795
1860
|
}
|
|
1796
1861
|
async roomCreate(contactIdList, topic) {
|
|
1797
|
-
|
|
1862
|
+
this.log.verbose('PuppetService', 'roomCreate(%s, %s)', contactIdList, topic);
|
|
1798
1863
|
const request = new wechaty_grpc_1.puppet.RoomCreateRequest();
|
|
1799
1864
|
request.setContactIdsList(contactIdList);
|
|
1800
1865
|
request.setTopic(topic);
|
|
@@ -1803,14 +1868,14 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
1803
1868
|
return response.getId();
|
|
1804
1869
|
}
|
|
1805
1870
|
async roomQuit(roomId) {
|
|
1806
|
-
|
|
1871
|
+
this.log.verbose('PuppetService', 'roomQuit(%s)', roomId);
|
|
1807
1872
|
const request = new wechaty_grpc_1.puppet.RoomQuitRequest();
|
|
1808
1873
|
request.setId(roomId);
|
|
1809
1874
|
await util_1.default.promisify(this.grpcManager.client.roomQuit
|
|
1810
1875
|
.bind(this.grpcManager.client))(request);
|
|
1811
1876
|
}
|
|
1812
1877
|
async roomQRCode(roomId) {
|
|
1813
|
-
|
|
1878
|
+
this.log.verbose('PuppetService', 'roomQRCode(%s)', roomId);
|
|
1814
1879
|
const request = new wechaty_grpc_1.puppet.RoomQRCodeRequest();
|
|
1815
1880
|
request.setId(roomId);
|
|
1816
1881
|
const response = await util_1.default.promisify(this.grpcManager.client.roomQRCode
|
|
@@ -1818,7 +1883,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
1818
1883
|
return response.getQrcode();
|
|
1819
1884
|
}
|
|
1820
1885
|
async roomParseDynamicQRCode(url) {
|
|
1821
|
-
|
|
1886
|
+
this.log.verbose('PuppetService', 'roomParseDynamicQRCode(%s)', url);
|
|
1822
1887
|
const request = new wechaty_grpc_1.puppet.RoomParseDynamicQRCodeRequest();
|
|
1823
1888
|
request.setUrl(url);
|
|
1824
1889
|
const response = await util_1.default.promisify(this.grpcManager.client.roomParseDynamicQRCode
|
|
@@ -1830,7 +1895,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
1830
1895
|
};
|
|
1831
1896
|
}
|
|
1832
1897
|
async roomMemberList(roomId) {
|
|
1833
|
-
|
|
1898
|
+
this.log.verbose('PuppetService', 'roomMemberList(%s)', roomId);
|
|
1834
1899
|
const request = new wechaty_grpc_1.puppet.RoomMemberListRequest();
|
|
1835
1900
|
request.setId(roomId);
|
|
1836
1901
|
const response = await util_1.default.promisify(this.grpcManager.client.roomMemberList
|
|
@@ -1838,11 +1903,11 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
1838
1903
|
return response.getMemberIdsList();
|
|
1839
1904
|
}
|
|
1840
1905
|
async roomMemberRawPayload(roomId, contactId) {
|
|
1841
|
-
|
|
1906
|
+
this.log.verbose('PuppetService', 'roomMemberRawPayload(%s, %s)', roomId, contactId);
|
|
1842
1907
|
const cachedPayload = await this._payloadStore.roomMember?.get(roomId);
|
|
1843
1908
|
const cachedRoomMemberPayload = cachedPayload && cachedPayload[contactId];
|
|
1844
1909
|
if (cachedRoomMemberPayload) {
|
|
1845
|
-
|
|
1910
|
+
this.log.silly('PuppetService', 'roomMemberRawPayload(%s, %s) cache HIT', roomId, contactId);
|
|
1846
1911
|
return cachedRoomMemberPayload;
|
|
1847
1912
|
}
|
|
1848
1913
|
const request = new wechaty_grpc_1.puppet.RoomMemberPayloadRequest();
|
|
@@ -1864,16 +1929,16 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
1864
1929
|
...cachedPayload,
|
|
1865
1930
|
[contactId]: payload,
|
|
1866
1931
|
});
|
|
1867
|
-
|
|
1932
|
+
this.log.silly('PuppetService', 'roomMemberRawPayload(%s, %s) cache SET', roomId, contactId);
|
|
1868
1933
|
return payload;
|
|
1869
1934
|
}
|
|
1870
1935
|
async roomMemberRawPayloadParser(payload) {
|
|
1871
|
-
// log.silly('PuppetService', 'roomMemberRawPayloadParser({id:%s})', payload.id)
|
|
1936
|
+
// this.log.silly('PuppetService', 'roomMemberRawPayloadParser({id:%s})', payload.id)
|
|
1872
1937
|
// passthrough
|
|
1873
1938
|
return payload;
|
|
1874
1939
|
}
|
|
1875
1940
|
async batchRoomMemberRawPayload(roomId, contactIdList) {
|
|
1876
|
-
|
|
1941
|
+
this.log.verbose('PuppetService', 'batchRoomMemberRawPayload(%s, %s)', roomId, contactIdList);
|
|
1877
1942
|
const result = new Map();
|
|
1878
1943
|
const contactIdSet = new Set(contactIdList);
|
|
1879
1944
|
let needGetSet = new Set();
|
|
@@ -1909,7 +1974,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
1909
1974
|
await this._payloadStore.roomMember?.set(roomId, cachedPayload);
|
|
1910
1975
|
}
|
|
1911
1976
|
catch (e) {
|
|
1912
|
-
|
|
1977
|
+
this.log.error('PuppetService', 'batchRoomMemberRawPayload(%s, %s) error: %s, use one by one method', roomId, needGetSet, e);
|
|
1913
1978
|
for (const contactId of needGetSet) {
|
|
1914
1979
|
const payload = await this.roomMemberRawPayload(roomId, contactId);
|
|
1915
1980
|
result.set(contactId, payload);
|
|
@@ -1919,7 +1984,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
1919
1984
|
return result;
|
|
1920
1985
|
}
|
|
1921
1986
|
async roomAnnounce(roomId, text) {
|
|
1922
|
-
|
|
1987
|
+
this.log.verbose('PuppetService', 'roomAnnounce(%s%s)', roomId, typeof text === 'undefined'
|
|
1923
1988
|
? ''
|
|
1924
1989
|
: `, ${text}`);
|
|
1925
1990
|
/**
|
|
@@ -1960,14 +2025,14 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
1960
2025
|
return '';
|
|
1961
2026
|
}
|
|
1962
2027
|
async roomInvitationAccept(roomInvitationId) {
|
|
1963
|
-
|
|
2028
|
+
this.log.verbose('PuppetService', 'roomInvitationAccept(%s)', roomInvitationId);
|
|
1964
2029
|
const request = new wechaty_grpc_1.puppet.RoomInvitationAcceptRequest();
|
|
1965
2030
|
request.setId(roomInvitationId);
|
|
1966
2031
|
await util_1.default.promisify(this.grpcManager.client.roomInvitationAccept
|
|
1967
2032
|
.bind(this.grpcManager.client))(request);
|
|
1968
2033
|
}
|
|
1969
2034
|
async roomInvitationAcceptByQRCode(qrcode) {
|
|
1970
|
-
|
|
2035
|
+
this.log.verbose('PuppetService', 'roomInvitationAcceptByQRCode(%s)', qrcode);
|
|
1971
2036
|
const request = new wechaty_grpc_1.puppet.RoomInvitationAcceptByQRCodeRequest();
|
|
1972
2037
|
request.setQrcode(qrcode);
|
|
1973
2038
|
const response = await util_1.default.promisify(this.grpcManager.client.roomInvitationAcceptByQRCode
|
|
@@ -1978,7 +2043,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
1978
2043
|
};
|
|
1979
2044
|
}
|
|
1980
2045
|
async roomInvitationRawPayload(id) {
|
|
1981
|
-
|
|
2046
|
+
this.log.verbose('PuppetService', 'roomInvitationRawPayload(%s)', id);
|
|
1982
2047
|
const request = new wechaty_grpc_1.puppet.RoomInvitationPayloadRequest();
|
|
1983
2048
|
request.setId(id);
|
|
1984
2049
|
const response = await util_1.default.promisify(this.grpcManager.client.roomInvitationPayload
|
|
@@ -2012,12 +2077,12 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
2012
2077
|
return payload;
|
|
2013
2078
|
}
|
|
2014
2079
|
async roomInvitationRawPayloadParser(payload) {
|
|
2015
|
-
// log.silly('PuppetService', 'roomInvitationRawPayloadParser({id:%s})', payload.id)
|
|
2080
|
+
// this.log.silly('PuppetService', 'roomInvitationRawPayloadParser({id:%s})', payload.id)
|
|
2016
2081
|
// passthrough
|
|
2017
2082
|
return payload;
|
|
2018
2083
|
}
|
|
2019
2084
|
async roomPermission(roomId, permission) {
|
|
2020
|
-
|
|
2085
|
+
this.log.verbose('PuppetService', 'roomPermission(%s, %s)', roomId, JSON.stringify(permission));
|
|
2021
2086
|
const request = new wechaty_grpc_1.puppet.RoomPermissionRequest();
|
|
2022
2087
|
request.setId(roomId);
|
|
2023
2088
|
let set = false;
|
|
@@ -2043,7 +2108,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
2043
2108
|
return set ? undefined : result;
|
|
2044
2109
|
}
|
|
2045
2110
|
async roomOwnerTransfer(roomId, contactId) {
|
|
2046
|
-
|
|
2111
|
+
this.log.verbose('PuppetService', 'roomOwnerTransfer(%s, %s)', roomId, contactId);
|
|
2047
2112
|
const request = new wechaty_grpc_1.puppet.RoomOwnerTransferRequest();
|
|
2048
2113
|
request.setId(roomId);
|
|
2049
2114
|
request.setContactId(contactId);
|
|
@@ -2051,7 +2116,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
2051
2116
|
.bind(this.grpcManager.client))(request);
|
|
2052
2117
|
}
|
|
2053
2118
|
async roomAddAdmins(roomId, contactIdList) {
|
|
2054
|
-
|
|
2119
|
+
this.log.verbose('PuppetService', 'roomAddAdmins(%s, %s)', roomId, contactIdList);
|
|
2055
2120
|
const request = new wechaty_grpc_1.puppet.RoomAdminsRequest();
|
|
2056
2121
|
request.setId(roomId);
|
|
2057
2122
|
request.setContactIdsList(contactIdList);
|
|
@@ -2059,7 +2124,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
2059
2124
|
.bind(this.grpcManager.client))(request);
|
|
2060
2125
|
}
|
|
2061
2126
|
async roomDelAdmins(roomId, contactIdList) {
|
|
2062
|
-
|
|
2127
|
+
this.log.verbose('PuppetService', 'roomDelAdmins(%s, %s)', roomId, contactIdList);
|
|
2063
2128
|
const request = new wechaty_grpc_1.puppet.RoomAdminsRequest();
|
|
2064
2129
|
request.setId(roomId);
|
|
2065
2130
|
request.setContactIdsList(contactIdList);
|
|
@@ -2067,7 +2132,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
2067
2132
|
.bind(this.grpcManager.client))(request);
|
|
2068
2133
|
}
|
|
2069
2134
|
async roomDismiss(roomId) {
|
|
2070
|
-
|
|
2135
|
+
this.log.verbose('PuppetService', 'roomDelAdmins(%s)', roomId);
|
|
2071
2136
|
const request = new wechaty_grpc_1.puppet.RoomDismissRequest();
|
|
2072
2137
|
request.setId(roomId);
|
|
2073
2138
|
await util_1.default.promisify(this.grpcManager.client.roomDismiss
|
|
@@ -2079,7 +2144,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
2079
2144
|
*
|
|
2080
2145
|
*/
|
|
2081
2146
|
async friendshipSearchPhone(phone, type) {
|
|
2082
|
-
|
|
2147
|
+
this.log.verbose('PuppetService', 'friendshipSearchPhone(%s)', phone);
|
|
2083
2148
|
const request = new wechaty_grpc_1.puppet.FriendshipSearchPhoneRequest();
|
|
2084
2149
|
request.setPhone(phone);
|
|
2085
2150
|
if (typeof (type) === 'undefined') {
|
|
@@ -2104,7 +2169,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
2104
2169
|
return null;
|
|
2105
2170
|
}
|
|
2106
2171
|
async friendshipSearchHandle(handle, type) {
|
|
2107
|
-
|
|
2172
|
+
this.log.verbose('PuppetService', 'friendshipSearchHandle(%s)', handle);
|
|
2108
2173
|
const request = new wechaty_grpc_1.puppet.FriendshipSearchHandleRequest();
|
|
2109
2174
|
/**
|
|
2110
2175
|
* TODO: use `setHandle()` in v2.0.0
|
|
@@ -2133,7 +2198,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
2133
2198
|
return null;
|
|
2134
2199
|
}
|
|
2135
2200
|
async friendshipRawPayload(id) {
|
|
2136
|
-
|
|
2201
|
+
this.log.verbose('PuppetService', 'friendshipRawPayload(%s)', id);
|
|
2137
2202
|
const request = new wechaty_grpc_1.puppet.FriendshipPayloadRequest();
|
|
2138
2203
|
request.setId(id);
|
|
2139
2204
|
const response = await util_1.default.promisify(this.grpcManager.client.friendshipPayload
|
|
@@ -2150,12 +2215,12 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
2150
2215
|
return payload;
|
|
2151
2216
|
}
|
|
2152
2217
|
async friendshipRawPayloadParser(payload) {
|
|
2153
|
-
// log.silly('PuppetService', 'friendshipRawPayloadParser({id:%s})', payload.id)
|
|
2218
|
+
// this.log.silly('PuppetService', 'friendshipRawPayloadParser({id:%s})', payload.id)
|
|
2154
2219
|
// passthrough
|
|
2155
2220
|
return payload;
|
|
2156
2221
|
}
|
|
2157
2222
|
async friendshipAdd(contactId, options) {
|
|
2158
|
-
|
|
2223
|
+
this.log.verbose('PuppetService', 'friendshipAdd(%s, %s)', contactId, JSON.stringify(options));
|
|
2159
2224
|
const request = new wechaty_grpc_1.puppet.FriendshipAddRequest();
|
|
2160
2225
|
request.setContactId(contactId);
|
|
2161
2226
|
// FIXME: for backward compatibility, need to be removed after all puppet has updated.
|
|
@@ -2186,7 +2251,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
2186
2251
|
.bind(this.grpcManager.client))(request);
|
|
2187
2252
|
}
|
|
2188
2253
|
async friendshipAccept(friendshipId) {
|
|
2189
|
-
|
|
2254
|
+
this.log.verbose('PuppetService', 'friendshipAccept(%s)', friendshipId);
|
|
2190
2255
|
const request = new wechaty_grpc_1.puppet.FriendshipAcceptRequest();
|
|
2191
2256
|
request.setId(friendshipId);
|
|
2192
2257
|
await util_1.default.promisify(this.grpcManager.client.friendshipAccept
|
|
@@ -2198,7 +2263,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
2198
2263
|
*
|
|
2199
2264
|
*/
|
|
2200
2265
|
async tagContactTagAdd(tagIds, contactIds) {
|
|
2201
|
-
|
|
2266
|
+
this.log.verbose('PuppetService', 'tagContactTagAdd(%s, %s)', tagIds, contactIds);
|
|
2202
2267
|
const request = new wechaty_grpc_1.puppet.TagContactTagAddRequest();
|
|
2203
2268
|
request.setTagIdsList(tagIds);
|
|
2204
2269
|
request.setContactIdsList(contactIds);
|
|
@@ -2206,7 +2271,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
2206
2271
|
.bind(this.grpcManager.client))(request);
|
|
2207
2272
|
}
|
|
2208
2273
|
async tagContactTagRemove(tagIds, contactIds) {
|
|
2209
|
-
|
|
2274
|
+
this.log.verbose('PuppetService', 'tagContactTagRemove(%s, %s)', tagIds, contactIds);
|
|
2210
2275
|
const request = new wechaty_grpc_1.puppet.TagContactTagRemoveRequest();
|
|
2211
2276
|
request.setTagIdsList(tagIds);
|
|
2212
2277
|
request.setContactIdsList(contactIds);
|
|
@@ -2214,7 +2279,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
2214
2279
|
.bind(this.grpcManager.client))(request);
|
|
2215
2280
|
}
|
|
2216
2281
|
async tagGroupAdd(tagGroupName) {
|
|
2217
|
-
|
|
2282
|
+
this.log.verbose('PuppetService', 'tagGroupAdd(%s)', tagGroupName);
|
|
2218
2283
|
const request = new wechaty_grpc_1.puppet.TagGroupAddRequest();
|
|
2219
2284
|
request.setTagGroupName(tagGroupName);
|
|
2220
2285
|
const result = await util_1.default.promisify(this.grpcManager.client.tagGroupAdd
|
|
@@ -2223,14 +2288,14 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
2223
2288
|
return id;
|
|
2224
2289
|
}
|
|
2225
2290
|
async tagGroupDelete(tagGroupId) {
|
|
2226
|
-
|
|
2291
|
+
this.log.verbose('PuppetService', 'tagGroupDelete(%s)', tagGroupId);
|
|
2227
2292
|
const request = new wechaty_grpc_1.puppet.TagGroupDeleteRequest();
|
|
2228
2293
|
request.setTagGroupId(tagGroupId);
|
|
2229
2294
|
await util_1.default.promisify(this.grpcManager.client.tagGroupDelete
|
|
2230
2295
|
.bind(this.grpcManager.client))(request);
|
|
2231
2296
|
}
|
|
2232
2297
|
async tagTagAdd(tagNameList, tagGroupId) {
|
|
2233
|
-
|
|
2298
|
+
this.log.verbose('PuppetService', 'tagTagAdd(%s, %s)', tagNameList, tagGroupId);
|
|
2234
2299
|
const request = new wechaty_grpc_1.puppet.TagTagAddRequest();
|
|
2235
2300
|
if (typeof tagGroupId !== 'undefined') {
|
|
2236
2301
|
request.setTagGroupId(tagGroupId);
|
|
@@ -2245,14 +2310,14 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
2245
2310
|
return tagInfoList;
|
|
2246
2311
|
}
|
|
2247
2312
|
async tagTagDelete(tagIdList) {
|
|
2248
|
-
|
|
2313
|
+
this.log.verbose('PuppetService', 'tagTagDelete(%s)', tagIdList);
|
|
2249
2314
|
const request = new wechaty_grpc_1.puppet.TagTagDeleteRequest();
|
|
2250
2315
|
request.setTagIdList(tagIdList);
|
|
2251
2316
|
await util_1.default.promisify(this.grpcManager.client.tagTagDelete
|
|
2252
2317
|
.bind(this.grpcManager.client))(request);
|
|
2253
2318
|
}
|
|
2254
2319
|
async tagTagModify(tagNewInfoList) {
|
|
2255
|
-
|
|
2320
|
+
this.log.verbose('PuppetService', 'tagTagModify(%o)', tagNewInfoList);
|
|
2256
2321
|
const request = new wechaty_grpc_1.puppet.TagTagModifyRequest();
|
|
2257
2322
|
const newInfoList = tagNewInfoList.map(i => {
|
|
2258
2323
|
const tagInfo = new wechaty_grpc_1.puppet.TagTagInfo();
|
|
@@ -2270,7 +2335,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
2270
2335
|
return tagInfoList;
|
|
2271
2336
|
}
|
|
2272
2337
|
async tagGroupList() {
|
|
2273
|
-
|
|
2338
|
+
this.log.verbose('PuppetService', 'tagGroupList()');
|
|
2274
2339
|
const request = new wechaty_grpc_1.puppet.TagGroupListRequest();
|
|
2275
2340
|
const result = await util_1.default.promisify(this.grpcManager.client.tagGroupList
|
|
2276
2341
|
.bind(this.grpcManager.client))(request);
|
|
@@ -2278,7 +2343,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
2278
2343
|
return groupIds;
|
|
2279
2344
|
}
|
|
2280
2345
|
async tagGroupTagList(tagGroupId) {
|
|
2281
|
-
|
|
2346
|
+
this.log.verbose('PuppetService', 'tagGroupTagList(%s)', tagGroupId);
|
|
2282
2347
|
const request = new wechaty_grpc_1.puppet.TagGroupTagListRequest();
|
|
2283
2348
|
if (typeof tagGroupId !== 'undefined') {
|
|
2284
2349
|
request.setTagGroupId(tagGroupId);
|
|
@@ -2289,7 +2354,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
2289
2354
|
return tagIds;
|
|
2290
2355
|
}
|
|
2291
2356
|
async tagTagList() {
|
|
2292
|
-
|
|
2357
|
+
this.log.verbose('PuppetService', 'tagTagList()');
|
|
2293
2358
|
const request = new wechaty_grpc_1.puppet.TagTagListRequest();
|
|
2294
2359
|
const result = await util_1.default.promisify(this.grpcManager.client.tagTagList
|
|
2295
2360
|
.bind(this.grpcManager.client))(request);
|
|
@@ -2297,7 +2362,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
2297
2362
|
return tagIds;
|
|
2298
2363
|
}
|
|
2299
2364
|
async tagContactTagList(contactId) {
|
|
2300
|
-
|
|
2365
|
+
this.log.verbose('PuppetService', 'tagContactTagList(%s)', contactId);
|
|
2301
2366
|
const request = new wechaty_grpc_1.puppet.TagContactTagListRequest();
|
|
2302
2367
|
request.setContactId(contactId);
|
|
2303
2368
|
const result = await util_1.default.promisify(this.grpcManager.client.tagContactTagList
|
|
@@ -2306,7 +2371,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
2306
2371
|
return tagIds;
|
|
2307
2372
|
}
|
|
2308
2373
|
async tagTagContactList(tagId) {
|
|
2309
|
-
|
|
2374
|
+
this.log.verbose('PuppetService', 'tagTagContactList(%s)', tagId);
|
|
2310
2375
|
const request = new wechaty_grpc_1.puppet.TagTagContactListRequest();
|
|
2311
2376
|
request.setTagId(tagId);
|
|
2312
2377
|
const result = await util_1.default.promisify(this.grpcManager.client.tagTagContactList
|
|
@@ -2315,10 +2380,10 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
2315
2380
|
return contactIds;
|
|
2316
2381
|
}
|
|
2317
2382
|
async tagGroupPayloadPuppet(id) {
|
|
2318
|
-
|
|
2383
|
+
this.log.verbose('PuppetService', 'tagGroupPayload(%s)', id);
|
|
2319
2384
|
const cachedPayload = await this._payloadStore.tagGroup?.get(id);
|
|
2320
2385
|
if (cachedPayload) {
|
|
2321
|
-
|
|
2386
|
+
this.log.silly('PuppetService', 'tagGroupPayload(%s) cache HIT', id);
|
|
2322
2387
|
return cachedPayload;
|
|
2323
2388
|
}
|
|
2324
2389
|
const request = new wechaty_grpc_1.puppet.TagGroupPayloadRequest();
|
|
@@ -2335,14 +2400,14 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
2335
2400
|
type: grpcPayload.getType(),
|
|
2336
2401
|
};
|
|
2337
2402
|
await this._payloadStore.tagGroup?.set(id, payload);
|
|
2338
|
-
|
|
2403
|
+
this.log.silly('PuppetService', 'tagGroupPayloadPuppet(%s) cache SET', id);
|
|
2339
2404
|
return payload;
|
|
2340
2405
|
}
|
|
2341
2406
|
async tagPayloadPuppet(tagId) {
|
|
2342
|
-
|
|
2407
|
+
this.log.verbose('PuppetService', 'tagPayloadPuppet(%s)', tagId);
|
|
2343
2408
|
const cachedPayload = await this._payloadStore.tag?.get(tagId);
|
|
2344
2409
|
if (cachedPayload) {
|
|
2345
|
-
|
|
2410
|
+
this.log.silly('PuppetService', 'tagPayloadPuppet(%s) cache HIT', tagId);
|
|
2346
2411
|
return cachedPayload;
|
|
2347
2412
|
}
|
|
2348
2413
|
const request = new wechaty_grpc_1.puppet.TagPayloadRequest();
|
|
@@ -2360,7 +2425,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
2360
2425
|
type: grpcPayload.getType(),
|
|
2361
2426
|
};
|
|
2362
2427
|
await this._payloadStore.tag?.set(tagId, payload);
|
|
2363
|
-
|
|
2428
|
+
this.log.silly('PuppetService', 'tagPayloadPuppet(%s) cache SET', tagId);
|
|
2364
2429
|
return payload;
|
|
2365
2430
|
}
|
|
2366
2431
|
/**
|
|
@@ -2369,7 +2434,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
2369
2434
|
*
|
|
2370
2435
|
*/
|
|
2371
2436
|
async postPublish(payload) {
|
|
2372
|
-
|
|
2437
|
+
this.log.verbose('PuppetService', 'postPublish(%s)', payload);
|
|
2373
2438
|
if (!PUPPET.payloads.isPostClient(payload)) {
|
|
2374
2439
|
throw new Error('can only publish client post now');
|
|
2375
2440
|
}
|
|
@@ -2382,13 +2447,13 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
2382
2447
|
return momentId;
|
|
2383
2448
|
}
|
|
2384
2449
|
async postUnpublish(id) {
|
|
2385
|
-
|
|
2450
|
+
this.log.verbose('PuppetService', 'postUnpublish(%s)', id);
|
|
2386
2451
|
const request = new wechaty_grpc_1.puppet.MomentUnpublishRequest();
|
|
2387
2452
|
request.setMomentId(id);
|
|
2388
2453
|
await util_1.default.promisify(this.grpcManager.client.momentUnpublish.bind(this.grpcManager.client))(request);
|
|
2389
2454
|
}
|
|
2390
2455
|
async momentSignature(text) {
|
|
2391
|
-
|
|
2456
|
+
this.log.verbose('PuppetService', 'momentSignature(%s)', text);
|
|
2392
2457
|
const request = new wechaty_grpc_1.puppet.MomentSignatureRequest();
|
|
2393
2458
|
if (text) {
|
|
2394
2459
|
request.setText(text);
|
|
@@ -2399,7 +2464,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
2399
2464
|
return signature;
|
|
2400
2465
|
}
|
|
2401
2466
|
async momentCoverage(cover) {
|
|
2402
|
-
|
|
2467
|
+
this.log.verbose('PuppetService', 'momentCoverage(%s)', JSON.stringify(cover));
|
|
2403
2468
|
const request = new wechaty_grpc_1.puppet.MomentCoverageRequest();
|
|
2404
2469
|
if (cover) {
|
|
2405
2470
|
const serializedFileBox = await this.serializeFileBox(cover);
|
|
@@ -2413,7 +2478,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
2413
2478
|
}
|
|
2414
2479
|
}
|
|
2415
2480
|
async postPayloadSayable(postId, sayableId) {
|
|
2416
|
-
|
|
2481
|
+
this.log.verbose('PuppetService', 'postPayloadSayable(%s, %s)', postId, sayableId);
|
|
2417
2482
|
const request = new wechaty_grpc_1.puppet.PostPayloadSayableRequest();
|
|
2418
2483
|
request.setPostId(postId);
|
|
2419
2484
|
request.setSayableId(sayableId);
|
|
@@ -2465,7 +2530,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
2465
2530
|
}
|
|
2466
2531
|
}
|
|
2467
2532
|
async postRawPayload(id) {
|
|
2468
|
-
|
|
2533
|
+
this.log.verbose('PuppetService', 'postRawPayload(%s)', id);
|
|
2469
2534
|
const request = new wechaty_grpc_1.puppet.PostPayloadRequest();
|
|
2470
2535
|
request.setPostId(id);
|
|
2471
2536
|
const response = await util_1.default.promisify(this.grpcManager.client.postPayload
|
|
@@ -2509,12 +2574,12 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
2509
2574
|
return payload;
|
|
2510
2575
|
}
|
|
2511
2576
|
async postRawPayloadParser(payload) {
|
|
2512
|
-
// log.silly('PuppetService', 'postRawPayloadParser({id:%s})', payload.id)
|
|
2577
|
+
// this.log.silly('PuppetService', 'postRawPayloadParser({id:%s})', payload.id)
|
|
2513
2578
|
// passthrough
|
|
2514
2579
|
return payload;
|
|
2515
2580
|
}
|
|
2516
2581
|
async tap(postId, type, tap = true) {
|
|
2517
|
-
|
|
2582
|
+
this.log.verbose('PuppetService', 'tap(%s, %s, %s)', postId, type, tap);
|
|
2518
2583
|
const request = new wechaty_grpc_1.puppet.PostTapRequest();
|
|
2519
2584
|
request.setPostId(postId);
|
|
2520
2585
|
if (type) {
|
|
@@ -2527,14 +2592,14 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
2527
2592
|
return result;
|
|
2528
2593
|
}
|
|
2529
2594
|
async momentVisibleList() {
|
|
2530
|
-
|
|
2595
|
+
this.log.verbose('PuppetService', 'momentVisibleList()');
|
|
2531
2596
|
const request = new wechaty_grpc_1.puppet.MomentVisibleListRequest();
|
|
2532
2597
|
const response = await util_1.default.promisify(this.grpcManager.client.momentVisibleList.bind(this.grpcManager.client))(request);
|
|
2533
2598
|
const contactIdsList = response.getContactIdsList();
|
|
2534
2599
|
return contactIdsList;
|
|
2535
2600
|
}
|
|
2536
2601
|
async getContactExternalUserId(contactIds, serviceProviderId) {
|
|
2537
|
-
|
|
2602
|
+
this.log.verbose('PuppetService', 'getContactExternalUserId(%s, %s)', JSON.stringify(contactIds), serviceProviderId);
|
|
2538
2603
|
const request = new wechaty_grpc_1.puppet.GetContactExternalUserIdRequest();
|
|
2539
2604
|
request.setContactIdsList(contactIds);
|
|
2540
2605
|
if (serviceProviderId) {
|
|
@@ -2552,7 +2617,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
2552
2617
|
return result;
|
|
2553
2618
|
}
|
|
2554
2619
|
async getRoomAntiSpamStrategyList() {
|
|
2555
|
-
|
|
2620
|
+
this.log.verbose('PuppetService', 'getRoomAntiSpamStrategyList()');
|
|
2556
2621
|
const request = new wechaty_grpc_1.puppet.GetRoomAntiSpamStrategyListRequest();
|
|
2557
2622
|
const response = await util_1.default.promisify(this.grpcManager.client.getRoomAntiSpamStrategyList.bind(this.grpcManager.client))(request);
|
|
2558
2623
|
const result = [];
|
|
@@ -2566,7 +2631,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
2566
2631
|
return result;
|
|
2567
2632
|
}
|
|
2568
2633
|
async getRoomAntiSpamStrategyEffectRoomList(strategyId) {
|
|
2569
|
-
|
|
2634
|
+
this.log.verbose('PuppetService', 'getRoomAntiSpamStrategyEffectRoomList(%s)', strategyId);
|
|
2570
2635
|
const request = new wechaty_grpc_1.puppet.GetRoomAntiSpamStrategyEffectRoomListRequest();
|
|
2571
2636
|
request.setStrategyId(strategyId);
|
|
2572
2637
|
const response = await util_1.default.promisify(this.grpcManager.client.getRoomAntiSpamStrategyEffectRoomList.bind(this.grpcManager.client))(request);
|
|
@@ -2574,7 +2639,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
2574
2639
|
return result;
|
|
2575
2640
|
}
|
|
2576
2641
|
async applyRoomAntiSpamStrategy(strategyId, roomIds, active) {
|
|
2577
|
-
|
|
2642
|
+
this.log.verbose('PuppetService', 'applyRoomAntiSpamStrategy(%s, %s, %s)', strategyId, roomIds, active);
|
|
2578
2643
|
const request = new wechaty_grpc_1.puppet.ApplyRoomAntiSpamStrategyRequest();
|
|
2579
2644
|
request.setStrategyId(strategyId);
|
|
2580
2645
|
request.setRoomIdsList(roomIds);
|
|
@@ -2582,7 +2647,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
2582
2647
|
await util_1.default.promisify(this.grpcManager.client.applyRoomAntiSpamStrategy.bind(this.grpcManager.client))(request);
|
|
2583
2648
|
}
|
|
2584
2649
|
async getCorpMessageInterceptionStrategies() {
|
|
2585
|
-
|
|
2650
|
+
this.log.verbose('PuppetService', 'getCorpMessageInterceptionStrategies()');
|
|
2586
2651
|
const request = new wechaty_grpc_1.puppet.GetCorpMessageInterceptionStrategiesRequest();
|
|
2587
2652
|
const response = await util_1.default.promisify(this.grpcManager.client.getCorpMessageInterceptionStrategies.bind(this.grpcManager.client))(request);
|
|
2588
2653
|
const result = [];
|
|
@@ -2615,15 +2680,15 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
2615
2680
|
reconnectIndicator;
|
|
2616
2681
|
async reset() {
|
|
2617
2682
|
if (!this._grpcManager) {
|
|
2618
|
-
|
|
2683
|
+
this.log.warn('PuppetService', 'grpc manager not constructed, perform regular reset');
|
|
2619
2684
|
return super.reset();
|
|
2620
2685
|
}
|
|
2621
2686
|
if (!this.isLoggedIn) {
|
|
2622
|
-
|
|
2687
|
+
this.log.warn('PuppetService', 'puppet not logged in, perform regular reset');
|
|
2623
2688
|
return super.reset();
|
|
2624
2689
|
}
|
|
2625
2690
|
if (this.reconnectIndicator.value()) {
|
|
2626
|
-
|
|
2691
|
+
this.log.warn('PuppetService', 'already trying to reconnect, pass this one');
|
|
2627
2692
|
return;
|
|
2628
2693
|
}
|
|
2629
2694
|
this.reconnectIndicator.value(true);
|
|
@@ -2673,13 +2738,13 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
2673
2738
|
}
|
|
2674
2739
|
catch (e) {
|
|
2675
2740
|
if (Date.now() - startTime < timeoutMilliseconds) {
|
|
2676
|
-
|
|
2741
|
+
this.log.warn('failed to start stream, will try again in 15 seconds');
|
|
2677
2742
|
await new Promise(resolve => {
|
|
2678
2743
|
setTimeout(resolve, 5000);
|
|
2679
2744
|
});
|
|
2680
2745
|
}
|
|
2681
2746
|
else {
|
|
2682
|
-
|
|
2747
|
+
this.log.warn('failed to start stream and reaches timeout, will perform regular reset');
|
|
2683
2748
|
this.reconnectIndicator.value(false);
|
|
2684
2749
|
return super.reset();
|
|
2685
2750
|
}
|
|
@@ -2696,7 +2761,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
2696
2761
|
});
|
|
2697
2762
|
}
|
|
2698
2763
|
catch (e) {
|
|
2699
|
-
|
|
2764
|
+
this.log.warn('PuppetService', 'waiting for event reset login error, will perform regular reset');
|
|
2700
2765
|
return super.reset();
|
|
2701
2766
|
}
|
|
2702
2767
|
try {
|
|
@@ -2707,7 +2772,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
2707
2772
|
});
|
|
2708
2773
|
}
|
|
2709
2774
|
catch (e) {
|
|
2710
|
-
|
|
2775
|
+
this.log.warn('PuppetService', 'waiting for event reset ready error, will do nothing');
|
|
2711
2776
|
}
|
|
2712
2777
|
}
|
|
2713
2778
|
async getMiscellaneousStoreData() {
|
|
@@ -2721,7 +2786,7 @@ class PuppetService extends PUPPET.Puppet {
|
|
|
2721
2786
|
const lastEventTimestamp = await this._payloadStore.miscellaneous?.get('lastEventTimestamp');
|
|
2722
2787
|
let lastEventSeq = await this._payloadStore.miscellaneous?.get('lastEventSeq');
|
|
2723
2788
|
if ((Date.now() - Number(lastEventTimestamp || 0)) > this.timeoutMilliseconds) {
|
|
2724
|
-
|
|
2789
|
+
this.log.warn(`last event was ${(Date.now() - Number(lastEventTimestamp || 0)) / 1000} seconds ago, will not request event cache`);
|
|
2725
2790
|
lastEventSeq = undefined;
|
|
2726
2791
|
}
|
|
2727
2792
|
const accountId = await this._payloadStore.miscellaneous?.get('accountId');
|