From 995a18868ae84944fdf8c8662141f9524b3ac8ff Mon Sep 17 00:00:00 2001 From: Dustin Blackman Date: Sun, 10 Sep 2017 21:32:22 -0400 Subject: [PATCH] add declaration files --- _tools/tsconfig.json | 1 + broid-alexa/lib/core/Adapter.d.ts | 26 ++++ broid-alexa/lib/core/Parser.d.ts | 11 ++ broid-alexa/lib/core/WebHookServer.d.ts | 16 +++ broid-alexa/lib/core/index.d.ts | 2 + broid-alexa/lib/core/interfaces.d.ts | 24 ++++ broid-alexa/lib/test/Adapter.d.ts | 0 broid-alexa/lib/test/Parser.d.ts | 0 broid-alexa/package.json | 1 + broid-callr/lib/core/Adapter.d.ts | 30 ++++ broid-callr/lib/core/Parser.d.ts | 14 ++ broid-callr/lib/core/WebHookServer.d.ts | 14 ++ broid-callr/lib/core/index.d.ts | 2 + broid-callr/lib/core/interfaces.d.ts | 17 +++ broid-callr/lib/test/Parser.d.ts | 0 broid-callr/package.json | 1 + broid-discord/lib/core/Adapter.d.ts | 23 ++++ broid-discord/lib/core/Parser.d.ts | 12 ++ broid-discord/lib/core/index.d.ts | 2 + broid-discord/lib/core/interfaces.d.ts | 17 +++ broid-discord/lib/test/Parser.d.ts | 0 broid-discord/package.json | 1 + broid-flowdock/lib/core/Adapter.d.ts | 26 ++++ broid-flowdock/lib/core/Parser.d.ts | 11 ++ broid-flowdock/lib/core/index.d.ts | 2 + broid-flowdock/lib/core/interfaces.d.ts | 5 + broid-flowdock/lib/test/Parser.d.ts | 0 broid-flowdock/package.json | 1 + broid-gitter/lib/core/Adapter.d.ts | 25 ++++ broid-gitter/lib/core/Parser.d.ts | 11 ++ broid-gitter/lib/core/index.d.ts | 2 + broid-gitter/lib/core/interfaces.d.ts | 5 + broid-gitter/lib/test/Parser.d.ts | 0 broid-gitter/package.json | 1 + broid-google-assistant/lib/core/Adapter.d.ts | 33 +++++ broid-google-assistant/lib/core/Parser.d.ts | 14 ++ .../lib/core/WebHookServer.d.ts | 15 ++ broid-google-assistant/lib/core/index.d.ts | 2 + .../lib/core/interfaces.d.ts | 12 ++ broid-google-assistant/lib/test/Parser.d.ts | 0 broid-google-assistant/package.json | 1 + broid-groupme/lib/core/Adapter.d.ts | 29 ++++ broid-groupme/lib/core/Parser.d.ts | 12 ++ broid-groupme/lib/core/WebHookServer.d.ts | 15 ++ broid-groupme/lib/core/client.d.ts | 4 + broid-groupme/lib/core/index.d.ts | 2 + broid-groupme/lib/core/interfaces.d.ts | 53 ++++++++ broid-groupme/lib/test/Parser.d.ts | 0 broid-groupme/package.json | 1 + broid-irc/lib/core/Adapter.d.ts | 28 ++++ broid-irc/lib/core/Parser.d.ts | 11 ++ broid-irc/lib/core/index.d.ts | 2 + broid-irc/lib/core/interfaces.d.ts | 8 ++ broid-irc/lib/test/Parser.d.ts | 0 broid-irc/package.json | 1 + broid-kik/lib/core/Adapter.d.ts | 30 ++++ broid-kik/lib/core/Parser.d.ts | 14 ++ broid-kik/lib/core/WebHookServer.d.ts | 15 ++ broid-kik/lib/core/index.d.ts | 2 + broid-kik/lib/core/interfaces.d.ts | 12 ++ broid-kik/lib/test/Parser.d.ts | 0 broid-kik/package.json | 1 + broid-line/lib/core/Adapter.d.ts | 29 ++++ broid-line/lib/core/Parser.d.ts | 15 ++ broid-line/lib/core/WebHookServer.d.ts | 15 ++ broid-line/lib/core/index.d.ts | 2 + broid-line/lib/core/interfaces.d.ts | 16 +++ broid-line/lib/test/Parser.d.ts | 0 broid-line/package.json | 1 + broid-messenger/lib/core/Adapter.d.ts | 30 ++++ broid-messenger/lib/core/Parser.d.ts | 16 +++ broid-messenger/lib/core/WebHookServer.d.ts | 15 ++ broid-messenger/lib/core/helpers.d.ts | 3 + broid-messenger/lib/core/index.d.ts | 2 + broid-messenger/lib/core/interfaces.d.ts | 15 ++ broid-messenger/lib/test/Parser.d.ts | 0 broid-messenger/package.json | 1 + broid-ms-teams/lib/core/Adapter.d.ts | 32 +++++ broid-ms-teams/lib/core/Parser.d.ts | 13 ++ broid-ms-teams/lib/core/WebHookServer.d.ts | 16 +++ broid-ms-teams/lib/core/index.d.ts | 2 + broid-ms-teams/lib/core/interfaces.d.ts | 11 ++ broid-ms-teams/lib/test/Parser.d.ts | 0 broid-ms-teams/package.json | 1 + broid-nexmo/lib/core/Adapter.d.ts | 30 ++++ broid-nexmo/lib/core/Parser.d.ts | 12 ++ broid-nexmo/lib/core/WebHookServer.d.ts | 17 +++ broid-nexmo/lib/core/index.d.ts | 2 + broid-nexmo/lib/core/interfaces.d.ts | 12 ++ broid-nexmo/lib/test/Parser.d.ts | 0 broid-nexmo/package.json | 1 + broid-schemas/lib/index.d.ts | 59 ++++++++ broid-schemas/package.json | 1 + broid-skype/lib/core/Adapter.d.ts | 31 +++++ broid-skype/lib/core/Parser.d.ts | 13 ++ broid-skype/lib/core/WebHookServer.d.ts | 15 ++ broid-skype/lib/core/index.d.ts | 2 + broid-skype/lib/core/interfaces.d.ts | 11 ++ broid-skype/lib/test/Parser.d.ts | 0 broid-skype/package.json | 1 + broid-slack/lib/core/Adapter.d.ts | 34 +++++ broid-slack/lib/core/Parser.d.ts | 14 ++ broid-slack/lib/core/WebHookServer.d.ts | 14 ++ broid-slack/lib/core/helpers.d.ts | 4 + broid-slack/lib/core/index.d.ts | 2 + broid-slack/lib/core/interfaces.d.ts | 128 ++++++++++++++++++ broid-slack/lib/test/Parser.d.ts | 0 broid-slack/package.json | 1 + broid-telegram/lib/core/Adapter.d.ts | 28 ++++ broid-telegram/lib/core/Parser.d.ts | 14 ++ broid-telegram/lib/core/WebHookServer.d.ts | 15 ++ broid-telegram/lib/core/index.d.ts | 2 + broid-telegram/lib/core/interfaces.d.ts | 11 ++ broid-telegram/lib/test/Parser.d.ts | 0 broid-telegram/package.json | 1 + broid-twilio/lib/core/Adapter.d.ts | 30 ++++ broid-twilio/lib/core/Parser.d.ts | 14 ++ broid-twilio/lib/core/WebHookServer.d.ts | 15 ++ broid-twilio/lib/core/index.d.ts | 2 + broid-twilio/lib/core/interfaces.d.ts | 29 ++++ broid-twilio/lib/test/Parser.d.ts | 0 broid-twilio/package.json | 1 + broid-twitter/lib/core/Adapter.d.ts | 32 +++++ broid-twitter/lib/core/Parser.d.ts | 13 ++ broid-twitter/lib/core/index.d.ts | 2 + broid-twitter/lib/core/interfaces.d.ts | 17 +++ broid-twitter/lib/test/Parser.d.ts | 0 broid-twitter/package.json | 1 + broid-utils/lib/Logger.d.ts | 8 ++ broid-utils/lib/index.d.ts | 11 ++ broid-utils/lib/index.js | 7 +- broid-utils/package.json | 1 + broid-utils/tsconfig.json | 1 + broid-viber/lib/core/Adapter.d.ts | 30 ++++ broid-viber/lib/core/Parser.d.ts | 13 ++ broid-viber/lib/core/WebHookServer.d.ts | 14 ++ broid-viber/lib/core/index.d.ts | 2 + broid-viber/lib/core/interfaces.d.ts | 14 ++ broid-viber/lib/test/Parser.d.ts | 0 broid-viber/package.json | 1 + broid-wechat/lib/core/Adapter.d.ts | 31 +++++ broid-wechat/lib/core/Parser.d.ts | 18 +++ broid-wechat/lib/core/WebHookServer.d.ts | 16 +++ broid-wechat/lib/core/index.d.ts | 2 + broid-wechat/lib/core/interfaces.d.ts | 11 ++ broid-wechat/lib/test/Parser.d.ts | 0 broid-wechat/package.json | 1 + 147 files changed, 1664 insertions(+), 3 deletions(-) create mode 100644 broid-alexa/lib/core/Adapter.d.ts create mode 100644 broid-alexa/lib/core/Parser.d.ts create mode 100644 broid-alexa/lib/core/WebHookServer.d.ts create mode 100644 broid-alexa/lib/core/index.d.ts create mode 100644 broid-alexa/lib/core/interfaces.d.ts create mode 100644 broid-alexa/lib/test/Adapter.d.ts create mode 100644 broid-alexa/lib/test/Parser.d.ts create mode 100644 broid-callr/lib/core/Adapter.d.ts create mode 100644 broid-callr/lib/core/Parser.d.ts create mode 100644 broid-callr/lib/core/WebHookServer.d.ts create mode 100644 broid-callr/lib/core/index.d.ts create mode 100644 broid-callr/lib/core/interfaces.d.ts create mode 100644 broid-callr/lib/test/Parser.d.ts create mode 100644 broid-discord/lib/core/Adapter.d.ts create mode 100644 broid-discord/lib/core/Parser.d.ts create mode 100644 broid-discord/lib/core/index.d.ts create mode 100644 broid-discord/lib/core/interfaces.d.ts create mode 100644 broid-discord/lib/test/Parser.d.ts create mode 100644 broid-flowdock/lib/core/Adapter.d.ts create mode 100644 broid-flowdock/lib/core/Parser.d.ts create mode 100644 broid-flowdock/lib/core/index.d.ts create mode 100644 broid-flowdock/lib/core/interfaces.d.ts create mode 100644 broid-flowdock/lib/test/Parser.d.ts create mode 100644 broid-gitter/lib/core/Adapter.d.ts create mode 100644 broid-gitter/lib/core/Parser.d.ts create mode 100644 broid-gitter/lib/core/index.d.ts create mode 100644 broid-gitter/lib/core/interfaces.d.ts create mode 100644 broid-gitter/lib/test/Parser.d.ts create mode 100644 broid-google-assistant/lib/core/Adapter.d.ts create mode 100644 broid-google-assistant/lib/core/Parser.d.ts create mode 100644 broid-google-assistant/lib/core/WebHookServer.d.ts create mode 100644 broid-google-assistant/lib/core/index.d.ts create mode 100644 broid-google-assistant/lib/core/interfaces.d.ts create mode 100644 broid-google-assistant/lib/test/Parser.d.ts create mode 100644 broid-groupme/lib/core/Adapter.d.ts create mode 100644 broid-groupme/lib/core/Parser.d.ts create mode 100644 broid-groupme/lib/core/WebHookServer.d.ts create mode 100644 broid-groupme/lib/core/client.d.ts create mode 100644 broid-groupme/lib/core/index.d.ts create mode 100644 broid-groupme/lib/core/interfaces.d.ts create mode 100644 broid-groupme/lib/test/Parser.d.ts create mode 100644 broid-irc/lib/core/Adapter.d.ts create mode 100644 broid-irc/lib/core/Parser.d.ts create mode 100644 broid-irc/lib/core/index.d.ts create mode 100644 broid-irc/lib/core/interfaces.d.ts create mode 100644 broid-irc/lib/test/Parser.d.ts create mode 100644 broid-kik/lib/core/Adapter.d.ts create mode 100644 broid-kik/lib/core/Parser.d.ts create mode 100644 broid-kik/lib/core/WebHookServer.d.ts create mode 100644 broid-kik/lib/core/index.d.ts create mode 100644 broid-kik/lib/core/interfaces.d.ts create mode 100644 broid-kik/lib/test/Parser.d.ts create mode 100644 broid-line/lib/core/Adapter.d.ts create mode 100644 broid-line/lib/core/Parser.d.ts create mode 100644 broid-line/lib/core/WebHookServer.d.ts create mode 100644 broid-line/lib/core/index.d.ts create mode 100644 broid-line/lib/core/interfaces.d.ts create mode 100644 broid-line/lib/test/Parser.d.ts create mode 100644 broid-messenger/lib/core/Adapter.d.ts create mode 100644 broid-messenger/lib/core/Parser.d.ts create mode 100644 broid-messenger/lib/core/WebHookServer.d.ts create mode 100644 broid-messenger/lib/core/helpers.d.ts create mode 100644 broid-messenger/lib/core/index.d.ts create mode 100644 broid-messenger/lib/core/interfaces.d.ts create mode 100644 broid-messenger/lib/test/Parser.d.ts create mode 100644 broid-ms-teams/lib/core/Adapter.d.ts create mode 100644 broid-ms-teams/lib/core/Parser.d.ts create mode 100644 broid-ms-teams/lib/core/WebHookServer.d.ts create mode 100644 broid-ms-teams/lib/core/index.d.ts create mode 100644 broid-ms-teams/lib/core/interfaces.d.ts create mode 100644 broid-ms-teams/lib/test/Parser.d.ts create mode 100644 broid-nexmo/lib/core/Adapter.d.ts create mode 100644 broid-nexmo/lib/core/Parser.d.ts create mode 100644 broid-nexmo/lib/core/WebHookServer.d.ts create mode 100644 broid-nexmo/lib/core/index.d.ts create mode 100644 broid-nexmo/lib/core/interfaces.d.ts create mode 100644 broid-nexmo/lib/test/Parser.d.ts create mode 100644 broid-schemas/lib/index.d.ts create mode 100644 broid-skype/lib/core/Adapter.d.ts create mode 100644 broid-skype/lib/core/Parser.d.ts create mode 100644 broid-skype/lib/core/WebHookServer.d.ts create mode 100644 broid-skype/lib/core/index.d.ts create mode 100644 broid-skype/lib/core/interfaces.d.ts create mode 100644 broid-skype/lib/test/Parser.d.ts create mode 100644 broid-slack/lib/core/Adapter.d.ts create mode 100644 broid-slack/lib/core/Parser.d.ts create mode 100644 broid-slack/lib/core/WebHookServer.d.ts create mode 100644 broid-slack/lib/core/helpers.d.ts create mode 100644 broid-slack/lib/core/index.d.ts create mode 100644 broid-slack/lib/core/interfaces.d.ts create mode 100644 broid-slack/lib/test/Parser.d.ts create mode 100644 broid-telegram/lib/core/Adapter.d.ts create mode 100644 broid-telegram/lib/core/Parser.d.ts create mode 100644 broid-telegram/lib/core/WebHookServer.d.ts create mode 100644 broid-telegram/lib/core/index.d.ts create mode 100644 broid-telegram/lib/core/interfaces.d.ts create mode 100644 broid-telegram/lib/test/Parser.d.ts create mode 100644 broid-twilio/lib/core/Adapter.d.ts create mode 100644 broid-twilio/lib/core/Parser.d.ts create mode 100644 broid-twilio/lib/core/WebHookServer.d.ts create mode 100644 broid-twilio/lib/core/index.d.ts create mode 100644 broid-twilio/lib/core/interfaces.d.ts create mode 100644 broid-twilio/lib/test/Parser.d.ts create mode 100644 broid-twitter/lib/core/Adapter.d.ts create mode 100644 broid-twitter/lib/core/Parser.d.ts create mode 100644 broid-twitter/lib/core/index.d.ts create mode 100644 broid-twitter/lib/core/interfaces.d.ts create mode 100644 broid-twitter/lib/test/Parser.d.ts create mode 100644 broid-utils/lib/Logger.d.ts create mode 100644 broid-utils/lib/index.d.ts create mode 100644 broid-viber/lib/core/Adapter.d.ts create mode 100644 broid-viber/lib/core/Parser.d.ts create mode 100644 broid-viber/lib/core/WebHookServer.d.ts create mode 100644 broid-viber/lib/core/index.d.ts create mode 100644 broid-viber/lib/core/interfaces.d.ts create mode 100644 broid-viber/lib/test/Parser.d.ts create mode 100644 broid-wechat/lib/core/Adapter.d.ts create mode 100644 broid-wechat/lib/core/Parser.d.ts create mode 100644 broid-wechat/lib/core/WebHookServer.d.ts create mode 100644 broid-wechat/lib/core/index.d.ts create mode 100644 broid-wechat/lib/core/interfaces.d.ts create mode 100644 broid-wechat/lib/test/Parser.d.ts diff --git a/_tools/tsconfig.json b/_tools/tsconfig.json index c36e8c4f..54080796 100644 --- a/_tools/tsconfig.json +++ b/_tools/tsconfig.json @@ -1,5 +1,6 @@ { "compilerOptions": { + "declaration": true, "removeComments": true, "preserveConstEnums": true, "moduleResolution": "node", diff --git a/broid-alexa/lib/core/Adapter.d.ts b/broid-alexa/lib/core/Adapter.d.ts new file mode 100644 index 00000000..b52a348a --- /dev/null +++ b/broid-alexa/lib/core/Adapter.d.ts @@ -0,0 +1,26 @@ +/// +import * as Promise from 'bluebird'; +import { Router } from 'express'; +import { Observable } from 'rxjs/Rx'; +import { IAdapter, IAdapterOptions } from './interfaces'; +export declare class Adapter implements IAdapter { + private serviceID; + private connected; + private emitter; + private parser; + private logLevel; + private logger; + private router; + private webhookServer; + constructor(obj?: IAdapterOptions); + serviceName(): string; + getRouter(): Router | null; + users(): Promise | Error>; + channels(): Promise | Error>; + serviceId(): string; + connect(): Observable; + disconnect(): Promise; + listen(): Observable; + send(data: any): Promise; + private setupRouter(); +} diff --git a/broid-alexa/lib/core/Parser.d.ts b/broid-alexa/lib/core/Parser.d.ts new file mode 100644 index 00000000..ad1b8950 --- /dev/null +++ b/broid-alexa/lib/core/Parser.d.ts @@ -0,0 +1,11 @@ +/// +import * as Promise from 'bluebird'; +export declare class Parser { + serviceID: string; + generatorName: string; + private logger; + constructor(serviceName: string, serviceID: string, logLevel: string); + validate(event: any): Promise; + parse(event: any): Promise; + private createActivityStream(); +} diff --git a/broid-alexa/lib/core/WebHookServer.d.ts b/broid-alexa/lib/core/WebHookServer.d.ts new file mode 100644 index 00000000..4ca84a6b --- /dev/null +++ b/broid-alexa/lib/core/WebHookServer.d.ts @@ -0,0 +1,16 @@ +/// +import * as Promise from 'bluebird'; +import * as express from 'express'; +import { IAdapterHTTPOptions } from './interfaces'; +export declare class WebHookServer { + emitAsync: any; + private express; + private logger; + private httpClient; + private host; + private port; + constructor(options: IAdapterHTTPOptions, router: express.Router, logLevel?: string); + listen(): void; + close(): Promise; + private setupExpress(router); +} diff --git a/broid-alexa/lib/core/index.d.ts b/broid-alexa/lib/core/index.d.ts new file mode 100644 index 00000000..6485757c --- /dev/null +++ b/broid-alexa/lib/core/index.d.ts @@ -0,0 +1,2 @@ +import { Adapter } from './Adapter'; +export = Adapter; diff --git a/broid-alexa/lib/core/interfaces.d.ts b/broid-alexa/lib/core/interfaces.d.ts new file mode 100644 index 00000000..2e134ca7 --- /dev/null +++ b/broid-alexa/lib/core/interfaces.d.ts @@ -0,0 +1,24 @@ +/// +import * as Promise from 'bluebird'; +import { Router } from 'express'; +import { Observable } from 'rxjs/Rx'; +export interface IAdapterHTTPOptions { + host: string; + port: number; +} +export interface IAdapterOptions { + http?: IAdapterHTTPOptions; + logLevel: string; + serviceID: string; +} +export interface IAdapter { + serviceName(): string; + serviceId(): string; + getRouter(): Router | null; + users(): Promise | Error>; + channels(): Promise | Error>; + connect(): Observable; + disconnect(): Promise; + listen(): Observable; + send(data: any): Promise; +} diff --git a/broid-alexa/lib/test/Adapter.d.ts b/broid-alexa/lib/test/Adapter.d.ts new file mode 100644 index 00000000..e69de29b diff --git a/broid-alexa/lib/test/Parser.d.ts b/broid-alexa/lib/test/Parser.d.ts new file mode 100644 index 00000000..e69de29b diff --git a/broid-alexa/package.json b/broid-alexa/package.json index 375bbc46..35722668 100755 --- a/broid-alexa/package.json +++ b/broid-alexa/package.json @@ -26,6 +26,7 @@ "engines": { "node": ">=6.0.0" }, + "types": "./lib/core/index.d.ts", "scripts": { "build": "yarn run clean && yarn run copy && yarn run copy:config && tsc -p tsconfig.json", "clean": "rm -rf lib && rm -rf tsconfig.json && rm -rf tslint.json", diff --git a/broid-callr/lib/core/Adapter.d.ts b/broid-callr/lib/core/Adapter.d.ts new file mode 100644 index 00000000..d501ad1b --- /dev/null +++ b/broid-callr/lib/core/Adapter.d.ts @@ -0,0 +1,30 @@ +import * as Promise from 'bluebird'; +import { Router } from 'express'; +import { Observable } from 'rxjs/Rx'; +import { IAdapterOptions } from './interfaces'; +export declare class Adapter { + private serviceID; + private token; + private tokenSecret; + private connected; + private emitter; + private session; + private parser; + private logLevel; + private username; + private logger; + private router; + private webhookServer; + private webhookURL; + constructor(obj: IAdapterOptions); + users(): Promise; + channels(): Promise; + serviceName(): string; + serviceId(): string; + getRouter(): Router; + connect(): Observable; + disconnect(): Promise; + listen(): Observable; + send(data: object): Promise; + private setupRouter(); +} diff --git a/broid-callr/lib/core/Parser.d.ts b/broid-callr/lib/core/Parser.d.ts new file mode 100644 index 00000000..a184e3d9 --- /dev/null +++ b/broid-callr/lib/core/Parser.d.ts @@ -0,0 +1,14 @@ +import { IActivityStream } from '@broid/schemas'; +import * as Promise from 'bluebird'; +import { ICallrWebHookEvent } from './interfaces'; +export declare class Parser { + serviceID: string; + generatorName: string; + private logger; + constructor(serviceName: string, serviceID: string, logLevel: string); + validate(event: any): Promise; + parse(event: any): Promise; + normalize(event: ICallrWebHookEvent): Promise; + private createIdentifier(); + private createActivityStream(normalized); +} diff --git a/broid-callr/lib/core/WebHookServer.d.ts b/broid-callr/lib/core/WebHookServer.d.ts new file mode 100644 index 00000000..6c713aee --- /dev/null +++ b/broid-callr/lib/core/WebHookServer.d.ts @@ -0,0 +1,14 @@ +import * as Promise from 'bluebird'; +import * as express from 'express'; +import { IAdapterHTTPOptions } from './interfaces'; +export declare class WebHookServer { + private express; + private logger; + private httpClient; + private host; + private port; + constructor(options: IAdapterHTTPOptions, router: express.Router, logLevel?: string); + listen(): void; + close(): Promise; + private setupExpress(router); +} diff --git a/broid-callr/lib/core/index.d.ts b/broid-callr/lib/core/index.d.ts new file mode 100644 index 00000000..6485757c --- /dev/null +++ b/broid-callr/lib/core/index.d.ts @@ -0,0 +1,2 @@ +import { Adapter } from './Adapter'; +export = Adapter; diff --git a/broid-callr/lib/core/interfaces.d.ts b/broid-callr/lib/core/interfaces.d.ts new file mode 100644 index 00000000..ae2d4a6e --- /dev/null +++ b/broid-callr/lib/core/interfaces.d.ts @@ -0,0 +1,17 @@ +export interface IAdapterHTTPOptions { + host: string; + port: number; +} +export interface IAdapterOptions { + logLevel: string; + serviceID: string; + token: string; + tokenSecret: string; + username: string; + webhookURL: string; + http?: IAdapterHTTPOptions; +} +export interface ICallrWebHookEvent { + request: any; + response: any; +} diff --git a/broid-callr/lib/test/Parser.d.ts b/broid-callr/lib/test/Parser.d.ts new file mode 100644 index 00000000..e69de29b diff --git a/broid-callr/package.json b/broid-callr/package.json index d7fbff72..6a8619bd 100644 --- a/broid-callr/package.json +++ b/broid-callr/package.json @@ -26,6 +26,7 @@ "engines": { "node": ">=6.0.0" }, + "types": "./lib/core/index.d.ts", "scripts": { "build": "yarn run clean && yarn run copy && yarn run copy:config && tsc -p tsconfig.json", "clean": "rm -rf lib && rm -rf tsconfig.json && rm -rf tslint.json", diff --git a/broid-discord/lib/core/Adapter.d.ts b/broid-discord/lib/core/Adapter.d.ts new file mode 100644 index 00000000..4ae0bcfd --- /dev/null +++ b/broid-discord/lib/core/Adapter.d.ts @@ -0,0 +1,23 @@ +/// +import * as Promise from 'bluebird'; +import { Observable } from 'rxjs/Rx'; +import { IAdapterOptions } from './interfaces'; +export declare class Adapter { + serviceID: string; + token: string | null; + private connected; + private session; + private parser; + private logLevel; + private logger; + constructor(obj?: IAdapterOptions); + users(): Promise; + channels(): Promise; + serviceId(): string; + serviceName(): string; + getRouter(): null; + connect(): Observable; + disconnect(): Promise; + listen(): Observable; + send(data: object): Promise; +} diff --git a/broid-discord/lib/core/Parser.d.ts b/broid-discord/lib/core/Parser.d.ts new file mode 100644 index 00000000..5d48888e --- /dev/null +++ b/broid-discord/lib/core/Parser.d.ts @@ -0,0 +1,12 @@ +/// +import * as Promise from 'bluebird'; +export declare class Parser { + serviceID: string; + generatorName: string; + private logger; + constructor(serviceName: string, serviceID: string, logLevel: string); + validate(event: any): Promise; + parse(event: any): Promise; + private parseMedia(media, content); + private createActivityStream(normalized); +} diff --git a/broid-discord/lib/core/index.d.ts b/broid-discord/lib/core/index.d.ts new file mode 100644 index 00000000..6485757c --- /dev/null +++ b/broid-discord/lib/core/index.d.ts @@ -0,0 +1,2 @@ +import { Adapter } from './Adapter'; +export = Adapter; diff --git a/broid-discord/lib/core/interfaces.d.ts b/broid-discord/lib/core/interfaces.d.ts new file mode 100644 index 00000000..759e3ac1 --- /dev/null +++ b/broid-discord/lib/core/interfaces.d.ts @@ -0,0 +1,17 @@ +export interface IAdapterOptions { + token: string; + serviceID: string; + logLevel: string; +} +export interface IUserInformations { + readonly id: string; + readonly username: string; + readonly is_bot: boolean; + readonly avatar: string; +} +export interface IChannelInformations { + readonly guildID: string; + readonly id: string; + readonly name: string; + readonly topic: string; +} diff --git a/broid-discord/lib/test/Parser.d.ts b/broid-discord/lib/test/Parser.d.ts new file mode 100644 index 00000000..e69de29b diff --git a/broid-discord/package.json b/broid-discord/package.json index 3511957b..f61859de 100644 --- a/broid-discord/package.json +++ b/broid-discord/package.json @@ -26,6 +26,7 @@ "engines": { "node": ">=6.0.0" }, + "types": "./lib/core/index.d.ts", "scripts": { "build": "yarn run clean && yarn run copy && yarn run copy:config && tsc -p tsconfig.json", "clean": "rm -rf lib && rm -rf tsconfig.json && rm -rf tslint.json", diff --git a/broid-flowdock/lib/core/Adapter.d.ts b/broid-flowdock/lib/core/Adapter.d.ts new file mode 100644 index 00000000..91e91e32 --- /dev/null +++ b/broid-flowdock/lib/core/Adapter.d.ts @@ -0,0 +1,26 @@ +import * as Promise from 'bluebird'; +import { Observable } from 'rxjs/Rx'; +import { IAdapterOptions } from './interfaces'; +export declare class Adapter { + private connected; + private serviceID; + private token; + private session; + private parser; + private logLevel; + private logger; + private storeUsers; + private storeFlows; + constructor(obj?: IAdapterOptions); + users(): Promise>; + channels(): Promise>; + serviceId(): string; + serviceName(): string; + getRouter(): null; + connect(): Observable; + disconnect(): Promise; + listen(): Observable; + send(data: any): Promise; + private userByID(userID); + private flowByID(flowID); +} diff --git a/broid-flowdock/lib/core/Parser.d.ts b/broid-flowdock/lib/core/Parser.d.ts new file mode 100644 index 00000000..0e60ab48 --- /dev/null +++ b/broid-flowdock/lib/core/Parser.d.ts @@ -0,0 +1,11 @@ +import * as Promise from 'bluebird'; +export declare class Parser { + serviceID: string; + generatorName: string; + private logger; + constructor(serviceName: string, serviceID: string, logLevel: string); + validate(event: any): Promise; + parse(event: any): Promise; + private createIdentifier(); + private createActivityStream(normalized); +} diff --git a/broid-flowdock/lib/core/index.d.ts b/broid-flowdock/lib/core/index.d.ts new file mode 100644 index 00000000..6485757c --- /dev/null +++ b/broid-flowdock/lib/core/index.d.ts @@ -0,0 +1,2 @@ +import { Adapter } from './Adapter'; +export = Adapter; diff --git a/broid-flowdock/lib/core/interfaces.d.ts b/broid-flowdock/lib/core/interfaces.d.ts new file mode 100644 index 00000000..fcc8fb55 --- /dev/null +++ b/broid-flowdock/lib/core/interfaces.d.ts @@ -0,0 +1,5 @@ +export interface IAdapterOptions { + token: string; + serviceID: string; + logLevel: string; +} diff --git a/broid-flowdock/lib/test/Parser.d.ts b/broid-flowdock/lib/test/Parser.d.ts new file mode 100644 index 00000000..e69de29b diff --git a/broid-flowdock/package.json b/broid-flowdock/package.json index ce4caf31..a1b488c1 100644 --- a/broid-flowdock/package.json +++ b/broid-flowdock/package.json @@ -26,6 +26,7 @@ "engines": { "node": ">=6.0.0" }, + "types": "./lib/core/index.d.ts", "scripts": { "build": "yarn run clean && yarn run copy && yarn run copy:config && tsc -p tsconfig.json", "clean": "rm -rf lib && rm -rf tsconfig.json && rm -rf tslint.json", diff --git a/broid-gitter/lib/core/Adapter.d.ts b/broid-gitter/lib/core/Adapter.d.ts new file mode 100644 index 00000000..538910a5 --- /dev/null +++ b/broid-gitter/lib/core/Adapter.d.ts @@ -0,0 +1,25 @@ +import * as Promise from 'bluebird'; +import { Observable } from 'rxjs/Rx'; +import { IAdapterOptions } from './interfaces'; +export declare class Adapter { + private ee; + private logLevel; + private logger; + private connected; + private me; + private parser; + private serviceID; + private session; + private token; + constructor(obj?: IAdapterOptions); + users(): Promise; + channels(): Promise; + serviceName(): string; + serviceId(): string; + getRouter(): null; + connect(): Observable; + disconnect(): Promise; + listen(): Observable; + send(data: any): Promise; + private joinRoom(room); +} diff --git a/broid-gitter/lib/core/Parser.d.ts b/broid-gitter/lib/core/Parser.d.ts new file mode 100644 index 00000000..5e86e92b --- /dev/null +++ b/broid-gitter/lib/core/Parser.d.ts @@ -0,0 +1,11 @@ +import * as Promise from 'bluebird'; +export declare class Parser { + serviceID: string; + generatorName: string; + private logger; + constructor(serviceName: string, serviceID: string, logLevel: string); + validate(event: any): Promise; + parse(event: any): Promise; + private createIdentifier(); + private createActivityStream(normalized); +} diff --git a/broid-gitter/lib/core/index.d.ts b/broid-gitter/lib/core/index.d.ts new file mode 100644 index 00000000..6485757c --- /dev/null +++ b/broid-gitter/lib/core/index.d.ts @@ -0,0 +1,2 @@ +import { Adapter } from './Adapter'; +export = Adapter; diff --git a/broid-gitter/lib/core/interfaces.d.ts b/broid-gitter/lib/core/interfaces.d.ts new file mode 100644 index 00000000..5886f847 --- /dev/null +++ b/broid-gitter/lib/core/interfaces.d.ts @@ -0,0 +1,5 @@ +export interface IAdapterOptions { + logLevel: string; + serviceID: string; + token: string; +} diff --git a/broid-gitter/lib/test/Parser.d.ts b/broid-gitter/lib/test/Parser.d.ts new file mode 100644 index 00000000..e69de29b diff --git a/broid-gitter/package.json b/broid-gitter/package.json index 09066d3b..40ce1bc3 100755 --- a/broid-gitter/package.json +++ b/broid-gitter/package.json @@ -26,6 +26,7 @@ "engines": { "node": ">=6.0.0" }, + "types": "./lib/core/index.d.ts", "scripts": { "build": "yarn run clean && yarn run copy && yarn run copy:config && tsc -p tsconfig.json", "clean": "rm -rf lib && rm -rf tsconfig.json && rm -rf tslint.json", diff --git a/broid-google-assistant/lib/core/Adapter.d.ts b/broid-google-assistant/lib/core/Adapter.d.ts new file mode 100644 index 00000000..e4880a62 --- /dev/null +++ b/broid-google-assistant/lib/core/Adapter.d.ts @@ -0,0 +1,33 @@ +/// +import * as Promise from 'bluebird'; +import { Router } from 'express'; +import { Observable } from 'rxjs/Rx'; +import { IAdapterOptions } from './interfaces'; +export declare class Adapter { + private assistant; + private actionsMap; + private serviceID; + private token; + private tokenSecret; + private connected; + private emitter; + private parser; + private logLevel; + private username; + private logger; + private router; + private webhookServer; + constructor(obj: IAdapterOptions); + serviceName(): string; + users(): Promise; + channels(): Promise; + serviceId(): string; + getRouter(): Router | null; + connect(): Observable; + disconnect(): Promise; + listen(): Observable; + send(data: object): Promise; + private addIntent(trigger); + private setupRouter(); + private sendMessage(isSSML, content, noInputs); +} diff --git a/broid-google-assistant/lib/core/Parser.d.ts b/broid-google-assistant/lib/core/Parser.d.ts new file mode 100644 index 00000000..1e1b2c03 --- /dev/null +++ b/broid-google-assistant/lib/core/Parser.d.ts @@ -0,0 +1,14 @@ +/// +import * as actionsSdk from 'actions-on-google'; +import * as Promise from 'bluebird'; +export declare class Parser { + serviceID: string; + generatorName: string; + private logger; + private username; + constructor(serviceName: string, serviceID: string, username: string, logLevel: string); + validate(event: any): Promise; + parse(event: actionsSdk.ActionsSdkAssistant): Promise; + private createIdentifier(); + private createActivityStream(); +} diff --git a/broid-google-assistant/lib/core/WebHookServer.d.ts b/broid-google-assistant/lib/core/WebHookServer.d.ts new file mode 100644 index 00000000..ce375f0f --- /dev/null +++ b/broid-google-assistant/lib/core/WebHookServer.d.ts @@ -0,0 +1,15 @@ +/// +import * as Promise from 'bluebird'; +import * as express from 'express'; +import { IAdapterHTTPOptions } from './interfaces'; +export declare class WebHookServer { + private express; + private logger; + private httpClient; + private host; + private port; + constructor(options: IAdapterHTTPOptions, router: express.Router, logLevel?: string); + listen(): void; + close(): Promise; + private setupExpress(router); +} diff --git a/broid-google-assistant/lib/core/index.d.ts b/broid-google-assistant/lib/core/index.d.ts new file mode 100644 index 00000000..6485757c --- /dev/null +++ b/broid-google-assistant/lib/core/index.d.ts @@ -0,0 +1,2 @@ +import { Adapter } from './Adapter'; +export = Adapter; diff --git a/broid-google-assistant/lib/core/interfaces.d.ts b/broid-google-assistant/lib/core/interfaces.d.ts new file mode 100644 index 00000000..3195f173 --- /dev/null +++ b/broid-google-assistant/lib/core/interfaces.d.ts @@ -0,0 +1,12 @@ +export interface IAdapterHTTPOptions { + host: string; + port: number; +} +export interface IAdapterOptions { + logLevel: string; + http?: IAdapterHTTPOptions; + serviceID: string; + token: string; + tokenSecret: string; + username: string; +} diff --git a/broid-google-assistant/lib/test/Parser.d.ts b/broid-google-assistant/lib/test/Parser.d.ts new file mode 100644 index 00000000..e69de29b diff --git a/broid-google-assistant/package.json b/broid-google-assistant/package.json index 2c225faa..abe5eef3 100755 --- a/broid-google-assistant/package.json +++ b/broid-google-assistant/package.json @@ -26,6 +26,7 @@ "engines": { "node": ">=6.0.0" }, + "types": "./lib/core/index.d.ts", "scripts": { "build": "yarn run clean && yarn run copy && yarn run copy:config && tsc -p tsconfig.json", "clean": "rm -rf lib && rm -rf tsconfig.json && rm -rf tslint.json", diff --git a/broid-groupme/lib/core/Adapter.d.ts b/broid-groupme/lib/core/Adapter.d.ts new file mode 100644 index 00000000..3fa0d889 --- /dev/null +++ b/broid-groupme/lib/core/Adapter.d.ts @@ -0,0 +1,29 @@ +/// +import * as Promise from 'bluebird'; +import { Router } from 'express'; +import { Observable } from 'rxjs/Rx'; +import { IAdapterOptions } from './interfaces'; +export declare class Adapter { + private serviceID; + private username; + private token; + private tokenSecret; + private connected; + private emitter; + private parser; + private logLevel; + private logger; + private router; + private webhookServer; + constructor(obj: IAdapterOptions); + serviceName(): string; + getRouter(): Router | null; + users(): Promise; + channels(): Promise; + serviceId(): string; + connect(): Observable; + disconnect(): Promise; + listen(): Observable; + send(data: any): Promise; + private setupRouter(); +} diff --git a/broid-groupme/lib/core/Parser.d.ts b/broid-groupme/lib/core/Parser.d.ts new file mode 100644 index 00000000..5cb0d11f --- /dev/null +++ b/broid-groupme/lib/core/Parser.d.ts @@ -0,0 +1,12 @@ +/// +import * as Promise from 'bluebird'; +export declare class Parser { + serviceID: string; + generatorName: string; + private logger; + constructor(serviceName: string, serviceID: string, logLevel: string); + validate(event: any): Promise; + parse(event: any): Promise; + private createIdentifier(); + private createActivityStream(normalized); +} diff --git a/broid-groupme/lib/core/WebHookServer.d.ts b/broid-groupme/lib/core/WebHookServer.d.ts new file mode 100644 index 00000000..ce375f0f --- /dev/null +++ b/broid-groupme/lib/core/WebHookServer.d.ts @@ -0,0 +1,15 @@ +/// +import * as Promise from 'bluebird'; +import * as express from 'express'; +import { IAdapterHTTPOptions } from './interfaces'; +export declare class WebHookServer { + private express; + private logger; + private httpClient; + private host; + private port; + constructor(options: IAdapterHTTPOptions, router: express.Router, logLevel?: string); + listen(): void; + close(): Promise; + private setupExpress(router); +} diff --git a/broid-groupme/lib/core/client.d.ts b/broid-groupme/lib/core/client.d.ts new file mode 100644 index 00000000..b4d55792 --- /dev/null +++ b/broid-groupme/lib/core/client.d.ts @@ -0,0 +1,4 @@ +export declare function getMessages(token: string, groupId: string): Promise; +export declare function getMembers(token: string, groupId: string): Promise; +export declare function getGroups(token: string): Promise; +export declare function postMessage(token: string, payload: any): Promise; diff --git a/broid-groupme/lib/core/index.d.ts b/broid-groupme/lib/core/index.d.ts new file mode 100644 index 00000000..6485757c --- /dev/null +++ b/broid-groupme/lib/core/index.d.ts @@ -0,0 +1,2 @@ +import { Adapter } from './Adapter'; +export = Adapter; diff --git a/broid-groupme/lib/core/interfaces.d.ts b/broid-groupme/lib/core/interfaces.d.ts new file mode 100644 index 00000000..be4652b9 --- /dev/null +++ b/broid-groupme/lib/core/interfaces.d.ts @@ -0,0 +1,53 @@ +export interface IAdapterHTTPOptions { + host: string; + port: number; +} +export interface IAdapterOptions { + http?: IAdapterHTTPOptions; + logLevel: string; + serviceID: string; + token: string; + tokenSecret: string; + username: string; +} +export interface IAttachment { + type: string; + url?: string; + lat?: string; + lng?: string; + name?: string; + token: string; + placeholder?: string; + charmap?: number[][]; +} +export interface IMessageParams { + text: string; + attachments: IAttachment[]; +} +export interface IMessage extends IMessageParams { + id: string; + source_guid: string; + sender_id: string; + sender_type: string; + created_at: number; + user_id: string; + group_id: string; + name: string; + avatar_url: string; + system: boolean; + favorited_by: string[]; + recipient_id?: string; +} +export interface IMemberParsed { + avatar: string; + id: string; + username: string; +} +export interface IGroupParsed { + created_at: number; + id: string; + name: string; + members: IMemberParsed[]; + updated_at: number; + type: string; +} diff --git a/broid-groupme/lib/test/Parser.d.ts b/broid-groupme/lib/test/Parser.d.ts new file mode 100644 index 00000000..e69de29b diff --git a/broid-groupme/package.json b/broid-groupme/package.json index 2a1fd722..1a906938 100644 --- a/broid-groupme/package.json +++ b/broid-groupme/package.json @@ -26,6 +26,7 @@ "engines": { "node": ">=6.0.0" }, + "types": "./lib/core/index.d.ts", "scripts": { "build": "yarn run clean && yarn run copy && yarn run copy:config && tsc -p tsconfig.json", "clean": "rm -rf lib && rm -rf tsconfig.json && rm -rf tslint.json", diff --git a/broid-irc/lib/core/Adapter.d.ts b/broid-irc/lib/core/Adapter.d.ts new file mode 100644 index 00000000..5bf428ae --- /dev/null +++ b/broid-irc/lib/core/Adapter.d.ts @@ -0,0 +1,28 @@ +/// +import { ISendParameters } from '@broid/schemas'; +import * as Promise from 'bluebird'; +import { Observable } from 'rxjs/Rx'; +import { IAdapterOptions } from './interfaces'; +export declare class Adapter { + serviceID: string; + private connected; + private address; + private username; + private ircChannels; + private client; + private logLevel; + private connectTimeout; + private logger; + private ee; + private parser; + constructor(obj: IAdapterOptions); + serviceName(): string; + serviceId(): string; + getRouter(): null; + users(): Promise; + channels(): Promise; + connect(): Observable; + disconnect(): Promise; + listen(): Observable; + send(data: ISendParameters): Promise; +} diff --git a/broid-irc/lib/core/Parser.d.ts b/broid-irc/lib/core/Parser.d.ts new file mode 100644 index 00000000..98f54968 --- /dev/null +++ b/broid-irc/lib/core/Parser.d.ts @@ -0,0 +1,11 @@ +/// +import * as Promise from 'bluebird'; +export declare class Parser { + serviceID: string; + generatorName: string; + private logger; + private username; + constructor(serviceName: string, username: string, serviceID: string, logLevel: string); + validate(event: object | null): Promise; + parse(event: object | null): Promise; +} diff --git a/broid-irc/lib/core/index.d.ts b/broid-irc/lib/core/index.d.ts new file mode 100644 index 00000000..6485757c --- /dev/null +++ b/broid-irc/lib/core/index.d.ts @@ -0,0 +1,2 @@ +import { Adapter } from './Adapter'; +export = Adapter; diff --git a/broid-irc/lib/core/interfaces.d.ts b/broid-irc/lib/core/interfaces.d.ts new file mode 100644 index 00000000..3067a03c --- /dev/null +++ b/broid-irc/lib/core/interfaces.d.ts @@ -0,0 +1,8 @@ +export interface IAdapterOptions { + address: string; + username: string; + channels: string[]; + serviceID?: string; + logLevel?: string; + connectTimeout?: number; +} diff --git a/broid-irc/lib/test/Parser.d.ts b/broid-irc/lib/test/Parser.d.ts new file mode 100644 index 00000000..e69de29b diff --git a/broid-irc/package.json b/broid-irc/package.json index a7cde3ab..f2da8605 100644 --- a/broid-irc/package.json +++ b/broid-irc/package.json @@ -26,6 +26,7 @@ "engines": { "node": ">=6.0.0" }, + "types": "./lib/core/index.d.ts", "scripts": { "build": "yarn run clean && yarn run copy && yarn run copy:config && tsc -p tsconfig.json", "clean": "rm -rf lib && rm -rf tsconfig.json && rm -rf tslint.json", diff --git a/broid-kik/lib/core/Adapter.d.ts b/broid-kik/lib/core/Adapter.d.ts new file mode 100644 index 00000000..106ddffb --- /dev/null +++ b/broid-kik/lib/core/Adapter.d.ts @@ -0,0 +1,30 @@ +/// +import * as Promise from 'bluebird'; +import { Router } from 'express'; +import { Observable } from 'rxjs/Rx'; +import { IAdapterOptions } from './interfaces'; +export declare class Adapter { + private serviceID; + private token; + private connected; + private session; + private parser; + private logLevel; + private username; + private logger; + private router; + private webhookServer; + private webhookURL; + private storeUsers; + constructor(obj: IAdapterOptions); + users(): Promise>; + channels(): Promise; + serviceName(): string; + serviceId(): string; + getRouter(): Router | null; + connect(): Observable; + disconnect(): Promise; + listen(): Observable; + send(data: object): Promise; + private user(key, cache?); +} diff --git a/broid-kik/lib/core/Parser.d.ts b/broid-kik/lib/core/Parser.d.ts new file mode 100644 index 00000000..22f7546f --- /dev/null +++ b/broid-kik/lib/core/Parser.d.ts @@ -0,0 +1,14 @@ +/// +import { IActivityStream } from '@broid/schemas'; +import * as Promise from 'bluebird'; +export declare class Parser { + serviceID: string; + generatorName: string; + private logger; + constructor(serviceName: string, serviceID: string, logLevel: string); + validate(event: any): Promise; + parse(event: any): Promise; + normalize(event: any, userInformation: any): Promise; + private createIdentifier(); + private createActivityStream(normalized); +} diff --git a/broid-kik/lib/core/WebHookServer.d.ts b/broid-kik/lib/core/WebHookServer.d.ts new file mode 100644 index 00000000..ce375f0f --- /dev/null +++ b/broid-kik/lib/core/WebHookServer.d.ts @@ -0,0 +1,15 @@ +/// +import * as Promise from 'bluebird'; +import * as express from 'express'; +import { IAdapterHTTPOptions } from './interfaces'; +export declare class WebHookServer { + private express; + private logger; + private httpClient; + private host; + private port; + constructor(options: IAdapterHTTPOptions, router: express.Router, logLevel?: string); + listen(): void; + close(): Promise; + private setupExpress(router); +} diff --git a/broid-kik/lib/core/index.d.ts b/broid-kik/lib/core/index.d.ts new file mode 100644 index 00000000..6485757c --- /dev/null +++ b/broid-kik/lib/core/index.d.ts @@ -0,0 +1,2 @@ +import { Adapter } from './Adapter'; +export = Adapter; diff --git a/broid-kik/lib/core/interfaces.d.ts b/broid-kik/lib/core/interfaces.d.ts new file mode 100644 index 00000000..03ef7a30 --- /dev/null +++ b/broid-kik/lib/core/interfaces.d.ts @@ -0,0 +1,12 @@ +export interface IAdapterHTTPOptions { + host: string; + port: number; +} +export interface IAdapterOptions { + logLevel: string; + http: IAdapterHTTPOptions; + serviceID: string; + token: string; + username: string; + webhookURL: string; +} diff --git a/broid-kik/lib/test/Parser.d.ts b/broid-kik/lib/test/Parser.d.ts new file mode 100644 index 00000000..e69de29b diff --git a/broid-kik/package.json b/broid-kik/package.json index 0199fe33..6f0018dd 100644 --- a/broid-kik/package.json +++ b/broid-kik/package.json @@ -26,6 +26,7 @@ "engines": { "node": ">=6.0.0" }, + "types": "./lib/core/index.d.ts", "scripts": { "build": "yarn run clean && yarn run copy && yarn run copy:config && tsc -p tsconfig.json", "clean": "rm -rf lib && rm -rf tsconfig.json && rm -rf tslint.json", diff --git a/broid-line/lib/core/Adapter.d.ts b/broid-line/lib/core/Adapter.d.ts new file mode 100644 index 00000000..e66997e1 --- /dev/null +++ b/broid-line/lib/core/Adapter.d.ts @@ -0,0 +1,29 @@ +/// +import * as Promise from 'bluebird'; +import { Observable } from 'rxjs/Rx'; +import { IAdapterOptions } from './interfaces'; +export declare class Adapter { + private connected; + private logLevel; + private logger; + private parser; + private router; + private serviceID; + private session; + private storeUsers; + private token; + private tokenSecret; + private username; + private webhookServer; + constructor(obj: IAdapterOptions); + users(): Promise>; + channels(): Promise; + serviceName(): string; + serviceId(): string; + getRouter(): null; + connect(): Observable; + disconnect(): Promise; + listen(): Observable; + send(data: object): Promise; + private user(key, cache?); +} diff --git a/broid-line/lib/core/Parser.d.ts b/broid-line/lib/core/Parser.d.ts new file mode 100644 index 00000000..d66aae13 --- /dev/null +++ b/broid-line/lib/core/Parser.d.ts @@ -0,0 +1,15 @@ +/// +import * as Promise from 'bluebird'; +export declare class Parser { + serviceID: string; + generatorName: string; + private logger; + constructor(serviceName: string, serviceID: string, logLevel: string); + validate(event: any): Promise; + parse(event: any): Promise; + normalize(event: any): Promise; + private createIdentifier(); + private createActivityStream(normalized); + private createAuthor(source); + private createTarget(source); +} diff --git a/broid-line/lib/core/WebHookServer.d.ts b/broid-line/lib/core/WebHookServer.d.ts new file mode 100644 index 00000000..ce375f0f --- /dev/null +++ b/broid-line/lib/core/WebHookServer.d.ts @@ -0,0 +1,15 @@ +/// +import * as Promise from 'bluebird'; +import * as express from 'express'; +import { IAdapterHTTPOptions } from './interfaces'; +export declare class WebHookServer { + private express; + private logger; + private httpClient; + private host; + private port; + constructor(options: IAdapterHTTPOptions, router: express.Router, logLevel?: string); + listen(): void; + close(): Promise; + private setupExpress(router); +} diff --git a/broid-line/lib/core/index.d.ts b/broid-line/lib/core/index.d.ts new file mode 100644 index 00000000..6485757c --- /dev/null +++ b/broid-line/lib/core/index.d.ts @@ -0,0 +1,2 @@ +import { Adapter } from './Adapter'; +export = Adapter; diff --git a/broid-line/lib/core/interfaces.d.ts b/broid-line/lib/core/interfaces.d.ts new file mode 100644 index 00000000..41b1ea15 --- /dev/null +++ b/broid-line/lib/core/interfaces.d.ts @@ -0,0 +1,16 @@ +export interface IAdapterHTTPOptions { + host: string; + port: number; +} +export interface IAdapterOptions { + logLevel: string; + http: IAdapterHTTPOptions; + serviceID: string; + token: string; + tokenSecret: string; + username: string; +} +export interface IWebHookEvent { + response: any; + request: any; +} diff --git a/broid-line/lib/test/Parser.d.ts b/broid-line/lib/test/Parser.d.ts new file mode 100644 index 00000000..e69de29b diff --git a/broid-line/package.json b/broid-line/package.json index e661cefe..c29ad9f1 100644 --- a/broid-line/package.json +++ b/broid-line/package.json @@ -26,6 +26,7 @@ "engines": { "node": ">=6.0.0" }, + "types": "./lib/core/index.d.ts", "scripts": { "build": "yarn run clean && yarn run copy && yarn run copy:config && tsc -p tsconfig.json", "clean": "rm -rf lib && rm -rf tsconfig.json && rm -rf tslint.json", diff --git a/broid-messenger/lib/core/Adapter.d.ts b/broid-messenger/lib/core/Adapter.d.ts new file mode 100644 index 00000000..d77c1abd --- /dev/null +++ b/broid-messenger/lib/core/Adapter.d.ts @@ -0,0 +1,30 @@ +/// +import * as Promise from 'bluebird'; +import { Router } from 'express'; +import { Observable } from 'rxjs/Rx'; +import { IAdapterOptions } from './interfaces'; +export declare class Adapter { + private connected; + private emitter; + private logLevel; + private logger; + private parser; + private router; + private serviceID; + private storeUsers; + private token; + private tokenSecret; + private webhookServer; + constructor(obj: IAdapterOptions); + users(): Promise>; + channels(): Promise; + serviceId(): string; + serviceName(): string; + getRouter(): Router | null; + connect(): Observable; + disconnect(): Promise; + listen(): Observable; + send(data: object): Promise; + private user(id, fields?, cache?); + private setupRouter(); +} diff --git a/broid-messenger/lib/core/Parser.d.ts b/broid-messenger/lib/core/Parser.d.ts new file mode 100644 index 00000000..46049a8d --- /dev/null +++ b/broid-messenger/lib/core/Parser.d.ts @@ -0,0 +1,16 @@ +/// +import { IActivityStream } from '@broid/schemas'; +import * as Promise from 'bluebird'; +import { IWebHookEvent } from './interfaces'; +export declare class Parser { + serviceID: string; + generatorName: string; + private logger; + constructor(serviceName: string, serviceID: string, logLevel: string); + validate(event: any): Promise; + parse(event: any): Promise; + normalize(event: IWebHookEvent): Promise; + private createIdentifier(); + private createActivityStream(normalized); + private parseAttachment(attachment); +} diff --git a/broid-messenger/lib/core/WebHookServer.d.ts b/broid-messenger/lib/core/WebHookServer.d.ts new file mode 100644 index 00000000..ce375f0f --- /dev/null +++ b/broid-messenger/lib/core/WebHookServer.d.ts @@ -0,0 +1,15 @@ +/// +import * as Promise from 'bluebird'; +import * as express from 'express'; +import { IAdapterHTTPOptions } from './interfaces'; +export declare class WebHookServer { + private express; + private logger; + private httpClient; + private host; + private port; + constructor(options: IAdapterHTTPOptions, router: express.Router, logLevel?: string); + listen(): void; + close(): Promise; + private setupExpress(router); +} diff --git a/broid-messenger/lib/core/helpers.d.ts b/broid-messenger/lib/core/helpers.d.ts new file mode 100644 index 00000000..d07df6c5 --- /dev/null +++ b/broid-messenger/lib/core/helpers.d.ts @@ -0,0 +1,3 @@ +export declare function parseQuickReplies(quickReplies: any[]): any[]; +export declare function createButtons(buttons: any[]): any[]; +export declare function createAttachment(name: string, content: string, buttons?: any[], imageURL?: any): object; diff --git a/broid-messenger/lib/core/index.d.ts b/broid-messenger/lib/core/index.d.ts new file mode 100644 index 00000000..6485757c --- /dev/null +++ b/broid-messenger/lib/core/index.d.ts @@ -0,0 +1,2 @@ +import { Adapter } from './Adapter'; +export = Adapter; diff --git a/broid-messenger/lib/core/interfaces.d.ts b/broid-messenger/lib/core/interfaces.d.ts new file mode 100644 index 00000000..eff0ce7a --- /dev/null +++ b/broid-messenger/lib/core/interfaces.d.ts @@ -0,0 +1,15 @@ +export interface IAdapterHTTPOptions { + host: string; + port: number; +} +export interface IAdapterOptions { + logLevel: string; + http: IAdapterHTTPOptions; + serviceID: string; + token: string; + tokenSecret: string; +} +export interface IWebHookEvent { + response: any; + request: any; +} diff --git a/broid-messenger/lib/test/Parser.d.ts b/broid-messenger/lib/test/Parser.d.ts new file mode 100644 index 00000000..e69de29b diff --git a/broid-messenger/package.json b/broid-messenger/package.json index dea15b61..235821ff 100644 --- a/broid-messenger/package.json +++ b/broid-messenger/package.json @@ -26,6 +26,7 @@ "engines": { "node": ">=6.0.0" }, + "types": "./lib/core/index.d.ts", "scripts": { "build": "yarn run clean && yarn run copy && yarn run copy:config && tsc -p tsconfig.json", "clean": "rm -rf lib && rm -rf tsconfig.json && rm -rf tslint.json", diff --git a/broid-ms-teams/lib/core/Adapter.d.ts b/broid-ms-teams/lib/core/Adapter.d.ts new file mode 100644 index 00000000..950f4040 --- /dev/null +++ b/broid-ms-teams/lib/core/Adapter.d.ts @@ -0,0 +1,32 @@ +/// +/// +import * as Promise from 'bluebird'; +import { Router } from 'express'; +import { Observable } from 'rxjs/Rx'; +import { IAdapterOptions } from './interfaces'; +export declare class Adapter { + private connected; + private logLevel; + private logger; + private parser; + private router; + private serviceID; + private storeUsers; + private storeAddresses; + private token; + private tokenSecret; + private webhookServer; + private session; + private sessionConnector; + constructor(obj: IAdapterOptions); + users(): Promise>; + channels(): Promise; + addresses(id: string): Promise; + serviceId(): string; + serviceName(): string; + getRouter(): Router | null; + connect(): Observable; + disconnect(): Promise; + listen(): Observable; + send(data: object): Promise; +} diff --git a/broid-ms-teams/lib/core/Parser.d.ts b/broid-ms-teams/lib/core/Parser.d.ts new file mode 100644 index 00000000..59841b13 --- /dev/null +++ b/broid-ms-teams/lib/core/Parser.d.ts @@ -0,0 +1,13 @@ +/// +import { IActivityStream } from '@broid/schemas'; +import * as Promise from 'bluebird'; +export declare class Parser { + serviceID: string; + generatorName: string; + private logger; + constructor(serviceName: string, serviceID: string, logLevel: string); + validate(event: any): Promise; + parse(event: any): Promise; + private createIdentifier(); + private createActivityStream(normalized); +} diff --git a/broid-ms-teams/lib/core/WebHookServer.d.ts b/broid-ms-teams/lib/core/WebHookServer.d.ts new file mode 100644 index 00000000..51391b87 --- /dev/null +++ b/broid-ms-teams/lib/core/WebHookServer.d.ts @@ -0,0 +1,16 @@ +/// +/// +import * as Promise from 'bluebird'; +import * as express from 'express'; +import { IAdapterHTTPOptions } from './interfaces'; +export declare class WebHookServer { + private express; + private logger; + private httpClient; + private host; + private port; + constructor(options: IAdapterHTTPOptions, router: express.Router, logLevel?: string); + listen(): void; + close(): Promise; + private setupExpress(router); +} diff --git a/broid-ms-teams/lib/core/index.d.ts b/broid-ms-teams/lib/core/index.d.ts new file mode 100644 index 00000000..6485757c --- /dev/null +++ b/broid-ms-teams/lib/core/index.d.ts @@ -0,0 +1,2 @@ +import { Adapter } from './Adapter'; +export = Adapter; diff --git a/broid-ms-teams/lib/core/interfaces.d.ts b/broid-ms-teams/lib/core/interfaces.d.ts new file mode 100644 index 00000000..da88e5ce --- /dev/null +++ b/broid-ms-teams/lib/core/interfaces.d.ts @@ -0,0 +1,11 @@ +export interface IAdapterHTTPOptions { + host: string; + port: number; +} +export interface IAdapterOptions { + logLevel: string; + http?: IAdapterHTTPOptions; + serviceID: string; + token: string; + tokenSecret: string; +} diff --git a/broid-ms-teams/lib/test/Parser.d.ts b/broid-ms-teams/lib/test/Parser.d.ts new file mode 100644 index 00000000..e69de29b diff --git a/broid-ms-teams/package.json b/broid-ms-teams/package.json index a42ed2f7..f2805a72 100644 --- a/broid-ms-teams/package.json +++ b/broid-ms-teams/package.json @@ -26,6 +26,7 @@ "engines": { "node": ">=6.0.0" }, + "types": "./lib/core/index.d.ts", "scripts": { "build": "yarn run clean && yarn run copy && yarn run copy:config && tsc -p tsconfig.json", "clean": "rm -rf lib && rm -rf tsconfig.json && rm -rf tslint.json", diff --git a/broid-nexmo/lib/core/Adapter.d.ts b/broid-nexmo/lib/core/Adapter.d.ts new file mode 100644 index 00000000..e5006be3 --- /dev/null +++ b/broid-nexmo/lib/core/Adapter.d.ts @@ -0,0 +1,30 @@ +/// +import * as Promise from 'bluebird'; +import { Router } from 'express'; +import { Observable } from 'rxjs/Rx'; +import { IAdapterOptions } from './interfaces'; +export declare class Adapter { + private serviceID; + private username; + private token; + private tokenSecret; + private connected; + private parser; + private logLevel; + private logger; + private webhookServer; + private session; + private emitter; + private router; + constructor(obj: IAdapterOptions); + users(): Promise; + channels(): Promise; + serviceId(): string; + getRouter(): Router | null; + serviceName(): string; + connect(): Observable; + disconnect(): Promise; + listen(): Observable; + send(data: any): Promise; + private setupRouter(); +} diff --git a/broid-nexmo/lib/core/Parser.d.ts b/broid-nexmo/lib/core/Parser.d.ts new file mode 100644 index 00000000..ee303350 --- /dev/null +++ b/broid-nexmo/lib/core/Parser.d.ts @@ -0,0 +1,12 @@ +/// +import * as Promise from 'bluebird'; +export declare class Parser { + serviceID: string; + generatorName: string; + private logger; + constructor(serviceName: string, serviceID: string, logLevel: string); + validate(event: any): Promise; + parse(event: any): Promise; + private createIdentifier(); + private createActivityStream(event); +} diff --git a/broid-nexmo/lib/core/WebHookServer.d.ts b/broid-nexmo/lib/core/WebHookServer.d.ts new file mode 100644 index 00000000..7625afee --- /dev/null +++ b/broid-nexmo/lib/core/WebHookServer.d.ts @@ -0,0 +1,17 @@ +/// +/// +import * as Promise from 'bluebird'; +import * as EventEmitter from 'events'; +import * as express from 'express'; +import { IAdapterHTTPOptions } from './interfaces'; +export declare class WebHookServer extends EventEmitter { + private express; + private logger; + private httpClient; + private host; + private port; + constructor(router: express.Router, options: IAdapterHTTPOptions, logLevel?: string); + listen(): void; + close(): Promise; + private setupExpress(router); +} diff --git a/broid-nexmo/lib/core/index.d.ts b/broid-nexmo/lib/core/index.d.ts new file mode 100644 index 00000000..6485757c --- /dev/null +++ b/broid-nexmo/lib/core/index.d.ts @@ -0,0 +1,2 @@ +import { Adapter } from './Adapter'; +export = Adapter; diff --git a/broid-nexmo/lib/core/interfaces.d.ts b/broid-nexmo/lib/core/interfaces.d.ts new file mode 100644 index 00000000..ce08bfb4 --- /dev/null +++ b/broid-nexmo/lib/core/interfaces.d.ts @@ -0,0 +1,12 @@ +export interface IAdapterHTTPOptions { + host: string; + port: number; +} +export interface IAdapterOptions { + http: IAdapterHTTPOptions; + logLevel: string; + serviceID: string; + token: string; + tokenSecret: string; + username: string; +} diff --git a/broid-nexmo/lib/test/Parser.d.ts b/broid-nexmo/lib/test/Parser.d.ts new file mode 100644 index 00000000..e69de29b diff --git a/broid-nexmo/package.json b/broid-nexmo/package.json index cfbc0a0a..6eff6337 100755 --- a/broid-nexmo/package.json +++ b/broid-nexmo/package.json @@ -26,6 +26,7 @@ "engines": { "node": ">=6.0.0" }, + "types": "./lib/core/index.d.ts", "scripts": { "build": "yarn run clean && yarn run copy && yarn run copy:config && tsc -p tsconfig.json", "clean": "rm -rf lib && rm -rf tsconfig.json && rm -rf tslint.json", diff --git a/broid-schemas/lib/index.d.ts b/broid-schemas/lib/index.d.ts new file mode 100644 index 00000000..5f57b9f2 --- /dev/null +++ b/broid-schemas/lib/index.d.ts @@ -0,0 +1,59 @@ +/// +import * as Promise from 'bluebird'; +export interface IASBase { + id: string; + name?: string; + type: string; +} +export interface IASContext { + content: string; + name?: string; + type: string; +} +export interface IASMedia { + content?: string; + context?: IASContext; + id?: string; + mediaType?: string; + name?: string; + preview?: string; + type: string; + url: string; +} +export interface IASObject { + attachment?: IASMedia | IASMedia[] | null; + content?: string; + context?: IASContext; + id: string; + latitude?: number; + longitude?: number; + mediaType?: string; + name?: string; + preview?: string; + tag?: IASTag | IASTag[]; + type: string; + url?: string; +} +export interface IActivityStream { + readonly '@context': string; + readonly published: number; + readonly type: string; + readonly generator: IASBase; + actor?: IASBase; + target?: IASBase; + object?: IASObject; +} +export interface IASTag { + id: string; + name: string; + type: string; +} +export interface ISendParameters { + readonly '@context': string; + readonly type: string; + readonly generator: {}; + actor?: IASBase; + to: IASBase; + object: IASObject; +} +export default function (data: any, schema: string): Promise; diff --git a/broid-schemas/package.json b/broid-schemas/package.json index f7a3a4f1..09aab7e4 100644 --- a/broid-schemas/package.json +++ b/broid-schemas/package.json @@ -25,6 +25,7 @@ "engines": { "node": ">=6.0.0" }, + "types": "./lib/index.d.ts", "scripts": { "build": "yarn run clean && yarn run lint && make && tsc -p tsconfig.json", "clean": "rm -rf lib", diff --git a/broid-skype/lib/core/Adapter.d.ts b/broid-skype/lib/core/Adapter.d.ts new file mode 100644 index 00000000..bb816482 --- /dev/null +++ b/broid-skype/lib/core/Adapter.d.ts @@ -0,0 +1,31 @@ +/// +import * as Promise from 'bluebird'; +import { Router } from 'express'; +import { Observable } from 'rxjs/Rx'; +import { IAdapterOptions } from './interfaces'; +export declare class Adapter { + private connected; + private logLevel; + private logger; + private parser; + private router; + private serviceID; + private storeUsers; + private storeAddresses; + private token; + private tokenSecret; + private webhookServer; + private session; + private sessionConnector; + constructor(obj: IAdapterOptions); + users(): Promise>; + channels(): Promise; + addresses(id: string): Promise; + serviceId(): string; + getRouter(): Router | null; + serviceName(): string; + connect(): Observable; + disconnect(): Promise; + listen(): Observable; + send(data: object): Promise; +} diff --git a/broid-skype/lib/core/Parser.d.ts b/broid-skype/lib/core/Parser.d.ts new file mode 100644 index 00000000..e03ec4cb --- /dev/null +++ b/broid-skype/lib/core/Parser.d.ts @@ -0,0 +1,13 @@ +/// +import { IActivityStream } from '@broid/schemas'; +import * as Promise from 'bluebird'; +export declare class Parser { + serviceID: string; + generatorName: string; + private logger; + constructor(serviceName: string, serviceID: string, logLevel: string); + validate(event: any): Promise; + parse(event: any): Promise; + private createIdentifier(); + private createActivityStream(normalized); +} diff --git a/broid-skype/lib/core/WebHookServer.d.ts b/broid-skype/lib/core/WebHookServer.d.ts new file mode 100644 index 00000000..8ab5f7b8 --- /dev/null +++ b/broid-skype/lib/core/WebHookServer.d.ts @@ -0,0 +1,15 @@ +/// +import * as Promise from 'bluebird'; +import * as express from 'express'; +import { IAdapterHTTPOptions } from './interfaces'; +export declare class WebHookServer { + private express; + private logger; + private httpServer; + private host; + private port; + constructor(router: express.Router, options: IAdapterHTTPOptions, logLevel?: string); + listen(): void; + close(): Promise; + private setupExpress(router); +} diff --git a/broid-skype/lib/core/index.d.ts b/broid-skype/lib/core/index.d.ts new file mode 100644 index 00000000..6485757c --- /dev/null +++ b/broid-skype/lib/core/index.d.ts @@ -0,0 +1,2 @@ +import { Adapter } from './Adapter'; +export = Adapter; diff --git a/broid-skype/lib/core/interfaces.d.ts b/broid-skype/lib/core/interfaces.d.ts new file mode 100644 index 00000000..f0ccfbfe --- /dev/null +++ b/broid-skype/lib/core/interfaces.d.ts @@ -0,0 +1,11 @@ +export interface IAdapterHTTPOptions { + host: string; + port: number; +} +export interface IAdapterOptions { + logLevel: string; + http: IAdapterHTTPOptions; + serviceID: string; + token: string; + tokenSecret: string; +} diff --git a/broid-skype/lib/test/Parser.d.ts b/broid-skype/lib/test/Parser.d.ts new file mode 100644 index 00000000..e69de29b diff --git a/broid-skype/package.json b/broid-skype/package.json index c6bb1973..60f92bf3 100644 --- a/broid-skype/package.json +++ b/broid-skype/package.json @@ -26,6 +26,7 @@ "engines": { "node": ">=6.0.0" }, + "types": "./lib/core/index.d.ts", "scripts": { "build": "yarn run clean && yarn run copy && yarn run copy:config && tsc -p tsconfig.json", "clean": "rm -rf lib && rm -rf tsconfig.json && rm -rf tslint.json", diff --git a/broid-slack/lib/core/Adapter.d.ts b/broid-slack/lib/core/Adapter.d.ts new file mode 100644 index 00000000..0a64e8d9 --- /dev/null +++ b/broid-slack/lib/core/Adapter.d.ts @@ -0,0 +1,34 @@ +import { ISendParameters } from '@broid/schemas'; +import * as Promise from 'bluebird'; +import { Router } from 'express'; +import { Observable } from 'rxjs/Rx'; +import { IAdapterOptions } from './interfaces'; +export declare class Adapter { + private asUser; + private connected; + private emitter; + private logLevel; + private logger; + private parser; + private router; + private serviceID; + private session; + private sessionWeb; + private storeUsers; + private storeChannels; + private token; + private webhookServer; + constructor(obj: IAdapterOptions); + users(): Promise>; + channels(): Promise>; + serviceId(): string; + getRouter(): Router | null; + serviceName(): string; + connect(): Observable; + disconnect(): Promise; + listen(): Observable; + send(data: ISendParameters): Promise; + private channel(key, cache?); + private user(key, cache?); + private setupRoutes(); +} diff --git a/broid-slack/lib/core/Parser.d.ts b/broid-slack/lib/core/Parser.d.ts new file mode 100644 index 00000000..46add15f --- /dev/null +++ b/broid-slack/lib/core/Parser.d.ts @@ -0,0 +1,14 @@ +import * as Promise from 'bluebird'; +import { IMessage } from './interfaces'; +export declare class Parser { + serviceID: string; + generatorName: string; + private logger; + constructor(serviceName: string, serviceID: string, logLevel: string); + validate(event: any): Promise; + parse(event: IMessage | null): Promise; + private createIdentifier(); + private createActivityStream(normalized); + private ts2Timestamp(ts); + private parseFile(attachment); +} diff --git a/broid-slack/lib/core/WebHookServer.d.ts b/broid-slack/lib/core/WebHookServer.d.ts new file mode 100644 index 00000000..a6ab5221 --- /dev/null +++ b/broid-slack/lib/core/WebHookServer.d.ts @@ -0,0 +1,14 @@ +import * as Promise from 'bluebird'; +import * as express from 'express'; +import { IAdapterHTTPOptions } from './interfaces'; +export declare class WebHookServer { + private express; + private logger; + private host; + private httpClient; + private port; + constructor(options: IAdapterHTTPOptions, router: express.Router, logLevel?: string); + listen(): void; + close(): Promise; + private setupExpress(router); +} diff --git a/broid-slack/lib/core/helpers.d.ts b/broid-slack/lib/core/helpers.d.ts new file mode 100644 index 00000000..a1c4e306 --- /dev/null +++ b/broid-slack/lib/core/helpers.d.ts @@ -0,0 +1,4 @@ +import { IWebHookEvent } from './interfaces'; +export declare function createActions(buttons: any[]): any[]; +export declare function createSendMessage(data: any, message: any, actions: string, attachments: any, responseURL: string): any; +export declare function parseWebHookEvent(event: IWebHookEvent): any; diff --git a/broid-slack/lib/core/index.d.ts b/broid-slack/lib/core/index.d.ts new file mode 100644 index 00000000..6485757c --- /dev/null +++ b/broid-slack/lib/core/index.d.ts @@ -0,0 +1,2 @@ +import { Adapter } from './Adapter'; +export = Adapter; diff --git a/broid-slack/lib/core/interfaces.d.ts b/broid-slack/lib/core/interfaces.d.ts new file mode 100644 index 00000000..50c2797b --- /dev/null +++ b/broid-slack/lib/core/interfaces.d.ts @@ -0,0 +1,128 @@ +export interface IAdapterHTTPOptions { + host: string; + port: number; +} +export interface IAdapterOptions { + logLevel: string; + http: IAdapterHTTPOptions; + serviceID: string; + token: string; + asUser: boolean; +} +export interface IWebHookEvent { + response: any; + request: any; +} +export interface IMessage { + type: string; + channel: ISlackGroup | ISlackDirectMessage | ISlackChannel; + user: ISlackUser; + text: string; + ts: string; +} +export interface ISlackField { + value: string; + alt: string; +} +export interface ISlackProfile { + first_name: string; + last_name: string; + avatar_hash: string; + real_name: string; + real_name_normalized: string; + email: string; + image_24: string; + image_32: string; + image_48: string; + image_72: string; + image_192: string; + image_512: string; + fields: { + [name: string]: ISlackField; + }; +} +export interface ISlackUser { + id: string; + team_id: string; + name: string; + deleted: boolean; + color: string; + real_name: string; + tz: string; + tz_label: string; + tz_offset: number; + profile: ISlackProfile; + is_admin: boolean; + is_owner: boolean; + is_primary_owner: boolean; + is_restricted: boolean; + is_ultra_restricted: boolean; + is_bot: boolean; + presence: string; +} +export interface ISlackChannel { + id: string; + name: string; + is_channel: boolean; + created: 1426851129; + creator: string; + is_archived: boolean; + is_general: boolean; + has_pins: boolean; + is_member: boolean; +} +export interface ISlackDirectMessage { + id: string; + user: string; + created: number; + is_im: boolean; + is_org_shared: boolean; + has_pins: boolean; + last_read: string; + latest: ISlackMessage; + unread_count: number; + unread_count_display: number; + is_open: boolean; +} +export interface ISlackGroup { + id: string; + name: string; + is_group: boolean; + created: number; + creator: string; + is_archived: boolean; + is_mpim: boolean; + has_pins: boolean; + is_open: boolean; + last_read: string; + latest: ISlackMessage; + unread_count: number; + unread_count_display: number; + members: string[]; + topic: { + value: string; + creator: string; + last_set: number; + }; + purpose: { + value: string; + creator: string; + last_set: number; + }; +} +export interface ISlackMessage { + type: string; + subtype?: string; + file?: any; + channel: string; + user: string; + text: string; + ts: string; +} +export interface ISlackAction { + confirm?: any; + name: string; + text: string; + type: string; + value: string; +} diff --git a/broid-slack/lib/test/Parser.d.ts b/broid-slack/lib/test/Parser.d.ts new file mode 100644 index 00000000..e69de29b diff --git a/broid-slack/package.json b/broid-slack/package.json index 04b7f160..5bc79773 100644 --- a/broid-slack/package.json +++ b/broid-slack/package.json @@ -26,6 +26,7 @@ "engines": { "node": ">=6.0.0" }, + "types": "./lib/core/index.d.ts", "scripts": { "build": "yarn run clean && yarn run copy && yarn run copy:config && tsc -p tsconfig.json", "clean": "rm -rf lib && rm -rf tsconfig.json && rm -rf tslint.json", diff --git a/broid-telegram/lib/core/Adapter.d.ts b/broid-telegram/lib/core/Adapter.d.ts new file mode 100644 index 00000000..72f6dc0a --- /dev/null +++ b/broid-telegram/lib/core/Adapter.d.ts @@ -0,0 +1,28 @@ +/// +import * as Promise from 'bluebird'; +import { Router } from 'express'; +import { Observable } from 'rxjs/Rx'; +import { IAdapterOptions } from './interfaces'; +export declare class Adapter { + private connected; + private serviceID; + private token; + private session; + private parser; + private logLevel; + private logger; + private router; + private webhookServer; + private webhookURL; + constructor(obj: IAdapterOptions); + users(): Promise; + channels(): Promise; + serviceId(): string; + serviceName(): string; + getRouter(): Router | null; + connect(): Observable; + disconnect(): Promise; + listen(): Observable; + send(data: object): Promise; + private setupRouter(); +} diff --git a/broid-telegram/lib/core/Parser.d.ts b/broid-telegram/lib/core/Parser.d.ts new file mode 100644 index 00000000..09618264 --- /dev/null +++ b/broid-telegram/lib/core/Parser.d.ts @@ -0,0 +1,14 @@ +/// +import { IActivityStream } from '@broid/schemas'; +import * as Promise from 'bluebird'; +export declare class Parser { + serviceID: string; + generatorName: string; + private logger; + constructor(serviceName: string, serviceID: string, logLevel: string); + validate(event: any): Promise; + parse(event: any): Promise; + normalize(evt: any): Promise; + private createIdentifier(); + private createActivityStream(normalized); +} diff --git a/broid-telegram/lib/core/WebHookServer.d.ts b/broid-telegram/lib/core/WebHookServer.d.ts new file mode 100644 index 00000000..ce375f0f --- /dev/null +++ b/broid-telegram/lib/core/WebHookServer.d.ts @@ -0,0 +1,15 @@ +/// +import * as Promise from 'bluebird'; +import * as express from 'express'; +import { IAdapterHTTPOptions } from './interfaces'; +export declare class WebHookServer { + private express; + private logger; + private httpClient; + private host; + private port; + constructor(options: IAdapterHTTPOptions, router: express.Router, logLevel?: string); + listen(): void; + close(): Promise; + private setupExpress(router); +} diff --git a/broid-telegram/lib/core/index.d.ts b/broid-telegram/lib/core/index.d.ts new file mode 100644 index 00000000..6485757c --- /dev/null +++ b/broid-telegram/lib/core/index.d.ts @@ -0,0 +1,2 @@ +import { Adapter } from './Adapter'; +export = Adapter; diff --git a/broid-telegram/lib/core/interfaces.d.ts b/broid-telegram/lib/core/interfaces.d.ts new file mode 100644 index 00000000..8cdf62df --- /dev/null +++ b/broid-telegram/lib/core/interfaces.d.ts @@ -0,0 +1,11 @@ +export interface IAdapterHTTPOptions { + host: string; + port: number; +} +export interface IAdapterOptions { + logLevel: string; + http: IAdapterHTTPOptions; + serviceID: string; + token: string; + webhookURL: string; +} diff --git a/broid-telegram/lib/test/Parser.d.ts b/broid-telegram/lib/test/Parser.d.ts new file mode 100644 index 00000000..e69de29b diff --git a/broid-telegram/package.json b/broid-telegram/package.json index f777c132..a8086c8c 100644 --- a/broid-telegram/package.json +++ b/broid-telegram/package.json @@ -26,6 +26,7 @@ "engines": { "node": ">=6.0.0" }, + "types": "./lib/core/index.d.ts", "scripts": { "build": "yarn run clean && yarn run copy && yarn run copy:config && tsc -p tsconfig.json", "clean": "rm -rf lib && rm -rf tsconfig.json && rm -rf tslint.json", diff --git a/broid-twilio/lib/core/Adapter.d.ts b/broid-twilio/lib/core/Adapter.d.ts new file mode 100644 index 00000000..c1df4581 --- /dev/null +++ b/broid-twilio/lib/core/Adapter.d.ts @@ -0,0 +1,30 @@ +/// +import * as Promise from 'bluebird'; +import { Router } from 'express'; +import { Observable } from 'rxjs/Rx'; +import { IAdapterOptions } from './interfaces'; +export declare class Adapter { + private serviceID; + private token; + private tokenSecret; + private connected; + private session; + private parser; + private logLevel; + private username; + private logger; + private emitter; + private router; + private webhookServer; + constructor(obj: IAdapterOptions); + users(): Promise; + channels(): Promise; + serviceId(): string; + serviceName(): string; + getRouter(): Router | null; + connect(): Observable; + disconnect(): Promise; + listen(): Observable; + send(data: object): Promise; + private setupRouter(); +} diff --git a/broid-twilio/lib/core/Parser.d.ts b/broid-twilio/lib/core/Parser.d.ts new file mode 100644 index 00000000..647ac066 --- /dev/null +++ b/broid-twilio/lib/core/Parser.d.ts @@ -0,0 +1,14 @@ +/// +import * as Promise from 'bluebird'; +import { ITwilioWebHookEvent } from './interfaces'; +export declare class Parser { + serviceID: string; + generatorName: string; + private logger; + constructor(serviceName: string, serviceID: string, logLevel: string); + validate(event: any): Promise; + parse(event: any): Promise; + normalize(event: ITwilioWebHookEvent): Promise; + private createIdentifier(); + private createActivityStream(normalized); +} diff --git a/broid-twilio/lib/core/WebHookServer.d.ts b/broid-twilio/lib/core/WebHookServer.d.ts new file mode 100644 index 00000000..ce375f0f --- /dev/null +++ b/broid-twilio/lib/core/WebHookServer.d.ts @@ -0,0 +1,15 @@ +/// +import * as Promise from 'bluebird'; +import * as express from 'express'; +import { IAdapterHTTPOptions } from './interfaces'; +export declare class WebHookServer { + private express; + private logger; + private httpClient; + private host; + private port; + constructor(options: IAdapterHTTPOptions, router: express.Router, logLevel?: string); + listen(): void; + close(): Promise; + private setupExpress(router); +} diff --git a/broid-twilio/lib/core/index.d.ts b/broid-twilio/lib/core/index.d.ts new file mode 100644 index 00000000..6485757c --- /dev/null +++ b/broid-twilio/lib/core/index.d.ts @@ -0,0 +1,2 @@ +import { Adapter } from './Adapter'; +export = Adapter; diff --git a/broid-twilio/lib/core/interfaces.d.ts b/broid-twilio/lib/core/interfaces.d.ts new file mode 100644 index 00000000..80cfeb07 --- /dev/null +++ b/broid-twilio/lib/core/interfaces.d.ts @@ -0,0 +1,29 @@ +export interface IAdapterHTTPOptions { + host: string; + port: number; +} +export interface IAdapterOptions { + logLevel: string; + http: IAdapterHTTPOptions; + serviceID: string; + token: string; + tokenSecret: string; + username: string; +} +export interface ITwilioWebHookEvent { + response: any; + request: any; +} +export interface ITwilioActivityStreamObject { + id: string; + content?: string; + mediaType?: string; + type: string; + url?: string; + attachment?: ITwilioMedia; +} +export interface ITwilioMedia { + mediaType: string; + type: string; + url: string; +} diff --git a/broid-twilio/lib/test/Parser.d.ts b/broid-twilio/lib/test/Parser.d.ts new file mode 100644 index 00000000..e69de29b diff --git a/broid-twilio/package.json b/broid-twilio/package.json index bd081111..ec27e0dc 100644 --- a/broid-twilio/package.json +++ b/broid-twilio/package.json @@ -26,6 +26,7 @@ "engines": { "node": ">=6.0.0" }, + "types": "./lib/core/index.d.ts", "scripts": { "build": "yarn run clean && yarn run copy && yarn run copy:config && tsc -p tsconfig.json", "clean": "rm -rf lib && rm -rf tsconfig.json && rm -rf tslint.json", diff --git a/broid-twitter/lib/core/Adapter.d.ts b/broid-twitter/lib/core/Adapter.d.ts new file mode 100644 index 00000000..8c3ad4df --- /dev/null +++ b/broid-twitter/lib/core/Adapter.d.ts @@ -0,0 +1,32 @@ +import * as Promise from 'bluebird'; +import { Observable } from 'rxjs/Rx'; +import { IAdapterOptions } from './interfaces'; +export declare class Adapter { + private connected; + private serviceID; + private username; + private myid; + private token; + private tokenSecret; + private consumerKey; + private consumerSecret; + private session; + private parser; + private logLevel; + private logger; + private storeUsers; + private sessionGET; + private sessionPOST; + constructor(obj?: IAdapterOptions); + users(): Promise>; + channels(): Promise; + serviceId(): string; + serviceName(): string; + getRouter(): null; + connect(): Observable; + disconnect(): Promise; + listen(): Observable; + send(data: object): Promise; + private userById(key, cache?); + private createMedia(url, altText?); +} diff --git a/broid-twitter/lib/core/Parser.d.ts b/broid-twitter/lib/core/Parser.d.ts new file mode 100644 index 00000000..d9e37055 --- /dev/null +++ b/broid-twitter/lib/core/Parser.d.ts @@ -0,0 +1,13 @@ +import { IActivityStream } from '@broid/schemas'; +import * as Promise from 'bluebird'; +export declare class Parser { + serviceID: string; + generatorName: string; + private logger; + constructor(serviceName: string, serviceID: string, logLevel: string); + validate(event: any): Promise; + parse(event: any): Promise; + normalize(raw: any): Promise; + private createIdentifier(); + private createActivityStream(normalized); +} diff --git a/broid-twitter/lib/core/index.d.ts b/broid-twitter/lib/core/index.d.ts new file mode 100644 index 00000000..6485757c --- /dev/null +++ b/broid-twitter/lib/core/index.d.ts @@ -0,0 +1,2 @@ +import { Adapter } from './Adapter'; +export = Adapter; diff --git a/broid-twitter/lib/core/interfaces.d.ts b/broid-twitter/lib/core/interfaces.d.ts new file mode 100644 index 00000000..dfd3e48c --- /dev/null +++ b/broid-twitter/lib/core/interfaces.d.ts @@ -0,0 +1,17 @@ +export interface IAdapterOptions { + token: string; + tokenSecret: string; + consumerSecret: string; + consumerKey: string; + username: string; + serviceID: string; + logLevel: string; +} +export interface ITwitterSendParameters { + status?: string; + twit_options: object; + text?: string; + screen_name?: string; + user_id?: string; + media_ids?: object[]; +} diff --git a/broid-twitter/lib/test/Parser.d.ts b/broid-twitter/lib/test/Parser.d.ts new file mode 100644 index 00000000..e69de29b diff --git a/broid-twitter/package.json b/broid-twitter/package.json index 1939c4e5..7d1c947c 100644 --- a/broid-twitter/package.json +++ b/broid-twitter/package.json @@ -26,6 +26,7 @@ "engines": { "node": ">=6.0.0" }, + "types": "./lib/core/index.d.ts", "scripts": { "build": "yarn run clean && yarn run copy && yarn run copy:config && tsc -p tsconfig.json", "clean": "rm -rf lib && rm -rf tsconfig.json && rm -rf tslint.json", diff --git a/broid-utils/lib/Logger.d.ts b/broid-utils/lib/Logger.d.ts new file mode 100644 index 00000000..efe1077d --- /dev/null +++ b/broid-utils/lib/Logger.d.ts @@ -0,0 +1,8 @@ +export declare class Logger { + private pino; + constructor(name: string, level: string); + error(...messages: any[]): void; + warning(...messages: any[]): void; + info(...messages: any[]): void; + debug(...messages: any[]): void; +} diff --git a/broid-utils/lib/index.d.ts b/broid-utils/lib/index.d.ts new file mode 100644 index 00000000..3ec6a3f0 --- /dev/null +++ b/broid-utils/lib/index.d.ts @@ -0,0 +1,11 @@ +/// +/// +import * as Promise from 'bluebird'; +import { Logger } from './Logger'; +declare const cleanNulls: any; +declare function capitalizeFirstLetter(str: string): string; +declare const defaults: (arg1: {}, arg0?: any) => (b: T2) => any; +declare const concat: (x0: any[]) => string; +declare function isUrl(url: any): any; +declare function fileInfo(file: any, logger?: Logger): Promise<{}>; +export { capitalizeFirstLetter, cleanNulls, concat, defaults, fileInfo, isUrl, Logger }; diff --git a/broid-utils/lib/index.js b/broid-utils/lib/index.js index 25bc5068..a79e5886 100644 --- a/broid-utils/lib/index.js +++ b/broid-utils/lib/index.js @@ -23,8 +23,7 @@ function isUrl(url) { return validUrl.isWebUri(url); } exports.isUrl = isUrl; -function fileInfo(file) { - const logger = new Logger_1.Logger('fileInfo', 'debug'); +function fileInfo(file, logger) { return Promise.resolve(isUrl(file)) .then((is) => { if (is) { @@ -35,7 +34,9 @@ function fileInfo(file) { }) .then((infos) => R.dissoc('mime', R.assoc('mimetype', infos.mime, infos))) .catch((error) => { - logger.error(error); + if (logger) { + logger.debug(error); + } return { mimetype: '' }; }); } diff --git a/broid-utils/package.json b/broid-utils/package.json index c2eaef0e..432ad4ba 100644 --- a/broid-utils/package.json +++ b/broid-utils/package.json @@ -25,6 +25,7 @@ "engines": { "node": ">=6.0.0" }, + "types": "./lib/core/index.d.ts", "scripts": { "build": "yarn run clean && yarn run copy:config && tsc -p tsconfig.json", "clean": "rm -rf lib && rm -rf tsconfig.json && rm -rf tslint.json", diff --git a/broid-utils/tsconfig.json b/broid-utils/tsconfig.json index c36e8c4f..54080796 100644 --- a/broid-utils/tsconfig.json +++ b/broid-utils/tsconfig.json @@ -1,5 +1,6 @@ { "compilerOptions": { + "declaration": true, "removeComments": true, "preserveConstEnums": true, "moduleResolution": "node", diff --git a/broid-viber/lib/core/Adapter.d.ts b/broid-viber/lib/core/Adapter.d.ts new file mode 100644 index 00000000..6a0208d7 --- /dev/null +++ b/broid-viber/lib/core/Adapter.d.ts @@ -0,0 +1,30 @@ +import * as Promise from 'bluebird'; +import { Router } from 'express'; +import { Observable } from 'rxjs/Rx'; +import { IAdapterOptions } from './interfaces'; +export declare class Adapter { + private avatar; + private connected; + private logger; + private logLevel; + private me; + private parser; + private serviceID; + private session; + private storeUsers; + private token; + private username; + private router; + private webhookServer; + private webhookURL; + constructor(obj: IAdapterOptions); + users(): Promise>; + channels(): Promise; + serviceName(): string; + serviceId(): string; + getRouter(): Router | null; + connect(): Observable; + disconnect(): Promise; + listen(): Observable; + send(data: object): Promise; +} diff --git a/broid-viber/lib/core/Parser.d.ts b/broid-viber/lib/core/Parser.d.ts new file mode 100644 index 00000000..b6e9724d --- /dev/null +++ b/broid-viber/lib/core/Parser.d.ts @@ -0,0 +1,13 @@ +import { IActivityStream } from '@broid/schemas'; +import * as Promise from 'bluebird'; +export declare class Parser { + serviceID: string; + generatorName: string; + private logger; + constructor(serviceName: string, serviceID: string, logLevel: string); + validate(event: any): Promise; + parse(event: any): Promise; + normalize(evt: any): Promise; + private createIdentifier(); + private createActivityStream(normalized); +} diff --git a/broid-viber/lib/core/WebHookServer.d.ts b/broid-viber/lib/core/WebHookServer.d.ts new file mode 100644 index 00000000..6c713aee --- /dev/null +++ b/broid-viber/lib/core/WebHookServer.d.ts @@ -0,0 +1,14 @@ +import * as Promise from 'bluebird'; +import * as express from 'express'; +import { IAdapterHTTPOptions } from './interfaces'; +export declare class WebHookServer { + private express; + private logger; + private httpClient; + private host; + private port; + constructor(options: IAdapterHTTPOptions, router: express.Router, logLevel?: string); + listen(): void; + close(): Promise; + private setupExpress(router); +} diff --git a/broid-viber/lib/core/index.d.ts b/broid-viber/lib/core/index.d.ts new file mode 100644 index 00000000..6485757c --- /dev/null +++ b/broid-viber/lib/core/index.d.ts @@ -0,0 +1,2 @@ +import { Adapter } from './Adapter'; +export = Adapter; diff --git a/broid-viber/lib/core/interfaces.d.ts b/broid-viber/lib/core/interfaces.d.ts new file mode 100644 index 00000000..c3c72a9b --- /dev/null +++ b/broid-viber/lib/core/interfaces.d.ts @@ -0,0 +1,14 @@ +export interface IAdapterHTTPOptions { + host: string; + port: number; +} +export interface IAdapterOptions { + avatar: string; + http: IAdapterHTTPOptions; + logLevel: string; + serviceID: string; + token: string; + tokenSecret: string; + username: string; + webhookURL: string; +} diff --git a/broid-viber/lib/test/Parser.d.ts b/broid-viber/lib/test/Parser.d.ts new file mode 100644 index 00000000..e69de29b diff --git a/broid-viber/package.json b/broid-viber/package.json index e7a33a0f..f87935c7 100644 --- a/broid-viber/package.json +++ b/broid-viber/package.json @@ -26,6 +26,7 @@ "engines": { "node": ">=6.0.0" }, + "types": "./lib/core/index.d.ts", "scripts": { "build": "yarn run clean && yarn run copy && yarn run copy:config && tsc -p tsconfig.json", "clean": "rm -rf lib && rm -rf tsconfig.json && rm -rf tslint.json", diff --git a/broid-wechat/lib/core/Adapter.d.ts b/broid-wechat/lib/core/Adapter.d.ts new file mode 100644 index 00000000..1f7fd9c9 --- /dev/null +++ b/broid-wechat/lib/core/Adapter.d.ts @@ -0,0 +1,31 @@ +/// +/// +import { ISendParameters } from '@broid/schemas'; +import * as Promise from 'bluebird'; +import { Router } from 'express'; +import { Observable } from 'rxjs/Rx'; +import { IAdapterOptions } from './interfaces'; +export declare class Adapter { + serviceID: string; + private appID; + private appSecret; + private client; + private connected; + private emitter; + private logLevel; + private logger; + private parser; + private router; + private webhookServer; + constructor(obj: IAdapterOptions); + serviceId(): string; + serviceName(): string; + connect(): Observable; + disconnect(): Promise; + listen(): Observable; + users(): Promise; + getRouter(): Router | null; + send(data: ISendParameters): Promise; + private uploadFile(url, fType, file); + private setupRouter(); +} diff --git a/broid-wechat/lib/core/Parser.d.ts b/broid-wechat/lib/core/Parser.d.ts new file mode 100644 index 00000000..28d33ff9 --- /dev/null +++ b/broid-wechat/lib/core/Parser.d.ts @@ -0,0 +1,18 @@ +/// +import { IActivityStream } from '@broid/schemas'; +import * as Promise from 'bluebird'; +export declare class Parser { + generatorName: string; + serviceID: string; + private logger; + private userCache; + private wechatClient; + constructor(serviceName: string, wechatClient: any, serviceID: string, logLevel: string); + validate(event: object | null): Promise; + parse(event: object): Promise; + private getUserName(openid); + private createActivityStream(normalized); + private parseImage(normalized); + private parseText(normalized); + private parseMultiMedia(normalized, messageType, mediaType); +} diff --git a/broid-wechat/lib/core/WebHookServer.d.ts b/broid-wechat/lib/core/WebHookServer.d.ts new file mode 100644 index 00000000..84748296 --- /dev/null +++ b/broid-wechat/lib/core/WebHookServer.d.ts @@ -0,0 +1,16 @@ +/// +/// +import * as Promise from 'bluebird'; +import * as express from 'express'; +import { IAdapterHTTPOptions } from './interfaces'; +export declare class WebHookServer { + private express; + private host; + private httpClient; + private logger; + private port; + constructor(options: IAdapterHTTPOptions, router: express.Router, logLevel: string); + listen(): void; + close(): Promise; + private setupExpress(router); +} diff --git a/broid-wechat/lib/core/index.d.ts b/broid-wechat/lib/core/index.d.ts new file mode 100644 index 00000000..6485757c --- /dev/null +++ b/broid-wechat/lib/core/index.d.ts @@ -0,0 +1,2 @@ +import { Adapter } from './Adapter'; +export = Adapter; diff --git a/broid-wechat/lib/core/interfaces.d.ts b/broid-wechat/lib/core/interfaces.d.ts new file mode 100644 index 00000000..d1066d67 --- /dev/null +++ b/broid-wechat/lib/core/interfaces.d.ts @@ -0,0 +1,11 @@ +export interface IAdapterHTTPOptions { + host: string; + port: number; +} +export interface IAdapterOptions { + appID: string; + appSecret: string; + serviceID?: string; + logLevel?: string; + http?: IAdapterHTTPOptions; +} diff --git a/broid-wechat/lib/test/Parser.d.ts b/broid-wechat/lib/test/Parser.d.ts new file mode 100644 index 00000000..e69de29b diff --git a/broid-wechat/package.json b/broid-wechat/package.json index 8f126835..e888ff02 100644 --- a/broid-wechat/package.json +++ b/broid-wechat/package.json @@ -26,6 +26,7 @@ "engines": { "node": ">=6.0.0" }, + "types": "./lib/core/index.d.ts", "scripts": { "build": "yarn run clean && yarn run copy && yarn run copy:config && tsc -p tsconfig.json", "clean": "rm -rf lib && rm -rf tsconfig.json && rm -rf tslint.json",