mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
@@ -5,6 +5,9 @@
|
||||
|
||||
/// <reference path="../angularjs/angular.d.ts" />
|
||||
|
||||
// Support for AMD require
|
||||
declare module 'angular-bootstrap' {}
|
||||
|
||||
declare module angular.ui.bootstrap {
|
||||
|
||||
interface IAccordionConfig {
|
||||
|
||||
@@ -158,7 +158,9 @@ class UrlLocatorTestService implements IUrlLocatorTestService {
|
||||
|
||||
private stateServiceTest() {
|
||||
this.$state.go("myState");
|
||||
this.$state.go(this.$state.current);
|
||||
this.$state.transitionTo("myState");
|
||||
this.$state.transitionTo(this.$state.current);
|
||||
if (this.$state.includes("myState") === true) {
|
||||
//
|
||||
}
|
||||
|
||||
+3
@@ -228,8 +228,11 @@ declare module angular.ui {
|
||||
* @param options Options object.
|
||||
*/
|
||||
go(to: string, params?: {}, options?: IStateOptions): angular.IPromise<any>;
|
||||
go(to: IState, params?: {}, options?: IStateOptions): angular.IPromise<any>;
|
||||
transitionTo(state: string, params?: {}, updateLocation?: boolean): void;
|
||||
transitionTo(state: IState, params?: {}, updateLocation?: boolean): void;
|
||||
transitionTo(state: string, params?: {}, options?: IStateOptions): void;
|
||||
transitionTo(state: IState, params?: {}, options?: IStateOptions): void;
|
||||
includes(state: string, params?: {}): boolean;
|
||||
is(state:string, params?: {}): boolean;
|
||||
is(state: IState, params?: {}): boolean;
|
||||
|
||||
@@ -1 +1 @@
|
||||
--experimentalDecorators --target ES5
|
||||
--experimentalDecorators --noImplicitAny --target ES5
|
||||
|
||||
Vendored
+1424
-1422
File diff suppressed because it is too large
Load Diff
Vendored
+5
@@ -10,6 +10,11 @@ declare module "angular-mocks/ngMock" {
|
||||
export = _;
|
||||
}
|
||||
|
||||
declare module "angular-mocks/ngMockE2E" {
|
||||
var _: string;
|
||||
export = _;
|
||||
}
|
||||
|
||||
declare module "angular-mocks/ngAnimateMock" {
|
||||
var _: string;
|
||||
export = _;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
module Analytics {
|
||||
angular.module("angulartics.app", ["angulartics"])
|
||||
.config(["$analyticsProvider", ($analyticsProvider: Angulartics.IAnalyticsServiceProvider) => {
|
||||
.config(["$analyticsProvider", ($analyticsProvider:angulartics.IAnalyticsServiceProvider) => {
|
||||
angulartics.waitForVendorApi("location", 1000, (message: string) => {
|
||||
console.log(message);
|
||||
});
|
||||
@@ -17,9 +17,8 @@ module Analytics {
|
||||
console.log(action);
|
||||
});
|
||||
|
||||
$analyticsProvider.registerPageTrack((path: string, locationObj: ng.ILocationService) => {
|
||||
$analyticsProvider.registerPageTrack((path:string, locationObj:angular.ILocationService) => {
|
||||
console.log("viewed " + path);
|
||||
});
|
||||
}]);
|
||||
}
|
||||
|
||||
|
||||
Vendored
+7
-8
@@ -4,16 +4,15 @@
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../angularjs/angular.d.ts" />
|
||||
declare module angulartics {
|
||||
|
||||
interface Angulartics {
|
||||
waitForVendorApi(objectName: string, delay: number, containsField?: any, registerFn?: any, onTimeout?: boolean): void;
|
||||
}
|
||||
|
||||
declare module Angulartics {
|
||||
interface IAngularticsStatic {
|
||||
waitForVendorApi(objectName:string, delay:number, containsField?:any, registerFn?:any, onTimeout?:boolean): void;
|
||||
}
|
||||
|
||||
interface IAnalyticsService {
|
||||
eventTrack(eventName: string, properties?: any): any;
|
||||
pageTrack(path: string, location?: ng.ILocationService): any;
|
||||
pageTrack(path:string, location?:angular.ILocationService): any;
|
||||
setAlias(alias: string): any;
|
||||
setUsername(username: string): any;
|
||||
setUserProperties(properties: any): any;
|
||||
@@ -27,7 +26,7 @@ declare module Angulartics {
|
||||
withAutoBase(value: boolean): void;
|
||||
developerMode(value: boolean): void;
|
||||
|
||||
registerPageTrack(callback: (path: string, location?: ng.ILocationService) => any): void;
|
||||
registerPageTrack(callback:(path:string, location?:angular.ILocationService) => any): void;
|
||||
registerEventTrack(callback: (eventName: string, properties?: any) => any): void;
|
||||
registerSetAlias(callback: (alias: string) => any): void
|
||||
registerSetUsername(callback: (username: string) => any): void
|
||||
@@ -36,4 +35,4 @@ declare module Angulartics {
|
||||
}
|
||||
}
|
||||
|
||||
declare var angulartics:Angulartics;
|
||||
declare var angulartics:angulartics.IAngularticsStatic;
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
/// <reference path="archiver.d.ts" />
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
import Archiver = require('archiver');
|
||||
import FS = require('fs');
|
||||
|
||||
var archiver = Archiver.create('zip');
|
||||
|
||||
var writeStream = FS.createWriteStream('./archiver.d.ts');
|
||||
var readStream = FS.createReadStream('./archiver.d.ts');
|
||||
|
||||
archiver.pipe(writeStream);
|
||||
archiver.append(readStream, {name: 'archiver.d.ts'});
|
||||
archiver.finalize();
|
||||
Vendored
+41
@@ -0,0 +1,41 @@
|
||||
// Type definitions for archiver v0.15.0
|
||||
// Project: https://github.com/archiverjs/node-archiver
|
||||
// Definitions by: Esri <https://github.com/archiverjs/node-archiver>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/* =================== USAGE ===================
|
||||
|
||||
import Archiver = require('archiver);
|
||||
var archiver = Archiver.create('zip');
|
||||
archiver.pipe(FS.createWriteStream('xxx'));
|
||||
archiver.append(FS.createReadStream('xxx'));
|
||||
archiver.finalize();
|
||||
|
||||
=============================================== */
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
declare module "archiver" {
|
||||
import * as FS from 'fs';
|
||||
|
||||
interface nameInterface {
|
||||
name?: string;
|
||||
}
|
||||
|
||||
interface Archiver {
|
||||
pipe(writeStream: FS.WriteStream): void;
|
||||
append(readStream: FS.ReadStream, name: nameInterface): void;
|
||||
finalize(): void;
|
||||
}
|
||||
|
||||
interface Options {
|
||||
|
||||
}
|
||||
|
||||
function archiver(format: string, options?: Options): Archiver;
|
||||
|
||||
namespace archiver {
|
||||
function create(format: string, options?: Options): Archiver;
|
||||
}
|
||||
|
||||
export = archiver;
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
/// <reference path="./async.d.ts" />
|
||||
|
||||
import async = require("async");
|
||||
|
||||
async.map(["a", "b", "c"], (item, cb) => cb(null, [item.toUpperCase()]), (err, results) => { });
|
||||
async.map(["a", "b", "c"], (item, cb) => cb(null, [item.toUpperCase()]), (err, results) => { });
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
/// <reference path="better-curry.d.ts" />
|
||||
|
||||
import bc = require('better-curry');
|
||||
bc.flatten([1,2,3,[1,2],['a']]) === [];
|
||||
bc.MAX_OPTIMIZED = 5;
|
||||
|
||||
function fn(...args: number[]): number[] {
|
||||
return [].concat([1]);
|
||||
}
|
||||
|
||||
function fn2(arg1: string, arg2: any): number {
|
||||
return parseInt(arg1 + String(arg2)) + 1;
|
||||
}
|
||||
|
||||
bc.predefine(fn, [1,2])() === [];
|
||||
bc.predefine(fn, [1,2]).__length === 3;
|
||||
|
||||
var f = bc.wrap(fn2, {}, 10, true);
|
||||
f('1', 2) === 3;
|
||||
|
||||
var delegate = bc.delegate({}, 'ok');
|
||||
delegate.access('ok') === delegate;
|
||||
delegate.getter('getter').setter('setter') === delegate;
|
||||
delegate.all(['1','2']);
|
||||
delegate.revoke('adsf').access('asdf');
|
||||
|
||||
BetterCurry.wrap(fn2, {}, -1, false).__length === 10;
|
||||
Vendored
+50
@@ -0,0 +1,50 @@
|
||||
// Type definitions for better-curry
|
||||
// Project: https://github.com/pocesar/js-bettercurry
|
||||
// Definitions by: Paulo Cesar <https://github.com/pocesar>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare var BetterCurry: BetterCurryModule.BetterCurry;
|
||||
|
||||
declare module BetterCurryModule {
|
||||
|
||||
export interface DelegateOptions {
|
||||
as?: string;
|
||||
len?: number;
|
||||
args?: any[];
|
||||
name?: string;
|
||||
}
|
||||
|
||||
export class Delegate<T> {
|
||||
proto: T;
|
||||
target: string;
|
||||
methods: any[];
|
||||
getters: any[];
|
||||
setters: any[];
|
||||
all: (skip?: string[]) => void;
|
||||
method: (name: string|DelegateOptions) => Delegate<T>;
|
||||
getter: (name: string|DelegateOptions) => Delegate<T>;
|
||||
setter: (name: string|DelegateOptions) => Delegate<T>;
|
||||
access: (name: string|DelegateOptions) => Delegate<T>;
|
||||
revoke: (name: string) => Delegate<T>;
|
||||
constructor(proto: T, target: string);
|
||||
}
|
||||
|
||||
export interface OriginalFunctionReminder<T> extends Function {
|
||||
__length: number;
|
||||
}
|
||||
|
||||
export interface BetterCurry {
|
||||
predefine: <T extends Function>(fn: T, args: any[], context?: Object, len?: number, checkArguments?: boolean) => OriginalFunctionReminder<T>;
|
||||
wrap: <T extends Function>(fn: T, context?: Object, len?: number, checkArguments?: boolean) => OriginalFunctionReminder<T>;
|
||||
flatten: (...args: Array<Array<any>|any>) => any[];
|
||||
delegate: <T>(proto: T, target: string) => Delegate<T>;
|
||||
MAX_OPTIMIZED: number;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
declare module 'better-curry' {
|
||||
var bc: BetterCurryModule.BetterCurry;
|
||||
|
||||
export = bc;
|
||||
}
|
||||
Vendored
+2
-2
@@ -6,7 +6,7 @@
|
||||
|
||||
declare module BigJsLibrary {
|
||||
|
||||
export enum RoundingMode {
|
||||
export const enum RoundingMode {
|
||||
RoundTowardsZero = 0,
|
||||
RoundTowardsNearestAwayFromZero = 1,
|
||||
RoundTowardsNearestTowardsEven = 2,
|
||||
@@ -200,4 +200,4 @@ declare module BigJsLibrary {
|
||||
}
|
||||
}
|
||||
|
||||
declare var Big: BigJsLibrary.BigJS;
|
||||
declare var Big: BigJsLibrary.BigJS;
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
/// <reference path="bluebird-retry.d.ts" />
|
||||
/// <reference path="../bluebird/bluebird.d.ts" />
|
||||
import Promise = require('bluebird');
|
||||
import retry = require('bluebird-retry');
|
||||
|
||||
function promiseSuccess(text:string) {
|
||||
return Promise.resolve(text);
|
||||
};
|
||||
|
||||
var count = 0;
|
||||
function myfunc() {
|
||||
console.log('myfunc called ' + (++count) + ' times');
|
||||
if (count < 3) {
|
||||
throw new Error('i fail the first two times');
|
||||
} else {
|
||||
return promiseSuccess('i succeed the third time');
|
||||
}
|
||||
}
|
||||
|
||||
retry(myfunc)
|
||||
.done(function(result) { console.log(result); } );
|
||||
|
||||
|
||||
//Options example
|
||||
function logFail() {
|
||||
console.log(new Date().toISOString());
|
||||
throw new Error('bail');
|
||||
}
|
||||
|
||||
var options:retry.Options = {
|
||||
max_tries: 4,
|
||||
interval: 500
|
||||
};
|
||||
|
||||
retry(logFail, options);
|
||||
Vendored
+24
@@ -0,0 +1,24 @@
|
||||
// Type definitions for bluebird-retry
|
||||
// Project: https://github.com/jut-io/bluebird-retry
|
||||
// Definitions by: Pascal Vomhoff <https://github.com/pvomhoff>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../bluebird/bluebird.d.ts" />
|
||||
declare module "bluebird-retry" {
|
||||
import Promise = require('bluebird');
|
||||
|
||||
function retry<T>(func:(param:T)=>void, options?:retry.Options):Promise<T>;
|
||||
|
||||
module retry {
|
||||
export interface Options {
|
||||
interval?:number;
|
||||
backoff?:number;
|
||||
max_interval?:number;
|
||||
timeout?:number;
|
||||
max_tries?:number;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export = retry;
|
||||
}
|
||||
+7
@@ -137,6 +137,13 @@ interface JQueryEventObject {
|
||||
value: number|ChangeValue;
|
||||
}
|
||||
|
||||
interface SliderStatics {
|
||||
new (selector: string, opts: SliderOptions): Slider;
|
||||
prototype: Slider;
|
||||
}
|
||||
|
||||
declare var Slider: SliderStatics;
|
||||
|
||||
/**
|
||||
* This class is actually not used when using the jQuery version of bootstrap-slider
|
||||
* The method documentation is still here thouh.
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
/// <reference path="./bowser.d.ts" />
|
||||
|
||||
import Bowser = require('bowser');
|
||||
|
||||
Bowser.msedge === true;
|
||||
Bowser.test(['msie']) === true;
|
||||
Bowser.a === Bowser.c;
|
||||
Bowser.osversion > 10;
|
||||
Bowser.osversion === '10.1A';
|
||||
Bowser.osversion === '10.1A';
|
||||
|
||||
+13
-7
@@ -11,7 +11,7 @@ function test_dataType() {
|
||||
var x = typ.parentEnum === <breeze.core.IEnum> breeze.DataType;
|
||||
var isFalse = breeze.DataType.contains(breeze.DataType.Double);
|
||||
var dt = breeze.DataType.fromName("Decimal");
|
||||
|
||||
|
||||
}
|
||||
|
||||
function test_dataProperty() {
|
||||
@@ -33,7 +33,7 @@ function test_dataService() {
|
||||
var em = new breeze.EntityManager({
|
||||
dataService: ds
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
function test_entityAspect() {
|
||||
@@ -69,7 +69,7 @@ function test_entityAspect() {
|
||||
var errorsAdded = validationChangeArgs.added;
|
||||
var errorsCleared = validationChangeArgs.removed;
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
function test_entityKey() {
|
||||
@@ -132,7 +132,7 @@ function test_entityManager() {
|
||||
serviceName: "breeze/NorthwindIBModel",
|
||||
metadataStore: metadataStore
|
||||
});
|
||||
|
||||
|
||||
return new breeze.QueryOptions({
|
||||
mergeStrategy: null,
|
||||
fetchStrategy: this.fetchStrategy
|
||||
@@ -157,7 +157,7 @@ function test_entityManager() {
|
||||
|
||||
var cust2 = em1.createEntity("Customer", { companyName: "foo" });
|
||||
var cust3 = em1.createEntity("foo", { xxx: 3 }, breeze.EntityState.Added);
|
||||
|
||||
|
||||
em1.attachEntity(cust1, breeze.EntityState.Added);
|
||||
em1.clear();
|
||||
var em2 = em1.createEmptyCopy();
|
||||
@@ -246,7 +246,7 @@ function test_entityManager() {
|
||||
var custType = <breeze.EntityType> em1.metadataStore.getEntityType("Customer");
|
||||
var orderType = <breeze.EntityType> em1.metadataStore.getEntityType("Order");
|
||||
if (em1.hasChanges([custType, orderType])) { };
|
||||
|
||||
|
||||
var bundle = em1.exportEntities();
|
||||
window.localStorage.setItem("myEntityManager", bundle);
|
||||
var bundleFromStorage = window.localStorage.getItem("myEntityManager");
|
||||
@@ -434,7 +434,7 @@ function test_entityState() {
|
||||
return es === breeze.EntityState.Unchanged;
|
||||
var es = anEntity.entityAspect.entityState;
|
||||
return es.isUnchangedOrModified();
|
||||
|
||||
|
||||
return es === breeze.EntityState.Unchanged || es === breeze.EntityState.Modified;
|
||||
}
|
||||
|
||||
@@ -443,12 +443,14 @@ function test_entityType() {
|
||||
var myEntityType: breeze.EntityType;
|
||||
var dataProperty1: breeze.DataProperty, dataProperty2: breeze.DataProperty, navigationProperty1: breeze.DataProperty;
|
||||
var em1: breeze.EntityManager;
|
||||
/* NOTE https://github.com/borisyankov/DefinitelyTyped/pull/5590
|
||||
var entityManager = new breeze.EntityType({
|
||||
metadataStore: myMetadataStore,
|
||||
serviceName: "breeze/NorthwindIBModel",
|
||||
name: "person",
|
||||
namespace: "myAppNamespace"
|
||||
});
|
||||
*/
|
||||
myEntityType.addProperty(dataProperty1);
|
||||
myEntityType.addProperty(dataProperty2);
|
||||
myEntityType.addProperty(navigationProperty1);
|
||||
@@ -759,9 +761,11 @@ function test_validator() {
|
||||
orderType = <breeze.EntityType> em1.metadataStore.getEntityType("Order");
|
||||
var orderDateProperty = orderType.getProperty("OrderDate");
|
||||
orderDateProperty.validators.push(breeze.Validator.date());
|
||||
/* NOTE https://github.com/borisyankov/DefinitelyTyped/pull/5590
|
||||
var v0 = breeze.Validator.maxLength({ maxLength: 5, displayName: "City" });
|
||||
v0.validate("adasdfasdf");
|
||||
var errMessage = v0.getMessage();
|
||||
*/
|
||||
custType = <breeze.EntityType> em1.metadataStore.getEntityType("Customer");
|
||||
var customerIdProperty = custType.getProperty("CustomerID");
|
||||
customerIdProperty.validators.push(breeze.Validator.guid());
|
||||
@@ -788,6 +792,7 @@ function test_validator() {
|
||||
regionProperty.validators.push(breeze.Validator.string());
|
||||
custType = <breeze.EntityType> em1.metadataStore.getEntityType("Customer");
|
||||
regionProperty = custType.getProperty("Region");
|
||||
/* NOTE https://github.com/borisyankov/DefinitelyTyped/pull/5590
|
||||
regionProperty.validators.push(breeze.Validator.stringLength({ minLength: 2, maxLength: 5 }));
|
||||
var validator = breeze.Validator.maxLength({ maxLength: 5, displayName: "City" });
|
||||
var result = validator.validate("asdf");
|
||||
@@ -796,6 +801,7 @@ function test_validator() {
|
||||
var errMsg = result.errorMessage;
|
||||
var context = result.context;
|
||||
var sameValidator = result.validator;
|
||||
*/
|
||||
var valFn = function (v: any) {
|
||||
if (v == null) return true;
|
||||
return (v.substr(0,2) === "US");
|
||||
|
||||
Vendored
+308
@@ -0,0 +1,308 @@
|
||||
// Type definitions for chai 2.0.0
|
||||
// Project: http://chaijs.com/
|
||||
// Definitions by: Jed Mao <https://github.com/jedmao/>,
|
||||
// Bart van der Schoor <https://github.com/Bartvds>,
|
||||
// Andrew Brown <https://github.com/AGBrown>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module Chai {
|
||||
|
||||
interface ChaiStatic {
|
||||
expect: ExpectStatic;
|
||||
should(): Should;
|
||||
/**
|
||||
* Provides a way to extend the internals of Chai
|
||||
*/
|
||||
use(fn: (chai: any, utils: any) => void): any;
|
||||
assert: AssertStatic;
|
||||
config: Config;
|
||||
}
|
||||
|
||||
export interface ExpectStatic extends AssertionStatic {
|
||||
}
|
||||
|
||||
export interface AssertStatic extends Assert {
|
||||
}
|
||||
|
||||
export interface AssertionStatic {
|
||||
(target: any, message?: string): Assertion;
|
||||
}
|
||||
|
||||
interface ShouldAssertion {
|
||||
equal(value1: any, value2: any, message?: string): void;
|
||||
Throw: ShouldThrow;
|
||||
throw: ShouldThrow;
|
||||
exist(value: any, message?: string): void;
|
||||
}
|
||||
|
||||
interface Should extends ShouldAssertion {
|
||||
not: ShouldAssertion;
|
||||
fail(actual: any, expected: any, message?: string, operator?: string): void;
|
||||
}
|
||||
|
||||
interface ShouldThrow {
|
||||
(actual: Function): void;
|
||||
(actual: Function, expected: string|RegExp, message?: string): void;
|
||||
(actual: Function, constructor: Error|Function, expected?: string|RegExp, message?: string): void;
|
||||
}
|
||||
|
||||
interface Assertion extends LanguageChains, NumericComparison, TypeComparison {
|
||||
not: Assertion;
|
||||
deep: Deep;
|
||||
a: TypeComparison;
|
||||
an: TypeComparison;
|
||||
include: Include;
|
||||
contain: Include;
|
||||
ok: Assertion;
|
||||
true: Assertion;
|
||||
false: Assertion;
|
||||
null: Assertion;
|
||||
undefined: Assertion;
|
||||
exist: Assertion;
|
||||
empty: Assertion;
|
||||
arguments: Assertion;
|
||||
Arguments: Assertion;
|
||||
equal: Equal;
|
||||
equals: Equal;
|
||||
eq: Equal;
|
||||
eql: Equal;
|
||||
eqls: Equal;
|
||||
property: Property;
|
||||
ownProperty: OwnProperty;
|
||||
haveOwnProperty: OwnProperty;
|
||||
length: Length;
|
||||
lengthOf: Length;
|
||||
match(regexp: RegExp|string, message?: string): Assertion;
|
||||
string(string: string, message?: string): Assertion;
|
||||
keys: Keys;
|
||||
key(string: string): Assertion;
|
||||
throw: Throw;
|
||||
throws: Throw;
|
||||
Throw: Throw;
|
||||
respondTo(method: string, message?: string): Assertion;
|
||||
itself: Assertion;
|
||||
satisfy(matcher: Function, message?: string): Assertion;
|
||||
closeTo(expected: number, delta: number, message?: string): Assertion;
|
||||
members: Members;
|
||||
}
|
||||
|
||||
interface LanguageChains {
|
||||
to: Assertion;
|
||||
be: Assertion;
|
||||
been: Assertion;
|
||||
is: Assertion;
|
||||
that: Assertion;
|
||||
which: Assertion;
|
||||
and: Assertion;
|
||||
has: Assertion;
|
||||
have: Assertion;
|
||||
with: Assertion;
|
||||
at: Assertion;
|
||||
of: Assertion;
|
||||
same: Assertion;
|
||||
}
|
||||
|
||||
interface NumericComparison {
|
||||
above: NumberComparer;
|
||||
gt: NumberComparer;
|
||||
greaterThan: NumberComparer;
|
||||
least: NumberComparer;
|
||||
gte: NumberComparer;
|
||||
below: NumberComparer;
|
||||
lt: NumberComparer;
|
||||
lessThan: NumberComparer;
|
||||
most: NumberComparer;
|
||||
lte: NumberComparer;
|
||||
within(start: number, finish: number, message?: string): Assertion;
|
||||
}
|
||||
|
||||
interface NumberComparer {
|
||||
(value: number, message?: string): Assertion;
|
||||
}
|
||||
|
||||
interface TypeComparison {
|
||||
(type: string, message?: string): Assertion;
|
||||
instanceof: InstanceOf;
|
||||
instanceOf: InstanceOf;
|
||||
}
|
||||
|
||||
interface InstanceOf {
|
||||
(constructor: Object, message?: string): Assertion;
|
||||
}
|
||||
|
||||
interface Deep {
|
||||
equal: Equal;
|
||||
include: Include;
|
||||
property: Property;
|
||||
}
|
||||
|
||||
interface Equal {
|
||||
(value: any, message?: string): Assertion;
|
||||
}
|
||||
|
||||
interface Property {
|
||||
(name: string, value?: any, message?: string): Assertion;
|
||||
}
|
||||
|
||||
interface OwnProperty {
|
||||
(name: string, message?: string): Assertion;
|
||||
}
|
||||
|
||||
interface Length extends LanguageChains, NumericComparison {
|
||||
(length: number, message?: string): Assertion;
|
||||
}
|
||||
|
||||
interface Include {
|
||||
(value: Object, message?: string): Assertion;
|
||||
(value: string, message?: string): Assertion;
|
||||
(value: number, message?: string): Assertion;
|
||||
keys: Keys;
|
||||
members: Members;
|
||||
}
|
||||
|
||||
interface Keys {
|
||||
(...keys: string[]): Assertion;
|
||||
(keys: any[]): Assertion;
|
||||
}
|
||||
|
||||
interface Throw {
|
||||
(): Assertion;
|
||||
(expected: string, message?: string): Assertion;
|
||||
(expected: RegExp, message?: string): Assertion;
|
||||
(constructor: Error, expected?: string, message?: string): Assertion;
|
||||
(constructor: Error, expected?: RegExp, message?: string): Assertion;
|
||||
(constructor: Function, expected?: string, message?: string): Assertion;
|
||||
(constructor: Function, expected?: RegExp, message?: string): Assertion;
|
||||
}
|
||||
|
||||
interface Members {
|
||||
(set: any[], message?: string): Assertion;
|
||||
}
|
||||
|
||||
export interface Assert {
|
||||
/**
|
||||
* @param expression Expression to test for truthiness.
|
||||
* @param message Message to display on error.
|
||||
*/
|
||||
(expression: any, message?: string): void;
|
||||
|
||||
fail(actual?: any, expected?: any, msg?: string, operator?: string): void;
|
||||
|
||||
ok(val: any, msg?: string): void;
|
||||
notOk(val: any, msg?: string): void;
|
||||
|
||||
equal(act: any, exp: any, msg?: string): void;
|
||||
notEqual(act: any, exp: any, msg?: string): void;
|
||||
|
||||
strictEqual(act: any, exp: any, msg?: string): void;
|
||||
notStrictEqual(act: any, exp: any, msg?: string): void;
|
||||
|
||||
deepEqual(act: any, exp: any, msg?: string): void;
|
||||
notDeepEqual(act: any, exp: any, msg?: string): void;
|
||||
|
||||
isTrue(val: any, msg?: string): void;
|
||||
isFalse(val: any, msg?: string): void;
|
||||
|
||||
isNull(val: any, msg?: string): void;
|
||||
isNotNull(val: any, msg?: string): void;
|
||||
|
||||
isUndefined(val: any, msg?: string): void;
|
||||
isDefined(val: any, msg?: string): void;
|
||||
|
||||
isFunction(val: any, msg?: string): void;
|
||||
isNotFunction(val: any, msg?: string): void;
|
||||
|
||||
isObject(val: any, msg?: string): void;
|
||||
isNotObject(val: any, msg?: string): void;
|
||||
|
||||
isArray(val: any, msg?: string): void;
|
||||
isNotArray(val: any, msg?: string): void;
|
||||
|
||||
isString(val: any, msg?: string): void;
|
||||
isNotString(val: any, msg?: string): void;
|
||||
|
||||
isNumber(val: any, msg?: string): void;
|
||||
isNotNumber(val: any, msg?: string): void;
|
||||
|
||||
isBoolean(val: any, msg?: string): void;
|
||||
isNotBoolean(val: any, msg?: string): void;
|
||||
|
||||
typeOf(val: any, type: string, msg?: string): void;
|
||||
notTypeOf(val: any, type: string, msg?: string): void;
|
||||
|
||||
instanceOf(val: any, type: Function, msg?: string): void;
|
||||
notInstanceOf(val: any, type: Function, msg?: string): void;
|
||||
|
||||
include(exp: string, inc: any, msg?: string): void;
|
||||
include(exp: any[], inc: any, msg?: string): void;
|
||||
|
||||
notInclude(exp: string, inc: any, msg?: string): void;
|
||||
notInclude(exp: any[], inc: any, msg?: string): void;
|
||||
|
||||
match(exp: any, re: RegExp, msg?: string): void;
|
||||
notMatch(exp: any, re: RegExp, msg?: string): void;
|
||||
|
||||
property(obj: Object, prop: string, msg?: string): void;
|
||||
notProperty(obj: Object, prop: string, msg?: string): void;
|
||||
deepProperty(obj: Object, prop: string, msg?: string): void;
|
||||
notDeepProperty(obj: Object, prop: string, msg?: string): void;
|
||||
|
||||
propertyVal(obj: Object, prop: string, val: any, msg?: string): void;
|
||||
propertyNotVal(obj: Object, prop: string, val: any, msg?: string): void;
|
||||
|
||||
deepPropertyVal(obj: Object, prop: string, val: any, msg?: string): void;
|
||||
deepPropertyNotVal(obj: Object, prop: string, val: any, msg?: string): void;
|
||||
|
||||
lengthOf(exp: any, len: number, msg?: string): void;
|
||||
//alias frenzy
|
||||
throw(fn: Function, msg?: string): void;
|
||||
throw(fn: Function, regExp: RegExp): void;
|
||||
throw(fn: Function, errType: Function, msg?: string): void;
|
||||
throw(fn: Function, errType: Function, regExp: RegExp): void;
|
||||
|
||||
throws(fn: Function, msg?: string): void;
|
||||
throws(fn: Function, regExp: RegExp): void;
|
||||
throws(fn: Function, errType: Function, msg?: string): void;
|
||||
throws(fn: Function, errType: Function, regExp: RegExp): void;
|
||||
|
||||
Throw(fn: Function, msg?: string): void;
|
||||
Throw(fn: Function, regExp: RegExp): void;
|
||||
Throw(fn: Function, errType: Function, msg?: string): void;
|
||||
Throw(fn: Function, errType: Function, regExp: RegExp): void;
|
||||
|
||||
doesNotThrow(fn: Function, msg?: string): void;
|
||||
doesNotThrow(fn: Function, regExp: RegExp): void;
|
||||
doesNotThrow(fn: Function, errType: Function, msg?: string): void;
|
||||
doesNotThrow(fn: Function, errType: Function, regExp: RegExp): void;
|
||||
|
||||
operator(val: any, operator: string, val2: any, msg?: string): void;
|
||||
closeTo(act: number, exp: number, delta: number, msg?: string): void;
|
||||
|
||||
sameMembers(set1: any[], set2: any[], msg?: string): void;
|
||||
includeMembers(set1: any[], set2: any[], msg?: string): void;
|
||||
|
||||
ifError(val: any, msg?: string): void;
|
||||
}
|
||||
|
||||
export interface Config {
|
||||
includeStack: boolean;
|
||||
}
|
||||
|
||||
export class AssertionError {
|
||||
constructor(message: string, _props?: any, ssf?: Function);
|
||||
name: string;
|
||||
message: string;
|
||||
showDiff: boolean;
|
||||
stack: string;
|
||||
}
|
||||
}
|
||||
|
||||
declare var chai: Chai.ChaiStatic;
|
||||
|
||||
declare module "chai" {
|
||||
export = chai;
|
||||
}
|
||||
|
||||
interface Object {
|
||||
should: Chai.Assertion;
|
||||
}
|
||||
+248
-42
@@ -31,6 +31,16 @@ function fail() {
|
||||
err(() => {
|
||||
should.fail('foo', 'bar', 'should fail', 'equal');
|
||||
}, 'expected fail to throw an AssertionError');
|
||||
|
||||
err(() => {
|
||||
expect.fail('foo', 'bar');
|
||||
}, 'expected fail to throw an AssertionError');
|
||||
err(() => {
|
||||
expect.fail('foo', 'bar', 'should fail');
|
||||
}, 'expected fail to throw an AssertionError');
|
||||
err(() => {
|
||||
expect.fail('foo', 'bar', 'should fail', 'equal');
|
||||
}, 'expected fail to throw an AssertionError');
|
||||
}
|
||||
|
||||
// ReSharper disable once InconsistentNaming
|
||||
@@ -107,11 +117,20 @@ function _undefined() {
|
||||
}, 'expected \'\' to be undefined');
|
||||
}
|
||||
|
||||
function _NaN() {
|
||||
expect(NaN).to.be.NaN;
|
||||
expect(12).to.be.not.NaN;
|
||||
expect("NaN").to.be.not.NaN;
|
||||
(NaN).should.be.NaN;
|
||||
(12).should.be.not.NaN;
|
||||
("NaN").should.be.not.NaN;
|
||||
}
|
||||
|
||||
function exist() {
|
||||
var foo = 'bar';
|
||||
expect(foo).to.exist;
|
||||
should.exist(foo);
|
||||
expect(void(0)).to.not.exist;
|
||||
expect(void (0)).to.not.exist;
|
||||
should.not.exist(void (0));
|
||||
}
|
||||
|
||||
@@ -128,8 +147,8 @@ function argumentsTest() {
|
||||
}
|
||||
|
||||
function equal() {
|
||||
expect(undefined).to.equal(void(0));
|
||||
should.equal(undefined, void(0));
|
||||
expect(undefined).to.equal(void (0));
|
||||
should.equal(undefined, void (0));
|
||||
}
|
||||
|
||||
function _typeof() {
|
||||
@@ -372,6 +391,9 @@ function match() {
|
||||
expect('foobar').to.not.match(/^bar/);
|
||||
'foobar'.should.not.match(/^bar/);
|
||||
|
||||
expect('foobar').matches(/^foo/);
|
||||
'foobar'.should.not.matches(/^bar/);
|
||||
|
||||
err(() => {
|
||||
expect('foobar').to.match(/^bar/i, 'blah');
|
||||
'foobar'.should.match(/^bar/i, 'blah');
|
||||
@@ -490,8 +512,8 @@ function deepEqual3() {
|
||||
function deepInclude() {
|
||||
expect(['foo', 'bar']).to.deep.include(['bar', 'foo']);
|
||||
['foo', 'bar'].should.deep.include(['bar', 'foo']);
|
||||
expect(['foo', 'bar']).not.to.deep.equal(['foo', 'baz' ]);
|
||||
['foo', 'bar'].should.not.deep.equal(['foo', 'baz' ]);
|
||||
expect(['foo', 'bar']).not.to.deep.equal(['foo', 'baz']);
|
||||
['foo', 'bar'].should.not.deep.equal(['foo', 'baz']);
|
||||
}
|
||||
|
||||
class FakeArgs {
|
||||
@@ -670,6 +692,20 @@ function ownProperty() {
|
||||
}, 'blah: expected { length: 12 } to not have own property \'length\'');
|
||||
}
|
||||
|
||||
function ownPropertyDescriptor() {
|
||||
expect('test').to.have.ownPropertyDescriptor('length');
|
||||
expect('test').to.have.ownPropertyDescriptor('length', { enumerable: false, configurable: false, writable: false, value: 4 });
|
||||
expect('test').not.to.have.ownPropertyDescriptor('length', { enumerable: false, configurable: false, writable: false, value: 3 });
|
||||
expect('test').to.haveOwnPropertyDescriptor('length').to.have.property('enumerable', false);
|
||||
expect('test').to.haveOwnPropertyDescriptor('length').to.contain.keys('value');
|
||||
|
||||
'test'.should.have.ownPropertyDescriptor('length');
|
||||
'test'.should.have.ownPropertyDescriptor('length', { enumerable: false, configurable: false, writable: false, value: 4 });
|
||||
'test'.should.not.have.ownPropertyDescriptor('length', { enumerable: false, configurable: false, writable: false, value: 3 });
|
||||
'test'.should.haveOwnPropertyDescriptor('length').to.have.property('enumerable', false);
|
||||
'test'.should.haveOwnPropertyDescriptor('length').to.contain.keys('value');
|
||||
}
|
||||
|
||||
function string() {
|
||||
expect('foobar').to.have.string('bar');
|
||||
'foobar'.should.have.string('bar');
|
||||
@@ -707,6 +743,10 @@ function include() {
|
||||
['foo', 'bar'].should.not.include('baz');
|
||||
expect(['foo', 'bar']).to.not.include(1);
|
||||
['foo', 'bar'].should.not.include(1);
|
||||
// alias
|
||||
|
||||
expect(['foo', 'bar']).includes('foo');
|
||||
['foo', 'bar'].should.includes('foo');
|
||||
|
||||
err(() => {
|
||||
expect(['foo']).to.include('bar', 'blah');
|
||||
@@ -732,6 +772,14 @@ function keys() {
|
||||
({ foo: 1, bar: 2, baz: 3 }).should.contain.keys('bar', 'foo');
|
||||
expect({ foo: 1, bar: 2, baz: 3 }).to.contain.keys('baz');
|
||||
({ foo: 1, bar: 2, baz: 3 }).should.contain.keys('baz');
|
||||
// alias
|
||||
|
||||
expect({ foo: 1, bar: 2, baz: 3 }).contains.keys('baz');
|
||||
|
||||
expect({ foo: 1, bar: 2 }).to.have.all.keys(['foo', 'bar']);
|
||||
expect({ foo: 1, bar: 2 }).to.have.any.keys(['foo', 'bar']);
|
||||
({ foo: 1, bar: 2, baz: 3 }).should.contain.all.keys('baz');
|
||||
({ foo: 1, bar: 2, baz: 3 }).should.contain.any.keys('baz');
|
||||
|
||||
expect({ foo: 1, bar: 2 }).to.contain.keys('foo');
|
||||
({ foo: 1, bar: 2 }).should.contain.keys('foo');
|
||||
@@ -830,7 +878,28 @@ function chaining() {
|
||||
tea.should.be.a('object').and.have.property('name', 'chai');
|
||||
}
|
||||
|
||||
class PoorlyConstructedError {}
|
||||
function exxtensible() {
|
||||
expect({}).to.be.extensible;
|
||||
expect(Object.preventExtensions({})).to.be.not.extensible;
|
||||
({}).should.be.extensible;
|
||||
Object.preventExtensions({}).should.not.be.extensible;
|
||||
}
|
||||
function sealed() {
|
||||
expect({}).to.be.not.sealed;
|
||||
expect(Object.seal({})).to.be.sealed;
|
||||
({}).should.be.not.sealed;
|
||||
Object.seal({}).should.be.sealed;
|
||||
}
|
||||
|
||||
function frozen() {
|
||||
expect({}).to.be.not.frozen;
|
||||
expect(Object.freeze({})).to.be.frozen;
|
||||
({}).should.be.not.frozen;
|
||||
Object.freeze({}).should.be.frozen;
|
||||
}
|
||||
|
||||
|
||||
class PoorlyConstructedError { }
|
||||
function _throw() {
|
||||
// See GH-45: some poorly-constructed custom errors don't have useful names
|
||||
// on either their constructor or their constructor prototype, but instead
|
||||
@@ -1023,34 +1092,44 @@ function _throw() {
|
||||
}, 'blah: expected [Function] to throw error including \'hello\' but got \'testing\'');
|
||||
}
|
||||
|
||||
function use(){
|
||||
function use() {
|
||||
// ReSharper disable once InconsistentNaming
|
||||
chai.use((_chai) => {
|
||||
_chai.can.use.any();
|
||||
_chai.can.use.any();
|
||||
});
|
||||
}
|
||||
|
||||
class Klass {
|
||||
val: number;
|
||||
constructor() { this.val = 0; }
|
||||
bar() { }
|
||||
|
||||
static baz() { }
|
||||
}
|
||||
|
||||
function respondTo() {
|
||||
var bar = {};
|
||||
var obj = new Klass();
|
||||
|
||||
expect(Foo).to.respondTo('bar');
|
||||
Foo.should.respondTo('bar');
|
||||
expect(Foo).to.not.respondTo('foo');
|
||||
Foo.should.not.respondTo('foo');
|
||||
expect(Foo).itself.to.respondTo('func');
|
||||
expect(Foo).itself.not.to.respondTo('bar');
|
||||
expect(Klass).to.respondTo('bar');
|
||||
expect(obj).respondsTo('bar');
|
||||
Klass.should.respondTo('bar');
|
||||
Klass.should.respondsTo('bar');
|
||||
expect(Klass).to.not.respondTo('foo');
|
||||
Klass.should.not.respondTo('foo');
|
||||
expect(Klass).itself.to.respondTo('func');
|
||||
expect(Klass).itself.not.to.respondTo('bar');
|
||||
|
||||
expect(bar).to.respondTo('foo');
|
||||
bar.should.respondTo('foo');
|
||||
expect(obj).not.to.respondTo('foo');
|
||||
obj.should.not.respondTo('foo');
|
||||
|
||||
err(() => {
|
||||
expect(Foo).to.respondTo('baz', 'constructor');
|
||||
Foo.should.respondTo('baz', 'constructor');
|
||||
}, /^(constructor: expected)(.*)(\[Function: Foo\])(.*)(to respond to \'baz\')$/);
|
||||
expect(Klass).to.respondTo('baz', 'constructor');
|
||||
Klass.should.respondTo('baz', 'constructor');
|
||||
}, /^(constructor: expected)(.*)(\[Function: Klass\])(.*)(to respond to \'baz\')$/);
|
||||
|
||||
err(() => {
|
||||
expect(bar).to.respondTo('baz', 'object');
|
||||
bar.should.respondTo('baz', 'object');
|
||||
expect(obj).to.respondTo('baz', 'object');
|
||||
obj.should.respondTo('baz', 'object');
|
||||
}, /^(object: expected)(.*)(\{ foo: \[Function\] \}|\{ Object \()(.*)(to respond to \'baz\')$/);
|
||||
}
|
||||
|
||||
@@ -1116,6 +1195,23 @@ function sameMembers() {
|
||||
[5, 4].should.not.have.same.members([6, 3]);
|
||||
expect([5, 4]).to.not.have.same.members([5, 4, 2]);
|
||||
[5, 4].should.not.have.same.members([5, 4, 2]);
|
||||
|
||||
assert.sameMembers([5, 4], [4, 5]);
|
||||
}
|
||||
function sameDeepMembers() {
|
||||
expect([{ id: 5 }, { id: 4 }]).to.have.same.deep.members([{ id: 4 }, { id: 5 }]);
|
||||
[{ id: 5 }, { id: 4 }].should.have.same.deep.members([{ id: 4 }, { id: 5 }]);
|
||||
expect([{ id: 5 }, { id: 4 }]).to.have.same.members([{ id: 5 }, { id: 4 }]);
|
||||
[{ id: 5 }, { id: 4 }].should.have.same.members([{ id: 5 }, { id: 4 }]);
|
||||
|
||||
expect([{ id: 5 }, { id: 4 }]).to.not.have.same.members([]);
|
||||
[{ id: 5 }, { id: 4 }].should.not.have.same.members([]);
|
||||
expect([{ id: 5 }, { id: 4 }]).to.not.have.same.members([{ id: 6 }, { id: 3 }]);
|
||||
[{ id: 5 }, { id: 4 }].should.not.have.same.members([{ id: 6 }, { id: 3 }]);
|
||||
expect([{ id: 5 }, { id: 4 }]).to.not.have.same.members([{ id: 5 }, { id: 4 }, { id: 2 }]);
|
||||
[{ id: 5 }, { id: 4 }].should.not.have.same.members([{ id: 5 }, { id: 4 }, { id: 2 }]);
|
||||
|
||||
assert.sameDeepMembers([{ id: 5 }, { id: 4 }], [{ id: 4 }, { id: 5 }]);
|
||||
}
|
||||
|
||||
function members() {
|
||||
@@ -1127,16 +1223,48 @@ function members() {
|
||||
expect([5, 4]).not.members([5, 4, 2]);
|
||||
}
|
||||
|
||||
function increaseDecreaseChange() {
|
||||
var obj = { val: 10 };
|
||||
var inc = () => { obj.val++; };
|
||||
var dec = () => { obj.val--; };
|
||||
var same = () => { };
|
||||
|
||||
expect(inc).to.increase(obj, "val");
|
||||
expect(inc).increases(obj, "val");
|
||||
expect(inc).to.change(obj, "val");
|
||||
|
||||
expect(dec).to.decrease(obj, "val");
|
||||
expect(dec).decreases(obj, "val");
|
||||
expect(dec).to.change(obj, "val");
|
||||
expect(dec).changes(obj, "val");
|
||||
|
||||
expect(inc).to.not.decrease(obj, "val");
|
||||
expect(dec).to.not.increase(obj, "val");
|
||||
expect(same).to.not.increase(obj, "val");
|
||||
expect(same).to.not.decrease(obj, "val");
|
||||
expect(same).to.not.change(obj, "val");
|
||||
|
||||
inc.should.increase(obj, "val");
|
||||
inc.should.change(obj, "val");
|
||||
|
||||
dec.should.decrease(obj, "val");
|
||||
dec.should.change(obj, "val");
|
||||
|
||||
inc.should.not.decrease(obj, "val");
|
||||
dec.should.not.increase(obj, "val");
|
||||
same.should.not.change(obj, "val");
|
||||
}
|
||||
|
||||
//tdd
|
||||
declare function suite(description: string, action: Function):void;
|
||||
declare function test(description: string, action: Function):void;
|
||||
declare function suite(description: string, action: Function): void;
|
||||
declare function test(description: string, action: Function): void;
|
||||
|
||||
interface FieldObj {
|
||||
field: any;
|
||||
}
|
||||
|
||||
class CrashyObject {
|
||||
inspect (): void {
|
||||
inspect(): void {
|
||||
throw new Error('Arg\'s inspect() called even though the test passed');
|
||||
}
|
||||
}
|
||||
@@ -1172,6 +1300,9 @@ suite('assert', () => {
|
||||
assert.ok(true);
|
||||
assert.ok(1);
|
||||
assert.ok('test');
|
||||
assert.isOk(true);
|
||||
assert.isOk(1);
|
||||
assert.isOk('test');
|
||||
|
||||
err(() => {
|
||||
assert.ok(false);
|
||||
@@ -1186,6 +1317,27 @@ suite('assert', () => {
|
||||
}, 'expected \'\' to be truthy');
|
||||
});
|
||||
|
||||
test('notOk', () => {
|
||||
assert.notOk(false);
|
||||
assert.notOk(0);
|
||||
assert.notOk('');
|
||||
assert.isNotOk(false);
|
||||
assert.isNotOk(0);
|
||||
assert.isNotOk('');
|
||||
|
||||
err(() => {
|
||||
assert.notOk(true);
|
||||
}, 'expected true to be falsy');
|
||||
|
||||
err(() => {
|
||||
assert.notOk(1);
|
||||
}, 'expected 1 to be falsy');
|
||||
|
||||
err(() => {
|
||||
assert.notOk('test');
|
||||
}, 'expected \'test\' to be falsy');
|
||||
});
|
||||
|
||||
test('isFalse', () => {
|
||||
assert.isFalse(false);
|
||||
|
||||
@@ -1199,7 +1351,7 @@ suite('assert', () => {
|
||||
});
|
||||
|
||||
test('equal', () => {
|
||||
assert.equal(void(0), undefined);
|
||||
assert.equal(void (0), undefined);
|
||||
});
|
||||
|
||||
test('typeof / notTypeOf', () => {
|
||||
@@ -1288,19 +1440,19 @@ suite('assert', () => {
|
||||
});
|
||||
|
||||
test('deepEqual', () => {
|
||||
assert.deepEqual({tea: 'chai'}, {tea: 'chai'});
|
||||
assert.deepEqual({ tea: 'chai' }, { tea: 'chai' });
|
||||
|
||||
err(() => {
|
||||
assert.deepEqual({tea: 'chai'}, {tea: 'black'});
|
||||
assert.deepEqual({ tea: 'chai' }, { tea: 'black' });
|
||||
}, 'expected { tea: \'chai\' } to deeply equal { tea: \'black\' }');
|
||||
|
||||
var obja = Object.create({ tea: 'chai' })
|
||||
, objb = Object.create({ tea: 'chai' });
|
||||
, objb = Object.create({ tea: 'chai' });
|
||||
|
||||
assert.deepEqual(obja, objb);
|
||||
|
||||
var obj1 = Object.create({tea: 'chai'})
|
||||
, obj2 = Object.create({tea: 'black'});
|
||||
var obj1 = Object.create({ tea: 'chai' })
|
||||
, obj2 = Object.create({ tea: 'black' });
|
||||
|
||||
err(() => {
|
||||
assert.deepEqual(obj1, obj2);
|
||||
@@ -1309,13 +1461,13 @@ suite('assert', () => {
|
||||
|
||||
test('deepEqual (ordering)', () => {
|
||||
var a = { a: 'b', c: 'd' }
|
||||
, b = { c: 'd', a: 'b' };
|
||||
, b = { c: 'd', a: 'b' };
|
||||
assert.deepEqual(a, b);
|
||||
});
|
||||
|
||||
test('deepEqual (circular)', () => {
|
||||
var circularObject:any = {}
|
||||
, secondCircularObject:any = {};
|
||||
var circularObject: any = {}
|
||||
, secondCircularObject: any = {};
|
||||
circularObject.field = circularObject;
|
||||
secondCircularObject.field = secondCircularObject;
|
||||
|
||||
@@ -1328,15 +1480,15 @@ suite('assert', () => {
|
||||
});
|
||||
|
||||
test('notDeepEqual', () => {
|
||||
assert.notDeepEqual({tea: 'jasmine'}, {tea: 'chai'});
|
||||
assert.notDeepEqual({ tea: 'jasmine' }, { tea: 'chai' });
|
||||
err(() => {
|
||||
assert.notDeepEqual({tea: 'chai'}, {tea: 'chai'});
|
||||
assert.notDeepEqual({ tea: 'chai' }, { tea: 'chai' });
|
||||
}, 'expected { tea: \'chai\' } to not deeply equal { tea: \'chai\' }');
|
||||
});
|
||||
|
||||
test('notDeepEqual (circular)', () => {
|
||||
var circularObject:any = {}
|
||||
, secondCircularObject:any = { tea: 'jasmine' };
|
||||
var circularObject: any = {}
|
||||
, secondCircularObject: any = { tea: 'jasmine' };
|
||||
circularObject.field = circularObject;
|
||||
secondCircularObject.field = secondCircularObject;
|
||||
|
||||
@@ -1380,6 +1532,22 @@ suite('assert', () => {
|
||||
}, 'expected undefined to not equal undefined');
|
||||
});
|
||||
|
||||
test('isNaN', () => {
|
||||
assert.isNaN(NaN);
|
||||
|
||||
err(() => {
|
||||
assert.isNaN(12);
|
||||
}, 'expected 12 to be NaN');
|
||||
});
|
||||
|
||||
test('isNotNaN', () => {
|
||||
assert.isNotNaN(12);
|
||||
|
||||
err(() => {
|
||||
assert.isNotNaN(NaN);
|
||||
}, 'expected NaN to not NaN');
|
||||
});
|
||||
|
||||
test('isFunction', () => {
|
||||
var func = () => {
|
||||
};
|
||||
@@ -1431,7 +1599,7 @@ suite('assert', () => {
|
||||
|
||||
test('isNotString', () => {
|
||||
assert.isNotString(3);
|
||||
assert.isNotString([ 'hello' ]);
|
||||
assert.isNotString(['hello']);
|
||||
|
||||
err(() => {
|
||||
assert.isNotString('hello');
|
||||
@@ -1449,7 +1617,7 @@ suite('assert', () => {
|
||||
|
||||
test('isNotNumber', () => {
|
||||
assert.isNotNumber('hello');
|
||||
assert.isNotNumber([ 5 ]);
|
||||
assert.isNotNumber([5]);
|
||||
|
||||
err(() => {
|
||||
assert.isNotNumber(4);
|
||||
@@ -1479,7 +1647,7 @@ suite('assert', () => {
|
||||
|
||||
test('include', () => {
|
||||
assert.include('foobar', 'bar');
|
||||
assert.include([ 1, 2, 3], 3);
|
||||
assert.include([1, 2, 3], 3);
|
||||
|
||||
err(() => {
|
||||
assert.include('foobar', 'baz');
|
||||
@@ -1492,7 +1660,7 @@ suite('assert', () => {
|
||||
|
||||
test('notInclude', () => {
|
||||
assert.notInclude('foobar', 'baz');
|
||||
assert.notInclude([ 1, 2, 3 ], 4);
|
||||
assert.notInclude([1, 2, 3], 4);
|
||||
|
||||
err(() => {
|
||||
assert.notInclude('foobar', 'bar');
|
||||
@@ -1739,4 +1907,42 @@ suite('assert', () => {
|
||||
}, 'expected [ 1, 54 ] to have the same members as [ 6, 1, 54 ]');
|
||||
});
|
||||
|
||||
|
||||
test('isAbove', () => {
|
||||
assert.isAbove(10, 5);
|
||||
|
||||
err(() => {
|
||||
assert.isAbove(1, 5);
|
||||
}, 'expected 1 to be above 5');
|
||||
err(() => {
|
||||
assert.isAbove(5, 5);
|
||||
}, 'expected 5 to be above 5');
|
||||
});
|
||||
|
||||
test('isBelow', () => {
|
||||
assert.isBelow(5, 10);
|
||||
|
||||
err(() => {
|
||||
assert.isBelow(5, 1);
|
||||
}, 'expected 5 to be above 1');
|
||||
err(() => {
|
||||
assert.isBelow(5, 5);
|
||||
}, 'expected 5 to be below 5');
|
||||
});
|
||||
|
||||
test('extensible', () => { assert.extensible({}); });
|
||||
test('isExtensible', () => { assert.isExtensible({}); });
|
||||
test('notExtensible', () => { assert.notExtensible(Object.preventExtensions({})); });
|
||||
test('isNotExtensible', () => { assert.isNotExtensible(Object.preventExtensions({})); });
|
||||
|
||||
test('sealed', () => { assert.sealed(Object.seal({})); });
|
||||
test('isSealed', () => { assert.isSealed(Object.seal({})); });
|
||||
test('notSealed', () => { assert.notSealed({}); });
|
||||
test('isNotSealed', () => { assert.isNotSealed({}); });
|
||||
|
||||
test('frozen', () => { assert.frozen(Object.freeze({})); });
|
||||
test('isFrozen', () => { assert.isFrozen(Object.freeze({})); });
|
||||
test('notFrozen', () => { assert.notFrozen({}); });
|
||||
test('isNotFrozen', () => { assert.isNotFrozen({}); });
|
||||
|
||||
});
|
||||
|
||||
Vendored
+87
-7
@@ -1,10 +1,13 @@
|
||||
// Type definitions for chai 2.0.0
|
||||
// Type definitions for chai 3.2.0
|
||||
// Project: http://chaijs.com/
|
||||
// Definitions by: Jed Mao <https://github.com/jedmao/>,
|
||||
// Bart van der Schoor <https://github.com/Bartvds>,
|
||||
// Andrew Brown <https://github.com/AGBrown>
|
||||
// Andrew Brown <https://github.com/AGBrown>,
|
||||
// Olivier Chevet <https://github.com/olivr70>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
// <reference path="../assertion-error/assertion-error.d.ts"/>
|
||||
|
||||
declare module Chai {
|
||||
|
||||
interface ChaiStatic {
|
||||
@@ -16,9 +19,11 @@ declare module Chai {
|
||||
use(fn: (chai: any, utils: any) => void): any;
|
||||
assert: AssertStatic;
|
||||
config: Config;
|
||||
AssertionError: AssertionError;
|
||||
}
|
||||
|
||||
export interface ExpectStatic extends AssertionStatic {
|
||||
fail(actual?: any, expected?: any, message?: string, operator?: string): void;
|
||||
}
|
||||
|
||||
export interface AssertStatic extends Assert {
|
||||
@@ -49,15 +54,20 @@ declare module Chai {
|
||||
interface Assertion extends LanguageChains, NumericComparison, TypeComparison {
|
||||
not: Assertion;
|
||||
deep: Deep;
|
||||
any: KeyFilter;
|
||||
all: KeyFilter;
|
||||
a: TypeComparison;
|
||||
an: TypeComparison;
|
||||
include: Include;
|
||||
includes: Include;
|
||||
contain: Include;
|
||||
contains: Include;
|
||||
ok: Assertion;
|
||||
true: Assertion;
|
||||
false: Assertion;
|
||||
null: Assertion;
|
||||
undefined: Assertion;
|
||||
NaN: Assertion;
|
||||
exist: Assertion;
|
||||
empty: Assertion;
|
||||
arguments: Assertion;
|
||||
@@ -70,20 +80,35 @@ declare module Chai {
|
||||
property: Property;
|
||||
ownProperty: OwnProperty;
|
||||
haveOwnProperty: OwnProperty;
|
||||
ownPropertyDescriptor: OwnPropertyDescriptor;
|
||||
haveOwnPropertyDescriptor: OwnPropertyDescriptor;
|
||||
length: Length;
|
||||
lengthOf: Length;
|
||||
match(regexp: RegExp|string, message?: string): Assertion;
|
||||
match: Match;
|
||||
matches: Match;
|
||||
string(string: string, message?: string): Assertion;
|
||||
keys: Keys;
|
||||
key(string: string): Assertion;
|
||||
throw: Throw;
|
||||
throws: Throw;
|
||||
Throw: Throw;
|
||||
respondTo(method: string, message?: string): Assertion;
|
||||
respondTo: RespondTo;
|
||||
respondsTo: RespondTo;
|
||||
itself: Assertion;
|
||||
satisfy(matcher: Function, message?: string): Assertion;
|
||||
satisfy: Satisfy;
|
||||
satisfies: Satisfy;
|
||||
closeTo(expected: number, delta: number, message?: string): Assertion;
|
||||
members: Members;
|
||||
increase: PropertyChange;
|
||||
increases: PropertyChange;
|
||||
decrease: PropertyChange;
|
||||
decreases: PropertyChange;
|
||||
change: PropertyChange;
|
||||
changes: PropertyChange;
|
||||
extensible: Assertion;
|
||||
sealed: Assertion;
|
||||
frozen: Assertion;
|
||||
|
||||
}
|
||||
|
||||
interface LanguageChains {
|
||||
@@ -134,6 +159,11 @@ declare module Chai {
|
||||
equal: Equal;
|
||||
include: Include;
|
||||
property: Property;
|
||||
members: Members;
|
||||
}
|
||||
|
||||
interface KeyFilter {
|
||||
keys: Keys;
|
||||
}
|
||||
|
||||
interface Equal {
|
||||
@@ -148,6 +178,11 @@ declare module Chai {
|
||||
(name: string, message?: string): Assertion;
|
||||
}
|
||||
|
||||
interface OwnPropertyDescriptor {
|
||||
(name: string, descriptor: PropertyDescriptor, message?: string): Assertion;
|
||||
(name: string, message?: string): Assertion;
|
||||
}
|
||||
|
||||
interface Length extends LanguageChains, NumericComparison {
|
||||
(length: number, message?: string): Assertion;
|
||||
}
|
||||
@@ -158,11 +193,18 @@ declare module Chai {
|
||||
(value: number, message?: string): Assertion;
|
||||
keys: Keys;
|
||||
members: Members;
|
||||
any: KeyFilter;
|
||||
all: KeyFilter;
|
||||
}
|
||||
|
||||
interface Match {
|
||||
(regexp: RegExp|string, message?: string): Assertion;
|
||||
}
|
||||
|
||||
interface Keys {
|
||||
(...keys: string[]): Assertion;
|
||||
(keys: any[]): Assertion;
|
||||
(keys: Object): Assertion;
|
||||
}
|
||||
|
||||
interface Throw {
|
||||
@@ -175,10 +217,22 @@ declare module Chai {
|
||||
(constructor: Function, expected?: RegExp, message?: string): Assertion;
|
||||
}
|
||||
|
||||
interface RespondTo {
|
||||
(method: string, message?: string): Assertion;
|
||||
}
|
||||
|
||||
interface Satisfy {
|
||||
(matcher: Function, message?: string): Assertion;
|
||||
}
|
||||
|
||||
interface Members {
|
||||
(set: any[], message?: string): Assertion;
|
||||
}
|
||||
|
||||
interface PropertyChange {
|
||||
(object: Object, prop: string, msg?: string): Assertion;
|
||||
}
|
||||
|
||||
export interface Assert {
|
||||
/**
|
||||
* @param expression Expression to test for truthiness.
|
||||
@@ -189,7 +243,9 @@ declare module Chai {
|
||||
fail(actual?: any, expected?: any, msg?: string, operator?: string): void;
|
||||
|
||||
ok(val: any, msg?: string): void;
|
||||
isOk(val: any, msg?: string): void;
|
||||
notOk(val: any, msg?: string): void;
|
||||
isNotOk(val: any, msg?: string): void;
|
||||
|
||||
equal(act: any, exp: any, msg?: string): void;
|
||||
notEqual(act: any, exp: any, msg?: string): void;
|
||||
@@ -209,6 +265,12 @@ declare module Chai {
|
||||
isUndefined(val: any, msg?: string): void;
|
||||
isDefined(val: any, msg?: string): void;
|
||||
|
||||
isNaN(val: any, msg?: string): void;
|
||||
isNotNaN(val: any, msg?: string): void;
|
||||
|
||||
isAbove(val: number, abv: number, msg?: string): void;
|
||||
isBelow(val: number, blw: number, msg?: string): void;
|
||||
|
||||
isFunction(val: any, msg?: string): void;
|
||||
isNotFunction(val: any, msg?: string): void;
|
||||
|
||||
@@ -279,9 +341,27 @@ declare module Chai {
|
||||
closeTo(act: number, exp: number, delta: number, msg?: string): void;
|
||||
|
||||
sameMembers(set1: any[], set2: any[], msg?: string): void;
|
||||
includeMembers(set1: any[], set2: any[], msg?: string): void;
|
||||
sameDeepMembers(set1: any[], set2: any[], msg?: string): void;
|
||||
includeMembers(superset: any[], subset: any[], msg?: string): void;
|
||||
|
||||
ifError(val: any, msg?: string): void;
|
||||
|
||||
isExtensible(obj: {}, msg?: string): void;
|
||||
extensible(obj: {}, msg?: string): void;
|
||||
isNotExtensible(obj: {}, msg?: string): void;
|
||||
notExtensible(obj: {}, msg?: string): void;
|
||||
|
||||
isSealed(obj: {}, msg?: string): void;
|
||||
sealed(obj: {}, msg?: string): void;
|
||||
isNotSealed(obj: {}, msg?: string): void;
|
||||
notSealed(obj: {}, msg?: string): void;
|
||||
|
||||
isFrozen(obj: Object, msg?: string): void;
|
||||
frozen(obj: Object, msg?: string): void;
|
||||
isNotFrozen(obj: Object, msg?: string): void;
|
||||
notFrozen(obj: Object, msg?: string): void;
|
||||
|
||||
|
||||
}
|
||||
|
||||
export interface Config {
|
||||
@@ -305,4 +385,4 @@ declare module "chai" {
|
||||
|
||||
interface Object {
|
||||
should: Chai.Assertion;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/// <reference path="cheerio.d.ts" />
|
||||
|
||||
import cheerio from 'cheerio';
|
||||
import * as cheerio from 'cheerio';
|
||||
|
||||
/*
|
||||
* LOADING
|
||||
@@ -29,7 +29,7 @@ $ = cheerio.load(html, {
|
||||
normalizeWhitespace: true,
|
||||
xmlMode: true,
|
||||
decodeEntities: true,
|
||||
lowercaseTags: true,
|
||||
lowerCaseTags: true,
|
||||
lowerCaseAttributeNames: true,
|
||||
recognizeCDATA: true,
|
||||
recognizeSelfClosing: true
|
||||
|
||||
Vendored
+1
-1
@@ -262,5 +262,5 @@ interface CheerioAPI extends CheerioSelector {
|
||||
declare var cheerio:CheerioAPI;
|
||||
|
||||
declare module "cheerio" {
|
||||
export default cheerio;
|
||||
export = cheerio;
|
||||
}
|
||||
|
||||
Vendored
+8
-3
@@ -1,13 +1,18 @@
|
||||
// Type definitions for classnames
|
||||
// Project: https://github.com/JedWatson/classnames
|
||||
// Definitions by: Dave Keen <http://www.keendevelopment.ch>
|
||||
// Definitions by: Dave Keen <http://www.keendevelopment.ch>, Adi Dahiya <https://github.com/adidahiya>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
interface ClassDictionary {
|
||||
[id: string]: boolean;
|
||||
}
|
||||
|
||||
interface ClassNamesFn {
|
||||
(...classes: (string | ClassDictionary)[]): string;
|
||||
}
|
||||
|
||||
declare var classNames: ClassNamesFn;
|
||||
|
||||
declare module "classnames" {
|
||||
function classNames(...classes: (string|ClassDictionary)[]): string;
|
||||
export = classNames
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
/// <reference path="./clone.d.ts" />
|
||||
|
||||
import clone = require("clone");
|
||||
|
||||
var original = {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/// <reference path="codemirror.d.ts" />
|
||||
/// <reference path="showhint.d.ts" />
|
||||
/// <reference path="codemirror-showhint.d.ts" />
|
||||
var doc = new CodeMirror.Doc('text');
|
||||
var pos = new CodeMirror.Pos(2, 3);
|
||||
CodeMirror.showHint(doc);
|
||||
+23
-11
@@ -1,10 +1,12 @@
|
||||
// Type definitions for CodeMirror
|
||||
// Project: https://github.com/marijnh/CodeMirror
|
||||
// Definitions by: jacqt <https://github.com/jacqt>
|
||||
// Definitions by: jacqt <https://github.com/jacqt>, basarat <https://github.com/basarat>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
// See docs https://codemirror.net/doc/manual.html#addon_show-hint
|
||||
|
||||
declare module CodeMirror {
|
||||
var commands : any;
|
||||
var commands: any;
|
||||
|
||||
/** Provides a framework for showing autocompletion hints. Defines editor.showHint, which takes an optional
|
||||
options object, and pops up a widget that allows the user to select a completion. Finding hints is done with
|
||||
@@ -12,13 +14,12 @@ declare module CodeMirror {
|
||||
and return a {list, from, to} object, where list is an array of strings or objects (the completions), and
|
||||
from and to give the start and end of the token that is being completed as {line, ch} objects. An optional
|
||||
selectedHint property (an integer) can be added to the completion object to control the initially selected hint. */
|
||||
function showHint (cm: CodeMirror.Doc, hinter?: (doc : CodeMirror.Doc) => Hints, options?: IShowHintOptions) : void;
|
||||
|
||||
function showHint(cm: CodeMirror.Doc, hinter?: (doc: CodeMirror.Doc) => Hints, options?: ShowHintOptions): void;
|
||||
|
||||
interface Hints {
|
||||
from: Position;
|
||||
to: Position;
|
||||
list: Hint[] | string[];
|
||||
list: (Hint | string)[];
|
||||
}
|
||||
|
||||
/** Interface used by showHint.js Codemirror add-on
|
||||
@@ -28,25 +29,27 @@ declare module CodeMirror {
|
||||
className?: string;
|
||||
displayText?: string;
|
||||
from?: Position;
|
||||
render?: (element: any, self: any, data: any) => void;
|
||||
/** Called if a completion is picked. If provided *you* are responsible for applying the completion */
|
||||
hint?: (cm: any, data: Hints, cur: Hint) => void;
|
||||
render?: (element: HTMLLIElement, data: Hints, cur: Hint) => void;
|
||||
to?: Position;
|
||||
}
|
||||
|
||||
interface Editor {
|
||||
/** An extension of the existing CodeMirror typings for the Editor.on("keyup", func) syntax */
|
||||
on(eventName: string, handler: (doc: CodeMirror.Doc, event : any ) => void ): void;
|
||||
off(eventName: string, handler: (doc: CodeMirror.Doc, event : any) => void ): void;
|
||||
on(eventName: string, handler: (doc: CodeMirror.Doc, event: any) => void): void;
|
||||
off(eventName: string, handler: (doc: CodeMirror.Doc, event: any) => void): void;
|
||||
}
|
||||
|
||||
/** Extend CodeMirror.Doc with a state object, so that the Doc.state.completionActive property is reachable*/
|
||||
interface Doc {
|
||||
state: any;
|
||||
showHint: (options: IShowHintOptions) => void;
|
||||
showHint: (options: ShowHintOptions) => void;
|
||||
}
|
||||
|
||||
interface IShowHintOptions {
|
||||
interface ShowHintOptions {
|
||||
completeSingle: boolean;
|
||||
hint: (doc : CodeMirror.Doc) => Hints;
|
||||
hint: (doc: CodeMirror.Doc) => Hints;
|
||||
}
|
||||
|
||||
/** The Handle used to interact with the autocomplete dialog box.*/
|
||||
@@ -59,4 +62,13 @@ declare module CodeMirror {
|
||||
pick(): void;
|
||||
data: any;
|
||||
}
|
||||
|
||||
interface EditorConfiguration {
|
||||
showHint?: boolean;
|
||||
hintOptions?: ShowHintOptions;
|
||||
}
|
||||
}
|
||||
|
||||
declare module "codemirror/addon/hint/show-hint" {
|
||||
export = CodeMirror;
|
||||
}
|
||||
Vendored
+4
@@ -1090,3 +1090,7 @@ declare module CodeMirror {
|
||||
to?: Position;
|
||||
}
|
||||
}
|
||||
|
||||
declare module "codemirror" {
|
||||
export = CodeMirror;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/// <reference path="../express/express.d.ts"/>
|
||||
/// <reference path="./connect-slashes.d.ts"/>
|
||||
|
||||
import express = require('express');
|
||||
import slashes = require('connect-slashes');
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
/// <reference path="./contextjs.d.ts" />
|
||||
|
||||
import context = require("contextjs");
|
||||
|
||||
context.init();
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
/// <reference path="./convert-source-map.d.ts" />
|
||||
|
||||
import convert = require("convert-source-map");
|
||||
|
||||
var json = convert
|
||||
@@ -10,4 +12,4 @@ var modified = convert
|
||||
.toJSON();
|
||||
|
||||
console.log(json);
|
||||
console.log(modified);
|
||||
console.log(modified);
|
||||
|
||||
Vendored
+2
-1
@@ -1,4 +1,4 @@
|
||||
// Type definitions for cookie-parser
|
||||
// Type definitions for cookie-parser v1.3.4
|
||||
// Project: https://github.com/expressjs/cookie-parser
|
||||
// Definitions by: Santi Albo <https://github.com/santialbo/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
@@ -8,5 +8,6 @@
|
||||
declare module "cookie-parser" {
|
||||
import express = require('express');
|
||||
function e(secret?: string, options?: any): express.RequestHandler;
|
||||
namespace e{}
|
||||
export = e;
|
||||
}
|
||||
Vendored
+21
-4
@@ -1,17 +1,32 @@
|
||||
// Type definitions for Apache Cordova Vibration plugin.
|
||||
// Project: https://github.com/apache/cordova-plugin-vibration
|
||||
// Definitions by: Microsoft Open Technologies, Inc. <http://msopentech.com>
|
||||
// Definitions by: Microsoft Open Technologies, Inc. <http://msopentech.com>, Louis Lagrange <https://github.com/Minishlink/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
//
|
||||
//
|
||||
// Copyright (c) Microsoft Open Technologies, Inc.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
interface Navigator {
|
||||
/**
|
||||
* Vibrates the device for the specified amount of time.
|
||||
* @param time Milliseconds to vibrate the device. 0 cancels the vibration. Ignored on iOS.
|
||||
*/
|
||||
vibrate(time: number): void;
|
||||
|
||||
/**
|
||||
* Vibrates the device with a given pattern.
|
||||
* @param time Sequence of durations (in milliseconds) for which to turn on or off the vibrator. Ignored on iOS.
|
||||
*/
|
||||
vibrate(time: number[]): void;
|
||||
}
|
||||
|
||||
interface Notification {
|
||||
/**
|
||||
* Vibrates the device for the specified amount of time.
|
||||
* @param time Milliseconds to vibrate the device. Ignored on iOS.
|
||||
* @deprecated
|
||||
*/
|
||||
vibrate(time: number): void
|
||||
vibrate(time: number): void;
|
||||
/**
|
||||
* Vibrates the device with a given pattern.
|
||||
* @param number[] pattern Pattern with which to vibrate the device.
|
||||
@@ -19,10 +34,12 @@ interface Notification {
|
||||
* The next value - the number of milliseconds for which to keep the vibrator on before turning it off.
|
||||
* @param number repeat Optional index into the pattern array at which to start repeating (will repeat until canceled),
|
||||
* or -1 for no repetition (default).
|
||||
* @deprecated
|
||||
*/
|
||||
vibrateWithPattern(pattern: number[], repeat: number): void;
|
||||
/**
|
||||
* Immediately cancels any currently running vibration.
|
||||
* @deprecated
|
||||
*/
|
||||
cancelVibration(): void;
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+146
-151
@@ -22,13 +22,13 @@ declare type PropertyKey = string | number | symbol;
|
||||
|
||||
// #############################################################################################
|
||||
// ECMAScript 6: Object & Function
|
||||
// Modules: es6.object.assign, es6.object.is, es6.object.set-prototype-of,
|
||||
// Modules: es6.object.assign, es6.object.is, es6.object.set-prototype-of,
|
||||
// es6.object.to-string, es6.function.name and es6.function.has-instance.
|
||||
// #############################################################################################
|
||||
|
||||
|
||||
interface ObjectConstructor {
|
||||
/**
|
||||
* Copy the values of all of the enumerable own properties from one or more source objects to a
|
||||
* Copy the values of all of the enumerable own properties from one or more source objects to a
|
||||
* target object. Returns the target object.
|
||||
* @param target The target object to copy to.
|
||||
* @param sources One or more source objects to copy properties from.
|
||||
@@ -57,10 +57,10 @@ interface Function {
|
||||
*/
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* Determines if a constructor object recognizes an object as one of the
|
||||
/**
|
||||
* Determines if a constructor object recognizes an object as one of the
|
||||
* constructor’s instances.
|
||||
* @param value The object to test.
|
||||
* @param value The object to test.
|
||||
*/
|
||||
[Symbol.hasInstance](value: any): boolean;
|
||||
}
|
||||
@@ -71,30 +71,25 @@ interface Function {
|
||||
// and es6.array.find-index
|
||||
// #############################################################################################
|
||||
|
||||
interface ArrayLike<T> {
|
||||
length: number;
|
||||
[n: number]: T;
|
||||
}
|
||||
|
||||
interface Array<T> {
|
||||
/**
|
||||
* Returns the value of the first element in the array where predicate is true, and undefined
|
||||
/**
|
||||
* Returns the value of the first element in the array where predicate is true, and undefined
|
||||
* otherwise.
|
||||
* @param predicate find calls predicate once for each element of the array, in ascending
|
||||
* order, until it finds one where predicate returns true. If such an element is found, find
|
||||
* @param predicate find calls predicate once for each element of the array, in ascending
|
||||
* order, until it finds one where predicate returns true. If such an element is found, find
|
||||
* immediately returns that element value. Otherwise, find returns undefined.
|
||||
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||||
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||||
* predicate. If it is not provided, undefined is used instead.
|
||||
*/
|
||||
find(predicate: (value: T, index: number, obj: Array<T>) => boolean, thisArg?: any): T;
|
||||
|
||||
/**
|
||||
* Returns the index of the first element in the array where predicate is true, and undefined
|
||||
/**
|
||||
* Returns the index of the first element in the array where predicate is true, and undefined
|
||||
* otherwise.
|
||||
* @param predicate find calls predicate once for each element of the array, in ascending
|
||||
* order, until it finds one where predicate returns true. If such an element is found, find
|
||||
* @param predicate find calls predicate once for each element of the array, in ascending
|
||||
* order, until it finds one where predicate returns true. If such an element is found, find
|
||||
* immediately returns that element value. Otherwise, find returns undefined.
|
||||
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||||
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||||
* predicate. If it is not provided, undefined is used instead.
|
||||
*/
|
||||
findIndex(predicate: (value: T) => boolean, thisArg?: any): number;
|
||||
@@ -102,21 +97,21 @@ interface Array<T> {
|
||||
/**
|
||||
* Returns the this object after filling the section identified by start and end with value
|
||||
* @param value value to fill array section with
|
||||
* @param start index to start filling the array at. If start is negative, it is treated as
|
||||
* length+start where length is the length of the array.
|
||||
* @param end index to stop filling the array at. If end is negative, it is treated as
|
||||
* @param start index to start filling the array at. If start is negative, it is treated as
|
||||
* length+start where length is the length of the array.
|
||||
* @param end index to stop filling the array at. If end is negative, it is treated as
|
||||
* length+end.
|
||||
*/
|
||||
fill(value: T, start?: number, end?: number): T[];
|
||||
|
||||
/**
|
||||
/**
|
||||
* Returns the this object after copying a section of the array identified by start and end
|
||||
* to the same array starting at position target
|
||||
* @param target If target is negative, it is treated as length+target where length is the
|
||||
* length of the array.
|
||||
* @param start If start is negative, it is treated as length+start. If end is negative, it
|
||||
* @param target If target is negative, it is treated as length+target where length is the
|
||||
* length of the array.
|
||||
* @param start If start is negative, it is treated as length+start. If end is negative, it
|
||||
* is treated as length+end.
|
||||
* @param end If not specified, length of the this object is used as its default value.
|
||||
* @param end If not specified, length of the this object is used as its default value.
|
||||
*/
|
||||
copyWithin(target: number, start: number, end?: number): T[];
|
||||
|
||||
@@ -161,47 +156,47 @@ interface ArrayConstructor {
|
||||
|
||||
// #############################################################################################
|
||||
// ECMAScript 6: String & RegExp
|
||||
// Modules: es6.string.from-code-point, es6.string.raw, es6.string.code-point-at,
|
||||
// es6.string.ends-with, es6.string.includes, es6.string.repeat,
|
||||
// Modules: es6.string.from-code-point, es6.string.raw, es6.string.code-point-at,
|
||||
// es6.string.ends-with, es6.string.includes, es6.string.repeat,
|
||||
// es6.string.starts-with, and es6.regexp
|
||||
// #############################################################################################
|
||||
|
||||
interface String {
|
||||
/**
|
||||
* Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point
|
||||
* value of the UTF-16 encoded code point starting at the string element at position pos in
|
||||
* the String resulting from converting this object to a String.
|
||||
* If there is no element at that position, the result is undefined.
|
||||
* Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point
|
||||
* value of the UTF-16 encoded code point starting at the string element at position pos in
|
||||
* the String resulting from converting this object to a String.
|
||||
* If there is no element at that position, the result is undefined.
|
||||
* If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos.
|
||||
*/
|
||||
codePointAt(pos: number): number;
|
||||
|
||||
/**
|
||||
* Returns true if searchString appears as a substring of the result of converting this
|
||||
* object to a String, at one or more positions that are
|
||||
* Returns true if searchString appears as a substring of the result of converting this
|
||||
* object to a String, at one or more positions that are
|
||||
* greater than or equal to position; otherwise, returns false.
|
||||
* @param searchString search string
|
||||
* @param searchString search string
|
||||
* @param position If position is undefined, 0 is assumed, so as to search all of the String.
|
||||
*/
|
||||
includes(searchString: string, position?: number): boolean;
|
||||
|
||||
/**
|
||||
* Returns true if the sequence of elements of searchString converted to a String is the
|
||||
* same as the corresponding elements of this object (converted to a String) starting at
|
||||
* Returns true if the sequence of elements of searchString converted to a String is the
|
||||
* same as the corresponding elements of this object (converted to a String) starting at
|
||||
* endPosition – length(this). Otherwise returns false.
|
||||
*/
|
||||
endsWith(searchString: string, endPosition?: number): boolean;
|
||||
|
||||
/**
|
||||
* Returns a String value that is made from count copies appended together. If count is 0,
|
||||
* Returns a String value that is made from count copies appended together. If count is 0,
|
||||
* T is the empty String is returned.
|
||||
* @param count number of copies to append
|
||||
*/
|
||||
repeat(count: number): string;
|
||||
|
||||
/**
|
||||
* Returns true if the sequence of elements of searchString converted to a String is the
|
||||
* same as the corresponding elements of this object (converted to a String) starting at
|
||||
* Returns true if the sequence of elements of searchString converted to a String is the
|
||||
* same as the corresponding elements of this object (converted to a String) starting at
|
||||
* position. Otherwise returns false.
|
||||
*/
|
||||
startsWith(searchString: string, position?: number): boolean;
|
||||
@@ -216,7 +211,7 @@ interface StringConstructor {
|
||||
|
||||
/**
|
||||
* String.raw is intended for use as a tag function of a Tagged Template String. When called
|
||||
* as such the first argument will be a well formed template call site object and the rest
|
||||
* as such the first argument will be a well formed template call site object and the rest
|
||||
* parameter will contain the substitution values.
|
||||
* @param template A well-formed template string call site representation.
|
||||
* @param substitutions A set of substitution values.
|
||||
@@ -248,14 +243,14 @@ interface RegExp {
|
||||
interface NumberConstructor {
|
||||
/**
|
||||
* The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1
|
||||
* that is representable as a Number value, which is approximately:
|
||||
* that is representable as a Number value, which is approximately:
|
||||
* 2.2204460492503130808472633361816 x 10−16.
|
||||
*/
|
||||
EPSILON: number;
|
||||
|
||||
/**
|
||||
* Returns true if passed value is finite.
|
||||
* Unlike the global isFininte, Number.isFinite doesn't forcibly convert the parameter to a
|
||||
* Unlike the global isFininte, Number.isFinite doesn't forcibly convert the parameter to a
|
||||
* number. Only finite values of the type number, result in true.
|
||||
* @param number A numeric value.
|
||||
*/
|
||||
@@ -268,7 +263,7 @@ interface NumberConstructor {
|
||||
isInteger(number: number): boolean;
|
||||
|
||||
/**
|
||||
* Returns a Boolean value that indicates whether a value is the reserved value NaN (not a
|
||||
* Returns a Boolean value that indicates whether a value is the reserved value NaN (not a
|
||||
* number). Unlike the global isNaN(), Number.isNaN() doesn't forcefully convert the parameter
|
||||
* to a number. Only values of the type number, that are also NaN, result in true.
|
||||
* @param number A numeric value.
|
||||
@@ -281,30 +276,30 @@ interface NumberConstructor {
|
||||
*/
|
||||
isSafeInteger(number: number): boolean;
|
||||
|
||||
/**
|
||||
* The value of the largest integer n such that n and n + 1 are both exactly representable as
|
||||
* a Number value.
|
||||
/**
|
||||
* The value of the largest integer n such that n and n + 1 are both exactly representable as
|
||||
* a Number value.
|
||||
* The value of Number.MIN_SAFE_INTEGER is 9007199254740991 2^53 − 1.
|
||||
*/
|
||||
MAX_SAFE_INTEGER: number;
|
||||
|
||||
/**
|
||||
* The value of the smallest integer n such that n and n − 1 are both exactly representable as
|
||||
* a Number value.
|
||||
/**
|
||||
* The value of the smallest integer n such that n and n − 1 are both exactly representable as
|
||||
* a Number value.
|
||||
* The value of Number.MIN_SAFE_INTEGER is −9007199254740991 (−(2^53 − 1)).
|
||||
*/
|
||||
MIN_SAFE_INTEGER: number;
|
||||
|
||||
/**
|
||||
* Converts a string to a floating-point number.
|
||||
* @param string A string that contains a floating-point number.
|
||||
* Converts a string to a floating-point number.
|
||||
* @param string A string that contains a floating-point number.
|
||||
*/
|
||||
parseFloat(string: string): number;
|
||||
|
||||
/**
|
||||
* Converts A string to an integer.
|
||||
* @param s A string to convert into a number.
|
||||
* @param radix A value between 2 and 36 that specifies the base of the number in numString.
|
||||
* @param radix A value between 2 and 36 that specifies the base of the number in numString.
|
||||
* If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.
|
||||
* All other strings are considered decimal.
|
||||
*/
|
||||
@@ -350,7 +345,7 @@ interface Math {
|
||||
log1p(x: number): number;
|
||||
|
||||
/**
|
||||
* Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of
|
||||
* Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of
|
||||
* the natural logarithms).
|
||||
* @param x A numeric expression.
|
||||
*/
|
||||
@@ -436,8 +431,8 @@ interface Symbol {
|
||||
}
|
||||
|
||||
interface SymbolConstructor {
|
||||
/**
|
||||
* A reference to the prototype.
|
||||
/**
|
||||
* A reference to the prototype.
|
||||
*/
|
||||
prototype: Symbol;
|
||||
|
||||
@@ -448,14 +443,14 @@ interface SymbolConstructor {
|
||||
(description?: string|number): symbol;
|
||||
|
||||
/**
|
||||
* Returns a Symbol object from the global symbol registry matching the given key if found.
|
||||
* Returns a Symbol object from the global symbol registry matching the given key if found.
|
||||
* Otherwise, returns a new symbol with this key.
|
||||
* @param key key to search for.
|
||||
*/
|
||||
for(key: string): symbol;
|
||||
|
||||
/**
|
||||
* Returns a key from the global symbol registry matching the given Symbol if found.
|
||||
* Returns a key from the global symbol registry matching the given Symbol if found.
|
||||
* Otherwise, returns a undefined.
|
||||
* @param sym Symbol to find the key for.
|
||||
*/
|
||||
@@ -463,72 +458,72 @@ interface SymbolConstructor {
|
||||
|
||||
// Well-known Symbols
|
||||
|
||||
/**
|
||||
* A method that determines if a constructor object recognizes an object as one of the
|
||||
* constructor’s instances. Called by the semantics of the instanceof operator.
|
||||
/**
|
||||
* A method that determines if a constructor object recognizes an object as one of the
|
||||
* constructor’s instances. Called by the semantics of the instanceof operator.
|
||||
*/
|
||||
hasInstance: symbol;
|
||||
|
||||
/**
|
||||
/**
|
||||
* A Boolean value that if true indicates that an object should flatten to its array elements
|
||||
* by Array.prototype.concat.
|
||||
*/
|
||||
isConcatSpreadable: symbol;
|
||||
|
||||
/**
|
||||
* A method that returns the default iterator for an object. Called by the semantics of the
|
||||
/**
|
||||
* A method that returns the default iterator for an object. Called by the semantics of the
|
||||
* for-of statement.
|
||||
*/
|
||||
iterator: symbol;
|
||||
|
||||
/**
|
||||
* A regular expression method that matches the regular expression against a string. Called
|
||||
* by the String.prototype.match method.
|
||||
* A regular expression method that matches the regular expression against a string. Called
|
||||
* by the String.prototype.match method.
|
||||
*/
|
||||
match: symbol;
|
||||
|
||||
/**
|
||||
* A regular expression method that replaces matched substrings of a string. Called by the
|
||||
/**
|
||||
* A regular expression method that replaces matched substrings of a string. Called by the
|
||||
* String.prototype.replace method.
|
||||
*/
|
||||
replace: symbol;
|
||||
|
||||
/**
|
||||
* A regular expression method that returns the index within a string that matches the
|
||||
* A regular expression method that returns the index within a string that matches the
|
||||
* regular expression. Called by the String.prototype.search method.
|
||||
*/
|
||||
search: symbol;
|
||||
|
||||
/**
|
||||
* A function valued property that is the constructor function that is used to create
|
||||
/**
|
||||
* A function valued property that is the constructor function that is used to create
|
||||
* derived objects.
|
||||
*/
|
||||
species: symbol;
|
||||
|
||||
/**
|
||||
* A regular expression method that splits a string at the indices that match the regular
|
||||
* A regular expression method that splits a string at the indices that match the regular
|
||||
* expression. Called by the String.prototype.split method.
|
||||
*/
|
||||
split: symbol;
|
||||
|
||||
/**
|
||||
/**
|
||||
* A method that converts an object to a corresponding primitive value.Called by the ToPrimitive
|
||||
* abstract operation.
|
||||
*/
|
||||
toPrimitive: symbol;
|
||||
|
||||
/**
|
||||
/**
|
||||
* A String value that is used in the creation of the default string description of an object.
|
||||
* Called by the built-in method Object.prototype.toString.
|
||||
*/
|
||||
toStringTag: symbol;
|
||||
|
||||
/**
|
||||
* An Object whose own property names are property names that are excluded from the with
|
||||
/**
|
||||
* An Object whose own property names are property names that are excluded from the with
|
||||
* environment bindings of the associated objects.
|
||||
*/
|
||||
unscopables: symbol;
|
||||
|
||||
|
||||
/**
|
||||
* Non-standard. Use simple mode for core-js symbols. See https://github.com/zloirock/core-js/#caveats-when-using-symbol-polyfill
|
||||
*/
|
||||
@@ -544,12 +539,12 @@ declare var Symbol: SymbolConstructor;
|
||||
|
||||
interface Object {
|
||||
/**
|
||||
* Determines whether an object has a property with the specified name.
|
||||
* Determines whether an object has a property with the specified name.
|
||||
* @param v A property name.
|
||||
*/
|
||||
hasOwnProperty(v: PropertyKey): boolean;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Determines whether a specified property is enumerable.
|
||||
* @param v A property name.
|
||||
*/
|
||||
@@ -564,17 +559,17 @@ interface ObjectConstructor {
|
||||
getOwnPropertySymbols(o: any): symbol[];
|
||||
|
||||
/**
|
||||
* Gets the own property descriptor of the specified object.
|
||||
* An own property descriptor is one that is defined directly on the object and is not
|
||||
* inherited from the object's prototype.
|
||||
* Gets the own property descriptor of the specified object.
|
||||
* An own property descriptor is one that is defined directly on the object and is not
|
||||
* inherited from the object's prototype.
|
||||
* @param o Object that contains the property.
|
||||
* @param p Name of the property.
|
||||
*/
|
||||
getOwnPropertyDescriptor(o: any, propertyKey: PropertyKey): PropertyDescriptor;
|
||||
|
||||
/**
|
||||
* Adds a property to an object, or modifies attributes of an existing property.
|
||||
* @param o Object on which to add or modify the property. This can be a native JavaScript
|
||||
* Adds a property to an object, or modifies attributes of an existing property.
|
||||
* @param o Object on which to add or modify the property. This can be a native JavaScript
|
||||
* object (that is, a user-defined object or a built in object) or a DOM object.
|
||||
* @param p The property name.
|
||||
* @param attributes Descriptor for the property. It can be for a data property or an accessor
|
||||
@@ -693,17 +688,17 @@ interface Array<T> {
|
||||
/** Iterator */
|
||||
[Symbol.iterator](): IterableIterator<T>;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Returns an array of key, value pairs for every entry in the array
|
||||
*/
|
||||
entries(): IterableIterator<[number, T]>;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Returns an list of keys in the array
|
||||
*/
|
||||
keys(): IterableIterator<number>;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Returns an list of values in the array
|
||||
*/
|
||||
values(): IterableIterator<T>;
|
||||
@@ -776,21 +771,21 @@ interface Promise<T> {
|
||||
}
|
||||
|
||||
interface PromiseConstructor {
|
||||
/**
|
||||
* A reference to the prototype.
|
||||
/**
|
||||
* A reference to the prototype.
|
||||
*/
|
||||
prototype: Promise<any>;
|
||||
|
||||
/**
|
||||
* Creates a new Promise.
|
||||
* @param executor A callback used to initialize the promise. This callback is passed two arguments:
|
||||
* a resolve callback used resolve the promise with a value or the result of another promise,
|
||||
* @param executor A callback used to initialize the promise. This callback is passed two arguments:
|
||||
* a resolve callback used resolve the promise with a value or the result of another promise,
|
||||
* and a reject callback used to reject the promise with a provided reason or error.
|
||||
*/
|
||||
new <T>(executor: (resolve: (value?: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void): Promise<T>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved with an array of results when all of the provided Promises
|
||||
* Creates a Promise that is resolved with an array of results when all of the provided Promises
|
||||
* resolve, or rejected when any Promise is rejected.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
@@ -798,7 +793,7 @@ interface PromiseConstructor {
|
||||
all<T>(values: Iterable<T | PromiseLike<T>>): Promise<T[]>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
|
||||
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
|
||||
* or rejected.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
@@ -859,7 +854,7 @@ declare module Reflect {
|
||||
|
||||
// #############################################################################################
|
||||
// ECMAScript 7
|
||||
// Modules: es7.array.includes, es7.string.at, es7.string.lpad, es7.string.rpad,
|
||||
// Modules: es7.array.includes, es7.string.at, es7.string.lpad, es7.string.rpad,
|
||||
// es7.object.to-array, es7.object.get-own-property-descriptors, es7.regexp.escape,
|
||||
// es7.map.to-json, and es7.set.to-json
|
||||
// #############################################################################################
|
||||
@@ -918,14 +913,14 @@ interface ArrayConstructor {
|
||||
*/
|
||||
join<T>(array: ArrayLike<T>, separator?: string): string;
|
||||
/**
|
||||
* Reverses the elements in an Array.
|
||||
* Reverses the elements in an Array.
|
||||
*/
|
||||
reverse<T>(array: ArrayLike<T>): T[];
|
||||
/**
|
||||
* Removes the first element from an array and returns it.
|
||||
*/
|
||||
shift<T>(array: ArrayLike<T>): T;
|
||||
/**
|
||||
/**
|
||||
* Returns a section of an array.
|
||||
* @param start The beginning of the specified portion of the array.
|
||||
* @param end The end of the specified portion of the array.
|
||||
@@ -988,21 +983,21 @@ interface ArrayConstructor {
|
||||
|
||||
/**
|
||||
* Performs the specified action for each element in an array.
|
||||
* @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.
|
||||
* @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.
|
||||
* @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
|
||||
*/
|
||||
forEach<T>(array: ArrayLike<T>, callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void;
|
||||
|
||||
/**
|
||||
* Calls a defined callback function on each element of an array, and returns an array that contains the results.
|
||||
* @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.
|
||||
* @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.
|
||||
* @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
|
||||
*/
|
||||
map<T, U>(array: ArrayLike<T>, callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[];
|
||||
|
||||
/**
|
||||
* Returns the elements of an array that meet the condition specified in a callback function.
|
||||
* @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array.
|
||||
* Returns the elements of an array that meet the condition specified in a callback function.
|
||||
* @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array.
|
||||
* @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
|
||||
*/
|
||||
filter<T>(array: ArrayLike<T>, callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): T[];
|
||||
@@ -1021,53 +1016,53 @@ interface ArrayConstructor {
|
||||
*/
|
||||
reduce<T>(array: ArrayLike<T>, callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
|
||||
* @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.
|
||||
* @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.
|
||||
* @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.
|
||||
*/
|
||||
reduceRight<T, U>(array: ArrayLike<T>, callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
|
||||
* @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.
|
||||
* @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.
|
||||
* @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.
|
||||
*/
|
||||
reduceRight<T>(array: ArrayLike<T>, callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Returns an array of key, value pairs for every entry in the array
|
||||
*/
|
||||
entries<T>(array: ArrayLike<T>): IterableIterator<[number, T]>;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Returns an list of keys in the array
|
||||
*/
|
||||
keys<T>(array: ArrayLike<T>): IterableIterator<number>;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Returns an list of values in the array
|
||||
*/
|
||||
values<T>(array: ArrayLike<T>): IterableIterator<T>;
|
||||
|
||||
/**
|
||||
* Returns the value of the first element in the array where predicate is true, and undefined
|
||||
/**
|
||||
* Returns the value of the first element in the array where predicate is true, and undefined
|
||||
* otherwise.
|
||||
* @param predicate find calls predicate once for each element of the array, in ascending
|
||||
* order, until it finds one where predicate returns true. If such an element is found, find
|
||||
* @param predicate find calls predicate once for each element of the array, in ascending
|
||||
* order, until it finds one where predicate returns true. If such an element is found, find
|
||||
* immediately returns that element value. Otherwise, find returns undefined.
|
||||
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||||
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||||
* predicate. If it is not provided, undefined is used instead.
|
||||
*/
|
||||
find<T>(array: ArrayLike<T>, predicate: (value: T, index: number, obj: Array<T>) => boolean, thisArg?: any): T;
|
||||
|
||||
/**
|
||||
* Returns the index of the first element in the array where predicate is true, and undefined
|
||||
/**
|
||||
* Returns the index of the first element in the array where predicate is true, and undefined
|
||||
* otherwise.
|
||||
* @param predicate find calls predicate once for each element of the array, in ascending
|
||||
* order, until it finds one where predicate returns true. If such an element is found, find
|
||||
* @param predicate find calls predicate once for each element of the array, in ascending
|
||||
* order, until it finds one where predicate returns true. If such an element is found, find
|
||||
* immediately returns that element value. Otherwise, find returns undefined.
|
||||
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||||
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||||
* predicate. If it is not provided, undefined is used instead.
|
||||
*/
|
||||
findIndex<T>(array: ArrayLike<T>, predicate: (value: T) => boolean, thisArg?: any): number;
|
||||
@@ -1075,21 +1070,21 @@ interface ArrayConstructor {
|
||||
/**
|
||||
* Returns the this object after filling the section identified by start and end with value
|
||||
* @param value value to fill array section with
|
||||
* @param start index to start filling the array at. If start is negative, it is treated as
|
||||
* length+start where length is the length of the array.
|
||||
* @param end index to stop filling the array at. If end is negative, it is treated as
|
||||
* @param start index to start filling the array at. If start is negative, it is treated as
|
||||
* length+start where length is the length of the array.
|
||||
* @param end index to stop filling the array at. If end is negative, it is treated as
|
||||
* length+end.
|
||||
*/
|
||||
fill<T>(array: ArrayLike<T>, value: T, start?: number, end?: number): T[];
|
||||
|
||||
/**
|
||||
/**
|
||||
* Returns the this object after copying a section of the array identified by start and end
|
||||
* to the same array starting at position target
|
||||
* @param target If target is negative, it is treated as length+target where length is the
|
||||
* length of the array.
|
||||
* @param start If start is negative, it is treated as length+start. If end is negative, it
|
||||
* @param target If target is negative, it is treated as length+target where length is the
|
||||
* length of the array.
|
||||
* @param start If start is negative, it is treated as length+start. If end is negative, it
|
||||
* is treated as length+end.
|
||||
* @param end If not specified, length of the this object is used as its default value.
|
||||
* @param end If not specified, length of the this object is used as its default value.
|
||||
*/
|
||||
copyWithin<T>(array: ArrayLike<T>, target: number, start: number, end?: number): T[];
|
||||
|
||||
@@ -1113,7 +1108,7 @@ interface ObjectConstructor {
|
||||
* Non-standard.
|
||||
*/
|
||||
classof(value: any): string;
|
||||
|
||||
|
||||
/**
|
||||
* Non-standard.
|
||||
*/
|
||||
@@ -1477,13 +1472,13 @@ declare module core {
|
||||
}
|
||||
|
||||
declare module "core-js" {
|
||||
export = core;
|
||||
export = core;
|
||||
}
|
||||
declare module "core-js/shim" {
|
||||
export = core;
|
||||
export = core;
|
||||
}
|
||||
declare module "core-js/core" {
|
||||
export = core;
|
||||
export = core;
|
||||
}
|
||||
declare module "core-js/core/$for" {
|
||||
import $for = core.$for;
|
||||
@@ -2149,10 +2144,10 @@ declare module "core-js/fn/symbol/unscopables" {
|
||||
export = unscopables;
|
||||
}
|
||||
declare module "core-js/es5" {
|
||||
export = core;
|
||||
export = core;
|
||||
}
|
||||
declare module "core-js/es6" {
|
||||
export = core;
|
||||
export = core;
|
||||
}
|
||||
declare module "core-js/es6/array" {
|
||||
var Array: typeof core.Array;
|
||||
@@ -2211,7 +2206,7 @@ declare module "core-js/es6/weak-set" {
|
||||
export = WeakSet;
|
||||
}
|
||||
declare module "core-js/es7" {
|
||||
export = core;
|
||||
export = core;
|
||||
}
|
||||
declare module "core-js/es7/array" {
|
||||
var Array: typeof core.Array;
|
||||
@@ -2238,32 +2233,32 @@ declare module "core-js/es7/string" {
|
||||
export = String;
|
||||
}
|
||||
declare module "core-js/js" {
|
||||
export = core;
|
||||
export = core;
|
||||
}
|
||||
declare module "core-js/js/array" {
|
||||
var Array: typeof core.Array;
|
||||
export = Array;
|
||||
}
|
||||
declare module "core-js/web" {
|
||||
export = core;
|
||||
export = core;
|
||||
}
|
||||
declare module "core-js/web/dom" {
|
||||
export = core;
|
||||
export = core;
|
||||
}
|
||||
declare module "core-js/web/immediate" {
|
||||
export = core;
|
||||
export = core;
|
||||
}
|
||||
declare module "core-js/web/timers" {
|
||||
export = core;
|
||||
export = core;
|
||||
}
|
||||
declare module "core-js/libary" {
|
||||
export = core;
|
||||
export = core;
|
||||
}
|
||||
declare module "core-js/libary/shim" {
|
||||
export = core;
|
||||
export = core;
|
||||
}
|
||||
declare module "core-js/libary/core" {
|
||||
export = core;
|
||||
export = core;
|
||||
}
|
||||
declare module "core-js/libary/core/$for" {
|
||||
import $for = core.$for;
|
||||
@@ -2928,10 +2923,10 @@ declare module "core-js/libary/fn/symbol/unscopables" {
|
||||
export = unscopables;
|
||||
}
|
||||
declare module "core-js/libary/es5" {
|
||||
export = core;
|
||||
export = core;
|
||||
}
|
||||
declare module "core-js/libary/es6" {
|
||||
export = core;
|
||||
export = core;
|
||||
}
|
||||
declare module "core-js/libary/es6/array" {
|
||||
var Array: typeof core.Array;
|
||||
@@ -2990,7 +2985,7 @@ declare module "core-js/libary/es6/weak-set" {
|
||||
export = WeakSet;
|
||||
}
|
||||
declare module "core-js/libary/es7" {
|
||||
export = core;
|
||||
export = core;
|
||||
}
|
||||
declare module "core-js/libary/es7/array" {
|
||||
var Array: typeof core.Array;
|
||||
@@ -3017,21 +3012,21 @@ declare module "core-js/libary/es7/string" {
|
||||
export = String;
|
||||
}
|
||||
declare module "core-js/libary/js" {
|
||||
export = core;
|
||||
export = core;
|
||||
}
|
||||
declare module "core-js/libary/js/array" {
|
||||
var Array: typeof core.Array;
|
||||
export = Array;
|
||||
}
|
||||
declare module "core-js/libary/web" {
|
||||
export = core;
|
||||
export = core;
|
||||
}
|
||||
declare module "core-js/libary/web/dom" {
|
||||
export = core;
|
||||
export = core;
|
||||
}
|
||||
declare module "core-js/libary/web/immediate" {
|
||||
export = core;
|
||||
export = core;
|
||||
}
|
||||
declare module "core-js/libary/web/timers" {
|
||||
export = core;
|
||||
export = core;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ module Tests.ui {
|
||||
activeStateEnabled: true,
|
||||
allowColumnReordering: true,
|
||||
allowColumnResizing: true,
|
||||
onCellClick: function () { },
|
||||
onCellClick: function() { },
|
||||
cellHintEnabled: true,
|
||||
columnAutoWidth: true,
|
||||
columnChooser: {
|
||||
@@ -17,67 +17,52 @@ module Tests.ui {
|
||||
},
|
||||
columns: [
|
||||
{
|
||||
text: '5 columns with custom css class', value: [
|
||||
{ dataField: 'Processed', dataType: 'boolean', allowSorting: false },
|
||||
{ dataField: 'CustomerID', cssClass: 'customCssClass' },
|
||||
'OrderDate',
|
||||
{ dataField: 'Freight', validationRules: [{ type: "range", min: 1, max: 100 }] },
|
||||
{ dataField: 'ShipName', validationRules: [{ type: 'required' }] },
|
||||
'ShipCity']
|
||||
},
|
||||
{
|
||||
text: 'with show editor always', value: [
|
||||
{ dataField: 'Processed', dataType: 'boolean', allowSorting: false, showEditorAlways: true },
|
||||
{ dataField: 'OrderDate', dataType: 'date', showEditorAlways: true },
|
||||
{ dataField: 'CustomerID', showEditorAlways: true },
|
||||
{ dataField: 'Freight', showEditorAlways: true },
|
||||
{ dataField: 'ShipName', showEditorAlways: true }]
|
||||
},
|
||||
{
|
||||
text: 'custom template/edit/header template', value: [
|
||||
'CustomerID',
|
||||
'OrderDate',
|
||||
'Freight',
|
||||
{
|
||||
dataField: 'ShipVia',
|
||||
editCellTemplate: function (container: JQuery, options: { value: number }) {
|
||||
container.addClass('dx-editor-cell');
|
||||
container.append($('<div />').dxSelectBox({
|
||||
value: options.value,
|
||||
dataSource: [
|
||||
{ ShipperID: 1, CompanyName: 'Speedy Express' },
|
||||
{ ShipperID: 2, CompanyName: 'United Package' },
|
||||
{ ShipperID: 3, CompanyName: 'Federal Shipping' }
|
||||
],
|
||||
valueExpr: 'ShipperID',
|
||||
displayExpr: 'CompanyName'
|
||||
}));
|
||||
},
|
||||
cellTemplate: function (container: JQuery, options: { value: number }) {
|
||||
container.text(String(options.value));
|
||||
},
|
||||
headerCellTemplate: function (container: JQuery, options: { headerCaption: string }) {
|
||||
container.append($('<div/>').css({ border: '1px solid red' }).text(options.headerCaption));
|
||||
}
|
||||
},
|
||||
'ShipName',
|
||||
'ShipCity']
|
||||
},
|
||||
{ text: 'none', value: '' },
|
||||
{
|
||||
text: 'custom template/header hogan template', value: [
|
||||
'CustomerID',
|
||||
'OrderDate',
|
||||
'Freight',
|
||||
{
|
||||
dataField: 'ShipVia',
|
||||
cellTemplate: '#hoganColumnTemplate',
|
||||
headerCellTemplate: $('#hoganHeaderColumnTemplate')
|
||||
},
|
||||
'ShipName',
|
||||
'ShipCity']
|
||||
}],
|
||||
customizeColumns: function (columns) {
|
||||
alignment: "center",
|
||||
allowFixing: true,
|
||||
allowEditing: true,
|
||||
allowFiltering: true,
|
||||
allowGrouping: true,
|
||||
allowHiding: true,
|
||||
allowReordering: true,
|
||||
allowResizing: true,
|
||||
allowSearch: true,
|
||||
allowSorting: true,
|
||||
autoExpandGroup: true,
|
||||
calculateCellValue: function(rowData: Object) { return "test-value"; },
|
||||
calculateFilterExpression: function(filterValue: any, selectedFilterOperation: string) { return []; },
|
||||
caption: "Test column",
|
||||
cellTemplate: function(container: JQuery, options: Object) { $("<span>Template</span>").appendTo(container); },
|
||||
cssClass: "test-ccs-class-name",
|
||||
customizeText: function(cellInfo: { value: any, valueText: string; }) { return "New text" },
|
||||
dataField: "Test",
|
||||
dataType: "string",
|
||||
encodeHtml: true,
|
||||
falseText: "FALSE",
|
||||
filterOperations: ["contains", "notcontains"],
|
||||
filterType: "exclude",
|
||||
filterValue: "Test-filter-value",
|
||||
fixed: true,
|
||||
fixedPosition: "right",
|
||||
groupIndex: 0,
|
||||
lookup: {
|
||||
allowClearing: true,
|
||||
dataSource: ["first", "second"],
|
||||
displayExpr: "this",
|
||||
valueExpr: "this"
|
||||
},
|
||||
name: "test-column-name",
|
||||
showEditorAlways: true,
|
||||
showInColumnChooser: true,
|
||||
showWhenGrouped: true,
|
||||
sortIndex: 1,
|
||||
sortOrder: "desc",
|
||||
trueText: "TRUE",
|
||||
visible: true,
|
||||
visibleIndex: 0,
|
||||
width: "100%"
|
||||
}
|
||||
],
|
||||
customizeColumns: function(columns) {
|
||||
var i: number;
|
||||
for (i = 0; i < columns.length; i++) {
|
||||
if (columns[i].dataField.indexOf('Date') > 0) {
|
||||
@@ -94,16 +79,16 @@ module Tests.ui {
|
||||
valueExpr: 'CustomerID',
|
||||
displayExpr: 'ContactName'
|
||||
}
|
||||
}
|
||||
}
|
||||
if (columns[i].dataField === 'EmployeeID') {
|
||||
columns[i].lookup = {
|
||||
dataSource: { store: [], sort: 'LastName' },
|
||||
valueExpr: 'EmployeeID',
|
||||
displayExpr: function (data: any) {
|
||||
displayExpr: function(data: any) {
|
||||
return data.LastName + ' ' + data.FirstName;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (columns[i].dataField === 'ShipVia') {
|
||||
columns[i].lookup = {
|
||||
dataSource: [
|
||||
@@ -114,14 +99,14 @@ module Tests.ui {
|
||||
valueExpr: 'ShipperID',
|
||||
displayExpr: 'CompanyName'
|
||||
}
|
||||
}
|
||||
}
|
||||
if (columns[i].dataField === 'ShipCity') {
|
||||
columns[i].editCellTemplate = function (container: JQuery, options: { value: string; setValue: Function }) {
|
||||
columns[i].editCellTemplate = function(container: JQuery, options: { value: string; setValue: Function }) {
|
||||
$('<div/>').dxAutocomplete({
|
||||
items: ["Bern", "Lyon", "Lander"],
|
||||
dataSource: ["Bern", "Lyon", "Lander"],
|
||||
value: options.value,
|
||||
onValueChanged: function (e:{ value: string }) {
|
||||
options.setValue(e.value);
|
||||
onValueChanged: function() {
|
||||
options.setValue("test-value");
|
||||
}
|
||||
}).appendTo(container);
|
||||
}
|
||||
@@ -242,10 +227,10 @@ module Tests.viz {
|
||||
{ valueField: 's8' }
|
||||
],
|
||||
title: 'Long Chart\'s Title',
|
||||
onPointClick: function (arg: any) {
|
||||
onPointClick: function(arg: any) {
|
||||
arg.target.isSelected() ? arg.target.clearSelection() : arg.target.select();
|
||||
},
|
||||
onSeriesClick: function (arg: any) {
|
||||
onSeriesClick: function(arg: any) {
|
||||
arg.target.isVisible() ? arg.target.hide() : arg.target.show();
|
||||
}
|
||||
};
|
||||
@@ -313,8 +298,8 @@ module Tests.data {
|
||||
pageSize: 25,
|
||||
paginate: true,
|
||||
|
||||
map: function (item) { return item; },
|
||||
postProcess: function (data) { return data; },
|
||||
map: function(item) { return item; },
|
||||
postProcess: function(data) { return data; },
|
||||
searchExpr: "expr",
|
||||
searchOperation: "contains",
|
||||
searchValue: "somevalue",
|
||||
@@ -328,7 +313,7 @@ module Tests.data {
|
||||
});
|
||||
|
||||
new DevExpress.data.CustomStore(<DevExpress.data.CustomStoreOptions>{
|
||||
load: function () {
|
||||
load: function() {
|
||||
return $.Deferred().promise();
|
||||
}
|
||||
});
|
||||
|
||||
Vendored
+80
-77
@@ -35,7 +35,7 @@ declare module DevExpress {
|
||||
brokenRules: any[];
|
||||
validators: IValidator[];
|
||||
}
|
||||
export interface GroupConfig extends EventsMixin<GroupConfig> {
|
||||
export interface GroupConfig extends EventsMixin<GroupConfig> {
|
||||
group: any;
|
||||
validators: IValidator[];
|
||||
validate(): ValidationGroupValidationResult;
|
||||
@@ -56,7 +56,7 @@ declare module DevExpress {
|
||||
/** Validates the rules that are defined within the dxValidator objects that are registered for the specified ViewModel. */
|
||||
export function validateModel(model: Object): ValidationGroupValidationResult;
|
||||
/** Registers all the dxValidator objects by which the fields of the specified ViewModel are extended. */
|
||||
export function registerModelForValidation(model: Object) : void;
|
||||
export function registerModelForValidation(model: Object): void;
|
||||
}
|
||||
export var hardwareBackButton: JQueryCallback;
|
||||
/** Processes the hardware back button click. */
|
||||
@@ -1789,7 +1789,7 @@ declare module DevExpress.ui {
|
||||
interval?: number;
|
||||
/** Specifies the maximum zoom level of a calendar, which is used to pick the date. */
|
||||
maxZoomLevel?: string;
|
||||
/** Specifies the minimal zoom level of a calendar, which is used to pick the date. */
|
||||
/** Specifies the minimal zoom level of a calendar, which is used to pick the date. */
|
||||
minZoomLevel?: string;
|
||||
/** Specifies the type of date/time picker. */
|
||||
pickerType?: string;
|
||||
@@ -1869,7 +1869,7 @@ declare module DevExpress.ui {
|
||||
/** A container widget used to arrange inner elements. */
|
||||
export class dxBox extends CollectionWidget {
|
||||
constructor(element: JQuery, options?: dxBoxOptions);
|
||||
constructor(element: Element, options?: dxBoxOptions);
|
||||
constructor(element: Element, options?: dxBoxOptions);
|
||||
}
|
||||
export interface dxResponsiveBoxOptions extends CollectionWidgetOptions {
|
||||
/** Specifies the collection of rows for the grid used to position layout elements. */
|
||||
@@ -3041,7 +3041,7 @@ declare module DevExpress.ui {
|
||||
lookup?: {
|
||||
/** Specifies whether or not a user can nullify values of a lookup column. */
|
||||
allowClearing?: boolean;
|
||||
/**
|
||||
/**
|
||||
* Specifies the data source providing data for a lookup column.
|
||||
*/
|
||||
dataSource?: any;
|
||||
@@ -3076,6 +3076,9 @@ declare module DevExpress.ui {
|
||||
showInColumnChooser?: boolean;
|
||||
/** Specifies the identifier of the column. */
|
||||
name?: string;
|
||||
// NOTE https://github.com/borisyankov/DefinitelyTyped/pull/5590
|
||||
text?: string;
|
||||
value?: any;
|
||||
}
|
||||
export interface dxDataGridOptions extends WidgetOptions {
|
||||
/** Specifies whether the outer borders of the grid are visible or not. */
|
||||
@@ -3171,7 +3174,7 @@ declare module DevExpress.ui {
|
||||
cancel?: string;
|
||||
}
|
||||
};
|
||||
/**
|
||||
/**
|
||||
* An array of grid columns.
|
||||
*/
|
||||
columns?: dxDataGridColumn[];
|
||||
@@ -3271,7 +3274,7 @@ declare module DevExpress.ui {
|
||||
autoExpandAll?: boolean;
|
||||
/** Specifies the message displayed in a group row when the corresponding group is continued from the previous page. */
|
||||
groupContinuedMessage?: string;
|
||||
/**
|
||||
/**
|
||||
* Specifies the message displayed in a group row when the corresponding group continues on the next page.
|
||||
*/
|
||||
groupContinuesMessage?: string;
|
||||
@@ -3653,7 +3656,7 @@ declare module DevExpress.ui {
|
||||
removeRow(rowIndex: number): void;
|
||||
/** Saves changes made in a grid. */
|
||||
saveEditData(): void;
|
||||
/**
|
||||
/**
|
||||
* Searches grid records by a search string.
|
||||
*/
|
||||
searchByText(text: string): void;
|
||||
@@ -4332,16 +4335,16 @@ declare module DevExpress.viz.core {
|
||||
}) => void;
|
||||
/** A handler for the incidentOccurred event. */
|
||||
onIncidentOccurred?: (
|
||||
component: BaseWidget,
|
||||
element: Element,
|
||||
target: {
|
||||
id: string;
|
||||
type: string;
|
||||
args: any;
|
||||
text: string;
|
||||
widget: string;
|
||||
version: string;
|
||||
}
|
||||
component: BaseWidget,
|
||||
element: Element,
|
||||
target: {
|
||||
id: string;
|
||||
type: string;
|
||||
args: any;
|
||||
text: string;
|
||||
widget: string;
|
||||
version: string;
|
||||
}
|
||||
) => void;
|
||||
/** Notifies a widget that it is embedded into an HTML page that uses a path modifier. */
|
||||
pathModified?: boolean;
|
||||
@@ -4656,59 +4659,59 @@ declare module DevExpress.viz.charts {
|
||||
};
|
||||
}
|
||||
export interface CommonPointOptions {
|
||||
/** Specifies border options for points in the line and area series. */
|
||||
/** Specifies border options for points in the line and area series. */
|
||||
border?: viz.core.Border;
|
||||
/** Specifies the points color. */
|
||||
color?: string;
|
||||
/** Specifies what series points to highlight when a point is hovered over. */
|
||||
hoverMode?: string;
|
||||
/** An object defining configuration options for a hovered point. */
|
||||
hoverStyle?: {
|
||||
/** An object defining the border options for a hovered point. */
|
||||
border?: viz.core.Border;
|
||||
/** Specifies the points color. */
|
||||
/** Sets a color for a point when it is hovered over. */
|
||||
color?: string;
|
||||
/** Specifies what series points to highlight when a point is hovered over. */
|
||||
hoverMode?: string;
|
||||
/** An object defining configuration options for a hovered point. */
|
||||
hoverStyle?: {
|
||||
/** An object defining the border options for a hovered point. */
|
||||
border?: viz.core.Border;
|
||||
/** Sets a color for a point when it is hovered over. */
|
||||
color?: string;
|
||||
/** Specifies the diameter of a hovered point in the series that represents data points as symbols (not as bars for instance). */
|
||||
size?: number;
|
||||
};
|
||||
/** Specifies what series points to highlight when a point is selected. */
|
||||
selectionMode?: string;
|
||||
/** An object defining configuration options for a selected point. */
|
||||
selectionStyle?: {
|
||||
/** An object defining the border options for a selected point. */
|
||||
border?: viz.core.Border;
|
||||
/** <p>Sets a color for a point when it is selected.</p> */
|
||||
color?: string;
|
||||
/** Specifies the diameter of a selected point in the series that represents data points as symbols (not as bars for instance). */
|
||||
size?: number;
|
||||
};
|
||||
/** Specifies the point diameter in pixels for those series that represent data points as symbols (not as bars for instance). */
|
||||
/** Specifies the diameter of a hovered point in the series that represents data points as symbols (not as bars for instance). */
|
||||
size?: number;
|
||||
/** Specifies a symbol for presenting points of the line and area series. */
|
||||
symbol?: string;
|
||||
visible?: boolean;
|
||||
};
|
||||
/** Specifies what series points to highlight when a point is selected. */
|
||||
selectionMode?: string;
|
||||
/** An object defining configuration options for a selected point. */
|
||||
selectionStyle?: {
|
||||
/** An object defining the border options for a selected point. */
|
||||
border?: viz.core.Border;
|
||||
/** <p>Sets a color for a point when it is selected.</p> */
|
||||
color?: string;
|
||||
/** Specifies the diameter of a selected point in the series that represents data points as symbols (not as bars for instance). */
|
||||
size?: number;
|
||||
};
|
||||
/** Specifies the point diameter in pixels for those series that represent data points as symbols (not as bars for instance). */
|
||||
size?: number;
|
||||
/** Specifies a symbol for presenting points of the line and area series. */
|
||||
symbol?: string;
|
||||
visible?: boolean;
|
||||
}
|
||||
export interface ChartCommonPointOptions extends CommonPointOptions {
|
||||
/** An object specifying the parameters of an image that is used as a point marker. */
|
||||
image?: {
|
||||
/** Specifies the height of an image that is used as a point marker. */
|
||||
height?: any;
|
||||
/** Specifies a URL leading to the image to be used as a point marker. */
|
||||
url?: any;
|
||||
/** Specifies the width of an image that is used as a point marker. */
|
||||
width?: any;
|
||||
};
|
||||
/** An object specifying the parameters of an image that is used as a point marker. */
|
||||
image?: {
|
||||
/** Specifies the height of an image that is used as a point marker. */
|
||||
height?: any;
|
||||
/** Specifies a URL leading to the image to be used as a point marker. */
|
||||
url?: any;
|
||||
/** Specifies the width of an image that is used as a point marker. */
|
||||
width?: any;
|
||||
};
|
||||
}
|
||||
export interface PolarCommonPointOptions extends CommonPointOptions {
|
||||
/** An object specifying the parameters of an image that is used as a point marker. */
|
||||
image?: {
|
||||
/** Specifies the height of an image that is used as a point marker. */
|
||||
height?: number;
|
||||
/** Specifies a URL leading to the image to be used as a point marker. */
|
||||
url?: string;
|
||||
/** Specifies the width of an image that is used as a point marker. */
|
||||
width?: number;
|
||||
};
|
||||
/** An object specifying the parameters of an image that is used as a point marker. */
|
||||
image?: {
|
||||
/** Specifies the height of an image that is used as a point marker. */
|
||||
height?: number;
|
||||
/** Specifies a URL leading to the image to be used as a point marker. */
|
||||
url?: string;
|
||||
/** Specifies the width of an image that is used as a point marker. */
|
||||
width?: number;
|
||||
};
|
||||
}
|
||||
/** An object that defines configuration options for chart series. */
|
||||
export interface CommonSeriesConfig extends BaseCommonSeriesConfig {
|
||||
@@ -5091,17 +5094,17 @@ declare module DevExpress.viz.charts {
|
||||
text?: string;
|
||||
}
|
||||
export interface AxisLabel {
|
||||
/** Specifies the text for a hint that appears when a user hovers the mouse pointer over a label on the value axis. */
|
||||
/** Specifies the text for a hint that appears when a user hovers the mouse pointer over a label on the value axis. */
|
||||
customizeHint?: (argument: { value: any; valueText: string }) => string;
|
||||
/** Specifies a callback function that returns the text to be displayed in value axis labels. */
|
||||
/** Specifies a callback function that returns the text to be displayed in value axis labels. */
|
||||
customizeText?: (argument: { value: any; valueText: string }) => string;
|
||||
/** Specifies a format for the text displayed by axis labels. */
|
||||
/** Specifies a format for the text displayed by axis labels. */
|
||||
format?: string;
|
||||
/** Specifies a precision for the formatted value displayed in the axis labels. */
|
||||
/** Specifies a precision for the formatted value displayed in the axis labels. */
|
||||
precision?: number;
|
||||
}
|
||||
export interface ChartAxisLabel extends ChartCommonAxisLabel, AxisLabel {}
|
||||
export interface PolarAxisLabel extends PolarCommonAxisLabel, AxisLabel {}
|
||||
export interface ChartAxisLabel extends ChartCommonAxisLabel, AxisLabel { }
|
||||
export interface PolarAxisLabel extends PolarCommonAxisLabel, AxisLabel { }
|
||||
export interface AxisTitle extends CommonAxisTitle {
|
||||
/** Specifies the text for the value axis title. */
|
||||
text?: string;
|
||||
@@ -5117,7 +5120,7 @@ declare module DevExpress.viz.charts {
|
||||
value?: any;
|
||||
}
|
||||
export interface PolarConstantLine extends PolarCommonConstantLineStyle {
|
||||
/** An object defining constant line label options. */
|
||||
/** An object defining constant line label options. */
|
||||
label?: PolarConstantLineLabel;
|
||||
/** Specifies a value to be displayed by a constant line. */
|
||||
value?: any;
|
||||
@@ -5170,7 +5173,7 @@ declare module DevExpress.viz.charts {
|
||||
/** Specifies the elements that will be highlighted when the argument axis is hovered over. */
|
||||
hoverMode?: string;
|
||||
}
|
||||
export interface ChartArgumentAxis extends ChartAxis, ArgumentAxis {}
|
||||
export interface ChartArgumentAxis extends ChartAxis, ArgumentAxis { }
|
||||
export interface PolarArgumentAxis extends PolarAxis, ArgumentAxis {
|
||||
/** Specifies a start angle for the argument axis in degrees. */
|
||||
startAngle?: number;
|
||||
@@ -5186,7 +5189,7 @@ declare module DevExpress.viz.charts {
|
||||
showZero?: boolean;
|
||||
/** Specifies the desired type of axis values. */
|
||||
valueType?: string;
|
||||
}
|
||||
}
|
||||
export interface ChartValueAxis extends ChartAxis, ValueAxis {
|
||||
/** Specifies the spacing, in pixels, between multiple value axes in a chart. */
|
||||
multipleAxesSpacing?: number;
|
||||
@@ -5385,7 +5388,7 @@ declare module DevExpress.viz.charts {
|
||||
/** Specifies whether a single series or multiple series can be selected in the chart. */
|
||||
seriesSelectionMode?: string;
|
||||
/** Specifies how the chart must behave when series point labels overlap. */
|
||||
resolveLabelOverlapping?: string;
|
||||
resolveLabelOverlapping?: string;
|
||||
}
|
||||
export interface Legend extends AdvancedLegend {
|
||||
/** Specifies whether the legend is located outside or inside the chart's plot. */
|
||||
@@ -5580,7 +5583,7 @@ declare module DevExpress.viz.charts {
|
||||
onLegendClick?: any;
|
||||
legendClick?: any;
|
||||
/** Specifies how the chart must behave when series point labels overlap. */
|
||||
resolveLabelOverlapping?: string;
|
||||
resolveLabelOverlapping?: string;
|
||||
}
|
||||
/** A circular chart widget for HTML JS applications. */
|
||||
export class dxPieChart extends BaseChart {
|
||||
@@ -5952,7 +5955,7 @@ declare module DevExpress.viz.rangeSelector {
|
||||
behavior?: {
|
||||
/** Indicates whether or not you can swap sliders. */
|
||||
allowSlidersSwap?: boolean;
|
||||
/**
|
||||
/**
|
||||
Indicates whether or not animation is enabled.
|
||||
*/
|
||||
animationEnabled?: boolean;
|
||||
@@ -6067,7 +6070,7 @@ Indicates whether or not animation is enabled.
|
||||
maxRange?: any;
|
||||
/** Specifies the number of minor ticks between neighboring major ticks. */
|
||||
minorTickCount?: number;
|
||||
/**
|
||||
/**
|
||||
Specifies an interval between minor ticks.
|
||||
*/
|
||||
minorTickInterval?: any;
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
/// <reference path="./dragula.d.ts" />
|
||||
|
||||
import dragula = require("dragula");
|
||||
|
||||
// containers
|
||||
|
||||
Vendored
+59
-64
@@ -12,7 +12,7 @@ interface IteratorResult<T> {
|
||||
|
||||
interface IterableShim<T> {
|
||||
/**
|
||||
* Shim for an ES6 iterable. Not intended for direct use by user code.
|
||||
* Shim for an ES6 iterable. Not intended for direct use by user code.
|
||||
*/
|
||||
"_es6-shim iterator_"(): Iterator<T>;
|
||||
}
|
||||
@@ -39,7 +39,7 @@ interface StringConstructor {
|
||||
|
||||
/**
|
||||
* String.raw is intended for use as a tag function of a Tagged Template String. When called
|
||||
* as such the first argument will be a well formed template call site object and the rest
|
||||
* as such the first argument will be a well formed template call site object and the rest
|
||||
* parameter will contain the substitution values.
|
||||
* @param template A well-formed template string call site representation.
|
||||
* @param substitutions A set of substitution values.
|
||||
@@ -49,40 +49,40 @@ interface StringConstructor {
|
||||
|
||||
interface String {
|
||||
/**
|
||||
* Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point
|
||||
* value of the UTF-16 encoded code point starting at the string element at position pos in
|
||||
* the String resulting from converting this object to a String.
|
||||
* If there is no element at that position, the result is undefined.
|
||||
* Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point
|
||||
* value of the UTF-16 encoded code point starting at the string element at position pos in
|
||||
* the String resulting from converting this object to a String.
|
||||
* If there is no element at that position, the result is undefined.
|
||||
* If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos.
|
||||
*/
|
||||
codePointAt(pos: number): number;
|
||||
|
||||
/**
|
||||
* Returns true if searchString appears as a substring of the result of converting this
|
||||
* object to a String, at one or more positions that are
|
||||
* Returns true if searchString appears as a substring of the result of converting this
|
||||
* object to a String, at one or more positions that are
|
||||
* greater than or equal to position; otherwise, returns false.
|
||||
* @param searchString search string
|
||||
* @param searchString search string
|
||||
* @param position If position is undefined, 0 is assumed, so as to search all of the String.
|
||||
*/
|
||||
includes(searchString: string, position?: number): boolean;
|
||||
|
||||
/**
|
||||
* Returns true if the sequence of elements of searchString converted to a String is the
|
||||
* same as the corresponding elements of this object (converted to a String) starting at
|
||||
* Returns true if the sequence of elements of searchString converted to a String is the
|
||||
* same as the corresponding elements of this object (converted to a String) starting at
|
||||
* endPosition – length(this). Otherwise returns false.
|
||||
*/
|
||||
endsWith(searchString: string, endPosition?: number): boolean;
|
||||
|
||||
/**
|
||||
* Returns a String value that is made from count copies appended together. If count is 0,
|
||||
* Returns a String value that is made from count copies appended together. If count is 0,
|
||||
* T is the empty String is returned.
|
||||
* @param count number of copies to append
|
||||
*/
|
||||
repeat(count: number): string;
|
||||
|
||||
/**
|
||||
* Returns true if the sequence of elements of searchString converted to a String is the
|
||||
* same as the corresponding elements of this object (converted to a String) starting at
|
||||
* Returns true if the sequence of elements of searchString converted to a String is the
|
||||
* same as the corresponding elements of this object (converted to a String) starting at
|
||||
* position. Otherwise returns false.
|
||||
*/
|
||||
startsWith(searchString: string, position?: number): boolean;
|
||||
@@ -130,19 +130,14 @@ interface String {
|
||||
sub(): string;
|
||||
|
||||
/** Returns a <sup> HTML element */
|
||||
sup(): string;
|
||||
sup(): string;
|
||||
|
||||
/**
|
||||
* Shim for an ES6 iterable. Not intended for direct use by user code.
|
||||
* Shim for an ES6 iterable. Not intended for direct use by user code.
|
||||
*/
|
||||
"_es6-shim iterator_"(): IterableIteratorShim<string>;
|
||||
}
|
||||
|
||||
interface ArrayLike<T> {
|
||||
length: number;
|
||||
[n: number]: T;
|
||||
}
|
||||
|
||||
interface ArrayConstructor {
|
||||
/**
|
||||
* Creates an array from an array-like object.
|
||||
@@ -180,24 +175,24 @@ interface ArrayConstructor {
|
||||
}
|
||||
|
||||
interface Array<T> {
|
||||
/**
|
||||
* Returns the value of the first element in the array where predicate is true, and undefined
|
||||
/**
|
||||
* Returns the value of the first element in the array where predicate is true, and undefined
|
||||
* otherwise.
|
||||
* @param predicate find calls predicate once for each element of the array, in ascending
|
||||
* order, until it finds one where predicate returns true. If such an element is found, find
|
||||
* @param predicate find calls predicate once for each element of the array, in ascending
|
||||
* order, until it finds one where predicate returns true. If such an element is found, find
|
||||
* immediately returns that element value. Otherwise, find returns undefined.
|
||||
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||||
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||||
* predicate. If it is not provided, undefined is used instead.
|
||||
*/
|
||||
find(predicate: (value: T, index: number, obj: Array<T>) => boolean, thisArg?: any): T;
|
||||
|
||||
/**
|
||||
* Returns the index of the first element in the array where predicate is true, and undefined
|
||||
/**
|
||||
* Returns the index of the first element in the array where predicate is true, and undefined
|
||||
* otherwise.
|
||||
* @param predicate find calls predicate once for each element of the array, in ascending
|
||||
* order, until it finds one where predicate returns true. If such an element is found, find
|
||||
* @param predicate find calls predicate once for each element of the array, in ascending
|
||||
* order, until it finds one where predicate returns true. If such an element is found, find
|
||||
* immediately returns that element value. Otherwise, find returns undefined.
|
||||
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||||
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||||
* predicate. If it is not provided, undefined is used instead.
|
||||
*/
|
||||
findIndex(predicate: (value: T) => boolean, thisArg?: any): number;
|
||||
@@ -205,41 +200,41 @@ interface Array<T> {
|
||||
/**
|
||||
* Returns the this object after filling the section identified by start and end with value
|
||||
* @param value value to fill array section with
|
||||
* @param start index to start filling the array at. If start is negative, it is treated as
|
||||
* length+start where length is the length of the array.
|
||||
* @param end index to stop filling the array at. If end is negative, it is treated as
|
||||
* @param start index to start filling the array at. If start is negative, it is treated as
|
||||
* length+start where length is the length of the array.
|
||||
* @param end index to stop filling the array at. If end is negative, it is treated as
|
||||
* length+end.
|
||||
*/
|
||||
fill(value: T, start?: number, end?: number): T[];
|
||||
|
||||
/**
|
||||
/**
|
||||
* Returns the this object after copying a section of the array identified by start and end
|
||||
* to the same array starting at position target
|
||||
* @param target If target is negative, it is treated as length+target where length is the
|
||||
* length of the array.
|
||||
* @param start If start is negative, it is treated as length+start. If end is negative, it
|
||||
* @param target If target is negative, it is treated as length+target where length is the
|
||||
* length of the array.
|
||||
* @param start If start is negative, it is treated as length+start. If end is negative, it
|
||||
* is treated as length+end.
|
||||
* @param end If not specified, length of the this object is used as its default value.
|
||||
* @param end If not specified, length of the this object is used as its default value.
|
||||
*/
|
||||
copyWithin(target: number, start: number, end?: number): T[];
|
||||
|
||||
/**
|
||||
/**
|
||||
* Returns an array of key, value pairs for every entry in the array
|
||||
*/
|
||||
entries(): IterableIteratorShim<[number, T]>;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Returns an list of keys in the array
|
||||
*/
|
||||
keys(): IterableIteratorShim<number>;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Returns an list of values in the array
|
||||
*/
|
||||
values(): IterableIteratorShim<T>;
|
||||
|
||||
/**
|
||||
* Shim for an ES6 iterable. Not intended for direct use by user code.
|
||||
* Shim for an ES6 iterable. Not intended for direct use by user code.
|
||||
*/
|
||||
"_es6-shim iterator_"(): IterableIteratorShim<T>;
|
||||
}
|
||||
@@ -247,14 +242,14 @@ interface Array<T> {
|
||||
interface NumberConstructor {
|
||||
/**
|
||||
* The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1
|
||||
* that is representable as a Number value, which is approximately:
|
||||
* that is representable as a Number value, which is approximately:
|
||||
* 2.2204460492503130808472633361816 x 10−16.
|
||||
*/
|
||||
EPSILON: number;
|
||||
|
||||
/**
|
||||
* Returns true if passed value is finite.
|
||||
* Unlike the global isFininte, Number.isFinite doesn't forcibly convert the parameter to a
|
||||
* Unlike the global isFininte, Number.isFinite doesn't forcibly convert the parameter to a
|
||||
* number. Only finite values of the type number, result in true.
|
||||
* @param number A numeric value.
|
||||
*/
|
||||
@@ -267,7 +262,7 @@ interface NumberConstructor {
|
||||
isInteger(number: number): boolean;
|
||||
|
||||
/**
|
||||
* Returns a Boolean value that indicates whether a value is the reserved value NaN (not a
|
||||
* Returns a Boolean value that indicates whether a value is the reserved value NaN (not a
|
||||
* number). Unlike the global isNaN(), Number.isNaN() doesn't forcefully convert the parameter
|
||||
* to a number. Only values of the type number, that are also NaN, result in true.
|
||||
* @param number A numeric value.
|
||||
@@ -280,30 +275,30 @@ interface NumberConstructor {
|
||||
*/
|
||||
isSafeInteger(number: number): boolean;
|
||||
|
||||
/**
|
||||
* The value of the largest integer n such that n and n + 1 are both exactly representable as
|
||||
* a Number value.
|
||||
/**
|
||||
* The value of the largest integer n such that n and n + 1 are both exactly representable as
|
||||
* a Number value.
|
||||
* The value of Number.MIN_SAFE_INTEGER is 9007199254740991 2^53 − 1.
|
||||
*/
|
||||
MAX_SAFE_INTEGER: number;
|
||||
|
||||
/**
|
||||
* The value of the smallest integer n such that n and n − 1 are both exactly representable as
|
||||
* a Number value.
|
||||
/**
|
||||
* The value of the smallest integer n such that n and n − 1 are both exactly representable as
|
||||
* a Number value.
|
||||
* The value of Number.MIN_SAFE_INTEGER is −9007199254740991 (−(2^53 − 1)).
|
||||
*/
|
||||
MIN_SAFE_INTEGER: number;
|
||||
|
||||
/**
|
||||
* Converts a string to a floating-point number.
|
||||
* @param string A string that contains a floating-point number.
|
||||
* Converts a string to a floating-point number.
|
||||
* @param string A string that contains a floating-point number.
|
||||
*/
|
||||
parseFloat(string: string): number;
|
||||
|
||||
/**
|
||||
* Converts A string to an integer.
|
||||
* @param s A string to convert into a number.
|
||||
* @param radix A value between 2 and 36 that specifies the base of the number in numString.
|
||||
* @param radix A value between 2 and 36 that specifies the base of the number in numString.
|
||||
* If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.
|
||||
* All other strings are considered decimal.
|
||||
*/
|
||||
@@ -312,7 +307,7 @@ interface NumberConstructor {
|
||||
|
||||
interface ObjectConstructor {
|
||||
/**
|
||||
* Copy the values of all of the enumerable own properties from one or more source objects to a
|
||||
* Copy the values of all of the enumerable own properties from one or more source objects to a
|
||||
* target object. Returns the target object.
|
||||
* @param target The target object to copy to.
|
||||
* @param sources One or more source objects to copy properties from.
|
||||
@@ -390,7 +385,7 @@ interface Math {
|
||||
log1p(x: number): number;
|
||||
|
||||
/**
|
||||
* Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of
|
||||
* Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of
|
||||
* the natural logarithms).
|
||||
* @param x A numeric expression.
|
||||
*/
|
||||
@@ -497,21 +492,21 @@ interface Promise<T> {
|
||||
}
|
||||
|
||||
interface PromiseConstructor {
|
||||
/**
|
||||
* A reference to the prototype.
|
||||
/**
|
||||
* A reference to the prototype.
|
||||
*/
|
||||
prototype: Promise<any>;
|
||||
|
||||
/**
|
||||
* Creates a new Promise.
|
||||
* @param executor A callback used to initialize the promise. This callback is passed two arguments:
|
||||
* a resolve callback used resolve the promise with a value or the result of another promise,
|
||||
* @param executor A callback used to initialize the promise. This callback is passed two arguments:
|
||||
* a resolve callback used resolve the promise with a value or the result of another promise,
|
||||
* and a reject callback used to reject the promise with a provided reason or error.
|
||||
*/
|
||||
new <T>(executor: (resolve: (value?: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void): Promise<T>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved with an array of results when all of the provided Promises
|
||||
* Creates a Promise that is resolved with an array of results when all of the provided Promises
|
||||
* resolve, or rejected when any Promise is rejected.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
@@ -519,7 +514,7 @@ interface PromiseConstructor {
|
||||
all<T>(values: IterableShim<T | PromiseLike<T>>): Promise<T[]>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
|
||||
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
|
||||
* or rejected.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
@@ -670,4 +665,4 @@ declare module "es6-shim" {
|
||||
function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean;
|
||||
function setPrototypeOf(target: any, proto: any): boolean;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
///<reference path='fontoxml.d.ts' />
|
||||
|
||||
var workflow:com.fontoxml.IWorkflowInfo = {
|
||||
id:"1",
|
||||
displayName:"workflow"
|
||||
}
|
||||
|
||||
var user:com.fontoxml.IUserInfo = {
|
||||
id: "123",
|
||||
displayName: "test",
|
||||
roleId: "editor"
|
||||
}
|
||||
|
||||
var init:com.fontoxml.IInvocator = {
|
||||
documentIds: ["11-22-33","44-55-66"],
|
||||
cmsBaseUrl: "/test/",
|
||||
editSessionToken: "aa-bb-cc-dd-ee",
|
||||
user: user,
|
||||
workflow: workflow,
|
||||
autosave: false,
|
||||
heartbeat: 300
|
||||
}
|
||||
|
||||
var simpleinit:com.fontoxml.IInvocator = {
|
||||
documentIds: ["11-22-33","44-55-66"],
|
||||
cmsBaseUrl: "/test/",
|
||||
editSessionToken: "aa-bb-cc-dd-ee"
|
||||
}
|
||||
Vendored
+40
@@ -0,0 +1,40 @@
|
||||
// Type definitions for FontoXML
|
||||
// Project: http://www.fontoxml.com/
|
||||
// Definitions by: Roland Zwaga <https://github.com/rolandzwaga>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module com.fontoxml
|
||||
{
|
||||
//This is a description of how to invoke the FontoXML editor, and instruct it to load (a) document(s).
|
||||
//Please keep in mind that the URL length may be limited in certain browsers, so a safe limit of 2000 characters
|
||||
//for the whole URL including query parameters should be used.
|
||||
export interface IInvocator
|
||||
{
|
||||
//The document id's of the documents to load from the CMS.
|
||||
documentIds: string[];
|
||||
//The base URL where the CMS endpoints are exposed.
|
||||
cmsBaseUrl: string;
|
||||
//The edit session token to use for accessing the CMS endpoints.
|
||||
editSessionToken: string;
|
||||
//User information.
|
||||
user?: IUserInfo;
|
||||
//Workflow information.
|
||||
workflow?: IWorkflowInfo;
|
||||
//Allow/disallow auto-save functionality.
|
||||
autosave?: boolean;
|
||||
//If set to a positive integer, enable the Heartbeat API to send every x seconds.
|
||||
heartbeat?: number;
|
||||
}
|
||||
|
||||
export interface IWorkflowInfo
|
||||
{
|
||||
id:string;
|
||||
displayName:string;
|
||||
}
|
||||
|
||||
export interface IUserInfo extends IWorkflowInfo
|
||||
{
|
||||
roleId:string;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -43,6 +43,8 @@ app.on('ready', () => {
|
||||
|
||||
// and load the index.html of the app.
|
||||
mainWindow.loadUrl(`file://${__dirname}/index.html`);
|
||||
mainWindow.loadUrl('file://foo/bar', {userAgent: 'cool-agent', httpReferrer: 'greateRefferer'});
|
||||
mainWindow.webContents.loadUrl('file://foo/bar', {userAgent: 'cool-agent', httpReferrer: 'greateRefferer'});
|
||||
|
||||
mainWindow.openDevTools()
|
||||
var opened: boolean = mainWindow.isDevToolsOpened()
|
||||
@@ -409,6 +411,7 @@ app.on('ready', () => {
|
||||
]);
|
||||
appIcon.setToolTip('This is my application.');
|
||||
appIcon.setContextMenu(contextMenu);
|
||||
appIcon.setImage('/path/to/new/icon');
|
||||
});
|
||||
|
||||
// clipboard
|
||||
|
||||
Vendored
+9
-3
@@ -400,7 +400,10 @@ declare module GitHubElectron {
|
||||
/**
|
||||
* Same with webContents.loadUrl(url).
|
||||
*/
|
||||
loadUrl(url: string): void;
|
||||
loadUrl(url: string, options?: {
|
||||
httpReferrer?: string;
|
||||
userAgent?: string;
|
||||
}): void;
|
||||
/**
|
||||
* Same with webContents.reload.
|
||||
*/
|
||||
@@ -537,7 +540,10 @@ declare module GitHubElectron {
|
||||
* Loads the url in the window.
|
||||
* @param url Must contain the protocol prefix (e.g., the http:// or file://).
|
||||
*/
|
||||
loadUrl(url: string): void;
|
||||
loadUrl(url: string, options?: {
|
||||
httpReferrer?: string;
|
||||
userAgent?: string;
|
||||
}): void;
|
||||
/**
|
||||
* @returns The URL of current web page.
|
||||
*/
|
||||
@@ -1212,7 +1218,7 @@ declare module GitHubElectron {
|
||||
/**
|
||||
* Sets the image associated with this tray icon.
|
||||
*/
|
||||
setImage(image: NativeImage): void;
|
||||
setImage(image: NativeImage|string): void;
|
||||
/**
|
||||
* Sets the image associated with this tray icon when pressed.
|
||||
*/
|
||||
|
||||
Vendored
+1
-1
@@ -32,7 +32,7 @@ declare module JQueryGlide {
|
||||
/**
|
||||
* Default: 500
|
||||
* Animation time in ms
|
||||
* @type {Int}
|
||||
* @type {number}
|
||||
*/
|
||||
animationDuration?: number;
|
||||
/**
|
||||
|
||||
Vendored
+1
@@ -13,6 +13,7 @@ declare module "gm" {
|
||||
module m {
|
||||
export interface ClassOptions {
|
||||
imageMagick?: boolean;
|
||||
nativeAutoOrient?: boolean;
|
||||
}
|
||||
|
||||
export interface CompareCallback {
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
/// <reference path="gulp-cheerio.d.ts" />
|
||||
/// <reference path="../vinyl/vinyl.d.ts" />
|
||||
/// <reference path="../gulp/gulp.d.ts" />
|
||||
/// <reference path="../cheerio/cheerio.d.ts" />
|
||||
|
||||
import cheerio = require('gulp-cheerio');
|
||||
import gulp = require('gulp');
|
||||
import Vinyl = require('vinyl');
|
||||
|
||||
//
|
||||
// There are two ways to use gulp-cheerio: synchronous and asynchronous. See the following usage examples:
|
||||
//
|
||||
|
||||
gulp.task('sync', function () {
|
||||
return gulp
|
||||
.src(['src/*.html'])
|
||||
.pipe(cheerio(function ($: CheerioStatic, file: Vinyl) {
|
||||
// Each file will be run through cheerio and each corresponding `$` will be passed here.
|
||||
// `file` is the gulp file object
|
||||
// Make all h1 tags uppercase
|
||||
$('h1').each(function () {
|
||||
var h1 = $(this);
|
||||
h1.text(h1.text().toUpperCase());
|
||||
});
|
||||
}))
|
||||
.pipe(gulp.dest('dist/'));
|
||||
});
|
||||
gulp.task('async', function () {
|
||||
return gulp
|
||||
.src(['src/*.html'])
|
||||
.pipe(cheerio(function ($: CheerioStatic, file: Vinyl, done: Function) {
|
||||
// The only difference here is the inclusion of a `done` parameter.
|
||||
// Call `done` when everything is finished. `done` accepts an error if applicable.
|
||||
done();
|
||||
}))
|
||||
.pipe(gulp.dest('dist/'));
|
||||
});
|
||||
//TODO
|
||||
|
||||
|
||||
//
|
||||
// Additional options can be passed by passing an object as the main argument with your function as the run option:
|
||||
//
|
||||
|
||||
|
||||
gulp.task('sync', function () {
|
||||
return gulp
|
||||
.src(['src/*.html'])
|
||||
.pipe(cheerio({
|
||||
run: function ($: CheerioStatic, file: Vinyl) {
|
||||
// Each file will be run through cheerio and each corresponding `$` will be passed here.
|
||||
// `file` is the gulp file object
|
||||
// Make all h1 tags uppercase
|
||||
$('h1').each(function () {
|
||||
var h1 = $(this);
|
||||
h1.text(h1.text().toUpperCase());
|
||||
});
|
||||
}
|
||||
}))
|
||||
.pipe(gulp.dest('dist/'));
|
||||
});
|
||||
|
||||
gulp.task('async', function () {
|
||||
return gulp
|
||||
.src(['src/*.html'])
|
||||
.pipe(cheerio({
|
||||
run: function ($: CheerioStatic, file: Vinyl, done: Function) {
|
||||
// The only difference here is the inclusion of a `done` parameter.
|
||||
// Call `done` when everything is finished. `done` accepts an error if applicable.
|
||||
done();
|
||||
}
|
||||
}))
|
||||
.pipe(gulp.dest('dist/'));
|
||||
});
|
||||
|
||||
cheerio({
|
||||
run: function () {},
|
||||
parserOptions: {
|
||||
// Options here
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
cheerio({
|
||||
run: function () {},
|
||||
parserOptions: {
|
||||
xmlMode: true
|
||||
}
|
||||
});
|
||||
|
||||
cheerio({
|
||||
cheerio: require('../cheerio/cheerio.d.ts') as CheerioStatic // special version of `cheerio`
|
||||
});
|
||||
Vendored
+34
@@ -0,0 +1,34 @@
|
||||
// Type definitions for gulp-cheerio
|
||||
// Project: https://github.com/KenPowers/gulp-cheerio
|
||||
// Definitions by: Qubo <https://github.com/tkQubo>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../cheerio/cheerio.d.ts" />
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
/// <reference path="../vinyl/vinyl.d.ts"/>
|
||||
|
||||
declare module "gulp-cheerio" {
|
||||
import Vinyl = require('vinyl');
|
||||
|
||||
namespace cheerio {
|
||||
interface Cheerio {
|
||||
(callback: Callback): NodeJS.ReadWriteStream;
|
||||
(option: Option): NodeJS.ReadWriteStream;
|
||||
}
|
||||
|
||||
interface Callback {
|
||||
($: CheerioStatic, file: Vinyl, done?: Function): any;
|
||||
}
|
||||
|
||||
interface Option {
|
||||
run?: Callback;
|
||||
parserOptions?: CheerioOptionsInterface;
|
||||
cheerio?: CheerioStatic;
|
||||
}
|
||||
}
|
||||
|
||||
var cheerio: cheerio.Cheerio;
|
||||
|
||||
export = cheerio;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
/// <reference path="gulp-coffeelint.d.ts" />
|
||||
/// <reference path="../gulp/gulp.d.ts" />
|
||||
|
||||
import coffeelint = require('gulp-coffeelint');
|
||||
import gulp = require('gulp');
|
||||
|
||||
|
||||
gulp.task('lint', function () {
|
||||
gulp.src('./src/*.coffee')
|
||||
.pipe(coffeelint())
|
||||
.pipe(coffeelint.reporter())
|
||||
});
|
||||
|
||||
gulp.src('./src/*.coffee')
|
||||
.pipe(coffeelint())
|
||||
.pipe(coffeelint.reporter('csv'));
|
||||
|
||||
|
||||
declare var stylish: Function;
|
||||
|
||||
gulp.src('./src/*.coffee')
|
||||
.pipe(coffeelint())
|
||||
.pipe(coffeelint.reporter(stylish));
|
||||
|
||||
gulp.src('./src/*.coffee')
|
||||
.pipe(coffeelint())
|
||||
.pipe(coffeelint.reporter('coffelint-stylish'));
|
||||
|
||||
gulp.src('./src/*.coffee')
|
||||
.pipe(coffeelint())
|
||||
.pipe(coffeelint.reporter('coffeelint-stylish'))
|
||||
.pipe(coffeelint.reporter('fail'));
|
||||
|
||||
var myReporter = (function() {
|
||||
function MyReporter(errorReport: any) {
|
||||
this.errorReport = errorReport;
|
||||
}
|
||||
|
||||
MyReporter.prototype.publish = function() {
|
||||
var hasError = this.errorReport.hasError();
|
||||
if (hasError) {
|
||||
return console.log('Oh no!');
|
||||
}
|
||||
return console.log('Oh yeah!');
|
||||
};
|
||||
|
||||
return MyReporter;
|
||||
})();
|
||||
|
||||
gulp.task('lint', function() {
|
||||
return gulp.src('./src/*.coffee')
|
||||
.pipe(coffeelint())
|
||||
.pipe(coffeelint.reporter(myReporter));
|
||||
});
|
||||
|
||||
|
||||
|
||||
Vendored
+26
@@ -0,0 +1,26 @@
|
||||
// Type definitions for gulp-coffeelint
|
||||
// Project: https://github.com/janraasch/gulp-coffeelint
|
||||
// Definitions by: Qubo <https://github.com/tkQubo>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module "gulp-coffeelint" {
|
||||
namespace coffeelint {
|
||||
interface Coffeelint {
|
||||
/**
|
||||
* @param optFile Absolute path of a json file containing options for coffeelint.
|
||||
* @param opt Options you wish to send to coffeelint. If optFile is given, this will be ignored.
|
||||
* @param literate Are we dealing with Literate CoffeeScript?
|
||||
* @param rules Add custom rules to coffeelint.
|
||||
*/
|
||||
(optFile?: string, opt?: any, literate?: boolean, rules?: Function[]): NodeJS.ReadWriteStream;
|
||||
reporter(reporter?: string|Function): NodeJS.ReadWriteStream;
|
||||
}
|
||||
}
|
||||
|
||||
var coffeelint: coffeelint.Coffeelint;
|
||||
|
||||
export = coffeelint;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/// <reference path="../gulp/gulp.d.ts" />
|
||||
|
||||
import gulp = require("gulp");
|
||||
import concat = require("gulp-concat");
|
||||
import * as concat from "gulp-concat";
|
||||
|
||||
gulp.task("concat:simple", () => {
|
||||
gulp.src(["file*.txt"])
|
||||
|
||||
Vendored
+6
-3
@@ -35,8 +35,11 @@ declare module "gulp-concat" {
|
||||
contents?: NodeJS.ReadableStream | Buffer;
|
||||
}
|
||||
|
||||
function concat(filename: string, options?: IOptions): NodeJS.ReadWriteStream;
|
||||
function concat(options: IVinylOptions): NodeJS.ReadWriteStream;
|
||||
interface IConcat {
|
||||
(filename: string, options?: IOptions): NodeJS.ReadWriteStream;
|
||||
(options: IVinylOptions): NodeJS.ReadWriteStream;
|
||||
}
|
||||
|
||||
export = concat;
|
||||
var _tmp: IConcat;
|
||||
export = _tmp;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
/// <reference path="gulp-gzip.d.ts" />
|
||||
/// <reference path="../gulp/gulp.d.ts" />
|
||||
|
||||
import gulp = require('gulp');
|
||||
import gzip = require('gulp-gzip');
|
||||
|
||||
gzip({ append: true });
|
||||
|
||||
gzip({ extension: 'zip' }); // note that the `.` should not be included in the extension
|
||||
|
||||
gzip({ preExtension: 'gz' }); // note that the `.` should not be included in the extension
|
||||
|
||||
gzip({ threshold: '1kb' });
|
||||
|
||||
gzip({ threshold: 1024 });
|
||||
|
||||
gzip({ threshold: true });
|
||||
|
||||
gzip({ gzipOptions: { level: 9 } });
|
||||
|
||||
gzip({ gzipOptions: { memLevel: 1 } });
|
||||
|
||||
gulp.task('compress', function() {
|
||||
gulp.src('./dev/scripts/*.js')
|
||||
.pipe(gzip())
|
||||
.pipe(gulp.dest('./public/scripts'));
|
||||
});
|
||||
Vendored
+47
@@ -0,0 +1,47 @@
|
||||
// Type definitions for gulp-gzip
|
||||
// Project: https://github.com/jstuckey/gulp-gzip
|
||||
// Definitions by: Qubo <https://github.com/tkQubo>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module "gulp-gzip" {
|
||||
import zlib = require('zlib');
|
||||
|
||||
namespace gzip {
|
||||
interface Gzip {
|
||||
(options?: Options): NodeJS.ReadWriteStream;
|
||||
}
|
||||
|
||||
interface Options {
|
||||
/**
|
||||
* Appends .gz file extension if true.
|
||||
* @default true
|
||||
*/
|
||||
append?: boolean;
|
||||
/**
|
||||
* Appends an arbitrary extension to the filename. Disables append and preExtension options.
|
||||
*/
|
||||
extension?: string;
|
||||
/**
|
||||
* Appends an arbitrary pre-extension to the filename. Disables append and extension options.
|
||||
*/
|
||||
preExtension?: string;
|
||||
/**
|
||||
* Minimum size required to compress a file.
|
||||
* @default false
|
||||
*/
|
||||
threshold?: number|string|boolean;
|
||||
/**
|
||||
* Options object to pass through to zlib.Gzip.
|
||||
* See <a href='https://nodejs.org/api/zlib.html#zlib_options'>zlib</a> documentation for more information.
|
||||
*/
|
||||
gzipOptions?: zlib.ZlibOptions;
|
||||
}
|
||||
}
|
||||
|
||||
var gzip: gzip.Gzip;
|
||||
|
||||
export = gzip;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
/// <reference path="gulp-ng-annotate.d.ts" />
|
||||
/// <reference path="../gulp/gulp.d.ts" />
|
||||
|
||||
import ngAnnotate = require('gulp-ng-annotate');
|
||||
import gulp = require('gulp');
|
||||
|
||||
gulp.task('default', function () {
|
||||
return gulp.src('src/app.js')
|
||||
.pipe(ngAnnotate())
|
||||
.pipe(gulp.dest('dist'));
|
||||
});
|
||||
|
||||
ngAnnotate({
|
||||
remove: true,
|
||||
add: true,
|
||||
single_quotes: true
|
||||
});
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
// Type definitions for gulp-ng-annotate
|
||||
// Project: https://github.com/Kagami/gulp-ng-annotate
|
||||
// Definitions by: Qubo <https://github.com/tkQubo>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module "gulp-ng-annotate" {
|
||||
|
||||
namespace ngAnnotate {
|
||||
interface NgAnnotate {
|
||||
(option?: Option): NodeJS.ReadWriteStream;
|
||||
}
|
||||
|
||||
//TODO: Should be on ng-annotate module
|
||||
interface Option {
|
||||
/**
|
||||
* Add annotations where non-existing
|
||||
*/
|
||||
add?: boolean;
|
||||
/**
|
||||
* Remove all existing annotations
|
||||
*/
|
||||
remove?: boolean;
|
||||
/**
|
||||
* List optional matchers
|
||||
*/
|
||||
list?: boolean;
|
||||
/**
|
||||
* Restrict matching further or to expand matching
|
||||
*/
|
||||
regexp?: string;
|
||||
/**
|
||||
* Enable optional matcher
|
||||
*/
|
||||
enable?: boolean;
|
||||
/**
|
||||
* Output '$scope' instead of "$scope".
|
||||
*/
|
||||
single_quotes?: boolean;
|
||||
/**
|
||||
* Rename providers (services, factories, controllers, etc.) with a new name when declared and referenced through annotation
|
||||
*/
|
||||
rename?: RenameOption[];
|
||||
/**
|
||||
* Load a user plugin with the provided path
|
||||
*/
|
||||
plugin?: any[];
|
||||
}
|
||||
|
||||
interface RenameOption {
|
||||
from: string;
|
||||
to: string;
|
||||
}
|
||||
}
|
||||
|
||||
var ngAnnotate: ngAnnotate.NgAnnotate;
|
||||
|
||||
export = ngAnnotate;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
/// <reference path="gulp-nodemon.d.ts" />
|
||||
/// <reference path="../gulp/gulp.d.ts" />
|
||||
|
||||
import gulp = require('gulp');
|
||||
import path = require('path');
|
||||
import nodemon = require('gulp-nodemon');
|
||||
|
||||
gulp.task('start', function () {
|
||||
nodemon({
|
||||
script: 'server.js'
|
||||
, ext: 'js html'
|
||||
, env: { 'NODE_ENV': 'development' }
|
||||
})
|
||||
});
|
||||
|
||||
nodemon({
|
||||
script: 'index.js'
|
||||
, tasks: ['browserify']
|
||||
});
|
||||
|
||||
nodemon({
|
||||
script: './index.js'
|
||||
, ext: 'js css'
|
||||
, tasks: function (changedFiles: string[]): string[] {
|
||||
var tasks: string[] = [];
|
||||
changedFiles.forEach(function (file: string) {
|
||||
if (path.extname(file) === '.js' && !~tasks.indexOf('lint')) tasks.push('lint')
|
||||
if (path.extname(file) === '.css' && !~tasks.indexOf('cssmin')) tasks.push('cssmin')
|
||||
});
|
||||
return tasks
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
gulp.task('develop', function () {
|
||||
nodemon({ script: 'server.js'
|
||||
, ext: 'html js'
|
||||
, ignore: ['ignored.js']
|
||||
, tasks: ['lint'] })
|
||||
.on('restart', function () {
|
||||
console.log('restarted!')
|
||||
})
|
||||
});
|
||||
Vendored
+88
@@ -0,0 +1,88 @@
|
||||
// Type definitions for gulp-nodemon
|
||||
// Project: https://github.com/JacksonGariety/gulp-nodemon
|
||||
// Definitions by: Qubo <https://github.com/tkQubo>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module "gulp-nodemon" {
|
||||
namespace nodemon {
|
||||
|
||||
interface Nodemon {
|
||||
(option?: Option): EventEmitter;
|
||||
}
|
||||
|
||||
interface Option extends _Option {
|
||||
tasks?: string[]|((changedFiles: string[]) => string[]);
|
||||
}
|
||||
|
||||
// TODO: Properties may be insufficient
|
||||
// TODO: In future this interface should be moved to nodemon.d.ts
|
||||
interface _Option {
|
||||
env?: { [key: string]: string|boolean|number; };
|
||||
script?: string;
|
||||
/**
|
||||
* Extensions to look for, ie. js,jade,hbs.
|
||||
*/
|
||||
ext?: string;
|
||||
/**
|
||||
* Execute script with "app", ie. -x "python -v".
|
||||
*/
|
||||
exec?: string;
|
||||
/**
|
||||
* Watch directory "dir" or files. use once for each directory or file to watch.
|
||||
*/
|
||||
watch?: string[];
|
||||
/**
|
||||
* Ignore specific files or directories.
|
||||
*/
|
||||
ignore?: string[];
|
||||
/**
|
||||
* Minimise nodemon messages to start/stop only.
|
||||
*/
|
||||
quiet?: boolean;
|
||||
/**
|
||||
* Show detail on what is causing restarts.
|
||||
*/
|
||||
verbose?: boolean;
|
||||
/**
|
||||
* Try to read from stdin.
|
||||
*/
|
||||
stdin?: boolean;
|
||||
stdout?: boolean;
|
||||
/**
|
||||
* Execute script on change only, not startup
|
||||
*/
|
||||
runOnChangeOnly?: boolean;
|
||||
/**
|
||||
* Debounce restart in seconds.
|
||||
*/
|
||||
delay?: number;
|
||||
/**
|
||||
* Forces node to use the most compatible version for watching file changes.
|
||||
*/
|
||||
legacyWatch?: boolean;
|
||||
/**
|
||||
* Exit on crash, allows use of nodemon with daemon tools like forever.js.
|
||||
*/
|
||||
exitcrash?: boolean;
|
||||
execMap?: { [key: string]: string|boolean|number; };
|
||||
events?: { [key: string]: string; };
|
||||
restartable?: string;
|
||||
}
|
||||
|
||||
interface EventEmitter extends NodeJS.EventEmitter {
|
||||
addListener(event: string, listener: Function): EventEmitter;
|
||||
addListener(event: string, tasks: string[]): EventEmitter;
|
||||
on(event: string, listener: Function): EventEmitter;
|
||||
on(event: string, tasks: string[]): EventEmitter;
|
||||
once(event: string, listener: Function): EventEmitter;
|
||||
once(event: string, tasks: string[]): EventEmitter;
|
||||
}
|
||||
}
|
||||
|
||||
var nodemon: nodemon.Nodemon;
|
||||
|
||||
export = nodemon;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/// <reference path="./gulp-sass.d.ts"/>
|
||||
/// <reference path="../gulp/gulp.d.ts"/>
|
||||
import gulp = require("gulp");
|
||||
import sass = require("gulp-sass");
|
||||
import * as sass from "gulp-sass";
|
||||
|
||||
gulp.task('sass', function () {
|
||||
gulp.src('./scss/*.scss')
|
||||
|
||||
Vendored
+5
-2
@@ -43,7 +43,10 @@ declare module "gulp-sass" {
|
||||
sync?: boolean;
|
||||
}
|
||||
|
||||
function sass(opts?: Options): NodeJS.ReadWriteStream;
|
||||
interface Sass {
|
||||
(opts?: Options): NodeJS.ReadWriteStream;
|
||||
}
|
||||
|
||||
export = sass;
|
||||
var _tmp: Sass;
|
||||
export = _tmp;
|
||||
}
|
||||
@@ -80,3 +80,5 @@ Handlebars.registerHelper('fullName', (person: typeof context.author) => {
|
||||
});
|
||||
|
||||
var escapedExpression = Handlebars.Utils.escapeExpression('<script>alert(\'xss\');</script>');
|
||||
|
||||
Handlebars.helpers !== undefined;
|
||||
|
||||
Vendored
+1
@@ -18,6 +18,7 @@ declare module Handlebars {
|
||||
export var Utils: typeof hbs.Utils;
|
||||
export var logger: Logger;
|
||||
export var templates: HandlebarsTemplates;
|
||||
export var helpers: any;
|
||||
|
||||
export module AST {
|
||||
export var helpers: hbs.AST.helpers;
|
||||
|
||||
@@ -37,4 +37,4 @@ class AppController {
|
||||
}
|
||||
}
|
||||
|
||||
app.controller("AppController", AppController);
|
||||
app.controller("AppController", AppController);
|
||||
|
||||
Vendored
+4
-4
@@ -6,11 +6,11 @@
|
||||
/// <reference path="../highcharts/highcharts.d.ts" />
|
||||
|
||||
interface HighChartsNGConfig {
|
||||
options: HighchartsChartOptions;
|
||||
options: HighchartsOptions;
|
||||
//The below properties are watched separately for changes.
|
||||
|
||||
//Series object (optional) - a list of series using normal highcharts series options.
|
||||
series?: number[]|[number, number][]| HighchartsDataPoint[];
|
||||
series?: number[]|[number, number][]| HighchartsDataPoint[] | {data:number[];}[];
|
||||
//Title configuration (optional)
|
||||
title?: {
|
||||
text?: string;
|
||||
@@ -24,7 +24,7 @@ interface HighChartsNGConfig {
|
||||
currentMin?: number;
|
||||
currentMax?: number;
|
||||
title?: { text?: string }
|
||||
},
|
||||
};
|
||||
//Whether to use HighStocks instead of HighCharts (optional). Defaults to false.
|
||||
useHighStocks?: boolean;
|
||||
//size (optional) if left out the chart will default to size of the div or something sensible.
|
||||
@@ -40,4 +40,4 @@ interface HighChartsNGConfig {
|
||||
interface HighChartsNGChart extends HighChartsNGConfig {
|
||||
//This is a simple way to access all the Highcharts API that is not currently managed by this directive.
|
||||
getHighcharts(): HighchartsChartObject;
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -249,7 +249,7 @@ interface HighchartsCSSObject {
|
||||
fontWeight?: string;
|
||||
left?: string;
|
||||
opacity?: number;
|
||||
padding?: string;
|
||||
padding?: string | number;
|
||||
position?: string;
|
||||
top?: string;
|
||||
}
|
||||
|
||||
Vendored
+9
-4
@@ -22,29 +22,34 @@ declare module i18n {
|
||||
*/
|
||||
directory?: string;
|
||||
|
||||
/**
|
||||
/**
|
||||
* whether to write new locale information to disk
|
||||
* @default true
|
||||
*/
|
||||
updateFiles?: boolean;
|
||||
|
||||
/**
|
||||
/**
|
||||
* What to use as the indentation unit
|
||||
* @default "\t"
|
||||
*/
|
||||
indent?: string;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Setting extension of json files (you might want to set this to '.js' according to webtranslateit)
|
||||
* @default ".json"
|
||||
*/
|
||||
extension?: string;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Enable object notation
|
||||
* @default false
|
||||
*/
|
||||
objectNotation?: boolean;
|
||||
|
||||
/**
|
||||
* json files prefix
|
||||
*/
|
||||
prefix?: string;
|
||||
}
|
||||
export interface TranslateOptions {
|
||||
phrase: string;
|
||||
|
||||
Vendored
+9
@@ -19,6 +19,12 @@ interface IResourceStoreKey {
|
||||
|
||||
interface I18nTranslateOptions extends I18nextOptions {
|
||||
defaultValue?: any; // normally a string
|
||||
// NOTE https://github.com/borisyankov/DefinitelyTyped/pull/5590
|
||||
toAdd?: any;
|
||||
child?: any;
|
||||
sprintf?: any;
|
||||
count?: any;
|
||||
context?: any;
|
||||
}
|
||||
|
||||
interface I18nextOptions {
|
||||
@@ -66,6 +72,9 @@ interface I18nextOptions {
|
||||
cookieName?: string; // Default value: 'i18next'
|
||||
|
||||
postProcess?: string; // Default value: undefined
|
||||
|
||||
// NOTE https://github.com/borisyankov/DefinitelyTyped/pull/5590
|
||||
replace?: any;
|
||||
}
|
||||
|
||||
interface I18nextStatic {
|
||||
|
||||
@@ -0,0 +1,528 @@
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
/// <reference path="inquirer.d.ts" />
|
||||
|
||||
import inquirer = require('inquirer');
|
||||
|
||||
|
||||
inquirer.prompt([/* Pass your questions in here */], function( answers: inquirer.Answers ) {
|
||||
// Use user feedback for... whatever!!
|
||||
});
|
||||
|
||||
//
|
||||
// examples/bottom-bar.js
|
||||
//
|
||||
|
||||
//var BottomBar = require("../lib/ui/bottom-bar");
|
||||
var BottomBar = inquirer.ui.BottomBar;
|
||||
declare var cmdify: any;
|
||||
|
||||
var loader = [
|
||||
"/ Installing",
|
||||
"| Installing",
|
||||
"\\ Installing",
|
||||
"- Installing"
|
||||
];
|
||||
var i = 4;
|
||||
var ui = new BottomBar({ bottomBar: loader[i % 4] });
|
||||
|
||||
setInterval(function() {
|
||||
ui.updateBottomBar( loader[i++ % 4] );
|
||||
}, 300 );
|
||||
|
||||
var spawn = require("child_process").spawn;
|
||||
|
||||
var cmd = spawn(cmdify("npm"), [ "-g", "install", "inquirer" ], { stdio: "pipe" });
|
||||
cmd.stdout.pipe( ui.log );
|
||||
cmd.on( "close", function() {
|
||||
ui.updateBottomBar("Installation done!\n");
|
||||
process.exit();
|
||||
});
|
||||
|
||||
|
||||
//
|
||||
// examples/checkbox.js
|
||||
//
|
||||
|
||||
/**
|
||||
* Checkbox list examples
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
//var inquirer = require("../lib/inquirer");
|
||||
|
||||
inquirer.prompt([
|
||||
{
|
||||
type: "checkbox",
|
||||
message: "Select toppings",
|
||||
name: "toppings",
|
||||
choices: [
|
||||
new inquirer.Separator("The usual:"),
|
||||
{
|
||||
name: "Peperonni"
|
||||
},
|
||||
{
|
||||
name: "Cheese",
|
||||
checked: true
|
||||
},
|
||||
{
|
||||
name: "Mushroom"
|
||||
},
|
||||
new inquirer.Separator("The extras:"),
|
||||
{
|
||||
name: "Pineapple",
|
||||
},
|
||||
{
|
||||
name: "Bacon"
|
||||
},
|
||||
{
|
||||
name: "Olives",
|
||||
disabled: "out of stock"
|
||||
},
|
||||
{
|
||||
name: "Extra cheese"
|
||||
}
|
||||
],
|
||||
validate: function( answer ) {
|
||||
if ( answer.length < 1 ) {
|
||||
return "You must choose at least one topping.";
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
], function( answers: inquirer.Answers ) {
|
||||
console.log( JSON.stringify(answers, null, " ") );
|
||||
});
|
||||
|
||||
|
||||
//
|
||||
// examples/expand.js
|
||||
//
|
||||
|
||||
/**
|
||||
* Expand list examples
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
//var inquirer = require("../lib/inquirer");
|
||||
|
||||
inquirer.prompt([
|
||||
{
|
||||
type: "expand",
|
||||
message: "Conflict on `file.js`: ",
|
||||
name: "overwrite",
|
||||
choices: [
|
||||
{
|
||||
key: "y",
|
||||
name: "Overwrite",
|
||||
value: "overwrite"
|
||||
},
|
||||
{
|
||||
key: "a",
|
||||
name: "Overwrite this one and all next",
|
||||
value: "overwrite_all"
|
||||
},
|
||||
{
|
||||
key: "d",
|
||||
name: "Show diff",
|
||||
value: "diff"
|
||||
},
|
||||
new inquirer.Separator(),
|
||||
{
|
||||
key: "x",
|
||||
name: "Abort",
|
||||
value: "abort"
|
||||
}
|
||||
]
|
||||
}
|
||||
], function( answers: inquirer.Answers ) {
|
||||
console.log( JSON.stringify(answers, null, " ") );
|
||||
});
|
||||
|
||||
|
||||
//
|
||||
// examples/input.js
|
||||
//
|
||||
|
||||
/**
|
||||
* Input prompt example
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
//var inquirer = require("../lib/inquirer");
|
||||
|
||||
var questions = [
|
||||
{
|
||||
type: "input",
|
||||
name: "first_name",
|
||||
message: "What's your first name"
|
||||
},
|
||||
{
|
||||
type: "input",
|
||||
name: "last_name",
|
||||
message: "What's your last name",
|
||||
default: function () { return "Doe"; }
|
||||
},
|
||||
{
|
||||
type: "input",
|
||||
name: "phone",
|
||||
message: "What's your phone number",
|
||||
validate: function( value: string ): string|boolean {
|
||||
var pass = value.match(/^([01]{1})?[\-\.\s]?\(?(\d{3})\)?[\-\.\s]?(\d{3})[\-\.\s]?(\d{4})\s?((?:#|ext\.?\s?|x\.?\s?){1}(?:\d+)?)?$/i);
|
||||
if (pass) {
|
||||
return true;
|
||||
} else {
|
||||
return "Please enter a valid phone number";
|
||||
}
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
inquirer.prompt( questions, function( answers ) {
|
||||
console.log( JSON.stringify(answers, null, " ") );
|
||||
});
|
||||
|
||||
//
|
||||
// examples/list.js
|
||||
//
|
||||
|
||||
|
||||
/**
|
||||
* List prompt example
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
//var inquirer = require("../lib/inquirer");
|
||||
|
||||
inquirer.prompt([
|
||||
{
|
||||
type: "list",
|
||||
name: "theme",
|
||||
message: "What do you want to do?",
|
||||
choices: [
|
||||
"Order a pizza",
|
||||
"Make a reservation",
|
||||
new inquirer.Separator(),
|
||||
"Ask opening hours",
|
||||
"Talk to the receptionnist"
|
||||
]
|
||||
},
|
||||
{
|
||||
type: "list",
|
||||
name: "size",
|
||||
message: "What size do you need",
|
||||
choices: [ "Jumbo", "Large", "Standard", "Medium", "Small", "Micro" ],
|
||||
filter: function( val: string ) { return val.toLowerCase(); }
|
||||
}
|
||||
], function( answers: inquirer.Answers ) {
|
||||
console.log( JSON.stringify(answers, null, " ") );
|
||||
});
|
||||
|
||||
//
|
||||
// examples/long-list.js
|
||||
//
|
||||
|
||||
/**
|
||||
* Paginated list
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
//var inquirer = require("../lib/inquirer");
|
||||
|
||||
var choices = Array.apply(0, new Array(26)).map(function(x: number,y: number) {
|
||||
return String.fromCharCode(y + 65);
|
||||
});
|
||||
choices.push("Multiline option \n super cool feature");
|
||||
choices.push("Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium.");
|
||||
|
||||
inquirer.prompt([
|
||||
{
|
||||
type : "list",
|
||||
name : "letter",
|
||||
message : "What's your favorite letter?",
|
||||
paginated : true,
|
||||
choices : choices
|
||||
},
|
||||
{
|
||||
type : "checkbox",
|
||||
name : "name",
|
||||
message : "Select the letter contained in your name:",
|
||||
paginated : true,
|
||||
choices : choices
|
||||
}
|
||||
], function( answers: inquirer.Answers ) {
|
||||
console.log( JSON.stringify(answers, null, " ") );
|
||||
});
|
||||
|
||||
//
|
||||
// examples/nested-call.js
|
||||
//
|
||||
|
||||
/**
|
||||
* Nested Inquirer call
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
//var inquirer = require("../lib/inquirer");
|
||||
|
||||
inquirer.prompt({
|
||||
type: "list",
|
||||
name: "chocolate",
|
||||
message: "What's your favorite chocolate?",
|
||||
choices: [ "Mars", "Oh Henry", "Hershey" ]
|
||||
}, function( answers: inquirer.Answers ) {
|
||||
inquirer.prompt({
|
||||
type: "list",
|
||||
name: "beverage",
|
||||
message: "And your favorite beverage?",
|
||||
choices: [ "Pepsi", "Coke", "7up", "Mountain Dew", "Red Bull" ]
|
||||
});
|
||||
});
|
||||
|
||||
//
|
||||
// examples/password.js
|
||||
//
|
||||
|
||||
/**
|
||||
* Password prompt example
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
//var inquirer = require("../lib/inquirer");
|
||||
|
||||
inquirer.prompt([
|
||||
{
|
||||
type: "password",
|
||||
message: "Enter your git password",
|
||||
name: "password"
|
||||
}
|
||||
], function( answers: inquirer.Answers ) {
|
||||
console.log( JSON.stringify(answers, null, " ") );
|
||||
});
|
||||
|
||||
//
|
||||
// examples/pizza.js
|
||||
//
|
||||
|
||||
/**
|
||||
* Pizza delivery prompt example
|
||||
* run example by writing `node pizza.js` in your console
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
//var inquirer = require("../lib/inquirer");
|
||||
|
||||
console.log("Hi, welcome to Node Pizza");
|
||||
|
||||
var questions2 = [
|
||||
{
|
||||
type: "confirm",
|
||||
name: "toBeDelivered",
|
||||
message: "Is it for a delivery",
|
||||
default: false
|
||||
},
|
||||
{
|
||||
type: "input",
|
||||
name: "phone",
|
||||
message: "What's your phone number",
|
||||
validate: function( value: string ): string|boolean {
|
||||
var pass = value.match(/^([01]{1})?[\-\.\s]?\(?(\d{3})\)?[\-\.\s]?(\d{3})[\-\.\s]?(\d{4})\s?((?:#|ext\.?\s?|x\.?\s?){1}(?:\d+)?)?$/i);
|
||||
if (pass) {
|
||||
return true;
|
||||
} else {
|
||||
return "Please enter a valid phone number";
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
type: "list",
|
||||
name: "size",
|
||||
message: "What size do you need",
|
||||
choices: [ "Large", "Medium", "Small" ],
|
||||
filter: function( val: string ) { return val.toLowerCase(); }
|
||||
},
|
||||
{
|
||||
type: "input",
|
||||
name: "quantity",
|
||||
message: "How many do you need",
|
||||
validate: function( value: string ) {
|
||||
var valid = !isNaN(parseFloat(value));
|
||||
return valid || "Please enter a number";
|
||||
},
|
||||
filter: Number
|
||||
},
|
||||
{
|
||||
type: "expand",
|
||||
name: "toppings",
|
||||
message: "What about the toping",
|
||||
choices: [
|
||||
{
|
||||
key: "p",
|
||||
name: "Peperonni and chesse",
|
||||
value: "PeperonniChesse"
|
||||
},
|
||||
{
|
||||
key: "a",
|
||||
name: "All dressed",
|
||||
value: "alldressed"
|
||||
},
|
||||
{
|
||||
key: "w",
|
||||
name: "Hawaïan",
|
||||
value: "hawaian"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
type: "rawlist",
|
||||
name: "beverage",
|
||||
message: "You also get a free 2L beverage",
|
||||
choices: [ "Pepsi", "7up", "Coke" ]
|
||||
},
|
||||
{
|
||||
type: "input",
|
||||
name: "comments",
|
||||
message: "Any comments on your purchase experience",
|
||||
default: "Nope, all good!"
|
||||
},
|
||||
{
|
||||
type: "list",
|
||||
name: "prize",
|
||||
message: "For leaving a comments, you get a freebie",
|
||||
choices: [ "cake", "fries" ],
|
||||
when: function( answers: inquirer.Answers ) {
|
||||
return answers['comments'] !== "Nope, all good!";
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
inquirer.prompt( questions, function( answers ) {
|
||||
console.log("\nOrder receipt:");
|
||||
console.log( JSON.stringify(answers, null, " ") );
|
||||
});
|
||||
|
||||
//
|
||||
// examples/rawlist.js
|
||||
//
|
||||
|
||||
/**
|
||||
* Raw List prompt example
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
//var inquirer = require("../lib/inquirer");
|
||||
|
||||
inquirer.prompt([
|
||||
{
|
||||
type: "rawlist",
|
||||
name: "theme",
|
||||
message: "What do you want to do?",
|
||||
choices: [
|
||||
"Order a pizza",
|
||||
"Make a reservation",
|
||||
new inquirer.Separator(),
|
||||
"Ask opening hours",
|
||||
"Talk to the receptionnist"
|
||||
]
|
||||
},
|
||||
{
|
||||
type: "rawlist",
|
||||
name: "size",
|
||||
message: "What size do you need",
|
||||
choices: [ "Jumbo", "Large", "Standard", "Medium", "Small", "Micro" ],
|
||||
filter: function( val: string ) { return val.toLowerCase(); }
|
||||
}
|
||||
], function( answers: inquirer.Answers ) {
|
||||
console.log( JSON.stringify(answers, null, " ") );
|
||||
});
|
||||
|
||||
//
|
||||
// examples/recursive.js
|
||||
//
|
||||
|
||||
/**
|
||||
* Recursive prompt example
|
||||
* Allows user to choose when to exit prompt
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
//var inquirer = require("../lib/inquirer");
|
||||
var output2: (string|boolean)[] = [];
|
||||
|
||||
var questions3 = [
|
||||
{
|
||||
type: "input",
|
||||
name: "tvShow",
|
||||
message: "What's your favorite TV show?"
|
||||
},
|
||||
{
|
||||
type: "confirm",
|
||||
name: "askAgain",
|
||||
message: "Want to enter another TV show favorite (just hit enter for YES)?",
|
||||
default: true
|
||||
}
|
||||
];
|
||||
|
||||
function ask() {
|
||||
inquirer.prompt( questions3, function( answers: inquirer.Answers ) {
|
||||
output2.push( answers['tvShow'] );
|
||||
if ( answers['askAgain'] ) {
|
||||
ask();
|
||||
} else {
|
||||
console.log( "Your favorite TV Shows:", output2.join(", ") );
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ask();
|
||||
|
||||
//
|
||||
// examples/when.js
|
||||
//
|
||||
|
||||
|
||||
/**
|
||||
* When example
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
//var inquirer = require("../lib/inquirer");
|
||||
|
||||
var questions4 = [
|
||||
{
|
||||
type: "confirm",
|
||||
name: "bacon",
|
||||
message: "Do you like bacon?"
|
||||
},
|
||||
{
|
||||
type: "input",
|
||||
name: "favorite",
|
||||
message: "Bacon lover, what is your favorite type of bacon?",
|
||||
when: function ( answers: inquirer.Answers ) {
|
||||
return answers['bacon'];
|
||||
}
|
||||
},
|
||||
{
|
||||
type: "confirm",
|
||||
name: "pizza",
|
||||
message: "Ok... Do you like pizza?",
|
||||
when: function (answers: inquirer.Answers) {
|
||||
return !likesFood( "bacon" )(answers);
|
||||
}
|
||||
},
|
||||
{
|
||||
type: "input",
|
||||
name: "favorite",
|
||||
message: "Whew! What is your favorite type of pizza?",
|
||||
when: likesFood( "pizza" )
|
||||
}
|
||||
];
|
||||
|
||||
function likesFood ( aFood: string ) {
|
||||
return function ( answers: inquirer.Answers ) {
|
||||
return answers[ aFood ];
|
||||
}
|
||||
}
|
||||
|
||||
inquirer.prompt(questions, function (answers) {
|
||||
console.log( JSON.stringify(answers, null, " ") );
|
||||
});
|
||||
Vendored
+299
@@ -0,0 +1,299 @@
|
||||
// Type definitions for Inquirer.js
|
||||
// Project: https://github.com/SBoudrias/Inquirer.js
|
||||
// Definitions by: Qubo <https://github.com/tkQubo>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../rx/rx-lite.d.ts" />
|
||||
/// <reference path="../through/through.d.ts" />
|
||||
|
||||
declare module "inquirer" {
|
||||
import through = require('through');
|
||||
|
||||
namespace inquirer {
|
||||
type Prompts = { [name: string]: PromptModule };
|
||||
type ChoiceType = string|objects.ChoiceOption|objects.Separator;
|
||||
type Questions = Question|Question[]|Rx.Observable<Question>;
|
||||
|
||||
interface Inquirer {
|
||||
restoreDefaultPrompts(): void;
|
||||
/**
|
||||
* Expose helper functions on the top level for easiest usage by common users
|
||||
* @param name
|
||||
* @param prompt
|
||||
*/
|
||||
registerPrompt(name: string, prompt: PromptModule): void;
|
||||
/**
|
||||
* Create a new self-contained prompt module.
|
||||
*/
|
||||
createPromptModule(): PromptModule;
|
||||
/**
|
||||
* Public CLI helper interface
|
||||
* @param questions Questions settings array
|
||||
* @param cb Callback being passed the user answers
|
||||
* @return
|
||||
*/
|
||||
prompt(questions: Questions, cb?: (answers: Answers) => any): ui.Prompt;
|
||||
prompts: Prompts;
|
||||
Separator: objects.SeparatorStatic;
|
||||
ui: {
|
||||
BottomBar: ui.BottomBar;
|
||||
Prompt: ui.Prompt;
|
||||
}
|
||||
}
|
||||
|
||||
interface PromptModule {
|
||||
(questions: Questions, cb: (answers: Answers) => any): ui.Prompt;
|
||||
/**
|
||||
* Register a prompt type
|
||||
* @param name Prompt type name
|
||||
* @param prompt Prompt constructor
|
||||
*/
|
||||
registerPrompt(name: string, prompt: PromptModule): ui.Prompt;
|
||||
/**
|
||||
* Register the defaults provider prompts
|
||||
*/
|
||||
restoreDefaultPrompts(): void;
|
||||
}
|
||||
|
||||
interface Question {
|
||||
/**
|
||||
* Type of the prompt.
|
||||
* Possible values:
|
||||
* <ul>
|
||||
* <li>input</li>
|
||||
* <li>confirm</li>
|
||||
* <li>list</li>
|
||||
* <li>rawlist</li>
|
||||
* <li>password</li>
|
||||
* </ul>
|
||||
* @defaults: 'input'
|
||||
*/
|
||||
type?: string;
|
||||
/**
|
||||
* The name to use when storing the answer in the anwers hash.
|
||||
*/
|
||||
name?: string;
|
||||
/**
|
||||
* The question to print. If defined as a function,
|
||||
* the first parameter will be the current inquirer session answers.
|
||||
*/
|
||||
message?: string|((answers: Answers) => string);
|
||||
/**
|
||||
* Default value(s) to use if nothing is entered, or a function that returns the default value(s).
|
||||
* If defined as a function, the first parameter will be the current inquirer session answers.
|
||||
*/
|
||||
default?: any|((answers: Answers) => any);
|
||||
/**
|
||||
* Choices array or a function returning a choices array. If defined as a function,
|
||||
* the first parameter will be the current inquirer session answers.
|
||||
* Array values can be simple strings, or objects containing a name (to display) and a value properties
|
||||
* (to save in the answers hash). Values can also be a Separator.
|
||||
*/
|
||||
choices?: ChoiceType[]|((answers: Answers) => ChoiceType[]);
|
||||
/**
|
||||
* Receive the user input and should return true if the value is valid, and an error message (String)
|
||||
* otherwise. If false is returned, a default error message is provided.
|
||||
*/
|
||||
validate?(input: string): boolean|string;
|
||||
/**
|
||||
* Receive the user input and return the filtered value to be used inside the program.
|
||||
* The value returned will be added to the Answers hash.
|
||||
*/
|
||||
filter?(input: string): string;
|
||||
/**
|
||||
* Receive the current user answers hash and should return true or false depending on whether or
|
||||
* not this question should be asked. The value can also be a simple boolean.
|
||||
*/
|
||||
when?: boolean|((answers: Answers) => boolean);
|
||||
paginated?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* A key/value hash containing the client answers in each prompt.
|
||||
*/
|
||||
interface Answers {
|
||||
[key: string]: string|boolean;
|
||||
}
|
||||
|
||||
namespace ui {
|
||||
/**
|
||||
* Base interface class other can inherits from
|
||||
*/
|
||||
interface Prompt extends BaseUI<Prompts> {
|
||||
new(promptModule: Prompts): Prompt;
|
||||
/**
|
||||
* Once all prompt are over
|
||||
*/
|
||||
onCompletion(): void;
|
||||
processQuestion(question: Question): any;
|
||||
fetchAnswer(question: Question): any;
|
||||
setDefaultType(question: Question): any;
|
||||
filterIfRunnable(question: Question): any;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sticky bottom bar user interface
|
||||
*/
|
||||
interface BottomBar extends BaseUI<BottomBarOption> {
|
||||
new(opt?: BottomBarOption): BottomBar;
|
||||
/**
|
||||
* Render the prompt to screen
|
||||
* @return self
|
||||
*/
|
||||
render(): BottomBar;
|
||||
/**
|
||||
* Update the bottom bar content and rerender
|
||||
* @param bottomBar Bottom bar content
|
||||
* @return self
|
||||
*/
|
||||
updateBottomBar(bottomBar: string): BottomBar;
|
||||
/**
|
||||
* Rerender the prompt
|
||||
* @return self
|
||||
*/
|
||||
writeLog(data: any): BottomBar;
|
||||
/**
|
||||
* Make sure line end on a line feed
|
||||
* @param str Input string
|
||||
* @return The input string with a final line feed
|
||||
*/
|
||||
enforceLF(str: string): string;
|
||||
/**
|
||||
* Helper for writing message in Prompt
|
||||
* @param message The message to be output
|
||||
*/
|
||||
write(message: string): void;
|
||||
log: through.ThroughStream;
|
||||
}
|
||||
|
||||
interface BottomBarOption {
|
||||
bottomBar?: string;
|
||||
}
|
||||
/**
|
||||
* Base interface class other can inherits from
|
||||
*/
|
||||
interface BaseUI<TOpt> {
|
||||
new(opt: TOpt): void;
|
||||
/**
|
||||
* Handle the ^C exit
|
||||
* @return {null}
|
||||
*/
|
||||
onForceClose(): void;
|
||||
/**
|
||||
* Close the interface and cleanup listeners
|
||||
*/
|
||||
close(): void;
|
||||
/**
|
||||
* Handle and propagate keypress events
|
||||
*/
|
||||
onKeypress(s: string, key: Key): void;
|
||||
}
|
||||
|
||||
interface Key {
|
||||
sequence: string;
|
||||
name: string;
|
||||
meta: boolean;
|
||||
shift: boolean;
|
||||
ctrl: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
namespace objects {
|
||||
/**
|
||||
* Choice object
|
||||
* Normalize input as choice object
|
||||
* @constructor
|
||||
* @param {String|Object} val Choice value. If an object is passed, it should contains
|
||||
* at least one of `value` or `name` property
|
||||
*/
|
||||
interface Choice {
|
||||
new(str: string): Choice;
|
||||
new(separator: Separator): Choice;
|
||||
new(option: ChoiceOption): Choice;
|
||||
}
|
||||
|
||||
interface ChoiceOption {
|
||||
name?: string;
|
||||
value?: string;
|
||||
type?: string;
|
||||
extra?: any;
|
||||
key?: string;
|
||||
checked?: boolean;
|
||||
disabled?: string|((answers: Answers) => any);
|
||||
}
|
||||
|
||||
/**
|
||||
* Choices collection
|
||||
* Collection of multiple `choice` object
|
||||
* @constructor
|
||||
* @param choices All `choice` to keep in the collection
|
||||
*/
|
||||
interface Choices {
|
||||
new(choices: (string|Separator|ChoiceOption)[], answers?: Answers): Choices;
|
||||
choices: Choice[];
|
||||
realChoices: Choice[];
|
||||
length: number;
|
||||
realLength: number;
|
||||
/**
|
||||
* Get a valid choice from the collection
|
||||
* @param selector The selected choice index
|
||||
* @return Return the matched choice or undefined
|
||||
*/
|
||||
getChoice(selector: number): Choice;
|
||||
/**
|
||||
* Get a raw element from the collection
|
||||
* @param selector The selected index value
|
||||
* @return Return the matched choice or undefined
|
||||
*/
|
||||
get(selector: number): Choice;
|
||||
/**
|
||||
* Match the valid choices against a where clause
|
||||
* @param whereClause Lodash `where` clause
|
||||
* @return Matching choices or empty array
|
||||
*/
|
||||
where<U extends {}>(whereClause: U): Choice[];
|
||||
/**
|
||||
* Pluck a particular key from the choices
|
||||
* @param propertyName Property name to select
|
||||
* @return Selected properties
|
||||
*/
|
||||
pluck(propertyName: string): any[];
|
||||
forEach<T>(application: (choice: Choice) => T): T[];
|
||||
}
|
||||
|
||||
interface SeparatorStatic {
|
||||
/**
|
||||
* @param line Separation line content (facultative)
|
||||
*/
|
||||
new(line?: string): Separator;
|
||||
/**
|
||||
* Helper function returning false if object is a separator
|
||||
* @param obj object to test against
|
||||
* @return `false` if object is a separator
|
||||
*/
|
||||
exclude(obj: any): boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Separator object
|
||||
* Used to space/separate choices group
|
||||
* @constructor
|
||||
* @param {String} line Separation line content (facultative)
|
||||
*/
|
||||
interface Separator {
|
||||
type: string;
|
||||
line: string;
|
||||
/**
|
||||
* Stringify separator
|
||||
* @return {String} the separator display string
|
||||
*/
|
||||
toString(): string;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var inquirer: inquirer.Inquirer;
|
||||
|
||||
export = inquirer;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,287 @@
|
||||
/// <reference path="../jquery-ajax-chain/jquery-ajax-chain.d.ts" />
|
||||
/// <reference path="../jquery/jquery.d.ts" />
|
||||
/// <reference path="../core-js/core-js.d.ts" />
|
||||
|
||||
function test_public_methods(): void {
|
||||
|
||||
let ajaxChain: ajaxChain.JQueryAjaxChain,
|
||||
configurationObj1: ajaxChain.AjaxChainConfiguration,
|
||||
configurationObj2: ajaxChain.AjaxChainConfiguration;
|
||||
|
||||
configurationObj1 = {
|
||||
|
||||
ajaxSettings: {
|
||||
|
||||
type: 'GET',
|
||||
dataType: 'xml',
|
||||
url: '/endpoint1'
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
configurationObj2 = {
|
||||
|
||||
ajaxSettings: {
|
||||
|
||||
type: 'GET',
|
||||
dataType: 'xml',
|
||||
url: '/endpoint2'
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
ajaxChain.enqueue(configurationObj1);
|
||||
ajaxChain.clearQueue();
|
||||
ajaxChain.enqueue([configurationObj1, configurationObj2]);
|
||||
ajaxChain.dequeue().then(doneResult => { console.log(doneResult); },
|
||||
failResult => { console.log(failResult); },
|
||||
progressResult => { console.log(progressResult); });
|
||||
|
||||
}
|
||||
|
||||
function test_optional_parameters(): void {
|
||||
|
||||
let itemsCollectionCache: XMLDocument = null,
|
||||
itemDetailCacheMap: WeakMap<String, XMLDocument> = new WeakMap<String, XMLDocument>(),
|
||||
ajaxChain: ajaxChain.JQueryAjaxChain,
|
||||
configurationObj1: ajaxChain.AjaxChainConfiguration,
|
||||
configurationObj2: ajaxChain.AjaxChainConfiguration,
|
||||
configurationObj3: ajaxChain.AjaxChainConfiguration,
|
||||
configurationObj4: ajaxChain.AjaxChainConfiguration;
|
||||
|
||||
ajaxChain = new $.AjaxChain();
|
||||
|
||||
configurationObj1 = {
|
||||
|
||||
ajaxSettings: {
|
||||
|
||||
type: 'GET',
|
||||
dataType: 'xml',
|
||||
url: '/items',
|
||||
success: function (xmlResponse): void {
|
||||
|
||||
itemsCollectionCache = xmlResponse;
|
||||
|
||||
},
|
||||
|
||||
},
|
||||
|
||||
hasHaltingCapabilities: function (xmlResponse): Boolean {
|
||||
|
||||
let $tempXmlResponse: JQuery;
|
||||
|
||||
$tempXmlResponse = $(xmlResponse);
|
||||
|
||||
if (!$tempXmlResponse.find('item').length) {
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
},
|
||||
|
||||
hasCache: function (xmlResponse): XMLDocument {
|
||||
|
||||
if (itemsCollectionCache) {
|
||||
|
||||
return itemsCollectionCache;
|
||||
|
||||
};
|
||||
|
||||
return null;
|
||||
},
|
||||
|
||||
transform: function (xmlResponse): Object {
|
||||
|
||||
let $tempXmlResponse: JQuery,
|
||||
$tempItems: JQuery,
|
||||
nextCallDataObj: Object;
|
||||
|
||||
$tempXmlResponse = $(xmlResponse);
|
||||
$tempItems = $tempXmlResponse.find('item');
|
||||
|
||||
if ($tempItems.length) {
|
||||
|
||||
nextCallDataObj = {
|
||||
|
||||
id: $tempItems.first()
|
||||
.attr('id')
|
||||
|
||||
};
|
||||
|
||||
return nextCallDataObj;
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
configurationObj2 = {
|
||||
|
||||
ajaxSettings: {
|
||||
|
||||
type: 'GET',
|
||||
dataType: 'xml',
|
||||
url: '/item',
|
||||
success: function (xmlResponse): void {
|
||||
|
||||
let $tempXmlResponse: JQuery,
|
||||
itemId: String;
|
||||
|
||||
$tempXmlResponse = $(xmlResponse);
|
||||
|
||||
itemId = $tempXmlResponse.find('id')
|
||||
.text();
|
||||
|
||||
if (itemId && !itemDetailCacheMap.has(itemId)) {
|
||||
|
||||
itemDetailCacheMap.set(itemId, xmlResponse);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
transform: function (xmlResponse): String {
|
||||
|
||||
let $tempXmlResponse: JQuery,
|
||||
tempTrackingCode: String,
|
||||
nextCallDataStr: String = "";
|
||||
|
||||
$tempXmlResponse = $(xmlResponse);
|
||||
|
||||
tempTrackingCode = $tempXmlResponse.find('code')
|
||||
.text();
|
||||
|
||||
if (tempTrackingCode) {
|
||||
|
||||
nextCallDataStr = "tracking=" + tempTrackingCode;
|
||||
|
||||
}
|
||||
|
||||
return nextCallDataStr;
|
||||
|
||||
},
|
||||
|
||||
hasCache: function (xmlResponse): XMLDocument {
|
||||
|
||||
let $tempXmlResponse: JQuery,
|
||||
itemId: String;
|
||||
|
||||
$tempXmlResponse = $(xmlResponse);
|
||||
|
||||
itemId = $tempXmlResponse.find('id')
|
||||
.text();
|
||||
|
||||
if (itemDetailCacheMap.has(itemId)) {
|
||||
|
||||
return itemDetailCacheMap.get(itemId);
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
},
|
||||
|
||||
hasErrors: function (xmlResponse): String {
|
||||
|
||||
var $tempXmlResponse: JQuery,
|
||||
categoryFilter: string = '1';
|
||||
|
||||
$tempXmlResponse = $(xmlResponse);
|
||||
|
||||
if ($tempXmlResponse.find('categoryId')
|
||||
.text() === categoryFilter) {
|
||||
|
||||
return '[Exception] forbidden category id: ' + categoryFilter;
|
||||
|
||||
}
|
||||
|
||||
return '';
|
||||
|
||||
},
|
||||
|
||||
appendToUrl: function (xmlResponse): String {
|
||||
|
||||
let $tempXmlResponse: JQuery,
|
||||
categoryId: string = '';
|
||||
|
||||
$tempXmlResponse = $(xmlResponse);
|
||||
categoryId = $tempXmlResponse.find('categoryId')
|
||||
.text();
|
||||
|
||||
return (categoryId) ? ('/' + categoryId) : '';
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
configurationObj3 = {
|
||||
|
||||
ajaxSettings: {
|
||||
|
||||
type: 'GET',
|
||||
dataType: 'xml',
|
||||
url: '/categories'
|
||||
|
||||
},
|
||||
|
||||
isSkippable: function (xmlResponse): Boolean {
|
||||
|
||||
return true;
|
||||
|
||||
},
|
||||
|
||||
transform: function (xmlResponse): Object[] {
|
||||
|
||||
let $tempXmlResponse: JQuery,
|
||||
nextCallDataArr: Object[] = [];
|
||||
|
||||
$tempXmlResponse = $(xmlResponse);
|
||||
|
||||
$tempXmlResponse.find('subCategory').each(function (index, node) {
|
||||
|
||||
let $tempIdNode = $(node).find('id');
|
||||
|
||||
nextCallDataArr.push({
|
||||
|
||||
name: $tempIdNode.attr('name'),
|
||||
value: $tempIdNode.text()
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
return nextCallDataArr;
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
configurationObj4 = {
|
||||
|
||||
ajaxSettings: {
|
||||
|
||||
type: 'GET',
|
||||
dataType: 'xml',
|
||||
url: '/subcategories'
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
ajaxChain.enqueue([configurationObj1, configurationObj2, configurationObj3, configurationObj4])
|
||||
.dequeue()
|
||||
.then(doneResult => { console.log(doneResult); },
|
||||
failResult => { console.log(failResult); },
|
||||
progressResult => { console.log(progressResult); });
|
||||
|
||||
}
|
||||
+97
@@ -0,0 +1,97 @@
|
||||
// Type definitions for jquery-ajax-chain v 1.0.4
|
||||
// Project: https://github.com/humana-fragilitas/jQuery-Ajax-Chain/
|
||||
// Definitions by: Andrea Blasio <https://github.com/humana-fragilitas>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../jquery/jquery.d.ts" />
|
||||
|
||||
declare module ajaxChain {
|
||||
|
||||
/**
|
||||
* Static members of JQueryAjaxChain
|
||||
*/
|
||||
interface JQueryAjaxChainStatic {
|
||||
|
||||
new (): JQueryAjaxChain
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Instance members of JQueryAjaxChain
|
||||
*/
|
||||
interface JQueryAjaxChain extends JQueryPromise<any> {
|
||||
|
||||
/**
|
||||
* Enqueues one or more configuration objects for later processing.
|
||||
*/
|
||||
enqueue(confObj: AjaxChainConfiguration | AjaxChainConfiguration[]): JQueryAjaxChain;
|
||||
/**
|
||||
* Sequentially and synchronously dequeues the configuration objects enqueued via enqueue() method
|
||||
* in the order they were added, triggering the related Ajax calls.
|
||||
*/
|
||||
dequeue(): JQueryAjaxChain;
|
||||
/**
|
||||
* Clears the currently queued configuration objects.
|
||||
*/
|
||||
clearQueue(): JQueryAjaxChain;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* A set of key/value pairs that configure the AjaxChain request; 'ajaxSettings' is mandatory.
|
||||
*/
|
||||
interface AjaxChainConfiguration {
|
||||
|
||||
/**
|
||||
* jQuery $.ajax method settings (required).
|
||||
*/
|
||||
ajaxSettings: JQueryAjaxSettings;
|
||||
/**
|
||||
* Configuration object label (optional).
|
||||
*/
|
||||
label?: String;
|
||||
/**
|
||||
* Returning a truthy value (Object) allows to arbitrarily overwrite the next queued Ajax call
|
||||
* 'data' property value specified in the original jQuery $.ajax method configuration
|
||||
* object ('ajaxSettings') (optional).
|
||||
*/
|
||||
transform?: (response: any) => String | Object | Object[];
|
||||
/**
|
||||
* Returning a truthy value (String) allows to append a string to the next queued
|
||||
* Ajax call 'url' property value specified in original jQuery $.ajax method configuration
|
||||
* object ('ajaxSettings') (optional).
|
||||
*/
|
||||
appendToUrl?: (response: any) => String;
|
||||
/**
|
||||
* Returning a truthy value determines any registered fail callback(s) to be called immediately,
|
||||
* passing the former as an argument to the latter; the queue is then rejected (optional).
|
||||
*/
|
||||
hasErrors?: (response: any) => any;
|
||||
/**
|
||||
* Returning a truthy value allows to prevent the related Ajax call from being executed,
|
||||
* passing the former as a parameter to any registered handler(s); useful to create
|
||||
* caching mechanisms (optional).
|
||||
*/
|
||||
hasCache?: (response: any) => any;
|
||||
/**
|
||||
* Returning a truthy value prevents the queue from further progressing to the succeeding
|
||||
* Ajax calls; the queue is then resolved (optional).
|
||||
*/
|
||||
hasHaltingCapabilities?: (response: any) => Boolean;
|
||||
/**
|
||||
* Returning a truthy value prevents the queue from being halted in case of Ajax error (optional).
|
||||
*/
|
||||
isSkippable?: (response: any) => Boolean;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
interface JQueryStatic {
|
||||
|
||||
/**
|
||||
* JQueryAjaxChain constructor
|
||||
*/
|
||||
AjaxChain: ajaxChain.JQueryAjaxChainStatic;
|
||||
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
function testRawApi(){
|
||||
var inputElement:HTMLInputElement = null;
|
||||
var resultPromise = AjaxFile.send({
|
||||
var resultPromise = AjaxFile.send<number>({
|
||||
method: 'POST',
|
||||
url: '/',
|
||||
desiredResponseDataType: JQueryAjaxFile.DataType.Json,
|
||||
@@ -42,7 +42,7 @@ function testJQuery() {
|
||||
global: true,
|
||||
timeout: 60
|
||||
};
|
||||
extension.ajaxWithFile(option);
|
||||
extension.ajaxWithFile<number>(option);
|
||||
}
|
||||
|
||||
function testKnockoutExtension(){
|
||||
|
||||
Vendored
+12
-11
@@ -1,4 +1,4 @@
|
||||
// Type definitions for jquery.ajaxfile v0.1.0
|
||||
// Type definitions for jquery.ajaxfile v0.2.0
|
||||
// Project: https://github.com/fpellet/jquery.ajaxFile
|
||||
// Definitions by: Florent PELLET <https://github.com/fpellet/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
@@ -35,27 +35,28 @@ declare namespace JQueryAjaxFile {
|
||||
isSuccess: boolean;
|
||||
}
|
||||
|
||||
interface IAjaxFileResult {
|
||||
interface IAjaxFileResult<T> {
|
||||
error?: any;
|
||||
data?: any;
|
||||
status?: IResponseStatus;
|
||||
}
|
||||
|
||||
interface IAjaxFileResultCallback {
|
||||
(result: IAjaxFileResult): void;
|
||||
interface IAjaxFileResultCallback<T> {
|
||||
(result: IAjaxFileResult<T>): void;
|
||||
}
|
||||
|
||||
interface IAjaxFilePromise {
|
||||
then(success: IAjaxFileResultCallback, error?: IAjaxFileResultCallback): IAjaxFilePromise;
|
||||
done(success: IAjaxFileResultCallback): IAjaxFilePromise;
|
||||
fail(error: IAjaxFileResultCallback): IAjaxFilePromise;
|
||||
always(error: IAjaxFileResultCallback): IAjaxFilePromise;
|
||||
interface IAjaxFilePromise<T> {
|
||||
then(success: IAjaxFileResultCallback<T>, error?: IAjaxFileResultCallback<T>): IAjaxFilePromise<T>;
|
||||
done(success: IAjaxFileResultCallback<T>): IAjaxFilePromise<T>;
|
||||
fail(error: IAjaxFileResultCallback<T>): IAjaxFilePromise<T>;
|
||||
always(error: IAjaxFileResultCallback<T>): IAjaxFilePromise<T>;
|
||||
|
||||
abord(): void;
|
||||
}
|
||||
|
||||
interface IAjaxFileStatic {
|
||||
send(option: IOption): IAjaxFilePromise;
|
||||
DataType: typeof DataType;
|
||||
send<T>(option: IOption): IAjaxFilePromise<T>;
|
||||
}
|
||||
|
||||
interface IJQueryXHR {
|
||||
@@ -97,7 +98,7 @@ declare namespace JQueryAjaxFile {
|
||||
}
|
||||
|
||||
interface IAjaxFileJQueryExtension {
|
||||
ajaxWithFile(jqueryOption: IJQueryOption): JQueryDeferred<any>;
|
||||
ajaxWithFile<T>(jqueryOption: IJQueryOption): JQueryDeferred<T>;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ ADocument.inject({ id: 5, author: 'John' });
|
||||
ADocument.inject({ id: 6, author: 'John' });
|
||||
|
||||
// bypass the data store
|
||||
adapter.updateAll(ADocument, { author: 'Johnny' }, { author: 'John' }).then(function (documents) {
|
||||
adapter.updateAll<{ id?: number; author: string; }>(ADocument, { author: 'Johnny' }, { author: 'John' }).then(function (documents) {
|
||||
documents[0]; // { id: 5, author: 'Johnny' }
|
||||
|
||||
// The updated documents have NOT been injected into the data store because we bypassed the data store
|
||||
@@ -37,7 +37,7 @@ adapter.updateAll(ADocument, { author: 'Johnny' }, { author: 'John' }).then(func
|
||||
});
|
||||
|
||||
// Normally you would just go through the data store
|
||||
ADocument.updateAll({ author: 'Johnny' }, { author: 'John' }).then(function (documents) {
|
||||
ADocument.updateAll<{ id?: number; author: string; }>({ author: 'Johnny' }, { author: 'John' }).then(function (documents) {
|
||||
documents[0]; // { id: 5, author: 'Johnny' }
|
||||
|
||||
// the updated documents have been injected into the data store
|
||||
@@ -164,4 +164,4 @@ ADocument.create({ author: 'John' }).then(function (document:any) {
|
||||
|
||||
// the new document has been injected into the data store
|
||||
ADocument.get(document.id); // { id: 5, author: 'John' }
|
||||
});
|
||||
});
|
||||
|
||||
Vendored
+3
-3
@@ -153,7 +153,7 @@ declare module JSData {
|
||||
findAll<T>(params?:DSFilterParams, options?:DSAdapterOperationConfiguration):JSDataPromise<Array<T>>;
|
||||
loadRelations<T>(idOrInstance:string | number | Object, relations:string | Array<string>, options?:DSAdapterOperationConfiguration):JSDataPromise<T>;
|
||||
update<T>(id:string | number, attrs:Object, options?:DSSaveConfiguration):JSDataPromise<T>;
|
||||
updateAll<T>(attrs:Object, params?:DSFilterParams, options?:DSAdapterOperationConfiguration):JSDataPromise<Array<T>>;
|
||||
updateAll<T>(attrs:Object, params?:DSFilterParams & T, options?:DSAdapterOperationConfiguration):JSDataPromise<Array<T>>;
|
||||
reap(resourceNametions?:DSConfiguration):JSDataPromise<any>;
|
||||
refresh<T>(id:string | number, options?:DSAdapterOperationConfiguration):JSDataPromise<T>;
|
||||
save<T>(id:string | number, options?:DSSaveConfiguration):JSDataPromise<T>;
|
||||
@@ -283,7 +283,7 @@ declare module JSData {
|
||||
|
||||
update<T>(config:DSResourceDefinition<T>, id:string | number, attrs:Object, options?:DSConfiguration):JSDataPromise<T>;
|
||||
|
||||
updateAll<T>(config:DSResourceDefinition<T>, attrs:Object, params?:DSFilterParams, options?:DSConfiguration):JSDataPromise<T>;
|
||||
updateAll<T>(config:DSResourceDefinition<T>, attrs:Object, params?:DSFilterParams & T, options?:DSConfiguration):JSDataPromise<T[]>;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -297,4 +297,4 @@ declare var JSData:{
|
||||
declare module 'js-data' {
|
||||
|
||||
export = JSData;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
/// <reference path="./jsdom.d.ts" />
|
||||
|
||||
import jsdom = require("jsdom");
|
||||
|
||||
jsdom.defaultDocumentFeatures.FetchExternalResources = ["img"];
|
||||
|
||||
Vendored
+24
@@ -0,0 +1,24 @@
|
||||
// Type definitions for karma v0.12.37
|
||||
// Project: https://github.com/karma-runner/karma
|
||||
// Definitions by: Tanguy Krotoff <https://github.com/tkrotoff>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module 'karma' {
|
||||
// See Karma public API https://karma-runner.github.io/0.12/dev/public-api.html
|
||||
|
||||
interface IKarmaServer {
|
||||
start(options?: any, callback?: (exitCode: number) => void): void;
|
||||
}
|
||||
|
||||
interface IKarmaRunner {
|
||||
run(options?: any, callback?: (exitCode: number) => void): void;
|
||||
}
|
||||
|
||||
interface IKarma {
|
||||
server: IKarmaServer;
|
||||
runner: IKarmaRunner;
|
||||
}
|
||||
|
||||
var karma: IKarma;
|
||||
export = karma;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
/// <reference path="karma-0.12.d.ts" />
|
||||
/// <reference path="../gulp/gulp.d.ts" />
|
||||
|
||||
import gulp = require('gulp');
|
||||
import karma = require('karma');
|
||||
|
||||
function runKarma(singleRun: boolean): void {
|
||||
karma.server.start({
|
||||
configFile: __dirname + '/karma.conf.js',
|
||||
singleRun: singleRun
|
||||
});
|
||||
}
|
||||
|
||||
gulp.task('test:unit:karma', ['build:test:unit'], () => runKarma(true));
|
||||
|
||||
|
||||
karma.server.start({port: 9876}, (exitCode: number) => {
|
||||
console.log('Karma has exited with ' + exitCode);
|
||||
process.exit(exitCode);
|
||||
});
|
||||
|
||||
|
||||
karma.runner.run({port: 9876}, (exitCode: number) => {
|
||||
console.log('Karma has exited with ' + exitCode);
|
||||
process.exit(exitCode);
|
||||
});
|
||||
+34
-6
@@ -4,23 +4,51 @@
|
||||
import gulp = require('gulp');
|
||||
import karma = require('karma');
|
||||
|
||||
|
||||
function runKarma(singleRun: boolean): void {
|
||||
karma.server.start({
|
||||
configFile: __dirname + '/karma.conf.js',
|
||||
singleRun: singleRun
|
||||
});
|
||||
// MEMO: `start` method is deprecated since 0.13. It will be removed in 0.14.
|
||||
karma.server.start({
|
||||
configFile: __dirname + '/karma.conf.js',
|
||||
singleRun: singleRun
|
||||
});
|
||||
}
|
||||
|
||||
gulp.task('test:unit:karma', ['build:test:unit'], () => runKarma(true));
|
||||
|
||||
|
||||
karma.server.start({port: 9876}, (exitCode) => {
|
||||
|
||||
karma.server.start({port: 9876}, (exitCode: number) => {
|
||||
console.log('Karma has exited with ' + exitCode);
|
||||
process.exit(exitCode);
|
||||
});
|
||||
|
||||
|
||||
karma.runner.run({port: 9876}, (exitCode) => {
|
||||
karma.runner.run({port: 9876}, (exitCode: number) => {
|
||||
console.log('Karma has exited with ' + exitCode);
|
||||
process.exit(exitCode);
|
||||
});
|
||||
|
||||
|
||||
var Server = require('karma').Server;
|
||||
var server = new Server({port: 9876}, function(exitCode: number) {
|
||||
console.log('Karma has exited with ' + exitCode);
|
||||
process.exit(exitCode);
|
||||
});
|
||||
|
||||
server.start();
|
||||
|
||||
server.refreshFiles();
|
||||
|
||||
server.on('browser_register', function (browser: any) {
|
||||
console.log('A new browser was registered');
|
||||
});
|
||||
|
||||
var runner = require('karma').runner;
|
||||
runner.run({port: 9876}, function(exitCode: number) {
|
||||
console.log('Karma has exited with ' + exitCode);
|
||||
process.exit(exitCode);
|
||||
});
|
||||
|
||||
//
|
||||
|
||||
var captured: boolean = karma.launcher.areAllCaptured();
|
||||
|
||||
Vendored
+356
-12
@@ -1,24 +1,368 @@
|
||||
// Type definitions for karma v0.12.37
|
||||
// Type definitions for karma v0.13.9
|
||||
// Project: https://github.com/karma-runner/karma
|
||||
// Definitions by: Tanguy Krotoff <https://github.com/tkrotoff>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../bluebird/bluebird.d.ts" />
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
/// <reference path="../log4js/log4js.d.ts" />
|
||||
|
||||
declare module 'karma' {
|
||||
// See Karma public API https://karma-runner.github.io/0.12/dev/public-api.html
|
||||
import Promise = require('bluebird');
|
||||
import https = require('https');
|
||||
import log4js = require('log4js');
|
||||
|
||||
interface IKarmaServer {
|
||||
start(options?: any, callback?: (exitCode: number) => void): void;
|
||||
namespace karma {
|
||||
interface Karma {
|
||||
/**
|
||||
* `start` method is deprecated since 0.13. It will be removed in 0.14.
|
||||
* Please use
|
||||
* <code>
|
||||
* server = new Server(config, [done])
|
||||
* server.start()
|
||||
* </code>
|
||||
* instead.
|
||||
*/
|
||||
server: DeprecatedServer;
|
||||
Server: Server;
|
||||
runner: Runner;
|
||||
launcher: Launcher;
|
||||
VERSION: string;
|
||||
}
|
||||
|
||||
interface LauncherStatic {
|
||||
generateId(): string;
|
||||
//TODO: injector should be of type `di.Injector`
|
||||
new(emitter: NodeJS.EventEmitter, injector: any): Launcher;
|
||||
}
|
||||
|
||||
interface Launcher {
|
||||
Launcher: LauncherStatic;
|
||||
//TODO: Can this return value ever be typified?
|
||||
launch(names: string[], protocol: string, hostname: string, port: number, urlRoot: string): any[];
|
||||
kill(id: string, callback: Function): boolean;
|
||||
restart(id: string): boolean;
|
||||
killAll(callback: Function): void;
|
||||
areAllCaptured(): boolean;
|
||||
markCaptured(id: string): void;
|
||||
}
|
||||
|
||||
interface DeprecatedServer {
|
||||
start(options?: any, callback?: ServerCallback): void;
|
||||
}
|
||||
|
||||
interface Runner {
|
||||
run(options?: Config, callback?: ServerCallback): void;
|
||||
}
|
||||
|
||||
interface Server extends NodeJS.EventEmitter {
|
||||
new(options?: Config, callback?: ServerCallback): Server;
|
||||
/**
|
||||
* Start the server
|
||||
*/
|
||||
start(): void;
|
||||
/**
|
||||
* Get properties from the injector
|
||||
* @param token
|
||||
*/
|
||||
get(token: string): any;
|
||||
/**
|
||||
* Force a refresh of the file list
|
||||
*/
|
||||
refreshFiles(): Promise<any>;
|
||||
|
||||
///**
|
||||
// * Backward-compatibility with karma-intellij bundled with WebStorm.
|
||||
// * Deprecated since version 0.13, to be removed in 0.14
|
||||
// */
|
||||
//static start(): void;
|
||||
}
|
||||
|
||||
interface ServerCallback {
|
||||
(exitCode: number): void;
|
||||
}
|
||||
|
||||
interface Config {
|
||||
/**
|
||||
* @description Enable or disable watching files and executing the tests whenever one of these files changes.
|
||||
* @default true
|
||||
*/
|
||||
autoWatch?: boolean;
|
||||
/**
|
||||
* @description When Karma is watching the files for changes, it tries to batch multiple changes into a single run
|
||||
* so that the test runner doesn't try to start and restart running tests more than it should.
|
||||
* The configuration setting tells Karma how long to wait (in milliseconds) after any changes have occurred
|
||||
* before starting the test process again.
|
||||
* @default 250
|
||||
*/
|
||||
autoWatchBatchDelay?: number;
|
||||
/**
|
||||
* @default ''
|
||||
* @description The root path location that will be used to resolve all relative paths defined in <code>files</code> and <code>exclude</code>.
|
||||
* If the basePath configuration is a relative path then it will be resolved to
|
||||
* the <code>__dirname</code> of the configuration file.
|
||||
*/
|
||||
basePath?: string;
|
||||
/**
|
||||
* @default 2000
|
||||
* @description How long does Karma wait for a browser to reconnect (in ms).
|
||||
* <p>
|
||||
* With a flaky connection it is pretty common that the browser disconnects,
|
||||
* but the actual test execution is still running without any problems. Karma does not treat a disconnection
|
||||
* as immediate failure and will wait <code>browserDisconnectTimeout</code> (ms).
|
||||
* If the browser reconnects during that time, everything is fine.
|
||||
* </p>
|
||||
*/
|
||||
browserDisconnectTimeout?: number;
|
||||
/**
|
||||
* @default 0
|
||||
* @description The number of disconnections tolerated.
|
||||
* <p>
|
||||
* The <code>disconnectTolerance</code> value represents the maximum number of tries a browser will attempt
|
||||
* in the case of a disconnection. Usually any disconnection is considered a failure,
|
||||
* but this option allows you to define a tolerance level when there is a flaky network link between
|
||||
* the Karma server and the browsers.
|
||||
* </p>
|
||||
*/
|
||||
browserDisconnectTolerance?: number;
|
||||
/**
|
||||
* @default 10000
|
||||
* @description How long will Karma wait for a message from a browser before disconnecting from it (in ms).
|
||||
* <p>
|
||||
* If, during test execution, Karma does not receive any message from a browser within
|
||||
* <code>browserNoActivityTimeout</code> (ms), it will disconnect from the browser
|
||||
* </p>
|
||||
*/
|
||||
browserNoActivityTimeout?: number;
|
||||
/**
|
||||
* @default []
|
||||
* Possible Values:
|
||||
* <ul>
|
||||
* <li>Chrome (launcher comes installed with Karma)</li>
|
||||
* <li>ChromeCanary (launcher comes installed with Karma)</li>
|
||||
* <li>PhantomJS (launcher comes installed with Karma)</li>
|
||||
* <li>Firefox (launcher requires karma-firefox-launcher plugin)</li>
|
||||
* <li>Opera (launcher requires karma-opera-launcher plugin)</li>
|
||||
* <li>Internet Explorer (launcher requires karma-ie-launcher plugin)</li>
|
||||
* <li>Safari (launcher requires karma-safari-launcher plugin)</li>
|
||||
* </ul>
|
||||
* @description A list of browsers to launch and capture. When Karma starts up, it will also start up each browser
|
||||
* which is placed within this setting. Once Karma is shut down, it will shut down these browsers as well.
|
||||
* You can capture any browser manually by opening the browser and visiting the URL where
|
||||
* the Karma web server is listening (by default it is <code>http://localhost:9876/</code>).
|
||||
*/
|
||||
browsers?: string[];
|
||||
/**
|
||||
* @default 60000
|
||||
* @description Timeout for capturing a browser (in ms).
|
||||
* <p>
|
||||
* The <code>captureTimeout</code> value represents the maximum boot-up time allowed for a
|
||||
* browser to start and connect to Karma. If any browser does not get captured within the timeout, Karma
|
||||
* will kill it and try to launch it again and, after three attempts to capture it, Karma will give up.
|
||||
* </p>
|
||||
*/
|
||||
captureTimeout?: number;
|
||||
client?: ClientConfig;
|
||||
/**
|
||||
* @default true
|
||||
* @description Enable or disable colors in the output (reporters and logs).
|
||||
*/
|
||||
colors?: boolean;
|
||||
/**
|
||||
* @default []
|
||||
* @description List of files/patterns to exclude from loaded files.
|
||||
*/
|
||||
exclude?: string[];
|
||||
/**
|
||||
* @default []
|
||||
* @description List of files/patterns to load in the browser.
|
||||
*/
|
||||
files?: (FilePattern|string)[];
|
||||
/**
|
||||
* @default []
|
||||
* @description List of test frameworks you want to use. Typically, you will set this to ['jasmine'], ['mocha'] or ['qunit']...
|
||||
* Please note just about all frameworks in Karma require an additional plugin/framework library to be installed (via NPM).
|
||||
*/
|
||||
frameworks?: string[];
|
||||
/**
|
||||
* @default 'localhost'
|
||||
* @description Hostname to be used when capturing browsers.
|
||||
*/
|
||||
hostname?: string;
|
||||
/**
|
||||
* @default {}
|
||||
* @description Options object to be used by Node's https class.
|
||||
* Object description can be found in the
|
||||
* [NodeJS.org API docs](https://nodejs.org/api/tls.html#tls_tls_createserver_options_secureconnectionlistener)
|
||||
*/
|
||||
httpsServerOptions?: https.ServerOptions;
|
||||
/**
|
||||
* @default config.LOG_INFO
|
||||
* Possible values:
|
||||
* <ul>
|
||||
* <li>config.LOG_DISABLE</li>
|
||||
* <li>config.LOG_ERROR</li>
|
||||
* <li>config.LOG_WARN</li>
|
||||
* <li>config.LOG_INFO</li>
|
||||
* <li>config.LOG_DEBUG</li>
|
||||
* </ul>
|
||||
* @description Level of logging.
|
||||
*/
|
||||
logLevel?: string;
|
||||
/**
|
||||
* @default [{type: 'console'}]
|
||||
* @description A list of log appenders to be used. See the documentation for [log4js] for more information.
|
||||
*/
|
||||
loggers?: log4js.AppenderConfigBase[];
|
||||
/**
|
||||
* @default ['karma-*']
|
||||
* @description List of plugins to load. A plugin can be a string (in which case it will be required
|
||||
* by Karma) or an inlined plugin - Object.
|
||||
* By default, Karma loads all sibling NPM modules which have a name starting with karma-*.
|
||||
* Note: Just about all plugins in Karma require an additional library to be installed (via NPM).
|
||||
*/
|
||||
plugins?: any[];
|
||||
/**
|
||||
* @default 9876
|
||||
* @description The port where the web server will be listening.
|
||||
*/
|
||||
port?: number;
|
||||
/**
|
||||
* @default {'**\/*.coffee': 'coffee'}
|
||||
* @description A map of preprocessors to use.
|
||||
*
|
||||
* Preprocessors can be loaded through [plugins].
|
||||
*
|
||||
* Note: Just about all preprocessors in Karma (other than CoffeeScript and some other defaults)
|
||||
* require an additional library to be installed (via NPM).
|
||||
*
|
||||
* Be aware that preprocessors may be transforming the files and file types that are available at run time. For instance,
|
||||
* if you are using the "coverage" preprocessor on your source files, if you then attempt to interactively debug
|
||||
* your tests, you'll discover that your expected source code is completely changed from what you expected. Because
|
||||
* of that, you'll want to engineer this so that your automated builds use the coverage entry in the "reporters" list,
|
||||
* but your interactive debugging does not.
|
||||
*
|
||||
*/
|
||||
preprocessors?: { [name: string]: string|string[] }
|
||||
/**
|
||||
* @default 'http:'
|
||||
* Possible Values:
|
||||
* <ul>
|
||||
* <li>http:</li>
|
||||
* <li>https:</li>
|
||||
* </ul>
|
||||
* @description Protocol used for running the Karma webserver.
|
||||
* Determines the use of the Node http or https class.
|
||||
* Note: Using <code>'https:'</code> requires you to specify <code>httpsServerOptions</code>.
|
||||
*/
|
||||
protocol?: string;
|
||||
/**
|
||||
* @default {}
|
||||
* @description A map of path-proxy pairs.
|
||||
*/
|
||||
proxies?: { [path: string]: string }
|
||||
/**
|
||||
* @default true
|
||||
* @description Whether or not Karma or any browsers should raise an error when an inavlid SSL certificate is found.
|
||||
*/
|
||||
proxyValidateSSL?: boolean;
|
||||
/**
|
||||
* @default 0
|
||||
* @description Karma will report all the tests that are slower than given time limit (in ms).
|
||||
* This is disabled by default (since the default value is 0).
|
||||
*/
|
||||
reportSlowerThan?: number;
|
||||
/**
|
||||
* @default ['progress']
|
||||
* Possible Values:
|
||||
* <ul>
|
||||
* <li>dots</li>
|
||||
* <li>progress</li>
|
||||
* </ul>
|
||||
* @description A list of reporters to use.
|
||||
* Additional reporters, such as growl, junit, teamcity or coverage can be loaded through plugins.
|
||||
* Note: Just about all additional reporters in Karma (other than progress) require an additional library to be installed (via NPM).
|
||||
*/
|
||||
reporters?: string[];
|
||||
/**
|
||||
* @default false
|
||||
* @description Continuous Integration mode.
|
||||
* If true, Karma will start and capture all configured browsers, run tests and then exit with an exit code of 0 or 1 depending
|
||||
* on whether all tests passed or any tests failed.
|
||||
*/
|
||||
singleRun?: boolean;
|
||||
/**
|
||||
* @default ['polling', 'websocket']
|
||||
* @description An array of allowed transport methods between the browser and testing server. This configuration setting
|
||||
* is handed off to [socket.io](http://socket.io/) (which manages the communication
|
||||
* between browsers and the testing server).
|
||||
*/
|
||||
transports?: string[];
|
||||
/**
|
||||
* @default '/'
|
||||
* @description The base url, where Karma runs.
|
||||
* All of Karma's urls get prefixed with the urlRoot. This is helpful when using proxies, as
|
||||
* sometimes you might want to proxy a url that is already taken by Karma.
|
||||
*/
|
||||
urlRoot?: string;
|
||||
}
|
||||
|
||||
interface ClientConfig {
|
||||
/**
|
||||
* @default undefined
|
||||
* @description When karma run is passed additional arguments on the command-line, they
|
||||
* are passed through to the test adapter as karma.config.args (an array of strings).
|
||||
* The client.args option allows you to set this value for actions other than run.
|
||||
* How this value is used is up to your test adapter - you should check your adapter's
|
||||
* documentation to see how (and if) it uses this value.
|
||||
*/
|
||||
args?: string[];
|
||||
/**
|
||||
* @default true
|
||||
* @description Run the tests inside an iFrame or a new window
|
||||
* If true, Karma runs the tests inside an iFrame. If false, Karma runs the tests in a new window. Some tests may not run in an
|
||||
* iFrame and may need a new window to run.
|
||||
*/
|
||||
useIframe?: boolean;
|
||||
/**
|
||||
* @default true
|
||||
* @description Capture all console output and pipe it to the terminal.
|
||||
*/
|
||||
captureConsole?: boolean;
|
||||
}
|
||||
|
||||
interface FilePattern {
|
||||
/**
|
||||
* The pattern to use for matching. This property is mandatory.
|
||||
*/
|
||||
pattern: string;
|
||||
/**
|
||||
* @default true
|
||||
* @description If <code>autoWatch</code> is true all files that have set watched to true will be watched
|
||||
* for changes.
|
||||
*/
|
||||
watched?: boolean;
|
||||
/**
|
||||
* @default true
|
||||
* @description Should the files be included in the browser using <script> tag? Use false if you want to
|
||||
* load them manually, eg. using Require.js.
|
||||
*/
|
||||
included?: boolean;
|
||||
/**
|
||||
* @default true
|
||||
* @description Should the files be served by Karma's webserver?
|
||||
*/
|
||||
served?: boolean;
|
||||
/**
|
||||
* @default false
|
||||
* @description Should the files be served from disk on each request by Karma's webserver?
|
||||
*/
|
||||
nocache?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
interface IKarmaRunner {
|
||||
run(options?: any, callback?: (exitCode: number) => void): void;
|
||||
}
|
||||
var karma: karma.Karma;
|
||||
|
||||
interface IKarma {
|
||||
server: IKarmaServer;
|
||||
runner: IKarmaRunner;
|
||||
}
|
||||
|
||||
var karma: IKarma;
|
||||
export = karma;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,222 @@
|
||||
/// <reference path="./kefir.d.ts" />
|
||||
|
||||
import * as Kefir from 'kefir';
|
||||
import { Observable, ObservablePool, Stream, Property, Event, Emitter } from 'kefir';
|
||||
|
||||
//Create a stream
|
||||
{
|
||||
let stream01: Stream<void, void> = Kefir.never();
|
||||
let stream02: Stream<number, void> = Kefir.later(1000, 1);
|
||||
let stream03: Stream<number, void> = Kefir.interval(1000, 1);
|
||||
let stream04: Stream<number, void> = Kefir.sequentially(1000, [1, 2, 3]);
|
||||
{
|
||||
let start = +new Date();
|
||||
let stream05: Stream<number, void> = Kefir.fromPoll(1000, () => +new Date() - start);
|
||||
}
|
||||
{
|
||||
let start = +new Date();
|
||||
let stream06: Stream<number, void> = Kefir.withInterval<number, void>(1000, function(emitter) {
|
||||
var time = +new Date() - start;
|
||||
if (time < 4000) {
|
||||
emitter.emit(time);
|
||||
} else {
|
||||
emitter.end();
|
||||
}
|
||||
});
|
||||
}
|
||||
let stream07: Stream<number, void> = Kefir.fromCallback<number>(callback => setTimeout(() => callback(1), 1000));
|
||||
let stream08: Stream<number, void> = Kefir.fromNodeCallback<number, void>(callback => setTimeout(() => callback(null, 1), 1000));
|
||||
let stream09: Stream<MouseEvent, void> = Kefir.fromEvents<MouseEvent, void>(document.body, 'click');
|
||||
let stream10: Stream<number, void> = Kefir.stream<number, void>(emitter => {
|
||||
let count = 0;
|
||||
emitter.emit(count);
|
||||
|
||||
let intervalId = setInterval(() => {
|
||||
count++;
|
||||
if (count < 4) {
|
||||
emitter.emit(count);
|
||||
} else {
|
||||
emitter.end();
|
||||
}
|
||||
}, 1000);
|
||||
|
||||
return () => clearInterval(intervalId);
|
||||
});
|
||||
}
|
||||
|
||||
// Create a property
|
||||
{
|
||||
let property01: Property<number, void> = Kefir.constant(1);
|
||||
let property02: Property<void, number> = Kefir.constantError(1);
|
||||
let property03: Property<number, void> = Kefir.fromPromise<number, void>(new Promise<number>(fulfill => fulfill(1)));
|
||||
}
|
||||
|
||||
// Convert observables
|
||||
{
|
||||
let property: Property<number, void> = Kefir.sequentially(100, [1, 2, 3]).toProperty(() => 0);
|
||||
let stream: Stream<number, void> = Kefir.sequentially(100, [1, 2, 3]).toProperty(() => 0).changes();
|
||||
}
|
||||
|
||||
// Subscribe / add side effects
|
||||
{
|
||||
Kefir.sequentially(1000, [1, 2]).onValue(x => console.log('value:', x));
|
||||
Kefir.sequentially(1000, [1, 2]).offValue(x => console.log('value:', x));
|
||||
Kefir.sequentially(1000, [1, 2]).valuesToErrors().onValue(x => console.log('error:', x));
|
||||
Kefir.sequentially(1000, [1, 2]).valuesToErrors().offValue(x => console.log('error:', x));
|
||||
Kefir.sequentially(1000, [1, 2]).onEnd(() => console.log('stream ended'));
|
||||
Kefir.sequentially(1000, [1, 2]).offEnd(() => console.log('stream ended'));
|
||||
Kefir.sequentially(1000, [1, 2]).onAny(event => console.log('event:', event));
|
||||
Kefir.sequentially(1000, [1, 2]).offAny(event => console.log('event:', event));
|
||||
Kefir.sequentially(1000, [1, 2]).log('my stream');
|
||||
Kefir.sequentially(1000, [1, 2]).offLog('my stream');
|
||||
Kefir.sequentially(1000, [1, 2]).toPromise().then(x => console.log('fulfilled with:', x));
|
||||
}
|
||||
|
||||
// Modify an observable
|
||||
{
|
||||
let observable01: Stream<number, void> = Kefir.sequentially(100, [1, 2, 3]).map(x => x + 1);
|
||||
let observable02: Stream<number, void> = Kefir.sequentially(100, [1, 2, 3]).filter(x => x > 1);
|
||||
let observable03: Stream<number, void> = Kefir.sequentially(100, [1, 2, 3]).take(2);
|
||||
let observable04: Stream<number, void> = Kefir.sequentially(100, [1, 2, 3]).takeWhile(x => x < 3);
|
||||
let observable05: Stream<number, void> = Kefir.sequentially(100, [1, 2, 3]).last();
|
||||
let observable06: Stream<number, void> = Kefir.sequentially(100, [1, 2, 3]).skip(2);
|
||||
let observable07: Stream<number, void> = Kefir.sequentially(100, [1, 3, 2]).skipWhile(x => x < 3);
|
||||
let observable08: Stream<number, void> = Kefir.sequentially(100, [1, 2, 2, 3, 1]).skipDuplicates();
|
||||
let observable09: Stream<number, void> = Kefir.sequentially(100, [1, 2, 2.1, 3, 1]).skipDuplicates((a, b) => Math.round(a) === Math.round(b));
|
||||
let observable10: Stream<number, void> = Kefir.sequentially(100, [1, 2, 2, 3]).diff((prev, next) => next - prev, 0);
|
||||
let observable11: Stream<number, void> = Kefir.sequentially(100, [1, 2, 2, 3]).scan((prev, next) => next + prev, 0);
|
||||
let observable12: Stream<number, void> = Kefir.sequentially(100, [[1], [], [2,3]]).flatten<number>();
|
||||
let observable13: Stream<number, void> = Kefir.sequentially(100, [1, 2, 3, 4]).flatten<number>(x => x % 2 === 0 ? [x * 10] : []);
|
||||
let observable14: Stream<number, void> = Kefir.sequentially(200, [1, 2, 3]).delay(100);
|
||||
let observable15: Stream<number, void> = Kefir.sequentially(750, [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]).throttle(2500);
|
||||
let observable16: Stream<number, void> = Kefir.sequentially(100, [1, 2, 3, 0, 0, 0, 4, 5, 6]).filter(x => x > 0).debounce(250);
|
||||
let observable17: Stream<void, number> = Kefir.sequentially(100, [0, -1, 2, -3]).valuesToErrors<number>(x => {
|
||||
return {convert: x < 0, error: x * 2};
|
||||
});
|
||||
let observable18: Stream<number, void> = Kefir.sequentially(100, [0, -1, 2, -3]).valuesToErrors<number>().errorsToValues<number>((x: number) => {
|
||||
return {convert: x >= 0, value: x * 2};
|
||||
});
|
||||
let observable19: Stream<void, number> = Kefir.sequentially(100, [0, 1, 2, 3]).valuesToErrors<number>().mapErrors((x: number) => x * 2);
|
||||
let observable20: Stream<void, number> = Kefir.sequentially(100, [0, 1, 2, 3]).valuesToErrors<number>().filterErrors((x: number) => (x % 2) === 0);
|
||||
let observable21: Stream<void, number> = Kefir.sequentially(100, [0, -1, 2, -3]).valuesToErrors(x => {
|
||||
return {convert: x < 0, error: x};
|
||||
}).endOnError();
|
||||
let observable22: Stream<void, number> = Kefir.sequentially(100, [0, -1, 2, -3]).valuesToErrors(x => {
|
||||
return {convert: x < 0, error: x};
|
||||
}).skipValues();
|
||||
let observable23: Stream<void, void> = Kefir.sequentially(100, [0, -1, 2, -3]).valuesToErrors(x => {
|
||||
return {convert: x < 0, error: x};
|
||||
}).skipErrors();
|
||||
let observable24: Stream<number, void> = Kefir.sequentially(100, [1, 2, 3]).skipEnd();
|
||||
let ovservable25: Stream<number, void> = Kefir.sequentially(100, [1, 2, 3]).beforeEnd(() => 0);
|
||||
let observable26: Stream<number[], void> = Kefir.sequentially(100, [1, 2, 3, 4, 5]).slidingWindow(3, 2)
|
||||
let observable27: Stream<number[], void> = Kefir.sequentially(100, [1, 2, 3, 4, 5]).bufferWhile(x => x !== 3);
|
||||
{
|
||||
var myTransducer: any;
|
||||
let observable28: Stream<number, void> = Kefir.sequentially(100, [1, 2, 3, 4, 5, 6]).transduce<number>(myTransducer);
|
||||
}
|
||||
let observable28: Stream<number | string, void> = Kefir.sequentially(100, [0, 1, 2, 3]).withHandler<number | string, void>((emitter: Emitter<string | number, void>, event: Event<number>) => {
|
||||
if (event.type === 'end') {
|
||||
emitter.emit('bye');
|
||||
emitter.end();
|
||||
}
|
||||
if (event.type === 'value') {
|
||||
for (var i = 0; i < event.value; i++) {
|
||||
emitter.emit(event.value);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Combine observables
|
||||
{
|
||||
{
|
||||
let a: Stream<number, void> = Kefir.sequentially(100, [1, 3]);
|
||||
let b: Stream<number, void> = Kefir.sequentially(100, [2, 4]).delay(40);
|
||||
let observable01: Observable<number, void> = Kefir.combine<number, void, number>([a, b], (a, b) => a + b);
|
||||
}
|
||||
{
|
||||
let a: Stream<number, void> = Kefir.sequentially(100, [1, 3]);
|
||||
let b: Stream<number, void> = Kefir.sequentially(100, [2, 4]).delay(40);
|
||||
let c: Stream<number, void> = Kefir.sequentially(60, [5, 6, 7]);
|
||||
let observable02: Observable<number, void> = Kefir.combine<number, void, number>([a, b], [c], (a, b, c) => a + b + c);
|
||||
}
|
||||
{
|
||||
let a: Stream<number, void> = Kefir.sequentially(100, [0, 1, 2, 3]);
|
||||
let b: Stream<number, void> = Kefir.sequentially(160, [4, 5, 6]);
|
||||
let c: Property<number, void> = Kefir.sequentially(100, [8, 9]).delay(260).toProperty(() => 7);
|
||||
let observable03: Observable<number, void> = Kefir.zip<number, void, number>([a, b, c]);
|
||||
}
|
||||
{
|
||||
let a: Stream<number, void> = Kefir.sequentially(100, [0, 1, 2]);
|
||||
let b: Stream<number, void> = Kefir.sequentially(100, [0, 1, 2]).delay(30);
|
||||
let c: Stream<number, void> = Kefir.sequentially(100, [0, 1, 2]).delay(60);
|
||||
let abc: Observable<number, void> = Kefir.merge<number, void>([a, b, c]);
|
||||
}
|
||||
{
|
||||
let a: Stream<number, void> = Kefir.sequentially(100, [0, 1, 2]);
|
||||
let b: Stream<number, void> = Kefir.sequentially(100, [3, 4, 5]);
|
||||
let abc: Observable<number, void> = Kefir.concat<number, void>([a, b]);
|
||||
}
|
||||
{
|
||||
let a: Stream<number, void> = Kefir.sequentially(100, [0, 1, 2]);
|
||||
let b: Stream<number, void> = Kefir.sequentially(100, [0, 1, 2]).delay(30);
|
||||
let c: Observable<number, void> = Kefir.sequentially(100, [0, 1, 2]).delay(60);
|
||||
let pool: ObservablePool<number, void> = Kefir.pool<number, void>();
|
||||
pool.plug(a);
|
||||
pool.plug(b);
|
||||
pool.plug(c);
|
||||
}
|
||||
let observable04: Observable<number, void> = Kefir.repeat<number, void>(i => {
|
||||
if (i < 3) {
|
||||
return Kefir.sequentially(100, [i, i]);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
let observable05: Stream<number, void> = Kefir.sequentially(100, [1, 2, 3]).flatMap(x => Kefir.interval(40, x).take(4));
|
||||
let observable06: Stream<number, void> = Kefir.sequentially(100, [1, 2, 3]).flatMapLatest(x => Kefir.interval(40, x).take(4));
|
||||
let observable07: Stream<number, void> = Kefir.sequentially(100, [1, 2, 3]).flatMapFirst(x => Kefir.interval(40, x).take(4));
|
||||
let observable08: Stream<number, void> = Kefir.sequentially(100, [1, 2, 3]).flatMapConcat(x => Kefir.interval(40, x).take(4));
|
||||
let observable09: Stream<number, void> = Kefir.sequentially(100, [1, 2, 3]).flatMapConcurLimit(x => Kefir.interval(40, x).take(6), 2);
|
||||
let observable10: Stream<number, void> = Kefir.sequentially(100, [1, 2]).valuesToErrors().flatMapErrors(x => Kefir.interval(40, x).take(2));
|
||||
}
|
||||
|
||||
// Combine two observables
|
||||
{
|
||||
{
|
||||
let foo: Stream<number, void> = Kefir.sequentially(100, [1, 2, 3, 4, 5, 6, 7, 8]);
|
||||
let bar: Property<boolean, void> = Kefir.sequentially(200, [false, true, false]).delay(40).toProperty(() => true);
|
||||
let observable01: Stream<number, void> = foo.filterBy<void>(bar);
|
||||
}
|
||||
{
|
||||
let a: Property<number, void> = Kefir.sequentially(200, [2, 3]).toProperty(() => 1);
|
||||
let b: Stream<number, void> = Kefir.interval(100, 0).delay(40).take(5);
|
||||
let observable02: Property<number, void> = a.sampledBy<number, void, number>(b)
|
||||
}
|
||||
{
|
||||
let foo: Stream<number, void> = Kefir.sequentially(100, [1, 2, 3, 4]);
|
||||
let bar: Stream<number, void> = Kefir.later(250, 0);
|
||||
let observable03: Stream<number, void> = foo.skipUntilBy<number, void>(bar);
|
||||
}
|
||||
{
|
||||
let foo: Stream<number, void> = Kefir.sequentially(100, [1, 2, 3, 4]);
|
||||
let bar: Stream<number, void> = Kefir.later(250, 0);
|
||||
let observable04: Stream<number, void> = foo.takeUntilBy<number, void>(bar);
|
||||
}
|
||||
{
|
||||
let foo: Stream<number, void> = Kefir.sequentially(100, [1, 2, 3, 4, 5, 6, 7, 8]).delay(40);
|
||||
let bar: Stream<number, void> = Kefir.sequentially(300, [1, 2])
|
||||
let observable05: Stream<number[], void> = foo.bufferBy<number, void>(bar);
|
||||
}
|
||||
{
|
||||
let foo: Stream<number, void> = Kefir.sequentially(100, [1, 2, 3, 4, 5, 6, 7, 8]);
|
||||
let bar: Stream<boolean, void> = Kefir.sequentially(200, [false, true, false]).delay(40);
|
||||
let observable06: Stream<number[], void> = foo.bufferWhileBy<void>(bar);
|
||||
}
|
||||
{
|
||||
let foo: Stream<number, void> = Kefir.sequentially(100, [1, 2, 3]);
|
||||
let bar: Stream<number, void> = Kefir.sequentially(100, [1, 2, 3]).delay(40);
|
||||
let observable07: Stream<boolean, void> = foo.awaiting<number, void>(bar);
|
||||
}
|
||||
}
|
||||
Vendored
+176
@@ -0,0 +1,176 @@
|
||||
// Type definitions for Kefir 2.8.1
|
||||
// Project: http://rpominov.github.io/kefir/
|
||||
// Definitions by: Aya Morisawa <https://github.com/AyaMorisawa>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
/// <reference path="../es6-promise/es6-promise.d.ts" />
|
||||
|
||||
declare module "kefir" {
|
||||
export interface Observable<T, S> {
|
||||
// Subscribe / add side effects
|
||||
onValue(callback: (value: T) => void): void;
|
||||
offValue(callback: (value: T) => void): void;
|
||||
onError(callback: (error: S) => void): void;
|
||||
offError(callback: (error: S) => void): void;
|
||||
onEnd(callback: () => void): void;
|
||||
offEnd(callback: () => void): void;
|
||||
onAny(callback: (event: Event<T | S>) => void): void;
|
||||
offAny(callback: (event: Event<T | S>) => void): void;
|
||||
log(name?: string): void;
|
||||
offLog(name?: string): void;
|
||||
toPromise(PromiseConstructor?: typeof Promise): Promise<T>;
|
||||
}
|
||||
|
||||
export interface Stream<T, S> extends Observable<T, S> {
|
||||
toProperty(getCurrent?: () => T): Property<T, S>;
|
||||
|
||||
// Modify an stream
|
||||
map<U>(fn: (value: T) => U): Stream<U, S>;
|
||||
filter(predicate?: (value: T) => boolean): Stream<T, S>;
|
||||
take(n: number): Stream<T, S>;
|
||||
takeWhile(predicate?: (value: T) => boolean): Stream<T, S>;
|
||||
last(): Stream<T, S>;
|
||||
skip(n: number): Stream<T, S>;
|
||||
skipWhile(predicate?: (value: T) => boolean): Stream<T, S>;
|
||||
skipDuplicates(comparator?: (a: T, b: T) => boolean): Stream<T, S>;
|
||||
diff(fn?: (prev: T, next: T) => T, seed?: T): Stream<T, S>;
|
||||
scan(fn: (prev: T, next: T) => T, seed?: T): Stream<T, S>;
|
||||
flatten<U>(transformer?: (value: T) => U[]): Stream<U, S>;
|
||||
delay(wait: number): Stream<T, S>;
|
||||
throttle(wait: number, options?: {leading: boolean, trailing: boolean}): Stream<T, S>;
|
||||
debounce(wait: number, options?: {immediate: boolean}): Stream<T, S>;
|
||||
valuesToErrors<U>(handler?: (value: T) => {convert: boolean, error: U}): Stream<void, S | U>;
|
||||
errorsToValues<U>(handler?: (error: S) => {convert: boolean, value: U}): Stream<T | U, void>;
|
||||
mapErrors<U>(fn: (error: S) => U): Stream<T, U>;
|
||||
filterErrors(predicate?: (error: S) => boolean): Stream<T, S>;
|
||||
endOnError(): Stream<T, S>;
|
||||
skipValues(): Stream<void, S>;
|
||||
skipErrors(): Stream<T, void>;
|
||||
skipEnd(): Stream<T, S>;
|
||||
beforeEnd<U>(fn: () => U): Stream<T | U, S>;
|
||||
slidingWindow(max: number, mix?: number): Stream<T[], S>;
|
||||
bufferWhile(predicate: (value: T) => boolean): Stream<T[], S>;
|
||||
transduce<U>(transducer: any): Stream<U, S>;
|
||||
withHandler<U, V>(handler: (emitter: Emitter<U, S>, event: Event<T | S>) => void): Stream<U, S>;
|
||||
|
||||
// Combine streams
|
||||
combine<U, V, W>(otherObs: Stream<U, V>, combinator?: (value: T, ...values: U[]) => W): Stream<W, S | V>;
|
||||
zip<U, V, W>(otherObs: Stream<U, V>, combinator?: (value: T, ...values: U[]) => W): Stream<W, S | V>;
|
||||
merge<U, V>(otherObs: Stream<U, V>): Stream<T | U, S | V>;
|
||||
concat<U, V>(otherObs: Stream<U, V>): Stream<T | U, S | V>;
|
||||
flatMap<U, V>(transform: (value: T) => Stream<U, V>): Stream<U, V>;
|
||||
flatMapLatest<U, V>(fn: (value: T) => Stream<U, V>): Stream<U, V>;
|
||||
flatMapFirst<U, V>(fn: (value: T) => Stream<U, V>): Stream<U, V>;
|
||||
flatMapConcat<U, V>(fn: (value: T) => Stream<U, V>): Stream<U, V>;
|
||||
flatMapConcurLimit<U, V>(fn: (value: T) => Stream<U, V>, limit: number): Stream<U, V>;
|
||||
flatMapErrors<U, V>(transform: (error: S) => Stream<U, V>): Stream<U, V>;
|
||||
|
||||
// Combine two streams
|
||||
filterBy<U>(otherObs: Observable<boolean, U>): Stream<T, S>;
|
||||
sampledBy<U, V, W>(otherObs: Observable<U, V>, combinator?: (a: T, b: U) => W): Stream<W, S>;
|
||||
skipUntilBy<U, V>(otherObs: Observable<U, V>): Stream<U, V>;
|
||||
takeUntilBy<U, V>(otherObs: Observable<U, V>): Stream<U, V>;
|
||||
bufferBy<U, V>(otherObs: Observable<U, V>, options?: {flushOnEnd: boolean}): Stream<T[], S>;
|
||||
bufferWhileBy<U>(otherObs: Observable<boolean, U>): Stream<T[], S>;
|
||||
awaiting<U, V>(otherObs: Observable<U, V>): Stream<boolean, S>;
|
||||
}
|
||||
|
||||
export interface Property<T, S> extends Observable<T, S> {
|
||||
changes(): Stream<T, S>;
|
||||
|
||||
// Modify an property
|
||||
map<U>(fn: (value: T) => U): Property<U, S>;
|
||||
filter(predicate?: (value: T) => boolean): Property<T, S>;
|
||||
take(n: number): Property<T, S>;
|
||||
takeWhile(predicate?: (value: T) => boolean): Property<T, S>;
|
||||
last(): Property<T, S>;
|
||||
skip(n: number): Property<T, S>;
|
||||
skipWhile(predicate?: (value: T) => boolean): Property<T, S>;
|
||||
skipDuplicates(comparator?: (a: T, b: T) => boolean): Property<T, S>;
|
||||
diff(fn?: (prev: T, next: T) => T, seed?: T): Property<T, S>;
|
||||
scan(fn: (prev: T, next: T) => T, seed?: T): Property<T, S>;
|
||||
flatten<U>(transformer?: (value: T) => U[]): Property<U, S>;
|
||||
delay(wait: number): Property<T, S>;
|
||||
throttle(wait: number, options?: {leading: boolean, trailing: boolean}): Property<T, S>;
|
||||
debounce(wait: number, options?: {immediate: boolean}): Property<T, S>;
|
||||
valuesToErrors<U>(handler?: (value: T) => {convert: boolean, error: U}): Property<void, S | U>;
|
||||
errorsToValues<U>(handler?: (error: S) => {convert: boolean, value: U}): Property<T | U, void>;
|
||||
mapErrors<U>(fn: (error: S) => U): Property<T, U>;
|
||||
filterErrors(predicate?: (error: S) => boolean): Property<T, S>;
|
||||
endOnError(): Property<T, S>;
|
||||
skipValues(): Property<void, S>;
|
||||
skipErrors(): Property<T, void>;
|
||||
skipEnd(): Property<T, S>;
|
||||
beforeEnd<U>(fn: () => U): Property<T | U, S>;
|
||||
slidingWindow(max: number, mix?: number): Property<T[], S>;
|
||||
bufferWhile(predicate: (value: T) => boolean): Property<T[], S>;
|
||||
transduce<U>(transducer: any): Property<U, S>;
|
||||
withHandler<U, V>(handler: (emitter: Emitter<T, S>, event: Event<T | S>) => void): Property<U, S>;
|
||||
|
||||
// Combine properties
|
||||
combine<U, V, W>(otherObs: Property<U, V>, combinator?: (value: T, ...values: U[]) => W): Property<W, S | V>;
|
||||
zip<U, V, W>(otherObs: Property<U, V>, combinator?: (value: T, ...values: U[]) => W): Property<W, S | V>;
|
||||
merge<U, V>(otherObs: Property<U, V>): Property<T | U, S | V>;
|
||||
concat<U, V>(otherObs: Property<U, V>): Property<T | U, S | V>;
|
||||
flatMap<U, V>(transform: (value: T) => Property<U, V>): Property<U, V>;
|
||||
flatMapLatest<U, V>(fn: (value: T) => Property<U, V>): Property<U, V>;
|
||||
flatMapFirst<U, V>(fn: (value: T) => Property<U, V>): Property<U, V>;
|
||||
flatMapConcat<U, V>(fn: (value: T) => Property<U, V>): Property<U, V>;
|
||||
flatMapConcurLimit<U, V>(fn: (value: T) => Property<U, V>, limit: number): Property<U, V>;
|
||||
flatMapErrors<U, V>(transform: (error: S) => Property<U, V>): Property<U, V>;
|
||||
|
||||
// Combine two properties
|
||||
filterBy<U>(otherObs: Observable<boolean, U>): Property<T, S>;
|
||||
sampledBy<U, V, W>(otherObs: Observable<U, V>, combinator?: (a: T, b: U) => W): Property<W, S>;
|
||||
skipUntilBy<U, V>(otherObs: Observable<U, V>): Property<U, V>;
|
||||
takeUntilBy<U, V>(otherObs: Observable<U, V>): Property<U, V>;
|
||||
bufferBy<U, V>(otherObs: Observable<U, V>, options?: {flushOnEnd: boolean}): Property<T[], S>;
|
||||
bufferWhileBy<U>(otherObs: Observable<boolean, U>): Property<T[], S>;
|
||||
awaiting<U, V>(otherObs: Observable<U, V>): Property<boolean, S>;
|
||||
}
|
||||
|
||||
export interface ObservablePool<T, S> extends Observable<T, S> {
|
||||
plug(obs: Observable<T, S>): void;
|
||||
unPlug(obs: Observable<T, S>): void;
|
||||
}
|
||||
|
||||
export interface Event<T> {
|
||||
type: string;
|
||||
value: T;
|
||||
current: boolean;
|
||||
}
|
||||
|
||||
export interface Emitter<T, S> {
|
||||
emit(value: T): void;
|
||||
error(error: S): void;
|
||||
end(): void;
|
||||
emitEvent(event: {type: string, value: T | S}): void;
|
||||
}
|
||||
|
||||
// Create a stream
|
||||
export function never(): Stream<void, void>;
|
||||
export function later<T>(wait: number, value: T): Stream<T, void>;
|
||||
export function interval<T>(interval: number, value: T): Stream<T, void>;
|
||||
export function sequentially<T>(interval: number, values: T[]): Stream<T, void>;
|
||||
export function fromPoll<T>(interval: number, fn: () => T): Stream<T, void>;
|
||||
export function withInterval<T, S>(interval: number, handler: (emitter: Emitter<T, S>) => void): Stream<T, S>;
|
||||
export function fromCallback<T>(fn: (callback: (value: T) => void) => void): Stream<T, void>;
|
||||
export function fromNodeCallback<T, S>(fn: (callback: (error: S, result: T) => void) => void): Stream<T, S>;
|
||||
export function fromEvents<T, S>(target: EventTarget | NodeJS.EventEmitter | { on: Function, off: Function }, eventName: string, transform?: (value: T) => S): Stream<T, S>;
|
||||
export function stream<T, S>(subscribe: (emitter: Emitter<T, S>) => Function | void): Stream<T, S>;
|
||||
|
||||
// Create a property
|
||||
export function constant<T>(value: T): Property<T, void>;
|
||||
export function constantError<T>(error: T): Property<void, T>;
|
||||
export function fromPromise<T, S>(promise: Promise<T>): Property<T, S>;
|
||||
|
||||
// Combine observables
|
||||
export function combine<T, S, U>(obss: Observable<T, S>[], passiveObss: Observable<T, S>[], combinator?: (...values: T[]) => U): Observable<U, S>;
|
||||
export function combine<T, S, U>(obss: Observable<T, S>[], combinator?: (...values: T[]) => U): Observable<U, S>;
|
||||
export function zip<T, S, U>(obss: Observable<T, S>[], passiveObss?: Observable<T, S>[], combinator?: (...values: T[]) => U): Observable<U, S>;
|
||||
export function merge<T, S>(obss: Observable<T, S>[]): Observable<T, S>;
|
||||
export function concat<T, S>(obss: Observable<T, S>[]): Observable<T, S>;
|
||||
export function pool<T, S>(): ObservablePool<T, S>;
|
||||
export function repeat<T, S>(generator: (i: number) => Observable<T, S> | boolean): Observable<T, S>;
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
/// <reference path="./knockout.d.ts" />
|
||||
|
||||
import ko = require("knockout");
|
||||
|
||||
var myArray = ko.observableArray([1, 2, 3]);
|
||||
@@ -6,4 +8,4 @@ class MyViewModel {
|
||||
name = ko.observable("Jeff");
|
||||
}
|
||||
|
||||
ko.applyBindings(new MyViewModel());
|
||||
ko.applyBindings(new MyViewModel());
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
/// <reference path="LeapMotionTS.d.ts" />
|
||||
|
||||
import Leap = require('LeapMotionTS');
|
||||
import Leap = require('./LeapMotionTS');
|
||||
|
||||
var controller: Leap.Controller = new Leap.Controller();
|
||||
controller.addEventListener(Leap.LeapEvent.LEAPMOTION_FRAME, (event: Leap.LeapEvent) => {
|
||||
|
||||
+101
-28
@@ -403,12 +403,59 @@ result = <number[]>_([1, 2]).zipWith<number>(testZipWithFn, any).value();
|
||||
result = <number[]>_([1, 2]).zipWith<number>([1, 2], testZipWithFn, any).value();
|
||||
result = <number[]>_([1, 2]).zipWith<number>([1, 2], [1, 2], [1, 2], [1, 2], [1, 2], testZipWithFn, any).value();
|
||||
|
||||
// /* *************
|
||||
// * Collections *
|
||||
// ************* */
|
||||
/*********
|
||||
* Chain *
|
||||
*********/
|
||||
|
||||
result = <string[]>_.at(['a', 'b', 'c', 'd', 'e'], [0, 2, 4]);
|
||||
result = <string[]>_.at(['moe', 'larry', 'curly'], 0, 2);
|
||||
// _.thru
|
||||
{
|
||||
let result: number;
|
||||
result = _.thru<number, number>(1, (value: number) => value);
|
||||
result = _.thru<number, number>(1, (value: number) => value, any);
|
||||
}
|
||||
{
|
||||
let result: _.LoDashWrapper<number>;
|
||||
result = _(1).thru<number>((value: number) => value);
|
||||
result = _(1).thru<number>((value: number) => value, any);
|
||||
}
|
||||
{
|
||||
let result: _.LoDashWrapper<string>;
|
||||
result = _('').thru<string>((value: string) => value);
|
||||
result = _('').thru<string>((value: string) => value, any);
|
||||
}
|
||||
{
|
||||
let result: _.LoDashWrapper<boolean>;
|
||||
result = _(true).thru<boolean>((value: boolean) => value);
|
||||
result = _(true).thru<boolean>((value: boolean) => value, any);
|
||||
}
|
||||
{
|
||||
let result: _.LoDashObjectWrapper<any>;
|
||||
result = _({}).thru<Object>((value: Object) => value);
|
||||
result = _({}).thru<Object>((value: Object) => value, any);
|
||||
}
|
||||
{
|
||||
let result: _.LoDashArrayWrapper<number>;
|
||||
result = _([1, 2, 3]).thru<number>((value: number[]) => value);
|
||||
result = _([1, 2, 3]).thru<number>((value: number[]) => value, any);
|
||||
}
|
||||
|
||||
/**************
|
||||
* Collection *
|
||||
**************/
|
||||
|
||||
// _.at
|
||||
{
|
||||
let testAtArray: TResult[];
|
||||
let testAtList: _.List<TResult>;
|
||||
let testAtDictionary: _.Dictionary<TResult>;
|
||||
let result: TResult[];
|
||||
result = _.at<TResult>(testAtArray, 0, '1', [2], ['3'], [4, '5']);
|
||||
result = _.at<TResult>(testAtList, 0, '1', [2], ['3'], [4, '5']);
|
||||
result = _.at<TResult>(testAtDictionary, 0, '1', [2], ['3'], [4, '5']);
|
||||
result = _(testAtArray).at(0, '1', [2], ['3'], [4, '5']).value();
|
||||
result = _(testAtList).at<TResult>(0, '1', [2], ['3'], [4, '5']).value();
|
||||
result = _(testAtDictionary).at<TResult>(0, '1', [2], ['3'], [4, '5']).value();
|
||||
}
|
||||
|
||||
result = <boolean>_.contains([1, 2, 3], 1);
|
||||
result = <boolean>_.contains([1, 2, 3], 1, 2);
|
||||
@@ -1482,20 +1529,28 @@ result = <_.LoDashArrayWrapper<string>>_(_).methods();
|
||||
|
||||
// _.get
|
||||
result = <number>_.get<number>({ 'a': [{ 'b': { 'c': 3 } }] }, 'a[0].b.c');
|
||||
// → 3
|
||||
result = <number>_.get<number>({ 'a': [{ 'b': { 'c': 3 } }] }, ['a', '0', 'b', 'c']);
|
||||
// → 3
|
||||
result = <string>_.get<string>({ 'a': [{ 'b': { 'c': 3 } }] }, 'a.b.c', 'default');
|
||||
// → 'default'
|
||||
|
||||
result = <number>_({ 'a': [{ 'b': { 'c': 3 } }] }).get<number>('a[0].b.c');
|
||||
// → 3
|
||||
result = <number>_({ 'a': [{ 'b': { 'c': 3 } }] }).get<number>(['a', '0', 'b', 'c']);
|
||||
// → 3
|
||||
result = <string>_({ 'a': [{ 'b': { 'c': 3 } }] }).get<string>('a.b.c', 'default');
|
||||
// → 'default'
|
||||
{
|
||||
let result: TResult;
|
||||
result = _.get<TResult>({}, '');
|
||||
result = _.get<TResult>({}, 42);
|
||||
result = _.get<TResult>({}, true);
|
||||
result = _.get<TResult>({}, ['', 42, true]);
|
||||
result = _({}).get<TResult>('');
|
||||
result = _({}).get<TResult>(42);
|
||||
result = _({}).get<TResult>(true);
|
||||
result = _({}).get<TResult>(['', 42, true]);
|
||||
}
|
||||
|
||||
result = <boolean>_.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b');
|
||||
// _.has
|
||||
result = <boolean>_.has({}, '');
|
||||
result = <boolean>_.has({}, 42);
|
||||
result = <boolean>_.has({}, true);
|
||||
result = <boolean>_.has({}, ['', 42, true]);
|
||||
result = <boolean>_({}).has('');
|
||||
result = <boolean>_({}).has(42);
|
||||
result = <boolean>_({}).has(true);
|
||||
result = <boolean>_({}).has(['', 42, true]);
|
||||
|
||||
interface FirstSecond {
|
||||
first: string;
|
||||
@@ -1594,11 +1649,20 @@ result = <HasName>_({ 'name': 'moe', 'age': 40 }).omit(function (value) {
|
||||
result = <any[][]>_.pairs({ 'moe': 30, 'larry': 40 });
|
||||
result = <any[][]>_({ 'moe': 30, 'larry': 40 }).pairs().value();
|
||||
|
||||
result = <HasName>_.pick({ 'name': 'moe', '_userid': 'moe1' }, 'name');
|
||||
result = <HasName>_.pick({ 'name': 'moe', '_userid': 'moe1' }, ['name']);
|
||||
result = <HasName>_.pick({ 'name': 'moe', '_userid': 'moe1' }, function (value, key) {
|
||||
return key.charAt(0) != '_';
|
||||
});
|
||||
// _.pick
|
||||
interface TestPickFn {
|
||||
(element: any, key: string, collection: any): boolean;
|
||||
}
|
||||
{
|
||||
let testPickFn: TestPickFn;
|
||||
let result: TResult;
|
||||
result = _.pick<TResult, Object>({}, 0, '1', true, [2], ['3'], [true], [4, '5', true]);
|
||||
result = _.pick<TResult, Object>({}, testPickFn);
|
||||
result = _.pick<TResult, Object>({}, testPickFn, any);
|
||||
result = _({}).pick<TResult>(0, '1', true, [2], ['3'], [true], [4, '5', true]).value();
|
||||
result = _({}).pick<TResult>(testPickFn).value();
|
||||
result = _({}).pick<TResult>(testPickFn, any).value();
|
||||
}
|
||||
|
||||
// _.set
|
||||
result = <{ a: { b: { c: number; }}[]}>_.set({ 'a': [{ 'b': { 'c': 3 } }] }, 'a[0].b.c', 4);
|
||||
@@ -1652,12 +1716,6 @@ var testAttempFn: TestAttemptFn;
|
||||
result = <TResult|Error>_.attempt<TResult>(testAttempFn);
|
||||
result = <TResult|Error>_(testAttempFn).attempt<TResult>();
|
||||
|
||||
_.mixin({
|
||||
'capitalize': function (string) {
|
||||
return string.charAt(0).toUpperCase() + string.slice(1).toLowerCase();
|
||||
}
|
||||
});
|
||||
|
||||
var lodash = <typeof _>_.noConflict();
|
||||
|
||||
result = <number>_.random(0, 5);
|
||||
@@ -1939,6 +1997,21 @@ result = <number>(_.methodOf<number>(TestMethodOfObject, 1, 2))(['a', '0']);
|
||||
result = <number>(_(TestMethodOfObject).methodOf<number>(1, 2).value())('a[0]');
|
||||
result = <number>(_(TestMethodOfObject).methodOf<number>(1, 2).value())(['a', '0']);
|
||||
|
||||
// _.mixin
|
||||
{
|
||||
let testMixinSource: _.Dictionary<Function>;
|
||||
let testMixinOptions: {chain?: boolean;}
|
||||
let result: TResult;
|
||||
result = _.mixin<TResult, Object>({}, testMixinSource);
|
||||
result = _.mixin<TResult, Object>({}, testMixinSource, testMixinOptions);
|
||||
result = _.mixin<TResult>(testMixinSource);
|
||||
result = _.mixin<TResult>(testMixinSource, testMixinOptions);
|
||||
result = _({}).mixin<TResult>(testMixinSource).value();
|
||||
result = _({}).mixin<TResult>(testMixinSource, testMixinOptions).value();
|
||||
result = _(testMixinSource).mixin<TResult>().value();
|
||||
result = _(testMixinSource).mixin<TResult>(testMixinOptions).value();
|
||||
}
|
||||
|
||||
// _.uniqueId
|
||||
result = <string>_.uniqueId();
|
||||
result = <string>_.uniqueId('');
|
||||
|
||||
Vendored
+189
-89
@@ -694,9 +694,9 @@ declare module _ {
|
||||
takeWhile<T>(
|
||||
array: (Array<T>|List<T>),
|
||||
predicate?: ListIterator<T, boolean>,
|
||||
thisArg?: any
|
||||
thisArg?: any
|
||||
): T[];
|
||||
|
||||
|
||||
/**
|
||||
* Takes the first items from an array or list based on a predicate
|
||||
* @param array The array or list of items on which the result set will be based
|
||||
@@ -706,7 +706,7 @@ declare module _ {
|
||||
array: (Array<T>|List<T>),
|
||||
pluckValue: string
|
||||
): any[];
|
||||
|
||||
|
||||
/**
|
||||
* Takes the first items from an array or list based on a predicate
|
||||
* @param array The array or list of items on which the result set will be based
|
||||
@@ -1502,7 +1502,7 @@ declare module _ {
|
||||
**/
|
||||
union<T>(...arrays: List<T>[]): T[];
|
||||
}
|
||||
|
||||
|
||||
interface LoDashArrayWrapper<T> {
|
||||
/**
|
||||
* @see _.union
|
||||
@@ -2000,58 +2000,94 @@ declare module _ {
|
||||
zipWith<TResult>(...args: any[]): LoDashArrayWrapper<TResult>;
|
||||
}
|
||||
|
||||
/* *************
|
||||
* Collections *
|
||||
************* */
|
||||
/*********
|
||||
* Chain *
|
||||
*********/
|
||||
|
||||
//_.thru
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* This method is like _.tap except that it returns the result of interceptor.
|
||||
* @param value The value to provide to interceptor.
|
||||
* @param interceptor The function to invoke.
|
||||
* @param thisArg The this binding of interceptor.
|
||||
* @return Returns the result of interceptor.
|
||||
*/
|
||||
thru<T, TResult>(
|
||||
value: T,
|
||||
interceptor: (value: T) => TResult,
|
||||
thisArg?: any): TResult;
|
||||
}
|
||||
|
||||
interface LoDashWrapperBase<T, TWrapper> {
|
||||
/**
|
||||
* @see _.thru
|
||||
*/
|
||||
thru<TResult extends number>(
|
||||
interceptor: (value: T) => TResult,
|
||||
thisArg?: any): LoDashWrapper<TResult>;
|
||||
|
||||
/**
|
||||
* @see _.thru
|
||||
*/
|
||||
thru<TResult extends string>(
|
||||
interceptor: (value: T) => TResult,
|
||||
thisArg?: any): LoDashWrapper<TResult>;
|
||||
|
||||
/**
|
||||
* @see _.thru
|
||||
*/
|
||||
thru<TResult extends boolean>(
|
||||
interceptor: (value: T) => TResult,
|
||||
thisArg?: any): LoDashWrapper<TResult>;
|
||||
|
||||
/**
|
||||
* @see _.thru
|
||||
*/
|
||||
thru<TResult extends Object>(
|
||||
interceptor: (value: T) => TResult,
|
||||
thisArg?: any): LoDashObjectWrapper<TResult>;
|
||||
|
||||
/**
|
||||
* @see _.thru
|
||||
*/
|
||||
thru<TResult>(
|
||||
interceptor: (value: T) => TResult[],
|
||||
thisArg?: any): LoDashArrayWrapper<TResult>;
|
||||
}
|
||||
|
||||
/**************
|
||||
* Collection *
|
||||
**************/
|
||||
|
||||
//_.at
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Creates an array of elements from the specified indexes, or keys, of the collection.
|
||||
* Indexes may be specified as individual arguments or as arrays of indexes.
|
||||
* @param collection The collection to iterate over.
|
||||
* @param indexes The indexes of collection to retrieve, specified as individual indexes or
|
||||
* arrays of indexes.
|
||||
* @return A new array of elements corresponding to the provided indexes.
|
||||
**/
|
||||
* Creates an array of elements corresponding to the given keys, or indexes, of collection. Keys may be
|
||||
* specified as individual arguments or as arrays of keys.
|
||||
*
|
||||
* @param collection The collection to iterate over.
|
||||
* @param props The property names or indexes of elements to pick, specified individually or in arrays.
|
||||
* @return Returns the new array of picked elements.
|
||||
*/
|
||||
at<T>(
|
||||
collection: Array<T>,
|
||||
indexes: number[]): T[];
|
||||
collection: List<T>|Dictionary<T>,
|
||||
...props: Array<number|string|Array<number|string>>
|
||||
): T[];
|
||||
}
|
||||
|
||||
interface LoDashArrayWrapper<T> {
|
||||
/**
|
||||
* @see _.at
|
||||
**/
|
||||
at<T>(
|
||||
collection: List<T>,
|
||||
indexes: number[]): T[];
|
||||
* @see _.at
|
||||
*/
|
||||
at(...props: Array<number|string|Array<number|string>>): LoDashArrayWrapper<T>;
|
||||
}
|
||||
|
||||
interface LoDashObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.at
|
||||
**/
|
||||
at<T>(
|
||||
collection: Dictionary<T>,
|
||||
indexes: number[]): T[];
|
||||
|
||||
/**
|
||||
* @see _.at
|
||||
**/
|
||||
at<T>(
|
||||
collection: Array<T>,
|
||||
...indexes: number[]): T[];
|
||||
|
||||
/**
|
||||
* @see _.at
|
||||
**/
|
||||
at<T>(
|
||||
collection: List<T>,
|
||||
...indexes: number[]): T[];
|
||||
|
||||
/**
|
||||
* @see _.at
|
||||
**/
|
||||
at<T>(
|
||||
collection: Dictionary<T>,
|
||||
...indexes: number[]): T[];
|
||||
* @see _.at
|
||||
*/
|
||||
at<TResult>(...props: Array<number|string|Array<number|string>>): LoDashArrayWrapper<TResult>;
|
||||
}
|
||||
|
||||
//_.contains
|
||||
@@ -2514,13 +2550,13 @@ declare module _ {
|
||||
/**
|
||||
* Iterates over elements of a collection, returning an array of all elements the
|
||||
* identity function returns truey for.
|
||||
*
|
||||
*
|
||||
* @param collection The collection to iterate over.
|
||||
* @return Returns a new array of elements that passed the callback check.
|
||||
**/
|
||||
filter<T>(
|
||||
collection: (Array<T>|List<T>)): T[];
|
||||
|
||||
|
||||
/**
|
||||
* Iterates over elements of a collection, returning an array of all elements the
|
||||
* callback returns truey for. The callback is bound to thisArg and invoked with three
|
||||
@@ -2683,7 +2719,7 @@ declare module _ {
|
||||
* @see _.filter
|
||||
**/
|
||||
filter(): LoDashArrayWrapper<T>;
|
||||
|
||||
|
||||
/**
|
||||
* @see _.filter
|
||||
**/
|
||||
@@ -5096,7 +5132,7 @@ declare module _ {
|
||||
sortBy<W, T>(
|
||||
collection: List<T>,
|
||||
whereValue: W): T[];
|
||||
|
||||
|
||||
/**
|
||||
* Sorts by all the given arguments, using either ListIterator, pluckValue, or whereValue foramts
|
||||
* @param args The rules by which to sort
|
||||
@@ -5126,7 +5162,7 @@ declare module _ {
|
||||
* @param whereValue _.where style callback
|
||||
**/
|
||||
sortBy<W>(whereValue: W): LoDashArrayWrapper<T>;
|
||||
|
||||
|
||||
/**
|
||||
* Sorts by all the given arguments, using either ListIterator, pluckValue, or whereValue foramts
|
||||
* @param args The rules by which to sort
|
||||
@@ -7117,17 +7153,17 @@ declare module _ {
|
||||
* @param defaultValue The value returned if the resolved value is undefined.
|
||||
* @return Returns the resolved value.
|
||||
**/
|
||||
get<T>(object: Object,
|
||||
path: string|string[],
|
||||
defaultValue?:T
|
||||
): T;
|
||||
get<TResult>(object: Object,
|
||||
path: string|number|boolean|Array<string|number|boolean>,
|
||||
defaultValue?:TResult
|
||||
): TResult;
|
||||
}
|
||||
|
||||
interface LoDashObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.get
|
||||
**/
|
||||
get<TResult>(path: string|string[],
|
||||
get<TResult>(path: string|number|boolean|Array<string|number|boolean>,
|
||||
defaultValue?: TResult
|
||||
): TResult;
|
||||
}
|
||||
@@ -7135,12 +7171,20 @@ declare module _ {
|
||||
//_.has
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Checks if path is a direct property.
|
||||
* @param object The object to query.
|
||||
* @param path The path to check.
|
||||
* @return True if path is a direct property, else False.
|
||||
**/
|
||||
has(object: any, path: string|string[]): boolean;
|
||||
* Checks if path is a direct property.
|
||||
*
|
||||
* @param object The object to query.
|
||||
* @param path The path to check.
|
||||
* @return Returns true if path is a direct property, else false.
|
||||
*/
|
||||
has(object: any, path: string|number|boolean|Array<string|number|boolean>): boolean;
|
||||
}
|
||||
|
||||
interface LoDashObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.has
|
||||
*/
|
||||
has(path: string|number|boolean|Array<string|number|boolean>): boolean;
|
||||
}
|
||||
|
||||
//_.invert
|
||||
@@ -7450,36 +7494,50 @@ declare module _ {
|
||||
pairs(): LoDashArrayWrapper<any[]>;
|
||||
}
|
||||
|
||||
//_.picks
|
||||
//_.pick
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Creates a shallow clone of object composed of the specified properties. Property names may be
|
||||
* specified as individual arguments or as arrays of property names. If a callback is provided
|
||||
* it will be executed for each property of object picking the properties the callback returns
|
||||
* truey for. The callback is bound to thisArg and invoked with three arguments; (value, key,
|
||||
* object).
|
||||
* @param object Object to strip unwanted key/value pairs.
|
||||
* @param keys Property names to pick
|
||||
* @return An object composed of the picked properties.
|
||||
**/
|
||||
pick<Picked, T>(
|
||||
* Creates an object composed of the picked object properties. Property names may be specified as individual
|
||||
* arguments or as arrays of property names. If predicate is provided it’s invoked for each property of object
|
||||
* picking the properties predicate returns truthy for. The predicate is bound to thisArg and invoked with
|
||||
* three arguments: (value, key, object).
|
||||
*
|
||||
* @param object The source object.
|
||||
* @param predicate The function invoked per iteration or property names to pick, specified as individual
|
||||
* property names or arrays of property names.
|
||||
* @param thisArg The this binding of predicate.
|
||||
* @return An object composed of the picked properties.
|
||||
*/
|
||||
pick<TResult extends Object, T extends Object>(
|
||||
object: T,
|
||||
...keys: string[]): Picked;
|
||||
predicate: ObjectIterator<any, boolean>,
|
||||
thisArg?: any
|
||||
): TResult;
|
||||
|
||||
/**
|
||||
* @see _.pick
|
||||
**/
|
||||
pick<Picked, T>(
|
||||
* @see _.pick
|
||||
*/
|
||||
pick<TResult extends Object, T extends Object>(
|
||||
object: T,
|
||||
keys: string[]): Picked;
|
||||
...predicate: Array<string|number|boolean|Array<string|number|boolean>>
|
||||
): TResult;
|
||||
}
|
||||
|
||||
interface LoDashObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.pick
|
||||
*/
|
||||
pick<TResult extends Object>(
|
||||
predicate: ObjectIterator<any, boolean>,
|
||||
thisArg?: any
|
||||
): LoDashObjectWrapper<TResult>;
|
||||
|
||||
/**
|
||||
* @see _.pick
|
||||
**/
|
||||
pick<Picked, T>(
|
||||
object: T,
|
||||
callback: ObjectIterator<any, boolean>,
|
||||
thisArg?: any): Picked;
|
||||
* @see _.pick
|
||||
*/
|
||||
pick<TResult extends Object>(
|
||||
...predicate: Array<string|number|boolean|Array<string|number|boolean>>
|
||||
): LoDashObjectWrapper<TResult>;
|
||||
}
|
||||
|
||||
//_.set
|
||||
@@ -8151,12 +8209,54 @@ declare module _ {
|
||||
}
|
||||
|
||||
//_.mixin
|
||||
interface MixinOptions {
|
||||
chain?: boolean;
|
||||
}
|
||||
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Adds function properties of a source object to the lodash function and chainable wrapper.
|
||||
* @param object The object of function properties to add to lodash.
|
||||
**/
|
||||
mixin(object?: Dictionary<(value: any) => any>): void;
|
||||
* Adds all own enumerable function properties of a source object to the destination object. If object is a
|
||||
* function then methods are added to its prototype as well.
|
||||
*
|
||||
* Note: Use _.runInContext to create a pristine lodash function to avoid conflicts caused by modifying
|
||||
* the original.
|
||||
*
|
||||
* @param object The destination object.
|
||||
* @param source The object of functions to add.
|
||||
* @param options The options object.
|
||||
* @param options.chain Specify whether the functions added are chainable.
|
||||
* @return Returns object.
|
||||
*/
|
||||
mixin<TResult, TObject>(
|
||||
object: TObject,
|
||||
source: Dictionary<Function>,
|
||||
options?: MixinOptions
|
||||
): TResult;
|
||||
|
||||
/**
|
||||
* @see _.mixin
|
||||
*/
|
||||
mixin<TResult>(
|
||||
source: Dictionary<Function>,
|
||||
options?: MixinOptions
|
||||
): TResult;
|
||||
}
|
||||
|
||||
interface LoDashObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.mixin
|
||||
*/
|
||||
mixin<TResult>(
|
||||
source: Dictionary<Function>,
|
||||
options?: MixinOptions
|
||||
): LoDashObjectWrapper<TResult>;
|
||||
|
||||
/**
|
||||
* @see _.mixin
|
||||
*/
|
||||
mixin<TResult>(
|
||||
options?: MixinOptions
|
||||
): LoDashObjectWrapper<TResult>;
|
||||
}
|
||||
|
||||
//_.noConflict
|
||||
|
||||
@@ -43,6 +43,8 @@ function main(): void {
|
||||
}).then(
|
||||
function() {
|
||||
return todoDb.select(lf.fn.count()).from(itemSchema).exec();
|
||||
}).then(function() {
|
||||
return todoDb.export();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Vendored
+21
-2
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Lovefield v2.0.56
|
||||
// Type definitions for Lovefield v2.0.62
|
||||
// Project: http://google.github.io/lovefield/
|
||||
// Definitions by: freshp86 <https://github.com/freshp86>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
@@ -18,6 +18,16 @@ declare module lf {
|
||||
STRING
|
||||
}
|
||||
|
||||
export enum ConstraintAction {
|
||||
RESTRICT,
|
||||
CASCADE
|
||||
}
|
||||
|
||||
export enum ConstraintTiming {
|
||||
IMMEDIATE,
|
||||
DEFERRABLE
|
||||
}
|
||||
|
||||
export interface Binder {
|
||||
getIndex(): number
|
||||
}
|
||||
@@ -56,7 +66,9 @@ declare module lf {
|
||||
close(): void
|
||||
createTransaction(type?: TransactionType): Transaction
|
||||
delete(): query.Delete
|
||||
export(): Promise<Object>
|
||||
getSchema(): schema.Database
|
||||
import(data: Object): Promise<void>
|
||||
insertOrReplace(): query.Insert
|
||||
insert(): query.Insert
|
||||
observe(query: query.Select, callback: Function): void
|
||||
@@ -174,9 +186,16 @@ declare module lf {
|
||||
order: Order
|
||||
}
|
||||
|
||||
type RawForeignKeySpec = {
|
||||
local: string
|
||||
ref: string
|
||||
action: lf.ConstraintAction
|
||||
timing: lf.ConstraintAction
|
||||
}
|
||||
|
||||
export interface TableBuilder {
|
||||
addColumn(name: string, type: lf.Type): TableBuilder
|
||||
addForeignKey(): TableBuilder
|
||||
addForeignKey(name: string, spec: RawForeignKeySpec): TableBuilder
|
||||
addIndex(
|
||||
name: string, columns: Array<string>|Array<IndexedColumn>,
|
||||
unique?: boolean, order?: Order): TableBuilder
|
||||
|
||||
Vendored
+39
-3
@@ -1,13 +1,49 @@
|
||||
// Type definitions for lscache v1.0.2
|
||||
// Type definitions for lscache v1.0.5
|
||||
// Project: https://github.com/pamelafox/lscache
|
||||
// Definitions by: Chris Martinez <https://github.com/Chris-Martinezz>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
interface LSCache {
|
||||
|
||||
/**
|
||||
* Stores the value in localStorage. Expires after specified number of minutes.
|
||||
* @param {string} key
|
||||
* @param {Object|string} value
|
||||
* @param {number} time
|
||||
*/
|
||||
set(key: string, value: any, time?: number): void;
|
||||
/**
|
||||
* Retrieves specified value from localStorage, if not expired.
|
||||
* @param {string} key
|
||||
* @return {string|Object}
|
||||
*/
|
||||
get(key: string): any;
|
||||
/**
|
||||
* Removes a value from localStorage.
|
||||
* Equivalent to 'delete' in memcache, but that's a keyword in JS.
|
||||
* @param {string} key
|
||||
*/
|
||||
remove(key: string): void;
|
||||
/**
|
||||
* Flushes all lscache items and expiry markers without affecting rest of localStorage
|
||||
*/
|
||||
flush(): void;
|
||||
/**
|
||||
* Flushes expired lscache items and expiry markers without affecting rest of localStorage
|
||||
*/
|
||||
flushExpired(): void;
|
||||
/**
|
||||
* Appends CACHE_PREFIX so lscache will partition data in to different buckets.
|
||||
* @param {string} bucket
|
||||
*/
|
||||
setBucket(bucket: string):void;
|
||||
/**
|
||||
* Resets the string being appended to CACHE_PREFIX so lscache will use the default storage behavior.
|
||||
*/
|
||||
resetBucket(): void;
|
||||
}
|
||||
declare var lscache:LSCache;
|
||||
declare module 'lscache' {
|
||||
var lscache: LSCache;
|
||||
export = lscache;
|
||||
}
|
||||
|
||||
declare var lscache: LSCache;
|
||||
@@ -1,3 +1,5 @@
|
||||
/// <reference path="./mailparser.d.ts" />
|
||||
|
||||
import mailparser_mod = require("mailparser");
|
||||
import MailParser = mailparser_mod.MailParser;
|
||||
import ParsedMail = mailparser_mod.ParsedMail;
|
||||
@@ -12,25 +14,25 @@ mailparser.on("headers", function(headers){
|
||||
});
|
||||
|
||||
mailparser.on("end", function(mail){
|
||||
mail; // object structure for parsed e-mail
|
||||
mail; // object structure for parsed e-mail
|
||||
});
|
||||
|
||||
|
||||
|
||||
// Decode a simple e-mail
|
||||
// This example decodes an e-mail from a string
|
||||
|
||||
|
||||
var email = "From: 'Sender Name' <sender@example.com>\r\n"+
|
||||
"To: 'Receiver Name' <receiver@example.com>\r\n"+
|
||||
"Subject: Hello world!\r\n"+
|
||||
"\r\n"+
|
||||
"How are you today?";
|
||||
// setup an event listener when the parsing finishes
|
||||
// setup an event listener when the parsing finishes
|
||||
mailparser.on("end", function(mail_object){
|
||||
console.log("From:", mail_object.from); //[{address:'sender@example.com',name:'Sender Name'}]
|
||||
console.log("Subject:", mail_object.subject); // Hello world!
|
||||
console.log("Text body:", mail_object.text); // How are you today?
|
||||
console.log("From:", mail_object.from); //[{address:'sender@example.com',name:'Sender Name'}]
|
||||
console.log("Subject:", mail_object.subject); // Hello world!
|
||||
console.log("Text body:", mail_object.text); // How are you today?
|
||||
});
|
||||
// send the email source to the parser
|
||||
// send the email source to the parser
|
||||
mailparser.write(email);
|
||||
mailparser.end();
|
||||
|
||||
@@ -42,7 +44,7 @@ import fs = require("fs");
|
||||
mailparser.on("end", function(mail_object){
|
||||
console.log("Subject:", mail_object.subject);
|
||||
});
|
||||
|
||||
|
||||
fs.createReadStream("email.eml").pipe(mailparser);
|
||||
|
||||
|
||||
@@ -63,7 +65,3 @@ mp.on("attachment", function(attachment, mail){
|
||||
var output = fs.createWriteStream(attachment.generatedFileName);
|
||||
attachment.stream.pipe(output);
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
// These are the examples from the node-mariasql README transposed to TypeScript
|
||||
// https://github.com/mscdex/node-mariasql
|
||||
|
||||
/// <reference path="../node/node-0.10.d.ts" />
|
||||
/// <reference path="./mariasql.d.ts" />
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
// Example 1 - SHOW DATABASES
|
||||
import util = require('util');
|
||||
@@ -198,4 +199,4 @@ c.end();
|
||||
Query #3 finished successfully
|
||||
Done with all queries
|
||||
Client closed
|
||||
*/
|
||||
*/
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/// <reference path="../gulp/gulp.d.ts" />
|
||||
|
||||
import gulp = require('gulp');
|
||||
import merge2 = require('merge2');
|
||||
import * as merge2 from "merge2";
|
||||
|
||||
gulp.task('app-js', () =>
|
||||
merge2(
|
||||
|
||||
Vendored
+6
-3
@@ -12,10 +12,13 @@ declare module 'merge2' {
|
||||
}
|
||||
|
||||
interface IMerge2Stream extends NodeJS.ReadWriteStream {
|
||||
add(...args: Array<NodeJS.ReadWriteStream | IMerge2Stream | Array<NodeJS.ReadWriteStream | IMerge2Stream | IOptions>>): IMerge2Stream;
|
||||
add(...args: Array<NodeJS.ReadWriteStream | IMerge2Stream | Array<NodeJS.ReadWriteStream | IMerge2Stream | IOptions>>): IMerge2Stream;
|
||||
}
|
||||
|
||||
function merge2(...args: Array<NodeJS.ReadWriteStream | IMerge2Stream | Array<NodeJS.ReadWriteStream | IMerge2Stream> | IOptions>): IMerge2Stream;
|
||||
interface IMerge2 {
|
||||
(...args: Array<NodeJS.ReadWriteStream | IMerge2Stream | Array<NodeJS.ReadWriteStream | IMerge2Stream> | IOptions>): IMerge2Stream;
|
||||
}
|
||||
|
||||
export = merge2;
|
||||
var _tmp: IMerge2;
|
||||
export = _tmp;
|
||||
}
|
||||
|
||||
Vendored
+1
@@ -527,6 +527,7 @@ declare module "mongodb" {
|
||||
export interface MongoCollectionOptions {
|
||||
safe?: any;
|
||||
serializeFunctions?: any;
|
||||
strict?: boolean;
|
||||
raw?: boolean;
|
||||
pkFactory?: any;
|
||||
readPreference?: string;
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
/// <reference path="./imap.d.ts" />
|
||||
|
||||
import Imap = require('imap');
|
||||
var inspect = require('util').inspect;
|
||||
|
||||
|
||||
@@ -8,11 +8,13 @@ let myJSFL: jsfl.JSFL = {
|
||||
}
|
||||
}
|
||||
|
||||
let flashLocation: string = '';
|
||||
|
||||
jsfl.createJSFL(myJSFL, 'fileName.jsfl', ['Hello!'], (err: NodeJS.ErrnoException) => {
|
||||
|
||||
});
|
||||
|
||||
jsfl.runJSFL('fileName.jsfl', (err: NodeJS.ErrnoException) => {
|
||||
jsfl.runJSFL(flashLocation, 'fileName.jsfl', (err: NodeJS.ErrnoException) => {
|
||||
|
||||
});
|
||||
|
||||
|
||||
+3
-2
@@ -1,4 +1,4 @@
|
||||
// Type definitions for node-jsfl-runner
|
||||
// Type definitions for node-jsfl-runner v0.2.4
|
||||
// Project: https://www.npmjs.com/package/node-jsfl-runner
|
||||
// Definitions by: Michael Randolph <https://github.com/mrand01>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
@@ -28,8 +28,9 @@ declare module "node-jsfl-runner" {
|
||||
|
||||
/**
|
||||
* Runs a JSFL file
|
||||
* @param flashLocation Path to Flash executable
|
||||
* @param fileName Path to JSFL file to run
|
||||
* @param callback Callback
|
||||
*/
|
||||
function runJSFL(fileName: string, callback: (err: NodeJS.ErrnoException) => void): void;
|
||||
function runJSFL(flashLocation:string, fileName: string, callback: (err: NodeJS.ErrnoException) => void): void;
|
||||
}
|
||||
@@ -1,49 +1,80 @@
|
||||
///<reference path='./node-mysql-wrapper.d.ts' />
|
||||
|
||||
import wrapper = require("node-mysql-wrapper");
|
||||
var db = wrapper.wrap("mysql://kataras:pass@127.0.0.1/taglub?debug=false&charset=utf8");
|
||||
|
||||
|
||||
/// <reference path="./node-mysql-wrapper.d.ts" />
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
/// <reference path="../bluebird/bluebird.d.ts" />
|
||||
|
||||
var express = require('express');
|
||||
var app = express();
|
||||
var server = require('http').createServer(app);
|
||||
import wrapper2 = require("node-mysql-wrapper");
|
||||
var db = wrapper2.wrap("mysql://kataras:pass@127.0.0.1/taglub?debug=false&charset=utf8");
|
||||
|
||||
class User { //or interface
|
||||
userId: number;
|
||||
username: string;
|
||||
mail: string;
|
||||
password:string;
|
||||
comments: Comment[];
|
||||
myComments: Comment[];
|
||||
info: UserInfo;
|
||||
}
|
||||
|
||||
interface Comment {
|
||||
commentId: number;
|
||||
content: string;
|
||||
likes: CommentLike[];
|
||||
|
||||
}
|
||||
interface CommentLike {
|
||||
commentLikeId: number;
|
||||
userId: number;
|
||||
commentId: number;
|
||||
}
|
||||
|
||||
interface UserInfo {
|
||||
userInfoId: number;
|
||||
userId: number;
|
||||
hometown: string;
|
||||
}
|
||||
|
||||
db.ready(() => {
|
||||
|
||||
|
||||
var usersDb = db.table<User>("users");
|
||||
|
||||
//or var usersDb = db.table("users"); if you don't want intel auto complete from your ide/editor
|
||||
|
||||
usersDb.findById(16, (_user) => {
|
||||
|
||||
console.log("TEST1: \n");
|
||||
console.log("FOUND USER WITH USERNAME: " + _user.username);
|
||||
});
|
||||
|
||||
|
||||
/* OR usersDb.findById(18).then(_user=> {
|
||||
console.log("FOUND USER WITH USERNAME: " + _user.username);
|
||||
}, (err) => { console.log("ERROR ON FETCHING FINDBY ID: " + err) });
|
||||
*/
|
||||
|
||||
usersDb.find({ userId: 18, comments: { userId: '=' } }, _users=> {
|
||||
var _user = _users[0];
|
||||
console.log("TEST2: \n");
|
||||
console.log(_user.username + " with ");
|
||||
console.log(_user.comments.length + " comments ");
|
||||
_user.comments.forEach(_comment=> {
|
||||
console.log("--------------\n" + _comment.content);
|
||||
usersDb.findSingle(
|
||||
{
|
||||
userId: 18,
|
||||
myComments: {
|
||||
userId: '=',
|
||||
tableRules: { //NEW: SET rules to joined tables too!
|
||||
table: "comments", //NEW SET table name inside any property u want!
|
||||
limit: 50,
|
||||
orderByDesc: "commentId" //give me the first 50 comments ordered by -commentId (DESC) from table 'comments' and put them at 'myComments' property inside the result object.
|
||||
}
|
||||
}
|
||||
}).then(_user=> { // to get this promise use : .promise()
|
||||
console.log("\n-------------TEST 2 ------------\n");
|
||||
console.log(_user.username + " with ");
|
||||
console.log(_user.myComments.length + " comments ");
|
||||
_user.myComments.forEach(_comment=> {
|
||||
console.log("--------------\n" + _comment.content);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
usersDb.safeRemove(5620, answer=> {
|
||||
usersDb.remove(5620, answer=> {
|
||||
console.log("TEST 3: \n");
|
||||
console.log(answer.affectedRows + ' (1) has removed from table: ' + answer.table);
|
||||
|
||||
@@ -60,4 +91,109 @@ db.ready(() => {
|
||||
});
|
||||
|
||||
|
||||
|
||||
usersDb.find(
|
||||
{
|
||||
yearsOld: 22,
|
||||
comments: {
|
||||
userId: "=",
|
||||
tableRules: {
|
||||
limit: 2
|
||||
}
|
||||
}
|
||||
|
||||
}, (_users) => {
|
||||
|
||||
console.log("---------------TEST 6----------------------------------------");
|
||||
_users.forEach(_user=> {
|
||||
console.log(_user.userId + " " + _user.username + " found with " + _user.comments.length + " comments");
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
//if no rules setted to find method it's uses the table's rules ( if exists)
|
||||
|
||||
|
||||
|
||||
let _criteriaFromBuilder = usersDb.criteria
|
||||
.except("password") // or .exclude(...columns). the only column you cannot except/exclude is the primary key (because it is used at where clause), be careful.
|
||||
.where("userId", 24)
|
||||
.joinAs("info", "userInfos", "userId")
|
||||
.at("info")
|
||||
.limit(1) //because we make it limit 1 it will return this result as object not as array.
|
||||
.parent()
|
||||
.joinAs("myComments", "comments", "userId")
|
||||
.at("myComments").limit(2)
|
||||
.joinAs("likes", "commentLikes", "commentId")
|
||||
.original().orderBy("userId", true).build();
|
||||
|
||||
/* console.dir(_criteriaFromBuilder);
|
||||
prints this object: ( of course you can create your own in order to pass it on .find table methods )
|
||||
{
|
||||
userId:23,
|
||||
|
||||
myComments:{
|
||||
userId: '=',
|
||||
|
||||
tableRules:{
|
||||
table: 'comments',
|
||||
limit:2
|
||||
|
||||
},
|
||||
|
||||
likes:{
|
||||
commentId: '=',
|
||||
|
||||
tableRules:{
|
||||
table: 'commentLikes'
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
tableRules:{
|
||||
orderByDesc: 'userId',
|
||||
except: ['password']
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
usersDb.find(_criteriaFromBuilder).then(_users=> {
|
||||
console.log("\n----------------\nTEST ADVANCED 1\n-------------------\n ");
|
||||
_users.forEach(_user=> {
|
||||
console.log(_user.userId + " " + _user.username);
|
||||
|
||||
if (_user.info !== undefined) {
|
||||
console.log(' from ' + _user.info.hometown);
|
||||
//console.dir(_user.userInfos);
|
||||
}
|
||||
|
||||
if (_user.myComments !== undefined) {
|
||||
_user.myComments.forEach(_comment=> {
|
||||
console.log(_comment.commentId + " " + _comment.content);
|
||||
|
||||
if (_comment.likes !== undefined) {
|
||||
console.log(' with ' + _comment.likes.length + ' likes!');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
server.on('uncaughtException', function(err:any) {
|
||||
console.log(err);
|
||||
})
|
||||
|
||||
var httpPort = 1193;//config.get('Server.port') || 1193;
|
||||
server.listen(httpPort, function() {
|
||||
console.log("Server is running on " + httpPort);
|
||||
});
|
||||
|
||||
+558
-62
@@ -1,5 +1,5 @@
|
||||
// Type definitions for node-mysql-wrapper
|
||||
// Project: https://github.com/kataras/node-mysql-wrapper
|
||||
// Project: https://github.com/nodets/node-mysql-wrapper
|
||||
// Definitions by: Makis Maropoulos <https://github.com/kataras>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
@@ -12,120 +12,616 @@ declare module "node-mysql-wrapper" {
|
||||
import {EventEmitter} from 'events';
|
||||
|
||||
var EQUAL_TO_PROPERTY_SYMBOL: string;
|
||||
var TABLE_RULES_PROPERTY: string;
|
||||
|
||||
type DeleteAnswer = {
|
||||
affectedRows: number;
|
||||
table: string;
|
||||
};
|
||||
|
||||
type RawRules = {
|
||||
table: string,
|
||||
begin: string,
|
||||
orderBy: string,
|
||||
orderByDesc: string,
|
||||
groupBy: string,
|
||||
limit: number, // limit = limitStart =0 and limitEnd = limit.
|
||||
limitStart: number,
|
||||
limitEnd: number,
|
||||
end: string
|
||||
|
||||
};
|
||||
|
||||
type TableToSearchPart = { tableName: string, propertyName: string };
|
||||
|
||||
interface Map<T> {
|
||||
[index: string]: T;
|
||||
}
|
||||
|
||||
class MysqlUtil {
|
||||
interface IQuery<T> {
|
||||
_table: Table<T>;
|
||||
execute(rawCriteria: any, callback?: (_results: any) => any): Promise<any>;
|
||||
}
|
||||
|
||||
interface IQueryConstructor<T> {
|
||||
new (_table: Table<T>): IQuery<T>;
|
||||
}
|
||||
|
||||
|
||||
class Helper {
|
||||
/**
|
||||
* Callback like forEach
|
||||
* @name valueCallback
|
||||
* @function
|
||||
* @param {T} the value of the object's key
|
||||
* @returnTye {U}
|
||||
* @return {U}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Callback like forEach
|
||||
* @name keyCallback
|
||||
* @function
|
||||
* @param {string} the name of the object's key
|
||||
* @returnTye {U}
|
||||
* @return {U}
|
||||
*/
|
||||
|
||||
constructor();
|
||||
|
||||
/**
|
||||
* Create and return a copy of an object.
|
||||
* @param {T} object the object you want to copy.
|
||||
* @returnType {T}
|
||||
* @return {T}
|
||||
*/
|
||||
static copyObject<T>(object: T): T;
|
||||
|
||||
/**
|
||||
* Converts any_string to anyString and returns it.
|
||||
* @param {string} columnKey the string you want to convert.
|
||||
* @returnType {string}
|
||||
* @return {string}
|
||||
*/
|
||||
static toObjectProperty(columnKey: string): string;
|
||||
|
||||
/**
|
||||
* Converts anyString to any_string and returns it.
|
||||
* @param {string} objectKey the string you want to convert.
|
||||
* @returnType {string}
|
||||
* @return {string}
|
||||
*/
|
||||
static toRowProperty(objectKey: string): string;
|
||||
|
||||
/**
|
||||
* Iterate object's keys and return their values to the callback.
|
||||
* @param {Map<T>} map the object.
|
||||
* @param {valueCallback}
|
||||
* @returnType {U}
|
||||
* @return {U}
|
||||
*/
|
||||
static forEachValue<T, U>(map: Map<T>, callback: (value: T) => U): U;
|
||||
|
||||
/**
|
||||
* Iterate object's keys and return their names to the callback.
|
||||
* @param {Map<T>} map the object.
|
||||
* @param {keyCallback}
|
||||
* @returnType {U}
|
||||
* @return {U}
|
||||
*/
|
||||
|
||||
static forEachKey<T, U>(map: Map<T>, callback: (key: string) => U): U;
|
||||
|
||||
/**
|
||||
* Checks if anything is a function.
|
||||
* @param {functionToCheck} the object or function to pass
|
||||
* @return boolean
|
||||
*/
|
||||
static isFunction(functionToCheck: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks if an object has 'tableRules' property.
|
||||
* @param {obj} the object to pass
|
||||
* @return boolean
|
||||
*/
|
||||
static hasRules(obj: any): boolean;
|
||||
}
|
||||
|
||||
interface ICriteria {
|
||||
|
||||
interface ICriteriaParts {
|
||||
rawCriteriaObject: any;
|
||||
tables: string[];
|
||||
tables: TableToSearchPart[];
|
||||
noDatabaseProperties: string[];
|
||||
whereClause: string;
|
||||
|
||||
selectFromClause<T>(_table: Table<T>): string;
|
||||
|
||||
}
|
||||
|
||||
class Criteria implements ICriteria {
|
||||
|
||||
|
||||
|
||||
class CriteriaParts implements ICriteriaParts {
|
||||
|
||||
/**
|
||||
* The raw format of the criteria eg: {yearsOld:22}.
|
||||
*/
|
||||
rawCriteriaObject: any;
|
||||
tables: string[];
|
||||
|
||||
/**
|
||||
* Which tables to search after the find method of the proto table finish.
|
||||
*/
|
||||
tables: TableToSearchPart[];
|
||||
|
||||
/**
|
||||
* The properties of the criteria which don't belong to the database's table.
|
||||
*/
|
||||
noDatabaseProperties: string[];
|
||||
|
||||
/**
|
||||
* The converted/exported where clause.
|
||||
*/
|
||||
whereClause: string;
|
||||
constructor(rawCriteriaObject: any, tables: string[], noDatabaseProperties: string[], whereClause: string);
|
||||
|
||||
constructor(rawCriteriaObject: any, tables: TableToSearchPart[], noDatabaseProperties: string[], whereClause: string);
|
||||
|
||||
selectFromClause<T>(_table: Table<T>): string;
|
||||
}
|
||||
|
||||
class CriteriaBuilder<T> {
|
||||
|
||||
class CriteriaDivider<T> {
|
||||
private _table;
|
||||
constructor(table: MysqlTable<T>);
|
||||
build(rawCriteriaObject: any): Criteria;
|
||||
constructor(table: Table<T>);
|
||||
|
||||
/**
|
||||
* Builds the criteria raw object to Criteria object.
|
||||
* @param {any} rawCriteriaObject the criteria at raw format you pass eg: {yearsOld:18}.
|
||||
* @returnType {Criteria}
|
||||
* @return {Criteria}
|
||||
*/
|
||||
build(rawCriteriaObject: any): CriteriaParts;
|
||||
}
|
||||
|
||||
class SelectQueryRules {
|
||||
private lastPropertyClauseName: string;
|
||||
manuallyEndClause: string;
|
||||
manuallyBeginClause: string;
|
||||
exceptColumns: string[];
|
||||
orderByColumn: string;
|
||||
orderByDescColumn: string;
|
||||
groupByColumn: string;
|
||||
limitStart: number;
|
||||
limitEnd: number;
|
||||
public tableName: string; //auto den benei oute sto last, oute sto from.
|
||||
static build(): SelectQueryRules;
|
||||
private last(propertyClauseName);
|
||||
except(...columns: string[]): SelectQueryRules;
|
||||
|
||||
/**
|
||||
* Same as .except(...columns)
|
||||
*/
|
||||
exclude(...columns: string[]): SelectQueryRules;
|
||||
|
||||
orderBy(columnKey: string, descending?: boolean): SelectQueryRules;
|
||||
groupBy(columnKey: string): SelectQueryRules;
|
||||
limit(limitRowsOrStart: number, limitEnd?: number): SelectQueryRules;
|
||||
appendToBegin(manualAfterWhereString: string): SelectQueryRules;
|
||||
appendToEnd(manualAfterWhereString: string): SelectQueryRules;
|
||||
append(appendToCurrent: string): SelectQueryRules;
|
||||
clearOrderBy(): SelectQueryRules;
|
||||
clearGroupBy(): SelectQueryRules;
|
||||
clearLimit(): SelectQueryRules;
|
||||
clearEndClause(): SelectQueryRules;
|
||||
clearBeginClause(): SelectQueryRules;
|
||||
clear(): SelectQueryRules;
|
||||
from(parentRule: SelectQueryRules): SelectQueryRules;
|
||||
isEmpty(): boolean;
|
||||
toString(): string;
|
||||
toRawObject(): RawRules;
|
||||
static toString(rules: SelectQueryRules): string;
|
||||
static toRawObject(rules: SelectQueryRules): RawRules;
|
||||
static fromRawObject(obj: RawRules): SelectQueryRules;
|
||||
}
|
||||
|
||||
class CriteriaBuilder<T>{
|
||||
|
||||
private rawCriteria: any;
|
||||
private primaryTable: Table<T>;
|
||||
private parentBuilder: CriteriaBuilder<any>;
|
||||
|
||||
constructor(primaryTable: Table<T>); //to arxiko apo to Table.ts 9a benei
|
||||
constructor(primaryTable: Table<T>, tableName: string, parentBuilder: CriteriaBuilder<any>);// auta 9a benoun apo to parent select query.
|
||||
constructor(primaryTable: Table<T>, tablePropertyName?: string, parentBuilder?: CriteriaBuilder<any>);
|
||||
|
||||
except(...columns: string[]): CriteriaBuilder<T>;
|
||||
|
||||
/**
|
||||
* Same as .except(...columns)
|
||||
*/
|
||||
exclude(...columns: string[]): CriteriaBuilder<T>;
|
||||
|
||||
where(key: string, value: any): CriteriaBuilder<T>;
|
||||
|
||||
private createRulesIfNotExists(): void;
|
||||
|
||||
orderBy(column: string, desceding?: boolean): CriteriaBuilder<T>;
|
||||
|
||||
limit(start: number, end?: number): CriteriaBuilder<T>;
|
||||
|
||||
join(realTableName: string, foreignColumnName: string): CriteriaBuilder<T>;
|
||||
|
||||
joinAs(tableNameProperty: string, realTableName: string, foreignColumnName: string): CriteriaBuilder<T>;
|
||||
|
||||
at(tableNameProperty: string): CriteriaBuilder<T>;
|
||||
|
||||
parent(): CriteriaBuilder<T>;
|
||||
|
||||
original(): CriteriaBuilder<T>;
|
||||
|
||||
/**
|
||||
* Auto kanei kuklous mexri na paei sto primary table kai ekei na epistrepsei to sunoliko raw criteria gia execute i kati allo.
|
||||
*/
|
||||
build(): any;
|
||||
|
||||
static from<T>(table: Table<T>): CriteriaBuilder<T>
|
||||
|
||||
}
|
||||
|
||||
class SelectQuery<T> implements IQuery<T> { // T for Table's result type.
|
||||
|
||||
_table: Table<T>
|
||||
constructor(_table: Table<T>);
|
||||
|
||||
private parseQueryResult(result: any, criteria: ICriteriaParts): Promise<any>;
|
||||
|
||||
/**
|
||||
* Executes the select and returns the Promise.
|
||||
*/
|
||||
promise(rawCriteria: any, callback?: (_results: T[]) => any): Promise<T[]>;
|
||||
|
||||
/**
|
||||
* Exactly the same thing as promise().
|
||||
* Executes the select and returns the Promise.
|
||||
*/
|
||||
execute(rawCriteria: any, callback?: (_results: T[]) => any): Promise<T[]>;
|
||||
}
|
||||
|
||||
class SaveQuery<T> implements IQuery<T> {
|
||||
|
||||
_table: Table<T>
|
||||
constructor(_table: Table<T>);
|
||||
|
||||
execute(criteriaRawJsObject: any, callback?: (_result: T | any) => any): Promise<T | any>;
|
||||
}
|
||||
|
||||
class DeleteQuery<T> implements IQuery<T>{
|
||||
|
||||
_table: Table<T>
|
||||
constructor(_table: Table<T>);
|
||||
|
||||
execute(criteriaOrID: any | number | string, callback?: (_result: DeleteAnswer) => any): Promise<DeleteAnswer>;
|
||||
}
|
||||
|
||||
|
||||
class MysqlConnection extends EventEmitter {
|
||||
|
||||
class Connection extends EventEmitter {
|
||||
|
||||
/**
|
||||
* The real database connection socket.
|
||||
*/
|
||||
connection: Mysql.IConnection;
|
||||
|
||||
/**
|
||||
* Collection of the supported event types for the tables.
|
||||
*/
|
||||
eventTypes: string[];
|
||||
|
||||
/**
|
||||
* Force to fetch ONLY these Database table names {array of string}.
|
||||
*/
|
||||
tableNamesToUseOnly: any[];
|
||||
tables: MysqlTable<any>[];
|
||||
|
||||
/**
|
||||
* All tables {MysqlTable} inside this connection's database.
|
||||
*/
|
||||
tables: Table<any>[];
|
||||
|
||||
constructor(connection: string | Mysql.IConnection);
|
||||
|
||||
/**
|
||||
* Creates the MysqlConnection from the connection url or the real connection object.
|
||||
* @param {string | Mysql.IConnection} connection the connection url or the real connection object.
|
||||
* @returnType {nothing}
|
||||
* @return {nothing}
|
||||
*/
|
||||
create(connection: string | Mysql.IConnection): void;
|
||||
|
||||
/**
|
||||
* Attach a real connection.
|
||||
* @param {Mysql.IConnection} connection the real connection object.
|
||||
* @returnType {nothing}
|
||||
* @return {nothing}
|
||||
*/
|
||||
attach(connection: Mysql.IConnection): void;
|
||||
|
||||
/**
|
||||
* Close the entire real connection and remove all event's listeners (if exist).
|
||||
* @param {function} callback If error occurs when closing the connection, this callback has the responsibility to catch it.
|
||||
* @returnType {nothing}
|
||||
* @return {nothing}
|
||||
*/
|
||||
end(callback?: (error: any) => void): void;
|
||||
|
||||
/**
|
||||
* Close the entire real connection and remove all event's listeners (if exist).
|
||||
* the difference from the 'end' is that this method doesn't care about errors so no callback passing here.
|
||||
*/
|
||||
destroy(): void;
|
||||
|
||||
/**
|
||||
* Link the real connection with this MysqlConnection object.
|
||||
* @param {function} readyCallback when the link operation is done this callback is executed.
|
||||
* @returnType {Promise}
|
||||
* @return {Promise}
|
||||
*/
|
||||
link(readyCallback?: () => void): Promise<void>;
|
||||
|
||||
/**
|
||||
* Force to use/fetch information from only certain of database's tables, otherwise all database's tables information will be fetched.
|
||||
* @param {Array} tables the array of the tables {string}
|
||||
* @returnType {nothing}
|
||||
* @return {nothing}
|
||||
*/
|
||||
useOnly(...tables: any[]): void;
|
||||
|
||||
/**
|
||||
* This method has the resposibility of fetching the correct tables from the database ( table = columns' names, primary key name).
|
||||
* @returnType {Promise}
|
||||
* @return {Promise}
|
||||
*/
|
||||
fetchDatabaseInfornation(): Promise<void>;
|
||||
|
||||
/**
|
||||
* Escape the query column's value and return it.
|
||||
* @param {string} val the value which will be escaped.
|
||||
* @returnType {string}
|
||||
* @return {string}
|
||||
*/
|
||||
escape(val: string): string;
|
||||
|
||||
/**
|
||||
* Call when must notify the Database events, SAVE(INSERT,UPDATE), REMOVE(DELETE).
|
||||
* @param {string} tableWhichCalled the table name which event is coming from.
|
||||
* @param {string} queryStr the full parsed query string which used to determinate the type of event to notify.
|
||||
* @param {any[]} parsedResults the parsed results (results after a method parse/edit/export them as objects), these are passing to the watch listener(s).
|
||||
* @returnType {nothing}
|
||||
* @return {nothing}
|
||||
*/
|
||||
notice(tableWhichCalled: string, queryStr: string, parsedResults: any[]): void;
|
||||
|
||||
/**
|
||||
* Adds an event listener/watcher on a table for a 'database event'.
|
||||
* @param {string} tableName the table name which you want to add the event listener.
|
||||
* @param {string or string[]} evtType the event(s) type you want to watch, one of these(string) or an array of them(string[]): ["INSERT", "UPDATE", "REMOVE", "SAVE"].
|
||||
* @param {function} callback Callback which has one parameter(typeof any[]) which filled by the parsedResults (results after query executed and exports to object(s)).
|
||||
* @returnType {nothing}
|
||||
* @return {nothing}
|
||||
*/
|
||||
watch(tableName: string, evtType: any, callback: (parsedResults: any[]) => void): void;
|
||||
|
||||
/**
|
||||
* Removes an event listener/watcher from a table for a specific event type.
|
||||
* @param {string} tableName the table name which you want to remove the event listener.
|
||||
* @param {string} evtType the Event type you want to remove, one of these: "INSERT", "UPDATE", "REMOVE", "SAVE".
|
||||
* @param {function} callbackToRemove the callback that you were used for watch this event type.
|
||||
* @returnType {nothing}
|
||||
* @return {nothing}
|
||||
*/
|
||||
unwatch(tableName: string, evtType: string, callbackToRemove: (parsedResults: any[]) => void): void;
|
||||
|
||||
/**
|
||||
* Executes a database query.
|
||||
* @param {string} queryStr the query text/string to be executed.
|
||||
* @param {function} callback the function will be called and fill the one and only parameter when an errors occurs.
|
||||
* @param {any[]} queryArguments (optional) the query arguments you want to pass into query. ['arg1','arg2']...
|
||||
* @returnType {nothing}
|
||||
* @return {nothing}
|
||||
*/
|
||||
query(queryStr: string, callback: (err: Mysql.IError, results: any) => any, queryArguments?: any[]): void;
|
||||
table<T>(tableName: string): MysqlTable<T>;
|
||||
}
|
||||
|
||||
class MysqlTable<T> {
|
||||
private _name;
|
||||
private _connection;
|
||||
private _columns;
|
||||
private _primaryKey;
|
||||
private _criteriaBuilder;
|
||||
constructor(tableName: string, connection: MysqlConnection);
|
||||
columns: string[];
|
||||
primaryKey: string;
|
||||
connection: MysqlConnection;
|
||||
name: string;
|
||||
on(evtType: string, callback: (parsedResults: any[]) => void): void;
|
||||
off(evtType: string, callbackToRemove: (parsedResults: any[]) => void): void;
|
||||
has(extendedFunctionName: string): boolean;
|
||||
extend(functionName: string, theFunction: (...args: any[]) => any): void;
|
||||
objectFromRow(row: any): any;
|
||||
rowFromObject(obj: any): any;
|
||||
getRowAsArray(jsObject: any): Array<any>;
|
||||
getPrimaryKeyValue(jsObject: any): number | string;
|
||||
parseQueryResult(result: any, criteria: ICriteria): Promise<any>;
|
||||
find(criteriaRawJsObject: any, callback?: (_results: T[]) => any): Promise<T[]>;
|
||||
findById(id: number | string, callback?: (result: T) => any): Promise<T>;
|
||||
findAll(callback?: (_results: T[]) => any): Promise<T[]>;
|
||||
save(criteriaRawJsObject: any, callback?: (_result: any) => any): Promise<any>;
|
||||
safeRemove(id: number | string, callback?: (_result: {
|
||||
affectedRows: number;
|
||||
table: string;
|
||||
}) => any): Promise<{
|
||||
affectedRows: number;
|
||||
table: string;
|
||||
}>;
|
||||
remove(criteriaRawJsObject: any, callback?: (_result: {
|
||||
affectedRows: number;
|
||||
table: string;
|
||||
}) => any): Promise<{
|
||||
affectedRows: number;
|
||||
table: string;
|
||||
}>;
|
||||
|
||||
/**
|
||||
* Returns a MysqlTable object from the database factory. (Note: this method doesn't create anything, just finds and returns the correct table, you don't have to create anything at all. Tables are fetched by the library itself.)
|
||||
* If you are using typescript you can pass a class (generic<T>) in order to use the auto completion assistance on table's results methods(find,findById,findAll,save,remove,safeRemove).
|
||||
* @param {string} tableName the table name which you want to get, on the form of: 'anyDatabaseTable' OR 'any_database_table' (possible your real table name into your database).
|
||||
* @returnType {MysqlTable}
|
||||
* @return {MysqlTable}
|
||||
*/
|
||||
table<T>(tableName: string): Table<T>;
|
||||
}
|
||||
|
||||
class MysqlWrapper {
|
||||
connection: MysqlConnection;
|
||||
class Table<T> {
|
||||
private _name: string;
|
||||
private _connection: Connection;
|
||||
private _columns: string[];
|
||||
private _primaryKey: string;
|
||||
private _criteriaDivider: CriteriaDivider<T>;
|
||||
private _rules: SelectQueryRules;
|
||||
private _selectQuery: SelectQuery<T>
|
||||
private _saveQuery: SaveQuery<T>;
|
||||
private _deleteQuery: DeleteQuery<T>;
|
||||
constructor(tableName: string, connection: Connection);
|
||||
|
||||
/**
|
||||
* An array of all columns' names inside this table.
|
||||
*/
|
||||
columns: string[];
|
||||
|
||||
/**
|
||||
* The name of the primary key column which this table is using.
|
||||
*/
|
||||
primaryKey: string;
|
||||
|
||||
/**
|
||||
* The MysqlConnection object which this MysqlTable belongs.
|
||||
*/
|
||||
connection: Connection;
|
||||
|
||||
/**
|
||||
* The real database name of the table. Autofilled by library.
|
||||
*/
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* Set of the query rules that will be applied after the 'where clause' on each select query executed by this table.
|
||||
* @return {SelectQueryRules}
|
||||
*/
|
||||
rules: SelectQueryRules;
|
||||
|
||||
/**
|
||||
* Returns this table's criteria divider class.
|
||||
* @return {CriteriaDivider}
|
||||
*/
|
||||
criteriaDivider: CriteriaDivider<T>;
|
||||
|
||||
/**
|
||||
* Returns new Criteria Builder each time.
|
||||
* Helps you to make criteria raw js objects ready to use in find,remove and save methods.
|
||||
* @return {CriteriaBuilder}
|
||||
*/
|
||||
criteria: CriteriaBuilder<T>;
|
||||
|
||||
/**
|
||||
* Adds or turn on an event listener/watcher on a table for a 'database event'.
|
||||
* @param {string} evtType the event type you want to watch, one of these: ["INSERT", "UPDATE", "REMOVE", "SAVE"].
|
||||
* @param {function} callback Callback which has one parameter(typeof any[]) which filled by the parsedResults (results after query executed and exports to object(s)).
|
||||
* @returnType {nothing}
|
||||
* @return {nothing}
|
||||
*/
|
||||
on(evtType: string, callback: (parsedResults: any[]) => void): void;
|
||||
|
||||
/**
|
||||
* Removes or turn off an event listener/watcher from a table for a specific event type.
|
||||
* @param {string} evtType the Event type you want to remove, one of these: "INSERT", "UPDATE", "REMOVE", "SAVE".
|
||||
* @param {function} callbackToRemove the callback that you were used for watch this event type.
|
||||
* @returnType {nothing}
|
||||
* @return {nothing}
|
||||
*/
|
||||
off(evtType: string, callbackToRemove: (parsedResults: any[]) => void): void;
|
||||
|
||||
/**
|
||||
* Use it when you want to check if extended function is exists here.
|
||||
* @param {string} extendedFunctionName the name of the function you want to check.
|
||||
* @returnType {boolean}
|
||||
* @return {boolean}
|
||||
*/
|
||||
has(extendedFunctionName: string): boolean;
|
||||
|
||||
/**
|
||||
* Extends this table's capabilities with a function.
|
||||
* @param {string} functionName the function name you want to use, this is used when you want to call this function later.
|
||||
* @param {function} theFunction the function with any optional parameters you want to pass along.
|
||||
* @returnType {nothing}
|
||||
* @return {nothing}
|
||||
*/
|
||||
extend(functionName: string, theFunction: (...args: any[]) => any): void;
|
||||
|
||||
/**
|
||||
* Converts and returns an object from this form: { a_property:'dsda', other_property:something, any_property_name:true } to { aProperty:..., otherProperty...,anyPropertyName...}
|
||||
* @param {any} row the raw row object.
|
||||
* @returnType {any}
|
||||
* @return {any}
|
||||
*/
|
||||
objectFromRow(row: any): any;
|
||||
|
||||
/**
|
||||
* Converts and returns an object from this form: { aProperty:'dsda', otherProperty:something, anyPropertyName:true } to { a_property:..., other_property...,any_property_name...}
|
||||
* @param {any} row the raw row object.
|
||||
* @returnType {any}
|
||||
* @return {any}
|
||||
*/
|
||||
rowFromObject(obj: any): any;
|
||||
|
||||
/**
|
||||
* Returns and array of [columns[],values[]]
|
||||
* @param {any} jsObject the raw row object.
|
||||
* @returnType {array}
|
||||
* @return {array}
|
||||
*/
|
||||
getRowAsArray(jsObject: any): Array<any>;
|
||||
|
||||
/**
|
||||
* Returns the primary key's value from an object.
|
||||
* @param {any} jsObject the object which you want to find and return the value of the primary key.
|
||||
* @returnType {number | string}
|
||||
* @return {number | string}
|
||||
*/
|
||||
getPrimaryKeyValue(jsObject: any): number | string;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
find(criteriaRawJsObject: any): Promise<T[]>; // only criteria
|
||||
find(criteriaRawJsObject: any, callback: ((_results: T[]) => any)): Promise<T[]>; // criteria and callback
|
||||
find(criteriaRawJsObject: any, callback?: (_results: T[]) => any): Promise<T[]>;
|
||||
|
||||
findSingle(criteriaRawJsObject: any, callback?: (_result: T) => any): Promise<T>;
|
||||
|
||||
findById(id: number|string): Promise<T>; // without callback
|
||||
findById(id: number | string, callback?: (result: T) => any): Promise<T>;
|
||||
|
||||
findAll(): Promise<T[]>; // only criteria and promise
|
||||
findAll(tableRules: RawRules): Promise<T[]> // only rules and promise
|
||||
findAll(tableRules?: RawRules, callback?: (_results: T[]) => any): Promise<T[]>;
|
||||
|
||||
|
||||
save(criteriaRawJsObject: any): Promise<any>; //without callback
|
||||
save(criteriaRawJsObject: any, callback?: (_result: any) => any): Promise<any>;
|
||||
|
||||
remove(id: number | string): Promise<DeleteAnswer>; // ID without callback
|
||||
remove(criteriaRawObject: any): Promise<DeleteAnswer>; // criteria obj without callback
|
||||
remove(criteriaOrID: any | number | string, callback?: (_result: DeleteAnswer) => any): Promise<DeleteAnswer>;
|
||||
|
||||
}
|
||||
|
||||
class Wrapper {
|
||||
connection: Connection;
|
||||
readyListenerCallbacks: Function[];
|
||||
constructor(connection?: MysqlConnection);
|
||||
constructor(connection?: Connection);
|
||||
static when(..._promises: Promise<any>[]): Promise<any>;
|
||||
setConnection(connection: MysqlConnection): void;
|
||||
setConnection(connection: Connection): void;
|
||||
|
||||
/**
|
||||
* Force to use/fetch information from only certain of database's tables, otherwise all database's tables information will be fetched.
|
||||
* @param {Array} tables the array of the tables {string}
|
||||
* @returnType {nothing}
|
||||
* @return {nothing}
|
||||
*/
|
||||
useOnly(...useTables: any[]): void;
|
||||
|
||||
has(tableName: string, functionName?: string): boolean;
|
||||
ready(callback: () => void): void;
|
||||
table<T>(tableName: string): MysqlTable<T>;
|
||||
table<T>(tableName: string): Table<T>;
|
||||
noticeReady(): void;
|
||||
removeReadyListener(callback: () => void): void;
|
||||
query(queryStr: string, callback: (err: Mysql.IError, results: any) => any, queryArguments?: any[]): void;
|
||||
|
||||
/**
|
||||
* Close the entire real connection and remove all event's listeners (if exist).
|
||||
* the difference from the 'end' is that this method doesn't care about errors so no callback passing here.
|
||||
*/
|
||||
destroy(): void;
|
||||
|
||||
/**
|
||||
* Close the entire real connection and remove all event's listeners (if exist).
|
||||
* @param {function} maybeAcallbackError If error occurs when closing the connection, this callback has the responsibility to catch it.
|
||||
* @returnType {nothing}
|
||||
* @return {nothing}
|
||||
*/
|
||||
end(maybeAcallbackError: (err: any) => void): void;
|
||||
|
||||
newTableRules(tableName: string): SelectQueryRules;
|
||||
|
||||
buildRules(): SelectQueryRules;
|
||||
buildRules(parentRules?: SelectQueryRules): SelectQueryRules;
|
||||
}
|
||||
|
||||
function wrap(mysqlUrlOrObjectOrMysqlAlreadyConnection: Mysql.IConnection | string, ...useTables: any[]): MysqlWrapper;
|
||||
|
||||
function wrap(mysqlUrlOrObjectOrMysqlAlreadyConnection: Mysql.IConnection | string, ...useTables: any[]): Wrapper;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
/// <reference path="./node-polyglot.d.ts" />
|
||||
|
||||
import Polyglot = require("node-polyglot");
|
||||
|
||||
function instantiatePolyglot(): void {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user