Skip to content

Commit c0abc41

Browse files
authored
Upgrade Typescript, RxJS and type definitions. Add augmentation for elasticsearch and crypto modules. (#12680)
1 parent 2c50926 commit c0abc41

File tree

7 files changed

+29
-10
lines changed

7 files changed

+29
-10
lines changed

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@
190190
"rimraf": "2.4.3",
191191
"rison-node": "1.0.0",
192192
"rjs-repack-loader": "1.0.6",
193-
"rxjs": "5.4.0",
193+
"rxjs": "5.4.2",
194194
"script-loader": "0.6.1",
195195
"semver": "5.1.0",
196196
"style-loader": "0.12.3",
@@ -215,14 +215,14 @@
215215
"@elastic/eslint-plugin-kibana-custom": "1.0.3",
216216
"@types/chalk": "0.4.31",
217217
"@types/chance": "0.7.33",
218-
"@types/elasticsearch": "5.0.13",
219-
"@types/express": "4.0.35",
220-
"@types/jest": "19.2.3",
218+
"@types/elasticsearch": "5.0.14",
219+
"@types/express": "4.0.36",
220+
"@types/jest": "20.0.2",
221221
"@types/js-yaml": "3.5.31",
222222
"@types/lodash": "3.10.1",
223-
"@types/node": "6.0.68",
223+
"@types/node": "6.0.78",
224224
"@types/sinon": "1.16.36",
225-
"@types/supertest": "2.0.0",
225+
"@types/supertest": "2.0.1",
226226
"@types/yargs": "6.6.0",
227227
"angular-mocks": "1.4.7",
228228
"babel-eslint": "7.2.3",
@@ -297,7 +297,7 @@
297297
"supertest-as-promised": "2.0.2",
298298
"tree-kill": "1.1.0",
299299
"ts-jest": "20.0.6",
300-
"typescript": "2.4.0",
300+
"typescript": "2.4.1",
301301
"webpack-dev-server": "1.14.1"
302302
},
303303
"engines": {

platform/server/elasticsearch/Cluster.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ export class Cluster {
2626
}
2727

2828
close() {
29-
// TODO The elasticsearch.js typings are buggy and are missing `close`
3029
this.client.close();
3130
this.noAuthClient.close();
3231

platform/server/elasticsearch/ElasticsearchConfig.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,9 @@ export class ElasticsearchConfig {
8686
}
8787

8888
if (this.config.ssl.certificateAuthorities.length > 0) {
89-
ssl.ca = this.config.ssl.certificateAuthorities.map(readFileSync);
89+
ssl.ca = this.config.ssl.certificateAuthorities.map(authority =>
90+
readFileSync(authority)
91+
);
9092
}
9193

9294
config.ssl = ssl;

platform/server/http/SslConfig.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ const createSslSchema = (schema: Schema) => {
2121
)
2222
),
2323
cipherSuites: arrayOf(string(), {
24-
// $ExpextError: 'constants' is currently missing in built-in types
2524
defaultValue: crypto.constants.defaultCoreCipherList.split(':')
2625
})
2726
},

types/crypto/index.d.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// `crypto` type definitions don't include `crypto.constants`, see available definitions here:
2+
// https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/node/v6/index.d.ts#L3282
3+
// So we just augment `crypto` module with a subset of crypto.constants we need. See full list here:
4+
// https://nodejs.org/dist/latest-v6.x/docs/api/crypto.html#crypto_node_js_crypto_constants
5+
declare module "crypto" {
6+
namespace constants {
7+
export const defaultCoreCipherList: string;
8+
}
9+
}

types/elasticsearch/index.d.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Augmentation of Elasticsearch module with methods and properties that
2+
// are not yet available in the official type definition set:
3+
// https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/elasticsearch
4+
declare module Elasticsearch {
5+
interface Client {
6+
close(): Promise<any>;
7+
}
8+
}

types/index.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1+
/// <reference path="./crypto/index.d.ts" />
2+
/// <reference path="./elasticsearch/index.d.ts" />
13
/// <reference path="./type-detect/index.d.ts" />

0 commit comments

Comments
 (0)