@juzi/wechaty-grpc 1.0.110 → 1.0.111

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.
@@ -10,6 +10,9 @@ export class EventRequest extends jspb.Message {
10
10
  getAccountId(): string;
11
11
  setAccountId(value: string): void;
12
12
 
13
+ getReplayBarrier(): boolean;
14
+ setReplayBarrier(value: boolean): void;
15
+
13
16
  serializeBinary(): Uint8Array;
14
17
  toObject(includeInstance?: boolean): EventRequest.AsObject;
15
18
  static toObject(includeInstance: boolean, msg: EventRequest): EventRequest.AsObject;
@@ -24,6 +27,7 @@ export namespace EventRequest {
24
27
  export type AsObject = {
25
28
  seq: number,
26
29
  accountId: string,
30
+ replayBarrier: boolean,
27
31
  }
28
32
  }
29
33
 
@@ -85,6 +89,7 @@ export interface EventTypeMap {
85
89
  EVENT_TYPE_ORG_BROADCAST_CREATED: 37;
86
90
  EVENT_TYPE_ORG_BROADCAST_SENT: 38;
87
91
  EVENT_TYPE_ROOM_MEMBER_LOAD: 39;
92
+ EVENT_TYPE_REPLAY_COMPLETE: 40;
88
93
  }
89
94
 
90
95
  export const EventType: EventTypeMap;
@@ -93,7 +93,8 @@ proto.wechaty.puppet.EventRequest.prototype.toObject = function(opt_includeInsta
93
93
  proto.wechaty.puppet.EventRequest.toObject = function(includeInstance, msg) {
94
94
  var f, obj = {
95
95
  seq: jspb.Message.getFieldWithDefault(msg, 1, 0),
96
- accountId: jspb.Message.getFieldWithDefault(msg, 2, "")
96
+ accountId: jspb.Message.getFieldWithDefault(msg, 2, ""),
97
+ replayBarrier: jspb.Message.getBooleanFieldWithDefault(msg, 3, false)
97
98
  };
98
99
 
99
100
  if (includeInstance) {
@@ -138,6 +139,10 @@ proto.wechaty.puppet.EventRequest.deserializeBinaryFromReader = function(msg, re
138
139
  var value = /** @type {string} */ (reader.readString());
139
140
  msg.setAccountId(value);
140
141
  break;
142
+ case 3:
143
+ var value = /** @type {boolean} */ (reader.readBool());
144
+ msg.setReplayBarrier(value);
145
+ break;
141
146
  default:
142
147
  reader.skipField();
143
148
  break;
@@ -181,6 +186,13 @@ proto.wechaty.puppet.EventRequest.serializeBinaryToWriter = function(message, wr
181
186
  f
182
187
  );
183
188
  }
189
+ f = message.getReplayBarrier();
190
+ if (f) {
191
+ writer.writeBool(
192
+ 3,
193
+ f
194
+ );
195
+ }
184
196
  };
185
197
 
186
198
 
@@ -220,6 +232,24 @@ proto.wechaty.puppet.EventRequest.prototype.setAccountId = function(value) {
220
232
  };
221
233
 
222
234
 
235
+ /**
236
+ * optional bool replay_barrier = 3;
237
+ * @return {boolean}
238
+ */
239
+ proto.wechaty.puppet.EventRequest.prototype.getReplayBarrier = function() {
240
+ return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 3, false));
241
+ };
242
+
243
+
244
+ /**
245
+ * @param {boolean} value
246
+ * @return {!proto.wechaty.puppet.EventRequest} returns this
247
+ */
248
+ proto.wechaty.puppet.EventRequest.prototype.setReplayBarrier = function(value) {
249
+ return jspb.Message.setProto3BooleanField(this, 3, value);
250
+ };
251
+
252
+
223
253
 
224
254
 
225
255
 
@@ -442,7 +472,8 @@ proto.wechaty.puppet.EventType = {
442
472
  EVENT_TYPE_SAME_NET_VERIFY: 36,
443
473
  EVENT_TYPE_ORG_BROADCAST_CREATED: 37,
444
474
  EVENT_TYPE_ORG_BROADCAST_SENT: 38,
445
- EVENT_TYPE_ROOM_MEMBER_LOAD: 39
475
+ EVENT_TYPE_ROOM_MEMBER_LOAD: 39,
476
+ EVENT_TYPE_REPLAY_COMPLETE: 40
446
477
  };
447
478
 
448
479
  goog.object.extend(exports, proto.wechaty.puppet);
@@ -9,7 +9,7 @@ info:
9
9
 
10
10
  Wechaty Puppet Service is the RESTful API for Wechaty API, which is build on
11
11
  top of the Wechaty Puppet Abstraction and the gRPC proto definition.
12
- version: 1.0.110
12
+ version: 1.0.111
13
13
  contact:
14
14
  name: Wechaty
15
15
  url: https://github.com/wechaty/openapi
@@ -1233,6 +1233,11 @@ paths:
1233
1233
  in: query
1234
1234
  required: false
1235
1235
  type: string
1236
+ - name: replayBarrier
1237
+ description: request a completion marker after ordered replay
1238
+ in: query
1239
+ required: false
1240
+ type: boolean
1236
1241
  tags:
1237
1242
  - Puppet
1238
1243
  /friendship/accept/{id}:
@@ -4315,12 +4320,13 @@ definitions:
4315
4320
  - EVENT_TYPE_ORG_BROADCAST_CREATED
4316
4321
  - EVENT_TYPE_ORG_BROADCAST_SENT
4317
4322
  - EVENT_TYPE_ROOM_MEMBER_LOAD
4323
+ - EVENT_TYPE_REPLAY_COMPLETE
4318
4324
  default: EVENT_TYPE_UNSPECIFIED
4319
- description: >-
4320
- - EVENT_TYPE_SAME_NET_VERIFY: same network verify for personal wechat
4321
- login on Mac protocol
4325
+ description: |2-
4326
+ - EVENT_TYPE_SAME_NET_VERIFY: same network verify for personal wechat login on Mac protocol
4322
4327
  - EVENT_TYPE_ORG_BROADCAST_CREATED: wecom org (admin) broadcast plan arrived: member received the broadcast assistant card
4323
4328
  - EVENT_TYPE_ORG_BROADCAST_SENT: wecom org (admin) broadcast plan executed, from any client
4329
+ - EVENT_TYPE_REPLAY_COMPLETE: Opt-in stream barrier: payload {accountId, throughSeq}, envelope seq=0.
4324
4330
  puppetFriendshipAcceptResponse:
4325
4331
  type: object
4326
4332
  puppetFriendshipAddResponse:
@@ -3,7 +3,7 @@
3
3
  "info": {
4
4
  "title": "Wechaty Puppet Service OpenAPI Specification",
5
5
  "description": "Wechaty is a Conversational RPA SDK for chatbot makers. With only 6 lines of code, you can create a bot on the most popular IMs like WeChat, Whatsapp, WeCom, Gitter, etc.\n\nWechaty Puppet Service is the RESTful API for Wechaty API, which is build on top of the Wechaty Puppet Abstraction and the gRPC proto definition.",
6
- "version": "1.0.110",
6
+ "version": "1.0.111",
7
7
  "contact": {
8
8
  "name": "Wechaty",
9
9
  "url": "https://github.com/wechaty/openapi",
@@ -1897,6 +1897,13 @@
1897
1897
  "in": "query",
1898
1898
  "required": false,
1899
1899
  "type": "string"
1900
+ },
1901
+ {
1902
+ "name": "replayBarrier",
1903
+ "description": "request a completion marker after ordered replay",
1904
+ "in": "query",
1905
+ "required": false,
1906
+ "type": "boolean"
1900
1907
  }
1901
1908
  ],
1902
1909
  "tags": [
@@ -6331,10 +6338,11 @@
6331
6338
  "EVENT_TYPE_SAME_NET_VERIFY",
6332
6339
  "EVENT_TYPE_ORG_BROADCAST_CREATED",
6333
6340
  "EVENT_TYPE_ORG_BROADCAST_SENT",
6334
- "EVENT_TYPE_ROOM_MEMBER_LOAD"
6341
+ "EVENT_TYPE_ROOM_MEMBER_LOAD",
6342
+ "EVENT_TYPE_REPLAY_COMPLETE"
6335
6343
  ],
6336
6344
  "default": "EVENT_TYPE_UNSPECIFIED",
6337
- "description": "- EVENT_TYPE_SAME_NET_VERIFY: same network verify for personal wechat login on Mac protocol\n - EVENT_TYPE_ORG_BROADCAST_CREATED: wecom org (admin) broadcast plan arrived: member received the broadcast assistant card\n - EVENT_TYPE_ORG_BROADCAST_SENT: wecom org (admin) broadcast plan executed, from any client"
6345
+ "description": " - EVENT_TYPE_SAME_NET_VERIFY: same network verify for personal wechat login on Mac protocol\n - EVENT_TYPE_ORG_BROADCAST_CREATED: wecom org (admin) broadcast plan arrived: member received the broadcast assistant card\n - EVENT_TYPE_ORG_BROADCAST_SENT: wecom org (admin) broadcast plan executed, from any client\n - EVENT_TYPE_REPLAY_COMPLETE: Opt-in stream barrier: payload {accountId, throughSeq}, envelope seq=0."
6338
6346
  },
