Skip to content

Commit

Permalink
Upgrade Typescript, RxJS and type definitions. Add augmentation for e…
Browse files Browse the repository at this point in the history
…lasticsearch and crypto modules. (#12680)
  • Loading branch information
azasypkin committed Jul 6, 2017
1 parent 2c50926 commit c0abc41
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 10 deletions.
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@
"rimraf": "2.4.3",
"rison-node": "1.0.0",
"rjs-repack-loader": "1.0.6",
"rxjs": "5.4.0",
"rxjs": "5.4.2",
"script-loader": "0.6.1",
"semver": "5.1.0",
"style-loader": "0.12.3",
Expand All @@ -215,14 +215,14 @@
"@elastic/eslint-plugin-kibana-custom": "1.0.3",
"@types/chalk": "0.4.31",
"@types/chance": "0.7.33",
"@types/elasticsearch": "5.0.13",
"@types/express": "4.0.35",
"@types/jest": "19.2.3",
"@types/elasticsearch": "5.0.14",
"@types/express": "4.0.36",
"@types/jest": "20.0.2",
"@types/js-yaml": "3.5.31",
"@types/lodash": "3.10.1",
"@types/node": "6.0.68",
"@types/node": "6.0.78",
"@types/sinon": "1.16.36",
"@types/supertest": "2.0.0",
"@types/supertest": "2.0.1",
"@types/yargs": "6.6.0",
"angular-mocks": "1.4.7",
"babel-eslint": "7.2.3",
Expand Down Expand Up @@ -297,7 +297,7 @@
"supertest-as-promised": "2.0.2",
"tree-kill": "1.1.0",
"ts-jest": "20.0.6",
"typescript": "2.4.0",
"typescript": "2.4.1",
"webpack-dev-server": "1.14.1"
},
"engines": {
Expand Down
1 change: 0 additions & 1 deletion platform/server/elasticsearch/Cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ export class Cluster {
}

close() {
// TODO The elasticsearch.js typings are buggy and are missing `close`
this.client.close();
this.noAuthClient.close();

Expand Down
4 changes: 3 additions & 1 deletion platform/server/elasticsearch/ElasticsearchConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ export class ElasticsearchConfig {
}

if (this.config.ssl.certificateAuthorities.length > 0) {
ssl.ca = this.config.ssl.certificateAuthorities.map(readFileSync);
ssl.ca = this.config.ssl.certificateAuthorities.map(authority =>
readFileSync(authority)
);
}

config.ssl = ssl;
Expand Down
1 change: 0 additions & 1 deletion platform/server/http/SslConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ const createSslSchema = (schema: Schema) => {
)
),
cipherSuites: arrayOf(string(), {
// $ExpextError: 'constants' is currently missing in built-in types
defaultValue: crypto.constants.defaultCoreCipherList.split(':')
})
},
Expand Down
9 changes: 9 additions & 0 deletions types/crypto/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// `crypto` type definitions don't include `crypto.constants`, see available definitions here:
// https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/node/v6/index.d.ts#L3282
// So we just augment `crypto` module with a subset of crypto.constants we need. See full list here:
// https://nodejs.org/dist/latest-v6.x/docs/api/crypto.html#crypto_node_js_crypto_constants
declare module "crypto" {
namespace constants {
export const defaultCoreCipherList: string;
}
}
8 changes: 8 additions & 0 deletions types/elasticsearch/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Augmentation of Elasticsearch module with methods and properties that
// are not yet available in the official type definition set:
// https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/elasticsearch
declare module Elasticsearch {
interface Client {
close(): Promise<any>;
}
}
2 changes: 2 additions & 0 deletions types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
/// <reference path="./crypto/index.d.ts" />
/// <reference path="./elasticsearch/index.d.ts" />
/// <reference path="./type-detect/index.d.ts" />

0 comments on commit c0abc41

Please sign in to comment.