Skip to content
This repository has been archived by the owner on Feb 8, 2020. It is now read-only.

TypeScript declarations #203

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions _tools/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"compilerOptions": {
"removeComments": true,
"preserveConstEnums": true,
"declaration": true,
"moduleResolution": "node",
"target": "es2015",
"module": "commonjs",
Expand Down
26 changes: 26 additions & 0 deletions broid-alexa/lib/core/Adapter.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/// <reference types="bluebird" />
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<Map<string, object> | Error>;
channels(): Promise<Map<string, object> | Error>;
serviceId(): string;
connect(): Observable<object>;
disconnect(): Promise<null>;
listen(): Observable<object>;
send(data: any): Promise<object | Error>;
private setupRouter();
}
11 changes: 11 additions & 0 deletions broid-alexa/lib/core/Parser.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/// <reference types="bluebird" />
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<object | null>;
parse(event: any): Promise<object | null>;
private createActivityStream();
}
16 changes: 16 additions & 0 deletions broid-alexa/lib/core/WebHookServer.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/// <reference types="bluebird" />
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<null>;
private setupExpress(router);
}
2 changes: 2 additions & 0 deletions broid-alexa/lib/core/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import { Adapter } from './Adapter';
export = Adapter;
24 changes: 24 additions & 0 deletions broid-alexa/lib/core/interfaces.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/// <reference types="bluebird" />
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<Map<string, object> | Error>;
channels(): Promise<Map<string, object> | Error>;
connect(): Observable<object>;
disconnect(): Promise<null>;
listen(): Observable<object>;
send(data: any): Promise<object | Error>;
}
Empty file.
Empty file.
1 change: 1 addition & 0 deletions broid-alexa/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]> (https://broid.ai)",
"description": "Convert Alexa messages into Activity Streams 2 with Broid Integration",
Expand Down
4 changes: 2 additions & 2 deletions broid-alexa/src/core/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ export interface IAdapterHTTPOptions {

export interface IAdapterOptions {
http?: IAdapterHTTPOptions;
logLevel: string;
serviceID: string;
logLevel?: string;
serviceID?: string;
}

export interface IAdapter {
Expand Down
30 changes: 30 additions & 0 deletions broid-callr/lib/core/Adapter.d.ts
Original file line number Diff line number Diff line change
@@ -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<Error>;
channels(): Promise<Error>;
serviceName(): string;
serviceId(): string;
getRouter(): Router;
connect(): Observable<object>;
disconnect(): Promise<null>;
listen(): Observable<object>;
send(data: object): Promise<object | Error>;
private setupRouter();
}
14 changes: 14 additions & 0 deletions broid-callr/lib/core/Parser.d.ts
Original file line number Diff line number Diff line change
@@ -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<object>;
parse(event: any): Promise<IActivityStream>;
normalize(event: ICallrWebHookEvent): Promise<any>;
private createIdentifier();
private createActivityStream(normalized);
}
14 changes: 14 additions & 0 deletions broid-callr/lib/core/WebHookServer.d.ts
Original file line number Diff line number Diff line change
@@ -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<null>;
private setupExpress(router);
}
2 changes: 2 additions & 0 deletions broid-callr/lib/core/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import { Adapter } from './Adapter';
export = Adapter;
17 changes: 17 additions & 0 deletions broid-callr/lib/core/interfaces.d.ts
Original file line number Diff line number Diff line change
@@ -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;
}
Empty file.
1 change: 1 addition & 0 deletions broid-callr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]> (https://broid.ai)",
"description": "Convert Callr messages into Activity Streams 2 with Broid Integration",
Expand Down
6 changes: 3 additions & 3 deletions broid-callr/src/core/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
12 changes: 2 additions & 10 deletions broid-callr/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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"

Expand Down
23 changes: 23 additions & 0 deletions broid-discord/lib/core/Adapter.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/// <reference types="bluebird" />
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<any>;
channels(): Promise<any>;
serviceId(): string;
serviceName(): string;
getRouter(): null;
connect(): Observable<any>;
disconnect(): Promise<null>;
listen(): Observable<any>;
send(data: object): Promise<object | Error>;
}
12 changes: 12 additions & 0 deletions broid-discord/lib/core/Parser.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/// <reference types="bluebird" />
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<object | null>;
parse(event: any): Promise<any>;
private parseMedia(media, content);
private createActivityStream(normalized);
}
2 changes: 2 additions & 0 deletions broid-discord/lib/core/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import { Adapter } from './Adapter';
export = Adapter;
17 changes: 17 additions & 0 deletions broid-discord/lib/core/interfaces.d.ts
Original file line number Diff line number Diff line change
@@ -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;
}
Empty file.
1 change: 1 addition & 0 deletions broid-discord/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]> (https://broid.ai)",
"description": "Convert Discord messages into Activity Streams 2 with Broid Integration",
Expand Down
4 changes: 2 additions & 2 deletions broid-discord/src/core/interfaces.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export interface IAdapterOptions {
token: string;
serviceID: string;
logLevel: string;
serviceID?: string;
logLevel?: string;
}

export interface IUserInformations {
Expand Down
12 changes: 2 additions & 10 deletions broid-discord/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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"

Expand Down
26 changes: 26 additions & 0 deletions broid-flowdock/lib/core/Adapter.d.ts
Original file line number Diff line number Diff line change
@@ -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<Map<string, any>>;
channels(): Promise<Map<string, any>>;
serviceId(): string;
serviceName(): string;
getRouter(): null;
connect(): Observable<object>;
disconnect(): Promise<null>;
listen(): Observable<object>;
send(data: any): Promise<object | Error>;
private userByID(userID);
private flowByID(flowID);
}
11 changes: 11 additions & 0 deletions broid-flowdock/lib/core/Parser.d.ts
Original file line number Diff line number Diff line change
@@ -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<object>;
parse(event: any): Promise<any>;
private createIdentifier();
private createActivityStream(normalized);
}
2 changes: 2 additions & 0 deletions broid-flowdock/lib/core/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import { Adapter } from './Adapter';
export = Adapter;
5 changes: 5 additions & 0 deletions broid-flowdock/lib/core/interfaces.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export interface IAdapterOptions {
token: string;
serviceID?: string;
logLevel?: string;
}
Empty file.
Loading