File tree Expand file tree Collapse file tree 4 files changed +10
-5
lines changed Expand file tree Collapse file tree 4 files changed +10
-5
lines changed Original file line number Diff line number Diff line change 63
63
64
64
- name : Test
65
65
run : |
66
- npm run test:unit -- --node-arg=--harmony-async-iteration
66
+ npm run test:node8
67
67
68
68
helpers-integration-test :
69
69
name : Helpers integration test
Original file line number Diff line number Diff line change 4
4
The client comes with an handy collection of helpers to give you a more comfortable experience with some APIs.
5
5
6
6
CAUTION: The client helpers are experimental, and the API may change in the next minor releases.
7
- If you are using the client with Node.js v8 you should run your code with the `--harmony-async-iteration` argument. +
8
- eg: `node --harmony-async-iteration index.js`
7
+ The helpers will not work in any Node.js version lower than 10.
9
8
10
9
=== Bulk Helper
11
10
Running Bulk requests can be complex due to the shape of the API, this helper aims to provide a nicer developer experience around the Bulk API.
Original file line number Diff line number Diff line change 4
4
5
5
'use strict'
6
6
7
+ const nodeMajor = Number ( process . versions . node . split ( '.' ) [ 0 ] )
8
+
7
9
const { EventEmitter } = require ( 'events' )
8
10
const { URL } = require ( 'url' )
9
11
const debug = require ( 'debug' ) ( 'elasticsearch' )
10
12
const Transport = require ( './lib/Transport' )
11
13
const Connection = require ( './lib/Connection' )
12
14
const { ConnectionPool, CloudConnectionPool } = require ( './lib/pool' )
13
- const Helpers = require ( './lib/Helpers' )
15
+ // Helpers works only in Node.js >= 10
16
+ const Helpers = nodeMajor < 10 ? null : require ( './lib/Helpers' )
14
17
const Serializer = require ( './lib/Serializer' )
15
18
const errors = require ( './lib/errors' )
16
19
const { ConfigurationError } = errors
@@ -127,7 +130,9 @@ class Client extends EventEmitter {
127
130
opaqueIdPrefix : options . opaqueIdPrefix
128
131
} )
129
132
130
- this . helpers = new Helpers ( { client : this , maxRetries : options . maxRetries } )
133
+ if ( Helpers !== null ) {
134
+ this . helpers = new Helpers ( { client : this , maxRetries : options . maxRetries } )
135
+ }
131
136
132
137
const apis = buildApi ( {
133
138
makeRequest : this . transport . request . bind ( this . transport ) ,
Original file line number Diff line number Diff line change 17
17
],
18
18
"scripts" : {
19
19
"test" : " npm run lint && npm run test:unit && npm run test:behavior && npm run test:types" ,
20
+ "test:node8" : " npm run lint && tap test/unit/*.test.js -t 300 --no-coverage && npm run test:behavior && npm run test:types" ,
20
21
"test:unit" : " tap test/unit/*.test.js test/unit/**/*.test.js -t 300 --no-coverage" ,
21
22
"test:behavior" : " tap test/behavior/*.test.js -t 300 --no-coverage" ,
22
23
"test:integration" : " node test/integration/index.js" ,
You can’t perform that action at this time.
0 commit comments