mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-12-04 04:01:52 +00:00
Merge remote-tracking branch 'refs/remotes/DefinitelyTyped/master'
This commit is contained in:
Vendored
+1
-1
@@ -3,7 +3,7 @@
|
||||
// Definitions by: Qubo <https://github.com/tkQubo>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../bluebird/bluebird.d.ts" />
|
||||
/// <reference path="../bluebird/bluebird-2.0.d.ts" />
|
||||
/// <reference path='../node/node.d.ts'/>
|
||||
|
||||
/// <reference path='../redis/redis.d.ts'/>
|
||||
|
||||
+1
-1
@@ -476,7 +476,7 @@ declare namespace angular {
|
||||
// Supplement IComponentOptions from angular.d.ts with router-specific
|
||||
// fields.
|
||||
interface IComponentOptions {
|
||||
$canActivate?: () => boolean;
|
||||
$canActivate?: (...args: any[]) => boolean | angular.IPromise<boolean>;
|
||||
$routeConfig?: RouteDefinition[];
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -1825,7 +1825,7 @@ declare namespace angular {
|
||||
bindToController?: boolean | Object;
|
||||
link?: IDirectiveLinkFn | IDirectivePrePost;
|
||||
multiElement?: boolean;
|
||||
name?: string;
|
||||
directiveName?: string;
|
||||
priority?: number;
|
||||
/**
|
||||
* @deprecated
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@
|
||||
// Definitions by: Gorgi Kosev <https://github.com/spion>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../bluebird/bluebird.d.ts" />
|
||||
/// <reference path="../bluebird/bluebird-2.0.d.ts" />
|
||||
/// <reference path="../anydb-sql/anydb-sql.d.ts" />
|
||||
|
||||
declare module "anydb-sql-migrations" {
|
||||
@@ -31,4 +31,4 @@ declare module "anydb-sql-migrations" {
|
||||
items: MigrationTask[];
|
||||
}) => any) => Promise<any>;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -3,7 +3,7 @@
|
||||
// Definitions by: Qubo <https://github.com/tkqubo>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../bluebird/bluebird.d.ts" />
|
||||
/// <reference path="../bluebird/bluebird-2.0.d.ts" />
|
||||
/// <reference path="../request/request.d.ts" />
|
||||
|
||||
declare module "asana" {
|
||||
|
||||
Vendored
+1
@@ -21,6 +21,7 @@ interface Auth0Static {
|
||||
loginWithUsernamePassword(options: Auth0LoginOptions, callback: (error?: Auth0Error, profile?: Auth0UserProfile, id_token?: string, access_token?: string, state?: string) => any): void;
|
||||
logout(query: string): void;
|
||||
getConnections(callback?: Function): void;
|
||||
refreshToken(refreshToken: string, callback: (error?: Auth0Error, delegationResult?: Auth0DelegationToken) => any): void;
|
||||
getDelegationToken(targetClientId: string, id_token: string, options: any, callback: (error?: Auth0Error, delegationResult?: Auth0DelegationToken) => any): void;
|
||||
getProfile(id_token: string, callback?: Function): Auth0UserProfile;
|
||||
getSSOData(withActiveDirectories: any, callback?: Function): void;
|
||||
|
||||
Vendored
+74
@@ -0,0 +1,74 @@
|
||||
// Type definitions for base64url v2.0.0
|
||||
// Project: https://github.com/brianloveswords/base64url
|
||||
// Definitions by: Stepan Miroshin <https://github.com/microshine>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
/**
|
||||
* For encoding and decoding base64url!
|
||||
* v2.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Encoding type
|
||||
*/
|
||||
declare type Encoding = "ascii" | "utf8" | "utf16le" | "ucs2" | "utf16le" | "base64" | "binary" | "hex"
|
||||
|
||||
interface IBase64Url {
|
||||
/**
|
||||
* Encode input to base64url
|
||||
* @param {string} input Incoming input
|
||||
* @param {Encoding} encoding Default 'utf8'
|
||||
* @return {string}
|
||||
*/
|
||||
(input: string, encoding?: Encoding): string;
|
||||
/**
|
||||
* Encode input to base64url
|
||||
* @param {Buffer} input Incoming value
|
||||
*/
|
||||
(inout: Buffer): string;
|
||||
/**
|
||||
* Encode input to base64url
|
||||
*
|
||||
* @param {string} input Incoming input
|
||||
* @param {Encoding} encoding Default 'utf8'
|
||||
* @returns {string}
|
||||
*/
|
||||
encode(input: string, encoding?: Encoding): string;
|
||||
/**
|
||||
* Encode input to base64url
|
||||
* @param {Buffer} input Incoming value
|
||||
*/
|
||||
encode(input: Buffer): string;
|
||||
/**
|
||||
* Convert a base64url encoded string into a raw string.
|
||||
* @param {string} base64url base64url encoded string
|
||||
* @param {Encoding} encoding Encoding defaults to 'utf8'
|
||||
* @returns {string}
|
||||
*/
|
||||
decode(base64url: string, encoding?: string): string;
|
||||
/**
|
||||
* Convert a base64url encoded string to a base64 encoded string
|
||||
* @param {string | Buffer} base64url base64url encoded value
|
||||
* @returns {string}
|
||||
*/
|
||||
toBase64(base64url: string | Buffer): string;
|
||||
/**
|
||||
* Convert a base64 encoded string to a base64url encoded string
|
||||
* @param {string} base64 encoded string
|
||||
* @returns {string}
|
||||
*/
|
||||
fromBase64(base64: string): string;
|
||||
/**
|
||||
* Convert a base64url encoded string to a Buffer
|
||||
* @param {string} base64url encoded string
|
||||
* @returns {Buffer}
|
||||
*/
|
||||
toBuffer(base64url: string): Buffer;
|
||||
}
|
||||
|
||||
declare module "base64url" {
|
||||
const base64url: IBase64Url;
|
||||
export = base64url;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
/// <reference path="./base64url.d.ts" />
|
||||
|
||||
import * as base64url from "base64url";
|
||||
|
||||
// default
|
||||
let str = base64url("some value");
|
||||
str = base64url("some value", "hex");
|
||||
str = base64url(new Buffer("some value"));
|
||||
|
||||
// encode
|
||||
str = base64url.encode("some value");
|
||||
str = base64url.encode("some value", "hex");
|
||||
str = base64url.encode(new Buffer("some value"));
|
||||
|
||||
// decode
|
||||
str = base64url.decode("ADA=");
|
||||
str = base64url.decode("ADA=", "binary");
|
||||
|
||||
// toBase64
|
||||
str = base64url.toBase64("ADA=");
|
||||
str = base64url.toBase64(new Buffer("ADA=", "base64"));
|
||||
|
||||
// fromBase64
|
||||
str = base64url.fromBase64("ADA=");
|
||||
|
||||
let buf = base64url.toBase64("ADA=");
|
||||
@@ -1,5 +1,5 @@
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
/// <reference path="../bluebird/bluebird.d.ts" />
|
||||
/// <reference path="../bluebird/bluebird-2.0.d.ts" />
|
||||
/// <reference path="blue-tape.d.ts" />
|
||||
|
||||
import tape = require('blue-tape');
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/// <reference path="bluebird-retry.d.ts" />
|
||||
/// <reference path="../bluebird/bluebird.d.ts" />
|
||||
/// <reference path="../bluebird/bluebird-2.0.d.ts" />
|
||||
import Promise = require('bluebird');
|
||||
import retry = require('bluebird-retry');
|
||||
|
||||
@@ -32,4 +32,4 @@ var options:retry.Options = {
|
||||
interval: 500
|
||||
};
|
||||
|
||||
retry(logFail, options);
|
||||
retry(logFail, options);
|
||||
|
||||
Vendored
+1
-1
@@ -3,7 +3,7 @@
|
||||
// Definitions by: Pascal Vomhoff <https://github.com/pvomhoff>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../bluebird/bluebird.d.ts" />
|
||||
/// <reference path="../bluebird/bluebird-2.0.d.ts" />
|
||||
declare module "bluebird-retry" {
|
||||
import Promise = require('bluebird');
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Vendored
+773
@@ -0,0 +1,773 @@
|
||||
// Type definitions for bluebird 2.0.0
|
||||
// Project: https://github.com/petkaantonov/bluebird
|
||||
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>, falsandtru <https://github.com/falsandtru>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
// ES6 model with generics overload was sourced and trans-multiplied from es6-promises.d.ts
|
||||
// By: Campredon <https://github.com/fdecampredon/>
|
||||
|
||||
// Warning: recommended to use `tsc > v0.9.7` (critical bugs in earlier generic code):
|
||||
// - https://github.com/DefinitelyTyped/DefinitelyTyped/issues/1563
|
||||
|
||||
// Note: replicate changes to all overloads in both definition and test file
|
||||
// Note: keep both static and instance members inline (so similar)
|
||||
|
||||
// TODO fix remaining TODO annotations in both definition and test
|
||||
|
||||
// TODO verify support to have no return statement in handlers to get a Promise<void> (more overloads?)
|
||||
|
||||
declare var Promise: PromiseConstructor;
|
||||
|
||||
interface PromiseCancelHandlerSetter {
|
||||
(handler: () => void): void;
|
||||
}
|
||||
|
||||
interface PromiseConstructor {
|
||||
/**
|
||||
* Create a new promise. The passed in function will receive functions
|
||||
* `resolve` and `reject` as its arguments which can be called to seal the
|
||||
* fate of the created promise.
|
||||
*
|
||||
* If configured appropriately, it will also receive an `onCancel`
|
||||
* function that can be used to configure a promise cancellation handler.
|
||||
*/
|
||||
new <T>(callback: (
|
||||
resolve: (thenableOrResult?: T | PromiseLike<T>) => void,
|
||||
reject: (error: any) => void,
|
||||
onCancel?: PromiseCancelHandlerSetter
|
||||
) => void): Promise<T>;
|
||||
|
||||
config(options: {
|
||||
warnings?: boolean | {wForgottenReturn?: boolean};
|
||||
longStackTraces?: boolean;
|
||||
cancellation?: boolean;
|
||||
monitoring?: boolean;
|
||||
}): void;
|
||||
|
||||
// Ideally, we'd define e.g. "export class RangeError extends Error {}",
|
||||
// but as Error is defined as an interface (not a class), TypeScript doesn't
|
||||
// allow extending Error, only implementing it.
|
||||
// However, if we want to catch() only a specific error type, we need to pass
|
||||
// a constructor function to it. So, as a workaround, we define them here as such.
|
||||
RangeError(): RangeError;
|
||||
CancellationError(): Promise.CancellationError;
|
||||
TimeoutError(): Promise.TimeoutError;
|
||||
TypeError(): Promise.TypeError;
|
||||
RejectionError(): Promise.RejectionError;
|
||||
OperationalError(): Promise.OperationalError;
|
||||
|
||||
/**
|
||||
* Changes how bluebird schedules calls a-synchronously.
|
||||
*
|
||||
* @param scheduler Should be a function that asynchronously schedules
|
||||
* the calling of the passed in function
|
||||
*/
|
||||
setScheduler(scheduler: (callback: (...args: any[]) => void) => void): void;
|
||||
|
||||
/**
|
||||
* Start the chain of promises with `Promise.try`. Any synchronous exceptions will be turned into rejections on the returned promise.
|
||||
*
|
||||
* Note about second argument: if it's specifically a true array, its values become respective arguments for the function call. Otherwise it is passed as is as the first argument for the function call.
|
||||
*
|
||||
* Alias for `attempt();` for compatibility with earlier ECMAScript version.
|
||||
*/
|
||||
try<T>(fn: () => T | PromiseLike<T>, args?: any[], ctx?: any): Promise<T>;
|
||||
|
||||
attempt<T>(fn: () => T | PromiseLike<T>, args?: any[], ctx?: any): Promise<T>;
|
||||
|
||||
/**
|
||||
* Returns a new function that wraps the given function `fn`. The new function will always return a promise that is fulfilled with the original functions return values or rejected with thrown exceptions from the original function.
|
||||
* This method is convenient when a function can sometimes return synchronously or throw synchronously.
|
||||
*/
|
||||
method(fn: Function): Function;
|
||||
|
||||
/**
|
||||
* Create a promise that is resolved with the given `value`. If `value` is a thenable or promise, the returned promise will assume its state.
|
||||
*/
|
||||
resolve<T>(value: T | PromiseLike<T>): Promise<T>;
|
||||
resolve(): Promise<void>;
|
||||
|
||||
/**
|
||||
* Create a promise that is rejected with the given `reason`.
|
||||
*/
|
||||
reject(reason: any): Promise<any>;
|
||||
reject<T>(reason: any): Promise<T>;
|
||||
|
||||
/**
|
||||
* Create a promise with undecided fate and return a `PromiseResolver` to control it. See resolution?: Promise(#promise-resolution).
|
||||
*/
|
||||
defer<T>(): Promise.Resolver<T>;
|
||||
|
||||
/**
|
||||
* Cast the given `value` to a trusted promise. If `value` is already a trusted `Promise`, it is returned as is. If `value` is not a thenable, a fulfilled is: Promise returned with `value` as its fulfillment value. If `value` is a thenable (Promise-like object, like those returned by jQuery's `$.ajax`), returns a trusted that: Promise assimilates the state of the thenable.
|
||||
*/
|
||||
cast<T>(value: T | PromiseLike<T>): Promise<T>;
|
||||
|
||||
/**
|
||||
* Sugar for `Promise.resolve(undefined).bind(thisArg);`. See `.bind()`.
|
||||
*/
|
||||
bind(thisArg: any): Promise<void>;
|
||||
|
||||
/**
|
||||
* See if `value` is a trusted Promise.
|
||||
*/
|
||||
is(value: any): boolean;
|
||||
|
||||
/**
|
||||
* Call this right after the library is loaded to enabled long stack traces. Long stack traces cannot be disabled after being enabled, and cannot be enabled after promises have alread been created. Long stack traces imply a substantial performance penalty, around 4-5x for throughput and 0.5x for latency.
|
||||
*/
|
||||
longStackTraces(): void;
|
||||
|
||||
/**
|
||||
* Returns a promise that will be fulfilled with `value` (or `undefined`) after given `ms` milliseconds. If `value` is a promise, the delay will start counting down when it is fulfilled and the returned promise will be fulfilled with the fulfillment value of the `value` promise.
|
||||
*/
|
||||
// TODO enable more overloads
|
||||
delay<T>(ms: number, value: T | PromiseLike<T>): Promise<T>;
|
||||
delay(ms: number): Promise<void>;
|
||||
|
||||
/**
|
||||
* Returns a function that will wrap the given `nodeFunction`. Instead of taking a callback, the returned function will return a promise whose fate is decided by the callback behavior of the given node function. The node function should conform to node.js convention of accepting a callback as last argument and calling that callback with error as the first argument and success value on the second argument.
|
||||
*
|
||||
* If the `nodeFunction` calls its callback with multiple success values, the fulfillment value will be an array of them.
|
||||
*
|
||||
* If you pass a `receiver`, the `nodeFunction` will be called as a method on the `receiver`.
|
||||
*/
|
||||
promisify<T>(func: (callback: (err: any, result: T) => void) => void, receiver?: any): () => Promise<T>;
|
||||
promisify<T, A1>(func: (arg1: A1, callback: (err: any, result: T) => void) => void, receiver?: any): (arg1: A1) => Promise<T>;
|
||||
promisify<T, A1, A2>(func: (arg1: A1, arg2: A2, callback: (err: any, result: T) => void) => void, receiver?: any): (arg1: A1, arg2: A2) => Promise<T>;
|
||||
promisify<T, A1, A2, A3>(func: (arg1: A1, arg2: A2, arg3: A3, callback: (err: any, result: T) => void) => void, receiver?: any): (arg1: A1, arg2: A2, arg3: A3) => Promise<T>;
|
||||
promisify<T, A1, A2, A3, A4>(func: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, callback: (err: any, result: T) => void) => void, receiver?: any): (arg1: A1, arg2: A2, arg3: A3, arg4: A4) => Promise<T>;
|
||||
promisify<T, A1, A2, A3, A4, A5>(func: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5, callback: (err: any, result: T) => void) => void, receiver?: any): (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5) => Promise<T>;
|
||||
promisify(nodeFunction: Function, receiver?: any): Function;
|
||||
|
||||
/**
|
||||
* Promisifies the entire object by going through the object's properties and creating an async equivalent of each function on the object and its prototype chain. The promisified method name will be the original method name postfixed with `Async`. Returns the input object.
|
||||
*
|
||||
* Note that the original methods on the object are not overwritten but new methods are created with the `Async`-postfix. For example, if you `promisifyAll()` the node.js `fs` object use `fs.statAsync()` to call the promisified `stat` method.
|
||||
*/
|
||||
// TODO how to model promisifyAll?
|
||||
promisifyAll(target: Object, options?: Promise.PromisifyAllOptions): any;
|
||||
|
||||
|
||||
/**
|
||||
* Returns a promise that is resolved by a node style callback function.
|
||||
*/
|
||||
fromNode(resolver: (callback: (err: any, result?: any) => void) => void, options? : {multiArgs? : boolean}): Promise<any>;
|
||||
fromCallback(resolver: (callback: (err: any, result?: any) => void) => void, options? : {multiArgs? : boolean}): Promise<any>;
|
||||
|
||||
/**
|
||||
* Returns a function that can use `yield` to run asynchronous code synchronously. This feature requires the support of generators which are drafted in the next version of the language. Node version greater than `0.11.2` is required and needs to be executed with the `--harmony-generators` (or `--harmony`) command-line switch.
|
||||
*/
|
||||
// TODO fix coroutine GeneratorFunction
|
||||
coroutine<T>(generatorFunction: Function): Function;
|
||||
|
||||
/**
|
||||
* Spawn a coroutine which may yield promises to run asynchronous code synchronously. This feature requires the support of generators which are drafted in the next version of the language. Node version greater than `0.11.2` is required and needs to be executed with the `--harmony-generators` (or `--harmony`) command-line switch.
|
||||
*/
|
||||
// TODO fix spawn GeneratorFunction
|
||||
spawn<T>(generatorFunction: Function): Promise<T>;
|
||||
|
||||
/**
|
||||
* This is relevant to browser environments with no module loader.
|
||||
*
|
||||
* Release control of the `Promise` namespace to whatever it was before this library was loaded. Returns a reference to the library namespace so you can attach it to something else.
|
||||
*/
|
||||
noConflict(): typeof Promise;
|
||||
|
||||
/**
|
||||
* Add `handler` as the handler to call when there is a possibly unhandled rejection. The default handler logs the error stack to stderr or `console.error` in browsers.
|
||||
*
|
||||
* Passing no value or a non-function will have the effect of removing any kind of handling for possibly unhandled rejections.
|
||||
*/
|
||||
onPossiblyUnhandledRejection(handler: (reason: any) => any): void;
|
||||
|
||||
/**
|
||||
* Given an array, or a promise of an array, which contains promises (or a mix of promises and values) return a promise that is fulfilled when all the items in the array are fulfilled. The promise's fulfillment value is an array with fulfillment values at respective positions to the original array. If any promise in the array rejects, the returned promise is rejected with the rejection reason.
|
||||
*/
|
||||
// TODO enable more overloads
|
||||
// promise of array with promises of value
|
||||
all<T>(values: PromiseLike<PromiseLike<T>[]>): Promise<T[]>;
|
||||
// promise of array with values
|
||||
all<T>(values: PromiseLike<T[]>): Promise<T[]>;
|
||||
// array with promises of value
|
||||
all<T>(values: PromiseLike<T>[]): Promise<T[]>;
|
||||
// array with promises of different types
|
||||
all<T1, T2, T3, T4, T5>(values: [PromiseLike<T1>, PromiseLike<T2>, PromiseLike<T3>, PromiseLike<T4>, PromiseLike<T5>]): Promise<[T1, T2, T3, T4, T5]>;
|
||||
all<T1, T2, T3, T4>(values: [PromiseLike<T1>, PromiseLike<T2>, PromiseLike<T3>, PromiseLike<T4>]): Promise<[T1, T2, T3, T4]>;
|
||||
all<T1, T2, T3>(values: [PromiseLike<T1>, PromiseLike<T2>, PromiseLike<T3>]): Promise<[T1, T2, T3]>;
|
||||
all<T1, T2>(values: [PromiseLike<T1>, PromiseLike<T2>]): Promise<[T1, T2]>;
|
||||
// array with values
|
||||
all<T>(values: T[]): Promise<T[]>;
|
||||
|
||||
/**
|
||||
* Like ``Promise.all`` but for object properties instead of array items. Returns a promise that is fulfilled when all the properties of the object are fulfilled. The promise's fulfillment value is an object with fulfillment values at respective keys to the original object. If any promise in the object rejects, the returned promise is rejected with the rejection reason.
|
||||
*
|
||||
* If `object` is a trusted `Promise`, then it will be treated as a promise for object rather than for its properties. All other objects are treated for their properties as is returned by `Object.keys` - the object's own enumerable properties.
|
||||
*
|
||||
* *The original object is not modified.*
|
||||
*/
|
||||
// TODO verify this is correct
|
||||
// trusted promise for object
|
||||
props(object: Promise<Object>): Promise<Object>;
|
||||
// object
|
||||
props(object: Object): Promise<Object>;
|
||||
|
||||
/**
|
||||
* Given an array, or a promise of an array, which contains promises (or a mix of promises and values) return a promise that is fulfilled when all the items in the array are either fulfilled or rejected. The fulfillment value is an array of ``PromiseInspection`` instances at respective positions in relation to the input array.
|
||||
*
|
||||
* *original: The array is not modified. The input array sparsity is retained in the resulting array.*
|
||||
*/
|
||||
// promise of array with promises of value
|
||||
settle<T>(values: PromiseLike<PromiseLike<T>[]>): Promise<Promise.Inspection<T>[]>;
|
||||
// promise of array with values
|
||||
settle<T>(values: PromiseLike<T[]>): Promise<Promise.Inspection<T>[]>;
|
||||
// array with promises of value
|
||||
settle<T>(values: PromiseLike<T>[]): Promise<Promise.Inspection<T>[]>;
|
||||
// array with values
|
||||
settle<T>(values: T[]): Promise<Promise.Inspection<T>[]>;
|
||||
|
||||
/**
|
||||
* Like `Promise.some()`, with 1 as `count`. However, if the promise fulfills, the fulfillment value is not an array of 1 but the value directly.
|
||||
*/
|
||||
// promise of array with promises of value
|
||||
any<T>(values: PromiseLike<PromiseLike<T>[]>): Promise<T>;
|
||||
// promise of array with values
|
||||
any<T>(values: PromiseLike<T[]>): Promise<T>;
|
||||
// array with promises of value
|
||||
any<T>(values: PromiseLike<T>[]): Promise<T>;
|
||||
// array with values
|
||||
any<T>(values: T[]): Promise<T>;
|
||||
|
||||
/**
|
||||
* Given an array, or a promise of an array, which contains promises (or a mix of promises and values) return a promise that is fulfilled or rejected as soon as a promise in the array is fulfilled or rejected with the respective rejection reason or fulfillment value.
|
||||
*
|
||||
* **Note** If you pass empty array or a sparse array with no values, or a promise/thenable for such, it will be forever pending.
|
||||
*/
|
||||
// promise of array with promises of value
|
||||
race<T>(values: PromiseLike<PromiseLike<T>[]>): Promise<T>;
|
||||
// promise of array with values
|
||||
race<T>(values: PromiseLike<T[]>): Promise<T>;
|
||||
// array with promises of value
|
||||
race<T>(values: PromiseLike<T>[]): Promise<T>;
|
||||
// array with values
|
||||
race<T>(values: T[]): Promise<T>;
|
||||
|
||||
/**
|
||||
* Initiate a competetive race between multiple promises or values (values will become immediately fulfilled promises). When `count` amount of promises have been fulfilled, the returned promise is fulfilled with an array that contains the fulfillment values of the winners in order of resolution.
|
||||
*
|
||||
* If too many promises are rejected so that the promise can never become fulfilled, it will be immediately rejected with an array of rejection reasons in the order they were thrown in.
|
||||
*
|
||||
* *The original array is not modified.*
|
||||
*/
|
||||
// promise of array with promises of value
|
||||
some<T>(values: PromiseLike<PromiseLike<T>[]>, count: number): Promise<T[]>;
|
||||
// promise of array with values
|
||||
some<T>(values: PromiseLike<T[]>, count: number): Promise<T[]>;
|
||||
// array with promises of value
|
||||
some<T>(values: PromiseLike<T>[], count: number): Promise<T[]>;
|
||||
// array with values
|
||||
some<T>(values: T[], count: number): Promise<T[]>;
|
||||
|
||||
/**
|
||||
* Like `Promise.all()` but instead of having to pass an array, the array is generated from the passed variadic arguments.
|
||||
*/
|
||||
// variadic array with promises of value
|
||||
join<T>(...values: PromiseLike<T>[]): Promise<T[]>;
|
||||
// variadic array with values
|
||||
join<T>(...values: T[]): Promise<T[]>;
|
||||
|
||||
/**
|
||||
* Map an array, or a promise of an array, which contains a promises (or a mix of promises and values) with the given `mapper` function with the signature `(item, index, arrayLength)` where `item` is the resolved value of a respective promise in the input array. If any promise in the input array is rejected the returned promise is rejected as well.
|
||||
*
|
||||
* If the `mapper` function returns promises or thenables, the returned promise will wait for all the mapped results to be resolved as well.
|
||||
*
|
||||
* *The original array is not modified.*
|
||||
*/
|
||||
// promise of array with promises of value
|
||||
map<T, U>(values: PromiseLike<PromiseLike<T>[]>, mapper: (item: T, index: number, arrayLength: number) => U | PromiseLike<U>, options?: Promise.ConcurrencyOption): Promise<U[]>;
|
||||
|
||||
// promise of array with values
|
||||
map<T, U>(values: PromiseLike<T[]>, mapper: (item: T, index: number, arrayLength: number) => U | PromiseLike<U>, options?: Promise.ConcurrencyOption): Promise<U[]>;
|
||||
|
||||
// array with promises of value
|
||||
map<T, U>(values: PromiseLike<T>[], mapper: (item: T, index: number, arrayLength: number) => U | PromiseLike<U>, options?: Promise.ConcurrencyOption): Promise<U[]>;
|
||||
|
||||
// array with values
|
||||
map<T, U>(values: T[], mapper: (item: T, index: number, arrayLength: number) => U | PromiseLike<U>, options?: Promise.ConcurrencyOption): Promise<U[]>;
|
||||
|
||||
/**
|
||||
* Similar to `map` with concurrency set to 1 but guaranteed to execute in sequential order
|
||||
*
|
||||
* If the `mapper` function returns promises or thenables, the returned promise will wait for all the mapped results to be resolved as well.
|
||||
*
|
||||
* *The original array is not modified.*
|
||||
*/
|
||||
// promise of array with promises of value
|
||||
mapSeries<R, U>(values: PromiseLike<PromiseLike<R>[]>, mapper: (item: R, index: number, arrayLength: number) => U | PromiseLike<U>): Promise<U[]>;
|
||||
|
||||
// promise of array with values
|
||||
mapSeries<R, U>(values: PromiseLike<R[]>, mapper: (item: R, index: number, arrayLength: number) => U | PromiseLike<U>): Promise<U[]>;
|
||||
|
||||
// array with promises of value
|
||||
mapSeries<R, U>(values: PromiseLike<R>[], mapper: (item: R, index: number, arrayLength: number) => U | PromiseLike<U>): Promise<U[]>;
|
||||
|
||||
// array with values
|
||||
mapSeries<R, U>(values: R[], mapper: (item: R, index: number, arrayLength: number) => U | PromiseLike<U>): Promise<U[]>;
|
||||
|
||||
|
||||
/**
|
||||
* Reduce an array, or a promise of an array, which contains a promises (or a mix of promises and values) with the given `reducer` function with the signature `(total, current, index, arrayLength)` where `item` is the resolved value of a respective promise in the input array. If any promise in the input array is rejected the returned promise is rejected as well.
|
||||
*
|
||||
* If the reducer function returns a promise or a thenable, the result for the promise is awaited for before continuing with next iteration.
|
||||
*
|
||||
* *The original array is not modified. If no `intialValue` is given and the array doesn't contain at least 2 items, the callback will not be called and `undefined` is returned. If `initialValue` is given and the array doesn't have at least 1 item, `initialValue` is returned.*
|
||||
*/
|
||||
// promise of array with promises of value
|
||||
reduce<T, U>(values: PromiseLike<PromiseLike<T>[]>, reducer: (total: U, current: T, index: number, arrayLength: number) => U | PromiseLike<U>, initialValue?: U): Promise<U>;
|
||||
|
||||
// promise of array with values
|
||||
reduce<T, U>(values: PromiseLike<T[]>, reducer: (total: U, current: T, index: number, arrayLength: number) => U | PromiseLike<U>, initialValue?: U): Promise<U>;
|
||||
|
||||
// array with promises of value
|
||||
reduce<T, U>(values: PromiseLike<T>[], reducer: (total: U, current: T, index: number, arrayLength: number) => U | PromiseLike<U>, initialValue?: U): Promise<U>;
|
||||
|
||||
// array with values
|
||||
reduce<T, U>(values: T[], reducer: (total: U, current: T, index: number, arrayLength: number) => U | PromiseLike<U>, initialValue?: U): Promise<U>;
|
||||
|
||||
/**
|
||||
* Filter an array, or a promise of an array, which contains a promises (or a mix of promises and values) with the given `filterer` function with the signature `(item, index, arrayLength)` where `item` is the resolved value of a respective promise in the input array. If any promise in the input array is rejected the returned promise is rejected as well.
|
||||
*
|
||||
* The return values from the filtered functions are coerced to booleans, with the exception of promises and thenables which are awaited for their eventual result.
|
||||
*
|
||||
* *The original array is not modified.
|
||||
*/
|
||||
// promise of array with promises of value
|
||||
filter<T>(values: PromiseLike<PromiseLike<T>[]>, filterer: (item: T, index: number, arrayLength: number) => boolean | PromiseLike<boolean>, option?: Promise.ConcurrencyOption): Promise<T[]>;
|
||||
|
||||
// promise of array with values
|
||||
filter<T>(values: PromiseLike<T[]>, filterer: (item: T, index: number, arrayLength: number) => boolean | PromiseLike<boolean>, option?: Promise.ConcurrencyOption): Promise<T[]>;
|
||||
|
||||
// array with promises of value
|
||||
filter<T>(values: PromiseLike<T>[], filterer: (item: T, index: number, arrayLength: number) => boolean | PromiseLike<boolean>, option?: Promise.ConcurrencyOption): Promise<T[]>;
|
||||
|
||||
// array with values
|
||||
filter<T>(values: T[], filterer: (item: T, index: number, arrayLength: number) => boolean | PromiseLike<boolean>, option?: Promise.ConcurrencyOption): Promise<T[]>;
|
||||
|
||||
/**
|
||||
* Iterate over an array, or a promise of an array, which contains promises (or a mix of promises and values) with the given iterator function with the signature (item, index, value) where item is the resolved value of a respective promise in the input array. Iteration happens serially. If any promise in the input array is rejected the returned promise is rejected as well.
|
||||
*
|
||||
* Resolves to the original array unmodified, this method is meant to be used for side effects. If the iterator function returns a promise or a thenable, the result for the promise is awaited for before continuing with next iteration.
|
||||
*/
|
||||
// promise of array with promises of value
|
||||
each<T, U>(values: PromiseLike<PromiseLike<T>[]>, iterator: (item: T, index: number, arrayLength: number) => U | PromiseLike<U>): Promise<T[]>;
|
||||
// array with promises of value
|
||||
each<T, U>(values: PromiseLike<T>[], iterator: (item: T, index: number, arrayLength: number) => U | PromiseLike<U>): Promise<T[]>;
|
||||
// array with values OR promise of array with values
|
||||
each<T, U>(values: T[] | PromiseLike<T[]>, iterator: (item: T, index: number, arrayLength: number) => U | PromiseLike<U>): Promise<T[]>;
|
||||
}
|
||||
|
||||
interface Promise<T> extends PromiseLike<T>, Promise.Inspection<T> {
|
||||
/**
|
||||
* Promises/A+ `.then()` with progress handler. Returns a new promise chained from this promise. The new promise will be rejected or resolved dedefer on the passed `fulfilledHandler`, `rejectedHandler` and the state of this promise.
|
||||
*/
|
||||
then<U>(onFulfill: (value: T) => U | PromiseLike<U>, onReject?: (error: any) => U | PromiseLike<U>, onProgress?: (note: any) => any): Promise<U>;
|
||||
then<U>(onFulfill: (value: T) => U | PromiseLike<U>, onReject?: (error: any) => void | PromiseLike<void>, onProgress?: (note: any) => any): Promise<U>;
|
||||
|
||||
/**
|
||||
* This is a catch-all exception handler, shortcut for calling `.then(null, handler)` on this promise. Any exception happening in a `.then`-chain will propagate to nearest `.catch` handler.
|
||||
*
|
||||
* Alias `.caught();` for compatibility with earlier ECMAScript version.
|
||||
*/
|
||||
catch(onReject?: (error: any) => T | PromiseLike<T> | void | PromiseLike<void>): Promise<T>;
|
||||
caught(onReject?: (error: any) => T | PromiseLike<T> | void | PromiseLike<void>): Promise<T>;
|
||||
|
||||
catch<U>(onReject?: (error: any) => U | PromiseLike<U>): Promise<U | T>;
|
||||
caught<U>(onReject?: (error: any) => U | PromiseLike<U>): Promise<U | T>;
|
||||
|
||||
/**
|
||||
* This extends `.catch` to work more like catch-clauses in languages like Java or C#. Instead of manually checking `instanceof` or `.name === "SomeError"`, you may specify a number of error constructors which are eligible for this catch handler. The catch handler that is first met that has eligible constructors specified, is the one that will be called.
|
||||
*
|
||||
* This method also supports predicate-based filters. If you pass a predicate function instead of an error constructor, the predicate will receive the error as an argument. The return result of the predicate will be used determine whether the error handler should be called.
|
||||
*
|
||||
* Alias `.caught();` for compatibility with earlier ECMAScript version.
|
||||
*/
|
||||
catch(predicate: (error: any) => boolean, onReject: (error: any) => T | PromiseLike<T> | void | PromiseLike<void>): Promise<T>;
|
||||
caught(predicate: (error: any) => boolean, onReject: (error: any) => T | PromiseLike<T> | void | PromiseLike<void>): Promise<T>;
|
||||
|
||||
catch<U>(predicate: (error: any) => boolean, onReject: (error: any) => U | PromiseLike<U>): Promise<U | T>;
|
||||
caught<U>(predicate: (error: any) => boolean, onReject: (error: any) => U | PromiseLike<U>): Promise<U | T>;
|
||||
|
||||
catch(ErrorClass: Function, onReject: (error: any) => T | PromiseLike<T> | void | PromiseLike<void>): Promise<T>;
|
||||
caught(ErrorClass: Function, onReject: (error: any) => T | PromiseLike<T> | void | PromiseLike<void>): Promise<T>;
|
||||
|
||||
catch<U>(ErrorClass: Function, onReject: (error: any) => U | PromiseLike<U>): Promise<U | T>;
|
||||
caught<U>(ErrorClass: Function, onReject: (error: any) => U | PromiseLike<U>): Promise<U | T>;
|
||||
|
||||
|
||||
/**
|
||||
* Like `.catch` but instead of catching all types of exceptions, it only catches those that don't originate from thrown errors but rather from explicit rejections.
|
||||
*/
|
||||
error<U>(onReject: (reason: any) => PromiseLike<U>): Promise<U>;
|
||||
error<U>(onReject: (reason: any) => U): Promise<U>;
|
||||
|
||||
/**
|
||||
* Pass a handler that will be called regardless of this promise's fate. Returns a new promise chained from this promise. There are special semantics for `.finally()` in that the final value cannot be modified from the handler.
|
||||
*
|
||||
* Alias `.lastly();` for compatibility with earlier ECMAScript version.
|
||||
*/
|
||||
finally<U>(handler: () => U | PromiseLike<U>): Promise<T>;
|
||||
|
||||
lastly<U>(handler: () => U | PromiseLike<U>): Promise<T>;
|
||||
|
||||
/**
|
||||
* Create a promise that follows this promise, but is bound to the given `thisArg` value. A bound promise will call its handlers with the bound value set to `this`. Additionally promises derived from a bound promise will also be bound promises with the same `thisArg` binding as the original promise.
|
||||
*/
|
||||
bind(thisArg: any): Promise<T>;
|
||||
|
||||
/**
|
||||
* Like `.then()`, but any unhandled rejection that ends up here will be thrown as an error.
|
||||
*/
|
||||
done<U>(onFulfilled?: (value: T) => PromiseLike<U>, onRejected?: (error: any) => U | PromiseLike<U>, onProgress?: (note: any) => any): void;
|
||||
done<U>(onFulfilled?: (value: T) => U, onRejected?: (error: any) => U | PromiseLike<U>, onProgress?: (note: any) => any): void;
|
||||
|
||||
/**
|
||||
* Like `.finally()`, but not called for rejections.
|
||||
*/
|
||||
tap<U>(onFulFill: (value: T) => U | PromiseLike<U>): Promise<T>;
|
||||
|
||||
/**
|
||||
* Shorthand for `.then(null, null, handler);`. Attach a progress handler that will be called if this promise is progressed. Returns a new promise chained from this promise.
|
||||
*/
|
||||
progressed(handler: (note: any) => any): Promise<T>;
|
||||
|
||||
/**
|
||||
* Same as calling `Promise.delay(this, ms)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too.
|
||||
*/
|
||||
delay(ms: number): Promise<T>;
|
||||
|
||||
/**
|
||||
* Returns a promise that will be fulfilled with this promise's fulfillment value or rejection reason. However, if this promise is not fulfilled or rejected within `ms` milliseconds, the returned promise is rejected with a `Promise.TimeoutError` instance.
|
||||
*
|
||||
* You may specify a custom error message with the `message` parameter.
|
||||
*/
|
||||
timeout(ms: number, message?: string): Promise<T>;
|
||||
|
||||
/**
|
||||
* Register a node-style callback on this promise. When this promise is is either fulfilled or rejected, the node callback will be called back with the node.js convention where error reason is the first argument and success value is the second argument. The error argument will be `null` in case of success.
|
||||
* Returns back this promise instead of creating a new one. If the `callback` argument is not a function, this method does not do anything.
|
||||
*/
|
||||
nodeify(callback: (err: any, value?: T) => void, options?: Promise.SpreadOption): Promise<T>;
|
||||
nodeify(...sink: any[]): Promise<T>;
|
||||
|
||||
/**
|
||||
* Marks this promise as cancellable. Promises by default are not cancellable after v0.11 and must be marked as such for `.cancel()` to have any effect. Marking a promise as cancellable is infectious and you don't need to remark any descendant promise.
|
||||
*/
|
||||
cancellable(): Promise<T>;
|
||||
|
||||
/**
|
||||
* Cancel this promise. The cancellation will propagate to farthest cancellable ancestor promise which is still pending.
|
||||
*
|
||||
* That ancestor will then be rejected with a `CancellationError` (get a reference from `Promise.CancellationError`) object as the rejection reason.
|
||||
*
|
||||
* In a promise rejection handler you may check for a cancellation by seeing if the reason object has `.name === "Cancel"`.
|
||||
*
|
||||
* Promises are by default not cancellable. Use `.cancellable()` to mark a promise as cancellable.
|
||||
*/
|
||||
// TODO what to do with this?
|
||||
cancel<U>(reason?: any): Promise<U>;
|
||||
|
||||
/**
|
||||
* Like `.then()`, but cancellation of the the returned promise or any of its descendant will not propagate cancellation to this promise or this promise's ancestors.
|
||||
*/
|
||||
fork<U>(onFulfilled?: (value: T) => U | PromiseLike<U>, onRejected?: (error: any) => U | PromiseLike<U>, onProgress?: (note: any) => any): Promise<U>;
|
||||
|
||||
/**
|
||||
* Create an uncancellable promise based on this promise.
|
||||
*/
|
||||
uncancellable(): Promise<T>;
|
||||
|
||||
/**
|
||||
* See if this promise can be cancelled.
|
||||
*/
|
||||
isCancellable(): boolean;
|
||||
|
||||
/**
|
||||
* See if this `promise` has been fulfilled.
|
||||
*/
|
||||
isFulfilled(): boolean;
|
||||
|
||||
/**
|
||||
* See if this `promise` has been rejected.
|
||||
*/
|
||||
isRejected(): boolean;
|
||||
|
||||
/**
|
||||
* See if this `promise` is still defer.
|
||||
*/
|
||||
isPending(): boolean;
|
||||
|
||||
/**
|
||||
* See if this `promise` is resolved -> either fulfilled or rejected.
|
||||
*/
|
||||
isResolved(): boolean;
|
||||
|
||||
/**
|
||||
* Get the fulfillment value of the underlying promise. Throws if the promise isn't fulfilled yet.
|
||||
*
|
||||
* throws `TypeError`
|
||||
*/
|
||||
value(): T;
|
||||
|
||||
/**
|
||||
* Get the rejection reason for the underlying promise. Throws if the promise isn't rejected yet.
|
||||
*
|
||||
* throws `TypeError`
|
||||
*/
|
||||
reason(): any;
|
||||
|
||||
/**
|
||||
* Synchronously inspect the state of this `promise`. The `PromiseInspection` will represent the state of the promise as snapshotted at the time of calling `.inspect()`.
|
||||
*/
|
||||
inspect(): Promise.Inspection<T>;
|
||||
|
||||
/**
|
||||
* This is a convenience method for doing:
|
||||
*
|
||||
* <code>
|
||||
* promise.then(function(obj){
|
||||
* return obj[propertyName].call(obj, arg...);
|
||||
* });
|
||||
* </code>
|
||||
*/
|
||||
call(propertyName: string, ...args: any[]): Promise<any>;
|
||||
|
||||
/**
|
||||
* This is a convenience method for doing:
|
||||
*
|
||||
* <code>
|
||||
* promise.then(function(obj){
|
||||
* return obj[propertyName];
|
||||
* });
|
||||
* </code>
|
||||
*/
|
||||
// TODO find way to fix get()
|
||||
// get<U>(propertyName: string): Promise<U>;
|
||||
|
||||
/**
|
||||
* Convenience method for:
|
||||
*
|
||||
* <code>
|
||||
* .then(function() {
|
||||
* return value;
|
||||
* });
|
||||
* </code>
|
||||
*
|
||||
* in the case where `value` doesn't change its value. That means `value` is bound at the time of calling `.return()`
|
||||
*
|
||||
* Alias `.thenReturn();` for compatibility with earlier ECMAScript version.
|
||||
*/
|
||||
return(): Promise<any>;
|
||||
thenReturn(): Promise<any>;
|
||||
return<U>(value: U): Promise<U>;
|
||||
thenReturn<U>(value: U): Promise<U>;
|
||||
|
||||
/**
|
||||
* Convenience method for:
|
||||
*
|
||||
* <code>
|
||||
* .then(function() {
|
||||
* throw reason;
|
||||
* });
|
||||
* </code>
|
||||
* Same limitations apply as with `.return()`.
|
||||
*
|
||||
* Alias `.thenThrow();` for compatibility with earlier ECMAScript version.
|
||||
*/
|
||||
throw(reason: Error): Promise<T>;
|
||||
thenThrow(reason: Error): Promise<T>;
|
||||
|
||||
/**
|
||||
* Convert to String.
|
||||
*/
|
||||
toString(): string;
|
||||
|
||||
/**
|
||||
* This is implicitly called by `JSON.stringify` when serializing the object. Returns a serialized representation of the `Promise`.
|
||||
*/
|
||||
toJSON(): Object;
|
||||
|
||||
/**
|
||||
* Like calling `.then`, but the fulfillment value or rejection reason is assumed to be an array, which is flattened to the formal parameters of the handlers.
|
||||
*/
|
||||
// TODO how to model instance.spread()? like Q?
|
||||
spread<U>(onFulfill: Function, onReject?: (reason: any) => U | PromiseLike<U>): Promise<U>;
|
||||
/*
|
||||
// TODO or something like this?
|
||||
spread<U, W>(onFulfill: (...values: W[]) => PromiseLike<U>, onReject?: (reason: any) => PromiseLike<U>): Promise<U>;
|
||||
spread<U, W>(onFulfill: (...values: W[]) => PromiseLike<U>, onReject?: (reason: any) => U): Promise<U>;
|
||||
spread<U, W>(onFulfill: (...values: W[]) => U, onReject?: (reason: any) => PromiseLike<U>): Promise<U>;
|
||||
spread<U, W>(onFulfill: (...values: W[]) => U, onReject?: (reason: any) => U): Promise<U>;
|
||||
*/
|
||||
/**
|
||||
* Same as calling `Promise.all(thisPromise)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too.
|
||||
*/
|
||||
// TODO type inference from array-resolving promise?
|
||||
all<U>(): Promise<U[]>;
|
||||
|
||||
/**
|
||||
* Same as calling `Promise.props(thisPromise)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too.
|
||||
*/
|
||||
// TODO how to model instance.props()?
|
||||
props(): Promise<Object>;
|
||||
|
||||
/**
|
||||
* Same as calling `Promise.settle(thisPromise)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too.
|
||||
*/
|
||||
// TODO type inference from array-resolving promise?
|
||||
settle<U>(): Promise<Promise.Inspection<U>[]>;
|
||||
|
||||
/**
|
||||
* Same as calling `Promise.any(thisPromise)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too.
|
||||
*/
|
||||
// TODO type inference from array-resolving promise?
|
||||
any<U>(): Promise<U>;
|
||||
|
||||
/**
|
||||
* Same as calling `Promise.some(thisPromise)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too.
|
||||
*/
|
||||
// TODO type inference from array-resolving promise?
|
||||
some<U>(count: number): Promise<U[]>;
|
||||
|
||||
/**
|
||||
* Same as calling `Promise.race(thisPromise, count)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too.
|
||||
*/
|
||||
// TODO type inference from array-resolving promise?
|
||||
race<U>(): Promise<U>;
|
||||
|
||||
/**
|
||||
* Same as calling `Promise.map(thisPromise, mapper)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too.
|
||||
*/
|
||||
// TODO type inference from array-resolving promise?
|
||||
map<Q, U>(mapper: (item: Q, index: number, arrayLength: number) => U | PromiseLike<U>, options?: Promise.ConcurrencyOption): Promise<U[]>;
|
||||
|
||||
/**
|
||||
* Same as `Promise.mapSeries(thisPromise, mapper)`.
|
||||
*/
|
||||
// TODO type inference from array-resolving promise?
|
||||
mapSeries<Q, U>(mapper: (item: Q, index: number, arrayLength: number) => U | PromiseLike<U>): Promise<U[]>;
|
||||
|
||||
/**
|
||||
* Same as calling `Promise.reduce(thisPromise, Function reducer, initialValue)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too.
|
||||
*/
|
||||
// TODO type inference from array-resolving promise?
|
||||
reduce<Q, U>(reducer: (memo: U, item: Q, index: number, arrayLength: number) => U | PromiseLike<U>, initialValue?: U): Promise<U>;
|
||||
|
||||
/**
|
||||
* Same as calling ``Promise.filter(thisPromise, filterer)``. With the exception that if this promise is bound to a value, the returned promise is bound to that value too.
|
||||
*/
|
||||
// TODO type inference from array-resolving promise?
|
||||
filter<U>(filterer: (item: U, index: number, arrayLength: number) => boolean | PromiseLike<boolean>, options?: Promise.ConcurrencyOption): Promise<U[]>;
|
||||
|
||||
/**
|
||||
* Same as calling ``Promise.each(thisPromise, iterator)``. With the exception that if this promise is bound to a value, the returned promise is bound to that value too.
|
||||
*/
|
||||
each<T, U>(iterator: (item: T, index: number, arrayLength: number) => U | PromiseLike<U>): Promise<T[]>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Don't use variable namespace such as variables, functions, and classes.
|
||||
* If you use this namespace, it will conflict in es6.
|
||||
*/
|
||||
declare namespace Promise {
|
||||
export interface RangeError extends Error {
|
||||
}
|
||||
export interface CancellationError extends Error {
|
||||
}
|
||||
export interface TimeoutError extends Error {
|
||||
}
|
||||
export interface TypeError extends Error {
|
||||
}
|
||||
export interface RejectionError extends Error {
|
||||
}
|
||||
export interface OperationalError extends Error {
|
||||
}
|
||||
|
||||
export interface ConcurrencyOption {
|
||||
concurrency: number;
|
||||
}
|
||||
export interface SpreadOption {
|
||||
spread: boolean;
|
||||
}
|
||||
export interface PromisifyAllOptions {
|
||||
suffix?: string;
|
||||
filter?: (name: string, func: Function, target?: any, passesDefaultFilter?: boolean) => boolean;
|
||||
// The promisifier gets a reference to the original method and should return a function which returns a promise
|
||||
promisifier?: (originalMethod: Function) => () => PromiseLike<any>;
|
||||
}
|
||||
|
||||
export interface Resolver<T> {
|
||||
/**
|
||||
* Returns a reference to the controlled promise that can be passed to clients.
|
||||
*/
|
||||
promise: Promise<T>;
|
||||
|
||||
/**
|
||||
* Resolve the underlying promise with `value` as the resolution value. If `value` is a thenable or a promise, the underlying promise will assume its state.
|
||||
*/
|
||||
resolve(value: T): void;
|
||||
resolve(): void;
|
||||
|
||||
/**
|
||||
* Reject the underlying promise with `reason` as the rejection reason.
|
||||
*/
|
||||
reject(reason: any): void;
|
||||
|
||||
/**
|
||||
* Progress the underlying promise with `value` as the progression value.
|
||||
*/
|
||||
progress(value: any): void;
|
||||
|
||||
/**
|
||||
* Gives you a callback representation of the `PromiseResolver`. Note that this is not a method but a property. The callback accepts error object in first argument and success values on the 2nd parameter and the rest, I.E. node js conventions.
|
||||
*
|
||||
* If the the callback is called with multiple success values, the resolver fullfills its promise with an array of the values.
|
||||
*/
|
||||
// TODO specify resolver callback
|
||||
callback: (err: any, value: T, ...values: T[]) => void;
|
||||
}
|
||||
|
||||
export interface Inspection<T> {
|
||||
/**
|
||||
* See if the underlying promise was fulfilled at the creation time of this inspection object.
|
||||
*/
|
||||
isFulfilled(): boolean;
|
||||
|
||||
/**
|
||||
* See if the underlying promise was rejected at the creation time of this inspection object.
|
||||
*/
|
||||
isRejected(): boolean;
|
||||
|
||||
/**
|
||||
* See if the underlying promise was defer at the creation time of this inspection object.
|
||||
*/
|
||||
isPending(): boolean;
|
||||
|
||||
/**
|
||||
* Get the fulfillment value of the underlying promise. Throws if the promise wasn't fulfilled at the creation time of this inspection object.
|
||||
*
|
||||
* throws `TypeError`
|
||||
*/
|
||||
value(): T;
|
||||
|
||||
/**
|
||||
* Get the rejection reason for the underlying promise. Throws if the promise wasn't rejected at the creation time of this inspection object.
|
||||
*
|
||||
* throws `TypeError`
|
||||
*/
|
||||
reason(): any;
|
||||
}
|
||||
}
|
||||
|
||||
declare module 'bluebird' {
|
||||
export = Promise;
|
||||
}
|
||||
+7
-126
@@ -7,6 +7,8 @@
|
||||
|
||||
// Note: try to maintain the ordering and separators, and keep to the pattern
|
||||
|
||||
import Promise = require("bluebird");
|
||||
|
||||
var obj: Object;
|
||||
var bool: boolean;
|
||||
var num: number;
|
||||
@@ -141,7 +143,7 @@ var fooResolver: Promise.Resolver<Foo>;
|
||||
var barResolver: Promise.Resolver<Bar>;
|
||||
|
||||
var fooInspection: Promise.Inspection<Foo>;
|
||||
var barInspection: Promise.Inspection<Bar>;
|
||||
var fooInspectionPromise: Promise<Promise.Inspection<Foo>>;
|
||||
|
||||
var fooInspectionArrProm: Promise<Promise.Inspection<Foo>[]>;
|
||||
var barInspectionArrProm: Promise<Promise.Inspection<Bar>[]>;
|
||||
@@ -195,8 +197,6 @@ fooResolver.resolve(foo);
|
||||
|
||||
fooResolver.reject(err);
|
||||
|
||||
fooResolver.progress(bar);
|
||||
|
||||
fooResolver.callback = (err: any, value: Foo) => {
|
||||
|
||||
};
|
||||
@@ -204,24 +204,13 @@ fooResolver.callback = (err: any, value: Foo) => {
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
bool = fooInspection.isFulfilled();
|
||||
|
||||
bool = fooInspection.isRejected();
|
||||
|
||||
bool = fooInspection.isPending();
|
||||
|
||||
foo = fooInspection.value();
|
||||
|
||||
x = fooInspection.reason();
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
barProm = fooProm.then((value: Foo) => {
|
||||
return bar;
|
||||
}, (reason: any) => {
|
||||
return bar;
|
||||
}, (note: any) => {
|
||||
return bar;
|
||||
});
|
||||
barProm = fooProm.then((value: Foo) => {
|
||||
return bar;
|
||||
}, (reason: any) => {
|
||||
@@ -384,13 +373,6 @@ fooProm = fooProm.bind(obj);
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
voidVar = fooProm.done((value: Foo) => {
|
||||
return bar;
|
||||
}, (reason: any) => {
|
||||
return bar;
|
||||
}, (note: any) => {
|
||||
|
||||
});
|
||||
voidVar = fooProm.done((value: Foo) => {
|
||||
return bar;
|
||||
}, (reason: any) => {
|
||||
@@ -402,13 +384,6 @@ voidVar = fooProm.done((value: Foo) => {
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
voidVar = fooProm.done((value: Foo) => {
|
||||
return barThen;
|
||||
}, (reason: any) => {
|
||||
return barThen;
|
||||
}, (note: any) => {
|
||||
|
||||
});
|
||||
voidVar = fooProm.done((value: Foo) => {
|
||||
return barThen;
|
||||
}, (reason: any) => {
|
||||
@@ -436,11 +411,6 @@ fooProm = fooProm.tap(() => {
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
fooProm = fooProm.progressed((note: any) => {
|
||||
return foo;
|
||||
});
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
fooProm = fooProm.delay(num);
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
@@ -460,52 +430,11 @@ fooProm = fooProm.nodeify((err: any, foo?: Foo) => { }, { spread: true });
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
barProm = fooProm.fork((value: Foo) => {
|
||||
return bar;
|
||||
}, (reason: any) => {
|
||||
return bar;
|
||||
}, (note: any) => {
|
||||
|
||||
});
|
||||
barProm = fooProm.fork((value: Foo) => {
|
||||
return bar;
|
||||
}, (reason: any) => {
|
||||
return bar;
|
||||
});
|
||||
barProm = fooProm.fork((value: Foo) => {
|
||||
return bar;
|
||||
});
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
barProm = fooProm.fork((value: Foo) => {
|
||||
return barThen;
|
||||
}, (reason: any) => {
|
||||
return barThen;
|
||||
}, (note: any) => {
|
||||
|
||||
});
|
||||
barProm = fooProm.fork((value: Foo) => {
|
||||
return barThen;
|
||||
}, (reason: any) => {
|
||||
return barThen;
|
||||
});
|
||||
barProm = fooProm.fork((value: Foo) => {
|
||||
return barThen;
|
||||
});
|
||||
voidVar = fooProm.cancel();
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
barProm = fooProm.cancel<Bar>();
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
fooProm = fooProm.cancellable();
|
||||
fooProm = fooProm.uncancellable();
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
bool = fooProm.isCancellable();
|
||||
bool = fooProm.isCancelled();
|
||||
bool = fooProm.isFulfilled();
|
||||
bool = fooProm.isRejected();
|
||||
bool = fooProm.isPending();
|
||||
@@ -513,8 +442,6 @@ bool = fooProm.isResolved();
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
fooInspection = fooProm.inspect();
|
||||
|
||||
anyProm = fooProm.call(str);
|
||||
anyProm = fooProm.call(str, 1, 2, 3);
|
||||
|
||||
@@ -543,22 +470,12 @@ obj = fooProm.toJSON();
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
barProm = fooArrProm.spread<Bar>((one: Foo, two: Bar) => {
|
||||
return bar;
|
||||
}, (reason: any) => {
|
||||
return bar;
|
||||
});
|
||||
barProm = fooArrProm.spread<Bar>((one: Foo, two: Bar, twotwo: Foo) => {
|
||||
return bar;
|
||||
});
|
||||
|
||||
// - - - - - - - - - - - - - - - - -
|
||||
|
||||
barProm = fooArrProm.spread<Bar>((one: Foo, two: Bar) => {
|
||||
return barThen;
|
||||
}, (reason: any) => {
|
||||
return barThen;
|
||||
});
|
||||
barProm = fooArrProm.spread<Bar>((one: Foo, two: Bar, twotwo: Foo) => {
|
||||
return barThen;
|
||||
});
|
||||
@@ -568,15 +485,10 @@ barProm = fooArrProm.spread<Bar>((one: Foo, two: Bar, twotwo: Foo) => {
|
||||
//TODO fix collection inference
|
||||
|
||||
barArrProm = fooProm.all<Bar>();
|
||||
|
||||
objProm = fooProm.props();
|
||||
|
||||
barInspectionArrProm = fooProm.settle<Bar>();
|
||||
|
||||
fooInspectionPromise = fooProm.reflect();
|
||||
barProm = fooProm.any<Bar>();
|
||||
|
||||
barArrProm = fooProm.some<Bar>(num);
|
||||
|
||||
barProm = fooProm.race<Bar>();
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
@@ -686,24 +598,12 @@ fooProm = Promise.try<Foo>(() => {
|
||||
fooProm = Promise.try(() => {
|
||||
return foo;
|
||||
});
|
||||
fooProm = Promise.try(() => {
|
||||
return foo;
|
||||
}, arr);
|
||||
fooProm = Promise.try(() => {
|
||||
return foo;
|
||||
}, arr, x);
|
||||
|
||||
// - - - - - - - - - - - - - - - - -
|
||||
|
||||
fooProm = Promise.try(() => {
|
||||
return fooThen;
|
||||
});
|
||||
fooProm = Promise.try(() => {
|
||||
return fooThen;
|
||||
}, arr);
|
||||
fooProm = Promise.try(() => {
|
||||
return fooThen;
|
||||
}, arr, x);
|
||||
|
||||
// - - - - - - - - - - - - - - - - -
|
||||
|
||||
@@ -725,12 +625,6 @@ fooProm = Promise.attempt<Foo>(() => {
|
||||
fooProm = Promise.attempt(() => {
|
||||
return foo;
|
||||
});
|
||||
fooProm = Promise.attempt(() => {
|
||||
return foo;
|
||||
}, arr);
|
||||
fooProm = Promise.attempt(() => {
|
||||
return foo;
|
||||
}, arr, x);
|
||||
|
||||
// - - - - - - - - - - - - - - - - -
|
||||
|
||||
@@ -746,12 +640,6 @@ fooProm = Promise.attempt(() => {
|
||||
fooProm = Promise.attempt(() => {
|
||||
return fooThen;
|
||||
});
|
||||
fooProm = Promise.attempt(() => {
|
||||
return fooThen;
|
||||
}, arr);
|
||||
fooProm = Promise.attempt(() => {
|
||||
return fooThen;
|
||||
}, arr, x);
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
@@ -847,6 +735,7 @@ obj = Promise.promisifyAll(obj, {
|
||||
*/
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
BlueBird = Promise.getNewLibraryCopy();
|
||||
BlueBird = Promise.noConflict();
|
||||
|
||||
Promise.onPossiblyUnhandledRejection((reason: any) => {
|
||||
@@ -868,14 +757,6 @@ objProm = Promise.props(obj);
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
//TODO expand tests to overloads
|
||||
fooInspectionArrProm = Promise.settle(fooThenArrThen);
|
||||
fooInspectionArrProm = Promise.settle(fooArrProm);
|
||||
fooInspectionArrProm = Promise.settle(fooThenArr);
|
||||
fooInspectionArrProm = Promise.settle(fooArr);
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
//TODO expand tests to overloads
|
||||
fooProm = Promise.any(fooThenArrThen);
|
||||
fooProm = Promise.any(fooArrProm);
|
||||
|
||||
Vendored
+730
-730
File diff suppressed because it is too large
Load Diff
Vendored
+1
-1
@@ -3,7 +3,7 @@
|
||||
// Definitions by: Andrew Schurman <http://github.com/arcticwaters>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../bluebird/bluebird.d.ts" />
|
||||
/// <reference path="../bluebird/bluebird-2.0.d.ts" />
|
||||
/// <reference path='../lodash/lodash-3.10.d.ts' />
|
||||
/// <reference path="../knex/knex.d.ts" />
|
||||
/// <reference path="../create-error/create-error.d.ts" />
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
/// <reference path="chroma-js.d.ts" />
|
||||
|
||||
import * as myChroma from "chroma-js";
|
||||
|
||||
function test_chroma() {
|
||||
chroma('hotpink');
|
||||
chroma('#ff3399');
|
||||
@@ -41,6 +43,9 @@ function test_chroma() {
|
||||
chroma.limits(data, 'e', 5);
|
||||
chroma.limits(data, 'q', 5);
|
||||
chroma.limits(data, 'k', 5);
|
||||
|
||||
myChroma(0xff3399);
|
||||
myChroma.limits(data, 'k', 5);
|
||||
}
|
||||
|
||||
function test_color() {
|
||||
@@ -99,6 +104,10 @@ function test_color() {
|
||||
chroma('#cbdbff').temperature();
|
||||
chroma('#b3ccff').temperature();
|
||||
chroma('33cc00').gl();
|
||||
|
||||
myChroma('teal').alpha(0.5).css();
|
||||
myChroma('teal').css('hsl');
|
||||
myChroma('orange').rgb();
|
||||
}
|
||||
|
||||
function test_scale() {
|
||||
@@ -163,4 +172,17 @@ function test_scale() {
|
||||
|
||||
chroma.scale('OrRd').classes(5);
|
||||
chroma.scale('OrRd').classes(8);
|
||||
}
|
||||
|
||||
myChroma.cubehelix()
|
||||
.start(200)
|
||||
.rotations(-0.35)
|
||||
.gamma(0.7)
|
||||
.lightness([0.3, 0.8])
|
||||
.scale() // convert to chroma.scale
|
||||
|
||||
.correctLightness()
|
||||
.colors(5);
|
||||
|
||||
myChroma.scale('RdYlBu');
|
||||
myChroma.scale('RdYlBu').padding(0.15);
|
||||
}
|
||||
|
||||
Vendored
+4
@@ -263,3 +263,7 @@ declare namespace Chroma {
|
||||
}
|
||||
|
||||
declare var chroma: Chroma.ChromaStatic;
|
||||
|
||||
declare module "chroma-js" {
|
||||
export = chroma;
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -6,7 +6,7 @@
|
||||
// Imported from: https://github.com/soywiz/typescript-node-definitions/consolidate.d.ts
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
/// <reference path="../bluebird/bluebird.d.ts" />
|
||||
/// <reference path="../bluebird/bluebird-2.0.d.ts" />
|
||||
|
||||
declare module "consolidate" {
|
||||
var cons: Consolidate;
|
||||
|
||||
Vendored
+4
-4
@@ -94,12 +94,12 @@ declare module 'documentdb' {
|
||||
/** Represents the result returned from a query. */
|
||||
interface QueryIterator<TResultRow> {
|
||||
current(): TResultRow;
|
||||
executeNext(callback: (error: QueryError, result: TResultRow[]) => void): void;
|
||||
forEach(iteratorFunction : (error: QueryError, element: TResultRow) => void): void;
|
||||
executeNext(callback: (error: QueryError, result: TResultRow[], responseHeaders? : any) => void): void;
|
||||
forEach(iteratorFunction : (error: QueryError, element: TResultRow, responseHeaders? : any) => void): void;
|
||||
hasMoreResults(): boolean;
|
||||
nextItem(callback: (error : QueryError, item : TResultRow) => void): void;
|
||||
nextItem(callback: (error : QueryError, item : TResultRow, responseHeaders? : any) => void): void;
|
||||
reset() : void;
|
||||
toArray(callback: (error: QueryError, result: TResultRow[]) => void): void;
|
||||
toArray(callback: (error: QueryError, result: TResultRow[], responseHeaders? : any) => void): void;
|
||||
}
|
||||
|
||||
/** Reprents an object with a unique identifier. */
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
// Imported from: https://github.com/soywiz/typescript-node-definitions/fs-extra.d.ts via TSD fs-extra definition
|
||||
|
||||
///<reference path="../node/node.d.ts"/>
|
||||
///<reference path="../bluebird/bluebird.d.ts"/>
|
||||
///<reference path="../bluebird/bluebird-2.0.d.ts"/>
|
||||
|
||||
declare module "fs-extra-promise" {
|
||||
import stream = require("stream");
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
/// <reference path="./graphene-pk11.d.ts" />
|
||||
|
||||
import * as graphene from "graphene-pk11";
|
||||
|
||||
// Example of Hashing from README.MD <https://github.com/PeculiarVentures/graphene#hashing>
|
||||
let Module = graphene.Module;
|
||||
|
||||
let lib = "/usr/local/lib/softhsm/libsofthsm2.so";
|
||||
@@ -13,13 +11,44 @@ mod.initialize();
|
||||
let slot = mod.getSlots(0);
|
||||
if (slot.flags & graphene.SlotFlag.TOKEN_PRESENT) {
|
||||
let session = slot.open();
|
||||
session.login("12345");
|
||||
|
||||
let digest = session.createDigest("sha1");
|
||||
digest.update("simple text 1");
|
||||
digest.update("simple text 2");
|
||||
let hash = digest.final();
|
||||
// generate EC key
|
||||
let keys = session.generateKeyPair(graphene.KeyGenMechanism.ECDSA, {
|
||||
keyType: graphene.KeyType.ECDSA,
|
||||
token: false,
|
||||
derive: true,
|
||||
paramsECDSA: graphene.NamedCurve.getByName("secp192r1").value
|
||||
}, {
|
||||
keyType: graphene.KeyType.ECDSA,
|
||||
token: false,
|
||||
derive: true
|
||||
});
|
||||
|
||||
console.log("Hash SHA1:", hash.toString("hex")); // Hash SHA1: e1dc1e52e9779cd69679b3e0af87d2e288190d34
|
||||
// derive algorithm
|
||||
let alg = {
|
||||
name: "ECDH1_DERIVE",
|
||||
params: new graphene.EcdhParams(
|
||||
graphene.EcKdf.SHA1,
|
||||
null,
|
||||
keys.publicKey.getAttribute({ pointEC: null }).pointEC)
|
||||
};
|
||||
|
||||
// Template for derived key
|
||||
let template = {
|
||||
"class": graphene.ObjectClass.SECRET_KEY,
|
||||
"token": false,
|
||||
"keyType": graphene.KeyType.AES,
|
||||
"valueLen": 256 / 8,
|
||||
"encrypt": true,
|
||||
"decrypt": true
|
||||
};
|
||||
|
||||
// Key derivation
|
||||
let dKey = session.deriveKey(alg, keys.privateKey, template);
|
||||
console.log("Derived key handle:", dKey.handle);
|
||||
|
||||
session.logout();
|
||||
session.close();
|
||||
}
|
||||
else {
|
||||
|
||||
Vendored
+1170
-1138
File diff suppressed because it is too large
Load Diff
Vendored
+4
@@ -468,6 +468,10 @@ interface HighchartsAxisOptions {
|
||||
* @since 4.0
|
||||
*/
|
||||
ceiling?: number;
|
||||
/**
|
||||
* Configure a crosshair that follows either the mouse pointer or the hovered point.
|
||||
*/
|
||||
crosshair?: HighchartsCrosshairObject;
|
||||
/**
|
||||
* For a datetime axis, the scale will automatically adjust to the appropriate unit. This member gives the default
|
||||
* string representations used for each unit. For an overview of the replacement codes, see dateFormat.
|
||||
|
||||
Vendored
+1
-1
@@ -3,7 +3,7 @@
|
||||
// Definitions by: Philip Spain <https://github.com/philipisapain>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../bluebird/bluebird.d.ts" />
|
||||
/// <reference path="../bluebird/bluebird-2.0.d.ts" />
|
||||
|
||||
declare module 'inline-css' {
|
||||
import Promise = require('bluebird');
|
||||
|
||||
Vendored
+33
-33
@@ -3,7 +3,7 @@
|
||||
// Definitions by: inversify <https://github.com/inversify>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../bluebird/bluebird.d.ts" />
|
||||
/// <reference path="../bluebird/bluebird-2.0.d.ts" />
|
||||
|
||||
interface Symbol {
|
||||
toString(): string;
|
||||
@@ -31,9 +31,9 @@ declare namespace inversify {
|
||||
export interface Newable<T> {
|
||||
new(...args: any[]): T;
|
||||
}
|
||||
|
||||
|
||||
export type ServiceIdentifier<T> = (string|Symbol|Newable<T>);
|
||||
|
||||
|
||||
export interface Binding<T> extends Clonable<Binding<T>> {
|
||||
guid: string;
|
||||
moduleId: string;
|
||||
@@ -49,66 +49,66 @@ declare namespace inversify {
|
||||
scope: number; // BindingScope
|
||||
type: number; // BindingType
|
||||
}
|
||||
|
||||
|
||||
export interface Factory<T> extends Function {
|
||||
(...args: any[]): (((...args: any[]) => T)|T);
|
||||
}
|
||||
|
||||
|
||||
export interface FactoryCreator<T> extends Function {
|
||||
(context: Context): Factory<T>;
|
||||
}
|
||||
|
||||
|
||||
export interface Provider<T> extends Function {
|
||||
(): Promise<T>;
|
||||
}
|
||||
|
||||
|
||||
export interface ProviderCreator<T> extends Function {
|
||||
(context: Context): Provider<T>;
|
||||
}
|
||||
|
||||
|
||||
export interface PlanAndResolve<T> {
|
||||
(args: PlanAndResolveArgs): T[];
|
||||
}
|
||||
|
||||
|
||||
export interface PlanAndResolveArgs {
|
||||
multiInject: boolean;
|
||||
serviceIdentifier: ServiceIdentifier<any>;
|
||||
target: Target;
|
||||
contextInterceptor: (contexts: Context) => Context;
|
||||
}
|
||||
|
||||
|
||||
export interface Middleware extends Function {
|
||||
(next: PlanAndResolve<any>): PlanAndResolve<any>;
|
||||
}
|
||||
|
||||
|
||||
export interface Context {
|
||||
guid: string;
|
||||
kernel: Kernel;
|
||||
plan: Plan;
|
||||
addPlan(plan: Plan): void;
|
||||
}
|
||||
|
||||
|
||||
export interface ReflectResult {
|
||||
[key: string]: Metadata[];
|
||||
}
|
||||
|
||||
|
||||
export interface Metadata {
|
||||
key: string;
|
||||
value: any;
|
||||
}
|
||||
|
||||
|
||||
export interface Plan {
|
||||
parentContext: Context;
|
||||
rootRequest: Request;
|
||||
}
|
||||
|
||||
|
||||
export interface Planner {
|
||||
createContext(kernel: Kernel): Context;
|
||||
createPlan(parentContext: Context, binding: Binding<any>, target: Target): Plan;
|
||||
getBindings<T>(kernel: Kernel, serviceIdentifier: ServiceIdentifier<T>): Binding<T>[];
|
||||
getActiveBindings(parentRequest: Request, target: Target): Binding<any>[];
|
||||
}
|
||||
|
||||
|
||||
export interface QueryableString {
|
||||
startsWith(searchString: string): boolean;
|
||||
endsWith(searchString: string): boolean;
|
||||
@@ -116,7 +116,7 @@ declare namespace inversify {
|
||||
equals(compareString: string): boolean;
|
||||
value(): string;
|
||||
}
|
||||
|
||||
|
||||
export interface Request {
|
||||
guid: string;
|
||||
serviceIdentifier: ServiceIdentifier<any>;
|
||||
@@ -131,7 +131,7 @@ declare namespace inversify {
|
||||
target: Target
|
||||
): Request;
|
||||
}
|
||||
|
||||
|
||||
export interface Target {
|
||||
guid: string;
|
||||
serviceIdentifier: ServiceIdentifier<any>;
|
||||
@@ -145,11 +145,11 @@ declare namespace inversify {
|
||||
matchesNamedTag(name: string): boolean;
|
||||
matchesTag(key: string): (value: any) => boolean;
|
||||
}
|
||||
|
||||
|
||||
export interface Resolver {
|
||||
resolve<T>(context: Context): T;
|
||||
}
|
||||
|
||||
|
||||
export interface Kernel {
|
||||
guid: string;
|
||||
bind<T>(serviceIdentifier: ServiceIdentifier<T>): BindingToSyntax<T>;
|
||||
@@ -167,25 +167,25 @@ declare namespace inversify {
|
||||
snapshot(): void;
|
||||
restore(): void;
|
||||
}
|
||||
|
||||
|
||||
export interface Bind extends Function {
|
||||
<T>(serviceIdentifier: ServiceIdentifier<T>): BindingToSyntax<T>;
|
||||
}
|
||||
|
||||
|
||||
export interface KernelModule {
|
||||
guid: string;
|
||||
registry: (bind: Bind) => void;
|
||||
}
|
||||
|
||||
|
||||
export interface KernelSnapshot {
|
||||
bindings: Lookup<Binding<any>>;
|
||||
middleware: PlanAndResolve<any>;
|
||||
}
|
||||
|
||||
|
||||
export interface Clonable<T> {
|
||||
clone(): T;
|
||||
}
|
||||
|
||||
|
||||
export interface Lookup<T> extends Clonable<Lookup<T>> {
|
||||
add(serviceIdentifier: ServiceIdentifier<any>, value: T): void;
|
||||
get(serviceIdentifier: ServiceIdentifier<any>): Array<T>;
|
||||
@@ -193,22 +193,22 @@ declare namespace inversify {
|
||||
removeByModuleId(moduleId: string): void;
|
||||
hasKey(serviceIdentifier: ServiceIdentifier<any>): boolean;
|
||||
}
|
||||
|
||||
|
||||
export interface KeyValuePair<T> {
|
||||
serviceIdentifier: ServiceIdentifier<any>;
|
||||
value: Array<T>;
|
||||
}
|
||||
|
||||
|
||||
export interface BindingInSyntax<T> {
|
||||
inSingletonScope(): BindingWhenOnSyntax<T>;
|
||||
}
|
||||
|
||||
|
||||
export interface BindingInWhenOnSyntax<T> extends BindingInSyntax<T>, BindingWhenOnSyntax<T> {}
|
||||
|
||||
|
||||
export interface BindingOnSyntax<T> {
|
||||
onActivation(fn: (context: Context, injectable: T) => T): BindingWhenSyntax<T>;
|
||||
}
|
||||
|
||||
|
||||
export interface BindingToSyntax<T> {
|
||||
to(constructor: { new(...args: any[]): T; }): BindingInWhenOnSyntax<T>;
|
||||
toConstantValue(value: T): BindingWhenOnSyntax<T>;
|
||||
@@ -219,9 +219,9 @@ declare namespace inversify {
|
||||
toAutoFactory<T2>(serviceIdentifier: ServiceIdentifier<T2>): BindingWhenOnSyntax<T>;
|
||||
toProvider<T2>(provider: ProviderCreator<T2>): BindingWhenOnSyntax<T>;
|
||||
}
|
||||
|
||||
|
||||
export interface BindingWhenOnSyntax<T> extends BindingWhenSyntax<T>, BindingOnSyntax<T> {}
|
||||
|
||||
|
||||
export interface BindingWhenSyntax<T> {
|
||||
when(constraint: (request: Request) => boolean): BindingOnSyntax<T>;
|
||||
whenTargetNamed(name: string): BindingOnSyntax<T>;
|
||||
@@ -238,7 +238,7 @@ declare namespace inversify {
|
||||
whenAnyAncestorMatches(constraint: (request: Request) => boolean): BindingOnSyntax<T>;
|
||||
whenNoAncestorMatches(constraint: (request: Request) => boolean): BindingOnSyntax<T>;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
export var Kernel: interfaces.KernelConstructor;
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
///<reference path="java.d.ts"/>
|
||||
///<reference path="../bluebird/bluebird.d.ts"/>
|
||||
///<reference path="../bluebird/bluebird-2.0.d.ts"/>
|
||||
|
||||
import java = require('java');
|
||||
import BluePromise = require('bluebird');
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
// From: https://mrrio.github.io/jsPDF/examples/basic.html
|
||||
|
||||
import * as jsPDF from 'jspdf';
|
||||
|
||||
function test_simple_two_page_document() {
|
||||
var doc = new jsPDF();
|
||||
doc.text(20, 20, 'Hello world!');
|
||||
|
||||
Vendored
+185
-179
@@ -3,201 +3,207 @@
|
||||
// Definitions by: Amber Schühmacher <https://github.com/amberjs>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare class jsPDF {
|
||||
constructor(orientation?:any,
|
||||
unit?:string,
|
||||
format?:string,
|
||||
compressPdf?:number);
|
||||
declare module 'jspdf' {
|
||||
class jsPDF {
|
||||
constructor(orientation?:any,
|
||||
unit?:string,
|
||||
format?:string,
|
||||
compressPdf?:number);
|
||||
|
||||
CapJoinStyles:any;
|
||||
version:string;
|
||||
CapJoinStyles:any;
|
||||
version:string;
|
||||
|
||||
internal: {
|
||||
'pdfEscape'(text:string, flags:any): any;
|
||||
'getStyle'(style:string) : any;
|
||||
'getFont'(): any;
|
||||
'getFontSize'():number;
|
||||
'getLineHeight'():number;
|
||||
'write'(string1:string):any;
|
||||
'getCoordinateString'(value:number):number;
|
||||
'getVerticalCoordinateString'(value:number):number;
|
||||
'collections':any;
|
||||
'newObject'():number;
|
||||
'newAdditionalObject'():any;
|
||||
'newObjectDeferred'():number;
|
||||
'newObjectDeferredBegin'(oid:number):void;
|
||||
'putStream'(str:string):void;
|
||||
'events':any;
|
||||
'scaleFactor':number;
|
||||
'pageSize': {
|
||||
width:number;
|
||||
height:number;
|
||||
internal: {
|
||||
'pdfEscape'(text:string, flags:any): any;
|
||||
'getStyle'(style:string) : any;
|
||||
'getFont'(): any;
|
||||
'getFontSize'():number;
|
||||
'getLineHeight'():number;
|
||||
'write'(string1:string):any;
|
||||
'getCoordinateString'(value:number):number;
|
||||
'getVerticalCoordinateString'(value:number):number;
|
||||
'collections':any;
|
||||
'newObject'():number;
|
||||
'newAdditionalObject'():any;
|
||||
'newObjectDeferred'():number;
|
||||
'newObjectDeferredBegin'(oid:number):void;
|
||||
'putStream'(str:string):void;
|
||||
'events':any;
|
||||
'scaleFactor':number;
|
||||
'pageSize': {
|
||||
width:number;
|
||||
height:number;
|
||||
};
|
||||
'output'(type:any, options:any):any;
|
||||
'getNumberOfPages'():number;
|
||||
'pages':number[];
|
||||
'out'(string:string):void;
|
||||
'f2'(number:number):number;
|
||||
'getPageInfo'(pageNumberOneBased:number):any;
|
||||
'getCurrentPageInfo'():any;
|
||||
};
|
||||
'output'(type:any, options:any):any;
|
||||
'getNumberOfPages'():number;
|
||||
'pages':number[];
|
||||
'out'(string:string):void;
|
||||
'f2'(number:number):number;
|
||||
'getPageInfo'(pageNumberOneBased:number):any;
|
||||
'getCurrentPageInfo'():any;
|
||||
};
|
||||
addPage():jsPDF;
|
||||
setPage(n:number):jsPDF;
|
||||
insertPage(beforePage:number):jsPDF;
|
||||
movePage(targetPage:number, beforePage:number):jsPDF;
|
||||
deletePage(n:number):jsPDF;
|
||||
setDisplayMode(zoom?:string, layout?:string, pmode?:string):jsPDF;
|
||||
text(text:any, x:any, y:any, flags?:any, angle?:any, align?:any):jsPDF;
|
||||
lstext(text:string, x:number, y:number, spacing:number):jsPDF;
|
||||
line(x1:number, y1:number, x2:number, y2:number):any;
|
||||
clip():void;
|
||||
lines(lines:any, x:any, y:any, scale?:any, style?:string, closed?:boolean):jsPDF;
|
||||
rect(x:number, y:number, w:number, h:number, style?:string):jsPDF;
|
||||
triangle(x1:number, y1:number, x2:number, y2:number, x3:number, y3:number, style:string):jsPDF;
|
||||
roundedRect(x:number, y:number, w:number, h:number, rx:number, ry:number, style:string):jsPDF;
|
||||
ellipse(x:number, y:number, rx:number, ry:number, style?:string):jsPDF;
|
||||
circle(x:number, y:number, r:number, style:string):jsPDF;
|
||||
setProperties(properties:any):jsPDF;
|
||||
setFontSize(size:number):jsPDF;
|
||||
setFont(fontName?:string, fontStyle?:string):jsPDF;
|
||||
setFontStyle(style:string):jsPDF;
|
||||
setFontType(style:string):jsPDF;
|
||||
getFontList():any;
|
||||
addFont(postScriptName:string, fontName:string, fontStyle:string):string;
|
||||
setLineWidth(width:number):jsPDF;
|
||||
setDrawColor(ch1:number|string, ch2?:number, ch3?:number, ch4?:number):jsPDF;
|
||||
setFillColor(ch1:number|string, ch2?:number, ch3?:number, ch4?:number):jsPDF;
|
||||
setTextColor(r?:number, g?:number, b?:number):jsPDF;
|
||||
setLineCap(style:string|number):jsPDF;
|
||||
setLineJoin(style:string|number):jsPDF;
|
||||
output(type?:string, options?:any):any;
|
||||
save(filename:string):jsPDF;
|
||||
addPage():jsPDF;
|
||||
setPage(n:number):jsPDF;
|
||||
insertPage(beforePage:number):jsPDF;
|
||||
movePage(targetPage:number, beforePage:number):jsPDF;
|
||||
deletePage(n:number):jsPDF;
|
||||
setDisplayMode(zoom?:string, layout?:string, pmode?:string):jsPDF;
|
||||
text(text:any, x:any, y:any, flags?:any, angle?:any, align?:any):jsPDF;
|
||||
lstext(text:string, x:number, y:number, spacing:number):jsPDF;
|
||||
line(x1:number, y1:number, x2:number, y2:number):any;
|
||||
clip():void;
|
||||
lines(lines:any, x:any, y:any, scale?:any, style?:string, closed?:boolean):jsPDF;
|
||||
rect(x:number, y:number, w:number, h:number, style?:string):jsPDF;
|
||||
triangle(x1:number, y1:number, x2:number, y2:number, x3:number, y3:number, style:string):jsPDF;
|
||||
roundedRect(x:number, y:number, w:number, h:number, rx:number, ry:number, style:string):jsPDF;
|
||||
ellipse(x:number, y:number, rx:number, ry:number, style?:string):jsPDF;
|
||||
circle(x:number, y:number, r:number, style:string):jsPDF;
|
||||
setProperties(properties:any):jsPDF;
|
||||
setFontSize(size:number):jsPDF;
|
||||
setFont(fontName?:string, fontStyle?:string):jsPDF;
|
||||
setFontStyle(style:string):jsPDF;
|
||||
setFontType(style:string):jsPDF;
|
||||
getFontList():any;
|
||||
addFont(postScriptName:string, fontName:string, fontStyle:string):string;
|
||||
setLineWidth(width:number):jsPDF;
|
||||
setDrawColor(ch1:number|string, ch2?:number, ch3?:number, ch4?:number):jsPDF;
|
||||
setFillColor(ch1:number|string, ch2?:number, ch3?:number, ch4?:number):jsPDF;
|
||||
setTextColor(r?:number, g?:number, b?:number):jsPDF;
|
||||
setLineCap(style:string|number):jsPDF;
|
||||
setLineJoin(style:string|number):jsPDF;
|
||||
output(type?:string, options?:any):any;
|
||||
save(filename:string):jsPDF;
|
||||
|
||||
/**
|
||||
* jsPDF plugins below:
|
||||
*
|
||||
* - AddHTML
|
||||
* - AddImage
|
||||
* - Annotations
|
||||
* - AutoPrint
|
||||
* - Canvas
|
||||
* - Cell
|
||||
* - Context2D
|
||||
* - FromHTML
|
||||
* - JavaScript
|
||||
* - PNG
|
||||
* - split_text_to_size
|
||||
* - SVG
|
||||
* - total_pages
|
||||
*/
|
||||
/**
|
||||
* jsPDF plugins below:
|
||||
*
|
||||
* - AddHTML
|
||||
* - AddImage
|
||||
* - Annotations
|
||||
* - AutoPrint
|
||||
* - Canvas
|
||||
* - Cell
|
||||
* - Context2D
|
||||
* - FromHTML
|
||||
* - JavaScript
|
||||
* - PNG
|
||||
* - split_text_to_size
|
||||
* - SVG
|
||||
* - total_pages
|
||||
*/
|
||||
|
||||
// jsPDF plugin: addHTML
|
||||
addHTML(element:any, x:number, y:number, options:any, callback:Function):jsPDF;
|
||||
addHTML(element:any, callback:Function):jsPDF;
|
||||
// jsPDF plugin: addHTML
|
||||
addHTML(element:any, x:number, y:number, options:any, callback:Function):jsPDF;
|
||||
addHTML(element:any, callback:Function):jsPDF;
|
||||
|
||||
// jsPDF plugin: addImage
|
||||
color_spaces:any;
|
||||
decode:any;
|
||||
image_compression:any;
|
||||
// jsPDF plugin: addImage
|
||||
color_spaces:any;
|
||||
decode:any;
|
||||
image_compression:any;
|
||||
|
||||
sHashCode(str:string):any;
|
||||
isString(object:any):boolean;
|
||||
extractInfoFromBase64DataURI(dataURI:string):any[];
|
||||
supportsArrayBuffer():boolean;
|
||||
isArrayBuffer(object:any):boolean;
|
||||
isArrayBufferView(object:any):boolean;
|
||||
binaryStringToUint8Array(binary_string:string):Uint8Array;
|
||||
arrayBufferToBinaryString(buffer:any):string;
|
||||
arrayBufferToBase64(arrayBuffer:ArrayBuffer):string;
|
||||
createImageInfo(data:any, wd:any, ht:any, cs:any, bpc:any, imageIndex:number, alias:any, f?:any, dp?:any, trns?:any, pal?:any, smask?:any):any;
|
||||
addImage(imageData?:any, format?:any, x?:number, y?:number, w?:number, h?:number, alias?:any, compression?:any, rotation?:any):jsPDF;
|
||||
processJPEG(data:any, index:number, alias:any, compression?:any, dataAsBinaryString?:string):any;
|
||||
processJPG():any;
|
||||
sHashCode(str:string):any;
|
||||
isString(object:any):boolean;
|
||||
extractInfoFromBase64DataURI(dataURI:string):any[];
|
||||
supportsArrayBuffer():boolean;
|
||||
isArrayBuffer(object:any):boolean;
|
||||
isArrayBufferView(object:any):boolean;
|
||||
binaryStringToUint8Array(binary_string:string):Uint8Array;
|
||||
arrayBufferToBinaryString(buffer:any):string;
|
||||
arrayBufferToBase64(arrayBuffer:ArrayBuffer):string;
|
||||
createImageInfo(data:any, wd:any, ht:any, cs:any, bpc:any, imageIndex:number, alias:any, f?:any, dp?:any, trns?:any, pal?:any, smask?:any):any;
|
||||
addImage(imageData?:any, format?:any, x?:number, y?:number, w?:number, h?:number, alias?:any, compression?:any, rotation?:any):jsPDF;
|
||||
processJPEG(data:any, index:number, alias:any, compression?:any, dataAsBinaryString?:string):any;
|
||||
processJPG():any;
|
||||
|
||||
// jsPDF plugin: Annotations
|
||||
annotationPlugin:any;
|
||||
createAnnotation(options:any):void;
|
||||
link(x:number, y:number, w:number, h:number, options:any):void;
|
||||
textWithLink(text:string, x:number, y:number, options:any):number;
|
||||
getTextWidth(text:string):number;
|
||||
getLineHeight():number;
|
||||
// jsPDF plugin: Annotations
|
||||
annotationPlugin:any;
|
||||
createAnnotation(options:any):void;
|
||||
link(x:number, y:number, w:number, h:number, options:any):void;
|
||||
textWithLink(text:string, x:number, y:number, options:any):number;
|
||||
getTextWidth(text:string):number;
|
||||
getLineHeight():number;
|
||||
|
||||
// jsPDF plugin: AutoPrint
|
||||
autoPrint():jsPDF;
|
||||
// jsPDF plugin: AutoPrint
|
||||
autoPrint():jsPDF;
|
||||
|
||||
// jsPDF plugin: Canvas
|
||||
canvas: {
|
||||
getContext():any;
|
||||
style:any;
|
||||
};
|
||||
// jsPDF plugin: Canvas
|
||||
canvas: {
|
||||
getContext():any;
|
||||
style:any;
|
||||
};
|
||||
|
||||
// jsPDF plugin: Cell
|
||||
setHeaderFunction(func:Function):void;
|
||||
getTextDimensions(txt:string):any;
|
||||
cellAddPage():void;
|
||||
cellInitialize():void;
|
||||
cell(x:number, y:number, w:number, h:number, txt:string, ln:number, align:string):jsPDF;
|
||||
arrayMax(array:any[], comparisonFn?:Function):number;
|
||||
table(x:number, y:number, data:any, headers:string[], config:any):jsPDF;
|
||||
calculateLineHeight(headerNames:string[], columnWidths:number[], model:any[]):number;
|
||||
setTableHeaderRow(config:any[]):void;
|
||||
printHeaderRow(lineNumber:number, new_page?:boolean):void;
|
||||
// jsPDF plugin: Cell
|
||||
setHeaderFunction(func:Function):void;
|
||||
getTextDimensions(txt:string):any;
|
||||
cellAddPage():void;
|
||||
cellInitialize():void;
|
||||
cell(x:number, y:number, w:number, h:number, txt:string, ln:number, align:string):jsPDF;
|
||||
arrayMax(array:any[], comparisonFn?:Function):number;
|
||||
table(x:number, y:number, data:any, headers:string[], config:any):jsPDF;
|
||||
calculateLineHeight(headerNames:string[], columnWidths:number[], model:any[]):number;
|
||||
setTableHeaderRow(config:any[]):void;
|
||||
printHeaderRow(lineNumber:number, new_page?:boolean):void;
|
||||
|
||||
// jsPDF plugin: Context2D
|
||||
context2d: {
|
||||
pageWrapXEnabled: boolean;
|
||||
pageWrapYEnabled: boolean;
|
||||
pageWrapX: number;
|
||||
pageWrapY: number;
|
||||
f2(number:number):number;
|
||||
fillRect(x:number, y:number, w:number, h:number):void;
|
||||
strokeRect(x:number, y:number, w:number, h:number):void;
|
||||
clearRect(x:number, y:number, w:number, h:number):void;
|
||||
save():void;
|
||||
restore():void;
|
||||
beginPath():void;
|
||||
closePath():void;
|
||||
setFillStyle(style:string):void;
|
||||
setStrokeStyle(style:string):void;
|
||||
fillText(text:string|string[], x:number, y:number, maxWidth:number):void;
|
||||
strokeText(text:string|string[], x:number, y:number, maxWidth:number):void;
|
||||
setFont(font:string):void;
|
||||
setTextBaseline(baseline:string):void;
|
||||
getTextBaseline():string;
|
||||
setLineWidth(width:number):void;
|
||||
setLineCap(style:string):void;
|
||||
setLineJoin(style:string):void;
|
||||
moveTo(x:number, y:number):void;
|
||||
lastBreak: number;
|
||||
pageBreaks: any[];
|
||||
lineTo(x:number, y:number):void;
|
||||
bezierCurveTo(x1:number, y1:number, x2:number, y2:number, x:number, y:number):void;
|
||||
quadraticCurveTo(x1:number, y1:number, x:number, y:number):void;
|
||||
arc(x:number, y:number, radius:number, startAngle:number, endAngle:number, anticlockwise:any):void;
|
||||
drawImage(img:string, x:number, y:number, w:number, h:number, x2?:number, y2?:number, w2?:number, h2?:number):void;
|
||||
stroke():void;
|
||||
fill():void;
|
||||
translate(x:number, y:number):void;
|
||||
measureText(text:string):number;
|
||||
};
|
||||
// jsPDF plugin: Context2D
|
||||
context2d: {
|
||||
pageWrapXEnabled: boolean;
|
||||
pageWrapYEnabled: boolean;
|
||||
pageWrapX: number;
|
||||
pageWrapY: number;
|
||||
f2(number:number):number;
|
||||
fillRect(x:number, y:number, w:number, h:number):void;
|
||||
strokeRect(x:number, y:number, w:number, h:number):void;
|
||||
clearRect(x:number, y:number, w:number, h:number):void;
|
||||
save():void;
|
||||
restore():void;
|
||||
beginPath():void;
|
||||
closePath():void;
|
||||
setFillStyle(style:string):void;
|
||||
setStrokeStyle(style:string):void;
|
||||
fillText(text:string|string[], x:number, y:number, maxWidth:number):void;
|
||||
strokeText(text:string|string[], x:number, y:number, maxWidth:number):void;
|
||||
setFont(font:string):void;
|
||||
setTextBaseline(baseline:string):void;
|
||||
getTextBaseline():string;
|
||||
setLineWidth(width:number):void;
|
||||
setLineCap(style:string):void;
|
||||
setLineJoin(style:string):void;
|
||||
moveTo(x:number, y:number):void;
|
||||
lastBreak: number;
|
||||
pageBreaks: any[];
|
||||
lineTo(x:number, y:number):void;
|
||||
bezierCurveTo(x1:number, y1:number, x2:number, y2:number, x:number, y:number):void;
|
||||
quadraticCurveTo(x1:number, y1:number, x:number, y:number):void;
|
||||
arc(x:number, y:number, radius:number, startAngle:number, endAngle:number, anticlockwise:any):void;
|
||||
drawImage(img:string, x:number, y:number, w:number, h:number, x2?:number, y2?:number, w2?:number, h2?:number):void;
|
||||
stroke():void;
|
||||
fill():void;
|
||||
translate(x:number, y:number):void;
|
||||
measureText(text:string):number;
|
||||
};
|
||||
|
||||
// jsPDF plugin: fromHTML
|
||||
fromHTML(HTML:string | HTMLElement, x:number, y:number, settings?:any, callback?:Function, margins?:any):jsPDF;
|
||||
// jsPDF plugin: fromHTML
|
||||
fromHTML(HTML:string | HTMLElement, x:number, y:number, settings?:any, callback?:Function, margins?:any):jsPDF;
|
||||
|
||||
// jsPDF plugin: JavaScript
|
||||
addJS(txt:string):jsPDF;
|
||||
// jsPDF plugin: JavaScript
|
||||
addJS(txt:string):jsPDF;
|
||||
|
||||
// jsPDF plugin: PNG
|
||||
processPNG(imageData:any, imageIndex:number, alias:string, compression:any, dataAsBinaryString:string):any;
|
||||
// jsPDF plugin: PNG
|
||||
processPNG(imageData:any, imageIndex:number, alias:string, compression:any, dataAsBinaryString:string):any;
|
||||
|
||||
// jsPDF plugin: split_text_to_size
|
||||
getCharWidthsArray(text:string, options?:any):any[];
|
||||
getStringUnitWidth(text:string, options?:any):number;
|
||||
splitTextToSize(text:string, maxlen:number, options?:any):any;
|
||||
// jsPDF plugin: split_text_to_size
|
||||
getCharWidthsArray(text:string, options?:any):any[];
|
||||
getStringUnitWidth(text:string, options?:any):number;
|
||||
splitTextToSize(text:string, maxlen:number, options?:any):any;
|
||||
|
||||
// jsPDF plugin: SVG
|
||||
addSVG(svgtext:string, x:number, y:number, w?:number, h?:number):jsPDF;
|
||||
// jsPDF plugin: SVG
|
||||
addSVG(svgtext:string, x:number, y:number, w?:number, h?:number):jsPDF;
|
||||
|
||||
// jsPDF plugin: total_pages
|
||||
putTotalPages(pageExpression:string):jsPDF;
|
||||
// jsPDF plugin: total_pages
|
||||
putTotalPages(pageExpression:string):jsPDF;
|
||||
}
|
||||
|
||||
namespace jsPDF {}
|
||||
|
||||
export = jsPDF;
|
||||
}
|
||||
|
||||
Vendored
+15
-2
@@ -1,8 +1,8 @@
|
||||
// Type definitions for jsTree v3.3.1
|
||||
// Type definitions for jsTree v3.3.2
|
||||
// Project: http://www.jstree.com/
|
||||
// Definitions by: Adam Pluciński <https://github.com/adaskothebeast>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// 1 commit 3b8f55d3797cd299eb36695b62d75c2313a3e3b3 2016-05-10
|
||||
// 1 commit bb0473ae8cfc205585b6404ef86f650df2f6996e 2016-08-15
|
||||
|
||||
///<reference path="../jquery/jquery.d.ts" />
|
||||
|
||||
@@ -465,6 +465,7 @@ interface JSTreeStaticDefaultsContextMenu {
|
||||
* * `separator_after` - a boolean indicating if there should be a separator after this item
|
||||
* * `_disabled` - a boolean indicating if this action should be disabled
|
||||
* * `label` - a string - the name of the action (could be a function returning a string)
|
||||
* * `title` - a string - an optional tooltip for the item
|
||||
* * `action` - a function to be executed if this item is chosen, the function will receive
|
||||
* * `icon` - a string, can be a path to an icon or a className, if using an image that is in the current directory use a `./` prefix, otherwise it will be detected as a class
|
||||
* * `shortcut` - keyCode which will trigger the action if the menu is open (for example `113` for rename, which equals F2)
|
||||
@@ -1339,6 +1340,8 @@ interface JSTree extends JQuery {
|
||||
* @param {Boolean} options.no_id do not return ID
|
||||
* @param {Boolean} options.no_children do not include children
|
||||
* @param {Boolean} options.no_data do not include node data
|
||||
* @param {Boolean} options.no_li_attr do not include LI attributes
|
||||
* @param {Boolean} options.no_a_attr do not include A attributes
|
||||
* @param {Boolean} options.flat return flat JSON instead of nested
|
||||
* @return {Object}
|
||||
*/
|
||||
@@ -1882,6 +1885,16 @@ interface JSTreeGetJsonOptions {
|
||||
*/
|
||||
no_data: boolean;
|
||||
|
||||
/**
|
||||
* do not include LI attributes
|
||||
*/
|
||||
no_li_attr: boolean;
|
||||
|
||||
/**
|
||||
* do not include A attributes
|
||||
*/
|
||||
no_a_attr: boolean;
|
||||
|
||||
/**
|
||||
* return flat JSON instead of nested
|
||||
*/
|
||||
|
||||
Vendored
+1
-1
@@ -3,7 +3,7 @@
|
||||
// Definitions by: Tanguy Krotoff <https://github.com/tkrotoff>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../bluebird/bluebird.d.ts" />
|
||||
/// <reference path="../bluebird/bluebird-2.0.d.ts" />
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
/// <reference path="../log4js/log4js.d.ts" />
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -3,7 +3,7 @@
|
||||
// Definitions by: Qubo <https://github.com/tkQubo>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../bluebird/bluebird.d.ts" />
|
||||
/// <reference path="../bluebird/bluebird-2.0.d.ts" />
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module "knex" {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/// <reference path="..\node\node.d.ts" />
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
/// <reference path="libxmljs.d.ts" />
|
||||
|
||||
var libxmljs = require("libxmljs");
|
||||
|
||||
Vendored
+1
-1
@@ -5,7 +5,7 @@
|
||||
|
||||
// Modified from the node.js definitions https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/node/node.d.ts
|
||||
|
||||
/// <reference path="../bluebird/bluebird.d.ts" />
|
||||
/// <reference path="../bluebird/bluebird-2.0.d.ts" />
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
|
||||
|
||||
@@ -43,8 +43,7 @@ namespace NavigationTests {
|
||||
}
|
||||
|
||||
// Navigation Event
|
||||
var navigationListener =
|
||||
(oldState: Navigation.State, state: Navigation.State, data: any) => {
|
||||
var navigationListener = (oldState: Navigation.State, state: Navigation.State, data: any, asyncData: any) => {
|
||||
stateNavigator.offNavigate(navigationListener);
|
||||
};
|
||||
stateNavigator.onNavigate(navigationListener);
|
||||
|
||||
Vendored
+3
-3
@@ -113,7 +113,7 @@ declare namespace Navigation {
|
||||
* @param data The current NavigationData
|
||||
* @param asyncData The data passed asynchronously while navigating
|
||||
*/
|
||||
navigated: (data: any, asyncData?: any) => void;
|
||||
navigated: (data: any, asyncData: any) => void;
|
||||
/**
|
||||
* Called on the new State before navigating to it
|
||||
* @param data The new NavigationData
|
||||
@@ -454,12 +454,12 @@ declare namespace Navigation {
|
||||
* Registers a navigate event listener
|
||||
* @param handler The navigate event listener
|
||||
*/
|
||||
onNavigate(handler: (oldState: State, state: State, data: any) => void): void;
|
||||
onNavigate(handler: (oldState: State, state: State, data: any, asyncData: any) => void): void;
|
||||
/**
|
||||
* Unregisters a navigate event listener
|
||||
* @param handler The navigate event listener
|
||||
*/
|
||||
offNavigate(handler: (oldState: State, state: State, data: any) => void): void;
|
||||
offNavigate(handler: (oldState: State, state: State, data: any, asyncData: any) => void): void;
|
||||
/**
|
||||
* Navigates to a State
|
||||
* @param stateKey The key of a State
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
/// <reference path="node-forge.d.ts" />
|
||||
|
||||
import * as forge from "node-forge";
|
||||
|
||||
let keypair = forge.pki.rsa.generateKeyPair({bits: 512});
|
||||
let privateKeyPem = forge.pki.privateKeyToPem(keypair.privateKey);
|
||||
let publicKeyPem = forge.pki.publicKeyToPem(keypair.publicKey);
|
||||
Vendored
+40
@@ -0,0 +1,40 @@
|
||||
// Type definitions for node-forge 0.6.42
|
||||
// Project: https://github.com/digitalbazaar/forge
|
||||
// Definitions by: Seth Westphal <https://github.com/westy92>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module "node-forge" {
|
||||
|
||||
export namespace pki {
|
||||
|
||||
export type PEM = string;
|
||||
export type Key = any;
|
||||
|
||||
export interface KeyPair {
|
||||
publicKey: Key;
|
||||
privateKey: Key;
|
||||
}
|
||||
|
||||
export function privateKeyToPem(key: Key, maxline?: number): PEM;
|
||||
export function publicKeyToPem(key: Key, maxline?: number): PEM;
|
||||
|
||||
export namespace rsa {
|
||||
|
||||
export interface GenerateKeyPairOptions {
|
||||
bits?: number;
|
||||
e?: number;
|
||||
workerScript?: string;
|
||||
workers?: number;
|
||||
workLoad?: number;
|
||||
prng?: any;
|
||||
algorithm?: string;
|
||||
}
|
||||
|
||||
export function generateKeyPair(bits?: number, e?: number, callback?: (err: Error, keypair: KeyPair) => void): KeyPair;
|
||||
export function generateKeyPair(options?: GenerateKeyPairOptions, callback?: (err: Error, keypair: KeyPair) => void): KeyPair;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/// <reference path="./node-mysql-wrapper.d.ts" />
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
/// <reference path="../bluebird/bluebird.d.ts" />
|
||||
/// <reference path="../bluebird/bluebird-2.0.d.ts" />
|
||||
|
||||
var express = require('express');
|
||||
var app = express();
|
||||
@@ -40,7 +40,7 @@ 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) => {
|
||||
@@ -65,7 +65,7 @@ db.ready(() => {
|
||||
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()
|
||||
}).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 ");
|
||||
@@ -103,7 +103,7 @@ db.ready(() => {
|
||||
}
|
||||
|
||||
}, (_users) => {
|
||||
|
||||
|
||||
console.log("---------------TEST 6----------------------------------------");
|
||||
_users.forEach(_user=> {
|
||||
console.log(_user.userId + " " + _user.username + " found with " + _user.comments.length + " comments");
|
||||
@@ -112,55 +112,55 @@ db.ready(() => {
|
||||
|
||||
});
|
||||
//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")
|
||||
.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")
|
||||
.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:{
|
||||
|
||||
tableRules:{
|
||||
orderByDesc: 'userId',
|
||||
except: ['password']
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
usersDb.find(_criteriaFromBuilder).then(_users=> {
|
||||
|
||||
+85
-85
@@ -3,8 +3,8 @@
|
||||
// Definitions by: Makis Maropoulos <https://github.com/kataras>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
///<reference path='./../mysql/mysql.d.ts' />
|
||||
///<reference path='./../bluebird/bluebird.d.ts' />
|
||||
///<reference path='../mysql/mysql.d.ts' />
|
||||
///<reference path='../bluebird/bluebird-2.0.d.ts' />
|
||||
///<reference path="./my-meteor.d.ts" />
|
||||
|
||||
|
||||
@@ -53,26 +53,26 @@ declare module "node-mysql-wrapper" {
|
||||
|
||||
|
||||
class Helper {
|
||||
/**
|
||||
/**
|
||||
* Callback like forEach
|
||||
* @name valueCallback
|
||||
* @function
|
||||
* @param {T} the value of the object's key
|
||||
* @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
|
||||
* @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.
|
||||
@@ -80,7 +80,7 @@ declare module "node-mysql-wrapper" {
|
||||
* @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.
|
||||
@@ -88,7 +88,7 @@ declare module "node-mysql-wrapper" {
|
||||
* @return {string}
|
||||
*/
|
||||
static toObjectProperty(columnKey: string): string;
|
||||
|
||||
|
||||
/**
|
||||
* Converts anyString to any_string and returns it.
|
||||
* @param {string} objectKey the string you want to convert.
|
||||
@@ -96,7 +96,7 @@ declare module "node-mysql-wrapper" {
|
||||
* @return {string}
|
||||
*/
|
||||
static toRowProperty(objectKey: string): string;
|
||||
|
||||
|
||||
/**
|
||||
* Iterate object's keys and return their values to the callback.
|
||||
* @param {<T>} map the object.
|
||||
@@ -115,14 +115,14 @@ declare module "node-mysql-wrapper" {
|
||||
*/
|
||||
|
||||
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
|
||||
@@ -145,24 +145,24 @@ declare module "node-mysql-wrapper" {
|
||||
|
||||
|
||||
class CriteriaParts implements ICriteriaParts {
|
||||
|
||||
|
||||
/**
|
||||
* The raw format of the criteria eg: {yearsOld:22}.
|
||||
*/
|
||||
rawCriteriaObject: any;
|
||||
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* The converted/exported where clause.
|
||||
*/
|
||||
whereClause: string;
|
||||
|
||||
@@ -174,7 +174,7 @@ declare module "node-mysql-wrapper" {
|
||||
class CriteriaDivider<T> {
|
||||
private _table;
|
||||
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}.
|
||||
@@ -198,7 +198,7 @@ declare module "node-mysql-wrapper" {
|
||||
static build(): SelectQueryRules;
|
||||
private last(propertyClauseName);
|
||||
except(...columns: string[]): SelectQueryRules;
|
||||
|
||||
|
||||
/**
|
||||
* Same as .except(...columns)
|
||||
*/
|
||||
@@ -236,7 +236,7 @@ declare module "node-mysql-wrapper" {
|
||||
constructor(primaryTable: Table<T>, tablePropertyName?: string, parentBuilder?: CriteriaBuilder<any>);
|
||||
|
||||
except(...columns: string[]): CriteriaBuilder<T>;
|
||||
|
||||
|
||||
/**
|
||||
* Same as .except(...columns)
|
||||
*/
|
||||
@@ -259,7 +259,7 @@ declare module "node-mysql-wrapper" {
|
||||
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.
|
||||
*/
|
||||
@@ -270,7 +270,7 @@ declare module "node-mysql-wrapper" {
|
||||
}
|
||||
|
||||
class SelectQuery<T> implements IQuery<T> { // T for Table's result type.
|
||||
|
||||
|
||||
_table: Table<T>
|
||||
constructor(_table: Table<T>);
|
||||
|
||||
@@ -315,7 +315,7 @@ declare module "node-mysql-wrapper" {
|
||||
static RESERVED_PROPERTY_NAMES: string[];
|
||||
|
||||
private propertyChangedListeners: PropertyChangedCallback[];
|
||||
|
||||
|
||||
/** Make the obj observable. Used in constructor or extend this class and use it. */
|
||||
private makeObservable(obj: any): void;
|
||||
|
||||
@@ -324,7 +324,7 @@ declare module "node-mysql-wrapper" {
|
||||
|
||||
/**Add a listener/observer to watch for changes in this object's properties */
|
||||
onPropertyChanged(listener: PropertyChangedCallback): void;
|
||||
|
||||
|
||||
/** If developer wants manualy notify for property changed */
|
||||
notifyPropertyChanged(propertyName: string, oldValue: any): void;
|
||||
|
||||
@@ -388,7 +388,7 @@ declare module "node-mysql-wrapper" {
|
||||
findById(id: number | string, callback?: (result: T) => any): Promise<T>;
|
||||
|
||||
findAll(tableRules?: RawRules, callback?: (_results: T[]) => any): Promise<T[]>;
|
||||
|
||||
|
||||
/**
|
||||
* .insert() and .update() do the same thing: .save();
|
||||
*/
|
||||
@@ -399,7 +399,7 @@ declare module "node-mysql-wrapper" {
|
||||
save(criteriaRawJsObject: any, callback?: (_result: any) => any): Promise<T | any>;
|
||||
|
||||
remove(criteriaOrID: any | number | string, callback?: (_result: DeleteAnswer) => any): Promise<DeleteAnswer>;
|
||||
|
||||
|
||||
/**
|
||||
* same thing as .remove();
|
||||
*/
|
||||
@@ -423,7 +423,7 @@ declare module "node-mysql-wrapper" {
|
||||
fillAll(): void;
|
||||
|
||||
fillOne(criteriaRawJsObject: any): void;
|
||||
|
||||
|
||||
//ONLY MONGO/METEOR COLLECTION METHODS START
|
||||
allow(options: {
|
||||
insert?: (userId: string, doc: T) => boolean;
|
||||
@@ -457,36 +457,36 @@ declare module "node-mysql-wrapper" {
|
||||
reactive?: boolean;
|
||||
transform?: Function;
|
||||
}): T;
|
||||
|
||||
|
||||
//ONLY MONGO/METEOR COLLECTION METHODS FINISH.
|
||||
|
||||
}
|
||||
|
||||
|
||||
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}.
|
||||
* Force to fetch ONLY these Database table names {array of string}.
|
||||
*/
|
||||
tableNamesToUseOnly: any[];
|
||||
|
||||
|
||||
/**
|
||||
* All tables {MysqlTable} inside this connection's database.
|
||||
*/
|
||||
tables: Table<any>[];
|
||||
|
||||
constructor(connection: string | Mysql.IConnection | Mysql.IConnectionConfig);
|
||||
|
||||
|
||||
/**
|
||||
* Creates the MysqlConnection from the connection url or the real connection object.
|
||||
* @param {string | Mysql.IConnection | Mysql.IConnectionConfig} connection the connection url or the real connection object.
|
||||
@@ -494,36 +494,36 @@ declare module "node-mysql-wrapper" {
|
||||
* @return {nothing}
|
||||
*/
|
||||
create(connection: string | Mysql.IConnection | Mysql.IConnectionConfig): void;
|
||||
|
||||
|
||||
/**
|
||||
* Attach a real connection.
|
||||
* @param {Mysql.IConnection} connection the real connection object.
|
||||
* @returnType {nothing}
|
||||
* @return {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}
|
||||
* @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.
|
||||
* the difference from the 'end' is that this method doesn't care about errors so no callback passing here.
|
||||
*/
|
||||
destroy(): void;
|
||||
|
||||
|
||||
/**
|
||||
* Clear all binary logs from the whole database.
|
||||
* When finish returns a promise, use it with .then(function(){});
|
||||
* @return Promise
|
||||
*/
|
||||
clearBinaryLogs(): Promise<void>;
|
||||
|
||||
|
||||
/**
|
||||
* Link the real connection with this MysqlConnection object.
|
||||
* @param {function} readyCallback when the link operation is done this callback is executed.
|
||||
@@ -531,7 +531,7 @@ declare module "node-mysql-wrapper" {
|
||||
* @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}
|
||||
@@ -539,22 +539,22 @@ declare module "node-mysql-wrapper" {
|
||||
* @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}
|
||||
*/
|
||||
fetchDatabaseInformation(): Promise<void>;
|
||||
|
||||
|
||||
/**
|
||||
* Escape the query column's value and return it.
|
||||
* @param {string} val the value which will be escaped.
|
||||
* @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.
|
||||
@@ -564,40 +564,40 @@ declare module "node-mysql-wrapper" {
|
||||
* @return {nothing}
|
||||
*/
|
||||
notice(tableWhichCalled: string, queryStr: string, rawRows: 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 rawRows (results after query executed and before parsed to object(s)).
|
||||
* @param {function} callback Callback which has one parameter(typeof any[]) which filled by the rawRows (results after query executed and before parsed to object(s)).
|
||||
* @returnType {nothing}
|
||||
* @return {nothing}
|
||||
*/
|
||||
watch(tableName: string, evtType: any, callback: (rawRows: 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} 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: (rawResults: 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}
|
||||
* @return {nothing}
|
||||
*/
|
||||
query(queryStr: string, callback: (err: Mysql.IError, results: any) => any, queryArguments?: any[]): void;
|
||||
|
||||
|
||||
/**
|
||||
* 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).
|
||||
* 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}
|
||||
@@ -606,7 +606,7 @@ declare module "node-mysql-wrapper" {
|
||||
}
|
||||
|
||||
class Table<T> {
|
||||
/** Private keywords here are useless but I put them.
|
||||
/** Private keywords here are useless but I put them.
|
||||
* If the developer wants to see the properties of the Table class, he/she just comes here.
|
||||
*/
|
||||
|
||||
@@ -622,55 +622,55 @@ declare module "node-mysql-wrapper" {
|
||||
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.
|
||||
* The MysqlConnection object which this MysqlTable belongs.
|
||||
*/
|
||||
connection: Connection;
|
||||
|
||||
|
||||
/**
|
||||
* The real database name of the table. Autofilled by library.
|
||||
* 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.
|
||||
* 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 rawResults (results after query executed and before exports to object(s)).
|
||||
* @param {function} callback Callback which has one parameter(typeof any[]) which filled by the rawResults (results after query executed and before exports to object(s)).
|
||||
* @returnType {nothing}
|
||||
* @return {nothing}
|
||||
*/
|
||||
on(evtType: string, callback: (rawResults: 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".
|
||||
@@ -679,7 +679,7 @@ declare module "node-mysql-wrapper" {
|
||||
* @return {nothing}
|
||||
*/
|
||||
off(evtType: string, callbackToRemove: (rawResults: 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.
|
||||
@@ -687,16 +687,16 @@ declare module "node-mysql-wrapper" {
|
||||
* @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}
|
||||
* @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.
|
||||
@@ -704,7 +704,7 @@ declare module "node-mysql-wrapper" {
|
||||
* @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.
|
||||
@@ -712,7 +712,7 @@ declare module "node-mysql-wrapper" {
|
||||
* @return {any}
|
||||
*/
|
||||
rowFromObject(obj: any): any;
|
||||
|
||||
|
||||
/**
|
||||
* Returns and array of [columns[],values[]]
|
||||
* @param {any} jsObject the raw row object.
|
||||
@@ -720,7 +720,7 @@ declare module "node-mysql-wrapper" {
|
||||
* @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.
|
||||
@@ -728,11 +728,11 @@ declare module "node-mysql-wrapper" {
|
||||
* @return {number | string}
|
||||
*/
|
||||
getPrimaryKeyValue(jsObject: any): number | string;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
find(criteriaRawJsObject: any): Promise<T[]>; // only criteria
|
||||
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[]>;
|
||||
|
||||
@@ -778,7 +778,7 @@ declare module "node-mysql-wrapper" {
|
||||
constructor(connection?: Connection);
|
||||
static when(..._promises: Promise<any>[]): Promise<any>;
|
||||
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}
|
||||
@@ -793,18 +793,18 @@ declare module "node-mysql-wrapper" {
|
||||
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.
|
||||
* 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}
|
||||
* @return {nothing}
|
||||
*/
|
||||
end(maybeAcallbackError: (err: any) => void): void;
|
||||
|
||||
@@ -820,7 +820,7 @@ declare module "node-mysql-wrapper" {
|
||||
}
|
||||
|
||||
function wrap(mysqlUrlOrObjectOrMysqlAlreadyConnection: Mysql.IConnection | string, ...useTables: any[]): Database;
|
||||
|
||||
|
||||
/** For meteor js only
|
||||
* Same as wrap but it's sync mode - autoconnect to the database without need to use database.ready(callback).
|
||||
*/
|
||||
|
||||
Vendored
+17
-9
@@ -257,8 +257,8 @@ declare namespace NodeJS {
|
||||
readable: boolean;
|
||||
read(size?: number): string | Buffer;
|
||||
setEncoding(encoding: string): void;
|
||||
pause(): void;
|
||||
resume(): void;
|
||||
pause(): ReadableStream;
|
||||
resume(): ReadableStream;
|
||||
pipe<T extends WritableStream>(destination: T, options?: { end?: boolean; }): T;
|
||||
unpipe<T extends WritableStream>(destination?: T): void;
|
||||
unshift(chunk: string): void;
|
||||
@@ -276,7 +276,10 @@ declare namespace NodeJS {
|
||||
end(str: string, encoding?: string, cb?: Function): void;
|
||||
}
|
||||
|
||||
export interface ReadWriteStream extends ReadableStream, WritableStream { }
|
||||
export interface ReadWriteStream extends ReadableStream, WritableStream {
|
||||
pause(): ReadWriteStream;
|
||||
resume(): ReadWriteStream;
|
||||
}
|
||||
|
||||
export interface Events extends EventEmitter { }
|
||||
|
||||
@@ -1281,8 +1284,8 @@ declare module "net" {
|
||||
setEncoding(encoding?: string): void;
|
||||
write(data: any, encoding?: string, callback?: Function): void;
|
||||
destroy(): void;
|
||||
pause(): void;
|
||||
resume(): void;
|
||||
pause(): Socket;
|
||||
resume(): Socket;
|
||||
setTimeout(timeout: number, callback?: Function): void;
|
||||
setNoDelay(noDelay?: boolean): void;
|
||||
setKeepAlive(enable?: boolean, initialDelay?: number): void;
|
||||
@@ -1418,6 +1421,7 @@ declare module "fs" {
|
||||
export interface WriteStream extends stream.Writable {
|
||||
close(): void;
|
||||
bytesWritten: number;
|
||||
path: string | Buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2184,8 +2188,8 @@ declare module "stream" {
|
||||
_read(size: number): void;
|
||||
read(size?: number): any;
|
||||
setEncoding(encoding: string): void;
|
||||
pause(): void;
|
||||
resume(): void;
|
||||
pause(): Readable;
|
||||
resume(): Readable;
|
||||
pipe<T extends NodeJS.WritableStream>(destination: T, options?: { end?: boolean; }): T;
|
||||
unpipe<T extends NodeJS.WritableStream>(destination?: T): void;
|
||||
unshift(chunk: any): void;
|
||||
@@ -2220,6 +2224,10 @@ declare module "stream" {
|
||||
|
||||
// Note: Duplex extends both Readable and Writable.
|
||||
export class Duplex extends Readable implements NodeJS.ReadWriteStream {
|
||||
// Readable
|
||||
pause(): Duplex;
|
||||
resume(): Duplex;
|
||||
// Writeable
|
||||
writable: boolean;
|
||||
constructor(opts?: DuplexOptions);
|
||||
_write(chunk: any, encoding: string, callback: Function): void;
|
||||
@@ -2244,8 +2252,8 @@ declare module "stream" {
|
||||
_flush(callback: Function): void;
|
||||
read(size?: number): any;
|
||||
setEncoding(encoding: string): void;
|
||||
pause(): void;
|
||||
resume(): void;
|
||||
pause(): Transform;
|
||||
resume(): Transform;
|
||||
pipe<T extends NodeJS.WritableStream>(destination: T, options?: { end?: boolean; }): T;
|
||||
unpipe<T extends NodeJS.WritableStream>(destination?: T): void;
|
||||
unshift(chunk: any): void;
|
||||
|
||||
Vendored
+3
-3
@@ -3,7 +3,7 @@
|
||||
// Definitions by: Rogier Schouten <https://github.com/rogierschouten/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../bluebird/bluebird.d.ts" />
|
||||
/// <reference path="../bluebird/bluebird-2.0.d.ts" />
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
/// <reference path="../nodemailer-direct-transport/nodemailer-direct-transport.d.ts" />
|
||||
/// <reference path="../nodemailer-smtp-transport/nodemailer-smtp-transport.d.ts" />
|
||||
@@ -45,7 +45,7 @@ declare module "nodemailer" {
|
||||
* Send mail using a template.
|
||||
*/
|
||||
templateSender(template?: any, defaults?: any): (mailData: any, context: any) => Promise<SentMessageInfo>;
|
||||
|
||||
|
||||
/**
|
||||
* Send mail using a template with a callback.
|
||||
*/
|
||||
@@ -59,7 +59,7 @@ declare module "nodemailer" {
|
||||
* @param pluginFunc is a function that takes two arguments: the mail object and a callback function
|
||||
*/
|
||||
use(step: string, plugin: Plugin): void;
|
||||
|
||||
|
||||
/**
|
||||
* Verifies connection with server
|
||||
*/
|
||||
|
||||
Vendored
+1
-1
@@ -5,7 +5,7 @@
|
||||
// Developed with love in www.nowcando.com
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
/// <reference path="../bluebird/bluebird.d.ts" />
|
||||
/// <reference path="../bluebird/bluebird-2.0.d.ts" />
|
||||
|
||||
/* =================== USAGE ===================
|
||||
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/// <reference path="pify.d.ts" />
|
||||
/// <reference path="../bluebird/bluebird.d.ts" />
|
||||
/// <reference path="../bluebird/bluebird-2.0.d.ts" />
|
||||
|
||||
import * as pify from 'pify';
|
||||
import * as Bluebird from 'bluebird';
|
||||
@@ -28,4 +28,4 @@ const fsP = pify(fs);
|
||||
fsP.readFile('foo.txt').then((result: string) => assert(result, 'foo'));
|
||||
|
||||
pify(fs.readFile)('foo.txt').then((result: string) => assert(result, 'foo'));
|
||||
pify(fs.readFile, Bluebird)('bar.txt').then((result: string) => assert(result, 'bar'));
|
||||
pify(fs.readFile, Bluebird)('bar.txt').then((result: string) => assert(result, 'bar'));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///<reference path='project-oxford.d.ts' />
|
||||
/// <reference path="../bluebird/bluebird.d.ts" />
|
||||
/// <reference path="../bluebird/bluebird-2.0.d.ts" />
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
/// <reference path="../mocha/mocha.d.ts" />
|
||||
|
||||
|
||||
Vendored
+2
-2
@@ -3,8 +3,8 @@
|
||||
// Definitions by: Scott Southwood <https://github.com/scsouthw/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="..\bluebird\bluebird.d.ts" />
|
||||
/// <reference path="..\node\node.d.ts" />
|
||||
/// <reference path="../bluebird/bluebird-2.0.d.ts" />
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module "project-oxford" {
|
||||
import Promise = require("bluebird");
|
||||
|
||||
Vendored
+1
-1
@@ -40,7 +40,7 @@ declare module __ReactDnd {
|
||||
spec: DragSourceSpec<P>,
|
||||
collect: DragSourceCollector,
|
||||
options?: DndOptions<P>
|
||||
): (componentClass: React.ComponentClass<P>) => DndComponentClass<P>;
|
||||
): (componentClass: React.ComponentClass<P> | React.StatelessComponent<P>) => DndComponentClass<P>;
|
||||
|
||||
export function DropTarget<P>(
|
||||
types: Identifier | Identifier[] | ((props: P) => Identifier | Identifier[]),
|
||||
|
||||
Vendored
+5
@@ -9,6 +9,11 @@ declare namespace __ReactFlex {
|
||||
export import React = __React;
|
||||
|
||||
interface CommonFlexProps {
|
||||
/**
|
||||
* For custom style
|
||||
*/
|
||||
style?: any;
|
||||
|
||||
/**
|
||||
* For `display: inline-flex`.
|
||||
*/
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
import * as React from "react"
|
||||
import * as ReactDOM from "react-dom"
|
||||
|
||||
import { browserHistory, hashHistory, createMemoryHistory, Router, Route, IndexRoute, Link} from "react-router"
|
||||
import { browserHistory, hashHistory, createMemoryHistory, withRouter, Router, Route, IndexRoute, Link} from "react-router"
|
||||
import { routerShape, locationShape } from "react-router/lib/PropTypes"
|
||||
|
||||
interface MasterContext {
|
||||
@@ -42,8 +42,21 @@ class Master extends React.Component<React.Props<{}>, {}> {
|
||||
|
||||
}
|
||||
|
||||
interface DashboardProps {
|
||||
router: ReactRouter.InjectedRouter
|
||||
};
|
||||
|
||||
class Dashboard extends React.Component<{}, {}> {
|
||||
class Dashboard extends React.Component<DashboardProps, {}> {
|
||||
|
||||
navigate() {
|
||||
var router = this.props.router;
|
||||
router.push("/users");
|
||||
router.push({
|
||||
pathname: "/users/12",
|
||||
query: { modal: true },
|
||||
state: { fromDashboard: true }
|
||||
});
|
||||
}
|
||||
|
||||
render() {
|
||||
return <div>
|
||||
@@ -53,6 +66,8 @@ class Dashboard extends React.Component<{}, {}> {
|
||||
|
||||
}
|
||||
|
||||
const DashboardWithRouter = withRouter(Dashboard)
|
||||
|
||||
class NotFound extends React.Component<{}, {}> {
|
||||
|
||||
render() {
|
||||
@@ -78,7 +93,7 @@ class Users extends React.Component<{}, {}> {
|
||||
ReactDOM.render((
|
||||
<Router history={hashHistory}>
|
||||
<Route path="/" component={Master}>
|
||||
<IndexRoute component={Dashboard} />
|
||||
<IndexRoute component={DashboardWithRouter} />
|
||||
<Route path="users" component={Users}/>
|
||||
<Route path="*" component={NotFound}/>
|
||||
</Route>
|
||||
|
||||
Vendored
+30
-2
@@ -1,6 +1,6 @@
|
||||
// Type definitions for react-router v2.0.0
|
||||
// Project: https://github.com/rackt/react-router
|
||||
// Definitions by: Sergey Buturlakin <https://github.com/sergey-buturlakin>, Yuichi Murata <https://github.com/mrk21>, Václav Ostrožlík <https://github.com/vasek17>, Nathan Brown <https://github.com/ngbrown>
|
||||
// Definitions by: Sergey Buturlakin <https://github.com/sergey-buturlakin>, Yuichi Murata <https://github.com/mrk21>, Václav Ostrožlík <https://github.com/vasek17>, Nathan Brown <https://github.com/ngbrown>, Alex Wendland <https://github.com/awendland>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
|
||||
@@ -227,6 +227,27 @@ declare namespace ReactRouter {
|
||||
|
||||
const RouteContext: React.Mixin<any, any>
|
||||
|
||||
/* Higher Order Component */
|
||||
|
||||
// Wrap a component using withRouter(Component) to provide a router object
|
||||
// to the Component's props, allowing the Component to programmatically call
|
||||
// push and other functions.
|
||||
//
|
||||
// https://github.com/reactjs/react-router/blob/v2.4.0/upgrade-guides/v2.4.0.md
|
||||
|
||||
interface InjectedRouter {
|
||||
push: (pathOrLoc: H.LocationDescriptor) => void
|
||||
replace: (pathOrLoc: H.LocationDescriptor) => void
|
||||
go: (n: number) => void
|
||||
goBack: () => void
|
||||
goForward: () => void
|
||||
setRouteLeaveHook(route: PlainRoute, callback: RouteHook): void
|
||||
createPath(path: H.Path, query?: H.Query): H.Path
|
||||
createHref(path: H.Path, query?: H.Query): H.Href
|
||||
isActive: (pathOrLoc: H.LocationDescriptor, indexOnly?: boolean) => boolean
|
||||
}
|
||||
|
||||
function withRouter<C extends React.ComponentClass<any>>(component: C): C
|
||||
|
||||
/* utils */
|
||||
|
||||
@@ -423,6 +444,10 @@ declare module "react-router/lib/createMemoryHistory" {
|
||||
export default ReactRouter.createMemoryHistory;
|
||||
}
|
||||
|
||||
declare module "react-router/lib/withRouter" {
|
||||
export default ReactRouter.withRouter;
|
||||
}
|
||||
|
||||
declare module "react-router" {
|
||||
|
||||
import Router from "react-router/lib/Router"
|
||||
@@ -465,6 +490,8 @@ declare module "react-router" {
|
||||
|
||||
import createMemoryHistory from "react-router/lib/createMemoryHistory";
|
||||
|
||||
import withRouter from "react-router/lib/withRouter";
|
||||
|
||||
// PlainRoute is defined in the API documented at:
|
||||
// https://github.com/rackt/react-router/blob/master/docs/API.md
|
||||
// but not included in any of the .../lib modules above.
|
||||
@@ -506,7 +533,8 @@ declare module "react-router" {
|
||||
PropTypes,
|
||||
match,
|
||||
useRouterHistory,
|
||||
createMemoryHistory
|
||||
createMemoryHistory,
|
||||
withRouter
|
||||
}
|
||||
|
||||
export default Router
|
||||
|
||||
Vendored
+7
-7
@@ -3,23 +3,23 @@
|
||||
// Definitions by: Ilya Mochalov <https://github.com/chrootsu>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../bluebird/bluebird.d.ts" />
|
||||
/// <reference path="../bluebird/bluebird-2.0.d.ts" />
|
||||
/// <reference path="../redis/redis.d.ts" />
|
||||
|
||||
|
||||
declare module "redlock" {
|
||||
|
||||
import * as redis from 'redis';
|
||||
import * as Promise from 'bluebird';
|
||||
|
||||
import * as Promise from 'bluebird';
|
||||
|
||||
namespace Redlock {
|
||||
|
||||
|
||||
interface Callback<T> {
|
||||
(err: any, value?: T): void;
|
||||
}
|
||||
|
||||
interface Lock {
|
||||
|
||||
|
||||
redlock: Redlock;
|
||||
resource: string;
|
||||
value: any;
|
||||
@@ -38,7 +38,7 @@ declare module "redlock" {
|
||||
|
||||
interface LockError extends Error {}
|
||||
}
|
||||
|
||||
|
||||
class Redlock {
|
||||
|
||||
driftFactor: number;
|
||||
@@ -59,6 +59,6 @@ declare module "redlock" {
|
||||
|
||||
extend(lock: Redlock.Lock, ttl: number, callback?: Redlock.Callback<Redlock.Lock>): Promise<Redlock.Lock>;
|
||||
}
|
||||
|
||||
|
||||
export = Redlock;
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -4,7 +4,7 @@
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../request/request.d.ts" />
|
||||
/// <reference path="../bluebird/bluebird.d.ts" />
|
||||
/// <reference path="../bluebird/bluebird-2.0.d.ts" />
|
||||
|
||||
declare module 'request-promise' {
|
||||
import request = require('request');
|
||||
|
||||
Vendored
+1
-1
@@ -4,7 +4,7 @@
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// Reference: http://www.rethinkdb.com/api/#js
|
||||
// TODO: Document manipulation and below
|
||||
///<reference path="../bluebird/bluebird.d.ts"/>
|
||||
///<reference path="../bluebird/bluebird-2.0.d.ts"/>
|
||||
|
||||
declare module "rethinkdb" {
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -6,7 +6,7 @@
|
||||
// Based on original work by: samuelneff <https://github.com/samuelneff/sequelize-auto-ts/blob/master/lib/sequelize.d.ts>
|
||||
|
||||
/// <reference path='../lodash/lodash.d.ts' />
|
||||
/// <reference path="../bluebird/bluebird.d.ts" />
|
||||
/// <reference path="../bluebird/bluebird-2.0.d.ts" />
|
||||
/// <reference path="../validator/validator.d.ts" />
|
||||
|
||||
declare module "sequelize" {
|
||||
|
||||
Vendored
+1
-1
@@ -3,7 +3,7 @@
|
||||
// Definitions by: Riderman de Sousa Barbosa <https://github.com/ridermansb/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="..\promises-a-plus\promises-a-plus.d.ts"/>
|
||||
/// <reference path="../promises-a-plus/promises-a-plus.d.ts"/>
|
||||
|
||||
declare namespace Stamplay {
|
||||
|
||||
|
||||
Vendored
+1389
-1389
File diff suppressed because it is too large
Load Diff
Vendored
+1
-1
@@ -3,7 +3,7 @@
|
||||
// Definitions by: Ivan Drinchev <https://github.com/drinchev/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../bluebird/bluebird.d.ts" />
|
||||
/// <reference path="../bluebird/bluebird-2.0.d.ts" />
|
||||
/// <reference path="../sequelize/sequelize.d.ts" />
|
||||
|
||||
declare module "umzug" {
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
/// <reference path="wallabyjs.d.ts" />
|
||||
|
||||
import * as wallabyjs from 'wallabyjs';
|
||||
|
||||
export class WallabyConfig implements wallabyjs.IWallabyConfig {
|
||||
|
||||
public files: string[] = [
|
||||
'src/**/*.ts',
|
||||
'!src/**/*.spec.ts'
|
||||
];
|
||||
|
||||
public tests: string[] = [
|
||||
'src/**/*.spec.ts'
|
||||
];
|
||||
|
||||
public compilers: wallabyjs.IWallabyCompiler = <wallabyjs.IWallabyCompiler>{
|
||||
'src/**/*.js': this.wallaby.compilers.babel({}),
|
||||
'src/**/*.ts': this.wallaby.compilers.typeScript({})
|
||||
};
|
||||
|
||||
public preprocessors: wallabyjs.IWallabyProcessor = <wallabyjs.IWallabyProcessor>{
|
||||
'**/*.js': file => file.content + '\n// this is JavaScript',
|
||||
'**/*.ts': file => file.content + '\n// this is TypeScript'
|
||||
};
|
||||
|
||||
public postprocessors: wallabyjs.IWallabyProcessor = <wallabyjs.IWallabyProcessor>{
|
||||
'**/*.js': file => file.content + '\n// this is JavaScript',
|
||||
'**/*.ts': file => file.content + '\n// this is TypeScript'
|
||||
};
|
||||
|
||||
public env: wallabyjs.IWallabyEnvironment = <wallabyjs.IWallabyEnvironment>{
|
||||
type: 'node',
|
||||
params: {
|
||||
env: 'KEY1=value1;KEY2=value2',
|
||||
runner: '--arg1;--arg2;'
|
||||
}
|
||||
};
|
||||
|
||||
constructor(private wallaby: any) { }
|
||||
}
|
||||
Vendored
+163
@@ -0,0 +1,163 @@
|
||||
// Type definitions for WallabyJS
|
||||
// Project: http://wallabyjs.com
|
||||
// Definitions by: Andrew Connell <http://www.andrewconnell.com>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module 'wallabyjs' {
|
||||
/**
|
||||
* Wallaby configuration settings.
|
||||
*
|
||||
* @interface
|
||||
*
|
||||
* @property {IWallabyCompiler=} compilers - File patterns as keys and compiler functions as values.
|
||||
* @property {boolean=} debug - Flag if debug messages written to Wallaby console (default=false).
|
||||
* @prooperty {IWallabyEnvironment=} env - Specify a different test runner or change the runner settings.
|
||||
* @property {string[] | IWallabyFilePattern[]} files - Specifies an array of source files or file name patterns to copy
|
||||
* to the local cache.
|
||||
* @property {Function=} postprocessor - Function that runs for every batch of file changes after all compilers and preprocessors.
|
||||
* @property {Function=} preprocessor - Function that runs for every batch of file changes after all compilers.
|
||||
* @property {string=} testFramework - Specifies the name and version of the testing framework you are using for your tests.
|
||||
* @property {string[] | IWallabyFilePattern[]} tests - Specifies an array of test files or test file name patterns to copy
|
||||
* to the local cache.
|
||||
* @property {IWallabyWorkers=} workers - Degree of parallelism used to run your tests and controls the way wallaby re-uses workers.
|
||||
*
|
||||
* @see {@link https://wallabyjs.com/docs/config/overview.html} for details.
|
||||
*/
|
||||
export interface IWallabyConfig {
|
||||
comilers?: IWallabyCompiler;
|
||||
debug?: boolean;
|
||||
env?: IWallabyEnvironment;
|
||||
files: string[] | IWallabyFilePattern[];
|
||||
postprocessor?: IWallabyProcessor;
|
||||
preprocessor?: IWallabyProcessor;
|
||||
testFramework?: string;
|
||||
tests: string[] | IWallabyFilePattern[];
|
||||
workers?: IWallabyWorkers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wallaby compiler configuration.
|
||||
*
|
||||
* @interface IWallabyCompiler
|
||||
*
|
||||
* @see {@link https://wallabyjs.com/docs/config/compilers.html} for details.
|
||||
*/
|
||||
export interface IWallabyCompiler {
|
||||
[pattern: string]: any
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Wallaby processor used in pre & post processors.
|
||||
*
|
||||
* @interface IWallabyProcessor
|
||||
*
|
||||
* @see {@link https://wallabyjs.com/docs/config/preprocessors.html} for details.
|
||||
*/
|
||||
export interface IWallabyProcessor {
|
||||
[pattern: string]: (file: IWallabyFile) => void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wallaby file object passed to pre & post processors.
|
||||
*
|
||||
* @interface IWallabyFile
|
||||
*
|
||||
* @property {string=} content - The current content of the file.
|
||||
* @property {string=} path - The current path to the file.
|
||||
* @function rename - Allows you to rename/move the file to newPath.
|
||||
* @function changeExt - Shortcut for the rename function allowing you to change the file extension.
|
||||
*
|
||||
* @see {@link https://wallabyjs.com/docs/config/preprocessors.html} for details.
|
||||
*/
|
||||
export interface IWallabyFile {
|
||||
content?: string;
|
||||
path?: string;
|
||||
rename(newPath: string): void;
|
||||
changeExt(newExt: string): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wallaby file pattern.
|
||||
*
|
||||
* @interface IWallabyFilePattern
|
||||
*
|
||||
* @property {string} pattern - File name or file pattern.
|
||||
* @property {boolean=} ignore - Used to completely exclude the file from Wallaby (default=false).
|
||||
* @property {boolean=} instrument - Determines if file is instrumented (default=true).
|
||||
* @property {boolean=} load - Determines if the file is loaded to sandbox HTML via script tag .(default=true).
|
||||
*
|
||||
* @see {@link https://wallabyjs.com/docs/config/files.html} for details.
|
||||
*/
|
||||
export interface IWallabyFilePattern {
|
||||
pattern: string;
|
||||
ignore?: boolean;
|
||||
instrument?: boolean;
|
||||
load?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wallaby environment configuration.
|
||||
*
|
||||
* @interface IWallabyEnvironment
|
||||
*
|
||||
* @property {IWallabyEnvironmentParameters=} params - set parameters on environment.
|
||||
* @property {string=} runner - Path of local Node / PhantomJs / Electron.
|
||||
* @property {string=} type - Specify a different test runner or change the runner settings.
|
||||
*
|
||||
* @see {@link https://wallabyjs.com/docs/config/runner.html} for details.
|
||||
*/
|
||||
export interface IWallabyEnvironment {
|
||||
params?: IWallabyEnvironmentParameters;
|
||||
runner?: string;
|
||||
type?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wallaby environment parameters.
|
||||
*
|
||||
* @interface IWallabyEnvironmentParameters
|
||||
*
|
||||
* @property {string=} env - Semicolon-separated spawed runner process env variables.
|
||||
* @property {string=} runner - Space-separated spawed runner process flags.
|
||||
*
|
||||
* @see {@link https://wallabyjs.com/docs/config/runner.html} for details.
|
||||
*/
|
||||
export interface IWallabyEnvironmentParameters {
|
||||
env?: string;
|
||||
runner?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wallaby worker configuration.
|
||||
*
|
||||
* @interface IWallabyWorkers
|
||||
*
|
||||
* @property {boolean=} recycle - Specifies the degree of parallelism used to run your tests and
|
||||
* controls the way wallaby re-uses workers.
|
||||
*
|
||||
* @see {@link https://wallabyjs.com/docs/config/workers.html} for details.
|
||||
*/
|
||||
export interface IWallabyWorkers {
|
||||
recycle?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wallaby object passed into config.
|
||||
*
|
||||
* @interface IWallaby
|
||||
*
|
||||
* @property {string=} localProjectDir - String property which returns the project local folder.
|
||||
* @property {string=} projectCacheDir - String property which returns the project cache folder.
|
||||
* @property {IWallabyCompiler=} compilers - Property which allows you to access the built-in TypeScript, CoffeeScript and Babel compilers.
|
||||
* @property {object=} defaults - Property which allows you to set the default values for file object properties.
|
||||
*
|
||||
* @see {@link https://wallabyjs.com/docs/config/overview.html} for details.
|
||||
*/
|
||||
export interface IWallaby {
|
||||
localProjectDir?: string;
|
||||
projectCacheDir?: string;
|
||||
compilers?: IWallabyCompiler;
|
||||
defaults?: any;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user