mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
Added type declarations for node-xmpp-core. (#14958)
This commit is contained in:
parent
2c7960b0c7
commit
9dc918dbf0
97
node-xmpp-core/index.d.ts
vendored
Normal file
97
node-xmpp-core/index.d.ts
vendored
Normal file
@ -0,0 +1,97 @@
|
||||
// Type definitions for node-xmpp-core 5.0
|
||||
// Project: github.com/node-xmpp/node-xmpp/
|
||||
// Definitions by: PJakcson <https://github.com/PJakcson>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
/// <reference types="node" />
|
||||
import {Element} from 'ltx';
|
||||
import {EventEmitter} from 'events';
|
||||
|
||||
// fixme: not ideal
|
||||
export {createElement, Element, escapeXML, escapeXMLText} from 'ltx';
|
||||
|
||||
export declare class Connection extends EventEmitter {
|
||||
constructor(opts?: any);
|
||||
}
|
||||
|
||||
export declare namespace SRV {
|
||||
/**
|
||||
* returns a lazy iterator which can be restarted via connection.connect()
|
||||
*/
|
||||
function connect(opts?: any): any;
|
||||
}
|
||||
|
||||
export declare class Stanza extends Element {
|
||||
from: string;
|
||||
to: string;
|
||||
id: string;
|
||||
type: string;
|
||||
|
||||
constructor(name: string, attrs?: any);
|
||||
}
|
||||
|
||||
/**
|
||||
* JSX compatible API, use this function as pragma
|
||||
* https://facebook.github.io/jsx/
|
||||
* Returns a Stanza if name is presence, message or iq an ltx Element otherwise.
|
||||
*
|
||||
* @param {string} name name of the element
|
||||
* @param {any} attrs attribute key/value pairs
|
||||
* @return {Element} Stanza or Element
|
||||
*/
|
||||
export declare function createStanza(name: string, attrs?: any): Element;
|
||||
|
||||
export declare class IQ extends Stanza {
|
||||
constructor(attrs?: any);
|
||||
}
|
||||
|
||||
export declare class Message extends Stanza {
|
||||
constructor(attrs?: any);
|
||||
}
|
||||
|
||||
export declare class Presence extends Stanza {
|
||||
constructor(attrs?: any);
|
||||
}
|
||||
|
||||
export declare class JID {
|
||||
local: string;
|
||||
domain: string;
|
||||
resource: string;
|
||||
|
||||
constructor(local: string, domain?: string, resource?: string);
|
||||
|
||||
parseJID(jid: string): void;
|
||||
|
||||
toString(unescape?: any): string;
|
||||
|
||||
/**
|
||||
* Convenience method to distinguish users
|
||||
**/
|
||||
bare(): JID;
|
||||
|
||||
/**
|
||||
* Comparison function
|
||||
**/
|
||||
equals(other: JID): boolean;
|
||||
|
||||
/**
|
||||
* http://xmpp.org/rfcs/rfc6122.html#addressing-localpart
|
||||
**/
|
||||
setLocal(local: string, escape?: any): void;
|
||||
|
||||
getLocal(unescape?: any): string;
|
||||
|
||||
/**
|
||||
* http://xmpp.org/rfcs/rfc6122.html#addressing-domain
|
||||
*/
|
||||
setDomain(value: string): void;
|
||||
|
||||
getDomain(): string;
|
||||
|
||||
/**
|
||||
* http://xmpp.org/rfcs/rfc6122.html#addressing-resourcepart
|
||||
*/
|
||||
setResource(value: string): void;
|
||||
|
||||
getResource(): string;
|
||||
}
|
||||
6
node-xmpp-core/node-xmpp-core-tests.ts
Normal file
6
node-xmpp-core/node-xmpp-core-tests.ts
Normal file
@ -0,0 +1,6 @@
|
||||
import {Connection} from './index';
|
||||
|
||||
const con = new Connection();
|
||||
con.on('online', () => {
|
||||
con.eventNames();
|
||||
});
|
||||
22
node-xmpp-core/tsconfig.json
Normal file
22
node-xmpp-core/tsconfig.json
Normal file
@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"node-xmpp-core-tests.ts"
|
||||
]
|
||||
}
|
||||
3
node-xmpp-core/tslint.json
Normal file
3
node-xmpp-core/tslint.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "../tslint.json"
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user