diff --git a/types/node-loggly-bulk/index.d.ts b/types/node-loggly-bulk/index.d.ts new file mode 100644 index 0000000000..0cd0a105bf --- /dev/null +++ b/types/node-loggly-bulk/index.d.ts @@ -0,0 +1,30 @@ +// Type definitions for node-loggly-bulk 2.2 +// Project: https://github.com/loggly/node-loggly-bulk#readme +// Definitions by: Andrei Kazakou +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import { LogglyInstance, LogglyOptions } from 'loggly'; + +export interface LogglyBulkOptions extends LogglyOptions { + proxy?: any; + userAgent?: string; + useTagHeader?: boolean; + isBulk?: boolean; + bufferOptions?: { + size: number; + retriesInMilliSeconds: number; + }; + networkErrorsOnConsole?: boolean; +} + +export interface LogglyBulkConstructor { + new (options: LogglyBulkOptions): LogglyInstance; +} + +export const Loggly: LogglyBulkConstructor; + +export const version: string; + +export function createClient(options: LogglyBulkOptions): LogglyInstance; + +export function serialize(obj: any, key?: string): string; diff --git a/types/node-loggly-bulk/node-loggly-bulk-tests.ts b/types/node-loggly-bulk/node-loggly-bulk-tests.ts new file mode 100644 index 0000000000..c117499640 --- /dev/null +++ b/types/node-loggly-bulk/node-loggly-bulk-tests.ts @@ -0,0 +1,32 @@ +import { createClient, Loggly, serialize } from 'node-loggly-bulk'; + +const client = createClient({ + token: 'test-token', + subdomain: 'test-subdomain', +}); + +client.log('Test message'); +client.log({ json: 'yes' }, ['some-tag'], () => {}); + +new Loggly({ + token: 'YOUR_TOKEN', + subdomain: 'YOUR_DOMAIN', + tags: ['NodeJS'], + json: true, + auth: { + username: 'your-username', + password: 'your-password', + }, + proxy: null, + userAgent: 'test-user-agent-header', + useTagHeader: true, + isBulk: true, + bufferOptions: { + size: 500, + retriesInMilliSeconds: 30000, + }, + networkErrorsOnConsole: false, +}); + +serialize({ key: 'value' }, 'key'); +serialize({ key: 'value' }); diff --git a/types/node-loggly-bulk/tsconfig.json b/types/node-loggly-bulk/tsconfig.json new file mode 100644 index 0000000000..6394d9006e --- /dev/null +++ b/types/node-loggly-bulk/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "node-loggly-bulk-tests.ts" + ] +} diff --git a/types/node-loggly-bulk/tslint.json b/types/node-loggly-bulk/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/node-loggly-bulk/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }