Skip to content

Commit e68a897

Browse files
authored
JSCO-71: Update stream-json to 3.x (#4)
Changes ------- * Bumpded stream-json to ^3.7.0 to resolve CVE-2026-71429 * Removed @types/stream-json (3.x ships its own types) * Switched to parserStream() as 3.x parser() no longer returns a Node stream * Updated Node.js min version = 22.12 as stream-json 3.x is ESM-only and requires Node >= 22
1 parent 432dafb commit e68a897

5 files changed

Lines changed: 24 additions & 45 deletions

File tree

‎lib/queryexecutor.ts‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@ import {
2424
QueryScanConsistency,
2525
} from './querytypes.js'
2626
import * as http from 'node:http'
27-
import stream_json from 'stream-json'
28-
const { parser } = stream_json
29-
import type { Parser } from 'stream-json'
27+
import { parserStream } from 'stream-json'
3028
import { pipeline } from 'node:stream'
3129
import { runWithRetry } from './retries.js'
3230
import { OperationalInsightsError } from './errors.js'
@@ -227,7 +225,7 @@ export class QueryExecutor {
227225
return this._handleNonSuccessfulStatusCode(res, reject)
228226
}
229227

230-
const jsonTokenizer: Parser = parser()
228+
const jsonTokenizer = parserStream()
231229
const jsonTokenParser = new JsonTokenParserStream()
232230
const effectiveDeserializer = deserializer ?? this._deserializer
233231
const queryStream = new QueryResultStream(

‎package-lock.json‎

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

‎package.json‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
},
55
"description": "The official Couchbase Node.js Operational Insights Client Library.",
66
"engines": {
7-
"node": ">=16"
7+
"node": ">=22.12"
88
},
99
"homepage": "https://www.couchbase.com/developers/sdks",
1010
"keywords": [
@@ -33,7 +33,7 @@
3333
"license": "Apache-2.0",
3434
"name": "couchbase-operational-insights",
3535
"dependencies": {
36-
"stream-json": "^1.9.1"
36+
"stream-json": "^3.7.0"
3737
},
3838
"overrides": {
3939
"diff": "^9.0.0",
@@ -49,7 +49,6 @@
4949
"@types/debug": "^4.1.13",
5050
"@types/mocha": "^10.0.10",
5151
"@types/node": "^20.14.5",
52-
"@types/stream-json": "^1.7.8",
5352
"@typescript-eslint/eslint-plugin": "^8.54.0",
5453
"@typescript-eslint/parser": "^8.54.0",
5554
"chai": "^6.2.2",

‎performer/package-lock.json‎

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

‎test/jsonparser.test.ts‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515
* limitations under the License.
1616
*/
1717

18-
import pkg from 'stream-json'
19-
const { parser } = pkg
18+
import { parserStream } from 'stream-json'
2019
import { pipeline, Readable } from 'node:stream'
2120
import { assert } from 'chai'
2221
import { harness } from './harness.js'
@@ -46,7 +45,7 @@ describe('JsonTokenParserStream', function () {
4645
resolve({ rows, errorsItems, stack: jsonParser.stack.pop() })
4746
})
4847

49-
pipeline(Readable.from([jsonString]), parser(), jsonParser, (err) => {
48+
pipeline(Readable.from([jsonString]), parserStream(), jsonParser, (err) => {
5049
if (err) {
5150
reject(err)
5251
}

0 commit comments

Comments
 (0)