tencentcloud-sdk-nodejs-intl-en 3.0.1133 → 3.0.1135

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tencentcloud-sdk-nodejs-intl-en",
3
- "version": "3.0.1133",
3
+ "version": "3.0.1135",
4
4
  "description": "腾讯云 API NODEJS SDK",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -3008,7 +3008,7 @@ class BillDetail extends AbstractModel {
3008
3008
  this.BusinessCodeName = null;
3009
3009
 
3010
3010
  /**
3011
- * Subproduct name: The subcategory of a Tencent Cloud product purchased by the user, such as CVM Standard S1.
3011
+ * Subproduct name: The subcategory of a Tencent Cloud product purchased by the user, such as CVM Standard S1.
3012
3012
  * @type {string || null}
3013
3013
  */
3014
3014
  this.ProductCodeName = null;
@@ -3209,6 +3209,25 @@ Note: This field may return null, indicating that no valid values can be obtaine
3209
3209
  */
3210
3210
  this.ReserveDetail = null;
3211
3211
 
3212
+ /**
3213
+ * the discount object for the current consumption item, such as official website discount, user discount, and event discount.
3214
+ * @type {string || null}
3215
+ */
3216
+ this.DiscountObject = null;
3217
+
3218
+ /**
3219
+ * the discount type for the current consumption item, such as discount and contract price.
3220
+
3221
+ * @type {string || null}
3222
+ */
3223
+ this.DiscountType = null;
3224
+
3225
+ /**
3226
+ * supplementary description of the discount type, such as 0.2.
3227
+ * @type {string || null}
3228
+ */
3229
+ this.DiscountContent = null;
3230
+
3212
3231
  }
3213
3232
 
3214
3233
  /**
@@ -3273,6 +3292,9 @@ Note: This field may return null, indicating that no valid values can be obtaine
3273
3292
  this.RegionType = 'RegionType' in params ? params.RegionType : null;
3274
3293
  this.RegionTypeName = 'RegionTypeName' in params ? params.RegionTypeName : null;
3275
3294
  this.ReserveDetail = 'ReserveDetail' in params ? params.ReserveDetail : null;
3295
+ this.DiscountObject = 'DiscountObject' in params ? params.DiscountObject : null;
3296
+ this.DiscountType = 'DiscountType' in params ? params.DiscountType : null;
3297
+ this.DiscountContent = 'DiscountContent' in params ? params.DiscountContent : null;
3276
3298
 
3277
3299
  }
3278
3300
  }
@@ -6830,7 +6852,7 @@ class DescribeBillDetailRequest extends AbstractModel {
6830
6852
  this.Offset = null;
6831
6853
 
6832
6854
  /**
6833
- * Quantity, maximum is 100
6855
+ * Quantity, maximum is 300
6834
6856
  * @type {number || null}
6835
6857
  */
6836
6858
  this.Limit = null;
@@ -1,2 +1,2 @@
1
- const sdkVersion = "3.0.1133";
1
+ const sdkVersion = "3.0.1135";
2
2
  module.exports = sdkVersion
@@ -1,4 +1,5 @@
1
1
  const { EventEmitter } = require('events')
2
+ const { createInterface } = require('readline')
2
3
 
3
4
  /**
4
5
  * @interface EventSourceMessage
@@ -18,6 +19,10 @@ class SSEResponseModel {
18
19
  */
19
20
  constructor(stream) {
20
21
  this.stream = stream
22
+ this.readline = createInterface({
23
+ input: stream,
24
+ crlfDelay: Infinity
25
+ })
21
26
  this.eventSource = new SSEEventEmitter()
22
27
  this.init()
23
28
  }
@@ -26,17 +31,23 @@ class SSEResponseModel {
26
31
  * @inner
27
32
  */
28
33
  init() {
29
- const { stream, eventSource } = this
30
- stream.on("data", (chunk) => {
31
- if (chunk !== null) {
32
- const messages = chunk.toString().split("\n\n")
33
- for (let i = 0; i < messages.length; i++) {
34
- if (messages[i].length > 0) {
35
- eventSource.emit("message", this.parseSSEMessage(messages[i]))
36
- }
37
- }
34
+ const { stream, readline, eventSource } = this
35
+
36
+ let lines = []
37
+ readline.on("line", (line) => {
38
+ if (line) {
39
+ lines.push(line)
40
+ return
41
+ }
42
+
43
+ eventSource.emit("message", this.parseSSEMessage(lines.splice(0)));
44
+ })
45
+ readline.on("close", () => {
46
+ if (lines.length > 0) {
47
+ eventSource.emit("message", this.parseSSEMessage(lines.splice(0)));
38
48
  }
39
49
  })
50
+
40
51
  stream.on("close", () => {
41
52
  eventSource.emit("close")
42
53
  })
@@ -47,9 +58,9 @@ class SSEResponseModel {
47
58
 
48
59
  /**
49
60
  * @inner
50
- * @param {string} chunk
61
+ * @param {string[]} lines
51
62
  */
52
- parseSSEMessage(chunk) {
63
+ parseSSEMessage(lines) {
53
64
  /**
54
65
  * @type {EventSourceMessage}
55
66
  */
@@ -60,7 +71,6 @@ class SSEResponseModel {
60
71
  retry: undefined,
61
72
  }
62
73
 
63
- const lines = chunk.split("\n")
64
74
  for (let i = 0; i < lines.length; i++) {
65
75
  const line = lines[i]
66
76
  // line is of format "<field>:<value>" or "<field>: <value>"
@@ -138,15 +148,18 @@ class SSEResponseModel {
138
148
  * @returns {AsyncIterableIterator<EventSourceMessage>}
139
149
  */
140
150
  async *[Symbol.asyncIterator]() {
141
- for await (const chunk of this.stream) {
142
- if (chunk !== null) {
143
- const messages = chunk.toString().split("\n\n")
144
- for (let i = 0; i < messages.length; i++) {
145
- if (messages[i].length > 0) {
146
- yield this.parseSSEMessage(messages[i])
147
- }
148
- }
151
+ let lines = []
152
+ for await (const line of this.readline) {
153
+ if (line) {
154
+ lines.push(line)
155
+ continue
149
156
  }
157
+
158
+ yield this.parseSSEMessage(lines.splice(0))
159
+ }
160
+
161
+ if (lines.length > 0) {
162
+ yield this.parseSSEMessage(lines.splice(0))
150
163
  }
151
164
  }
152
165
  }