mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-16 15:00:26 +00:00
Merge pull request #22453 from DefinitelyTyped/hystrixjs
hystrixjs: Fix name and lint
This commit is contained in:
@@ -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<string, string>('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);
|
||||
})
|
||||
});
|
||||
|
||||
Vendored
+48
-49
@@ -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 <https://github.com/igorsechyn>
|
||||
// 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<any>
|
||||
execute(...args: any[]): PromiseLike<any>;
|
||||
}
|
||||
|
||||
export interface CommandA0<R> {
|
||||
execute<R>(): PromiseLike<R>
|
||||
execute<R>(): PromiseLike<R>;
|
||||
}
|
||||
|
||||
export interface CommandA1<R, T> {
|
||||
execute(t: T): PromiseLike<R>
|
||||
execute(t: T): PromiseLike<R>;
|
||||
}
|
||||
|
||||
export interface CommandA2<R, T, U> {
|
||||
execute(t: T, u: U): PromiseLike<R>
|
||||
execute(t: T, u: U): PromiseLike<R>;
|
||||
}
|
||||
|
||||
export interface CommandA3<R, T, U, V> {
|
||||
execute(t: T, u: U, v: V): PromiseLike<R>
|
||||
execute(t: T, u: U, v: V): PromiseLike<R>;
|
||||
}
|
||||
|
||||
export interface CommandA4<R, T, U, V, W> {
|
||||
execute(t: T, u: U, v: V, w: W): PromiseLike<R>
|
||||
execute(t: T, u: U, v: V, w: W): PromiseLike<R>;
|
||||
}
|
||||
|
||||
export interface CommandA5<R, T, U, V, W, X> {
|
||||
execute(t: T, u: U, v: V, w: W, x: X): PromiseLike<R>
|
||||
execute(t: T, u: U, v: V, w: W, x: X): PromiseLike<R>;
|
||||
}
|
||||
|
||||
export interface CommandA6<R, T, U, V, W, X, Y> {
|
||||
execute(t: T, u: U, v: V, w: W, x: X, y: Y): PromiseLike<R>
|
||||
execute(t: T, u: U, v: V, w: W, x: X, y: Y): PromiseLike<R>;
|
||||
}
|
||||
|
||||
export interface CommandA7<R, T, U, V, W, X, Y, Z> {
|
||||
execute(t: T, u: U, v: V, w: W, x: X, y: Y, z: Z): PromiseLike<R>
|
||||
execute(t: T, u: U, v: V, w: W, x: X, y: Y, z: Z): PromiseLike<R>;
|
||||
}
|
||||
|
||||
export interface CommandBuilder {
|
||||
@@ -97,7 +96,7 @@ export interface CommandBuilder {
|
||||
context(value: any): CommandBuilder;
|
||||
run(value: (...args: any[]) => PromiseLike<any>): CommandBuilder;
|
||||
fallbackTo(value: (error: Error, args ?: any[]) => PromiseLike<any>): CommandBuilder;
|
||||
build() : Command;
|
||||
build(): Command;
|
||||
}
|
||||
|
||||
export interface CommandBuilderA0<R> {
|
||||
@@ -116,7 +115,7 @@ export interface CommandBuilderA0<R> {
|
||||
context(value: any): CommandBuilderA0<R>;
|
||||
run(value: () => PromiseLike<R>): CommandBuilderA0<R>;
|
||||
fallbackTo(value: (error: Error) => PromiseLike<R>): CommandBuilderA0<R>;
|
||||
build() : CommandA0<R>;
|
||||
build(): CommandA0<R>;
|
||||
}
|
||||
|
||||
export interface CommandBuilderA1<R, T> {
|
||||
@@ -134,7 +133,7 @@ export interface CommandBuilderA1<R, T> {
|
||||
circuitBreakerErrorThresholdPercentage(value: number): CommandBuilderA1<R, T>;
|
||||
context(value: any): CommandBuilderA1<R, T>;
|
||||
run(value: (t: T) => PromiseLike<R>): CommandBuilderA1<R, T>;
|
||||
fallbackTo(value: (error: Error, args : [T]) => PromiseLike<R>): CommandBuilderA1<R, T>;
|
||||
fallbackTo(value: (error: Error, args: [T]) => PromiseLike<R>): CommandBuilderA1<R, T>;
|
||||
build(): CommandA1<R, T>;
|
||||
}
|
||||
|
||||
@@ -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<CommandMetrics>;
|
||||
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<CircuitBreaker>;
|
||||
getCache(): CircuitBreaker[];
|
||||
resetCache(): void;
|
||||
}
|
||||
|
||||
export interface HystrixSSEStream {
|
||||
toObservable(): Rx.Observable<any>
|
||||
toObservable(): Rx.Observable<any>;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user