diff --git a/types/signalfx/index.d.ts b/types/signalfx/index.d.ts new file mode 100644 index 0000000000..77c4b040cd --- /dev/null +++ b/types/signalfx/index.d.ts @@ -0,0 +1,53 @@ +// Type definitions for signalfx 7.0 +// Project: https://github.com/signalfx/signalfx-nodejs +// Definitions by: Vladimir Grenaderov +// Max Boguslavskiy +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +export interface IngestOptions { + enableAmazonUniqueId?: boolean; + dimensions?: object; + ingestEndpoint?: string; + timeout?: number; + batchSize?: number; + userAgents?: string[]; + proxy?: string; +} + +export interface SignalMetric { + metric: string; + value: number; + timestamp?: number; +} + +export interface SignalReport { + cumulative_counters?: SignalMetric[]; + gauges?: SignalMetric[]; + counters?: SignalMetric[]; +} + +export interface SignalClient { + send(report: SignalReport): void; +} + +export class Ingest { + constructor(token: string, options?: IngestOptions); + send(report: SignalReport): void; +} + +export class IngestJson { + constructor(token: string, options?: IngestOptions); + send(report: SignalReport): void; +} + +export const CONSTANTS: { + MESSAGE_TYPES: { + CONTROL: string; + DATA: string; + EVENT: string; + METADATA: string; + }; +}; + +export function SignalFlow(apiToken: any, options: any): any; diff --git a/types/signalfx/signalfx-tests.ts b/types/signalfx/signalfx-tests.ts new file mode 100644 index 0000000000..8c1b218e9c --- /dev/null +++ b/types/signalfx/signalfx-tests.ts @@ -0,0 +1,4 @@ +import * as signalfx from 'signalfx'; + +const sgnlfx = new signalfx.Ingest('1'); +sgnlfx.send({}); diff --git a/types/signalfx/tsconfig.json b/types/signalfx/tsconfig.json new file mode 100644 index 0000000000..5c9c420829 --- /dev/null +++ b/types/signalfx/tsconfig.json @@ -0,0 +1,24 @@ +{ + "files": [ + "index.d.ts", + "signalfx-tests.ts" + ], + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + } +} diff --git a/types/signalfx/tslint.json b/types/signalfx/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/signalfx/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +}