cbor-x 1.5.4 → 1.5.6

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/index.d.ts CHANGED
@@ -29,6 +29,7 @@ export interface Options {
29
29
  onInvalidDate?: () => any
30
30
  tagUint8Array?: boolean
31
31
  pack?: boolean
32
+ sequential?: boolean
32
33
  }
33
34
  type ClassOf<T> = new (...args: any[]) => T;
34
35
  interface Extension<T, R> {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cbor-x",
3
3
  "author": "Kris Zyp",
4
- "version": "1.5.4",
4
+ "version": "1.5.6",
5
5
  "description": "Ultra-fast and conformant CBOR (RFC 8949) implementation with support for numerous tag extensions including records and structured cloning",
6
6
  "license": "MIT",
7
7
  "types": "./index.d.ts",
package/stream.js CHANGED
@@ -13,10 +13,12 @@ export class EncoderStream extends Transform {
13
13
  this.encoder = options.encoder || new Encoder(options)
14
14
  }
15
15
  async _transform(value, encoding, callback) {
16
- for await (let chunk of this.encoder.encodeAsAsyncIterable(value)) {
17
- this.push(chunk)
18
- }
19
- callback()
16
+ try {
17
+ for await (let chunk of this.encoder.encodeAsAsyncIterable(value)) {
18
+ this.push(chunk)
19
+ }
20
+ callback()
21
+ } catch(error) { callback (error) }
20
22
  }
21
23
  }
22
24
 
@@ -41,9 +43,9 @@ export class DecoderStream extends Transform {
41
43
  if (error.incomplete) {
42
44
  this.incompleteBuffer = chunk.slice(error.lastPosition)
43
45
  values = error.values
46
+ } else {
47
+ return callback(error)
44
48
  }
45
- else
46
- throw error
47
49
  } finally {
48
50
  for (let value of values || []) {
49
51
  if (value === null)
@@ -51,7 +53,7 @@ export class DecoderStream extends Transform {
51
53
  this.push(value)
52
54
  }
53
55
  }
54
- if (callback) callback()
56
+ callback()
55
57
  }
56
58
  getNullValue() {
57
59
  return Symbol.for(null)