Skip to content

Commit a84c9a6

Browse files
committed
update stream-json dep; use values only json parsers
1 parent c21f45e commit a84c9a6

File tree

4 files changed

+9
-40
lines changed

4 files changed

+9
-40
lines changed

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
"request": "^2.88.0",
8484
"safe-memory-cache": "^1.5.1",
8585
"semaphore": "^1.1.0",
86-
"stream-json": "^1.1.1",
86+
"stream-json": "^1.1.3",
8787
"string-builder": "^0.1.6",
8888
"util.promisify": "^1.0.0",
8989
"uuid": "^3.2.1",

src/Http/RavenCommandResponsePipeline.ts

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -165,23 +165,7 @@ export class RavenCommandResponsePipeline<TStreamResult> extends EventEmitter {
165165
}
166166

167167
if (opts.jsonAsync) {
168-
const parser = new Parser({
169-
packKeys: true,
170-
packStrings: true,
171-
packNumbers: true,
172-
streamNumbers: true,
173-
streamKeys: false,
174-
streamStrings: false
175-
// TODO perfect setup perf-wise below, reducing traffic by packing all values
176-
// not yet working due to issue uhop/stream-json#44 - stringer freezes
177-
// we still need to stream numbers
178-
// packKeys: true,
179-
// packStrings: true,
180-
// packNumbers: true,
181-
// streamNumbers: false,
182-
// streamKeys: false,
183-
// streamStrings: false
184-
});
168+
const parser = new Parser({ streamValues: false });
185169
streams.push(parser);
186170

187171
if (opts.jsonAsync.filters && opts.jsonAsync.filters.length) {

test/Mapping/StreamJsonTests.ts

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ describe("stream-json parser and stringer", function () {
1515
readable.push(null);
1616

1717
const parser = new Parser({
18-
packKeys: true
18+
streamValues: false
1919
});
2020

2121
let hasNumberChunk = false;
@@ -35,23 +35,15 @@ describe("stream-json parser and stringer", function () {
3535
});
3636
});
3737

38-
// TODO waiting for resolution of https://github.com/uhop/stream-json/issues/44
39-
it.skip("parser with streamNumbers turned off should not emit 'numberChunk' tokens", (done) => {
38+
it("parser with streamNumbers turned off should not emit 'numberChunk' tokens", (done) => {
4039

4140
const content = `{ "test": -1 }`;
4241
const readable = new stream.Readable();
4342
readable.push(content);
4443
readable.push(null);
4544

4645
const parser = new Parser({
47-
packKeys: true,
48-
packStrings: true,
49-
packValues: true,
50-
packNumbers: true,
51-
streamNumbers: false,
52-
streamValues: false,
53-
streamKeys: false,
54-
streamStrings: false
46+
streamValues: false
5547
});
5648

5749
let hasNumberChunk = false;
@@ -73,14 +65,7 @@ describe("stream-json parser and stringer", function () {
7365
readable.push(null);
7466

7567
const parser = new Parser({
76-
packKeys: true,
77-
packStrings: true,
78-
packValues: true,
79-
packNumbers: true,
80-
streamNumbers: true,
81-
streamValues: false,
82-
streamKeys: false,
83-
streamStrings: false
68+
streamValues: false
8469
});
8570

8671
const stringerInstance = stringer({ useValues: true });

0 commit comments

Comments
 (0)