Merge branch 'master' into node_urlUrl

This commit is contained in:
Flarna
2017-02-19 23:28:58 +01:00
82 changed files with 1823 additions and 500 deletions
+2 -2
View File
@@ -51,8 +51,8 @@ declare module 'angular' {
cloakClassName(name: string): ITranslateProvider;
fallbackLanguage(langKey?: string): string;
fallbackLanguage(langKey?: string[]): string;
instant(translationId: string, interpolateParams?: any, interpolationId?: string): string;
instant(translationId: string[], interpolateParams?: any, interpolationId?: string): { [key: string]: string };
instant(translationId: string, interpolateParams?: any, interpolationId?: string, forceLanguage?: string, sanitizeStrategy?: string): string;
instant(translationId: string[], interpolateParams?: any, interpolationId?: string, forceLanguage?: string, sanitizeStrategy?: string): { [key: string]: string };
isPostCompilingEnabled(): boolean;
preferredLanguage(langKey?: string): string;
proposedLanguage(): string;
+5 -5
View File
@@ -143,7 +143,7 @@ class UrlLocatorTestService implements IUrlLocatorTestService {
private $state: ng.ui.IStateService
) {
$rootScope.$on("$locationChangeSuccess", (event: ng.IAngularEvent) => this.onLocationChangeSuccess(event));
$rootScope.$on('$stateNotFound', (event: ng.IAngularEvent, unfoundState: ng.ui.IUnfoundState, fromState: ng.ui.IState, fromParams: {}) =>
$rootScope.$on('$stateNotFound', (event: ng.IAngularEvent, unfoundState: ng.ui.IUnfoundState, fromState: ng.ui.IState, fromParams: {}) =>
this.onStateNotFound(event, unfoundState, fromState, fromParams));
}
@@ -157,8 +157,8 @@ class UrlLocatorTestService implements IUrlLocatorTestService {
// Note that we do not concern ourselves with what to do if this request fails,
// because if it fails, the web page will be redirected away to the login screen.
this.$http({ url: "/api/me", method: "GET" }).success((user: any) => {
this.currentUser = user;
this.$http({ url: "/api/me", method: "GET" }).then((response: ng.IHttpPromiseCallbackArg<any>) => {
this.currentUser = response.data;
// sync the ui-state with the location in the browser, which effectively
// restarts the state change that was stopped previously
@@ -166,14 +166,14 @@ class UrlLocatorTestService implements IUrlLocatorTestService {
});
}
}
private onStateNotFound(event: ng.IAngularEvent,
unfoundState: ng.ui.IUnfoundState,
fromState: ng.ui.IState,
fromParams: {}) {
var unfoundTo: string = unfoundState.to;
var unfoundToParams: {} = unfoundState.toParams;
var unfoundOptions: ng.ui.IStateOptions = unfoundState.options
var unfoundOptions: ng.ui.IStateOptions = unfoundState.options
}
private stateServiceTest() {
+3 -23
View File
@@ -108,11 +108,6 @@ namespace HttpAndRegularPromiseTests {
}
function someController($scope: SomeControllerScope, $http: ng.IHttpService, $q: ng.IQService) {
$http.get<ExpectedResponse>('http://somewhere/some/resource')
.success((data: ExpectedResponse) => {
$scope.person = data;
});
$http.get<ExpectedResponse>('http://somewhere/some/resource')
.then((response: ng.IHttpPromiseCallbackArg<ExpectedResponse>) => {
// typing lost, so something like
@@ -156,21 +151,6 @@ namespace HttpAndRegularPromiseTests {
$scope.nothing = 'really nothing';
});
}
// Test that we can pass around a type-checked success/error Promise Callback
function anotherController($scope: SomeControllerScope, $http: ng.IHttpService, $q: ng.IQService) {
function buildFooData(): ng.IRequestShortcutConfig {
return {};
}
function doFoo(callback: ng.IHttpPromiseCallback<ExpectedResponse>) {
$http
.get<ExpectedResponse>('/foo', buildFooData())
.success(callback);
};
doFoo((data: any) => console.log(data));
};
}
// Test for AngularJS Syntax
@@ -441,10 +421,10 @@ httpFoo.then((x) => {
x.toFixed();
});
httpFoo.success((data, status, headers, config) => {
const h = headers('test');
httpFoo.then((response: ng.IHttpPromiseCallbackArg<any>) => {
const h = response.headers('test');
h.charAt(0);
const hs = headers();
const hs = response.headers();
hs['content-type'].charAt(1);
});
-12
View File
@@ -1505,18 +1505,6 @@ declare namespace angular {
}
interface IHttpPromise<T> extends IPromise<IHttpPromiseCallbackArg<T>> {
/**
* The $http legacy promise methods success and error have been deprecated. Use the standard then method instead.
* If $httpProvider.useLegacyPromiseExtensions is set to false then these methods will throw $http/legacy error.
* @deprecated
*/
success?(callback: IHttpPromiseCallback<T>): IHttpPromise<T>;
/**
* The $http legacy promise methods success and error have been deprecated. Use the standard then method instead.
* If $httpProvider.useLegacyPromiseExtensions is set to false then these methods will throw $http/legacy error.
* @deprecated
*/
error?(callback: IHttpPromiseCallback<any>): IHttpPromise<T>;
}
// See the jsdoc for transformData() at https://github.com/angular/angular.js/blob/master/src/ng/http.js#L228
+341 -22
View File
@@ -1,6 +1,6 @@
// Type definitions for auth0 v2.3.1
// Type definitions for auth0 2.4
// Project: https://github.com/auth0/node-auth0
// Definitions by: Seth Westphal <https://github.com/westy92>
// Definitions by: Wilson Hobbs <https://github.com/wbhob>, Seth Westphal <https://github.com/westy92>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import * as Promise from 'bluebird';
@@ -10,8 +10,8 @@ export interface ManagementClientOptions {
domain?: string;
}
export type UserMetadata = {};
export type AppMetadata = {};
export interface UserMetadata { }
export interface AppMetadata { }
export interface UserData {
connection: string;
@@ -71,34 +71,353 @@ export interface UpdateUserParameters {
id: string;
}
export class ManagementClient {
constructor(options: ManagementClientOptions);
getUsers(params?: GetUsersData): Promise<User[]>;
getUsers(params?: GetUsersData, cb?: (err: Error, users: User[]) => void): void;
createUser(data: UserData): Promise<User>;
createUser(data: UserData, cb: (err: Error, data: User) => void): void;
updateUser(params: UpdateUserParameters, data: User): Promise<User>;
updateUser(params: UpdateUserParameters, data: User, cb: (err: Error, data: User) => void): void;
updateUserMetadata(params: UpdateUserParameters, data: UserMetadata): Promise<User>;
updateUserMetadata(params: UpdateUserParameters, data: UserMetadata, cb: (err: Error, data: User) => void): void
updateAppMetadata(params: UpdateUserParameters, data: AppMetadata): Promise<User>;
updateAppMetadata(params: UpdateUserParameters, data: AppMetadata, cb: (err: Error, data: User) => void): void
}
export interface AuthenticationClientOptions {
clientId?: string;
domain: string;
}
export interface RequestChangePasswordEmailData {
interface Environment {
name: string;
version: string;
}
export interface ClientInfo {
name: string;
version: string;
dependencies: any[];
environment: Environment[];
}
export interface RequestEmailOptions {
email: string;
authParams: {};
}
export interface RequestSMSOptions {
phone_number: string;
}
export interface VerifyOptions {
username: string;
password: string;
}
export interface DelegationTokenOptions {
id_token: string;
api_type: string;
scope: string;
target: string;
grant_type: string;
}
export interface ResetPasswordOptions {
connection: string;
email: string;
password: string;
}
export interface ResetPasswordEmailOptions {
email: string;
connection: string;
}
export interface ObjectWithId {
id: string;
}
export interface Data {
name?: string;
[propName: string]: any;
}
export interface ClientParams {
client_id: string;
}
export interface DeleteMultifactorParams {
id: string;
provider: string;
}
export interface LinkAccountsParams {
id: string;
provider: string;
user_id: string;
}
export interface LinkAccountsData {
user_id: string;
connection_id: string;
}
export interface Token {
aud: string;
jti: string;
}
export interface StatsParams {
from: string;
to: string;
}
export interface ImportUsersOptions {
connection_id: string;
users: string;
}
export interface UserIdParams {
user_id: string;
}
export interface PasswordChangeTicketParams {
result_url: string;
user_id: string;
email: string;
new_password: string;
}
export interface EmailVerificationTicketOptions {
user_id: string;
result_url: string;
}
export class AuthenticationClient {
constructor(options: AuthenticationClientOptions);
getClientInfo(): ClientInfo;
requestMagicLink(data: RequestEmailOptions): Promise<any>;
requestMagicLink(data: RequestEmailOptions, cb: (err: Error, message: string) => void): void;
requestEmailCode(data: RequestEmailOptions): Promise<any>;
requestEmailCode(data: RequestEmailOptions, cb: (err: Error, message: string) => void): void;
requestSMSCode(data: RequestSMSOptions): Promise<any>;
requestSMSCode(data: RequestSMSOptions, cb: (err: Error, message: string) => void): void;
verifyEmailCode(data: VerifyOptions): Promise<any>;
verifyEmailCode(data: VerifyOptions, cb: (err: Error, message: string) => void): void;
verifySMSCode(data: VerifyOptions): Promise<any>;
verifySMSCode(data: VerifyOptions, cb: (err: Error, message: string) => void): void;
getDelegationToken(data: DelegationTokenOptions): Promise<any>;
getDelegationToken(data: DelegationTokenOptions, cb: (err: Error, message: string) => void): void;
changePassword(data: ResetPasswordOptions): Promise<any>;
changePassword(data: ResetPasswordOptions, cb: (err: Error, message: string) => void): void;
requestChangePasswordEmail(data: ResetPasswordEmailOptions): Promise<any>;
requestChangePasswordEmail(data: ResetPasswordEmailOptions, cb: (err: Error, message: string) => void): void;
getProfile(accessToken: string): Promise<any>;
getProfile(accessToken: string, cb: (err: Error, message: string) => void): void;
getCredentialsGrant(scope: string): Promise<any>;
getCredentialsGrant(scope: string, cb: (err: Error, message: string) => void): void;
}
export class ManagementClient {
constructor(options: ManagementClientOptions);
getClientInfo(): ClientInfo;
// Connections
getConnections(): Promise<User>;
getConnections(cb: (err: Error, data: any) => void): void;
createConnection(data: ObjectWithId): Promise<User>;
createConnection(data: ObjectWithId, cb: (err: Error, data: any) => void): void;
getConnection(params: ObjectWithId, cb: (err: Error, data: any) => void): void;
getConnection(params: ObjectWithId): Promise<User>;
deleteConnection(params: ObjectWithId, cb: (err: Error, data: any) => void): void;
deleteConnection(params: ObjectWithId): Promise<User>;
deleteConnection(params: ObjectWithId, cb: (err: Error, data: any) => void): void;
deleteConnection(params: ObjectWithId): Promise<User>;
updateConnection(params: ObjectWithId, data: Data, cb: (err: Error, data: any) => void): void;
updateConnection(params: ObjectWithId, data: Data): Promise<User>;
// Clients
getClients(): Promise<User>;
getClients(cb: (err: Error, data: any) => void): void;
getClient(params: ClientParams): Promise<User>;
getClient(params: ClientParams, cb: (err: Error, data: any) => void): void;
createClient(data: Data): Promise<User>;
createClient(data: Data, cb: (err: Error, data: any) => void): void;
updateClient(params: ClientParams, data: Data): Promise<User>;
updateClient(params: ClientParams, data: Data, cb: (err: Error, data: any) => void): void;
deleteClient(params: ClientParams): Promise<User>;
deleteClient(params: ClientParams, cb: (err: Error, data: any) => void): void;
// Client Grants
getClientGrants(): Promise<User>;
getClientGrants(cb: (err: Error, data: any) => void): void;
createClientGrant(data: Data): Promise<User>;
createClientGrant(data: Data, cb: (err: Error, data: any) => void): void;
updateClientGrant(params: ObjectWithId, data: Data): Promise<User>;
updateClientGrant(params: ObjectWithId, data: Data, cb: (err: Error, data: any) => void): void;
deleteClientGrant(params: ObjectWithId): Promise<User>;
deleteClientGrant(params: ObjectWithId, cb: (err: Error, data: any) => void): void;
// Device Keys
getDeviceCredentials(): Promise<User>;
getDeviceCredentials(cb: (err: Error, data: any) => void): void;
createDevicePublicKey(data: Data): Promise<User>;
createDevicePublicKey(data: Data, cb: (err: Error, data: any) => void): void;
deleteDeviceCredential(params: ClientParams): Promise<User>;
deleteDeviceCredential(params: ClientParams, cb: (err: Error, data: any) => void): void;
// Rules
getRules(): Promise<User>;
getRules(cb: (err: Error, data: any) => void): void;
getRule(params: ClientParams): Promise<User>;
getRule(params: ClientParams, cb: (err: Error, data: any) => void): void;
createRules(data: Data): Promise<User>;
createRules(data: Data, cb: (err: Error, data: any) => void): void;
updateRule(params: ObjectWithId, data: Data): Promise<User>;
updateRule(params: ObjectWithId, data: Data, cb: (err: Error, data: any) => void): void;
deleteRule(params: ObjectWithId): Promise<User>;
deleteRule(params: ObjectWithId, cb: (err: Error, data: any) => void): void;
// Users
getUsers(params?: GetUsersData): Promise<User[]>;
getUsers(params?: GetUsersData, cb?: (err: Error, users: User[]) => void): void;
getUser(params?: ObjectWithId): Promise<User[]>;
getUser(params?: ObjectWithId, cb?: (err: Error, users: User[]) => void): void;
createUser(data: UserData): Promise<User>;
createUser(data: UserData, cb: (err: Error, data: User) => void): void;
updateUser(params: UpdateUserParameters, data: User): Promise<User>;
updateUser(params: UpdateUserParameters, data: User, cb: (err: Error, data: User) => void): void;
updateUserMetadata(params: UpdateUserParameters, data: UserMetadata): Promise<User>;
updateUserMetadata(params: UpdateUserParameters, data: UserMetadata, cb: (err: Error, data: User) => void): void;
deleteAllUsers(): Promise<User>;
deleteAllUsers(cb: (err: Error, data: any) => void): void;
deleteUser(params?: ObjectWithId): Promise<any>;
deleteUser(params?: ObjectWithId, cb?: (err: Error, users: User[]) => void): void;
updateAppMetadata(params: UpdateUserParameters, data: AppMetadata): Promise<User>;
updateAppMetadata(params: UpdateUserParameters, data: AppMetadata, cb: (err: Error, data: User) => void): void;
deleteUserMultifactor(params: DeleteMultifactorParams): Promise<any>;
deleteUserMultifactor(params: DeleteMultifactorParams, cb: (err: Error, data: any) => void): void;
unlinkUsers(params: LinkAccountsParams): Promise<any>;
unlinkUsers(params: LinkAccountsParams, cb: (err: Error, data: any) => void): void;
linkUsers(params: ObjectWithId, data: LinkAccountsData): Promise<any>;
linkUsers(params: ObjectWithId, data: LinkAccountsData, cb: (err: Error, data: any) => void): void;
// Tokens
getBlacklistedTokens(): Promise<any>;
getBlacklistedTokens(cb?: (err: Error, data: any) => void): void;
blacklistToken(token: Token): Promise<any>;
blacklistToken(token: Token, cb: (err: Error, data: any) => void): void;
// Providers
getEmailProvider(): Promise<any>;
getEmailProvider(cb?: (err: Error, data: any) => void): void;
configureEmailProvider(data: Data): Promise<any>;
configureEmailProvider(data: Data, cb: (err: Error, data: any) => void): void;
deleteEmailProvider(): Promise<any>;
deleteEmailProvider(cb?: (err: Error, data: any) => void): void;
updateEmailProvider(data: Data): Promise<any>;
updateEmailProvider(data: Data, cb?: (err: Error, data: any) => void): void;
// Statistics
getActiveUsersCount(): Promise<any>;
getActiveUsersCount(cb?: (err: Error, data: any) => void): void;
getDailyStats(data: StatsParams): Promise<any>;
getDailyStats(data: StatsParams, cb: (err: Error, data: any) => void): void;
// Tenant
getTenantSettings(): Promise<any>;
getTenantSettings(cb?: (err: Error, data: any) => void): void;
updateTenantSettings(data: Data): Promise<any>;
updateTenantSettings(data: Data, cb?: (err: Error, data: any) => void): void;
// Jobs
getJob(params: ObjectWithId): Promise<any>;
getJob(params: ObjectWithId, cb?: (err: Error, data: any) => void): void;
importUsers(data: ImportUsersOptions): Promise<any>;
importUsers(data: ImportUsersOptions, cb?: (err: Error, data: any) => void): void;
sendEmailVerification(data: UserIdParams): Promise<any>;
sendEmailVerification(data: UserIdParams, cb?: (err: Error, data: any) => void): void;
// Tickets
createPasswordChangeTicket(params: PasswordChangeTicketParams): Promise<any>;
createPasswordChangeTicket(params: PasswordChangeTicketParams, cb?: (err: Error, data: any) => void): void;
createEmailVerificationTicket(data: EmailVerificationTicketOptions): Promise<any>;
createEmailVerificationTicket(data: EmailVerificationTicketOptions, cb?: (err: Error, data: any) => void): void;
// Logs
getLog(params: ObjectWithId): Promise<any>;
getLog(params: ObjectWithId, cb?: (err: Error, data: any) => void): void;
getLogs(): Promise<any>;
getLogs(cb?: (err: Error, data: any) => void): void;
// Resource Server
createResourceServer(data: Data): Promise<any>;
createResourceServer(data: Data, cb?: (err: Error, data: any) => void): void;
getResourceServers(): Promise<any>;
getResourceServers(cb?: (err: Error, data: any) => void): void;
getResourceServer(data: ObjectWithId): Promise<any>;
getResourceServer(data: ObjectWithId, cb?: (err: Error, data: any) => void): void;
deleteResourceServer(params: ObjectWithId): Promise<any>;
deleteResourceServer(params: ObjectWithId, cb?: (err: Error, data: any) => void): void;
updateResourceServer(params: ObjectWithId, data: Data): Promise<any>;
updateResourceServer(params: ObjectWithId, data: Data, cb?: (err: Error, data: any) => void): void;
requestChangePasswordEmail(data: RequestChangePasswordEmailData): Promise<string>;
requestChangePasswordEmail(data: RequestChangePasswordEmailData, cb: (err: Error, message: string) => void): void;
}
+74 -9
View File
@@ -1,6 +1,6 @@
// Type definitions for body-parser
// Project: http://expressjs.com
// Definitions by: Santi Albo <https://github.com/santialbo/>, VILIC VANE <https://vilic.info>, Jonathan Häberle <https://github.com/dreampulse/>
// Definitions by: Santi Albo <https://github.com/santialbo/>, VILIC VANE <https://vilic.info>, Jonathan Häberle <https://github.com/dreampulse/>, Gevik Babakhani <https://github.com/blendsdk/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -41,7 +41,14 @@ declare function bodyParser(options?: {
}): express.RequestHandler;
declare namespace bodyParser {
export function json(options?: {
/**
* Interface for defining the options for the json() middleware
*
* @export
* @interface JsonOptions
*/
export interface JsonOptions {
/**
* if deflated bodies will be inflated. (default: true)
*/
@@ -66,9 +73,15 @@ declare namespace bodyParser {
* passed to JSON.parse().
*/
reviver?: (key: string, value: any) => any;
}): express.RequestHandler;
}
export function raw(options?: {
/**
* Interface for defining the options the raw() middleware
*
* @export
* @interface RawOptions
*/
export interface RawOptions {
/**
* if deflated bodies will be inflated. (default: true)
*/
@@ -85,9 +98,15 @@ declare namespace bodyParser {
* function to verify body content, the parsing can be aborted by throwing an error.
*/
verify?: (req: express.Request, res: express.Response, buf: Buffer, encoding: string) => void;
}): express.RequestHandler;
}
export function text(options?: {
/**
* Interface for defining the options for the text() middleware
*
* @export
* @interface TextOptions
*/
export interface TextOptions {
/**
* if deflated bodies will be inflated. (default: true)
*/
@@ -108,9 +127,15 @@ declare namespace bodyParser {
* the default charset to parse as, if not specified in content-type. (default: 'utf-8')
*/
defaultCharset?: string;
}): express.RequestHandler;
}
export function urlencoded(options: {
/**
* Interface for defining the options for the urlencoded() middleware
*
* @export
* @interface UrlEncodedOptions
*/
export interface UrlEncodedOptions {
/**
* if deflated bodies will be inflated. (default: true)
*/
@@ -131,7 +156,47 @@ declare namespace bodyParser {
* parse extended syntax with the qs module.
*/
extended: boolean;
}): express.RequestHandler;
}
/**
* Returns middleware that only parses json. This parser accepts any Unicode encoding
* of the body and supports automatic inflation of gzip and deflate encodings.
*
* @export
* @param {JsonOptions} [options]
* @returns {express.RequestHandler}
*/
export function json(options?: JsonOptions): express.RequestHandler;
/**
* Returns middleware that parses all bodies as a Buffer. This parser supports automatic
* inflation of gzip and deflate encodings.
*
* @export
* @param {RawOptions} [options]
* @returns {express.RequestHandler}
*/
export function raw(options?: RawOptions): express.RequestHandler;
/**
* Returns middleware that parses all bodies as a string. This parser supports
* automatic inflation of gzip and deflate encodings.
*
* @export
* @param {TextOptions} [options]
* @returns {express.RequestHandler}
*/
export function text(options?: TextOptions): express.RequestHandler;
/**
* Returns middleware that only parses urlencoded bodies. This parser accepts only
* UTF-8 encoding of the body and supports automatic inflation of gzip and deflate encodings.
*
* @export
* @param {UrlEncodedOptions} [options]
* @returns {express.RequestHandler}
*/
export function urlencoded(options?: UrlEncodedOptions): express.RequestHandler;
}
export = bodyParser;
+1
View File
@@ -358,6 +358,7 @@ declare namespace Chai {
sameMembers(set1: any[], set2: any[], msg?: string): void;
sameDeepMembers(set1: any[], set2: any[], msg?: string): void;
includeMembers(superset: any[], subset: any[], msg?: string): void;
includeDeepMembers(superset: any[], subset: any[], msg?: string): void;
ifError(val: any, msg?: string): void;
+1
View File
@@ -103,6 +103,7 @@ declare namespace Chart {
animation?: ChartAnimationOptions;
elements?: ChartElementsOptions;
scales?: ChartScales;
cutoutPercentage?: number;
}
export interface ChartFontOptions {
+112 -150
View File
@@ -25,7 +25,6 @@ class NumCoercible {
}
}
class MixedObject {
public num: number;
@@ -40,18 +39,23 @@ class MixedObject {
this.date = date;
}
}
let num: number;
let str: string;
let numeric: NumCoercible;
let date: Date;
let extentNum: [number, number];
let extentStr: [string, string];
let extentNumeric: [NumCoercible, NumCoercible];
let extentDateMixed: [d3Array.Primitive, d3Array.Primitive];
let extentMixed: [d3Array.Primitive | NumCoercible, d3Array.Primitive | NumCoercible];
let extentDate: [Date, Date];
let numOrUndefined: number | undefined;
let strOrUndefined: string | undefined;
let numericOrUndefined: NumCoercible | undefined;
let dateOrUndefined: Date | undefined;
let numOrUndefinedExtent: [number, number] | [undefined, undefined];
let strOrUndefinedExtent: [string, string] | [undefined, undefined];
let numericOrUndefinedExtent: [NumCoercible, NumCoercible] | [undefined, undefined];
let dateMixedOrUndefined: [Date , Date] | [undefined, undefined];
let mixedOrUndefinedExtent: [d3Array.Primitive | NumCoercible, d3Array.Primitive | NumCoercible] | [undefined, undefined];
let dateOrUndefinedExtent: [Date, Date] | [undefined, undefined];
let numbersArray = [10, 20, 30, 40, 50];
let numbersOrUndefinedArray = [10, 20, undefined, null, 40, 50];
let stringyNumbersArray = ['10', '20', '30', '40', '50'];
let numericArray = [new NumCoercible(10), new NumCoercible(20), new NumCoercible(30), new NumCoercible(40), new NumCoercible(50)];
let dateArray = [new Date(2016, 6, 1), new Date(2016, 7, 30), new Date(2015, 3, 15)];
@@ -62,7 +66,31 @@ let mixedObjectArray = [
new MixedObject(40, new Date(2014, 3, 15)),
new MixedObject(50, new Date(2017, 4, 15))
];
let mixedObjectOrUndefinedArray = [...mixedObjectArray, undefined]
function accessorMixedObjectToNum(datum: MixedObject, index: number, array: Array<MixedObject>): number {
return datum.num;
}
function accessorMixedObjectToStr(datum: MixedObject, index: number, array: Array<MixedObject>): string {
return datum.str;
}
function accessorMixedObjectToNumeric(datum: MixedObject, index: number, array: Array<MixedObject>): NumCoercible {
return datum.numeric;
}
function accessorMixedObjectToDate(datum: MixedObject, index: number, array: Array<MixedObject>): Date {
return datum.date;
}
function accessorMixedObjectToNumOrUndefined(datum: MixedObject | undefined, index: number, array: Array<MixedObject | undefined>): number | undefined | null {
return datum ? datum.num : undefined;
}
function accessorMixedObjectToStrOrUndefined(datum: MixedObject | undefined, index: number, array: Array<MixedObject>): string | undefined | null {
return datum ? datum.str : undefined;
}
// -----------------------------------------------------------------------------
// Test Statistics
@@ -72,186 +100,109 @@ let mixedObjectArray = [
// without accessors
num = d3Array.max(numbersArray);
str = d3Array.max(stringyNumbersArray);
numeric = d3Array.max(numericArray);
date = d3Array.max(dateArray);
numOrUndefined = d3Array.max(numbersArray);
strOrUndefined = d3Array.max(stringyNumbersArray);
numericOrUndefined = d3Array.max(numericArray);
dateOrUndefined = d3Array.max(dateArray);
// with accessors
num = d3Array.max(mixedObjectArray, function (datum, index, array) {
let d: MixedObject = datum;
let i: number = index;
let arr: Array<MixedObject> = array;
return datum.num;
});
str = d3Array.max(mixedObjectArray, function (datum, index, array) {
let d: MixedObject = datum;
let i: number = index;
let arr: Array<MixedObject> = array;
return datum.str;
});
numeric = d3Array.max(mixedObjectArray, function (datum, index, array) {
let d: MixedObject = datum;
let i: number = index;
let arr: Array<MixedObject> = array;
return datum.numeric;
});
date = d3Array.max(mixedObjectArray, function (datum, index, array) {
let d: MixedObject = datum;
let i: number = index;
let arr: Array<MixedObject> = array;
return datum.date;
});
numOrUndefined = d3Array.max(mixedObjectArray, accessorMixedObjectToNum);
strOrUndefined = d3Array.max(mixedObjectArray, accessorMixedObjectToStr);
numericOrUndefined = d3Array.max(mixedObjectArray, accessorMixedObjectToNumeric);
dateOrUndefined = d3Array.max(mixedObjectArray, accessorMixedObjectToDate);
numOrUndefined = d3Array.max(mixedObjectArray, accessorMixedObjectToNumOrUndefined);
strOrUndefined = d3Array.max(mixedObjectArray, accessorMixedObjectToStrOrUndefined);
// min() -----------------------------------------------------------------------
// without accessors
num = d3Array.min(numbersArray);
str = d3Array.min(stringyNumbersArray);
numeric = d3Array.min(numericArray);
date = d3Array.min(dateArray);
numOrUndefined = d3Array.min(numbersArray);
strOrUndefined = d3Array.min(stringyNumbersArray);
numericOrUndefined = d3Array.min(numericArray);
dateOrUndefined = d3Array.min(dateArray);
// with accessors
num = d3Array.min(mixedObjectArray, function (datum, index, array) {
let d: MixedObject = datum;
let i: number = index;
let arr: Array<MixedObject> = array;
return datum.num;
});
str = d3Array.min(mixedObjectArray, function (datum, index, array) {
let d: MixedObject = datum;
let i: number = index;
let arr: Array<MixedObject> = array;
return datum.str;
});
numeric = d3Array.min(mixedObjectArray, function (datum, index, array) {
let d: MixedObject = datum;
let i: number = index;
let arr: Array<MixedObject> = array;
return datum.numeric;
});
date = d3Array.min(mixedObjectArray, function (datum, index, array) {
let d: MixedObject = datum;
let i: number = index;
let arr: Array<MixedObject> = array;
return datum.date;
});
numOrUndefined = d3Array.min(mixedObjectArray, accessorMixedObjectToNum);
strOrUndefined = d3Array.min(mixedObjectArray, accessorMixedObjectToStr);
numericOrUndefined = d3Array.min(mixedObjectArray, accessorMixedObjectToNumeric);
dateOrUndefined = d3Array.min(mixedObjectArray, accessorMixedObjectToDate);
numOrUndefined = d3Array.min(mixedObjectArray, accessorMixedObjectToNumOrUndefined);
strOrUndefined = d3Array.min(mixedObjectArray, accessorMixedObjectToStrOrUndefined);
// extent() --------------------------------------------------------------------
// without accessors
extentNum = d3Array.extent(numbersArray);
extentStr = d3Array.extent(stringyNumbersArray);
extentNumeric = d3Array.extent(numericArray);
extentDate = d3Array.extent(dateArray);
extentMixed = d3Array.extent<NumCoercible>([new NumCoercible(10), 13, '12', true]);
numOrUndefinedExtent = d3Array.extent(numbersArray);
strOrUndefinedExtent = d3Array.extent(stringyNumbersArray);
numericOrUndefinedExtent = d3Array.extent(numericArray);
dateOrUndefinedExtent = d3Array.extent(dateArray);
// with accessors
extentNum = d3Array.extent(mixedObjectArray, function (datum, index, array) {
let d: MixedObject = datum;
let i: number = index;
let arr: Array<MixedObject> = array;
return datum.num;
});
extentStr = d3Array.extent(mixedObjectArray, function (datum, index, array) {
let d: MixedObject = datum;
let i: number = index;
let arr: Array<MixedObject> = array;
return datum.str;
});
extentMixed = d3Array.extent(mixedObjectArray, function (datum, index, array) {
let d: MixedObject = datum;
let i: number = index;
let arr: Array<MixedObject> = array;
return datum.numeric;
});
extentDateMixed = d3Array.extent(mixedObjectArray, function (datum, index, array) {
let d: MixedObject = datum;
let i: number = index;
let arr: Array<MixedObject> = array;
return datum.date;
});
numOrUndefinedExtent = d3Array.extent(mixedObjectArray, accessorMixedObjectToNum);
strOrUndefinedExtent = d3Array.extent(mixedObjectArray, accessorMixedObjectToStr);
mixedOrUndefinedExtent = d3Array.extent(mixedObjectArray, accessorMixedObjectToNumeric);
dateMixedOrUndefined = d3Array.extent(mixedObjectArray, accessorMixedObjectToDate);
numOrUndefinedExtent = d3Array.extent(mixedObjectArray, accessorMixedObjectToNumOrUndefined);
strOrUndefinedExtent = d3Array.extent(mixedObjectArray, accessorMixedObjectToStrOrUndefined);
// mean() ----------------------------------------------------------------------
num = d3Array.mean(numbersArray);
numOrUndefined = d3Array.mean(numbersArray);
numOrUndefined = d3Array.mean(numericArray);
numOrUndefined = d3Array.mean(numbersOrUndefinedArray);
num = d3Array.mean(mixedObjectArray, function (datum, index, array) {
let d: MixedObject = datum;
let i: number = index;
let arr: Array<MixedObject> = array;
return datum.num;
});
numOrUndefined = d3Array.mean(mixedObjectArray, accessorMixedObjectToNum);
numOrUndefined = d3Array.mean(mixedObjectOrUndefinedArray, accessorMixedObjectToNumOrUndefined);
// median() --------------------------------------------------------------------
num = d3Array.median(numbersArray);
numOrUndefined = d3Array.median(numbersArray);
numOrUndefined = d3Array.median(numericArray);
numOrUndefined = d3Array.median(numbersOrUndefinedArray);
num = d3Array.median(mixedObjectArray, function (datum, index, array) {
let d: MixedObject = datum;
let i: number = index;
let arr: Array<MixedObject> = array;
return datum.num;
});
numOrUndefined = d3Array.median(mixedObjectArray, accessorMixedObjectToNum);
numOrUndefined = d3Array.median(mixedObjectOrUndefinedArray, accessorMixedObjectToNumOrUndefined);
// quantile() ------------------------------------------------------------------
num = d3Array.quantile(numbersArray, 0.5);
numOrUndefined = d3Array.quantile(numbersArray, 0.5);
numOrUndefined = d3Array.quantile(numericArray, 0.5);
numOrUndefined = d3Array.quantile(numbersOrUndefinedArray, 0.5);
num = d3Array.quantile(mixedObjectArray, 0.5, function (datum, index, array) {
let d: MixedObject = datum;
let i: number = index;
let arr: Array<MixedObject> = array;
return datum.num;
});
numOrUndefined = d3Array.quantile(mixedObjectArray, 0.5, accessorMixedObjectToNum);
numOrUndefined = d3Array.quantile(mixedObjectOrUndefinedArray, 0.5, accessorMixedObjectToNumOrUndefined);
// sum() -----------------------------------------------------------------------
numOrUndefined = d3Array.sum(numbersArray);
numOrUndefined = d3Array.sum(numericArray);
numOrUndefined = d3Array.sum(numbersOrUndefinedArray);
num = d3Array.sum(numbersArray);
num = d3Array.sum(mixedObjectArray, function (datum, index, array) {
let d: MixedObject = datum;
let i: number = index;
let arr: Array<MixedObject> = array;
return datum.num;
});
numOrUndefined = d3Array.sum(mixedObjectArray, accessorMixedObjectToNum);
numOrUndefined = d3Array.sum(mixedObjectOrUndefinedArray, accessorMixedObjectToNumOrUndefined);
// deviation() -----------------------------------------------------------------
num = d3Array.deviation(numbersArray);
numOrUndefined = d3Array.deviation(numbersArray);
numOrUndefined = d3Array.deviation(numericArray);
numOrUndefined = d3Array.deviation(numbersOrUndefinedArray);
num = d3Array.deviation(mixedObjectArray, function (datum, index, array) {
let d: MixedObject = datum;
let i: number = index;
let arr: Array<MixedObject> = array;
return datum.num;
});
numOrUndefined = d3Array.deviation(mixedObjectArray, accessorMixedObjectToNum);
numOrUndefined = d3Array.deviation(mixedObjectOrUndefinedArray, accessorMixedObjectToNumOrUndefined);
// variance() ------------------------------------------------------------------
num = d3Array.variance(numbersArray);
numOrUndefined = d3Array.variance(numbersArray);
numOrUndefined = d3Array.variance(numericArray);
numOrUndefined = d3Array.variance(numbersOrUndefinedArray);
num = d3Array.variance(mixedObjectArray, function (datum, index, array) {
let d: MixedObject = datum;
let i: number = index;
let arr: Array<MixedObject> = array;
return datum.num;
});
numOrUndefined = d3Array.variance(mixedObjectArray, accessorMixedObjectToNum);
numOrUndefined = d3Array.variance(mixedObjectOrUndefinedArray, accessorMixedObjectToNumOrUndefined);
// -----------------------------------------------------------------------------
// Test Searching Arrays
@@ -259,8 +210,18 @@ num = d3Array.variance(mixedObjectArray, function (datum, index, array) {
// scan() ----------------------------------------------------------------------
num = d3Array.scan(mixedObjectArray, function (a, b) {
return a.num - b.num; // a and b are of type MixedObject
numOrUndefined = d3Array.scan(numbersArray)
numOrUndefined = d3Array.scan(mixedObjectArray, function (a, b) {
let aElem: MixedObject = a;
let bElem: MixedObject = b;
return a.num - b.num;
});
numOrUndefined = d3Array.scan(mixedObjectOrUndefinedArray, function (a, b) {
let aElem: MixedObject | undefined = a;
let bElem: MixedObject | undefined = b;
return a && b ? a.num - b.num : NaN;
});
// bisectLeft() ----------------------------------------------------------------
@@ -334,12 +295,14 @@ num = mixedObjectDateBisectorObject.right(mixedObjectArray, new Date(2015, 3, 14
// ascending() -----------------------------------------------------------------
num = d3Array.ascending(undefined, 20);
num = d3Array.ascending(10, 20);
num = d3Array.ascending('10', '20');
num = d3Array.ascending(new Date(2016, 6, 13), new Date(2016, 6, 14));
// descending() ----------------------------------------------------------------
num = d3Array.descending(undefined, 20);
num = d3Array.descending(10, 20);
num = d3Array.descending('10', '20');
num = d3Array.descending(new Date(2016, 6, 13), new Date(2016, 6, 14));
@@ -364,12 +327,11 @@ let testArrays: MixedObject[][] = [
]
];
let mergedArray: MixedObject[];
mergedArray = d3Array.merge(testArrays); // inferred type
mergedArray = d3Array.merge<MixedObject>(testArrays); // explicit type
// mergedArray = d3.merge<MixedObject>([[10, 40, 30], [15, 30]]); // fails, type mismatch
// mergedArray = d3Array.merge<MixedObject>([[10, 40, 30], [15, 30]]); // fails, type mismatch
// pairs() ---------------------------------------------------------------------
+26 -60
View File
@@ -1,8 +1,10 @@
// Type definitions for D3JS d3-array module v1.0.1
// Type definitions for D3JS d3-array module 1.0
// Project: https://github.com/d3/d3-array
// Definitions by: Alex Ford <https://github.com/gustavderdrache>, Boris Yankov <https://github.com/borisyankov>, Tom Wanzek <https://github.com/tomwanzek>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// Last module patch version validated against: 1.0.2
// --------------------------------------------------------------------------
// Shared Types and Interfaces
// --------------------------------------------------------------------------
@@ -20,17 +22,11 @@ interface Numeric {
valueOf(): number;
}
// --------------------------------------------------------------------------------------
// Descriptive Statistics
// --------------------------------------------------------------------------------------
/**
* Return the maximum value in the array of numbers using natural order.
*/
export function max(array: number[]): number | undefined;
/**
* Return the maximum value in the array of strings using natural order.
*/
@@ -41,25 +37,15 @@ export function max(array: string[]): string | undefined;
*/
export function max<T extends Numeric>(array: T[]): T | undefined;
/**
* Return the maximum value in the array using natural order and a projection function to map values to numbers.
*/
export function max<T>(array: T[], accessor: (datum: T, index: number, array: T[]) => number): number | undefined;
/**
* Return the maximum value in the array using natural order and a projection function to map values to strings.
*/
export function max<T>(array: T[], accessor: (datum: T, index: number, array: T[]) => string): string | undefined;
export function max<T>(array: T[], accessor: (datum: T, index: number, array: T[]) => string | undefined | null): string | undefined;
/**
* Return the maximum value in the array using natural order and a projection function to map values to easily-sorted values.
*/
export function max<T, U extends Numeric>(array: T[], accessor: (datum: T, index: number, array: T[]) => U): U | undefined;
/**
* Return the minimum value in the array using natural order.
*/
export function min(array: number[]): number | undefined;
export function max<T, U extends Numeric>(array: T[], accessor: (datum: T, index: number, array: T[]) => U | undefined | null): U | undefined;
/**
* Return the minimum value in the array using natural order.
@@ -74,25 +60,15 @@ export function min<T extends Numeric>(array: T[]): T | undefined;
/**
* Return the minimum value in the array using natural order.
*/
export function min<T>(array: T[], accessor: (datum: T, index: number, array: T[]) => number): number | undefined;
export function min<T>(array: T[], accessor: (datum: T, index: number, array: T[]) => string | undefined | null): string | undefined;
/**
* Return the minimum value in the array using natural order.
*/
export function min<T>(array: T[], accessor: (datum: T, index: number, array: T[]) => string): string | undefined;
/**
* Return the minimum value in the array using natural order.
*/
export function min<T, U extends Numeric>(array: T[], accessor: (datum: T, index: number, array: T[]) => U): U | undefined;
export function min<T, U extends Numeric>(array: T[], accessor: (datum: T, index: number, array: T[]) => U | undefined | null): U | undefined;
/**
* Return the min and max simultaneously.
*/
export function extent(array: number[]): [number, number] | [undefined, undefined];
/**
* Return the min and max simultaneously.
*/
@@ -106,79 +82,70 @@ export function extent<T extends Numeric>(array: T[]): [T, T] | [undefined, unde
/**
* Return the min and max simultaneously.
*/
export function extent<T extends Numeric>(array: Array<T | Primitive>): [T | Primitive, T | Primitive] | [undefined, undefined];
export function extent<T>(array: T[], accessor: (datum: T, index: number, array: T[]) => string | undefined | null): [string, string] | [undefined, undefined];
/**
* Return the min and max simultaneously.
*/
export function extent<T>(array: T[], accessor: (datum: T, index: number, array: T[]) => number): [number, number] | [undefined, undefined];
/**
* Return the min and max simultaneously.
*/
export function extent<T>(array: T[], accessor: (datum: T, index: number, array: T[]) => string): [string, string] | [undefined, undefined];
/**
* Return the min and max simultaneously.
*/
export function extent<T, U extends Numeric>(array: T[], accessor: (datum: T, index: number, array: T[]) => U): [U, U ] | [undefined, undefined];
export function extent<T, U extends Numeric>(array: T[], accessor: (datum: T, index: number, array: T[]) => U | undefined | null): [U, U] | [undefined, undefined];
/**
* Return the mean of an array of numbers
*/
export function mean(array: number[]): number | undefined;
export function mean<T>(array: T[], accessor: (datum: T, index: number, array: T[]) => number): number | undefined;
export function mean<T extends Numeric>(array: Array<T | undefined | null>): number | undefined;
export function mean<T>(array: T[], accessor: (datum: T, index: number, array: T[]) => number | undefined | null): number | undefined;
/**
* Return the median of an array of numbers
*/
export function median(array: number[]): number | undefined;
export function median<T>(array: T[], accessor: (element: T, i: number, array: T[]) => number): number | undefined;
export function median<T extends Numeric>(array: Array<T | undefined | null>): number | undefined;
export function median<T>(array: T[], accessor: (element: T, i: number, array: T[]) => number | undefined | null): number | undefined;
/**
* Returns the p-quantile of an array of numbers
*/
export function quantile(array: number[], p: number): number | undefined;
export function quantile<T>(array: T[], p: number, accessor: (element: T, i: number, array: T[]) => number): number | undefined;
export function quantile<T extends Numeric>(array: Array<T | undefined | null>, p: number): number | undefined;
export function quantile<T>(array: T[], p: number, accessor: (element: T, i: number, array: T[]) => number | undefined | null): number | undefined;
/**
* Compute the sum of an array of numbers.
*/
export function sum(array: number[]): number;
export function sum<T extends Numeric>(array: Array<T | undefined | null>): number;
/**
* Compute the sum of an array, using the given accessor to convert values to numbers.
*/
export function sum<T>(array: T[], accessor: (datum: T, index: number, array: T[]) => number): number;
export function sum<T>(array: T[], accessor: (datum: T, index: number, array: T[]) => number | undefined | null): number;
/**
* Compute the standard deviation, defined as the square root of the bias-corrected variance, of the given array of numbers.
*/
export function deviation(array: number[]): number | undefined;
export function deviation<T extends Numeric>(array: Array<T | undefined | null>): number | undefined;
/**
* Compute the standard deviation, defined as the square root of the bias-corrected variance, of the given array,
* using the given accessor to convert values to numbers.
*/
export function deviation<T>(array: T[], accessor: (datum: T, index: number, array: T[]) => number): number | undefined;
export function deviation<T>(array: T[], accessor: (datum: T, index: number, array: T[]) => number | undefined | null): number | undefined;
/**
* Compute an unbiased estimator of the population variance of the given array of numbers.
*/
export function variance(array: number[]): number | undefined;
export function variance<T extends Numeric>(array: Array<T | undefined | null>): number | undefined;
/**
* Compute an unbiased estimator of the population variance of the given array,
* using the given accessor to convert values to numbers.
*/
export function variance<T>(array: T[], accessor: (datum: T, index: number, array: T[]) => number): number | undefined;
export function variance<T>(array: T[], accessor: (datum: T, index: number, array: T[]) => number | undefined | null): number | undefined;
// --------------------------------------------------------------------------------------
// Searching Arrays
// --------------------------------------------------------------------------------------
export function scan<T>(array: T[], comparator: (a: T, b: T) => number): number;
export function scan(array: number[], comparator?: (a: number, b: number) => number): number | undefined;
export function scan<T>(array: T[], comparator: (a: T, b: T) => number): number | undefined;
export function bisectLeft(array: number[], x: number, lo?: number, hi?: number): number;
export function bisectLeft(array: string[], x: string, lo?: number, hi?: number): number;
@@ -202,16 +169,16 @@ export function bisector<T, U>(accessor: (x: T) => U): Bisector<T, U>;
/**
* Compares two primitive values for sorting (in ascending order).
*/
export function ascending(a: Primitive, b: Primitive): number;
export function ascending(a: Primitive | undefined, b: Primitive | undefined): number;
// NB. this is limited to primitive values due to D3's use of the <, >, and >= operators. Results get weird for object instances.
/**
* Compares two primitive values for sorting (in ascending order).
*/
export function descending(a: Primitive, b: Primitive): number;
export function descending(a: Primitive | undefined, b: Primitive | undefined): number;
// --------------------------------------------------------------------------------------
// Transforming Arrays
// Transforming Arrays
// --------------------------------------------------------------------------------------
@@ -236,7 +203,6 @@ export function permute<T>(array: { [key: number]: T }, keys: number[]): T[];
*/
export function permute<T>(object: { [key: string]: T }, keys: string[]): T[];
/**
* Generates a 0-based numeric sequence. The output range does not include 'stop'.
*/
+1 -1
View File
@@ -7,7 +7,7 @@
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
+6
View File
@@ -0,0 +1,6 @@
{
"extends": "../tslint.json",
"rules": {
"unified-signatures": false
}
}
+1
View File
@@ -735,6 +735,7 @@ declare namespace createjs {
intersection(rect: Rectangle): Rectangle;
intersects(rect: Rectangle): boolean;
isEmpty(): boolean;
pad(top: number, left: number, bottom: number, right: number): Rectangle;
setValues(x?: number, y?: number, width?: number, height?: number): Rectangle;
toString(): string;
union(rect: Rectangle): Rectangle;
+16
View File
@@ -19,6 +19,22 @@ function test_getAuthInstance(){
var auth = gapi.auth2.getAuthInstance();
}
function test_signIn(){
gapi.auth2.getAuthInstance().signIn({
scope: 'email profile',
prompt: 'content'
});
}
function test_signInOptionsBuild(){
var options = new gapi.auth2.SigninOptionsBuilder();
options.setAppPackageName('com.example.app');
options.setFetchBasicProfile(true);
options.setPrompt('select_account');
options.setScope('profile').setScope('email');
gapi.auth2.getAuthInstance().signIn(options);
}
function test_getAuthResponse(){
var user = gapi.auth2.getAuthInstance().currentUser.get();
var authResponse = user.getAuthResponse();
+32 -25
View File
@@ -31,12 +31,7 @@ declare namespace gapi.auth2 {
/**
* Signs in the user using the specified options.
*/
signIn(options?: {
app_package_name?: string;
fetch_basic_profile?: boolean;
prompt?: boolean;
scope?: string;
}, optionBuilder?: SigninOptionsBuilder): any;
signIn(options?: SigninOptions | SigninOptionsBuilder): any;
/**
* Signs out all accounts from the application.
@@ -59,12 +54,8 @@ declare namespace gapi.auth2 {
/**
* Attaches the sign-in flow to the specified container's click handler.
*/
attachClickHandler(container: any, options: {
app_package_name?: string;
fetch_basic_profile?: boolean;
prompt?: boolean;
scope?: string;
}, onsuccess: (googleUser: GoogleUser) => any, onfailure: (reason: string) => any): any;
attachClickHandler(container: any, options: SigninOptions,
onsuccess: (googleUser: GoogleUser) => any, onfailure: (reason: string) => any): any;
}
export interface IsSignedIn{
@@ -93,6 +84,32 @@ declare namespace gapi.auth2 {
listen(listener: (user: GoogleUser) => any): void;
}
export interface SigninOptions {
/**
* The package name of the Android app to install over the air.
* See Android app installs from your web site:
* https://developers.google.com/identity/sign-in/web/android-app-installs
*/
app_package_name?: string;
/**
* Fetch users' basic profile information when they sign in.
* Adds 'profile', 'email' and 'openid' to the requested scopes.
* True if unspecified.
*/
fetch_basic_profile?: boolean;
/**
* Specifies whether to prompt the user for re-authentication.
* See OpenID Connect Request Parameters:
* https://openid.net/specs/openid-connect-basic-1_0.html#RequestParameters
*/
prompt?: string;
/**
* The scopes to request, as a space-delimited string.
* Optional if fetch_basic_profile is not set to false.
*/
scope?: string;
}
export class SigninOptionsBuilder {
setAppPackageName(name: string): any;
setFetchBasicProfile(fetch: boolean): any;
@@ -164,22 +181,12 @@ declare namespace gapi.auth2 {
* When you use GoogleUser.signIn(), the sign-in flow skips the account chooser step.
* See GoogleAuth.signIn().
*/
signIn(options?: {
app_package_name?: string;
fetch_basic_profile?: boolean;
prompt?: boolean;
scope?: string;
}, optionBuilder?: SigninOptionsBuilder): any;
signIn(options?: SigninOptions | SigninOptionsBuilder): any;
/**
*
* See GoogleUser.signIn()
*/
grant(options?: {
app_package_name?: string;
fetch_basic_profile?: boolean;
prompt?: boolean;
scope?: string;
}, optionBuilder?: SigninOptionsBuilder): any;
grant(options?: SigninOptions | SigninOptionsBuilder): any;
/**
* Get permission from the user to access the specified scopes offline.
+2 -1
View File
@@ -1587,7 +1587,8 @@ declare namespace DataTables {
}
interface FunctionColumnData {
(row: any, t: string, s: any, meta: CellMetaSettings): void;
(row: any, t: 'set', s: any, meta: CellMetaSettings): void;
(row: any, t: 'display' | 'sort' | 'filter' | 'type', s: undefined, meta: CellMetaSettings): any;
}
interface ObjectColumnData {
+9 -2
View File
@@ -43,10 +43,17 @@ $(document).ready(function () {
sort: "asc"
};
var colDataFunc: DataTables.FunctionColumnData = function (row, type, set, meta) {
var colDataFunc: DataTables.FunctionColumnData = (row: any, type: 'set' | 'display' | 'sort' | 'filter' | 'type', set: any, meta: DataTables.CellMetaSettings) => {
meta.col;
meta.row;
meta.settings;
switch (type) {
case 'set':
row.value = set;
return;
default:
return row.value;
}
};
var colRenderObject: DataTables.ObjectColumnRender = {
@@ -276,7 +283,7 @@ $(document).ready(function () {
bScrollbarLeft: true,
bScrollOversize: true
}
//#endregion
//#region "Init"
+161
View File
@@ -0,0 +1,161 @@
// Type definitions for jQuery TOOLS 1.2
// Project: https://github.com/jquerytools/jquerytools
// Definitions by: Joe Skeen <https://github.com/joeskeen/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="jquery"/>
declare interface JQuery {
overlay(opts?: JQueryTools.overlay.OverlayOptions): JQuery;
overlay<T extends JQueryTools.overlay.Overlay>(opts?: JQueryTools.overlay.OverlayOptions): T;
data(key: 'overlay'): JQueryTools.overlay.Overlay;
}
declare interface JQueryStatic {
tools: JQueryTools.ToolsStatic;
}
/** jQuery Tools (http://jquerytools.github.io/documentation/overlay/index.html) */
declare namespace JQueryTools {
interface ToolsStatic {
overlay: overlay.OverlayStatic;
}
namespace overlay {
interface OverlayStatic {
addEffect(effectName: string,
effectFn: (this: Overlay, position: CssOptions, done: () => void) => void,
closeFn: (this: Overlay, done: () => void) => void): void;
}
interface CssOptions {
[key: string]: any;
}
interface OverlayOptions {
/**
* A jQuery selector for the closing elements inside the overlay. These
* can be any elements such as links, buttons or images. If this is not
* supplied, a close element is auto-generated. Read more about this in
* defining close actions.
*/
close?: JQuery;
/**
* By default, overlays are closed when the mouse is clicked outside the
* overlay area. Setting this property to false suppresses this behaviour
* which is suitable for modal dialogs.
* @default true
*/
closeOnClick?: boolean;
/**
* By default, overlays are closed when the ESC keyboard key is pressed.
* Setting this property to false suppresses this behaviour.
* @default true
*/
closeOnEsc?: boolean;
/** The speed to close the overlay, in milliseconds */
closeSpeed?: number;
/**
* The effect to be used when an overlay is opened and closed. This can
* dramatically change the behaviour of the overlay. By default this tool
* uses an effect called "default" which is a simple show/hide effect.
* @default 'default'
*/
effect?: string;
/**
* since 1.2.0. whether overlay stays in the same position while the screen
* is scrolled. This is the default behaviour for all browsers except IE6
* and below. IE6 does not support fixed positioning. If this property is
* set to false then the overlay is positioned in relationship to the document
* so that when the screen is scrolled then the overlay moves along with the document.
* @default true
*/
fixed?: boolean;
/**
* Previously known as expose. Overlay is very often used together with the
* Mask Tool. Because of this, the support for this feature has been built
* inside the tool. This option accepts the mask configuration. This is either
* a simple string specifying the background color of the mask or a more complex
* object literal specifying more configuration variables. See an example of an
* overlay together with mask. By default masking is disabled.
*/
mask?: string | MaskOptions;
/**
* Specifies how far from the left-hand edge of the screen the overlay should be
* placed. By default the overlay is horizontally centered with the value "center"
* but you can also supply a numerical value specifying a distance in pixels.
* @default 'center'
*/
left?: 'center' | number;
/**
* If enabled then the overlay loads immediately after it has been initialized.
* @default false
*/
load?: boolean;
/**
* By default, there can be only one overlay on the page at once. Setting this
* property to false allows you to have multiple overlay instances.
* @default true
*/
oneInstance?: boolean;
/**
* The speed of the fade-in animation on the "default" effect. Valid values are
* 'slow', 'normal' and 'fast', or you can supply a numerical value (in milliseconds).
* By setting this property to 0, the overlay will appear immediately without any animation.
* @default 'normal'
*/
speed?: 'slow' | 'normal' | 'fast' | number;
/**
* The element to be overlayed (if not specified in the rel attribute of the triggering element).
*/
target?: Element;
/**
* Specifies how far from the top edge of the screen the overlay should be placed.
* Acceptable values are an integer number specifying a distance in pixels, a string
* (such as '15%') specifying a percentage value or "center" in which case the overlay
* is vertically centered. Percentage values work consistently at different screen resolutions.
* @default '10%'
*/
top?: string | number;
/**
* before the overlay is displayed. The overlay has already been positioned at the
* location from where it will start animating.
*/
onBeforeLoad?: (this: Overlay, event: JQueryEventObject) => void;
/** when the overlay has completely been displayed */
onLoad?: (this: Overlay, event: JQueryEventObject) => void;
/** before the overlay is closed */
onBeforeClose?: (this: Overlay, event: JQueryEventObject) => void;
/** when the overlay is closed */
onClose?: (this: Overlay, event: JQueryEventObject) => void;
}
interface MaskOptions {
/** CSS color string (i.e. hex value) */
color?: string;
/** load speed in milliseconds */
loadSpeed?: number;
/** Opacity of mask. Between 0 and 1. */
opacity?: number;
}
interface Overlay {
/** Closes the overlay. */
close(): Overlay;
/** Returns the closing element(s) as a jQuery object. */
getClosers(): JQuery;
/** Returns the configuration for the overlay. */
getConf(): OverlayOptions;
/** Returns the overlayed element as a jQuery object. */
getOverlay(): JQuery;
/** Returns the triggering element as a jQuery object. */
getTrigger(): JQuery;
/** Returns `true` if the overlay is opened. */
isOpened(): boolean;
/** Opens the overlay. */
load(): Overlay;
}
}
}
+182
View File
@@ -0,0 +1,182 @@
/// <reference path="index.d.ts" />
/* from documentation at http://jquerytools.github.io/documentation/overlay/index.html */
$("img[rel]").overlay();
var triggers = $(".modalInput").overlay({
 
// some mask tweaks suitable for modal dialogs
mask: {
color: '#ebecff',
loadSpeed: 200,
opacity: 0.9
},
 
closeOnClick: false
});
var buttons = $("#yesno button").click(function(this: JQuery, e: JQueryEventObject) {
 
// get user input
var yes = buttons.index(this) === 0;
 
// do something with the answer
triggers.eq(0).html("You clicked " + (yes ? "yes" : "no"));
});
// select one or more elements to be overlay triggers
$(".my_overlay_trigger").overlay({
// one configuration property
mask: {
color: '#ccc'
},
// another property
top: 50
// ... the rest of the configuration properties
});
$("#prompt form").submit(function(this: JQuery, e: JQueryEventObject) {
 
// close the overlay
triggers.eq(1).overlay<JQueryTools.overlay.Overlay>().close();
//or more straightforward:
triggers.data('overlay').close();
 
// get user input
var input = $("input", this).val();
 
// do something with the answer
triggers.eq(1).html(input);
 
// do not submit the form
return e.preventDefault();
});
$.tools.overlay.addEffect('', function() {}, function() {});
/* custom effects */
$.tools.overlay.addEffect("myEffect", function(position, done) {
/*
- 'this' variable is a reference to the overlay API
- here we use jQuery's fadeIn() method to perform the effect
*/
this.getOverlay().css(position).fadeIn(this.getConf().speed, done);
},
 
// close function
function(done) {
// fade out the overlay
this.getOverlay().fadeOut(this.getConf().closeSpeed, done);
}
);
$("#apple img[rel]").overlay({effect: 'apple'});
// select the overlay element - and "make it an overlay"
$("#facebox").overlay({
// custom top position
top: 260,
// some mask tweaks suitable for facebox-looking dialogs
mask: {
// you might also consider a "transparent" color for the mask
color: '#fff',
// load mask a little faster
loadSpeed: 200,
// very transparent
opacity: 0.5
},
// disable this for modal dialog-type of overlays
closeOnClick: false,
// load it immediately after the construction
load: true
});
$(function() {
 
// if the function argument is given to overlay,
// it is assumed to be the onBeforeLoad event listener
$("a[rel]").overlay({
 
mask: 'darkred',
effect: 'apple',
 
onBeforeLoad: function() {
 
// grab wrapper element inside content
var wrap = this.getOverlay().find(".contentWrap");
 
// load the page specified in the trigger
wrap.load(this.getTrigger().attr("href"));
}
 
});
});
$(function() {
// positions for each overlay
var positions = [
[0, 530],
[400, 20],
[400, 530],
[0, 20]
];
 
// setup triggers
$("button[rel]").each(function(this: JQuery, i: number) {
 
$(this).overlay({
 
// common configuration for each overlay
oneInstance: false,
closeOnClick: false,
 
// setup custom finish position
top: positions[i][0],
left: positions[i][1],
 
// use apple effect
effect: 'apple'
 
});
});
});
// loading animation
$.tools.overlay.addEffect("drop", function(css, done) {
 
// use Overlay API to gain access to crucial elements
var conf = this.getConf(),
overlay = this.getOverlay();
 
// determine initial position for the overlay
if (conf.fixed) {
css['position'] = 'fixed';
} else {
css['top'] += $(window).scrollTop();
css['left'] += $(window).scrollLeft();
css['position'] = 'absolute';
}
 
// position the overlay and show it
overlay.css(css).show();
 
// begin animating with our custom easing
overlay.animate(
{ top: '+=55', opacity: 1, width: '+=20'}, 400, 'drop', done
);
 
/* closing animation */
}, function(done) {
this.getOverlay().animate(
{top:'-=55', opacity:0, width:'-=20'}, 300, 'drop',
function(this: JQuery) {
$(this).hide();
done.call(null);
});
});
$("img[rel]").overlay({
effect: 'drop',
mask: '#789'
});
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"jquery.tools-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "../tslint.json" }
+1 -1
View File
@@ -142,7 +142,7 @@ declare namespace later {
* For acces to custom time periods created as extension to the later static type
* and modifiers created on the later modifier static type.
*/
[ timeperiodAndModifierName: string ]: number[];
[ timeperiodAndModifierName: string ]: number[] | undefined;
}
interface ParseStatic {
+1 -1
View File
@@ -7,7 +7,7 @@
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
+23 -12
View File
@@ -1405,8 +1405,8 @@ declare namespace L {
*/
export function map(element: string | HTMLElement, options?: MapOptions): Map;
export interface IconOptions extends LayerOptions {
iconUrl: string;
interface BaseIconOptions extends LayerOptions {
iconUrl?: string;
iconRetinaUrl?: string;
iconSize?: PointExpression;
iconAnchor?: PointExpression;
@@ -1418,25 +1418,38 @@ declare namespace L {
className?: string;
}
class InternalIcon extends Layer {
constructor(options: IconOptions);
createIcon(oldIcon?: HTMLElement): HTMLElement;
export interface IconOptions extends BaseIconOptions {
iconUrl: string;
}
export class Icon extends InternalIcon {
// This class does not exist in reality, it's just a way to provide
// options of more specific types in the sub classes
class BaseIcon extends Layer {
createIcon(oldIcon?: HTMLElement): HTMLElement;
createShadow(oldIcon?: HTMLElement): HTMLElement;
options: BaseIconOptions;
}
export class Icon extends BaseIcon {
constructor(options: IconOptions);
options: IconOptions;
}
export namespace Icon {
export class Default extends InternalIcon {
imagePath: string;
export interface DefaultIconOptions extends BaseIconOptions {
imagePath?: string;
}
export class Default extends BaseIcon {
static imagePath?: string;
constructor(options?: DefaultIconOptions);
options: DefaultIconOptions;
}
}
export function icon(options: IconOptions): Icon;
export interface DivIconOptions extends LayerOptions {
export interface DivIconOptions extends BaseIconOptions {
html?: string;
bgPos?: PointExpression;
iconSize?: PointExpression;
@@ -1445,7 +1458,7 @@ declare namespace L {
className?: string;
}
export class DivIcon extends InternalIcon {
export class DivIcon extends BaseIcon {
constructor(options?: DivIconOptions);
options: DivIconOptions;
}
@@ -1463,8 +1476,6 @@ declare namespace L {
opacity?: number;
riseOnHover?: boolean;
riseOffset?: number;
options?: DivIconOptions;
}
export class Marker extends Layer {
+7
View File
@@ -404,22 +404,29 @@ class MyMarker extends L.Marker {
super([12, 13]);
}
}
class MyLayer extends L.Layer {
constructor() {
super();
}
}
class MyIcon extends L.Icon {
constructor() {
super({iconUrl: 'icon.png'});
}
}
class MyDivIcon extends L.DivIcon {
constructor() {
super();
}
}
const divIcon = L.divIcon({html: ''});
let defaultIcon = new L.Icon.Default();
defaultIcon = new L.Icon.Default({imagePath: 'apath'});
let myControlClass = L.Control.extend({});
let myControl = new myControlClass();
+17
View File
@@ -0,0 +1,17 @@
// Type definitions for ltx 2.6
// Project: github.com/node-xmpp/ltx/
// Definitions by: PJakcson <https://github.com/PJakcson>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
export {Element} from './lib/Element'
export {nameEqual, attrsEqual, childrenEqual, equal} from './lib/equal';
export {isNode, isElement, isText} from './lib/is';
export {clone} from './lib/clone';
export {createElement} from './lib/createElement';
export {escapeXML, unescapeXML, escapeXMLText, unescapeXMLText} from './lib/escape';
export {Parser} from './lib/Parser';
export {parse} from './lib/parse';
export {tag} from './lib/tag';
export {tagString} from './lib/tagString';
export {stringify} from './lib/stringify';
+119
View File
@@ -0,0 +1,119 @@
/**
* Element
*
* Attributes are in the element.attrs object. Children is a list of
* either other Elements or Strings for text content.
**/
export declare class Element {
name: string;
parent: Element;
children: Element[];
attrs: any;
constructor(name: string, attrs?: any);
/**
* if (element.is('message', 'jabber:client')) ...
**/
is(name: string, xmlns?: any): boolean;
/**
* without prefix.
*/
getName(): string;
/**
* retrieves the namespace of the current element, upwards recursively
**/
getNS(): any;
/**
* find the namespace to the given prefix, upwards recursively
**/
findNS(prefix: string): any;
/**
* Recursiverly gets all xmlns defined, in the form of {url:prefix}
**/
getXmlns(): any;
setAttrs(attrs: any): void;
/**
* xmlns can be null, returns the matching attribute.
**/
getAttr(name: string, xmlns?: any): any;
/**
* xmlns can be null
**/
getChild(name: string, xmlns?: any): Element;
/**
* xmlns can be null
**/
getChildren(name: string, xmlns?: any): Element[];
/**
* xmlns and recursive can be null
**/
getChildByAttr(attr: any, val: any, xmlns?: any, recursive?: any): Element;
/**
* xmlns and recursive can be null
**/
getChildrenByAttr(attr: any, val: any, xmlns?: any, recursive?: any): Element[];
getText(): string;
getChildText(name: string, xmlns: any): string;
/**
* Return all direct descendents that are Elements.
* This differs from `getChildren` in that it will exclude text nodes,
* processing instructions, etc.
*/
getChildElements(): Element[];
/** returns uppermost parent */
root(): Element;
tree(): Element;
/** just parent or itself */
up(): Element;
/** create child node and return it */
c(name: string, attrs?: any): Element;
/** add text node and return element */
t(text: string): Element;
/**
* Either:
* el.remove(childEl)
* el.remove('author', 'urn:...')
*/
remove(el: Element, xmlns?: any): Element;
clone(): Element;
text(val: string): string;
attr(attr: any, val: any): any;
toString(): string;
toJSON(): any;
write(writer: any): void;
nameEquals(el: Element): boolean;
attrsEquals(el: Element): boolean;
childrenEquals(el: Element): boolean;
equals(el: Element): boolean;
}
+5
View File
@@ -0,0 +1,5 @@
/// <reference types="node" />
import {EventEmitter} from 'events';
export declare class Parser extends EventEmitter {
constructor(options?: any);
}
+1
View File
@@ -0,0 +1 @@
export declare function clone(el: any): any;
+2
View File
@@ -0,0 +1,2 @@
import {Element} from './Element';
export declare function createElement(name: string, attrs: any): Element;
+4
View File
@@ -0,0 +1,4 @@
export declare function nameEqual(a: any, b: any): boolean;
export declare function attrsEqual(a: any, b: any): boolean;
export declare function childrenEqual(a: any, b: any): boolean;
export declare function equal(a: any, b: any): boolean;
+4
View File
@@ -0,0 +1,4 @@
export declare function escapeXML(s: string): string;
export declare function unescapeXML(s: string): string;
export declare function escapeXMLText(s: string): string;
export declare function unescapeXMLText(s: string): string;
+3
View File
@@ -0,0 +1,3 @@
export declare function isNode(el: any): boolean;
export declare function isElement(el: any): boolean;
export declare function isText(el: any): boolean;
+1
View File
@@ -0,0 +1 @@
export declare function parse(data: any, options?: any): any;
+1
View File
@@ -0,0 +1 @@
export declare function stringify(el: any, indent: any, level: any): string;
+1
View File
@@ -0,0 +1 @@
export declare function tag(d: any): any;
+1
View File
@@ -0,0 +1 @@
export declare function tagString(d: any): string;
+19
View File
@@ -0,0 +1,19 @@
import * as ltx from './index';
ltx.parse('<document/>');
let p = new ltx.Parser();
p.on('tree', function (ignored: any) {
});
p.on('error', function (ignored: any) {
});
let el = new ltx.Element('root').c('children');
el.c('child', {age: 5}).t('Hello').up()
.c('child', {age: 7}).t('Hello').up()
.c('child', {age: 99}).t('Hello').up();
el.root().toString();
+22
View 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",
"ltx-tests.ts"
]
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "../tslint.json"
}
+5
View File
@@ -2163,6 +2163,11 @@ declare module "mongoose" {
* @param fields the field(s) to unwind
*/
unwind(...fields: string[]): this;
/**
* Appends new custom $unwind operator(s) to this aggregate pipeline
* new in mongodb 3.2
*/
unwind(...opts: { path: string, includeArrayIndex?: string, preserveNullAndEmptyArrays?: boolean }[]): this;
}
/*
+35 -1
View File
@@ -1016,7 +1016,41 @@ aggregate.sort('field -test');
aggregate.then(cb).catch(cb);
aggregate.unwind("tags").unwind('tags');
aggregate.unwind("a", "b", "c").unwind('tag1', 'tag2');
aggregate.unwind(
{
path: "tags",
includeArrayIndex: "idx",
preserveNullAndEmptyArrays: true
})
.unwind({
path: "tags",
includeArrayIndex: "idx",
preserveNullAndEmptyArrays: true
});
aggregate.unwind(
{
path: "a",
includeArrayIndex: "idx",
preserveNullAndEmptyArrays: true
}, {
path: "b",
includeArrayIndex: "idx",
preserveNullAndEmptyArrays: true
}, {
path: "c",
includeArrayIndex: "idx",
preserveNullAndEmptyArrays: true
})
.unwind({
path: "tag1",
includeArrayIndex: "idx",
preserveNullAndEmptyArrays: true
}, {
path: "tag2",
includeArrayIndex: "idx",
preserveNullAndEmptyArrays: true
});
/*
* section schematype.js
* http://mongoosejs.com/docs/api.html#schematype-js
+8 -8
View File
@@ -26,7 +26,7 @@ class UploadController {
ngfValidateForce: true
});
}
onFileSelect(files: Array<File>) {
this.Upload
@@ -44,11 +44,11 @@ class UploadController {
}).progress((evt: angular.angularFileUpload.IFileProgressEvent) => {
let percent = parseInt((100.0 * evt.loaded / evt.total).toString(), 10);
console.log("upload progress: " + percent + "% for " + evt.config.data.media[0]);
}).error((data: any, status: number, response: any, headers: any) => {
console.error(data, status, response, headers);
}).success((data: any, status: number, headers: any, config: angular.angularFileUpload.IFileUploadConfigFile) => {
}).catch((response: ng.IHttpPromiseCallbackArg<any>) => {
console.error(response.data, response.status, response.statusText, response.headers);
}).then((response: ng.IHttpPromiseCallbackArg<any>) => {
// file is uploaded successfully
console.log("Success!", data, status, headers, config);
console.log("Success!", response.data, response.status, response.headers, response.config);
});
this.Upload
@@ -72,16 +72,16 @@ class UploadController {
this.Upload.isResizeSupported();
this.Upload.isResumeSupported();
this.Upload.isUploadInProgress();
let json = this.Upload.json({ test: true }),
jsonBlob = this.Upload.jsonBlob({ test: true }),
fileWithNewName = this.Upload.rename(files[0], "newName.jpg");
this.Upload
.resize(files[0], {
.resize(files[0], {
height: 1024,
width: 1024,
quality: 0.7,
quality: 0.7,
ratio: 0.9,
centerCrop: true,
restoreExif: true,
+71
View File
@@ -0,0 +1,71 @@
// Type definitions for node-xmpp-client 3.1
// Project: https://github.com/node-xmpp/node-xmpp/tree/master/packages/node-xmpp-client/
// Definitions by: PJakcson <https://github.com/PJakcson>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
export declare class Client {
static Stanza: Stanza;
constructor(options: XmppOptions);
connect(): void;
disconnect(): void;
on(event: string, c: (e: any, d: any) => any): void;
send(stanza: any): void;
}
interface Stanza extends Element {
// This has to be used for the static class initializer new Client.Stanza(..). If there is a better way feel free to
// contribute.
// tslint:disable-next-line
new(name: string, attr: any): Stanza;
from: string;
to: string;
id: string;
type: string;
}
interface Element {
is(name: string, xmlns: string): boolean;
getName(): string;
getNS(): string;
findNS(prefix: string): string;
getXmlns(): string;
setAttrs(attrs: any): void;
getAttrs(): any;
up(): Element;
c(name: string, attrs?: any): Element;
cnode(child: Element): Element;
t(text: string): Element;
remove(el: Element, xmnls: string): Element;
attr(attr: any, val: any): any;
toString(): string;
toJSON(): any;
}
interface XmppOptions {
jid: string;
password: string;
host?: string;
port?: number;
reconnect?: boolean;
autostart?: boolean; // if we start connecting to a given port
register?: boolean; // register account before authentication
legacySSL?: boolean; // connect to the legacy SSL port, requires at least the host to be specified
credentials?: any; // Dictionary (optional) - TLS or SSL key and certificate credentials
actAs?: string; // if admin user act on behalf of another user (just user)
disallowTLS?: boolean; // prevent upgrading the connection to a secure one via TLS
preferred?: string; // Preferred SASL mechanism to use
bosh?: Bosh;
}
interface Bosh {
url?: string;
prebind?: (error: any, data: any) => void;
}
@@ -0,0 +1,22 @@
import {Client} from './index';
let client = new Client({
jid: 'user@example.com',
password: 'password'
});
client.connect();
client.on('online', function () {
});
client.on('stanza', function (stanza) {
let _ = stanza;
});
let stanza = new Client.Stanza('chat', {})
.c('show').t('chat').up()
.c('status').t('message');
client.send(stanza);
client.disconnect();
+22
View 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-client-tests.ts"
]
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "../tslint.json"
}
+59
View File
@@ -1355,6 +1355,12 @@ id(value: number|string): this;
valueFormatter(func: (d: any) => string): this;
}
interface SankeyNodeStyleOptions {
title?: any;
fillColor?: any;
strokeColor?: any;
}
//#endregion
//#region Charts
@@ -3274,6 +3280,58 @@ id(value: number|string): this;
}
interface SankeyChart extends Chart {
/*Y-position of the middle of a node.*/
center(): number;
/*Y-position of the middle of a node.*/
center(value: (d: any) => any): this;
/*Formatting settings for nodes. */
format(): string;
/*Formatting settings for nodes. */
format(formatter: (d: any) => string): this;
/*The height the graph or component created inside the SVG should be made*/
height(): number;
/*The height the graph or component created inside the SVG should be made.*/
height(value: number): this;
/*Format annotation on links. */
linkTitle(): string;
/*Format annotation on links. */
linkTitle(formatter: (d: any) => string): this;
/* The padding of nodes.*/
nodePadding(): number;
/*The padding of nodes.*/
nodePadding(value: number): this;
/*Styling options for nodes. */
margin(): Margin;
/*Styling options for nodes. */
margin(value: Margin): this;
/* The width of nodes.*/
nodeWidth(): number;
/*The width of nodes.*/
nodeWidth(value: number): this;
/*Styling options for nodes. */
nodeStyle(): SankeyNodeStyleOptions;
/*Styling options for nodes. */
nodeStyle(value: SankeyNodeStyleOptions): this;
/* The width the graph or component created inside the SVG should be made*/
width(): number;
/*The width the graph or component created inside the SVG should be made.*/
width(value: number): this;
/*Units to be used. */
units(): string
/*Units to be used. */
units(value: string): this;
}
interface StackedAreaChart extends StackedArea, Chart {
stacked: StackedArea;
legend: Legend;
@@ -3378,6 +3436,7 @@ id(value: number|string): this;
parallelCoordinatesChart(): ParallelCoordinatesChart;
pie(): Pie;
pieChart(): PieChart;
sankeyChart(): SankeyChart;
scatter(): Scatter;
scatterChart(): ScatterChart;
sparkline(): SparkLine;
+4 -3
View File
@@ -528,6 +528,7 @@ declare namespace ReactBootstrap {
// <Navbar.Toggle />
interface NavbarToggleProps {
onClick?: React.MouseEventHandler<HTMLButtonElement>;
}
type NavbarToggle = React.ClassicComponent<NavbarToggleProps, {}>;
var NavbarToggle: React.ClassicComponentClass<NavbarToggleProps>;
@@ -535,7 +536,7 @@ declare namespace ReactBootstrap {
// <Navbar.Link />
interface NavbarLinkProps {
href: string;
onClick?: React.MouseEventHandler<{}>;
onClick?: React.MouseEventHandler<HTMLAnchorElement>;
}
type NavbarLink = React.ClassicComponent<NavbarLinkProps, {}>;
const NavbarLink: React.ClassicComponentClass<NavbarLinkProps>;
@@ -615,7 +616,7 @@ declare namespace ReactBootstrap {
interface TabProps extends React.HTMLProps<Tab> {
animation?: boolean;
'aria-labelledby'?:string;
bsClass?:string;
bsClass?:string;
eventKey?: any; // TODO: Add more specific type
onEnter?: Function;
onEntered?: Function;
@@ -766,7 +767,7 @@ declare namespace ReactBootstrap {
interface GridProps extends React.HTMLProps<Grid> {
componentClass?: React.ReactType;
fluid?: boolean;
bsClass?: string;
bsClass?: string;
}
type Grid = React.ClassicComponent<GridProps, {}>;
var Grid: React.ClassicComponentClass<GridProps>;
+3 -3
View File
@@ -528,7 +528,7 @@ export class ReactBootstrapTest extends Component<any, any> {
<Navbar.Brand>
<a href="#">React-Bootstrap</a>
</Navbar.Brand>
<Navbar.Toggle />
<Navbar.Toggle onClick={ () => {} } />
</Navbar.Header>
<Navbar.Collapse>
<Nav>
@@ -1218,7 +1218,7 @@ export class ReactBootstrapTest extends Component<any, any> {
</FormGroup>
</form>
</div>
<div style={style}>
<Form>
<FormGroup controlId="formBasicText">
@@ -1227,7 +1227,7 @@ export class ReactBootstrapTest extends Component<any, any> {
<FormControl.Feedback />
<HelpBlock>Help block message.</HelpBlock>
</FormGroup>
<FormGroup>
<Checkbox name="checkbox" inline>1</Checkbox>
{' '}
+3 -1
View File
@@ -1,6 +1,6 @@
// Type definitions for React v15.0
// Project: http://facebook.github.io/react/
// Definitions by: Asana <https://asana.com>, AssureSign <http://www.assuresign.com>, Microsoft <https://microsoft.com>, John Reilly <https://github.com/johnnyreilly/>, Benoit Benezech <https://github.com/bbenezech>, Patricio Zavolinsky <https://github.com/pzavolinsky>
// Definitions by: Asana <https://asana.com>, AssureSign <http://www.assuresign.com>, Microsoft <https://microsoft.com>, John Reilly <https://github.com/johnnyreilly/>, Benoit Benezech <https://github.com/bbenezech>, Patricio Zavolinsky <https://github.com/pzavolinsky>, Digiguru <https://github.com/digiguru>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
@@ -2568,6 +2568,7 @@ declare namespace React {
// SVG
svg: SVGFactory;
animate: SVGFactory;
circle: SVGFactory;
defs: SVGFactory;
ellipse: SVGFactory;
@@ -2795,6 +2796,7 @@ declare global {
// SVG
svg: React.SVGProps;
animate: React.SVGProps;
circle: React.SVGProps;
clipPath: React.SVGProps;
defs: React.SVGProps;
+10 -5
View File
@@ -1,4 +1,4 @@
// Type definitions for redis 0.12.1
// Type definitions for redis 0.12.2
// Project: https://github.com/mranney/node_redis
// Definitions by: Carlos Ballesteros Velasco <https://github.com/soywiz>, Peter Harris <https://github.com/CodeAnimal>, TANAKA Koichi <https://github.com/MugeSo>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -91,7 +91,12 @@ export interface RedisClient extends NodeJS.EventEmitter {
offline_queue: any[];
server_info: ServerInfo;
end(): void;
/**
* Forcibly close the connection to the Redis server. Note that this does not wait until all replies have been parsed. If you want to exit cleanly, call client.quit()
*
* @param {boolean} flush You should set flush to true, if you are not absolutely sure you do not care about any other commands. If you set flush to false all still running commands will silently fail.
*/
end(flush: boolean): void;
unref(): void;
/**
@@ -274,8 +279,8 @@ export interface RedisClient extends NodeJS.EventEmitter {
hmget(...args: any[]): boolean;
hincrby(args: any[], callback?: ResCallbackT<any>): boolean;
hincrby(...args: any[]): boolean;
hincrbyfloat(args:any[], callback?:ResCallbackT<any>): boolean;
hincrbyfloat(...args:any[]): boolean;
hincrbyfloat(args: any[], callback?: ResCallbackT<any>): boolean;
hincrbyfloat(...args: any[]): boolean;
hdel(args: any[], callback?: ResCallbackT<any>): boolean;
hdel(...args: any[]): boolean;
hlen(args: any[], callback?: ResCallbackT<any>): boolean;
@@ -408,7 +413,7 @@ export interface RedisClient extends NodeJS.EventEmitter {
zscan(args: any[], callback?: ResCallbackT<any>): boolean;
// Extras
duplicate(options?:any[], callback?:ResCallbackT<any>): RedisClient;
duplicate(options?: any[], callback?: ResCallbackT<any>): RedisClient;
}
export interface Multi {
+9 -9
View File
@@ -31,10 +31,10 @@ client = redis.createClient(num, str, options);
function retryStrategyNumber(options: redis.RetryStrategyOptions): number {
// Ensure that the properties of RetryStrategyOptions are resilient to breaking change.
// If the properties of the interface changes, the variables below will also need to be adapted.
var error: Error = options.error;
var error: Error = options.error;
var total_retry_time: number = options.total_retry_time;
var times_connected: number = options.times_connected;
var attempt: number = options.attempt;
var times_connected: number = options.times_connected;
var attempt: number = options.attempt;
return 5000;
}
function retryStrategyError(options: redis.RetryStrategyOptions): Error {
@@ -57,7 +57,7 @@ info = client.server_info;
// ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
client.end();
client.end(true);
// Connection (http://redis.io/commands#connection)
client.auth(str, resCallback);
@@ -98,11 +98,11 @@ client.subscribe(str);
// Multi
client.multi()
.scard(str)
.smembers(str)
.keys('*', resCallback)
.dbsize()
.exec(resCallback);
.scard(str)
.smembers(str)
.keys('*', resCallback)
.dbsize()
.exec(resCallback);
client.multi(commandArr).exec();
+2
View File
@@ -91,6 +91,8 @@ declare namespace request {
qsStringifyOptions?: any;
qsParseOptions?: any;
json?: any;
jsonReviver?: (key: string, value: any) => any;
jsonReplacer?: (key: string, value: any) => any;
multipart?: RequestPart[] | Multipart;
agent?: http.Agent | https.Agent;
agentOptions?: any;
+6
View File
@@ -91,6 +91,12 @@ var options: request.Options = {
aws: aws,
qs: obj,
json: value,
jsonReviver: (key: string, value: any) => {
},
jsonReplacer: (key: string, value: any) => {
},
multipart: value,
agent: new http.Agent(),
agentOptions: value,
+2
View File
@@ -300,6 +300,7 @@ interface HandlerTiming {
interface Response extends http.ServerResponse {
header: (key: string, value?: any) => any;
cache: (type?: any, options?: Object) => any;
noCache: () => any;
status: (code: number) => any;
send: (status?: any, body?: any, headers?: { [header: string]: string }) => any;
json: (status?: any, body?: any, headers?: { [header: string]: string }) => any;
@@ -448,6 +449,7 @@ interface Server extends http.Server {
}
interface ServerOptions {
ca?: string;
certificate?: string;
key?: string;
formatters?: Object;
+3 -2
View File
@@ -18,6 +18,7 @@ var server = restify.createServer({
});
server = restify.createServer({
ca: "test",
certificate: "test",
key: "test",
formatters: {},
@@ -43,7 +44,7 @@ function send(req: restify.Request, res: restify.Response, next: restify.Next) {
req.header('key') === 'val';
req.trailer('key', 'val');
req.trailer('key') === 'val';
req.accepts('test') === true;
req.accepts(['test']) === true;
req.acceptsEncoding('test') === true;
@@ -343,7 +344,7 @@ client2.get('/str/mcavage', function(err: any, req: any) {
});
});
});
client.basicAuth('test', 'password');
client2.basicAuth('test', 'password');
+5 -5
View File
@@ -1,6 +1,6 @@
// Type definitions for RSVP 3.0.9
// Project: github.com/tildeio/rsvp.js 3.0.9
// Definitions by: Taylor Brown <https://github.com/Taytay>
// Type definitions for RSVP 3.3.3
// Project: https://github.com/tildeio/rsvp.js
// Definitions by: Taylor Brown <https://github.com/Taytay>, Mikael Kohlmyr <https://github.com/mkohlmyr>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
// Some of this file was taken from the type definitions for es6-promise https://github.com/borisyankov/DefinitelyTyped/blob/master/es6-promise/es6-promise.d.ts
@@ -220,8 +220,8 @@ declare module RSVP {
* having to remember the initial order like you would with all().
*
*/
export function hash<T>(promises: Thenable<T>[]): Promise<T[]>;
export function hash<T>(promises: any[]): Promise<T[]>;
export function hash<T>(promises: { [key: string]: Thenable<T> }): Promise<{ [key: string]: T }>;
export function hash<T>(promises: { [key: string]: any }): Promise<{ [key: string]: T }>;
/**
`RSVP.map` is similar to JavaScript's native `map` method, except that it
+2 -1
View File
@@ -1,4 +1,4 @@
// Type definitions for sax js
// Type definitions for sax-js 1.x
// Project: https://github.com/isaacs/sax-js
// Definitions by: Asana <https://asana.com>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -63,6 +63,7 @@ export declare class SAXParser {
strict: boolean;
opt: SAXOptions;
tag: string;
ENTITIES: {[key: string]: string};
// Events
onerror(e: Error): void;
+2
View File
@@ -13,6 +13,8 @@ import fs = require("fs");
let parser = sax.parser(/*strict=*/true, opts);
parser.ENTITIES["foo"] = "bar";
parser.onerror = function(e: Error) {
};
+2 -2
View File
@@ -1,4 +1,4 @@
// Type definitions for ShellJS v0.6.0
// Type definitions for ShellJS v0.7.6
// Project: http://shelljs.org
// Definitions by: Niklas Mollenhauer <https://github.com/nikeee>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -466,7 +466,7 @@ export interface ExecCallback {
(code: number, stdout: string, stderr: string): any;
}
export interface ExecOptions {
export interface ExecOptions extends child.ExecOptions {
silent?: boolean;
async?: boolean;
}
+1 -1
View File
@@ -97,7 +97,7 @@ var pid = asyncVersion3.pid;
shell.exec("node --version", { silent: true }, function (code, stdout, stderr) {
var version = stdout;
});
shell.exec("node --version", { silent: true, async: true }, function (code, stdout, stderr) {
shell.exec("node --version", { silent: true, async: true, cwd: '/usr/local/bin' }, function (code, stdout, stderr) {
var version = stdout;
});
shell.exec("node --version", function (code, stdout, stderr) {
+1 -1
View File
@@ -180,7 +180,7 @@ declare namespace SocketIO {
/**
* Closes the server connection
*/
close():void;
close( fn ?: () => void ):void;
/**
* The event fired when we get a new connection
+11
View File
@@ -143,3 +143,14 @@ function testUsingItJustAsACrossBrowserWebSocket() {
socket.on('disconnect', function () { });
});
}
function testClosingServerWithCallback() {
var io = socketIO.listen(80);
io.close(function() {
});
}
function testClosingServerWithoutCallback() {
var io = socketIO.listen(80);
io.close();
}
+9 -10
View File
@@ -3,22 +3,21 @@
// Definitions by: Paul Isache <https://github.com/Paul-Isache>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace steed {
interface Dictionary<T> { [key: string]: T; }
interface ErrorCallback<T> { (err?: T): void; }
type ErrorCallback<T> = (err?: T) => void;
interface SteedResultCallback<T, E> { (err: E, result: T): void; }
interface SteedResultArrayCallback<T, E> { (err: E, results: T[]): void; }
interface SteedResultObjectCallback<T, E> { (err: E, results: Dictionary<T>): void; }
type SteedResultCallback<T, E> = (err: E, result: T) => void;
type SteedResultArrayCallback<T, E> = (err: E, results: T[]) => void;
type SteedResultObjectCallback<T, E> = (err: E, results: Dictionary<T>) => void;
interface SteedWorker<T, E> { (task: T, callback: ErrorCallback<E>): void; }
interface SteedIterator<T, E> { (item: T, callback: ErrorCallback<E>): void; }
interface SteedResultIterator<T, R, E> { (item: T, callback: SteedResultCallback<R, E>): void; }
interface SteedFunction<T, E> { (callback: (err?: E, result?: T) => void): void; }
type SteedWorker<T, E> = (task: T, callback: ErrorCallback<E>) => void;
type SteedIterator<T, E> = (item: T, callback: ErrorCallback<E>) => void;
type SteedResultIterator<T, R, E> = (item: T, callback: SteedResultCallback<R, E>) => void;
type SteedFunction<T, E> = (callback: (err?: E, result?: T) => void) => void;
interface SteedQueue<T> {
push<E>(task: T | T[], callback?: ErrorCallback<E> | SteedResultCallback<T, E>): void;
push<E>(task: T | T[], callback?: SteedResultCallback<T, E>): void;
unshift<E>(task: T | T[], callback?: ErrorCallback<E>): void;
pause(): void;
resume(): void;
+6
View File
@@ -0,0 +1,6 @@
{
"extends": "../tslint.json",
"rules": {
"forbidden-types": false
}
}
+59 -57
View File
@@ -1,63 +1,65 @@
// Type definitions for Video.js
// Type definitions for Video.js 5.16
// Project: https://github.com/zencoder/video-js
// Definitions by: Vincent Bortone <https://github.com/vbortone/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// The Video.js API allows you to interact with the video through Javascript, whether the browser is playing the video through HTML5 video, Flash, or any other supported playback technologies.
// The Video.js API allows you to interact with the video through
// Javascript, whether the browser is playing the video through HTML5
// video, Flash, or any other supported playback technologies.
interface VideoJSOptions {
techOrder?: string[];
html5?: Object;
width?: number;
height?: number;
defaultVolume?: number;
children?: Object;
controls?: boolean;
src?: string;
autoplay?: boolean;
preload?: string;
declare var videojs: videojsStatic;
export = videojs;
export as namespace videojs;
type videojsStatic =
(id: any, options?: videojs.PlayerOptions, ready?: () => void) => videojs.Player;
declare namespace videojs {
interface PlayerOptions {
techOrder?: string[];
html5?: any;
width?: number;
height?: number;
defaultVolume?: number;
children?: string[];
controls?: boolean;
src?: string;
autoplay?: boolean;
preload?: string;
}
interface Source {
type: string;
src: string;
}
interface Player {
play(): Player;
pause(): Player;
paused(): boolean;
src(newSource: string | Source | Source[]): Player;
currentTime(seconds: number): Player;
currentTime(): number;
duration(): number;
buffered(): TimeRanges;
bufferedPercent(): number;
volume(percentAsDecimal: number): TimeRanges;
volume(): number;
width(): number;
width(pixels: number): Player;
height(): number;
height(pixels: number): Player;
size(width: number, height: number): Player;
requestFullScreen(): Player;
cancelFullScreen(): Player;
ready(callback: () => void ): Player;
on(eventName: string, callback: (eventObject: Event) => void ): void;
off(eventName?: string, callback?: (eventObject: Event) => void ): void;
dispose(): void;
addRemoteTextTrack(options: {}): HTMLTrackElement;
removeRemoteTextTrack(track: HTMLTrackElement): void;
poster(val?: string): string | Player;
playbackRate(rate?: number): number;
}
}
interface VideoJSSource {
type: string;
src: string;
}
interface VideoJSPlayer {
play(): VideoJSPlayer;
pause(): VideoJSPlayer;
paused(): boolean;
src(newSource: string): VideoJSPlayer;
src(newSource: VideoJSSource): VideoJSPlayer;
src(newSource: VideoJSSource[]): VideoJSPlayer;
currentTime(seconds: number): VideoJSPlayer;
currentTime(): number;
duration(): number;
buffered(): TimeRanges;
bufferedPercent(): number;
volume(percentAsDecimal: number): TimeRanges;
volume(): number;
width(): number;
width(pixels: number): VideoJSPlayer;
height(): number;
height(pixels: number): VideoJSPlayer;
size(width: number, height: number): VideoJSPlayer;
requestFullScreen(): VideoJSPlayer;
cancelFullScreen(): VideoJSPlayer;
ready(callback: () => void ): VideoJSPlayer;
on(eventName: string, callback: (eventObject: Event) => void ): void;
off(eventName: string, callback: () => void ): void;
off(eventName: string): void;
off(): void;
dispose(): void;
addRemoteTextTrack(options : {}) : HTMLTrackElement;
removeRemoteTextTrack(track : HTMLTrackElement) : void;
poster(val?: string) : string|VideoJSPlayer;
playbackRate(rate?: number) : number;
}
interface VideoJSStatic {
(id: any, options?: VideoJSOptions, ready?: () => void): VideoJSPlayer;
}
declare var videojs:VideoJSStatic;
+1
View File
@@ -0,0 +1 @@
{ "extends": "../tslint.json" }
+26 -7
View File
@@ -1,9 +1,10 @@
// Tests for Video.js API
import * as videojs from 'videojs';
videojs("example_video_1").ready(function(){
var myPlayer:VideoJSPlayer = this;
var myPlayer: videojs.Player = this;
// EXAMPLE: Start playing the video.
myPlayer.play();
@@ -57,17 +58,35 @@ videojs("example_video_1").ready(function(){
myPlayer.height(480);
myPlayer.size(640,480);
myPlayer.size(640, 480);
myPlayer.requestFullScreen();
myPlayer.cancelFullScreen();
testEvents(myPlayer);
});
var myFunc = function(){
var myPlayer: VideoJSPlayer = this;
function testEvents(myPlayer: videojs.Player) {
const myFunc = function() {
const myPlayer: videojs.Player = this;
// Do something when the event is fired
};
//myPlayer.addEvent("volumechange", myFunc);
//myPlayer.removeEvent("volumechange", myFunc);
});
myPlayer.on("error", myFunc);
// Removes the specified listener only.
myPlayer.off("error", myFunc);
const myFuncWithArg = function(e: Event) {
const myPlayer: videojs.Player = this;
// Do something when the event is fired
};
myPlayer.on("volumechange", myFuncWithArg);
// Removes all listeners for the given event type.
myPlayer.off("volumechange");
myPlayer.on("loadeddata", function() { /* Some handler. */ });
// Removes all listeners.
myPlayer.off();
}
+3
View File
@@ -0,0 +1,3 @@
[*.ts]
indent_style = space
indent_size = 3
+11 -10
View File
@@ -1,25 +1,26 @@
// Type definitions for vinyl-fs
// Type definitions for vinyl-fs 2.4
// Project: https://github.com/wearefractal/vinyl-fs
// Definitions by: vvakame <https://github.com/vvakame/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
/// <reference types="vinyl" />
/// <reference types="glob-stream" />
declare global {
namespace NodeJS {
interface WritableStream {
write(buffer: any/* Vinyl.File */, cb?: Function): boolean;
write(buffer: any/* Vinyl.File */, cb?: (err?: Error) => void): boolean;
}
}
}
import _events = require("events");
import File = require("vinyl");
import globStream = require("glob-stream");
import * as _events from 'events';
import * as File from 'vinyl';
import * as globStream from 'glob-stream';
interface SrcOptions extends globStream.Options {
/** Prevents stream from emitting an error when file not found. */
allowEmpty?: boolean;
interface ISrcOptions extends globStream.Options {
/** Specifies the working directory the folder is relative to */
cwd?: string;
@@ -62,7 +63,7 @@ interface ISrcOptions extends globStream.Options {
* fs.src(['!b*.js', '*.js']) would not exclude any files, but this would: fs.src(['*.js', '!b*.js'])
* @param opt Options Vinyl source options, changes the way the files are read, found, or stored in the vinyl stream
*/
declare function src(globs: string|string[], opt?: ISrcOptions): NodeJS.ReadWriteStream;
declare function src(globs: string|string[], opt?: SrcOptions): NodeJS.ReadWriteStream;
/**
* This is just a glob-watcher
@@ -80,7 +81,7 @@ declare function watch(globs: string|string[], cb?: (outEvt: { type: any; path:
* Globs are executed in order, so negations should follow positive globs
* fs.src(['!b*.js', '*.js']) would not exclude any files, but this would: fs.src(['*.js', '!b*.js'])
*/
declare function watch(globs: string|string[], opt?: { interval?: number; debounceDelay?: number; cwd?: string; maxListeners?: Function; }, cb?: (outEvt: { type: any; path: any; old: any; }) => void): _events.EventEmitter;
declare function watch(globs: string|string[], opt?: { interval?: number; debounceDelay?: number; cwd?: string; maxListeners?: () => number; }, cb?: (outEvt: { type: any; path: any; old: any; }) => void): _events.EventEmitter;
/**
* On write the stream will save the vinyl File to disk at the folder/cwd specified.
+21 -21
View File
@@ -1,22 +1,22 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": false,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"vinyl-fs-tests.ts"
]
}
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": false,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"vinyl-fs-tests.ts"
]
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "../tslint.json"
}
+20 -24
View File
@@ -3,10 +3,10 @@
// from src
import vfs = require('vinyl-fs');
import * as vfs from 'vinyl-fs';
import path = require('path');
import fs = require('fs'); // require('graceful-fs');
import * as path from 'path';
import * as fs from 'fs'; // require('graceful-fs');
// import bufEqual = require('buffer-equal');
declare var bufEqual: any;
@@ -16,8 +16,8 @@ import File = require('vinyl');
// var spies = require('./spy');
declare var spies: any;
import should = require('should');
require('mocha');
import * as should from 'should';
import 'mocha';
declare var gulp: any;
declare var bufferStream: any;
@@ -210,7 +210,7 @@ import rimraf = require('rimraf');
// var File = require('vinyl');
// var should = require('should');
require('mocha');
// require('mocha');
var wipeOut = function (cb: any) {
rimraf(path.join(__dirname, "./out-fixtures/"), cb);
@@ -374,7 +374,7 @@ describe('dest stream', function () {
cwd: __dirname,
path: inputPath,
contents: expectedContents,
stat: <fs.Stats>{
stat: <fs.Stats> {
mode: expectedMode
}
});
@@ -415,7 +415,7 @@ describe('dest stream', function () {
cwd: __dirname,
path: inputPath,
contents: contentStream,
stat: <fs.Stats>{
stat: <fs.Stats> {
mode: expectedMode
}
});
@@ -458,10 +458,8 @@ describe('dest stream', function () {
cwd: __dirname,
path: inputPath,
contents: null,
stat: <fs.Stats>{
isDirectory: function () {
return true;
},
stat: <fs.Stats> {
isDirectory: () => true,
mode: expectedMode
}
});
@@ -503,7 +501,7 @@ describe('dest stream', function () {
stream1.on('data', function (file: any) {
file.path.should.equal(inputPath1);
})
});
stream1.pipe(rename).pipe(stream2);
stream2.on('data', function (file: any) {
@@ -519,11 +517,11 @@ describe('dest stream', function () {
path: inputPath1,
cwd: __dirname,
contents: content
})
});
stream1.write(file);
stream1.end();
})
});
});
@@ -708,7 +706,7 @@ describe('symlink stream', function () {
cwd: __dirname,
path: inputPath,
contents: expectedContents,
stat: <fs.Stats>{
stat: <fs.Stats> {
mode: expectedMode
}
});
@@ -749,7 +747,7 @@ describe('symlink stream', function () {
cwd: __dirname,
path: inputPath,
contents: contentStream,
stat: <fs.Stats>{
stat: <fs.Stats> {
mode: expectedMode
}
});
@@ -792,10 +790,8 @@ describe('symlink stream', function () {
cwd: __dirname,
path: inputPath,
contents: null,
stat: <fs.Stats>{
isDirectory: function () {
return true;
},
stat: <fs.Stats> {
isDirectory: () => true,
mode: expectedMode
}
});
@@ -869,7 +865,7 @@ describe('symlink stream', function () {
cwd: __dirname,
path: inputPath,
contents: expectedContents,
stat: <fs.Stats>{
stat: <fs.Stats> {
mode: expectedMode
}
});
@@ -878,7 +874,7 @@ describe('symlink stream', function () {
fs.chmodSync(expectedBase, 0);
var stream = vfs.symlink('./out-fixtures/', { cwd: __dirname });
stream.on('error', function (err:any) {
stream.on('error', function (err: any) {
err.code.should.equal('EACCES');
done();
});
@@ -914,5 +910,5 @@ describe('symlink stream', function () {
var file = new File(options);
File.isVinyl(file).should.equal(true);
File.isVinyl(options).should.equal(false);
})
});
});
+1 -1
View File
@@ -17,7 +17,7 @@ interface BluetoothRequestDeviceFilter {
interface RequestDeviceOptions {
filters: BluetoothRequestDeviceFilter[];
optionalServices?: number[];
optionalServices?: BluetoothServiceUUID[];
acceptAllDevices?: boolean;
}
+4 -1
View File
@@ -759,7 +759,10 @@ declare namespace webpack {
namespace optimize {
class AggressiveMergingPlugin extends Plugin {
constructor(options: any);
constructor(options?: {
minSize?: number;
maxSize?: number;
});
}
class CommonsChunkPlugin extends Plugin {
+10 -1
View File
@@ -1,6 +1,7 @@
// Type definitions for websocket
// Project: https://github.com/theturtle32/WebSocket-Node
// Definitions by: Paul Loyd <https://github.com/loyd>
// Definitions by: Paul Loyd <https://github.com/loyd>,
// Kay Schecker <https://github.com/flynetworks>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
@@ -8,6 +9,7 @@
import events = require('events');
import http = require('http');
import https = require('https');
import net = require('net');
import url = require('url');
@@ -534,6 +536,13 @@ export interface IClientConfig extends IConfig {
* @default 8MiB
*/
maxReceivedMessageSize?: number;
/**
* Options to pass to https.request if connecting via TLS.
* See Node's HTTPS documentation
* @see https://nodejs.org/api/https.html#https_https_request_options_callback
*/
tlsOptions?: https.RequestOptions;
}
declare class client extends events.EventEmitter {
+13
View File
@@ -0,0 +1,13 @@
// Type definitions for @xmpp/jid 0.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
import {JID} from './lib/JID';
export declare function createJID(local: string, domain: string, resource: string): JID;
export {JID} from './lib/JID';
export declare function equal(a: JID, b: JID): boolean;
export declare function is(a: any): boolean;
+46
View File
@@ -0,0 +1,46 @@
/**
* Created by marcneumann on 17.02.17.
*/
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;
}
+22
View 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",
"xmpp-jid-tests.ts"
]
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "../tslint.json"
}
+40
View File
@@ -0,0 +1,40 @@
import {JID} from './index';
/*
* All return an instance of JID.JID, the new operator is optional.
*/
let addr = new JID('alice@wonderland.net/rabbithole'); // OK
addr = new JID('alice', 'wonderland.net', 'rabbithole'); // BEST; see section on escaping below
/*
* local
*/
addr.local = 'alice';
addr.local; // alice
// same as
addr.setLocal('alice');
addr.getLocal(); // alice
/*
* domain
*/
addr.domain = 'wonderland.net';
addr.domain; // wonderland.net
// same as
addr.setDomain('wonderland.net');
addr.getDomain(); // wonderland.net
/*
* resource
*/
addr.resource = 'rabbithole';
addr.resource; // rabbithole
// same as
addr.setResource('rabbithole');
addr.getResource(); // rabbithole
addr.toString(); // alice@wonderland.net/rabbithole
addr.bare(); // returns a JID without resource
let some_jid = new JID('is', 'a', 'test');
addr.equals(some_jid); // returns true if the two JIDs are equal, false otherwise