diff --git a/types/hystrixjs/hystrixjs-tests.ts b/types/hystrixjs/hystrixjs-tests.ts index 7ed7819fb7..72c709068d 100644 --- a/types/hystrixjs/hystrixjs-tests.ts +++ b/types/hystrixjs/hystrixjs-tests.ts @@ -1,9 +1,9 @@ import hystrixjs = require('hystrixjs'); import q = require('q'); -var commandFactory = hystrixjs.commandFactory; +const commandFactory = hystrixjs.commandFactory; -var command = commandFactory +const command = commandFactory .getOrCreate('testCommand', 'testGroup') .circuitBreakerSleepWindowInMilliseconds(5000) .errorHandler((error) => { @@ -29,16 +29,16 @@ var command = commandFactory command.execute('something').then((result) => { console.log(result); -}) +}); commandFactory.resetCache(); -var metricsFactory = hystrixjs.metricsFactory; +const metricsFactory = hystrixjs.metricsFactory; -var metrics = metricsFactory.getOrCreate({ +const metrics = metricsFactory.getOrCreate({ commandKey: 'metricsKey', commandGroup: 'metricsGroup' -}) +}); metrics.markSuccess(); metrics.markFailure(); metrics.markRejected(); @@ -48,7 +48,7 @@ metrics.decrementExecutionCount(); metrics.getCurrentExecutionCount(); metrics.addExecutionTime(3000); metrics.getRollingCount("FAILURE"); -var healthcounts = metrics.getHealthCounts(); +const healthcounts = metrics.getHealthCounts(); console.log(healthcounts.totalCount); console.log(healthcounts.errorCount); console.log(healthcounts.errorPercentage); @@ -59,7 +59,7 @@ metricsFactory.getAllMetrics().map((metrics) => { console.log(metrics.getCurrentExecutionCount()); }); -var hystrixConfig = hystrixjs.hystrixConfig; +const hystrixConfig = hystrixjs.hystrixConfig; console.log(hystrixConfig.metricsPercentileWindowBuckets()); console.log(hystrixConfig.circuitBreakerForceClosed()); console.log(hystrixConfig.circuitBreakerForceOpened()); @@ -73,11 +73,11 @@ console.log(hystrixConfig.metricsStatisticalWindowBuckets()); console.log(hystrixConfig.metricsStatisticalWindowInMilliseconds()); console.log(hystrixConfig.metricsPercentileWindowInMilliseconds()); console.log(hystrixConfig.requestVolumeRejectionThreshold()); -console.log(hystrixConfig.resetProperties()); -console.log(hystrixConfig.init({})); +hystrixConfig.resetProperties(); +hystrixConfig.init({}); -var hystrixSSEStream = hystrixjs.hystrixSSEStream; +const hystrixSSEStream = hystrixjs.hystrixSSEStream; hystrixSSEStream.toObservable().subscribe((result) => { console.log(result); -}) +}); diff --git a/types/hystrixjs/index.d.ts b/types/hystrixjs/index.d.ts index b49cd40ba4..d3ee7bb416 100644 --- a/types/hystrixjs/index.d.ts +++ b/types/hystrixjs/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for dragula v2.1.2 +// Type definitions for hystrixjs 0.2 // Project: https://bitbucket.org/igor_sechyn/hystrixjs // Definitions by: Igor Sechyn // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -10,20 +10,20 @@ export as namespace hystrixjs; export as namespace HystrixJS; export interface HystrixProperties { - "hystrix.force.circuit.open"?: boolean, - "hystrix.force.circuit.closed"?: boolean, - "hystrix.circuit.sleepWindowInMilliseconds"?: number, - "hystrix.circuit.errorThresholdPercentage"?: number, - "hystrix.circuit.volumeThreshold"?: number, - "hystrix.circuit.volumeThreshold.forceOverride"?: boolean, - "hystrix.circuit.volumeThreshold.override"?: number, - "hystrix.execution.timeoutInMilliseconds"?: number, - "hystrix.metrics.statistical.window.timeInMilliseconds"?: number, - "hystrix.metrics.statistical.window.bucketsNumber"?: number, - "hystrix.metrics.percentile.window.timeInMilliseconds"?: number, - "hystrix.metrics.percentile.window.bucketsNumber"?: number, - "hystrix.request.volume.rejectionThreshold"?: number, - "hystrix.promise.implementation"?: PromiseConstructorLike, + "hystrix.force.circuit.open"?: boolean; + "hystrix.force.circuit.closed"?: boolean; + "hystrix.circuit.sleepWindowInMilliseconds"?: number; + "hystrix.circuit.errorThresholdPercentage"?: number; + "hystrix.circuit.volumeThreshold"?: number; + "hystrix.circuit.volumeThreshold.forceOverride"?: boolean; + "hystrix.circuit.volumeThreshold.override"?: number; + "hystrix.execution.timeoutInMilliseconds"?: number; + "hystrix.metrics.statistical.window.timeInMilliseconds"?: number; + "hystrix.metrics.statistical.window.bucketsNumber"?: number; + "hystrix.metrics.percentile.window.timeInMilliseconds"?: number; + "hystrix.metrics.percentile.window.bucketsNumber"?: number; + "hystrix.request.volume.rejectionThreshold"?: number; + "hystrix.promise.implementation"?: PromiseConstructorLike; } export interface HystrixConfig { @@ -39,46 +39,45 @@ export interface HystrixConfig { metricsStatisticalWindowBuckets(): number; metricsStatisticalWindowInMilliseconds(): number; metricsPercentileWindowInMilliseconds(): number; - metricsPercentileWindowBuckets(): number; requestVolumeRejectionThreshold(): number; resetProperties(): void; init(properties: HystrixProperties): void; } export interface Command { - execute(...args: any[]): PromiseLike + execute(...args: any[]): PromiseLike; } export interface CommandA0 { - execute(): PromiseLike + execute(): PromiseLike; } export interface CommandA1 { - execute(t: T): PromiseLike + execute(t: T): PromiseLike; } export interface CommandA2 { - execute(t: T, u: U): PromiseLike + execute(t: T, u: U): PromiseLike; } export interface CommandA3 { - execute(t: T, u: U, v: V): PromiseLike + execute(t: T, u: U, v: V): PromiseLike; } export interface CommandA4 { - execute(t: T, u: U, v: V, w: W): PromiseLike + execute(t: T, u: U, v: V, w: W): PromiseLike; } export interface CommandA5 { - execute(t: T, u: U, v: V, w: W, x: X): PromiseLike + execute(t: T, u: U, v: V, w: W, x: X): PromiseLike; } export interface CommandA6 { - execute(t: T, u: U, v: V, w: W, x: X, y: Y): PromiseLike + execute(t: T, u: U, v: V, w: W, x: X, y: Y): PromiseLike; } export interface CommandA7 { - execute(t: T, u: U, v: V, w: W, x: X, y: Y, z: Z): PromiseLike + execute(t: T, u: U, v: V, w: W, x: X, y: Y, z: Z): PromiseLike; } export interface CommandBuilder { @@ -97,7 +96,7 @@ export interface CommandBuilder { context(value: any): CommandBuilder; run(value: (...args: any[]) => PromiseLike): CommandBuilder; fallbackTo(value: (error: Error, args ?: any[]) => PromiseLike): CommandBuilder; - build() : Command; + build(): Command; } export interface CommandBuilderA0 { @@ -116,7 +115,7 @@ export interface CommandBuilderA0 { context(value: any): CommandBuilderA0; run(value: () => PromiseLike): CommandBuilderA0; fallbackTo(value: (error: Error) => PromiseLike): CommandBuilderA0; - build() : CommandA0; + build(): CommandA0; } export interface CommandBuilderA1 { @@ -134,7 +133,7 @@ export interface CommandBuilderA1 { circuitBreakerErrorThresholdPercentage(value: number): CommandBuilderA1; context(value: any): CommandBuilderA1; run(value: (t: T) => PromiseLike): CommandBuilderA1; - fallbackTo(value: (error: Error, args : [T]) => PromiseLike): CommandBuilderA1; + fallbackTo(value: (error: Error, args: [T]) => PromiseLike): CommandBuilderA1; build(): CommandA1; } @@ -288,28 +287,28 @@ export interface CommandMetrics { } export interface MetricsProperties { - commandKey: string, - commandGroup: string, - statisticalWindowTimeInMilliSeconds?: number, - statisticalWindowNumberOfBuckets?: number, - percentileWindowTimeInMilliSeconds?: number, - percentileWindowNumberOfBuckets?: number + commandKey: string; + commandGroup: string; + statisticalWindowTimeInMilliSeconds?: number; + statisticalWindowNumberOfBuckets?: number; + percentileWindowTimeInMilliSeconds?: number; + percentileWindowNumberOfBuckets?: number; } export interface MetricsFactory { getOrCreate(config: MetricsProperties): CommandMetrics; resetCache(): void; - getAllMetrics(): Array; + getAllMetrics(): CommandMetrics[]; } export interface CirctuiBreakerConfig { - circuitBreakerSleepWindowInMilliseconds: number, - commandKey: string, - circuitBreakerErrorThresholdPercentage: number, - circuitBreakerRequestVolumeThreshold: number, - commandGroup: string, - circuitBreakerForceClosed: boolean, - circuitBreakerForceOpened: boolean + circuitBreakerSleepWindowInMilliseconds: number; + commandKey: string; + circuitBreakerErrorThresholdPercentage: number; + circuitBreakerRequestVolumeThreshold: number; + commandGroup: string; + circuitBreakerForceClosed: boolean; + circuitBreakerForceOpened: boolean; } export interface CircuitBreaker { @@ -321,16 +320,16 @@ export interface CircuitBreaker { export interface CircuitFactory { getOrCreate(config: CirctuiBreakerConfig): CircuitBreaker; - getCache(): Array; + getCache(): CircuitBreaker[]; resetCache(): void; } export interface HystrixSSEStream { - toObservable(): Rx.Observable + toObservable(): Rx.Observable; } -export var commandFactory: CommandFactory; -export var metricsFactory: MetricsFactory; -export var circuitFactory: CircuitFactory; -export var hystrixSSEStream: HystrixSSEStream; -export var hystrixConfig: HystrixConfig; +export const commandFactory: CommandFactory; +export const metricsFactory: MetricsFactory; +export const circuitFactory: CircuitFactory; +export const hystrixSSEStream: HystrixSSEStream; +export const hystrixConfig: HystrixConfig; diff --git a/types/hystrixjs/tslint.json b/types/hystrixjs/tslint.json index a41bf5d19a..3fc34b8203 100644 --- a/types/hystrixjs/tslint.json +++ b/types/hystrixjs/tslint.json @@ -1,79 +1,7 @@ { "extends": "dtslint/dt.json", "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false + // TODO + "no-unnecessary-generics": false } }