diff --git a/_tools/tsconfig.json b/_tools/tsconfig.json index c36e8c4f..29d22c4e 100644 --- a/_tools/tsconfig.json +++ b/_tools/tsconfig.json @@ -1,7 +1,6 @@ { "compilerOptions": { - "removeComments": true, - "preserveConstEnums": true, + "declaration": true, "moduleResolution": "node", "target": "es2015", "module": "commonjs", 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..3ed3fa50 --- /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 eb08a190..db362266 100755 --- a/broid-alexa/package.json +++ b/broid-alexa/package.json @@ -2,6 +2,7 @@ "name": "@broid/alexa", "version": "2.1.0", "main": "lib/core/index.js", + "types": "lib/core/index.d.ts", "license": "AGPL-3.0+", "author": "Broid Team (https://broid.ai)", "description": "Convert Alexa messages into Activity Streams 2 with Broid Integration", diff --git a/broid-alexa/src/core/interfaces.ts b/broid-alexa/src/core/interfaces.ts index a5ca9abd..51401928 100644 --- a/broid-alexa/src/core/interfaces.ts +++ b/broid-alexa/src/core/interfaces.ts @@ -9,8 +9,8 @@ export interface IAdapterHTTPOptions { export interface IAdapterOptions { http?: IAdapterHTTPOptions; - logLevel: string; - serviceID: string; + logLevel?: string; + serviceID?: string; } export interface IAdapter { 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..e1cd65c8 --- /dev/null +++ b/broid-callr/lib/core/interfaces.d.ts @@ -0,0 +1,17 @@ +export interface IAdapterHTTPOptions { + host: string; + port: number; +} +export interface IAdapterOptions { + token: string; + tokenSecret: string; + webhookURL: string; + logLevel?: string; + username?: string; + serviceID?: 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 87a4a7f4..1a0118bd 100644 --- a/broid-callr/package.json +++ b/broid-callr/package.json @@ -2,6 +2,7 @@ "name": "@broid/callr", "version": "2.1.0", "main": "lib/core/index.js", + "types": "lib/core/index.d.ts", "license": "AGPL-3.0+", "author": "Broid Team (https://broid.ai)", "description": "Convert Callr messages into Activity Streams 2 with Broid Integration", diff --git a/broid-callr/src/core/interfaces.ts b/broid-callr/src/core/interfaces.ts index 4143f0cc..f5f74cdd 100644 --- a/broid-callr/src/core/interfaces.ts +++ b/broid-callr/src/core/interfaces.ts @@ -4,12 +4,12 @@ export interface IAdapterHTTPOptions { } export interface IAdapterOptions { - logLevel: string; - serviceID: string; token: string; tokenSecret: string; - username: string; webhookURL: string; + logLevel?: string; + username?: string; + serviceID?: string; http?: IAdapterHTTPOptions; } diff --git a/broid-callr/yarn.lock b/broid-callr/yarn.lock index c771c2be..ecc4d0b9 100644 --- a/broid-callr/yarn.lock +++ b/broid-callr/yarn.lock @@ -21,11 +21,7 @@ request "^2.81.0" valid-url "^1.0.9" -"@types/node@*": - version "8.0.12" - resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.12.tgz#0560c3e8c9e3da0aa07d0b86e0b0a02b5fd29480" - -"@types/node@^7.0.12": +"@types/node@*", "@types/node@^7.0.12": version "7.0.12" resolved "https://registry.yarnpkg.com/@types/node/-/node-7.0.12.tgz#ae5f67a19c15f752148004db07cbbb372e69efc9" @@ -3792,11 +3788,7 @@ uuid@^2.0.1: version "2.0.3" resolved "https://registry.yarnpkg.com/uuid/-/uuid-2.0.3.tgz#67e2e863797215530dff318e5bf9dcebfd47b21a" -uuid@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.0.1.tgz#6544bba2dfda8c1cf17e629a3a305e2bb1fee6c1" - -uuid@^3.1.0: +uuid@^3.0.0, uuid@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.1.0.tgz#3dd3d3e790abc24d7b0d3a034ffababe28ebbc04" 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..8f1fc2b2 --- /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 c83e4a9a..0703b719 100644 --- a/broid-discord/package.json +++ b/broid-discord/package.json @@ -2,6 +2,7 @@ "name": "@broid/discord", "version": "2.2.0", "main": "lib/core/index.js", + "types": "lib/core/index.d.ts", "license": "AGPL-3.0+", "author": "Broid Team (https://broid.ai)", "description": "Convert Discord messages into Activity Streams 2 with Broid Integration", diff --git a/broid-discord/src/core/interfaces.ts b/broid-discord/src/core/interfaces.ts index 03543f12..f2f71d55 100644 --- a/broid-discord/src/core/interfaces.ts +++ b/broid-discord/src/core/interfaces.ts @@ -1,7 +1,7 @@ export interface IAdapterOptions { token: string; - serviceID: string; - logLevel: string; + serviceID?: string; + logLevel?: string; } export interface IUserInformations { diff --git a/broid-discord/yarn.lock b/broid-discord/yarn.lock index 35905ed0..f6009358 100644 --- a/broid-discord/yarn.lock +++ b/broid-discord/yarn.lock @@ -31,11 +31,7 @@ version "3.5.2" resolved "https://registry.yarnpkg.com/@types/bluebird/-/bluebird-3.5.2.tgz#ecf1104217495e50fe0b588d538146cd6f733b89" -"@types/node@*": - version "8.0.12" - resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.12.tgz#0560c3e8c9e3da0aa07d0b86e0b0a02b5fd29480" - -"@types/node@^7.0.12": +"@types/node@*", "@types/node@^7.0.12": version "7.0.12" resolved "https://registry.yarnpkg.com/@types/node/-/node-7.0.12.tgz#ae5f67a19c15f752148004db07cbbb372e69efc9" @@ -3675,11 +3671,7 @@ uuid@^2.0.1: version "2.0.3" resolved "https://registry.yarnpkg.com/uuid/-/uuid-2.0.3.tgz#67e2e863797215530dff318e5bf9dcebfd47b21a" -uuid@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.0.1.tgz#6544bba2dfda8c1cf17e629a3a305e2bb1fee6c1" - -uuid@^3.1.0: +uuid@^3.0.0, uuid@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.1.0.tgz#3dd3d3e790abc24d7b0d3a034ffababe28ebbc04" 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..06a1fa73 --- /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 4ec11f0d..f5b82439 100644 --- a/broid-flowdock/package.json +++ b/broid-flowdock/package.json @@ -2,6 +2,7 @@ "name": "@broid/flowdock", "version": "2.2.0", "main": "lib/core/index.js", + "types": "lib/core/index.d.ts", "license": "AGPL-3.0+", "author": "Broid Team (https://broid.ai)", "description": "Convert Flowdock messages into Activity Streams 2 with Broid Integration", diff --git a/broid-flowdock/src/core/interfaces.ts b/broid-flowdock/src/core/interfaces.ts index bce629ca..5cd016ba 100644 --- a/broid-flowdock/src/core/interfaces.ts +++ b/broid-flowdock/src/core/interfaces.ts @@ -1,5 +1,5 @@ export interface IAdapterOptions { token: string; - serviceID: string; - logLevel: string; + serviceID?: string; + logLevel?: string; } diff --git a/broid-flowdock/yarn.lock b/broid-flowdock/yarn.lock index 1f00a335..689d9a31 100644 --- a/broid-flowdock/yarn.lock +++ b/broid-flowdock/yarn.lock @@ -21,11 +21,7 @@ request "^2.81.0" valid-url "^1.0.9" -"@types/node@*": - version "8.0.12" - resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.12.tgz#0560c3e8c9e3da0aa07d0b86e0b0a02b5fd29480" - -"@types/node@^7.0.12": +"@types/node@*", "@types/node@^7.0.12": version "7.0.12" resolved "https://registry.yarnpkg.com/@types/node/-/node-7.0.12.tgz#ae5f67a19c15f752148004db07cbbb372e69efc9" @@ -3662,11 +3658,7 @@ uuid@^2.0.1: version "2.0.3" resolved "https://registry.yarnpkg.com/uuid/-/uuid-2.0.3.tgz#67e2e863797215530dff318e5bf9dcebfd47b21a" -uuid@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.0.1.tgz#6544bba2dfda8c1cf17e629a3a305e2bb1fee6c1" - -uuid@^3.1.0: +uuid@^3.0.0, uuid@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.1.0.tgz#3dd3d3e790abc24d7b0d3a034ffababe28ebbc04" 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..fb16b27d --- /dev/null +++ b/broid-gitter/lib/core/interfaces.d.ts @@ -0,0 +1,5 @@ +export interface IAdapterOptions { + token: string; + logLevel?: string; + serviceID?: 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 9428b74b..db60012f 100755 --- a/broid-gitter/package.json +++ b/broid-gitter/package.json @@ -2,6 +2,7 @@ "name": "@broid/gitter", "version": "2.2.0", "main": "lib/core/index.js", + "types": "lib/core/index.d.ts", "license": "AGPL-3.0+", "author": "Broid Team (https://broid.ai)", "description": "Convert Gitter messages into Activity Streams 2 with Broid Integration", diff --git a/broid-gitter/src/core/interfaces.ts b/broid-gitter/src/core/interfaces.ts index b80a00f4..55037c7e 100644 --- a/broid-gitter/src/core/interfaces.ts +++ b/broid-gitter/src/core/interfaces.ts @@ -1,5 +1,5 @@ export interface IAdapterOptions { - logLevel: string; - serviceID: string; token: string; + logLevel?: string; + serviceID?: string; } diff --git a/broid-gitter/yarn.lock b/broid-gitter/yarn.lock index b5dca89b..53718b98 100644 --- a/broid-gitter/yarn.lock +++ b/broid-gitter/yarn.lock @@ -53,11 +53,7 @@ request "^2.81.0" valid-url "^1.0.9" -"@types/node@*": - version "8.0.12" - resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.12.tgz#0560c3e8c9e3da0aa07d0b86e0b0a02b5fd29480" - -"@types/node@^7.0.12": +"@types/node@*", "@types/node@^7.0.12": version "7.0.12" resolved "https://registry.yarnpkg.com/@types/node/-/node-7.0.12.tgz#ae5f67a19c15f752148004db07cbbb372e69efc9" @@ -3405,11 +3401,7 @@ uuid@^2.0.1: version "2.0.3" resolved "https://registry.yarnpkg.com/uuid/-/uuid-2.0.3.tgz#67e2e863797215530dff318e5bf9dcebfd47b21a" -uuid@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.0.1.tgz#6544bba2dfda8c1cf17e629a3a305e2bb1fee6c1" - -uuid@^3.1.0: +uuid@^3.0.0, uuid@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.1.0.tgz#3dd3d3e790abc24d7b0d3a034ffababe28ebbc04" 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..fa017927 --- /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 { + token: string; + tokenSecret: string; + logLevel?: string; + http?: IAdapterHTTPOptions; + serviceID?: 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 bb8eaf27..1303e2f8 100755 --- a/broid-google-assistant/package.json +++ b/broid-google-assistant/package.json @@ -2,6 +2,7 @@ "name": "@broid/google-assistant", "version": "2.1.0", "main": "lib/core/index.js", + "types": "lib/core/index.d.ts", "license": "AGPL-3.0+", "author": "Broid Team (https://broid.ai)", "description": "Convert Google Assistant messages into Activity Streams 2 with Broid Integration", diff --git a/broid-google-assistant/src/core/interfaces.ts b/broid-google-assistant/src/core/interfaces.ts index c5284bcc..1d4ec5ea 100644 --- a/broid-google-assistant/src/core/interfaces.ts +++ b/broid-google-assistant/src/core/interfaces.ts @@ -4,10 +4,10 @@ export interface IAdapterHTTPOptions { } export interface IAdapterOptions { - logLevel: string; - http?: IAdapterHTTPOptions; - serviceID: string; token: string; tokenSecret: string; - username: string; + logLevel?: string; + http?: IAdapterHTTPOptions; + serviceID?: string; + username?: string; } diff --git a/broid-google-assistant/yarn.lock b/broid-google-assistant/yarn.lock index 5988d527..db76feae 100644 --- a/broid-google-assistant/yarn.lock +++ b/broid-google-assistant/yarn.lock @@ -63,11 +63,7 @@ version "3.5.2" resolved "https://registry.yarnpkg.com/@types/bluebird/-/bluebird-3.5.2.tgz#ecf1104217495e50fe0b588d538146cd6f733b89" -"@types/node@*": - version "8.0.12" - resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.12.tgz#0560c3e8c9e3da0aa07d0b86e0b0a02b5fd29480" - -"@types/node@^7.0.12": +"@types/node@*", "@types/node@^7.0.12": version "7.0.12" resolved "https://registry.yarnpkg.com/@types/node/-/node-7.0.12.tgz#ae5f67a19c15f752148004db07cbbb372e69efc9" @@ -3626,11 +3622,7 @@ uuid@^2.0.1: version "2.0.3" resolved "https://registry.yarnpkg.com/uuid/-/uuid-2.0.3.tgz#67e2e863797215530dff318e5bf9dcebfd47b21a" -uuid@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.0.1.tgz#6544bba2dfda8c1cf17e629a3a305e2bb1fee6c1" - -uuid@^3.1.0: +uuid@^3.0.0, uuid@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.1.0.tgz#3dd3d3e790abc24d7b0d3a034ffababe28ebbc04" 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..622f0838 --- /dev/null +++ b/broid-groupme/lib/core/interfaces.d.ts @@ -0,0 +1,53 @@ +export interface IAdapterHTTPOptions { + host: string; + port: number; +} +export interface IAdapterOptions { + token: string; + tokenSecret: string; + username: string; + http?: IAdapterHTTPOptions; + logLevel?: string; + serviceID?: 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 eec733c9..062de874 100644 --- a/broid-groupme/package.json +++ b/broid-groupme/package.json @@ -2,6 +2,7 @@ "name": "@broid/groupme", "version": "2.1.0", "main": "lib/core/index.js", + "types": "lib/core/index.d.ts", "license": "AGPL-3.0+", "author": "Broid Team (https://broid.ai)", "description": "Convert GroupMe messages into Activity Streams 2 with Broid Integration", diff --git a/broid-groupme/src/core/interfaces.ts b/broid-groupme/src/core/interfaces.ts index 42fd8445..89b2a86b 100644 --- a/broid-groupme/src/core/interfaces.ts +++ b/broid-groupme/src/core/interfaces.ts @@ -4,12 +4,12 @@ export interface IAdapterHTTPOptions { } export interface IAdapterOptions { - http?: IAdapterHTTPOptions; - logLevel: string; - serviceID: string; token: string; tokenSecret: string; username: string; + http?: IAdapterHTTPOptions; + logLevel?: string; + serviceID?: string; } export interface IAttachment { diff --git a/broid-groupme/yarn.lock b/broid-groupme/yarn.lock index 05b6fe4d..5cbb856d 100644 --- a/broid-groupme/yarn.lock +++ b/broid-groupme/yarn.lock @@ -69,11 +69,7 @@ dependencies: moment "*" -"@types/node@*": - version "8.0.12" - resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.12.tgz#0560c3e8c9e3da0aa07d0b86e0b0a02b5fd29480" - -"@types/node@^7.0.12": +"@types/node@*", "@types/node@^7.0.12": version "7.0.12" resolved "https://registry.yarnpkg.com/@types/node/-/node-7.0.12.tgz#ae5f67a19c15f752148004db07cbbb372e69efc9" @@ -3701,11 +3697,7 @@ uuid@^2.0.1, uuid@^2.0.2: version "2.0.3" resolved "https://registry.yarnpkg.com/uuid/-/uuid-2.0.3.tgz#67e2e863797215530dff318e5bf9dcebfd47b21a" -uuid@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.0.1.tgz#6544bba2dfda8c1cf17e629a3a305e2bb1fee6c1" - -uuid@^3.1.0: +uuid@^3.0.0, uuid@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.1.0.tgz#3dd3d3e790abc24d7b0d3a034ffababe28ebbc04" 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 382ba127..67550afa 100644 --- a/broid-irc/package.json +++ b/broid-irc/package.json @@ -2,6 +2,7 @@ "name": "@broid/irc", "version": "2.2.0", "main": "lib/core/index.js", + "types": "lib/core/index.d.ts", "license": "AGPL-3.0+", "author": "Broid Team (https://broid.ai)", "description": "Convert IRC messages into Activity Streams 2 with Broid Integration", diff --git a/broid-irc/yarn.lock b/broid-irc/yarn.lock index f974853b..64c33479 100644 --- a/broid-irc/yarn.lock +++ b/broid-irc/yarn.lock @@ -3402,11 +3402,7 @@ uuid@^2.0.1: version "2.0.3" resolved "https://registry.yarnpkg.com/uuid/-/uuid-2.0.3.tgz#67e2e863797215530dff318e5bf9dcebfd47b21a" -uuid@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.0.1.tgz#6544bba2dfda8c1cf17e629a3a305e2bb1fee6c1" - -uuid@^3.1.0: +uuid@^3.0.0, uuid@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.1.0.tgz#3dd3d3e790abc24d7b0d3a034ffababe28ebbc04" 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..11a07e25 --- /dev/null +++ b/broid-kik/lib/core/interfaces.d.ts @@ -0,0 +1,12 @@ +export interface IAdapterHTTPOptions { + host: string; + port: number; +} +export interface IAdapterOptions { + token: string; + webhookURL: string; + logLevel?: string; + http?: IAdapterHTTPOptions; + serviceID?: string; + username?: 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 11ea2bbb..bda4f787 100644 --- a/broid-kik/package.json +++ b/broid-kik/package.json @@ -2,6 +2,7 @@ "name": "@broid/kik", "version": "2.2.0", "main": "lib/core/index.js", + "types": "lib/core/index.d.ts", "license": "AGPL-3.0+", "author": "Broid Team (https://broid.ai)", "description": "Convert Kik messages into Activity Streams 2 with Broid Integration", diff --git a/broid-kik/src/core/interfaces.ts b/broid-kik/src/core/interfaces.ts index 88584bc6..1fb23905 100644 --- a/broid-kik/src/core/interfaces.ts +++ b/broid-kik/src/core/interfaces.ts @@ -4,10 +4,10 @@ export interface IAdapterHTTPOptions { } export interface IAdapterOptions { - logLevel: string; - http: IAdapterHTTPOptions; - serviceID: string; token: string; - username: string; webhookURL: string; + logLevel?: string; + http?: IAdapterHTTPOptions; + serviceID?: string; + username?: string; } diff --git a/broid-kik/yarn.lock b/broid-kik/yarn.lock index c95ca2d7..200e7299 100644 --- a/broid-kik/yarn.lock +++ b/broid-kik/yarn.lock @@ -38,11 +38,7 @@ version "3.5.3" resolved "https://registry.yarnpkg.com/@types/bluebird/-/bluebird-3.5.3.tgz#a2c28be02c0855f526e43785fa326f282402e290" -"@types/node@*": - version "8.0.12" - resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.12.tgz#0560c3e8c9e3da0aa07d0b86e0b0a02b5fd29480" - -"@types/node@^7.0.12": +"@types/node@*", "@types/node@^7.0.12": version "7.0.18" resolved "https://registry.yarnpkg.com/@types/node/-/node-7.0.18.tgz#cd67f27d3dc0cfb746f0bdd5e086c4c5d55be173" @@ -3779,11 +3775,7 @@ uuid@^2.0.1: version "2.0.3" resolved "https://registry.yarnpkg.com/uuid/-/uuid-2.0.3.tgz#67e2e863797215530dff318e5bf9dcebfd47b21a" -uuid@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.0.1.tgz#6544bba2dfda8c1cf17e629a3a305e2bb1fee6c1" - -uuid@^3.1.0: +uuid@^3.0.0, uuid@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.1.0.tgz#3dd3d3e790abc24d7b0d3a034ffababe28ebbc04" 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..2080232f --- /dev/null +++ b/broid-line/lib/core/interfaces.d.ts @@ -0,0 +1,16 @@ +export interface IAdapterHTTPOptions { + host: string; + port: number; +} +export interface IAdapterOptions { + token: string; + tokenSecret: string; + username: string; + logLevel?: string; + http?: IAdapterHTTPOptions; + serviceID?: 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 62367918..36f34395 100644 --- a/broid-line/package.json +++ b/broid-line/package.json @@ -2,6 +2,7 @@ "name": "@broid/line", "version": "2.2.0", "main": "lib/core/index.js", + "types": "lib/core/index.d.ts", "license": "AGPL-3.0+", "author": "Broid Team (https://broid.ai)", "description": "Convert Line messages into Activity Streams 2 with Broid Integration", diff --git a/broid-line/src/core/interfaces.ts b/broid-line/src/core/interfaces.ts index d9d8fbb4..17d0d199 100644 --- a/broid-line/src/core/interfaces.ts +++ b/broid-line/src/core/interfaces.ts @@ -4,12 +4,12 @@ export interface IAdapterHTTPOptions { } export interface IAdapterOptions { - logLevel: string; - http: IAdapterHTTPOptions; - serviceID: string; token: string; tokenSecret: string; username: string; + logLevel?: string; + http?: IAdapterHTTPOptions; + serviceID?: string; } export interface IWebHookEvent { diff --git a/broid-line/yarn.lock b/broid-line/yarn.lock index 3e32bc56..7190fdbf 100644 --- a/broid-line/yarn.lock +++ b/broid-line/yarn.lock @@ -31,11 +31,7 @@ version "3.5.2" resolved "https://registry.yarnpkg.com/@types/bluebird/-/bluebird-3.5.2.tgz#ecf1104217495e50fe0b588d538146cd6f733b89" -"@types/node@*": - version "8.0.12" - resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.12.tgz#0560c3e8c9e3da0aa07d0b86e0b0a02b5fd29480" - -"@types/node@^7.0.12": +"@types/node@*", "@types/node@^7.0.12": version "7.0.12" resolved "https://registry.yarnpkg.com/@types/node/-/node-7.0.12.tgz#ae5f67a19c15f752148004db07cbbb372e69efc9" @@ -3759,11 +3755,7 @@ uuid@^2.0.1: version "2.0.3" resolved "https://registry.yarnpkg.com/uuid/-/uuid-2.0.3.tgz#67e2e863797215530dff318e5bf9dcebfd47b21a" -uuid@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.0.1.tgz#6544bba2dfda8c1cf17e629a3a305e2bb1fee6c1" - -uuid@^3.1.0: +uuid@^3.0.0, uuid@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.1.0.tgz#3dd3d3e790abc24d7b0d3a034ffababe28ebbc04" diff --git a/broid-messenger/lib/core/Adapter.d.ts b/broid-messenger/lib/core/Adapter.d.ts new file mode 100644 index 00000000..46b37a8a --- /dev/null +++ b/broid-messenger/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 emitter; + private logLevel; + private logger; + private parser; + private router; + private serviceID; + private storeUsers; + private token; + private tokenSecret; + private consumerSecret; + 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..f96b0fbe --- /dev/null +++ b/broid-messenger/lib/core/helpers.d.ts @@ -0,0 +1,7 @@ +export declare function isXHubSignatureValid(request: any, secret: string): boolean; +export declare function parseQuickReplies(quickReplies: any[]): any[]; +export declare function createQuickReplies(buttons: any[]): any[]; +export declare function createButtons(buttons: any[]): any[]; +export declare function createElement(data: any): any; +export declare function createCard(name: string, content: string, buttons?: any[], imageURL?: any): object; +export declare function createTextWithButtons(name: string, content: string, buttons?: 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..4ef1eb9d --- /dev/null +++ b/broid-messenger/lib/core/interfaces.d.ts @@ -0,0 +1,16 @@ +export interface IAdapterHTTPOptions { + host: string; + port: number; +} +export interface IAdapterOptions { + token: string; + tokenSecret: string; + consumerSecret: string; + logLevel?: string; + http?: IAdapterHTTPOptions; + serviceID?: 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 5015a349..00ac3d93 100644 --- a/broid-messenger/package.json +++ b/broid-messenger/package.json @@ -2,6 +2,7 @@ "name": "@broid/messenger", "version": "2.2.0", "main": "lib/core/index.js", + "types": "lib/core/index.d.ts", "license": "AGPL-3.0+", "author": "Broid Team (https://broid.ai)", "description": "Convert Facebook Messenger messages into Activity Streams 2 with Broid Integration", diff --git a/broid-messenger/src/core/interfaces.ts b/broid-messenger/src/core/interfaces.ts index 8ea9c663..f9df23f9 100644 --- a/broid-messenger/src/core/interfaces.ts +++ b/broid-messenger/src/core/interfaces.ts @@ -4,12 +4,12 @@ export interface IAdapterHTTPOptions { } export interface IAdapterOptions { - logLevel: string; - http: IAdapterHTTPOptions; - serviceID: string; token: string; tokenSecret: string; consumerSecret: string; + logLevel?: string; + http?: IAdapterHTTPOptions; + serviceID?: string; } export interface IWebHookEvent { diff --git a/broid-messenger/yarn.lock b/broid-messenger/yarn.lock index 376cf54b..724630e8 100644 --- a/broid-messenger/yarn.lock +++ b/broid-messenger/yarn.lock @@ -2,9 +2,9 @@ # yarn lockfile v1 -"@broid/schemas@^1.0.1": - version "1.0.1" - resolved "https://registry.yarnpkg.com/@broid/schemas/-/schemas-1.0.1.tgz#3e2a318be8e2789e50730ea37528db19baa71f14" +"@broid/schemas@^1.1.1": + version "1.1.1" + resolved "https://registry.yarnpkg.com/@broid/schemas/-/schemas-1.1.1.tgz#49dad830e1ba979b9dbdb07620141e45dbd16f37" dependencies: ajv "^5.0.1-beta.1" bluebird "^3.4.6" @@ -3836,11 +3836,7 @@ uuid@^2.0.1: version "2.0.3" resolved "https://registry.yarnpkg.com/uuid/-/uuid-2.0.3.tgz#67e2e863797215530dff318e5bf9dcebfd47b21a" -uuid@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.0.1.tgz#6544bba2dfda8c1cf17e629a3a305e2bb1fee6c1" - -uuid@^3.1.0: +uuid@^3.0.0, uuid@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.1.0.tgz#3dd3d3e790abc24d7b0d3a034ffababe28ebbc04" 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..19b176ec --- /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 { + token: string; + tokenSecret: string; + logLevel?: string; + http?: IAdapterHTTPOptions; + serviceID?: 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 0f065cb2..5c410568 100644 --- a/broid-ms-teams/package.json +++ b/broid-ms-teams/package.json @@ -2,6 +2,7 @@ "name": "@broid/ms-teams", "version": "2.1.0", "main": "lib/core/index.js", + "types": "lib/core/index.d.ts", "license": "AGPL-3.0+", "author": "Broid Team (https://broid.ai)", "description": "Convert Microsoft Teams messages into Activity Streams 2 with Broid Integration", diff --git a/broid-ms-teams/src/core/interfaces.ts b/broid-ms-teams/src/core/interfaces.ts index 5d6b05d4..fa3945f7 100644 --- a/broid-ms-teams/src/core/interfaces.ts +++ b/broid-ms-teams/src/core/interfaces.ts @@ -4,9 +4,9 @@ export interface IAdapterHTTPOptions { } export interface IAdapterOptions { - logLevel: string; - http?: IAdapterHTTPOptions; - serviceID: string; token: string; tokenSecret: string; + logLevel?: string; + http?: IAdapterHTTPOptions; + serviceID?: string; } diff --git a/broid-ms-teams/yarn.lock b/broid-ms-teams/yarn.lock index 60f8aee3..523c64c6 100644 --- a/broid-ms-teams/yarn.lock +++ b/broid-ms-teams/yarn.lock @@ -3968,11 +3968,7 @@ uuid@^2.0.1: version "2.0.3" resolved "https://registry.yarnpkg.com/uuid/-/uuid-2.0.3.tgz#67e2e863797215530dff318e5bf9dcebfd47b21a" -uuid@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.0.1.tgz#6544bba2dfda8c1cf17e629a3a305e2bb1fee6c1" - -uuid@^3.1.0: +uuid@^3.0.0, uuid@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.1.0.tgz#3dd3d3e790abc24d7b0d3a034ffababe28ebbc04" 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..06a29a4b --- /dev/null +++ b/broid-nexmo/lib/core/interfaces.d.ts @@ -0,0 +1,12 @@ +export interface IAdapterHTTPOptions { + host: string; + port: number; +} +export interface IAdapterOptions { + token: string; + tokenSecret: string; + username: string; + http?: IAdapterHTTPOptions; + logLevel?: string; + serviceID?: 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 42876b22..21f30c41 100755 --- a/broid-nexmo/package.json +++ b/broid-nexmo/package.json @@ -2,6 +2,7 @@ "name": "@broid/nexmo", "version": "2.1.0", "main": "lib/core/index.js", + "types": "lib/core/index.d.ts", "license": "AGPL-3.0+", "author": "Broid Team (https://broid.ai)", "description": "Convert Nexmo messages into Activity Streams 2 with Broid Integration", diff --git a/broid-nexmo/src/core/interfaces.ts b/broid-nexmo/src/core/interfaces.ts index 381b0a2d..afb9d183 100644 --- a/broid-nexmo/src/core/interfaces.ts +++ b/broid-nexmo/src/core/interfaces.ts @@ -4,10 +4,10 @@ export interface IAdapterHTTPOptions { } export interface IAdapterOptions { - http: IAdapterHTTPOptions; - logLevel: string; - serviceID: string; token: string; tokenSecret: string; username: string; + http?: IAdapterHTTPOptions; + logLevel?: string; + serviceID?: string; } diff --git a/broid-nexmo/yarn.lock b/broid-nexmo/yarn.lock index ec3c2567..2ebfa53a 100644 --- a/broid-nexmo/yarn.lock +++ b/broid-nexmo/yarn.lock @@ -69,11 +69,7 @@ dependencies: moment "*" -"@types/node@*": - version "8.0.12" - resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.12.tgz#0560c3e8c9e3da0aa07d0b86e0b0a02b5fd29480" - -"@types/node@^7.0.12": +"@types/node@*", "@types/node@^7.0.12": version "7.0.12" resolved "https://registry.yarnpkg.com/@types/node/-/node-7.0.12.tgz#ae5f67a19c15f752148004db07cbbb372e69efc9" @@ -3675,11 +3671,7 @@ uuid@^2.0.1, uuid@^2.0.2: version "2.0.3" resolved "https://registry.yarnpkg.com/uuid/-/uuid-2.0.3.tgz#67e2e863797215530dff318e5bf9dcebfd47b21a" -uuid@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.0.1.tgz#6544bba2dfda8c1cf17e629a3a305e2bb1fee6c1" - -uuid@^3.1.0: +uuid@^3.0.0, uuid@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.1.0.tgz#3dd3d3e790abc24d7b0d3a034ffababe28ebbc04" 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 d041f43f..88cede81 100644 --- a/broid-schemas/package.json +++ b/broid-schemas/package.json @@ -2,6 +2,7 @@ "name": "@broid/schemas", "version": "1.1.1", "main": "lib/index.js", + "types": "lib/index.d.ts", "license": "AGPL-3.0+", "author": "Broid Team (https://broid.ai)", "description": "Validate Broid activity streams 2.0 messages", diff --git a/broid-schemas/yarn.lock b/broid-schemas/yarn.lock index 0268e237..e07d0210 100644 --- a/broid-schemas/yarn.lock +++ b/broid-schemas/yarn.lock @@ -12,11 +12,7 @@ version "3.5.2" resolved "https://registry.yarnpkg.com/@types/bluebird/-/bluebird-3.5.2.tgz#ecf1104217495e50fe0b588d538146cd6f733b89" -"@types/node@*": - version "8.0.12" - resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.12.tgz#0560c3e8c9e3da0aa07d0b86e0b0a02b5fd29480" - -"@types/node@^7.0.11": +"@types/node@*", "@types/node@^7.0.11": version "7.0.12" resolved "https://registry.yarnpkg.com/@types/node/-/node-7.0.12.tgz#ae5f67a19c15f752148004db07cbbb372e69efc9" 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..19b176ec --- /dev/null +++ b/broid-skype/lib/core/interfaces.d.ts @@ -0,0 +1,11 @@ +export interface IAdapterHTTPOptions { + host: string; + port: number; +} +export interface IAdapterOptions { + token: string; + tokenSecret: string; + logLevel?: string; + http?: IAdapterHTTPOptions; + serviceID?: 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 918319fc..1cf51453 100644 --- a/broid-skype/package.json +++ b/broid-skype/package.json @@ -2,6 +2,7 @@ "name": "@broid/skype", "version": "2.1.0", "main": "lib/core/index.js", + "types": "lib/core/index.d.ts", "license": "AGPL-3.0+", "author": "Broid Team (https://broid.ai)", "description": "Convert Skype messages into Activity Streams 2 with Broid Integration", diff --git a/broid-skype/src/core/interfaces.ts b/broid-skype/src/core/interfaces.ts index 3093ed80..fa3945f7 100644 --- a/broid-skype/src/core/interfaces.ts +++ b/broid-skype/src/core/interfaces.ts @@ -4,9 +4,9 @@ export interface IAdapterHTTPOptions { } export interface IAdapterOptions { - logLevel: string; - http: IAdapterHTTPOptions; - serviceID: string; token: string; tokenSecret: string; + logLevel?: string; + http?: IAdapterHTTPOptions; + serviceID?: string; } diff --git a/broid-skype/yarn.lock b/broid-skype/yarn.lock index 000337d3..eebea899 100644 --- a/broid-skype/yarn.lock +++ b/broid-skype/yarn.lock @@ -31,11 +31,7 @@ version "3.5.2" resolved "https://registry.yarnpkg.com/@types/bluebird/-/bluebird-3.5.2.tgz#ecf1104217495e50fe0b588d538146cd6f733b89" -"@types/node@*": - version "8.0.12" - resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.12.tgz#0560c3e8c9e3da0aa07d0b86e0b0a02b5fd29480" - -"@types/node@^7.0.12": +"@types/node@*", "@types/node@^7.0.12": version "7.0.12" resolved "https://registry.yarnpkg.com/@types/node/-/node-7.0.12.tgz#ae5f67a19c15f752148004db07cbbb372e69efc9" @@ -3948,11 +3944,7 @@ uuid@^2.0.1: version "2.0.3" resolved "https://registry.yarnpkg.com/uuid/-/uuid-2.0.3.tgz#67e2e863797215530dff318e5bf9dcebfd47b21a" -uuid@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.0.1.tgz#6544bba2dfda8c1cf17e629a3a305e2bb1fee6c1" - -uuid@^3.1.0: +uuid@^3.0.0, uuid@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.1.0.tgz#3dd3d3e790abc24d7b0d3a034ffababe28ebbc04" 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..31fa4052 --- /dev/null +++ b/broid-slack/lib/core/interfaces.d.ts @@ -0,0 +1,128 @@ +export interface IAdapterHTTPOptions { + host: string; + port: number; +} +export interface IAdapterOptions { + token: string; + asUser?: boolean; + logLevel?: string; + http?: IAdapterHTTPOptions; + serviceID?: string; +} +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 5d7ff836..7fc7458b 100644 --- a/broid-slack/package.json +++ b/broid-slack/package.json @@ -2,6 +2,7 @@ "name": "@broid/slack", "version": "2.2.0", "main": "lib/core/index.js", + "types": "lib/core/index.d.ts", "license": "AGPL-3.0+", "author": "Broid Team (https://broid.ai)", "description": "Convert Slack messages into Activity Streams 2 with Broid Integration", diff --git a/broid-slack/src/core/interfaces.ts b/broid-slack/src/core/interfaces.ts index bf9f2a9d..cd6a8f6b 100644 --- a/broid-slack/src/core/interfaces.ts +++ b/broid-slack/src/core/interfaces.ts @@ -4,11 +4,11 @@ export interface IAdapterHTTPOptions { } export interface IAdapterOptions { - logLevel: string; - http: IAdapterHTTPOptions; - serviceID: string; token: string; - asUser: boolean; + asUser?: boolean; + logLevel?: string; + http?: IAdapterHTTPOptions; + serviceID?: string; } export interface IWebHookEvent { diff --git a/broid-slack/yarn.lock b/broid-slack/yarn.lock index abafde89..c74a7410 100644 --- a/broid-slack/yarn.lock +++ b/broid-slack/yarn.lock @@ -38,11 +38,7 @@ winston "^2.1.1" ws "^1.0.1" -"@types/node@*": - version "8.0.12" - resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.12.tgz#0560c3e8c9e3da0aa07d0b86e0b0a02b5fd29480" - -"@types/node@^7.0.12": +"@types/node@*", "@types/node@^7.0.12": version "7.0.12" resolved "https://registry.yarnpkg.com/@types/node/-/node-7.0.12.tgz#ae5f67a19c15f752148004db07cbbb372e69efc9" @@ -3874,11 +3870,7 @@ uuid@^2.0.1: version "2.0.3" resolved "https://registry.yarnpkg.com/uuid/-/uuid-2.0.3.tgz#67e2e863797215530dff318e5bf9dcebfd47b21a" -uuid@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.0.1.tgz#6544bba2dfda8c1cf17e629a3a305e2bb1fee6c1" - -uuid@^3.1.0: +uuid@^3.0.0, uuid@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.1.0.tgz#3dd3d3e790abc24d7b0d3a034ffababe28ebbc04" 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..82bbfe1e --- /dev/null +++ b/broid-telegram/lib/core/interfaces.d.ts @@ -0,0 +1,11 @@ +export interface IAdapterHTTPOptions { + host: string; + port: number; +} +export interface IAdapterOptions { + token: string; + webhookURL: string; + logLevel?: string; + http?: IAdapterHTTPOptions; + serviceID?: 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 4c4e1f30..3010ddc9 100644 --- a/broid-telegram/package.json +++ b/broid-telegram/package.json @@ -2,6 +2,7 @@ "name": "@broid/telegram", "version": "2.1.0", "main": "lib/core/index.js", + "types": "lib/core/index.d.ts", "license": "AGPL-3.0+", "author": "Broid Team (https://broid.ai)", "description": "Convert Telegram messages into Activity Streams 2 with Broid Integration", diff --git a/broid-telegram/src/core/interfaces.ts b/broid-telegram/src/core/interfaces.ts index 0b73dac5..e5829bbc 100644 --- a/broid-telegram/src/core/interfaces.ts +++ b/broid-telegram/src/core/interfaces.ts @@ -4,9 +4,9 @@ export interface IAdapterHTTPOptions { } export interface IAdapterOptions { - logLevel: string; - http: IAdapterHTTPOptions; - serviceID: string; token: string; webhookURL: string; + logLevel?: string; + http?: IAdapterHTTPOptions; + serviceID?: string; } diff --git a/broid-telegram/yarn.lock b/broid-telegram/yarn.lock index 02298e53..5563f575 100644 --- a/broid-telegram/yarn.lock +++ b/broid-telegram/yarn.lock @@ -31,11 +31,7 @@ version "3.5.2" resolved "https://registry.yarnpkg.com/@types/bluebird/-/bluebird-3.5.2.tgz#ecf1104217495e50fe0b588d538146cd6f733b89" -"@types/node@*": - version "8.0.12" - resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.12.tgz#0560c3e8c9e3da0aa07d0b86e0b0a02b5fd29480" - -"@types/node@^7.0.12": +"@types/node@*", "@types/node@^7.0.12": version "7.0.12" resolved "https://registry.yarnpkg.com/@types/node/-/node-7.0.12.tgz#ae5f67a19c15f752148004db07cbbb372e69efc9" @@ -3844,11 +3840,7 @@ uuid@^2.0.1: version "2.0.3" resolved "https://registry.yarnpkg.com/uuid/-/uuid-2.0.3.tgz#67e2e863797215530dff318e5bf9dcebfd47b21a" -uuid@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.0.1.tgz#6544bba2dfda8c1cf17e629a3a305e2bb1fee6c1" - -uuid@^3.1.0: +uuid@^3.0.0, uuid@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.1.0.tgz#3dd3d3e790abc24d7b0d3a034ffababe28ebbc04" 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..77603c8f --- /dev/null +++ b/broid-twilio/lib/core/interfaces.d.ts @@ -0,0 +1,29 @@ +export interface IAdapterHTTPOptions { + host: string; + port: number; +} +export interface IAdapterOptions { + token: string; + tokenSecret: string; + logLevel?: string; + http?: IAdapterHTTPOptions; + serviceID?: 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 c9e0236a..0acdc810 100644 --- a/broid-twilio/package.json +++ b/broid-twilio/package.json @@ -2,6 +2,7 @@ "name": "@broid/twilio", "version": "2.1.0", "main": "lib/core/index.js", + "types": "lib/core/index.d.ts", "license": "AGPL-3.0+", "author": "Broid Team (https://broid.ai)", "description": "Convert Twilio messages into Activity Streams 2 with Broid Integration", diff --git a/broid-twilio/src/core/interfaces.ts b/broid-twilio/src/core/interfaces.ts index 00f4a169..125a606e 100644 --- a/broid-twilio/src/core/interfaces.ts +++ b/broid-twilio/src/core/interfaces.ts @@ -4,12 +4,12 @@ export interface IAdapterHTTPOptions { } export interface IAdapterOptions { - logLevel: string; - http: IAdapterHTTPOptions; - serviceID: string; token: string; tokenSecret: string; - username: string; + logLevel?: string; + http?: IAdapterHTTPOptions; + serviceID?: string; + username?: string; } export interface ITwilioWebHookEvent { diff --git a/broid-twilio/yarn.lock b/broid-twilio/yarn.lock index 886ddaa4..366208b2 100644 --- a/broid-twilio/yarn.lock +++ b/broid-twilio/yarn.lock @@ -31,11 +31,7 @@ version "3.5.2" resolved "https://registry.yarnpkg.com/@types/bluebird/-/bluebird-3.5.2.tgz#ecf1104217495e50fe0b588d538146cd6f733b89" -"@types/node@*": - version "8.0.12" - resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.12.tgz#0560c3e8c9e3da0aa07d0b86e0b0a02b5fd29480" - -"@types/node@^7.0.12": +"@types/node@*", "@types/node@^7.0.12": version "7.0.12" resolved "https://registry.yarnpkg.com/@types/node/-/node-7.0.12.tgz#ae5f67a19c15f752148004db07cbbb372e69efc9" @@ -3943,11 +3939,7 @@ uuid@^2.0.1: version "2.0.3" resolved "https://registry.yarnpkg.com/uuid/-/uuid-2.0.3.tgz#67e2e863797215530dff318e5bf9dcebfd47b21a" -uuid@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.0.1.tgz#6544bba2dfda8c1cf17e629a3a305e2bb1fee6c1" - -uuid@^3.1.0: +uuid@^3.0.0, uuid@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.1.0.tgz#3dd3d3e790abc24d7b0d3a034ffababe28ebbc04" 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..83783557 --- /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 470d9b9e..41c5accc 100644 --- a/broid-twitter/package.json +++ b/broid-twitter/package.json @@ -2,6 +2,7 @@ "name": "@broid/twitter", "version": "2.2.0", "main": "lib/core/index.js", + "types": "lib/core/index.d.ts", "license": "AGPL-3.0+", "author": "Broid Team (https://broid.ai)", "description": "Convert Twitter messages into Activity Streams 2 with Broid Integration", diff --git a/broid-twitter/src/core/interfaces.ts b/broid-twitter/src/core/interfaces.ts index 437fd7dd..86ce8842 100644 --- a/broid-twitter/src/core/interfaces.ts +++ b/broid-twitter/src/core/interfaces.ts @@ -4,8 +4,8 @@ export interface IAdapterOptions { consumerSecret: string; consumerKey: string; username: string; - serviceID: string; - logLevel: string; + serviceID?: string; + logLevel?: string; } export interface ITwitterSendParameters { diff --git a/broid-twitter/yarn.lock b/broid-twitter/yarn.lock index e122c689..7b561b76 100644 --- a/broid-twitter/yarn.lock +++ b/broid-twitter/yarn.lock @@ -21,11 +21,7 @@ request "^2.81.0" valid-url "^1.0.9" -"@types/node@*": - version "8.0.12" - resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.12.tgz#0560c3e8c9e3da0aa07d0b86e0b0a02b5fd29480" - -"@types/node@^7.0.12": +"@types/node@*", "@types/node@^7.0.12": version "7.0.12" resolved "https://registry.yarnpkg.com/@types/node/-/node-7.0.12.tgz#ae5f67a19c15f752148004db07cbbb372e69efc9" @@ -3564,11 +3560,7 @@ uuid@^2.0.1: version "2.0.3" resolved "https://registry.yarnpkg.com/uuid/-/uuid-2.0.3.tgz#67e2e863797215530dff318e5bf9dcebfd47b21a" -uuid@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.0.1.tgz#6544bba2dfda8c1cf17e629a3a305e2bb1fee6c1" - -uuid@^3.1.0: +uuid@^3.0.0, uuid@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.1.0.tgz#3dd3d3e790abc24d7b0d3a034ffababe28ebbc04" 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 8e4034d9..918aeae1 100644 --- a/broid-utils/package.json +++ b/broid-utils/package.json @@ -2,6 +2,7 @@ "name": "@broid/utils", "version": "1.2.0", "main": "lib/index.js", + "types": "lib/index.d.ts", "license": "AGPL-3.0+", "author": "Broid Team (https://broid.ai)", "description": "Broid Utils used in Broid Integrations.", diff --git a/broid-utils/tsconfig.json b/broid-utils/tsconfig.json index c36e8c4f..29d22c4e 100644 --- a/broid-utils/tsconfig.json +++ b/broid-utils/tsconfig.json @@ -1,7 +1,6 @@ { "compilerOptions": { - "removeComments": true, - "preserveConstEnums": true, + "declaration": true, "moduleResolution": "node", "target": "es2015", "module": "commonjs", diff --git a/broid-utils/yarn.lock b/broid-utils/yarn.lock index 39eb980d..39008163 100644 --- a/broid-utils/yarn.lock +++ b/broid-utils/yarn.lock @@ -12,11 +12,7 @@ version "3.5.2" resolved "https://registry.yarnpkg.com/@types/bluebird/-/bluebird-3.5.2.tgz#ecf1104217495e50fe0b588d538146cd6f733b89" -"@types/node@*": - version "8.0.12" - resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.12.tgz#0560c3e8c9e3da0aa07d0b86e0b0a02b5fd29480" - -"@types/node@^7.0.12": +"@types/node@*", "@types/node@^7.0.12": version "7.0.12" resolved "https://registry.yarnpkg.com/@types/node/-/node-7.0.12.tgz#ae5f67a19c15f752148004db07cbbb372e69efc9" 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..7c09b805 --- /dev/null +++ b/broid-viber/lib/core/interfaces.d.ts @@ -0,0 +1,14 @@ +export interface IAdapterHTTPOptions { + host: string; + port: number; +} +export interface IAdapterOptions { + token: string; + tokenSecret: string; + username: string; + webhookURL: string; + avatar: string; + http?: IAdapterHTTPOptions; + logLevel?: string; + serviceID?: 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 e18d4562..9d6137fa 100644 --- a/broid-viber/package.json +++ b/broid-viber/package.json @@ -2,6 +2,7 @@ "name": "@broid/viber", "version": "2.1.0", "main": "lib/core/index.js", + "types": "lib/core/index.d.ts", "license": "AGPL-3.0+", "author": "Broid Team (https://broid.ai)", "description": "Convert Viber messages into Activity Streams 2 with Broid Integration", diff --git a/broid-viber/src/core/interfaces.ts b/broid-viber/src/core/interfaces.ts index 6a4629a9..bcf29dd5 100644 --- a/broid-viber/src/core/interfaces.ts +++ b/broid-viber/src/core/interfaces.ts @@ -4,12 +4,12 @@ export interface IAdapterHTTPOptions { } export interface IAdapterOptions { - avatar: string; - http: IAdapterHTTPOptions; - logLevel: string; - serviceID: string; token: string; tokenSecret: string; username: string; webhookURL: string; + avatar: string; + http?: IAdapterHTTPOptions; + logLevel?: string; + serviceID?: string; } diff --git a/broid-viber/yarn.lock b/broid-viber/yarn.lock index 6e3a8eb0..337273b8 100644 --- a/broid-viber/yarn.lock +++ b/broid-viber/yarn.lock @@ -21,11 +21,7 @@ request "^2.81.0" valid-url "^1.0.9" -"@types/node@*": - version "8.0.12" - resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.12.tgz#0560c3e8c9e3da0aa07d0b86e0b0a02b5fd29480" - -"@types/node@^7.0.12": +"@types/node@*", "@types/node@^7.0.12": version "7.0.12" resolved "https://registry.yarnpkg.com/@types/node/-/node-7.0.12.tgz#ae5f67a19c15f752148004db07cbbb372e69efc9" @@ -3799,11 +3795,7 @@ uuid@^2.0.1: version "2.0.3" resolved "https://registry.yarnpkg.com/uuid/-/uuid-2.0.3.tgz#67e2e863797215530dff318e5bf9dcebfd47b21a" -uuid@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.0.1.tgz#6544bba2dfda8c1cf17e629a3a305e2bb1fee6c1" - -uuid@^3.1.0: +uuid@^3.0.0, uuid@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.1.0.tgz#3dd3d3e790abc24d7b0d3a034ffababe28ebbc04" 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 8223ce1b..76f7c35e 100644 --- a/broid-wechat/package.json +++ b/broid-wechat/package.json @@ -2,6 +2,7 @@ "name": "@broid/wechat", "version": "2.1.0", "main": "lib/core/index.js", + "types": "lib/core/index.d.ts", "license": "AGPL-3.0+", "author": "Broid Team (https://broid.ai)", "description": "Convert WeChat messages into Activity Streams 2 with Broid Integration", diff --git a/broid-wechat/yarn.lock b/broid-wechat/yarn.lock index 7af1722f..1d9db5f6 100644 --- a/broid-wechat/yarn.lock +++ b/broid-wechat/yarn.lock @@ -1169,13 +1169,13 @@ debug-log@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/debug-log/-/debug-log-1.0.1.tgz#2307632d4c04382b8df8a32f70b895046d52745f" -debug@2, debug@2.6.3, debug@^2.1.1, debug@^2.1.3: +debug@2, debug@2.6.3, debug@^2.1.1, debug@^2.1.3, debug@^2.6.0: version "2.6.3" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.3.tgz#0f7eb8c30965ec08c72accfa0130c8b79984141d" dependencies: ms "0.7.2" -debug@2.6.1, debug@^2.2.0, debug@^2.6.0: +debug@2.6.1, debug@^2.2.0: version "2.6.1" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.1.tgz#79855090ba2c4e3115cc7d8769491d58f0491351" dependencies: @@ -3783,11 +3783,7 @@ uuid@^2.0.1: version "2.0.3" resolved "https://registry.yarnpkg.com/uuid/-/uuid-2.0.3.tgz#67e2e863797215530dff318e5bf9dcebfd47b21a" -uuid@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.0.1.tgz#6544bba2dfda8c1cf17e629a3a305e2bb1fee6c1" - -uuid@^3.1.0: +uuid@^3.0.0, uuid@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.1.0.tgz#3dd3d3e790abc24d7b0d3a034ffababe28ebbc04" @@ -3819,9 +3815,9 @@ watch@^1.0.1: exec-sh "^0.2.0" minimist "^1.2.0" -"wechat-api@git+https://git@github.com/node-webot/wechat-api.git#295ad45e199ef93610c4d3a9350de6992a932d8c": - version "1.32.0" - resolved "git+https://git@github.com/node-webot/wechat-api.git#295ad45e199ef93610c4d3a9350de6992a932d8c" +wechat-api@^1.35.0: + version "1.35.1" + resolved "https://registry.yarnpkg.com/wechat-api/-/wechat-api-1.35.1.tgz#cd639bc1729ecb5d80a6ac92064c24d8ed8ee65b" dependencies: formstream ">=1.0.0" urllib "2.21.0"