From b19ec6c9649c5bbfffa10e760f5b4d8643f33679 Mon Sep 17 00:00:00 2001 From: Andy Date: Thu, 21 Dec 2017 16:04:59 -0800 Subject: [PATCH] zetapush-js: Provides its own types (#22430) --- notNeededPackages.json | 6 + types/zetapush-js/index.d.ts | 187 ------------------------- types/zetapush-js/tsconfig.json | 23 --- types/zetapush-js/tslint.json | 1 - types/zetapush-js/zetapush-js-tests.ts | 23 --- 5 files changed, 6 insertions(+), 234 deletions(-) delete mode 100644 types/zetapush-js/index.d.ts delete mode 100644 types/zetapush-js/tsconfig.json delete mode 100644 types/zetapush-js/tslint.json delete mode 100644 types/zetapush-js/zetapush-js-tests.ts diff --git a/notNeededPackages.json b/notNeededPackages.json index 76ba44852f..80e3cb27ba 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -972,6 +972,12 @@ "sourceRepoURL": "github.com/node-xmpp/node-xmpp/", "asOfVersion": "1.2.0" }, + { + "libraryName": "zetapush-js", + "typingsPackageName": "zetapush-js", + "sourceRepoURL": "https://github.com/zetapush/zetapush-js", + "asOfVersion": "3.1.2" + }, { "libraryName": "Zone.js", "typingsPackageName": "zone.js", diff --git a/types/zetapush-js/index.d.ts b/types/zetapush-js/index.d.ts deleted file mode 100644 index b6d8d1d9e3..0000000000 --- a/types/zetapush-js/index.d.ts +++ /dev/null @@ -1,187 +0,0 @@ -// Type definitions for zetapush-js 3.1 -// Project: https://github.com/zetapush/zetapush-js -// Definitions by: ghoullier -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -export interface HandshakeFields { - ext: any; -} - -export interface AbstractHandshakeOptions { - authType: string; - sandboxId: string; - deploymentId: string; -} - -export interface CredentialsHandshakeOptions { - authType: string; - deploymentId: string; - login: string; - password: string; -} - -export interface TokenHandshakeOptions { - authType: string; - deploymentId: string; - token: string; -} - -export interface AbstractHandshake { - authType: string; - authVersion: string; - sandboxId: string; - deploymentId: string; - getHandshakeFields(client: Client): HandshakeFields; -} - -export interface CredentialsAuthData { - login: string; - password: string; -} - -export interface CredentialsHandshake extends AbstractHandshake { - login: string; - password: string; - authData: CredentialsAuthData; -} - -export interface TokenAuthData { - token: string; -} - -export interface TokenHandshake extends AbstractHandshake { - token: string; - authData: TokenAuthData; -} - -export type AuthenticationCallback = () => AbstractHandshake; - -export type AsyncMacroServicePublisher = (method: string, parameters: any, hardFail?: boolean, debug?: number) => Promise; - -export type MacroServicePublisher = (method: string, parameters: any, hardFail?: boolean, debug?: number) => void; - -export type ServicePublisher = (method: string, parameters: any) => void; - -export interface Options { - apiUrl?: string; - sandboxId: string; - forceHttps?: boolean; - resource?: string; - transports?: any[]; -} - -export interface ClientOptions extends Options { - authentication(): AbstractHandshake; -} - -export interface WeakClientOptions extends Options { - deploymentId?: string; -} - -export interface Services { - Macro: AsyncMacroService; - Messaging: Service; -} - -export interface Service { - DEFAULT_DEPLOYMENT_ID: string; - $publish: ServicePublisher; -} - -export interface AsyncMacroService { - DEFAULT_DEPLOYMENT_ID: string; - $publish: AsyncMacroServicePublisher; -} - -export interface MacroService { - DEFAULT_DEPLOYMENT_ID: string; - $publish: MacroServicePublisher; -} - -export interface ServiceDeclaration { - Type: Service; - deploymentId?: string; -} - -export interface Token { - token: string; -} - -export interface Credentials { - login: string; - password: string; -} - -export interface ClientHelper { - authentication: AuthenticationCallback; - servers: Promise; - getUniqRequestId(): string; -} - -export type ConnectionStatusHandler = number; - -export namespace Authentication { - function delegating({ token }: TokenAuthData): TokenHandshake; - function simple({ login, password }: CredentialsAuthData): CredentialsHandshake; - function weak({ token }: TokenAuthData): TokenHandshake; -} - -export interface ConnectionStatusListener { - onConnectionBroken(): void; - onConnectionClosed(): void; - onConnectionEstablished(): void; - onConnectionToServerFail(failure: any): void; - onConnectionWillClose(): void; - onFailedHandshake(failure: any): void; - onMessageLost(): void; - onNoServerUrlAvailable(): void; - onSuccessfulHandshake(authentication: any): void; -} - -export class Client { - helper: ClientHelper; - constructor(options: ClientOptions); - addConnectionStatusListener(listener: ConnectionStatusListener): ConnectionStatusHandler; - connect(): void; - createService(declaration: ServiceDeclaration): Service; - createAsyncMacroService(declaration: ServiceDeclaration): AsyncMacroService; - disconnect(): void; - isConnected(): boolean; - getSandboxId(): string; - getResource(): string; - getUserId(): string; - removeConnectionStatusListener(listener: ConnectionStatusHandler): void; - setAuthentication(authentication: AuthenticationCallback): void; - setLogLevel(level: string): void; - setResource(resource: string): void; - unsubscribe(service: Service): void; - // - onConnectionBroken(handler: () => void): void; - onConnectionClosed(handler: () => void): void; - onConnectionEstablished(handler: () => void): void; - onConnectionToServerFail(handler: (failure: any) => void): void; - onConnectionWillClose(handler: () => void): void; - onFailedHandshake(handler: (failure: any) => void): void; - onMessageLost(handler: () => void): void; - onNoServerUrlAvailable(handler: () => void): void; - onSuccessfulHandshake(handler: (authentication: any) => void): void; -} - -export class SmartClient extends Client { - getCredentials(): any; - getSession(): any; - hasCredentials(): boolean; - isStronglyAuthenticated(session?: any): boolean; - isWeaklyAuthenticated(session?: any): boolean; - setCredentials(credentials: any): void; -} -export class WeakClient extends Client { - constructor(options: WeakClientOptions); - getToken(): Token; -} - -export const services: Services; - -export const VERSION: string; - -export as namespace ZetaPush; diff --git a/types/zetapush-js/tsconfig.json b/types/zetapush-js/tsconfig.json deleted file mode 100644 index 3ce2c2d301..0000000000 --- a/types/zetapush-js/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "zetapush-js-tests.ts" - ] -} \ No newline at end of file diff --git a/types/zetapush-js/tslint.json b/types/zetapush-js/tslint.json deleted file mode 100644 index 3db14f85ea..0000000000 --- a/types/zetapush-js/tslint.json +++ /dev/null @@ -1 +0,0 @@ -{ "extends": "dtslint/dt.json" } diff --git a/types/zetapush-js/zetapush-js-tests.ts b/types/zetapush-js/zetapush-js-tests.ts deleted file mode 100644 index 46eb822680..0000000000 --- a/types/zetapush-js/zetapush-js-tests.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { Authentication, Client, WeakClient } from 'zetapush-js'; - -const weak = new WeakClient({ - sandboxId: '' -}); - -weak.onConnectionEstablished(() => { - // onConnectionEstablished; -}); -weak.connect(); - -const client = new Client({ - apiUrl: '', - sandboxId: '', - authentication: () => Authentication.simple({ - login: 'login', - password: 'password' - }) -}); -client.onConnectionEstablished(() => { - // onConnectionEstablished; -}); -client.connect();