Merge pull request #1 from DefinitelyTyped/master

pulling upstream
This commit is contained in:
Jason Swearingen
2016-01-14 20:10:47 -08:00
12 changed files with 276 additions and 106 deletions
+7 -7
View File
@@ -6,15 +6,15 @@
/// <reference path="../node/node.d.ts"/>
declare module "gulp-autoprefixer" {
interface Options {
browsers?: string[];
cascade?: boolean;
remove?: boolean;
namespace autoPrefixer {
interface Options {
browsers?: string[];
cascade?: boolean;
remove?: boolean;
}
}
function autoPrefixer(opts?: Options): NodeJS.ReadWriteStream;
namespace autoPrefixer {}
function autoPrefixer(opts?: autoPrefixer.Options): NodeJS.ReadWriteStream;
export = autoPrefixer;
}
+4 -4
View File
@@ -3,10 +3,10 @@
/// <reference path="../gulp-rev/gulp-rev.d.ts" />
/// <reference path="../gulp-useref/gulp-useref.d.ts" />
import gulp = require('gulp');
import revReplace = require('gulp-rev-replace');
import rev = require('gulp-rev');
import useref = require('gulp-useref');
import * as gulp from 'gulp';
import * as revReplace from 'gulp-rev-replace';
import * as rev from 'gulp-rev';
import * as useref from 'gulp-useref';
gulp.task("index", () => {
return gulp.src("src/index.html")
+11 -9
View File
@@ -6,16 +6,18 @@
/// <reference path="../node/node.d.ts" />
declare module 'gulp-rev-replace' {
interface IOptions {
canonicalUris?: boolean;
replaceInExtensions?: Array<string>;
prefix?: string;
manifest?: NodeJS.ReadWriteStream;
modifyUnreved?: Function;
modifyReved?: Function;
namespace revReplace {
interface Options {
canonicalUris?: boolean;
replaceInExtensions?: Array<string>;
prefix?: string;
manifest?: NodeJS.ReadWriteStream;
modifyUnreved?: Function;
modifyReved?: Function;
}
}
function revReplace(options?: IOptions): NodeJS.ReadWriteStream;
function revReplace(options?: revReplace.Options): NodeJS.ReadWriteStream;
export = revReplace;
export = revReplace;
}
+12 -12
View File
@@ -6,20 +6,20 @@
/// <reference path="../node/node.d.ts" />
declare module 'gulp-size' {
interface IOptions {
showFiles?: boolean;
gzip?: boolean;
title?: string;
namespace size {
interface Options {
showFiles?: boolean;
gzip?: boolean;
title?: string;
}
interface SizeStream extends NodeJS.ReadWriteStream {
size: number;
prettySize: string;
}
}
interface ISizeStream extends NodeJS.ReadWriteStream {
size: number;
prettySize: string;
}
function size(options?: IOptions): ISizeStream;
namespace size {}
function size(options?: size.Options): size.SizeStream;
export = size;
}
+30 -9
View File
@@ -395,21 +395,19 @@ declare module "hapi" {
'required'authentication is required.
'optional'authentication is optional (must be valid if present).
'try'same as 'optional' but allows for invalid authentication. */
mode: string;
mode?: string;
/** a string array of strategy names in order they should be attempted.If only one strategy is used, strategy can be used instead with the single string value.Defaults to the default authentication strategy which is available only when a single strategy is configured. */
strategies: string | Array<string>;
strategies?: string | Array<string>;
/** if set, the payload (in requests other than 'GET' and 'HEAD') is authenticated after it is processed.Requires a strategy with payload authentication support (e.g.Hawk).Cannot be set to a value other than 'required' when the scheme sets the options.payload to true.Available values:
falseno payload authentication.This is the default value.
'required'payload authentication required.This is the default value when the scheme sets options.payload to true.
'optional'payload authentication performed only when the client includes payload authentication information (e.g.hash attribute in Hawk). */
payload?: string;
/** the application scope required to access the route.Value can be a scope string or an array of scope strings.The authenticated credentials object scope property must contain at least one of the scopes defined to access the route.Set to false to remove scope requirements.Defaults to no scope required. */
scope?: string|Array<string>|boolean;
/** the required authenticated entity type.If set, must match the entity value of the authentication credentials.Available values:
anythe authentication can be on behalf of a user or application.This is the default value.
userthe authentication must be on behalf of a user.
appthe authentication must be on behalf of an application. */
entity?: string;
/**
* an object or array of objects specifying the route access rules. Each rule is evaluated against an incoming
* request and access is granted if at least one rule matches. Each rule object must include at least one of:
*/
access?: IRouteAdditionalConfigurationAuthAccess | IRouteAdditionalConfigurationAuthAccess[];
};
/** an object passed back to the provided handler (via this) when called. */
bind?: any;
@@ -640,6 +638,29 @@ declare module "hapi" {
*/
tags?: string[]
}
/**
* specifying the route access rules. Each rule is evaluated against an incoming request and access is granted if at least one rule matches
*/
export interface IRouteAdditionalConfigurationAuthAccess {
/**
* the application scope required to access the route. Value can be a scope string or an array of scope strings.
* The authenticated credentials object scope property must contain at least one of the scopes defined to access the route.
* If a scope string begins with a + character, that scope is required. If a scope string begins with a ! character,
* that scope is forbidden. For example, the scope ['!a', '+b', 'c', 'd'] means the incoming request credentials'
* scope must not include 'a', must include 'b', and must include on of 'c' or 'd'. You may also access properties
* on the request object (query and params} to populate a dynamic scope by using {} characters around the property name,
* such as 'user-{params.id}'. Defaults to false (no scope requirements).
*/
scope?: string|Array<string>|boolean;
/** the required authenticated entity type. If set, must match the entity value of the authentication credentials. Available values:
* any - the authentication can be on behalf of a user or application. This is the default value.
* user - the authentication must be on behalf of a user which is identified by the presence of a user attribute in the credentials object returned by the authentication strategy.
* app - the authentication must be on behalf of an application which is identified by the lack of presence of a user attribute in the credentials object returned by the authentication strategy.
*/
entity?: string;
}
/** server.realm http://hapijs.com/api#serverrealm
The realm object contains server-wide or plugin-specific state that can be shared across various methods. For example, when calling server.bind(),
the active realm settings.bind property is set which is then used by routes and extensions added at the same level (server root or plugin).
+10
View File
@@ -134,6 +134,7 @@ function bufferTests() {
var base64Buffer = new Buffer('','base64');
var octets: Uint8Array = null;
var octetBuffer = new Buffer(octets);
var copiedBuffer = new Buffer(utf8Buffer);
console.log(Buffer.isBuffer(octetBuffer));
console.log(Buffer.isEncoding('utf8'));
console.log(Buffer.byteLength('xyz123'));
@@ -159,6 +160,15 @@ function bufferTests() {
// fill returns the input buffer.
b.fill('a').fill('b');
{
let buffer = new Buffer('123');
let index: number;
index = buffer.indexOf("23");
index = buffer.indexOf("23", 1);
index = buffer.indexOf(23);
index = buffer.indexOf(buffer);
}
}
+7
View File
@@ -113,6 +113,12 @@ declare var Buffer: {
* @param array The octets to store.
*/
new (array: any[]): Buffer;
/**
* Copies the passed {buffer} data onto a new {Buffer} instance.
*
* @param buffer The buffer to copy.
*/
new (buffer: Buffer): Buffer;
prototype: Buffer;
/**
* Returns true if {obj} is a Buffer
@@ -395,6 +401,7 @@ interface NodeBuffer {
writeDoubleLE(value: number, offset: number, noAssert?: boolean): number;
writeDoubleBE(value: number, offset: number, noAssert?: boolean): number;
fill(value: any, offset?: number, end?: number): Buffer;
indexOf(value: string | number | Buffer, byteOffset?: number): number;
}
/************************************************
+1 -1
View File
@@ -33,7 +33,7 @@ osmtogeojson(xml, {
uninterestingTags: {foo:true}
});
let json: OsmJSON.Root = {
let json: OsmJSON.OsmJSONObject = {
elements: [
{
type: "node",
+7 -7
View File
@@ -5,8 +5,8 @@
declare module "osmtogeojson" {
export interface OsmToGeoJSON {
(data: Document|OsmJSON.Root, options?: Options): GeoJSON.GeoJSONObject;
toGeojson(data: Document|OsmJSON.Root, options?: Options): GeoJSON.GeoJSONObject;
(data: Document|OsmJSON.OsmJSONObject, options?: Options): GeoJSON.GeoJSONObject;
toGeojson(data: Document|OsmJSON.OsmJSONObject, options?: Options): GeoJSON.GeoJSONObject;
}
export interface Options {
@@ -54,11 +54,11 @@ declare module "osmtogeojson" {
}
export namespace OsmJSON {
export interface Root {
export interface OsmJSONObject {
elements: (Node|Way|Relationship)[];
}
export interface OsmJSONObject {
export interface Element {
type: string;
id: number;
tags?: { [name: string]: string; }
@@ -69,16 +69,16 @@ declare module "osmtogeojson" {
uid?: number;
}
export interface Node extends OsmJSONObject {
export interface Node extends Element {
lat: number;
lon: number;
}
export interface Way extends OsmJSONObject {
export interface Way extends Element {
nodes: number[];
}
export interface Relationship extends OsmJSONObject {
export interface Relationship extends Element {
members: Member[];
}
+1
View File
@@ -110,6 +110,7 @@ declare module 'request' {
passphrase?: string;
ca?: Buffer;
har?: HttpArchiveRequest;
useQuerystring?: boolean;
}
interface UriOptions {
+118 -32
View File
@@ -15,6 +15,20 @@ should.throws(() => {});
should.doesNotThrow(() => {});
should.ifError('value');
(0).should
.a
.an
.and
.be
.has
.have
.is
.it
.of
.the
.which
.with
.equal(0)
class User {
name: string;
@@ -60,36 +74,48 @@ should.not.exist(null);
should.not.exist('');
should.not.exist({});
true.should.be.ok;
'yay'.should.be.ok;
(1).should.be.ok;
true.should.be.ok();
'yay'.should.be.ok();
(1).should.be.ok();
false.should.not.be.ok;
''.should.not.be.ok;
(0).should.not.be.ok;
false.should.not.be.ok();
''.should.not.be.ok();
(0).should.not.be.ok();
true.should.be.true
'1'.should.not.be.true
false
true.should.be.true();
true.should.be.True();
'1'.should.not.be.true();
false.should.be.false;
(0).should.not.be.false;
false.should.be.false();
false.should.be.False();
(0).should.not.be.false();
var args = function (a: string, b: string, c: string) { return arguments; };
args.should.be.arguments;
['a'].should.not.be.arguments;
args.should.be.arguments();
args.should.be.Arguments();
['a'].should.not.be.arguments();
['a'].should.be.empty;
''.should.be.empty;
({ length: 0 }).should.be.empty;
['a'].should.be.empty();
''.should.be.empty();
({ length: 0 }).should.be.empty();
({ foo: 'bar' }).should.eql({ foo: 'bar' });
[1, 2, 3].should.eql([1, 2, 3]);
[1, 2, 3].should.deepEqual([1, 2, 3]);
(4).should.equal(4);
'test'.should.equal('test');
[1, 2, 3].should.not.equal([1, 2, 3]);
'ab'.should.equalOneOf('a', 10, 'ab');
'ab'.should.equalOneOf(['a', 10, 'ab']);
({a: 10}).should.be.oneOf('a', 10, 'ab', {a: 10});
({a: 10}).should.be.oneOf(['a', 10, 'ab', {a: 10}]);
'1'.should.be.exactly('1');
'1'.should.not.be.exactly(1);
user.age.should.be.within(5, 50);
user.should.be.of.type('object');
@@ -114,7 +140,29 @@ user.should.have.property('age', 15);
user.should.not.have.property('rawr');
user.should.not.have.property('age', 0);
({ a: 10 }).should.have.properties('a');
({ a: 10, b: 20 }).should.have.properties([ 'a' ]);
({ a: 10, b: 20 }).should.have.properties({ b: 20 });
({ foo: 'bar' }).should.have.ownProperty('foo');
({ foo: 'bar' }).should.hasOwnProperty('foo');
({ a: {b: 10}}).should.have.propertyByPath('a', 'b').eql(10);
({ a: 10 }).should.have.propertyWithDescriptor('a', { enumerable: true });
NaN.should.be.NaN();
Infinity.should.be.Infinity();
new Date().should.be.a.Date();
({}).should.be.an.Object();
"".should.be.a.String();
true.should.be.a.Boolean();
(4).should.be.a.Number();
new ReferenceError("error").should.be.an.Error();
(function() {}).should.be.a.Function();
User.should.be.a.class();
User.should.be.a.Class();
'a'.should.not.be.a.generator();
[].should.be.iterable();
[].should.be.an.iterator();
[].should.be.an.Array();
var res = {};
res.should.have.status(200);
@@ -123,30 +171,60 @@ res.should.have.header('content-length');
res.should.have.header('Content-Length', '123');
res.should.have.header('content-length', '123');
res.should.be.json;
res.should.be.json();
res.should.be.html;
res.should.be.html();
[1, 2, 3].should.include(3);
[1, 2, 3].should.include(2);
[1, 2, 3].should.not.include(4);
[1, 2, 3].should.containEql(3);
[1, 2, 3].should.containEql(2);
[1, 2, 3].should.not.containEql(4);
'foo bar baz'.should.include('foo');
'foo bar baz'.should.include('bar');
'foo bar baz'.should.include('baz');
'foo bar baz'.should.not.include('FOO');
'foo bar baz'.should.containEql('foo');
'foo bar baz'.should.containEql('bar');
'foo bar baz'.should.containEql('baz');
'foo bar baz'.should.not.containEql('FOO')
var tobi = { name: 'Tobi', age: 1 };
var jane = { name: 'Jane', age: 5 };
var tj = { name: 'TJ', pet: tobi };
tj.should.include({ pet: tobi });
tj.should.include({ pet: tobi, name: 'TJ' });
tj.should.not.include({ pet: jane });
tj.should.not.include({ name: 'Someone' });
tj.should.containEql({ pet: tobi });
tj.should.containEql({ pet: tobi, name: 'TJ' });
tj.should.not.containEql({ pet: jane });
tj.should.not.containEql({ name: 'Someone' });
[[1], [2], [3]].should.includeEql([3]);
[[1], [2], [3]].should.includeEql([2]);
[[1], [2], [3]].should.not.includeEql([4]);
[[1], [2], [3]].should.containEql([3]);
[[1], [2], [3]].should.containEql([2]);
[[1], [2], [3]].should.not.containEql([4]);
var spy = function() { };
spy.should.be.alwaysCalledOn({});
spy.should.be.alwaysCalledWith(1, 2);
spy.should.be.alwaysCalledWithExactly(1, 2);
spy.should.be.alwaysCalledWithMatch(1, 2);
spy.should.have.alwaysThrew("ReferenceError");
spy.should.have.callCount(1);
spy.should.be.called();
spy.should.be.calledOn({});
spy.should.be.calledOnce();
spy.should.be.calledTwice();
spy.should.be.calledThrice();
spy.should.be.calledWith(1, 2);
spy.should.be.calledWithExactly(1, 2);
spy.should.be.calledWithMatch(1, 2);
spy.should.be.calledWithNew();
spy.should.be.neverCalledWith(1, 2);
spy.should.be.neverCalledWithMatch(1, 2);
spy.should.have.threw("ReferenceError");
(10).should.be.aboveOrEqual(0);
(10).should.be.aboveOrEqual(10);
(10).should.be.greaterThanOrEqual(0);
(10).should.be.greaterThanOrEqual(10);
(0).should.be.belowOrEqual(10);
(0).should.be.belowOrEqual(0);
(0).should.be.lessThanOrEqual(10);
(0).should.be.lessThanOrEqual(0);
(function () {
throw new Error('fail');
@@ -170,9 +248,17 @@ tj.should.not.include({ name: 'Someone' });
var obj = { foo: 'bar', baz: 'raz' };
obj.should.have.keys('foo', 'bar');
obj.should.have.keys(['foo', 'bar']);
obj.should.have.key('foo');
({ a: 10 }).should.have.enumerable('a');
({ a: 10 }).should.have.enumerable('a', 10);
({ a: 10, b: 10 }).should.have.enumerables('a', 'b');
(1).should.eql(0, 'some useful description');
[ 1, 2, 3].should.containDeep([2, 1]);
[ 1, 2, [ 1, 2, 3 ]].should.containDeep([ 1, [ 3, 1 ]]);
[ 1, 2, 3].should.containDeepOrdered([1, 2]);
[ 1, 2, [ 1, 2, 3 ]].should.containDeepOrdered([ 1, [ 2, 3 ]]);
+68 -25
View File
@@ -1,5 +1,5 @@
// Type definitions for should.js 3.1.2
// Project: https://github.com/visionmedia/should.js
// Type definitions for should.js v8.1.1
// Project: https://github.com/shouldjs/should.js
// Definitions by: Alex Varju <https://github.com/varju/>, Maxime LUCE <https://github.com/SomaticIT/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
@@ -13,34 +13,49 @@ interface ShouldAssertion {
an: ShouldAssertion;
and: ShouldAssertion;
be: ShouldAssertion;
has: ShouldAssertion;
have: ShouldAssertion;
is: ShouldAssertion;
it: ShouldAssertion;
with: ShouldAssertion;
which: ShouldAssertion;
the: ShouldAssertion;
of: ShouldAssertion;
not: ShouldAssertion;
// validators
arguments: ShouldAssertion;
empty: ShouldAssertion;
ok: ShouldAssertion;
true: ShouldAssertion;
false: ShouldAssertion;
NaN: ShouldAssertion;
Infinity: ShouldAssertion;
Array: ShouldAssertion;
Object: ShouldAssertion;
String: ShouldAssertion;
Boolean: ShouldAssertion;
Number: ShouldAssertion;
Error: ShouldAssertion;
Function: ShouldAssertion;
arguments(): ShouldAssertion;
empty(): ShouldAssertion;
ok(): ShouldAssertion;
true(): ShouldAssertion;
false(): ShouldAssertion;
NaN(): ShouldAssertion;
Infinity(): ShouldAssertion;
Array(): ShouldAssertion;
Object(): ShouldAssertion;
String(): ShouldAssertion;
Boolean(): ShouldAssertion;
Number(): ShouldAssertion;
Error(): ShouldAssertion;
Function(): ShouldAssertion;
Date(): ShouldAssertion;
Class(): ShouldAssertion;
generator(): ShouldAssertion;
iterable(): ShouldAssertion;
iterator(): ShouldAssertion;
eql(expected: any, description?: string): ShouldAssertion;
equal(expected: any, description?: string): ShouldAssertion;
equalOneOf(...values: any[]): ShouldAssertion;
within(start: number, finish: number, description?: string): ShouldAssertion;
approximately(value: number, delta: number, description?: string): ShouldAssertion;
type(expected: any, description?: string): ShouldAssertion;
instanceof(constructor: Function, description?: string): ShouldAssertion;
above(n: number, description?: string): ShouldAssertion;
below(n: number, description?: string): ShouldAssertion;
aboveOrEqual(n: number, description?: string): ShouldAssertion;
greaterThanOrEqual(n: number, description?: string): ShouldAssertion;
belowOrEqual(n: number, description?: string): ShouldAssertion;
lessThanOrEqual(n: number, description?: string): ShouldAssertion;
match(other: {}, description?: string): ShouldAssertion;
match(other: (val: any) => any, description?: string): ShouldAssertion;
match(regexp: RegExp, description?: string): ShouldAssertion;
@@ -60,32 +75,60 @@ interface ShouldAssertion {
properties(name: string): ShouldAssertion;
properties(descriptor: any): ShouldAssertion;
properties(...properties: string[]): ShouldAssertion;
propertyByPath(...properties: string[]): ShouldAssertion;
propertyWithDescriptor(name: string, descriptor: PropertyDescriptor): ShouldAssertion;
oneOf(...values: any[]): ShouldAssertion;
ownProperty(name: string, description?: string): ShouldAssertion;
contain(obj: any): ShouldAssertion;
containEql(obj: any): ShouldAssertion;
containDeep(obj: any): ShouldAssertion;
containDeepOrdered(obj: any): ShouldAssertion;
keys(...allKeys: string[]): ShouldAssertion;
keys(allKeys: string[]): ShouldAssertion;
header(field: string, val?: string): ShouldAssertion;
status(code: number): ShouldAssertion;
json: ShouldAssertion;
html: ShouldAssertion;
enumerable(property: string, value?: any): ShouldAssertion;
enumerables(...properties: string[]): ShouldAssertion;
startWith(expected: string, message?: any): ShouldAssertion;
endWith(expected: string, message?: any): ShouldAssertion;
throw(message?: any): ShouldAssertion;
// deprecated
include(obj: any, description?: string): ShouldAssertion;
includeEql(obj: any[], description?: string): ShouldAssertion;
//http
header(field: string, val?: string): ShouldAssertion;
status(code: number): ShouldAssertion;
json(): ShouldAssertion;
html(): ShouldAssertion;
//stubs
alwaysCalledOn(thisTarget: any): ShouldAssertion;
alwaysCalledWith(...arguments: any[]): ShouldAssertion;
alwaysCalledWithExactly(...arguments: any[]): ShouldAssertion;
alwaysCalledWithMatch(...arguments: any[]): ShouldAssertion;
alwaysCalledWithNew(): ShouldAssertion;
alwaysThrew(exception?: any): ShouldAssertion;
callCount(count: number): ShouldAssertion;
called(): ShouldAssertion;
calledOn(thisTarget: any): ShouldAssertion;
calledOnce(): ShouldAssertion;
calledTwice(): ShouldAssertion;
calledThrice(): ShouldAssertion;
calledWith(...arguments: any[]): ShouldAssertion;
calledWithExactly(...arguments: any[]): ShouldAssertion;
calledWithMatch(...arguments: any[]): ShouldAssertion;
calledWithNew(): ShouldAssertion;
neverCalledWith(...arguments: any[]): ShouldAssertion;
neverCalledWithMatch(...arguments: any[]): ShouldAssertion;
threw(exception?: any): ShouldAssertion;
// aliases
True(): ShouldAssertion;
False(): ShouldAssertion;
Arguments(): ShouldAssertion;
class(): ShouldAssertion;
deepEqual(expected: any, description?: string): ShouldAssertion;
exactly(expected: any, description?: string): ShouldAssertion;
instanceOf(constructor: Function, description?: string): ShouldAssertion;
throwError(message?: any): ShouldAssertion;
lengthOf(n: number, description?: string): ShouldAssertion;
key(key: string): ShouldAssertion;
haveOwnProperty(name: string, description?: string): ShouldAssertion;
hasOwnProperty(name: string, description?: string): ShouldAssertion;
greaterThan(n: number, description?: string): ShouldAssertion;
lessThan(n: number, description?: string): ShouldAssertion;
}