Merge remote-tracking branch 'Main_DefinitelyTyped/master'

This commit is contained in:
Ralph
2015-09-25 14:07:57 -04:00
23 changed files with 313 additions and 19 deletions
+8 -1
View File
@@ -14,4 +14,11 @@ var a2 = new AutoLaunch({
a1.enable();
a2.disable();
var enabled: boolean = a1.isEnabled();
a1.isEnabled(function(enabled: boolean) {
if (enabled) {
return;
}
a1.enable(function(err){ console.log(err.message); });
});
+1 -1
View File
@@ -32,7 +32,7 @@ declare class AutoLaunch {
/**
* Returns if auto start up is enabled
*/
isEnabled(callback?: (err: Error) => void): boolean;
isEnabled(callback: (enabled: boolean) => void): void;
}
declare module "auto-launch" {
+4
View File
@@ -572,6 +572,10 @@ declare module CKEDITOR {
colorButton_colors?: string;
startupFocus?: boolean;
on?: any;
extraPlugins?: string;
height?: string | number;
toolbarLocation?: string;
readOnly?: boolean;
}
+8 -1
View File
@@ -8,9 +8,16 @@ classNames('foo', 'bar'); // => 'foo bar'
classNames('foo', { bar: true }); // => 'foo bar'
classNames({ foo: true }, { bar: true }); // => 'foo bar'
classNames({ foo: true, bar: true }); // => 'foo bar'
classNames(10, 11); // => '10 11';
// lots of arguments of various types
classNames('foo', { bar: true, duck: false }, 'baz', { quux: true }) // => 'foo bar baz quux'
classNames('foo', { bar: true, duck: false }, 'baz', { quux: true }); // => 'foo bar baz quux'
classNames(['foo', 'bar', 'baz']); // => 'foo bar baz'
classNames([1, 2, 3]); // => '1 2 3'
classNames([{ foo: true, bar: false }, { baz: true }]); // => 'foo baz'
classNames(["foo", ["bar", {baz: true}]]); // => 'foo bar baz'
// other falsy values are just ignored
// NOTE: We don't really want to allow this kind of thing with Typescript (otherwise what's the point!)
+6 -2
View File
@@ -1,14 +1,18 @@
// Type definitions for classnames
// Project: https://github.com/JedWatson/classnames
// Definitions by: Dave Keen <http://www.keendevelopment.ch>, Adi Dahiya <https://github.com/adidahiya>
// Definitions by: Dave Keen <http://www.keendevelopment.ch>, Adi Dahiya <https://github.com/adidahiya>, Jason Killian <https://github.com/JKillian>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare type ClassValue = string | number | ClassDictionary | ClassArray;
interface ClassDictionary {
[id: string]: boolean;
}
interface ClassArray extends Array<ClassValue> { }
interface ClassNamesFn {
(...classes: (string | ClassDictionary)[]): string;
(...classes: ClassValue[]): string;
}
declare var classNames: ClassNamesFn;
+2
View File
@@ -39,6 +39,8 @@ declare module JsDiff {
function diffWordsWithSpace(oldStr:string, newStr:string):IDiffResult[];
function diffJson(oldObj: Object, newObj: Object): IDiffResult[];
function diffLines(oldStr:string, newStr:string):IDiffResult[];
function diffCss(oldStr:string, newStr:string):IDiffResult[];
+1 -1
View File
@@ -41,7 +41,7 @@ interface DropzoneOptions {
filesizeBase?: number;
maxFiles?: number;
params?: {};
headers?: {},
headers?: {};
clickable?: boolean|string|HTMLElement|(string|HTMLElement)[];
ignoreHiddenFiles?: boolean;
acceptedFiles?: string;
+11 -1
View File
@@ -12,12 +12,22 @@ declare module "express-jwt" {
function jwt(options: jwt.Options): jwt.RequestHandler;
interface IDoneCallback<T> {
(err: Error, result: T): void;
}
type ICallback = <T>(req: express.Request, payload: T, done: IDoneCallback<boolean>) => void;
module jwt {
export interface Options {
secret: string;
secret: string|ICallback;
userProperty?: string;
skip?: string[];
credentialsRequired?: boolean;
isRevoked?: boolean;
requestProperty?: string;
getToken?: ICallback;
[property: string]: any;
}
export interface RequestHandler extends express.RequestHandler {
unless?: typeof unless;
+19
View File
@@ -0,0 +1,19 @@
/// <reference path="geoip-lite.d.ts"/>
// require geoip-lite
import geoip = require('geoip-lite');
// lookup an IP addres
var geo = geoip.lookup('199.16.156.125');
// convert the ip block range to string
if (geo) {
let rangeStart = geoip.pretty(geo.range[0]);
let rangeEnd = geoip.pretty(geo.range[1]);
}
// start the data update watcher
geoip.startWatchingDataUpdate();
// stop the data update watcher
geoip.stopWatchingDataUpdate();
+22
View File
@@ -0,0 +1,22 @@
// Type definitions for GeoIP-lite 1.1.6
// Project: https://github.com/bluesmoon/node-geoip
// Definitions by: Yuce Tekol <http://yuce.me/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module 'geoip-lite' {
module mod {
export interface Lookup {
range: Array<number>; // range start, end
country: string;
region: string;
city: string;
ll: Array<number>; // latitude, longitude
}
export function lookup(ip: string): Lookup;
export function pretty(ip: number): string;
export function startWatchingDataUpdate(): void;
export function stopWatchingDataUpdate(): void;
}
export = mod;
}
+4
View File
@@ -90,3 +90,7 @@ declare module Cookies {
}
declare var Cookies: Cookies.CookiesStatic;
declare module 'js-cookie' {
export = Cookies;
}
+3
View File
@@ -14,6 +14,7 @@ var superStringDistance = function(string1: string, string2: string): number {
$('#email').on('blur', function() {
$(this).mailcheck({
email: 'nonoptional@example.com',
domains: domains, // optional
secondLevelDomains: secondLevelDomains, // optional
topLevelDomains: topLevelDomains, // optional
@@ -28,6 +29,7 @@ $('#email').on('blur', function() {
});
Mailcheck.run({
email: 'nonoptional@example.com',
domains: domains, // optional
secondLevelDomains: secondLevelDomains, // optional
topLevelDomains: topLevelDomains, // optional
@@ -41,6 +43,7 @@ Mailcheck.run({
});
MC.run({
email: 'nonoptional@example.com',
domains: domains, // optional
secondLevelDomains: secondLevelDomains, // optional
topLevelDomains: topLevelDomains, // optional
+1
View File
@@ -46,6 +46,7 @@ declare module MailcheckModule {
}
export interface IOptions {
email: string;
domains?: string[];
secondLevelDomains?: string[];
topLevelDomains?: string[];
+17 -5
View File
@@ -34,6 +34,7 @@ function TestPortal() {
var bladePromise = testFx.portal.openResourceBlade(resourceId, summaryBlade.title, 20000)
var stringPromise = testFx.portal.takeScreenshot("TestPortal");
var stringArrayPromise = testFx.portal.getBrowserLogs(testFx.LogLevel.All);
anyPromise = testFx.portal.waitUntilElementDoesNotContainAttribute(testFx.Locators.By.className('part'), 'class', 'invalid');
}
function TestBlades() {
@@ -41,14 +42,16 @@ function TestBlades() {
blade.clickCommand('Delete');
var createBlade = new testFx.Blades.CreateBlade(bladeTitle);
voidPromise = createBlade.actionBar.clickCreate();
voidPromise = createBlade.actionBar.clickDelete();
voidPromise = createBlade.actionBar.createButton.click();
var browseBlade = new testFx.Blades.BrowseResourceBlade(bladeTitle);
voidPromise = browseBlade.selectResource(resourceName);
var pickerBlade = new testFx.Blades.PickerBlade(bladeTitle);
pickerBlade.pickItem('abc');
var specPickerBlade = new testFx.Blades.SpecPickerBlade(bladeTitle);
specPickerBlade.pickSpec('S2');
}
function TestParts() {
@@ -60,6 +63,9 @@ function TestParts() {
var resourceSummary = new testFx.Parts.ResourceSummaryPart(summaryBlade.getLocator());
var count = resourceSummary.properties.length;
var pricingTier = new testFx.Parts.PricingTierPart(summaryBlade.getLocator());
voidPromise = pricingTier.click();
}
function TestControls() {
@@ -75,7 +81,13 @@ function TestControls() {
}
function TestActionBars() {
var bar = new testFx.ActionBars.ActionBar(summaryBlade.getLocator());
voidPromise = bar.clickCreate();
voidPromise = bar.clickDelete();
var createBar = new testFx.ActionBars.CreateActionBar(summaryBlade.getLocator());
voidPromise = createBar.createButton.click();
var deleteBar = new testFx.ActionBars.DeleteActionBar(summaryBlade.getLocator());
voidPromise = deleteBar.deleteButton.click();
voidPromise = deleteBar.cancelButton.click();
var pickerBar = new testFx.ActionBars.PickerActionBar(summaryBlade.getLocator());
voidPromise = pickerBar.selectButton.click();
}
+31 -5
View File
@@ -38,16 +38,35 @@ declare module MsPortalTestFx {
static partialLinkText(value: string): Locator;
static tagName(value: string): Locator;
static xpath(value: string): Locator;
static text(value: string): Locator;
static chained(...values: Locator[]): Locator;
static content(...values: Locator[]): Locator;
}
}
export module ActionBars {
export class ActionBar extends MsPortalTestFx.PortalElement {
export class ActionBarButton extends PortalElement {
constructor(parentLocator?: Locators.Locator, baseLocator?: Locators.Locator);
click(): Q.Promise<void>;
}
export class CreateActionBar extends PortalElement {
public createButton: ActionBarButton;
constructor(parentLocator?: Locators.Locator);
}
export class DeleteActionBar extends PortalElement {
public deleteButton: ActionBarButton;
public cancelButton: ActionBarButton;
constructor(parentLocator?: Locators.Locator);
}
export class PickerActionBar extends PortalElement {
public selectButton: ActionBarButton;
constructor(parentLocator?: Locators.Locator);
clickCreate(): Q.Promise<void>;
clickDelete(): Q.Promise<void>;
}
}
@@ -60,7 +79,7 @@ declare module MsPortalTestFx {
}
export class CreateBlade extends Blade {
public actionBar: ActionBars.ActionBar;
public actionBar: ActionBars.CreateActionBar;
}
export class BrowseResourceBlade extends Blade {
@@ -70,9 +89,12 @@ declare module MsPortalTestFx {
}
export class PickerBlade extends Blade {
constructor(title: string);
pickItem(item: string): Q.Promise<void>;
}
export class SpecPickerBlade extends Blade {
pickSpec(specCode: string): Q.Promise<void>;
}
}
export module Controls {
@@ -137,6 +159,9 @@ declare module MsPortalTestFx {
constructor(parentLocator?: Locators.Locator);
}
class PricingTierPart extends Part {
}
export class Tile extends MsPortalTestFx.PortalElement {
public progressLocator: Locators.Locator;
@@ -201,6 +226,7 @@ declare module MsPortalTestFx {
getAttribute(locator: Locators.Locator, attributeName: string, timeout?: number): Q.Promise<string>;
waitForElementNotVisible(locator: Locators.Locator, timeout?: number): Q.Promise<boolean>;
waitUntilElementContainsAttribute(locator: Locators.Locator, attributeName: string, attributeValue: string, timeout?: number): Q.Promise<any>;
waitUntilElementDoesNotContainAttribute(locator: Locators.Locator, attributeName: string, attributeValue: string, timeout?: number): Q.Promise<any>;
waitForElementLocated(locator: Locators.Locator, timeout?: number): Q.Promise<any>;
takeScreenshot(filePrefix?: string): Q.Promise<string>;
goHome(timeout?: number): Q.Promise<void>;
-1
View File
@@ -3,7 +3,6 @@
// Definitions by: Qubo <https://github.com/tkQubo>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../bluebird/bluebird.d.ts" />
/// <reference path="../node/node.d.ts" />
declare module "node-notifier" {
+1
View File
@@ -1772,6 +1772,7 @@ declare module "util" {
export function isDate(object: any): boolean;
export function isError(object: any): boolean;
export function inherits(constructor: any, superConstructor: any): void;
export function debuglog(key:string): (msg:string,...param: any[])=>void;
}
declare module "assert" {
+1
View File
@@ -141,6 +141,7 @@ declare module 'request' {
pass?: string;
password?: string;
sendImmediately?: boolean;
bearer?: string;
}
export interface OAuthOptions {
+18
View File
@@ -0,0 +1,18 @@
/// <reference path="rest-io.d.ts" />
import express = require('express');
import restIO = require('rest-io');
import mongoose = require('mongoose');
var app = express();
// register the express app with rest.io
restIO.restIO(app, {
resources: __dirname + '/resources'
});
mongoose.connect('mongodb://localhost:27017/test');
app.listen(3000, function () {
console.log('Server has started under port: 3000');
});
module.exports = app;
+148
View File
@@ -0,0 +1,148 @@
// Type definitions for rest-io 4.0
// Project: https://github.com/EnoF/rest-io
// Definitions by: Andy Tang <https://github.com/EnoF>, Stefan Schacherl <https://github.com/TheBay0r>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../express/express.d.ts" />
/// <reference path="../mongoose/mongoose.d.ts" />
declare module 'rest-io' {
import {Router, Application, Response, Request} from 'express';
import {Mongoose, Schema, Model, Document, Types, Promise} from 'mongoose';
function restIO(app: Application, config?: IRestIOConfig): RestIO;
export interface RestIO {
resource: ResourceModule
}
export interface IRestIOConfig {
resources: string;
db?: Mongoose;
}
export interface ResourceModule {
Resource: Resource;
AuthorizedResource: AuthorizedResource;
authorizedResource: AuthorizedResourceModule;
UserResource: UserResource;
SubResource: SubResource;
}
export class Resource {
baseUrl: string;
url: string;
parameterizedUrl: string;
model: Model<Document>;
resDef: IResource;
parentResource: Resource;
router: Router;
app: Application;
db: Mongoose;
paramId: string;
parentRef: string;
populate: string;
constructor(resDef: IResource);
createModel(resDef: IResource): Model<Document>;
toClassName(name: string): string;
setupRoutes(): void;
getAll(req: Request, res: Response): void;
buildParentSearch(req: Request): any;
getById(req: Request, res: Response): void;
create(req: Request, res: Response): void;
update(req: Request, res: Response): void;
del(req: Request, res: Response): void;
errorHandler(err: Error, res: Response): void;
}
export interface IResource {
name: string;
model: any;
parentRef?: string;
populate?: string;
plural?: string;
parentResource?: Resource;
}
export interface AuthorizedResourceModule {
AuthorizedResource: AuthorizedResource
ROLES: Roles
}
export interface Roles {
USER: string;
SUPER_USER: string;
MODERATOR: string;
ADMIN: string;
}
export class AuthorizedResource extends Resource {
methodAccess: IMethodAccess;
maxDays: number;
permissions: IMethodAccess;
isTokenExpired(createdAt: Date): boolean;
getRoles(id: string): Promise<Document>;
hasAuthorizedRole(roles: Array<any>, authorizedRoles: Array<string>): boolean;
hasAccessRightsDefined(req: Request, authorizedRoles: Array<string>): boolean;
isAuthorized(req: Request, authorizedRoles: Array<string>): boolean;
sendUnauthorized(error: Error, res: Response): void;
}
export interface IMethodAccess {
getAll: Array<string>;
getById: Array<string>;
create: Array<string>;
update: Array<string>;
del: Array<string>;
}
export class UserResource extends AuthorizedResource {
ensureBaseUserModel(model: any): void;
createRoleModel(): void;
isSelf(req: Request): boolean;
login(req: Request, res: Response): void;
}
export class SubResource extends Resource {
constructor(resDef: ISubResource);
createProjectionQuery(req: Request): any;
createPullQuery(req: Request): any;
createFindQuery(req: Request): any;
createSubUpdateQuery(req: Request): any;
}
export interface ISubResource {
name: string;
plural?: string;
parentResource: Resource;
populate?: string;
}
}
+2 -1
View File
@@ -92,7 +92,8 @@ myApp.controller('TestCtrl', (
Restangular.setMethodOverriders(["put", "patch"]);
Restangular.setErrorInterceptor(function (response) {
console.error('' + response.status + ' ' + response.data);
let location: string = response.headers('Location');
console.error('' + response.status + ' ' + response.data + ' ' + location);
});
Restangular.setRequestSuffix('.json');
+1
View File
@@ -43,6 +43,7 @@ declare module restangular {
interface IResponse {
status: number;
data: any;
headers(name: string): string;
config: {
method: string;
url: string;
+4
View File
@@ -49,6 +49,10 @@ interface ShouldAssertion {
matchEach(other: (val: any) => any, description?: string): ShouldAssertion;
matchEach(regexp: RegExp, description?: string): ShouldAssertion;
matchEach(other: any, description?: string): ShouldAssertion;
matchAny(other: {}, description?: string): ShouldAssertion;
matchAny(other: (val: any) => any, description?: string): ShouldAssertion;
matchAny(regexp: RegExp, description?: string): ShouldAssertion;
matchAny(other: any, description?: string): ShouldAssertion;
length(n: number, description?: string): ShouldAssertion;
property(name: string, description?: string): ShouldAssertion;
property(name: string, val: any, description?: string): ShouldAssertion;