6339
6347
  "puppetFriendshipAcceptResponse": {
6340
6348
  "type": "object"
@@ -42,11 +42,14 @@ enum EventType {
42
42
  // wecom org (admin) broadcast plan executed, from any client
43
43
  EVENT_TYPE_ORG_BROADCAST_SENT = 38;
44
44
  EVENT_TYPE_ROOM_MEMBER_LOAD = 39;
45
+ // Opt-in stream barrier: payload {accountId, throughSeq}, envelope seq=0.
46
+ EVENT_TYPE_REPLAY_COMPLETE = 40;
45
47
  }
46
48
 
47
49
  message EventRequest {
48
50
  int32 seq = 1; // the seq of the last event
49
51
  string account_id = 2; // the accountId of the last event
52
+ bool replay_barrier = 3; // request a completion marker after ordered replay
50
53
  }
51
54
 
52
55
  message EventResponse {
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.packageJson = void 0;
4
4
  exports.packageJson = {
5
5
  "name": "@juzi/wechaty-grpc",
6
- "version": "1.0.110",
6
+ "version": "1.0.111",
7
7
  "description": "gRPC for Wechaty",
8
8
  "type": "module",
9
9
  "exports": {
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=replay-barrier.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"replay-barrier.spec.d.ts","sourceRoot":"","sources":["../../../tests/replay-barrier.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tstest_1 = require("tstest");
4
+ const cjs_js_1 = require("../src/cjs.js");
5
+ (0, tstest_1.test)('replay capability is opt-in and preserves the existing resume cursor', t => {
6
+ const legacy = cjs_js_1.puppet.EventRequest.deserializeBinary(Uint8Array.from([8, 7, 18, 1, 97]));
7
+ t.equal(legacy.getSeq(), 7);
8
+ t.equal(legacy.getAccountId(), 'a');
9
+ t.equal(legacy.getReplayBarrier(), false);
10
+ t.same([...legacy.serializeBinary()], [8, 7, 18, 1, 97]);
11
+ legacy.setReplayBarrier(true);
12
+ t.same([...legacy.serializeBinary()], [8, 7, 18, 1, 97, 24, 1]);
13
+ const decoded = cjs_js_1.puppet.EventRequest.deserializeBinary(legacy.serializeBinary());
14
+ t.equal(decoded.getReplayBarrier(), true);
15
+ t.equal(decoded.getSeq(), 7);
16
+ t.equal(decoded.getAccountId(), 'a');
17
+ t.end();
18
+ });
19
+ (0, tstest_1.test)('replay completion carries a watermark without advancing the business event cursor', t => {
20
+ const response = new cjs_js_1.puppet.EventResponse();
21
+ response.setType(cjs_js_1.puppet.EventType.EVENT_TYPE_REPLAY_COMPLETE);
22
+ response.setPayload(JSON.stringify({ accountId: 'account', throughSeq: 42 }));
23
+ const decoded = cjs_js_1.puppet.EventResponse.deserializeBinary(response.serializeBinary());
24
+ t.equal(decoded.getType(), 40);
25
+ t.equal(decoded.getSeq(), 0);
26
+ t.same(JSON.parse(decoded.getPayload()), { accountId: 'account', throughSeq: 42 });
27
+ t.equal(cjs_js_1.puppet.EventType.EVENT_TYPE_READY, 23);
28
+ t.equal(cjs_js_1.puppet.EventType.EVENT_TYPE_ROOM_MEMBER_LOAD, 39);
29
+ t.end();
30
+ });
31
+ //# sourceMappingURL=replay-barrier.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"replay-barrier.spec.js","sourceRoot":"","sources":["../../../tests/replay-barrier.spec.ts"],"names":[],"mappings":";;AAAA,mCAA6B;AAE7B,0CAAsC;AAEtC,IAAA,aAAI,EAAC,sEAAsE,EAAE,CAAC,CAAC,EAAE;IAC/E,MAAM,MAAM,GAAG,eAAM,CAAC,YAAY,CAAC,iBAAiB,CAAC,UAAU,CAAC,IAAI,CAAC,CAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,CAAE,CAAC,CAAC,CAAA;IAC1F,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAA;IAC3B,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,YAAY,EAAE,EAAE,GAAG,CAAC,CAAA;IACnC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,gBAAgB,EAAE,EAAE,KAAK,CAAC,CAAA;IACzC,CAAC,CAAC,IAAI,CAAC,CAAE,GAAG,MAAM,CAAC,eAAe,EAAE,CAAE,EAAE,CAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,CAAE,CAAC,CAAA;IAC5D,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,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AC,UAAU,EAAE,CAAC,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,CAAA;IAClF,CAAC,CAAC,KAAK,CAAC,eAAM,CAAC,SAAS,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAA;IAC9C,CAAC,CAAC,KAAK,CAAC,eAAM,CAAC,SAAS,CAAC,2BAA2B,EAAE,EAAE,CAAC,CAAA;IACzD,CAAC,CAAC,GAAG,EAAE,CAAA;AACT,CAAC,CAAC,CAAA"}
@@ -10,6 +10,9 @@ export class EventRequest extends jspb.Message {
10
10
  getAccountId(): string;
11
11
  setAccountId(value: string): void;
12
12
 
13
+ getReplayBarrier(): boolean;
14
+ setReplayBarrier(value: boolean): void;
15
+
13
16
  serializeBinary(): Uint8Array;
14
17
  toObject(includeInstance?: boolean): EventRequest.AsObject;
15
18
  static toObject(includeInstance: boolean, msg: EventRequest): EventRequest.AsObject;
@@ -24,6 +27,7 @@ export namespace EventRequest {
24
27
  export type AsObject = {
25
28
  seq: number,
26
29
  accountId: string,
30
+ replayBarrier: boolean,
27
31
  }
28
32
  }
29
33
 
@@ -85,6 +89,7 @@ export interface EventTypeMap {
85
89
  EVENT_TYPE_ORG_BROADCAST_CREATED: 37;
86
90
  EVENT_TYPE_ORG_BROADCAST_SENT: 38;
87
91
  EVENT_TYPE_ROOM_MEMBER_LOAD: 39;
92
+ EVENT_TYPE_REPLAY_COMPLETE: 40;
88
93
  }
89
94
 
90
95
  export const EventType: EventTypeMap;
@@ -93,7 +93,8 @@ proto.wechaty.puppet.EventRequest.prototype.toObject = function(opt_includeInsta
93
93
  proto.wechaty.puppet.EventRequest.toObject = function(includeInstance, msg) {
94
94
  var f, obj = {
95
95
  seq: jspb.Message.getFieldWithDefault(msg, 1, 0),
96
- accountId: jspb.Message.getFieldWithDefault(msg, 2, "")
96
+ accountId: jspb.Message.getFieldWithDefault(msg, 2, ""),
97
+ replayBarrier: jspb.Message.getBooleanFieldWithDefault(msg, 3, false)
97
98
  };
98
99
 
99
100
  if (includeInstance) {
@@ -138,6 +139,10 @@ proto.wechaty.puppet.EventRequest.deserializeBinaryFromReader = function(msg, re
138
139
  var value = /** @type {string} */ (reader.readString());
139
140
  msg.setAccountId(value);
140
141
  break;
142
+ case 3:
143
+ var value = /** @type {boolean} */ (reader.readBool());
144
+ msg.setReplayBarrier(value);
145
+ break;
141
146
  default:
142
147
  reader.skipField();
143
148
  break;
@@ -181,6 +186,13 @@ proto.wechaty.puppet.EventRequest.serializeBinaryToWriter = function(message, wr
181
186
  f
182
187
  );
183
188
  }
189
+ f = message.getReplayBarrier();
190
+ if (f) {
191
+ writer.writeBool(
192
+ 3,
193
+ f
194
+ );
195
+ }
184
196
  };
185
197
 
186
198
 
@@ -220,6 +232,24 @@ proto.wechaty.puppet.EventRequest.prototype.setAccountId = function(value) {
220
232
  };
221
233
 
222
234
 
235
+ /**
236
+ * optional bool replay_barrier = 3;
237
+ * @return {boolean}
238
+ */
239
+ proto.wechaty.puppet.EventRequest.prototype.getReplayBarrier = function() {
240
+ return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 3, false));
241
+ };
242
+
243
+
244
+ /**
245
+ * @param {boolean} value
246
+ * @return {!proto.wechaty.puppet.EventRequest} returns this
247
+ */
248
+ proto.wechaty.puppet.EventRequest.prototype.setReplayBarrier = function(value) {
249
+ return jspb.Message.setProto3BooleanField(this, 3, value);
250
+ };
251
+
252
+
223
253
 
224
254
 
225
255
 
@@ -442,7 +472,8 @@ proto.wechaty.puppet.EventType = {
442
472
  EVENT_TYPE_SAME_NET_VERIFY: 36,
443
473
  EVENT_TYPE_ORG_BROADCAST_CREATED: 37,
444
474
  EVENT_TYPE_ORG_BROADCAST_SENT: 38,
445
- EVENT_TYPE_ROOM_MEMBER_LOAD: 39
475
+ EVENT_TYPE_ROOM_MEMBER_LOAD: 39,
476
+ EVENT_TYPE_REPLAY_COMPLETE: 40
446
477
  };
447
478
 
448
479
  goog.object.extend(exports, proto.wechaty.puppet);
@@ -9,7 +9,7 @@ info:
9
9
 
10
10
  Wechaty Puppet Service is the RESTful API for Wechaty API, which is build on
11
11
  top of the Wechaty Puppet Abstraction and the gRPC proto definition.
12
- version: 1.0.110
12
+ version: 1.0.111
13
13
  contact:
14
14
  name: Wechaty
15
15
  url: https://github.com/wechaty/openapi
@@ -1233,6 +1233,11 @@ paths:
1233
1233
  in: query
1234
1234
  required: false
1235
1235
  type: string
1236
+ - name: replayBarrier
1237
+ description: request a completion marker after ordered replay
1238
+ in: query
1239
+ required: false
1240
+ type: boolean
1236
1241
  tags:
1237
1242
  - Puppet
1238
1243
  /friendship/accept/{id}:
@@ -4315,12 +4320,13 @@ definitions:
4315
4320
  - EVENT_TYPE_ORG_BROADCAST_CREATED
4316
4321
  - EVENT_TYPE_ORG_BROADCAST_SENT
4317
4322
  - EVENT_TYPE_ROOM_MEMBER_LOAD
4323
+ - EVENT_TYPE_REPLAY_COMPLETE
4318
4324
  default: EVENT_TYPE_UNSPECIFIED
4319
- description: >-
4320
- - EVENT_TYPE_SAME_NET_VERIFY: same network verify for personal wechat
4321
- login on Mac protocol
4325
+ description: |2-
4326
+ - EVENT_TYPE_SAME_NET_VERIFY: same network verify for personal wechat login on Mac protocol
4322
4327
  - EVENT_TYPE_ORG_BROADCAST_CREATED: wecom org (admin) broadcast plan arrived: member received the broadcast assistant card
4323
4328
  - EVENT_TYPE_ORG_BROADCAST_SENT: wecom org (admin) broadcast plan executed, from any client
4329
+ - EVENT_TYPE_REPLAY_COMPLETE: Opt-in stream barrier: payload {accountId, throughSeq}, envelope seq=0.
4324
4330
  puppetFriendshipAcceptResponse:
4325
4331
  type: object
4326
4332
  puppetFriendshipAddResponse:
@@ -3,7 +3,7 @@
3
3
  "info": {
4
4
  "title": "Wechaty Puppet Service OpenAPI Specification",
5
5
  "description": "Wechaty is a Conversational RPA SDK for chatbot makers. With only 6 lines of code, you can create a bot on the most popular IMs like WeChat, Whatsapp, WeCom, Gitter, etc.\n\nWechaty Puppet Service is the RESTful API for Wechaty API, which is build on top of the Wechaty Puppet Abstraction and the gRPC proto definition.",
6
- "version": "1.0.110",
6
+ "version": "1.0.111",
7
7
  "contact": {
8
8
  "name": "Wechaty",
9
9
  "url": "https://github.com/wechaty/openapi",
@@ -1897,6 +1897,13 @@
1897
1897
  "in": "query",
1898
1898
  "required": false,
1899
1899
  "type": "string"
1900
+ },
1901
+ {
1902
+ "name": "replayBarrier",
1903
+ "description": "request a completion marker after ordered replay",
1904
+ "in": "query",
1905
+ "required": false,
1906
+ "type": "boolean"
1900
1907
  }
1901
1908
  ],
1902
1909
  "tags": [
@@ -6331,10 +6338,11 @@
6331
6338
  "EVENT_TYPE_SAME_NET_VERIFY",
6332
6339
  "EVENT_TYPE_ORG_BROADCAST_CREATED",
6333
6340
  "EVENT_TYPE_ORG_BROADCAST_SENT",
6334
- "EVENT_TYPE_ROOM_MEMBER_LOAD"
6341
+ "EVENT_TYPE_ROOM_MEMBER_LOAD",
6342
+ "EVENT_TYPE_REPLAY_COMPLETE"
6335
6343
  ],
6336
6344
  "default": "EVENT_TYPE_UNSPECIFIED",
6337
- "description": "- EVENT_TYPE_SAME_NET_VERIFY: same network verify for personal wechat login on Mac protocol\n - EVENT_TYPE_ORG_BROADCAST_CREATED: wecom org (admin) broadcast plan arrived: member received the broadcast assistant card\n - EVENT_TYPE_ORG_BROADCAST_SENT: wecom org (admin) broadcast plan executed, from any client"
6345
+ "description": " - EVENT_TYPE_SAME_NET_VERIFY: same network verify for personal wechat login on Mac protocol\n - EVENT_TYPE_ORG_BROADCAST_CREATED: wecom org (admin) broadcast plan arrived: member received the broadcast assistant card\n - EVENT_TYPE_ORG_BROADCAST_SENT: wecom org (admin) broadcast plan executed, from any client\n - EVENT_TYPE_REPLAY_COMPLETE: Opt-in stream barrier: payload {accountId, throughSeq}, envelope seq=0."
6338
6346
  },
6339
6347
  "puppetFriendshipAcceptResponse": {
6340
6348
  "type": "object"
@@ -42,11 +42,14 @@ enum EventType {
42
42
  // wecom org (admin) broadcast plan executed, from any client
43
43
  EVENT_TYPE_ORG_BROADCAST_SENT = 38;
44
44
  EVENT_TYPE_ROOM_MEMBER_LOAD = 39;
45
+ // Opt-in stream barrier: payload {accountId, throughSeq}, envelope seq=0.
46
+ EVENT_TYPE_REPLAY_COMPLETE = 40;
45
47
  }
46
48
 
47
49
  message EventRequest {
48
50
  int32 seq = 1; // the seq of the last event
49
51
  string account_id = 2; // the accountId of the last event
52
+ bool replay_barrier = 3; // request a completion marker after ordered replay
50
53
  }
51
54
 
52
55
  message EventResponse {
@@ -1,6 +1,6 @@
1
1
  export const packageJson = {
2
2
  "name": "@juzi/wechaty-grpc",
3
- "version": "1.0.110",
3
+ "version": "1.0.111",
4
4
  "description": "gRPC for Wechaty",
5
5
  "type": "module",
6
6
  "exports": {
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=replay-barrier.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"replay-barrier.spec.d.ts","sourceRoot":"","sources":["../../../tests/replay-barrier.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,29 @@
1
+ import { test } from 'tstest';
2
+ import { puppet } from '../src/cjs.js';
3
+ test('replay capability is opt-in and preserves the existing resume cursor', t => {
4
+ const legacy = puppet.EventRequest.deserializeBinary(Uint8Array.from([8, 7, 18, 1, 97]));
5
+ t.equal(legacy.getSeq(), 7);
6
+ t.equal(legacy.getAccountId(), 'a');
7
+ t.equal(legacy.getReplayBarrier(), false);
8
+ t.same([...legacy.serializeBinary()], [8, 7, 18, 1, 97]);
9
+ legacy.setReplayBarrier(true);
10
+ t.same([...legacy.serializeBinary()], [8, 7, 18, 1, 97, 24, 1]);
11
+ const decoded = puppet.EventRequest.deserializeBinary(legacy.serializeBinary());
12
+ t.equal(decoded.getReplayBarrier(), true);
13
+ t.equal(decoded.getSeq(), 7);
14
+ t.equal(decoded.getAccountId(), 'a');
15
+ t.end();
16
+ });
17
+ test('replay completion carries a watermark without advancing the business event cursor', t => {
18
+ const response = new puppet.EventResponse();
19
+ response.setType(puppet.EventType.EVENT_TYPE_REPLAY_COMPLETE);
20
+ response.setPayload(JSON.stringify({ accountId: 'account', throughSeq: 42 }));
21
+ const decoded = puppet.EventResponse.deserializeBinary(response.serializeBinary());
22
+ t.equal(decoded.getType(), 40);
23
+ t.equal(decoded.getSeq(), 0);
24
+ t.same(JSON.parse(decoded.getPayload()), { accountId: 'account', throughSeq: 42 });
25
+ t.equal(puppet.EventType.EVENT_TYPE_READY, 23);
26
+ t.equal(puppet.EventType.EVENT_TYPE_ROOM_MEMBER_LOAD, 39);
27
+ t.end();
28
+ });
29
+ //# sourceMappingURL=replay-barrier.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"replay-barrier.spec.js","sourceRoot":"","sources":["../../../tests/replay-barrier.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAE7B,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAEtC,IAAI,CAAC,sEAAsE,EAAE,CAAC,CAAC,EAAE;IAC/E,MAAM,MAAM,GAAG,MAAM,CAAC,YAAY,CAAC,iBAAiB,CAAC,UAAU,CAAC,IAAI,CAAC,CAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,CAAE,CAAC,CAAC,CAAA;IAC1F,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAA;IAC3B,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,YAAY,EAAE,EAAE,GAAG,CAAC,CAAA;IACnC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,gBAAgB,EAAE,EAAE,KAAK,CAAC,CAAA;IACzC,CAAC,CAAC,IAAI,CAAC,CAAE,GAAG,MAAM,CAAC,eAAe,EAAE,CAAE,EAAE,CAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC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,CAAA;IAC5B,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,CAAA;IAClF,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAA;IAC9C,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,2BAA2B,EAAE,EAAE,CAAC,CAAA;IACzD,CAAC,CAAC,GAAG,EAAE,CAAA;AACT,CAAC,CAAC,CAAA"}
@@ -10,6 +10,9 @@ export class EventRequest extends jspb.Message {
10
10
  getAccountId(): string;
11
11
  setAccountId(value: string): void;
12
12
 
13
+ getReplayBarrier(): boolean;
14
+ setReplayBarrier(value: boolean): void;
15
+
13
16
  serializeBinary(): Uint8Array;
14
17
  toObject(includeInstance?: boolean): EventRequest.AsObject;
15
18
  static toObject(includeInstance: boolean, msg: EventRequest): EventRequest.AsObject;
@@ -24,6 +27,7 @@ export namespace EventRequest {
24
27
  export type AsObject = {
25
28
  seq: number,
26
29
  accountId: string,
30
+ replayBarrier: boolean,
27
31
  }
28
32
  }
29
33
 
@@ -85,6 +89,7 @@ export interface EventTypeMap {
85
89
  EVENT_TYPE_ORG_BROADCAST_CREATED: 37;
86
90
  EVENT_TYPE_ORG_BROADCAST_SENT: 38;
87
91
  EVENT_TYPE_ROOM_MEMBER_LOAD: 39;
92
+ EVENT_TYPE_REPLAY_COMPLETE: 40;
88
93
  }
89
94
 
90
95
  export const EventType: EventTypeMap;
@@ -93,7 +93,8 @@ proto.wechaty.puppet.EventRequest.prototype.toObject = function(opt_includeInsta
93
93
  proto.wechaty.puppet.EventRequest.toObject = function(includeInstance, msg) {
94
94
  var f, obj = {
95
95
  seq: jspb.Message.getFieldWithDefault(msg, 1, 0),
96
- accountId: jspb.Message.getFieldWithDefault(msg, 2, "")
96
+ accountId: jspb.Message.getFieldWithDefault(msg, 2, ""),
97
+ replayBarrier: jspb.Message.getBooleanFieldWithDefault(msg, 3, false)
97
98
  };
98
99
 
99
100
  if (includeInstance) {
@@ -138,6 +139,10 @@ proto.wechaty.puppet.EventRequest.deserializeBinaryFromReader = function(msg, re
138
139
  var value = /** @type {string} */ (reader.readString());
139
140
  msg.setAccountId(value);
140
141
  break;
142
+ case 3:
143
+ var value = /** @type {boolean} */ (reader.readBool());
144
+ msg.setReplayBarrier(value);
145
+ break;
141
146
  default:
142
147
  reader.skipField();
143
148
  break;
@@ -181,6 +186,13 @@ proto.wechaty.puppet.EventRequest.serializeBinaryToWriter = function(message, wr
181
186
  f
182
187
  );
183
188
  }
189
+ f = message.getReplayBarrier();
190
+ if (f) {
191
+ writer.writeBool(
192
+ 3,
193
+ f
194
+ );
195
+ }
184
196
  };
185
197
 
186
198
 
@@ -220,6 +232,24 @@ proto.wechaty.puppet.EventRequest.prototype.setAccountId = function(value) {
220
232
  };
221
233
 
222
234
 
235
+ /**
236
+ * optional bool replay_barrier = 3;
237
+ * @return {boolean}
238
+ */
239
+ proto.wechaty.puppet.EventRequest.prototype.getReplayBarrier = function() {
240
+ return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 3, false));
241
+ };
242
+
243
+
244
+ /**
245
+ * @param {boolean} value
246
+ * @return {!proto.wechaty.puppet.EventRequest} returns this
247
+ */
248
+ proto.wechaty.puppet.EventRequest.prototype.setReplayBarrier = function(value) {
249
+ return jspb.Message.setProto3BooleanField(this, 3, value);
250
+ };
251
+
252
+
223
253
 
224
254
 
225
255
 
@@ -442,7 +472,8 @@ proto.wechaty.puppet.EventType = {
442
472
  EVENT_TYPE_SAME_NET_VERIFY: 36,
443
473
  EVENT_TYPE_ORG_BROADCAST_CREATED: 37,
444
474
  EVENT_TYPE_ORG_BROADCAST_SENT: 38,
445
- EVENT_TYPE_ROOM_MEMBER_LOAD: 39
475
+ EVENT_TYPE_ROOM_MEMBER_LOAD: 39,
476
+ EVENT_TYPE_REPLAY_COMPLETE: 40
446
477
  };
447
478
 
448
479
  goog.object.extend(exports, proto.wechaty.puppet);
@@ -9,7 +9,7 @@ info:
9
9
 
10
10
  Wechaty Puppet Service is the RESTful API for Wechaty API, which is build on
11
11
  top of the Wechaty Puppet Abstraction and the gRPC proto definition.
12
- version: 1.0.110
12
+ version: 1.0.111
13
13
  contact:
14
14
  name: Wechaty
15
15
  url: https://github.com/wechaty/openapi
@@ -1233,6 +1233,11 @@ paths:
1233
1233
  in: query
1234
1234
  required: false
1235
1235
  type: string
1236
+ - name: replayBarrier
1237
+ description: request a completion marker after ordered replay
1238
+ in: query
1239
+ required: false
1240
+ type: boolean
1236
1241
  tags:
1237
1242
  - Puppet
1238
1243
  /friendship/accept/{id}:
@@ -4315,12 +4320,13 @@ definitions:
4315
4320
  - EVENT_TYPE_ORG_BROADCAST_CREATED
4316
4321
  - EVENT_TYPE_ORG_BROADCAST_SENT
4317
4322
  - EVENT_TYPE_ROOM_MEMBER_LOAD
4323
+ - EVENT_TYPE_REPLAY_COMPLETE
4318
4324
  default: EVENT_TYPE_UNSPECIFIED
4319
- description: >-
4320
- - EVENT_TYPE_SAME_NET_VERIFY: same network verify for personal wechat
4321
- login on Mac protocol
4325
+ description: |2-
4326
+ - EVENT_TYPE_SAME_NET_VERIFY: same network verify for personal wechat login on Mac protocol
4322
4327
  - EVENT_TYPE_ORG_BROADCAST_CREATED: wecom org (admin) broadcast plan arrived: member received the broadcast assistant card
4323
4328
  - EVENT_TYPE_ORG_BROADCAST_SENT: wecom org (admin) broadcast plan executed, from any client
4329
+ - EVENT_TYPE_REPLAY_COMPLETE: Opt-in stream barrier: payload {accountId, throughSeq}, envelope seq=0.
4324
4330
  puppetFriendshipAcceptResponse:
4325
4331
  type: object
4326
4332
  puppetFriendshipAddResponse:
@@ -3,7 +3,7 @@
3
3
  "info": {
4
4
  "title": "Wechaty Puppet Service OpenAPI Specification",
5
5
  "description": "Wechaty is a Conversational RPA SDK for chatbot makers. With only 6 lines of code, you can create a bot on the most popular IMs like WeChat, Whatsapp, WeCom, Gitter, etc.\n\nWechaty Puppet Service is the RESTful API for Wechaty API, which is build on top of the Wechaty Puppet Abstraction and the gRPC proto definition.",
6
- "version": "1.0.110",
6
+ "version": "1.0.111",
7
7
  "contact": {
8
8
  "name": "Wechaty",
9
9
  "url": "https://github.com/wechaty/openapi",
@@ -1897,6 +1897,13 @@
1897
1897
  "in": "query",
1898
1898
  "required": false,
1899
1899
  "type": "string"
1900
+ },
1901
+ {
1902
+ "name": "replayBarrier",
1903
+ "description": "request a completion marker after ordered replay",
1904
+ "in": "query",
1905
+ "required": false,
1906
+ "type": "boolean"
1900
1907
  }
1901
1908
  ],
1902
1909
  "tags": [
@@ -6331,10 +6338,11 @@
6331
6338
  "EVENT_TYPE_SAME_NET_VERIFY",
6332
6339
  "EVENT_TYPE_ORG_BROADCAST_CREATED",
6333
6340
  "EVENT_TYPE_ORG_BROADCAST_SENT",
6334
- "EVENT_TYPE_ROOM_MEMBER_LOAD"
6341
+ "EVENT_TYPE_ROOM_MEMBER_LOAD",
6342
+ "EVENT_TYPE_REPLAY_COMPLETE"
6335
6343
  ],
6336
6344
  "default": "EVENT_TYPE_UNSPECIFIED",
6337
- "description": "- EVENT_TYPE_SAME_NET_VERIFY: same network verify for personal wechat login on Mac protocol\n - EVENT_TYPE_ORG_BROADCAST_CREATED: wecom org (admin) broadcast plan arrived: member received the broadcast assistant card\n - EVENT_TYPE_ORG_BROADCAST_SENT: wecom org (admin) broadcast plan executed, from any client"
6345
+ "description": " - EVENT_TYPE_SAME_NET_VERIFY: same network verify for personal wechat login on Mac protocol\n - EVENT_TYPE_ORG_BROADCAST_CREATED: wecom org (admin) broadcast plan arrived: member received the broadcast assistant card\n - EVENT_TYPE_ORG_BROADCAST_SENT: wecom org (admin) broadcast plan executed, from any client\n - EVENT_TYPE_REPLAY_COMPLETE: Opt-in stream barrier: payload {accountId, throughSeq}, envelope seq=0."
6338
6346
  },
6339
6347
  "puppetFriendshipAcceptResponse": {
6340
6348
  "type": "object"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juzi/wechaty-grpc",
3
- "version": "1.0.110",
3
+ "version": "1.0.111",
4
4
  "description": "gRPC for Wechaty",
5
5
  "type": "module",
6
6
  "exports": {
@@ -4,7 +4,7 @@
4
4
  import type { PackageJson } from 'type-fest'
5
5
  export const packageJson: PackageJson = {
6
6
  "name": "@juzi/wechaty-grpc",
7
- "version": "1.0.110",
7
+ "version": "1.0.111",
8
8
  "description": "gRPC for Wechaty",
9
9
  "type": "module",
10
10
  "exports": {