Merge github.com:DefinitelyTyped/DefinitelyTyped

This commit is contained in:
Avi Vahl
2017-03-22 18:24:13 +02:00
1416 changed files with 112850 additions and 75616 deletions
-20
View File
@@ -1,22 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
# Custom for Visual Studio
*.cs diff=csharp
*.sln merge=union
*.csproj merge=union
*.vbproj merge=union
*.fsproj merge=union
*.dbproj merge=union
# Standard to msysgit
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
+1 -1
View File
@@ -1,6 +1,6 @@
language: node_js
node_js:
- 6.9.2
- node
sudo: false
+1 -1
View File
@@ -1,5 +1,5 @@
import packer = require("3d-bin-packing");
import samchon = require("samchon-framework");
import samchon = require("samchon");
function main(): void
{
+140 -258
View File
@@ -1,20 +1,22 @@
// Type definitions for 3d-bin-packing
// Type definitions for 3d-bin-packing v1.1.2
// Project: https://github.com/betterwaysystems/packer
// Definitions by: Jeongho Nam <http://samchon.org>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
/// <reference types="typescript-stl" />
/// <reference types="samchon-framework" />
/// <reference types="react" />
/// <reference types="react-data-grid" />
/// <reference types="three" />
/// <reference types="samchon" />
declare module "3d-bin-packing"
{
export = bws.packer;
export = bws.packer;
}
/// <reference types="samchon" />
/// <reference types="tstl" />
declare namespace bws.packer {
export import library = samchon.library;
export import protocol = samchon.protocol;
function _Test(): void;
}
declare var ReactDataGrid: typeof AdazzleReactDataGrid.ReactDataGrid;
declare namespace boxologic {
/**
* <p> An abstract instance of boxologic. </p>
@@ -62,122 +64,6 @@ declare namespace boxologic {
constructor(width: number, height: number, length: number);
}
}
declare namespace bws.packer {
/**
* @brief Packer, a solver of 3d bin packing with multiple wrappers.
*
* @details
* <p> Packer is a facade class supporting packing operations in user side. You can solve a packing problem
* by constructing Packer class with {@link WrapperArray wrappers} and {@link InstanceArray instances} to
* pack and executing {@link optimize Packer.optimize()} method. </p>
*
* <p> In background side, deducting packing solution, those algorithms are used. </p>
* <ul>
* <li> <a href="http://betterwaysystems.github.io/packer/reference/AirForceBinPacking.pdf" target="_blank">
* Airforce Bin Packing; 3D pallet packing problem: A human intelligence-based heuristic approach </a>
* </li>
* <li> Genetic Algorithm </li>
* <li> Greedy and Back-tracking algorithm </li>
* </ul>
*
* @author Jeongho Nam <http://samchon.org>
*/
class Packer extends samchon.protocol.Entity {
/**
* Candidate wrappers who can contain instances.
*/
protected wrapperArray: WrapperArray;
/**
* Instances trying to pack into the wrapper.
*/
protected instanceArray: InstanceArray;
/**
* Default Constructor.
*/
constructor();
/**
* Construct from members.
*
* @param wrapperArray Candidate wrappers who can contain instances.
* @param instanceArray Instances to be packed into some wrappers.
*/
constructor(wrapperArray: WrapperArray, instanceArray: InstanceArray);
/**
* @inheritdoc
*/
construct(xml: samchon.library.XML): void;
/**
* Get wrapperArray.
*/
getWrapperArray(): WrapperArray;
/**
* Get instanceArray.
*/
getInstanceArray(): InstanceArray;
/**
* <p> Deduct
*
*/
optimize(): WrapperArray;
/**
* @brief Initialize sequence list (gene_array).
*
* @details
* <p> Deducts initial sequence list by such assumption: </p>
*
* <ul>
* <li> Cost of larger wrapper is less than smaller one, within framework of price per volume unit. </li>
* <ul>
* <li> Wrapper Larger: (price: $1,000, volume: 100cm^3 -> price per volume unit: $10 / cm^3) </li>
* <li> Wrapper Smaller: (price: $700, volume: 50cm^3 -> price per volume unit: $14 / cm^3) </li>
* <li> Larger's <u>cost</u> is less than Smaller, within framework of price per volume unit </li>
* </ul>
* </ul>
*
* <p> Method {@link initGenes initGenes()} constructs {@link WrapperGroup WrapperGroups} corresponding
* with the {@link wrapperArray} and allocates {@link instanceArray instances} to a {@link WrapperGroup},
* has the smallest <u>cost</u> between containbles. </p>
*
* <p> After executing packing solution by {@link WrapperGroup.optimize WrapperGroup.optimize()}, trying to
* {@link repack re-pack} each {@link WrapperGroup} to another type of {@link Wrapper}, deducts the best
* solution between them. It's the initial sequence list of genetic algorithm. </p>
*
* @return Initial sequence list.
*/
protected initGenes(): GAWrapperArray;
/**
* Try to repack each wrappers to another type.
*
* @param $wrappers Wrappers to repack.
* @return Re-packed wrappers.
*/
protected repack($wrappers: WrapperArray): WrapperArray;
/**
* @inheritdoc
*/
TAG(): string;
/**
* @inheritdoc
*/
toXML(): samchon.library.XML;
}
}
declare namespace flex {
class TabNavigator extends React.Component<TabNavigatorProps, TabNavigatorProps> {
render(): JSX.Element;
private handle_change(index, event);
}
class NavigatorContent extends React.Component<NavigatorContentProps, NavigatorContentProps> {
render(): JSX.Element;
}
interface TabNavigatorProps extends React.Props<TabNavigator> {
selectedIndex?: number;
style?: React.CSSProperties;
}
interface NavigatorContentProps extends React.Props<NavigatorContent> {
label: string;
}
}
declare namespace boxologic {
/**
* A box, trying to pack into a {@link Pallet}.
@@ -589,7 +475,7 @@ declare namespace bws.packer {
*
* @author Jeongho Nam <http://samchon.org>
*/
class PackerForm extends samchon.protocol.Entity {
class PackerForm extends protocol.Entity {
/**
* Form of Instances to pack.
*/
@@ -609,12 +495,12 @@ declare namespace bws.packer {
* @param wrapperArray Type of Wrappers to be used.
*/
constructor(instanceFormArray: InstanceFormArray, wrapperArray: WrapperArray);
construct(xml: samchon.library.XML): void;
construct(xml: library.XML): void;
optimize(): WrapperArray;
getInstanceFormArray(): InstanceFormArray;
getWrapperArray(): WrapperArray;
TAG(): string;
toXML(): samchon.library.XML;
toXML(): library.XML;
toPacker(): Packer;
}
/**
@@ -622,12 +508,12 @@ declare namespace bws.packer {
*
* @author Jeongho Nam <http://samchon.org>
*/
class InstanceFormArray extends samchon.protocol.EntityArrayCollection<InstanceForm> {
class InstanceFormArray extends protocol.EntityArrayCollection<InstanceForm> {
/**
* Default Constructor.
*/
constructor();
createChild(xml: samchon.library.XML): InstanceForm;
createChild(xml: library.XML): InstanceForm;
TAG(): string;
CHILD_TAG(): string;
/**
@@ -645,7 +531,7 @@ declare namespace bws.packer {
*
* @author Jeongho Nam <http://samchon.org>
*/
class InstanceForm extends samchon.protocol.Entity {
class InstanceForm extends protocol.Entity {
/**
* A duplicated Instance.
*/
@@ -661,7 +547,7 @@ declare namespace bws.packer {
/**
* @inheritdoc
*/
construct(xml: samchon.library.XML): void;
construct(xml: library.XML): void;
private createInstance(xml);
key(): any;
getInstance(): Instance;
@@ -679,7 +565,7 @@ declare namespace bws.packer {
/**
* @inheritdoc
*/
toXML(): samchon.library.XML;
toXML(): library.XML;
/**
* <p> Repeated {@link instance} to {@link InstanceArray}.
*
@@ -694,7 +580,7 @@ declare namespace bws.packer {
}
}
declare namespace bws.packer {
class WrapperArray extends samchon.protocol.EntityArrayCollection<Wrapper> {
class WrapperArray extends protocol.EntityArrayCollection<Wrapper> {
/**
* Default Constructor.
*/
@@ -702,7 +588,7 @@ declare namespace bws.packer {
/**
* @inheritdoc
*/
createChild(xml: samchon.library.XML): Wrapper;
createChild(xml: library.XML): Wrapper;
/**
* Get (calculate) price.
*/
@@ -756,7 +642,7 @@ declare namespace bws.packer {
*
* @author Jeongho Nam <http://samchon.org>
*/
interface Instance extends samchon.protocol.IEntity {
interface Instance extends protocol.IEntity {
/**
* Get name.
*/
@@ -813,7 +699,7 @@ declare namespace bws.packer {
*
* @author Jeongho Nam <http://samchon.org>
*/
class InstanceArray extends samchon.protocol.EntityArray<Instance> {
class InstanceArray extends protocol.EntityArray<Instance> {
/**
* Default Constructor.
*/
@@ -821,7 +707,7 @@ declare namespace bws.packer {
/**
* @inheritdoc
*/
createChild(xml: samchon.library.XML): Instance;
createChild(xml: library.XML): Instance;
/**
* @inheritdoc
*/
@@ -832,13 +718,113 @@ declare namespace bws.packer {
CHILD_TAG(): string;
}
}
declare namespace bws.packer {
/**
* @brief Packer, a solver of 3d bin packing with multiple wrappers.
*
* @details
* <p> Packer is a facade class supporting packing operations in user side. You can solve a packing problem
* by constructing Packer class with {@link WrapperArray wrappers} and {@link InstanceArray instances} to
* pack and executing {@link optimize Packer.optimize()} method. </p>
*
* <p> In background side, deducting packing solution, those algorithms are used. </p>
* <ul>
* <li> <a href="http://betterwaysystems.github.io/packer/reference/AirForceBinPacking.pdf" target="_blank">
* Airforce Bin Packing; 3D pallet packing problem: A human intelligence-based heuristic approach </a>
* </li>
* <li> Genetic Algorithm </li>
* <li> Greedy and Back-tracking algorithm </li>
* </ul>
*
* @author Jeongho Nam <http://samchon.org>
*/
class Packer extends protocol.Entity {
/**
* Candidate wrappers who can contain instances.
*/
protected wrapperArray: WrapperArray;
/**
* Instances trying to pack into the wrapper.
*/
protected instanceArray: InstanceArray;
/**
* Default Constructor.
*/
constructor();
/**
* Construct from members.
*
* @param wrapperArray Candidate wrappers who can contain instances.
* @param instanceArray Instances to be packed into some wrappers.
*/
constructor(wrapperArray: WrapperArray, instanceArray: InstanceArray);
/**
* @inheritdoc
*/
construct(xml: library.XML): void;
/**
* Get wrapperArray.
*/
getWrapperArray(): WrapperArray;
/**
* Get instanceArray.
*/
getInstanceArray(): InstanceArray;
/**
* <p> Deduct
*
*/
optimize(): WrapperArray;
/**
* @brief Initialize sequence list (gene_array).
*
* @details
* <p> Deducts initial sequence list by such assumption: </p>
*
* <ul>
* <li> Cost of larger wrapper is less than smaller one, within framework of price per volume unit. </li>
* <ul>
* <li> Wrapper Larger: (price: $1,000, volume: 100cm^3 -> price per volume unit: $10 / cm^3) </li>
* <li> Wrapper Smaller: (price: $700, volume: 50cm^3 -> price per volume unit: $14 / cm^3) </li>
* <li> Larger's <u>cost</u> is less than Smaller, within framework of price per volume unit </li>
* </ul>
* </ul>
*
* <p> Method {@link initGenes initGenes()} constructs {@link WrapperGroup WrapperGroups} corresponding
* with the {@link wrapperArray} and allocates {@link instanceArray instances} to a {@link WrapperGroup},
* has the smallest <u>cost</u> between containbles. </p>
*
* <p> After executing packing solution by {@link WrapperGroup.optimize WrapperGroup.optimize()}, trying to
* {@link repack re-pack} each {@link WrapperGroup} to another type of {@link Wrapper}, deducts the best
* solution between them. It's the initial sequence list of genetic algorithm. </p>
*
* @return Initial sequence list.
*/
protected initGenes(): GAWrapperArray;
/**
* Try to repack each wrappers to another type.
*
* @param $wrappers Wrappers to repack.
* @return Re-packed wrappers.
*/
protected repack($wrappers: WrapperArray): WrapperArray;
/**
* @inheritdoc
*/
TAG(): string;
/**
* @inheritdoc
*/
toXML(): library.XML;
}
}
declare namespace bws.packer {
/**
* A product.
*
* @author Jeongho Nam <http://samchon.org>
*/
class Product extends samchon.protocol.Entity implements Instance {
class Product extends protocol.Entity implements Instance {
/**
* <p> Name, key of the Product. </p>
*
@@ -921,7 +907,7 @@ declare namespace bws.packer {
/**
* @inheritdoc
*/
toXML(): samchon.library.XML;
toXML(): library.XML;
}
}
declare namespace bws.packer {
@@ -937,7 +923,7 @@ declare namespace bws.packer {
*
* @author Jeongho Nam <http://samchon.org>
*/
class Wrap extends samchon.protocol.Entity {
class Wrap extends protocol.Entity {
/**
* A wrapper wrapping the {@link instance}.
*/
@@ -962,10 +948,6 @@ declare namespace bws.packer {
* Placement orientation of wrapped {@link instance}.
*/
protected orientation: number;
/**
*
*/
protected color: number;
/**
* Construct from a Wrapper.
*
@@ -996,7 +978,7 @@ declare namespace bws.packer {
/**
* @inheritdoc
*/
construct(xml: samchon.library.XML): void;
construct(xml: library.XML): void;
/**
* Factory method of wrapped Instance.
*
@@ -1058,11 +1040,11 @@ declare namespace bws.packer {
/**
* Get width.
*/
getWidth(): number;
getLayoutWidth(): number;
/**
* Get height.
*/
getHeight(): number;
getLayoutHeight(): number;
/**
* Get length.
*/
@@ -1071,9 +1053,9 @@ declare namespace bws.packer {
* Get volume.
*/
getVolume(): number;
$instanceName: string;
$layoutScale: string;
$position: string;
readonly $instanceName: string;
readonly $layoutScale: string;
readonly $position: string;
/**
* @inheritdoc
*/
@@ -1081,19 +1063,7 @@ declare namespace bws.packer {
/**
* @inheritdoc
*/
toXML(): samchon.library.XML;
/**
* Thickness of boundary lines of a shape represents the {@link instance}.
*/
private static BOUNDARY_THICKNESS;
/**
*
*
* @param geometry
*
* @return A shape and its boundary lines as 3D-objects.
*/
toDisplayObjects(geometry: THREE.Geometry): std.Vector<THREE.Object3D>;
toXML(): library.XML;
}
}
declare namespace bws.packer {
@@ -1102,7 +1072,7 @@ declare namespace bws.packer {
*
* @author Jeongho Nam <http://samchon.org>
*/
class Wrapper extends samchon.protocol.EntityDeque<Wrap> implements Instance {
class Wrapper extends protocol.EntityDeque<Wrap> implements Instance {
/**
* <p> Name, key of the Wrapper. </p>
*
@@ -1151,11 +1121,10 @@ declare namespace bws.packer {
* @param thickness A thickness causes shrinkness on containable volume.
*/
constructor(name: string, price: number, width: number, height: number, length: number, thickness: number);
construct(xml: samchon.library.XML): void;
/**
* @inheritdoc
*/
createChild(xml: samchon.library.XML): Wrap;
createChild(xml: library.XML): Wrap;
/**
* Key of a Wrapper is its name.
*/
@@ -1232,7 +1201,7 @@ declare namespace bws.packer {
* @return utilization ratio.
*/
getUtilization(): number;
equal_to(obj: Wrapper): boolean;
equals(obj: Wrapper): boolean;
/**
* <p> Wrapper is enough greater? </p>
*
@@ -1272,8 +1241,8 @@ declare namespace bws.packer {
$height: string;
$length: string;
$thickness: string;
$scale: string;
$spaceUtilization: string;
readonly $scale: string;
readonly $spaceUtilization: string;
/**
* @inheritdoc
*/
@@ -1289,25 +1258,7 @@ declare namespace bws.packer {
/**
* @inheritdoc
*/
toXML(): samchon.library.XML;
private static scene;
private static renderer;
private static camera;
private static trackball;
private static mouse;
private static BOUNDARY_THICKNESS;
/**
* <p> Convert to a canvas containing 3D elements. </p>
*
* @param endIndex
*
* @return A 3D-canvans printing the Wrapper and its children {@link Wrap wrapped}
* {@link Instance instances} with those boundary lines.
*/
toCanvas(endIndex?: number): HTMLCanvasElement;
private static handleMouseMove(event);
private static animate();
private static render();
toXML(): library.XML;
}
}
declare namespace bws.packer {
@@ -1430,72 +1381,3 @@ declare namespace bws.packer {
TAG(): string;
}
}
declare namespace bws.packer {
abstract class Editor<T extends samchon.protocol.IEntity> extends React.Component<{
dataProvider: samchon.protocol.EntityArrayCollection<T>;
}, {}> {
private columns;
private selected_index;
/**
* Default Constructor.
*/
constructor();
protected abstract createColumns(): AdazzleReactDataGrid.Column[];
private get_row(index);
private insert_instance(event);
private erase_instances(event);
private handle_data_change(event);
private handle_row_change(event);
private handle_select(event);
render(): JSX.Element;
}
}
declare namespace bws.packer {
interface ItemEditorProps extends React.Props<ItemEditor> {
application: PackerApplication;
instances: InstanceFormArray;
wrappers: WrapperArray;
}
class ItemEditor extends React.Component<ItemEditorProps, {}> {
private clear(event);
private open(event);
private save(event);
private pack(event);
render(): JSX.Element;
}
class InstanceEditor extends Editor<InstanceForm> {
protected createColumns(): AdazzleReactDataGrid.Column[];
}
class WrapperEditor extends Editor<Wrapper> {
protected createColumns(): AdazzleReactDataGrid.Column[];
}
}
declare namespace bws.packer {
class PackerApplication extends React.Component<{}, {}> {
private instances;
private wrappers;
private result;
/**
* Default Constructor.
*/
constructor();
pack(): void;
drawWrapper(wrapper: Wrapper, index?: number): void;
render(): JSX.Element;
static main(): void;
}
}
declare namespace bws.packer {
class ResultViewer extends React.Component<WrapperViewerProps, {}> {
drawWrapper(wrapper: Wrapper, index?: number): void;
private clear(event);
private open(event);
private save(event);
refresh(): void;
render(): JSX.Element;
}
interface WrapperViewerProps extends React.Props<ResultViewer> {
application: PackerApplication;
wrappers: WrapperArray;
}
}
-1
View File
@@ -1 +0,0 @@
Please see the [contribution guide](http://definitelytyped.org/guides/contributing.html) at [definitelytyped.org](http://definitelytyped.org/guides/contributing.html) for information on how to contribute to DefinitelyTyped.
-1893
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -444,7 +444,7 @@ declare namespace ablyLib {
}
}
export declare class Rest {
export class Rest {
constructor(options: ablyLib.ClientOptions | string);
static Crypto: ablyLib.Crypto;
static Message: ablyLib.MessageStatic;
@@ -456,7 +456,7 @@ export declare class Rest {
time: (paramsOrCallback?: ablyLib.timeCallback | any, callback?: ablyLib.timeCallback) => void;
}
export declare class Realtime {
export class Realtime {
constructor(options: ablyLib.ClientOptions | string);
static Crypto: ablyLib.Crypto;
static Message: ablyLib.MessageStatic;
+2 -2
View File
@@ -4,11 +4,11 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace accepts {
export interface Headers {
interface Headers {
[key: string]: string | string[];
}
export interface Accepts {
interface Accepts {
/**
* Return the first accepted charset. If nothing in `charsets` is accepted, then `false` is returned.
*/
+3 -2
View File
@@ -1,5 +1,3 @@
/// <reference types="estree" />
import acorn = require('acorn');
import * as ESTree from 'estree';
@@ -67,3 +65,6 @@ acorn.getLineInfo('string', 56);
acorn.plugins['test'] = function (p: acorn.Parser, config: any) {
}
acorn.tokenizer('console.log("hello world)', {locations: true}).getToken();
acorn.tokenizer('console.log("hello world)', {locations: true})[Symbol.iterator]().next();
+6 -3
View File
@@ -238,9 +238,12 @@ declare namespace acorn {
function parseExpressionAt(input: string, pos?: number, options?: Options): ESTree.Expression;
// todo: here the tokenizer function returns a Parser instance, that is targeting the detail of
// Parser prototype. Someone need this please reade README.md first.
// function tokenizer(options: Options, input: string): Parser;
interface ITokenizer {
getToken() : Token,
[Symbol.iterator](): Iterator<Token>
}
function tokenizer(input: string, options: Options): ITokenizer;
let parse_dammit: IParse | undefined;
let LooseParser: ILooseParserClass | undefined;
-4
View File
@@ -1,6 +1,3 @@
/// <reference types="jquery" />
import amplify = require("amplify");
// Copied examples directly from AmplifyJs site
@@ -260,4 +257,3 @@ amplify.request({
error: (data, status) => {
}
});
-5
View File
@@ -34,7 +34,6 @@ declare namespace amplify {
}
interface Request {
/***
* Request a resource.
* resourceId: Identifier string for the resource.
@@ -118,7 +117,6 @@ declare namespace amplify {
}
interface Store extends StorageTypeStore {
/***
* IE 8+, Firefox 3.5+, Safari 4+, Chrome, Opera 10.5+, iPhone 2+, Android 2+
*/
@@ -143,12 +141,9 @@ declare namespace amplify {
* An in-memory store is provided as a fallback if none of the other storage types are available.
*/
memory: StorageTypeStore;
}
interface Static {
subscribe: Subscribe;
/***
@@ -1,6 +1,3 @@
///<reference path='index.d.ts'/>
///<reference types="angular"/>
var myApp = angular.module('testModule');
interface MyAppScope extends ng.IScope {
@@ -15,6 +15,9 @@ class LocaleTestController {
var newLocale = "mt"
tmhDynamicLocaleService.set(newLocale);
newLocale = "en";
tmhDynamicLocaleService.set(newLocale).then((value) => {});
}
}
+1 -1
View File
@@ -11,7 +11,7 @@ declare module 'angular' {
export namespace dynamicLocale {
interface tmhDynamicLocaleService {
set(locale: string): void;
set(locale: string): angular.IPromise<string>;
get(): string;
}
@@ -1,5 +1,3 @@
/// <reference types="angular" />
import * as angular from "angular";
let myApp = angular.module('myApp', ['feature-flags']);
+4 -5
View File
@@ -3,13 +3,12 @@
// Definitions by: Donald Nairn <https://github.com/deenairn/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="angular" />
declare namespace angular {
import * as angular from 'angular';
declare module 'angular' {
/**
* A core Angular factory proving FileSaver functionality.
*/
interface FileSaver {
export interface FileSaver {
/**
* Immediately starts saving a file
* @param data: a Blob instance;
@@ -18,4 +17,4 @@ declare namespace angular {
*/
saveAs(blob: Blob, fileName: string, disableBOM?: boolean): void;
}
}
}
+1 -7
View File
@@ -8,11 +8,8 @@ import * as angular from "angular";
export default "gridster";
declare module "angular" {
export namespace gridster {
namespace gridster {
interface GridsterConfig {
// number of columns in the grid
columns?: number;
// whether to push other items out of the way
@@ -83,7 +80,6 @@ declare module "angular" {
// options to pass to resizable handler
resizable?: {
// whether the items are resizable
enabled?: boolean;
@@ -103,7 +99,6 @@ declare module "angular" {
// options to pass to draggable handler
draggable?: {
// whether the items are resizable
enabled?: boolean;
@@ -128,7 +123,6 @@ declare module "angular" {
}
interface StandardGridsterItem {
// width of the item expressed in terms of number of columns it will occupy
sizeX: number;
-2
View File
@@ -1,5 +1,3 @@
/// <reference types="angular" />
var scope: ng.IScope;
var hotkeyProvider: ng.hotkeys.HotkeysProvider;
var hotkeyObj: ng.hotkeys.Hotkey;
-2
View File
@@ -1,5 +1,3 @@
/// <reference types="angular" />
var app = angular.module("angular-jwt-tests", ["angular-jwt"]);
var $jwtHelper: ng.jwt.IJwtHelper;
+5
View File
@@ -0,0 +1,5 @@
{
"dependencies": {
"localforage": "^1.5.0"
}
}
+2 -1
View File
@@ -1,6 +1,6 @@
// Type definitions for Angular Material (angular.material module) 1.1
// Project: https://github.com/angular/material
// Definitions by: Blake Bigelow <https://github.com/blbigelow>, Peter Hajdu <https://github.com/PeterHajdu>, Davide Donadello <https://github.com/Dona278>
// Definitions by: Blake Bigelow <https://github.com/blbigelow>, Peter Hajdu <https://github.com/PeterHajdu>, Davide Donadello <https://github.com/Dona278>, Geert Jansen <https://github.com/geertjansen>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import * as angular from 'angular';
@@ -18,6 +18,7 @@ declare module 'angular' {
controller?: string | Function;
locals?: { [index: string]: any };
clickOutsideToClose?: boolean;
bindToController?: boolean; // default: false
disableBackdrop?: boolean;
escapeToClose?: boolean;
resolve?: { [index: string]: () => angular.IPromise<any> };
-2
View File
@@ -1,5 +1,3 @@
/// <reference types="jquery" />
var btfModal: angularModal.AngularModalFactory;
// Using template URL
+10
View File
@@ -0,0 +1,10 @@
import * as angular from 'angular';
angular.module('angular-oauth2-test', ['angular-oauth2'])
.config(['OAuthProvider', (OAuthProvider: angular.oauth2.OAuthProvider) => {
OAuthProvider.configure({
baseUrl: 'https://api.website.com',
clientId: 'CLIENT_ID',
clientSecret: 'CLIENT_SECRET' // optional
});
}]);
+47
View File
@@ -0,0 +1,47 @@
// Type definitions for angular-oauth2 4.1
// Project: https://github.com/oauthjs/angular-oauth2
// Definitions by: Antério Vieira <https://github.com/anteriovieira>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import * as angular from 'angular';
declare module 'angular' {
namespace oauth2 {
interface OAuthConfig {
baseUrl: string;
clientId: string;
clientSecret?: string;
grantPath?: string;
revokePath?: string;
}
interface OAuthProvider {
configure(params: OAuthConfig): OAuthConfig;
}
interface Data {
username: string;
password: string;
}
interface OAuth {
isAuthenticated(): boolean;
getAccessToken(data: Data, options?: any): angular.IPromise<string>;
getRefreshToken(data?: Data, options?: any): angular.IPromise<string>;
revokeToken(data?: Data, options?: any): angular.IPromise<string>;
}
interface OAuthTokenConfig {
name: string;
options: any;
}
interface OAuthTokenOptions {
secure: boolean;
}
interface OAuthTokenProvider {
configure(params: OAuthTokenConfig): OAuthTokenConfig;
}
}
}
@@ -1,14 +1,14 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"lib": [
"es6",
"dom"
],
"target": "es6",
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
@@ -19,6 +19,6 @@
},
"files": [
"index.d.ts",
"paymentrequest-tests.ts"
"angular-oauth2-tests.ts"
]
}
}
+13 -7
View File
@@ -15,6 +15,7 @@ export type IDropdownConfig = angular.ui.bootstrap.IDropdownConfig;
export type IModalProvider = angular.ui.bootstrap.IModalProvider;
export type IModalService = angular.ui.bootstrap.IModalService;
export type IModalServiceInstance = angular.ui.bootstrap.IModalServiceInstance;
export type IModalInstanceService = angular.ui.bootstrap.IModalInstanceService;
export type IModalScope = angular.ui.bootstrap.IModalScope;
export type IModalSettings = angular.ui.bootstrap.IModalSettings;
export type IModalStackService = angular.ui.bootstrap.IModalStackService;
@@ -320,12 +321,12 @@ declare module 'angular' {
interface IModalService {
/**
* @param {IModalSettings} options
* @returns {IModalServiceInstance}
* @returns {IModalInstanceService}
*/
open(options: IModalSettings): IModalServiceInstance;
open(options: IModalSettings): IModalInstanceService;
}
interface IModalServiceInstance {
interface IModalInstanceService {
/**
* A method that can be used to close a modal, passing a result. If `preventDefault` is called on the `modal.closing` event then the modal will remain open.
*/
@@ -357,6 +358,11 @@ declare module 'angular' {
closed: angular.IPromise<any>;
}
/**
* @deprecated use IModalInstanceService instead.
*/
interface IModalServiceInstance extends IModalInstanceService { }
interface IModalScope extends angular.IScope {
/**
* Dismiss the dialog without assigning a value to the promise output. If `preventDefault` is called on the `modal.closing` event then the modal will remain open.
@@ -512,17 +518,17 @@ declare module 'angular' {
/**
* Opens a new modal instance.
*/
open(modalInstance: IModalServiceInstance, modal: any): void;
open(modalInstance: IModalInstanceService, modal: any): void;
/**
* Closes a modal instance with an optional result.
*/
close(modalInstance: IModalServiceInstance, result?: any): void;
close(modalInstance: IModalInstanceService, result?: any): void;
/**
* Dismisses a modal instance with an optional reason.
*/
dismiss(modalInstance: IModalServiceInstance, reason?: any): void;
dismiss(modalInstance: IModalInstanceService, reason?: any): void;
/**
* Dismiss all open modal instances with an optional reason that will be passed to each instance.
@@ -536,7 +542,7 @@ declare module 'angular' {
}
interface IModalStackedMapKeyValuePair {
key: IModalServiceInstance;
key: IModalInstanceService;
value: any;
}
+2 -1
View File
@@ -587,7 +587,8 @@ namespace TestPromise {
function test_angular_forEach() {
const values: { [key: string]: string } = { name: 'misko', gender: 'male' };
const log: string[] = [];
angular.forEach(values, (value, key) => {
angular.forEach(values, (value, key, obj) => {
obj[key] = value;
this.push(key + ': ' + value);
}, log);
// expect(log).toEqual(['name: misko', 'gender: male']);
+14 -9
View File
@@ -26,7 +26,6 @@ import ng = angular;
// ng module (angular.js)
///////////////////////////////////////////////////////////////////////////////
declare namespace angular {
type Injectable<T extends Function> = T | Array<string | T>;
// not directly implemented, but ensures that constructed class implements $get
@@ -97,7 +96,7 @@ declare namespace angular {
* @param iterator Iterator function.
* @param context Object to become context (this) for the iterator function.
*/
forEach<T>(obj: T[], iterator: (value: T, key: number) => any, context?: any): any;
forEach<T>(obj: T[], iterator: (value: T, key: number, obj: T[]) => void, context?: any): T[];
/**
* Invokes the iterator function once for each item in obj collection, which can be either an object or an array. The iterator function is invoked with iterator(value, key), where value is the value of an object property or an array element and key is the object property key or array element index. Specifying a context for the function is optional.
*
@@ -107,7 +106,7 @@ declare namespace angular {
* @param iterator Iterator function.
* @param context Object to become context (this) for the iterator function.
*/
forEach<T>(obj: { [index: string]: T; }, iterator: (value: T, key: string) => any, context?: any): any;
forEach<T>(obj: { [index: string]: T; }, iterator: (value: T, key: string, obj: { [index: string]: T; }) => void, context?: any): { [index: string]: T; };
/**
* Invokes the iterator function once for each item in obj collection, which can be either an object or an array. The iterator function is invoked with iterator(value, key), where value is the value of an object property or an array element and key is the object property key or array element index. Specifying a context for the function is optional.
*
@@ -117,7 +116,7 @@ declare namespace angular {
* @param iterator Iterator function.
* @param context Object to become context (this) for the iterator function.
*/
forEach(obj: any, iterator: (value: any, key: any) => any, context?: any): any;
forEach(obj: any, iterator: (value: any, key: any, obj: any) => void, context?: any): any;
fromJson(json: string): any;
identity<T>(arg?: T): T;
@@ -344,7 +343,6 @@ declare namespace angular {
* see https://docs.angularjs.org/api/ng/type/form.FormController
*/
interface IFormController {
/**
* Indexer which should return ng.INgModelController for most properties but cannot because of "All named properties must be assignable to string indexer type" constraint - see https://github.com/Microsoft/TypeScript/issues/272
*/
@@ -532,7 +530,6 @@ declare namespace angular {
* see https://docs.angularjs.org/api/ng/directive/ngRepeat
*/
interface IRepeatScope extends IScope {
/**
* iterator offset of the repeated element (0..length-1).
*/
@@ -562,7 +559,6 @@ declare namespace angular {
* true if the iterator position $index is odd (otherwise false).
*/
$odd: boolean;
}
interface IAngularEvent {
@@ -1332,9 +1328,19 @@ declare namespace angular {
// see http://docs.angularjs.org/api/ng.$controller
// see http://docs.angularjs.org/api/ng.$controllerProvider
///////////////////////////////////////////////////////////////////////////
/**
* The minimal local definitions required by $controller(ctrl, locals) calls.
*/
interface IControllerLocals {
$scope: ng.IScope;
$element: JQuery;
}
interface IControllerService {
// Although the documentation doesn't state this, locals are optional
<T>(controllerConstructor: new (...args: any[]) => T, locals?: any, later?: boolean, ident?: string): T;
<T>(controllerConstructor: Function, locals?: IControllerLocals, later?: boolean, ident?: string): T;
<T>(controllerConstructor: Function, locals?: any, later?: boolean, ident?: string): T;
<T>(controllerName: string, locals?: any, later?: boolean, ident?: string): T;
}
@@ -1934,8 +1940,7 @@ declare namespace angular {
///////////////////////////////////////////////////////////////////////////
// AUTO module (angular.js)
///////////////////////////////////////////////////////////////////////////
export namespace auto {
namespace auto {
///////////////////////////////////////////////////////////////////////
// InjectorService
// see http://docs.angularjs.org/api/AUTO.$injector
-483
View File
@@ -1,483 +0,0 @@
/// <reference types="react" />
/*import {
Affix,
Button,
Alert,
Badge,
Breadcrumb,
Calendar,
Carousel,
Cascader,
Checkbox,
Collapse,
DatePicker,
Dropdown,
Icon,
Form,
Input,
InputNumber,
Row,
Col,
Menu,
message,
Modal,
notification,
Pagination,
Popconfirm,
Popover,
Progress,
QueueAnim,
Radio,
Select,
Slider,
Spin,
Steps,
Switch,
Table,
Tabs,
Tag,
TimePicker,
Timeline,
Tooltip,
Transfer,
Tree,
TreeSelect,
Upload,
} from 'antd';*/
import * as React from 'react'
import Affix from 'antd/lib/Affix'
import Button from 'antd/lib/Button'
import Alert from 'antd/lib/Alert'
import Badge from 'antd/lib/Badge'
import Breadcrumb from 'antd/lib/Breadcrumb'
import Calendar from 'antd/lib/Calendar'
import Carousel from 'antd/lib/Carousel'
import Cascader from 'antd/lib/Cascader'
import Checkbox from 'antd/lib/Checkbox'
import Collapse from 'antd/lib/Collapse'
import DatePicker from 'antd/lib/DatePicker'
import Dropdown from 'antd/lib/Dropdown'
import Icon from 'antd/lib/Icon'
import Form from 'antd/lib/Form'
import Input from 'antd/lib/Input'
import InputNumber from 'antd/lib/InputNumber'
import Row from 'antd/lib/Row'
import Col from 'antd/lib/Col'
import Menu from 'antd/lib/Menu'
import message from 'antd/lib/message'
import Modal from 'antd/lib/Modal'
import notification from 'antd/lib/notification'
import Pagination from 'antd/lib/Pagination'
import Popconfirm from 'antd/lib/Popconfirm'
import Popover from 'antd/lib/Popover'
import Progress from 'antd/lib/Progress'
import QueueAnim from 'antd/lib/QueueAnim'
import Radio from 'antd/lib/Radio'
import Select from 'antd/lib/Select'
import Slider from 'antd/lib/Slider'
import Spin from 'antd/lib/Spin'
import Steps from 'antd/lib/Steps'
import Switch from 'antd/lib/Switch'
import Table from 'antd/lib/Table'
import Tabs from 'antd/lib/Tabs'
import Tag from 'antd/lib/Tag'
import TimePicker from 'antd/lib/TimePicker'
import Timeline from 'antd/lib/Timeline'
import Tooltip from 'antd/lib/Tooltip'
import Transfer from 'antd/lib/Transfer'
import Tree from 'antd/lib/Tree'
import TreeSelect from 'antd/lib/TreeSelect'
import Upload from 'antd/lib/Upload'
const ButtonGroup = Button.Group;
const CheckboxGroup = Checkbox.Group;
const Panel = Collapse.Panel;
const RangePicker = DatePicker.RangePicker;
const MonthPicker = DatePicker.MonthPicker;
const DropdownButton = Dropdown.Button;
const SubMenu = Menu.SubMenu;
const MenuItemGroup = Menu.ItemGroup;
const ProgressCircle = Progress.Circle;
const ProgressLine = Progress.Line;
const RadioGroup = Radio.Group;
const Option = Select.Option;
const OptGroup = Select.OptGroup;
const Step = Steps.Step;
const FormItem = Form.Item;
const TabPane = Tabs.TabPane;
const TreeNode = Tree.TreeNode;
const TreeSelectTreeNode = TreeSelect.TreeNode;
const onChange = () => { }
const options = [{
value: 'zhejiang',
label: '浙江',
children: [{
value: 'hangzhou',
label: '杭州',
children: [{
value: 'xihu',
label: '西湖',
}],
}],
}, {
value: 'jiangsu',
label: '江苏',
children: [{
value: 'nanjing',
label: '南京',
children: [{
value: 'zhonghuamen',
label: '中华门',
}],
}],
}];
const columns = [{
title: '姓名',
dataIndex: 'name',
key: 'name',
render(text: any) {
return <a href="#">{text}</a>;
}
}, {
title: '年龄',
dataIndex: 'age',
key: 'age',
}, {
title: '住址',
dataIndex: 'address',
key: 'address',
}, {
title: '操作',
key: 'operation',
render(text: any, record: any) {
return (
<span>
<a href="#">{record.name}</a>
<span className="ant-divider"></span>
<a href="#"></a>
<span className="ant-divider"></span>
<a href="#" className="ant-dropdown-link">
<Icon type="down" />
</a>
</span>
);
}
}];
const data = [{
key: '1',
name: '胡彦斌',
age: 32,
address: '西湖区湖底公园1号'
}, {
key: '2',
name: '胡彦祖',
age: 42,
address: '西湖区湖底公园1号'
}, {
key: '3',
name: '李大嘴',
age: 32,
address: '西湖区湖底公园1号'
}];
// tests
class AccountForm extends React.Component<any, any>{
render() {
const { getFieldProps } = this.props.form;
return (
<Form inline>
<FormItem
label="账户:">
<Input placeholder="请输入账户名"
{...getFieldProps('userName') } />
</FormItem>
<FormItem
label="密码:">
<Input type="password" placeholder="请输入密码"
{...getFieldProps('password') } />
</FormItem>
<FormItem>
<label className="ant-checkbox-inline">
<Checkbox
{...getFieldProps('agreement') } />
</label>
</FormItem>
<Button type="primary" htmlType="submit"></Button>
</Form>
);
}
}
var Account = Form.create()(AccountForm);
// app
class App extends React.Component<any, any>{
render() {
message.success('success')
message.config({ top: 100 })
message.destroy()
message.info('info', 1000)
message.error('error', 3500)
Modal.info({ title: 'hello' });
Modal.success({ cancelText: 'No' })
notification.success({
message: 'hello',
description: 'test'
})
const props = {
name: 'file',
action: '/upload.do',
onChange(info: any) {
if (info.file.status !== 'uploading') {
console.log(info.file, info.fileList);
}
if (info.file.status === 'done') {
message.success(`${info.file.name} 上传成功。`);
} else if (info.file.status === 'error') {
message.error(`${info.file.name} 上传失败。`);
}
}
};
return <div>
<Affix>Affix</Affix>
<Row>
<Col>test</Col>
</Row>
<Alert message="Hello" type='info' closable={true}/>
<Badge count={10}/>
<Button type='primary'>Primary Button</Button>
<ButtonGroup>
<Button type='primary'>Primary Button</Button>
<Button type='ghost'>Primary Button</Button>
</ButtonGroup>
<Breadcrumb>
<Breadcrumb.Item></Breadcrumb.Item>
<Breadcrumb.Item href=""></Breadcrumb.Item>
<Breadcrumb.Item href=""></Breadcrumb.Item>
<Breadcrumb.Item></Breadcrumb.Item>
</Breadcrumb>
<Calendar/>
<Carousel autoplay>
<div><h3>1</h3></div>
<div><h3>2</h3></div>
<div><h3>3</h3></div>
<div><h3>4</h3></div>
</Carousel>
<Cascader options={options} />
<CheckboxGroup options={['Apple', 'Pear', 'Orange']} defaultValue={['Apple']} onChange={onChange} />
<Collapse defaultActiveKey={['1']}>
<Panel header="This is panel header 1" key="1">
<p>test1</p>
</Panel>
<Panel header="This is panel header 2" key="2">
<p>test2</p>
</Panel>
<Panel header="This is panel header 3" key="3">
<p>test3</p>
</Panel>
</Collapse>
<DatePicker defaultValue="2015-01-01" />
<RangePicker showTime format="yyyy/MM/dd HH:mm:ss" onChange={onChange} />
<MonthPicker defaultValue="2015-12" />
<Dropdown trigger={['click']} overlay={<div>Hello Dp</div>}>
<a className="ant-dropdown-link" href="#">
<Icon type="down" />
</a>
</Dropdown>
<DropdownButton overlay={<p>dpb</p>} type="primary">
</DropdownButton>
<InputNumber min={0} max={10}/>
<Menu
selectedKeys={[this.state.current]}
theme={this.state.theme}
mode="horizontal">
<Menu.Item key="mail">
<Icon type="mail" />
</Menu.Item>
<SubMenu title={<span><Icon type="setting" /> - </span>}>
<MenuItemGroup title="分组1">
<Menu.Item key="setting:1">1</Menu.Item>
<Menu.Item key="setting:2">2</Menu.Item>
</MenuItemGroup>
<MenuItemGroup title="分组2">
<Menu.Item key="setting:3">3</Menu.Item>
<Menu.Item key="setting:4">4</Menu.Item>
</MenuItemGroup>
</SubMenu>
</Menu>
<Modal title='Modal .....' maskClosable/>
<Pagination defaultCurrent={1} total={50} />,
<Popconfirm title="confirm .">
<a href="#">remove</a>
</Popconfirm>
<Popover overlay={<div>Overlay</div>} title="title">
<Button type="primary">display card</Button>
</Popover>
<ProgressCircle percent={75} />
<ProgressCircle percent={70} status="exception" />
<ProgressCircle percent={100} />
<ProgressLine percent={30} />
<ProgressLine percent={50} status="active" />
<ProgressLine percent={70} status="exception" />
<ProgressLine percent={100} />
<ProgressLine percent={50} showInfo={false} />
<QueueAnim>
<div key='demo1'>demo1</div>
<div key='demo2'>demo2</div>
<div key='demo3'>demo3</div>
<div key='demo4'>demo4</div>
</QueueAnim>
<RadioGroup>
<Radio key="a" value={1}>A</Radio>
<Radio key="b" value={2}>B</Radio>
<Radio key="c" value={3}>C</Radio>
<Radio key="d" value={null}>D</Radio>
</RadioGroup>
<Select defaultValue="lucy"
style={{ width: 200 }}
showSearch={false}>
<OptGroup label="Manager">
<Option value="jack">jack</Option>
<Option value="lucy">lucy</Option>
</OptGroup>
<OptGroup label="Engineer">
<Option value="yiminghe">yiminghe</Option>
</OptGroup>
</Select>
<Select defaultValue="lucy" style={{ width: 120 }} disabled>
<Option value="lucy">Lucy</Option>
</Select>
<Slider defaultValue={30} />
<Slider range defaultValue={[20, 50]} />
<Slider range defaultValue={[20, 50]} disabled />
<Spin />
<Step status="finish" title="步骤1" icon="cloud" />
<Step status="process" title="步骤2" icon="apple" />
<Step status="wait" title="步骤3" icon="github" />
<Switch defaultChecked={false} onChange={onChange} />,
<Tabs defaultActiveKey="1" onChange={onChange}>
<TabPane tab="选项卡一" key="1"></TabPane>
<TabPane tab="选项卡二" key="2"></TabPane>
<TabPane tab="选项卡三" key="3"></TabPane>
</Tabs>
<Tag></Tag>
<Tag></Tag>
<Tag closable onClose={() => { } }></Tag>
<Tag><a href="https://www.alipay.com/" target="_blank"></a></Tag>
<TimePicker onChange={onChange} />
<Timeline>
<Timeline.Item> 2015-09-01</Timeline.Item>
<Timeline.Item> 2015-09-01</Timeline.Item>
<Timeline.Item> 2015-09-01</Timeline.Item>
<Timeline.Item> 2015-09-01</Timeline.Item>
</Timeline>
<Tooltip title="提示文字">
<span></span>
</Tooltip>
<Transfer
dataSource={this.state.mockData}
targetKeys={this.state.targetKeys}
onChange={onChange} />
<Tree className="myCls" showLine multiple checkable
defaultExpandedKeys={this.state.defaultExpandedKeys}
defaultSelectedKeys={this.state.defaultSelectedKeys}
defaultCheckedKeys={this.state.defaultCheckedKeys}
>
<TreeNode title="parent 1" key="0-0">
<TreeNode title="parent 1-0" key="0-0-0" disabled>
<TreeNode title="leaf" key="0-0-0-0" disableCheckbox />
<TreeNode title="leaf" key="0-0-0-1" />
</TreeNode>
<TreeNode title="parent 1-1" key="0-0-1">
<TreeNode title={<span style={{ color: '#08c' }}>sss</span>} key="0-0-1-0" />
</TreeNode>
</TreeNode>
</Tree>
<Upload {...props}>
<Button type="ghost">
<Icon type="upload" />
</Button>
</Upload>
<TreeSelect style={{ width: 300 }}
value={this.state.value}
dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
placeholder="请选择"
allowClear
treeDefaultExpandAll
onChange={onChange}>
<TreeSelectTreeNode value="parent 1" title="parent 1" key="0-1">
<TreeSelectTreeNode value="parent 1-0" title="parent 1-0" key="0-1-1">
<TreeSelectTreeNode value="leaf1" title="my leaf" key="random" />
<TreeSelectTreeNode value="leaf2" title="your leaf" key="random1" />
</TreeSelectTreeNode>
<TreeSelectTreeNode value="parent 1-1" title="parent 1-1" key="random2">
<TreeSelectTreeNode value="sss" title={<b style={{ color: '#08c' }}>sss</b>} key="random3" />
</TreeSelectTreeNode>
</TreeSelectTreeNode>
</TreeSelect>
<Table columns={columns} dataSource={data}/>
</div>
}
}
-2083
View File
File diff suppressed because it is too large Load Diff
@@ -1,4 +1,3 @@
// More samples on: https://github.com/Microsoft/ApplicationInsights-JS/blob/master/API-reference.md
var config: Microsoft.ApplicationInsights.IConfig = {
@@ -24,28 +23,32 @@ var config: Microsoft.ApplicationInsights.IConfig = {
disableCorrelationHeaders: true,
disableFlushOnBeforeUnload: false,
enableSessionStorageBuffer: false,
cookieDomain: ""
cookieDomain: "",
isCookieUseDisabled: true,
isRetryDisabled: true,
isPerfAnalyzerEnabled: true,
isStorageUseDisabled: true
};
var appInsights: Microsoft.ApplicationInsights.IAppInsights = {
config: config,
config,
context: null,
queue: null,
startTrackPage(name?: string) { return null; },
stopTrackPage(name?: string, url?: string, properties?: { [name: string]: string; }, measurements?: { [name: string]: number; }) { return null; },
trackPageView(name?: string, url?: string, properties?: { [name: string]: string; }, measurements?: { [name: string]: number; }, duration?: number) { return null; },
startTrackEvent(name: string) { return null },
stopTrackEvent(name: string, properties?: { [name: string]: string; }, measurements?: { [name: string]: number; }) { return null },
trackEvent(name: string, properties?: { [name: string]: string; }, measurements?: { [name: string]: number; }) { return null },
trackAjax(id: string, absoluteUrl: string, pathName: string, totalTime: number, success: boolean, resultCode: number, method?: string) { return null },
trackException(exception: Error, handledAt?: string, properties?: { [name: string]: string; }, measurements?: { [name: string]: number; }, severityLevel?: AI.SeverityLevel) { return null },
trackMetric(name: string, average: number, sampleCount?: number, min?: number, max?: number, properties?: { [name: string]: string; }) { return null },
trackTrace(message: string, properties?: { [name: string]: string; }) { return null },
flush() { return null },
setAuthenticatedUserContext(authenticatedUserId: string, accountId?: string) { return null },
clearAuthenticatedUserContext() { return null },
_onerror(message: string, url: string, lineNumber: number, columnNumber: number, error: Error) { return null }
startTrackEvent(name: string) { return null; },
stopTrackEvent(name: string, properties?: { [name: string]: string; }, measurements?: { [name: string]: number; }) { return null; },
trackEvent(name: string, properties?: { [name: string]: string; }, measurements?: { [name: string]: number; }) { return null; },
trackDependency(id: string, method: string, absoluteUrl: string, pathName: string, totalTime: number, success: boolean, resultCode: number) { return null; },
trackException(exception: Error, handledAt?: string, properties?: { [name: string]: string; }, measurements?: { [name: string]: number; }, severityLevel?: AI.SeverityLevel) { return null; },
trackMetric(name: string, average: number, sampleCount?: number, min?: number, max?: number, properties?: { [name: string]: string; }) { return null; },
trackTrace(message: string, properties?: { [name: string]: string; }) { return null; },
flush() { return null; },
setAuthenticatedUserContext(authenticatedUserId: string, accountId?: string) { return null; },
clearAuthenticatedUserContext() { return null; },
_onerror(message: string, url: string, lineNumber: number, columnNumber: number, error: Error) { return null; }
};
// trackPageView
@@ -75,6 +78,9 @@ appInsights.trackException(new Error("sample error"), "handledAt", null, null);
appInsights.trackTrace("message");
appInsights.trackTrace("message", null);
// trackDependency
appInsights.trackDependency("id", "POST", "http://example.com/test/abc", "/test/abc", null, true, null);
// flush
appInsights.flush();
@@ -122,7 +128,8 @@ context.track(eventEnvelope);
// track exception
var exceptionObj = new Microsoft.ApplicationInsights.Telemetry.Exception(new Error(), "handledAt", null, null, AI.SeverityLevel.Critical);
var exceptionData = new Microsoft.ApplicationInsights.Telemetry.Common.Data<Microsoft.ApplicationInsights.Telemetry.Exception>(Microsoft.ApplicationInsights.Telemetry.Exception.dataType, exceptionObj);
var exceptionData = new Microsoft.ApplicationInsights.Telemetry.Common.Data<Microsoft.ApplicationInsights.Telemetry.Exception>(
Microsoft.ApplicationInsights.Telemetry.Exception.dataType, exceptionObj);
var exceptionEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(exceptionData, Microsoft.ApplicationInsights.Telemetry.Exception.envelopeType);
context.track(exceptionEnvelope);
@@ -140,13 +147,15 @@ context.track(pageViewEnvelope);
// track page view performance
var pageViewPerfObj = new Microsoft.ApplicationInsights.Telemetry.PageViewPerformance("page name", "url", 999, null, null);
var pageViewPerfData = new Microsoft.ApplicationInsights.Telemetry.Common.Data<Microsoft.ApplicationInsights.Telemetry.PageViewPerformance>(Microsoft.ApplicationInsights.Telemetry.PageViewPerformance.dataType, pageViewPerfObj);
var pageViewPerfData = new Microsoft.ApplicationInsights.Telemetry.Common.Data<Microsoft.ApplicationInsights.Telemetry.PageViewPerformance>(
Microsoft.ApplicationInsights.Telemetry.PageViewPerformance.dataType, pageViewPerfObj);
var pageViewPerfEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(pageViewPerfData, Microsoft.ApplicationInsights.Telemetry.PageViewPerformance.envelopeType);
context.track(pageViewPerfEnvelope);
// track remote dependency
var remoteDepObj = new Microsoft.ApplicationInsights.Telemetry.RemoteDependencyData("id", "url", "command", 1, true, 1234, "GET");
var remoteDepData = new Microsoft.ApplicationInsights.Telemetry.Common.Data<Microsoft.ApplicationInsights.Telemetry.RemoteDependencyData>(Microsoft.ApplicationInsights.Telemetry.RemoteDependencyData.dataType, remoteDepObj);
var remoteDepData = new Microsoft.ApplicationInsights.Telemetry.Common.Data<Microsoft.ApplicationInsights.Telemetry.RemoteDependencyData>(
Microsoft.ApplicationInsights.Telemetry.RemoteDependencyData.dataType, remoteDepObj);
var remoteDepEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(remoteDepData, Microsoft.ApplicationInsights.Telemetry.RemoteDependencyData.envelopeType);
context.track(pageViewPerfEnvelope);
+23 -20
View File
@@ -1,4 +1,4 @@
// Type definitions for ApplicationInsights-JS v0.23.2
// Type definitions for ApplicationInsights-JS 1.0
// Project: https://github.com/Microsoft/ApplicationInsights-JS
// Definitions by: Kamil Szostak <https://github.com/kamilszostak>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -306,7 +306,6 @@ declare module Microsoft.Telemetry {
}
declare module Microsoft.ApplicationInsights.Telemetry {
class Event implements Microsoft.ApplicationInsights.ISerializable {
static envelopeType: string;
static dataType: string;
@@ -323,7 +322,7 @@ declare module Microsoft.ApplicationInsights.Telemetry {
/**
* Constructs a new instance of the EventTelemetry object
*/
constructor(name: string, properties?: Object, measurements?: Object);
constructor(name: string, properties?: any, measurements?: any);
}
class Exception implements Microsoft.ApplicationInsights.ISerializable {
@@ -348,7 +347,7 @@ declare module Microsoft.ApplicationInsights.Telemetry {
/**
* Constructs a new isntance of the ExceptionTelemetry object
*/
constructor(exception: Error, handledAt?: string, properties?: Object, measurements?: Object, severityLevel?: AI.SeverityLevel);
constructor(exception: Error, handledAt?: string, properties?: any, measurements?: any, severityLevel?: AI.SeverityLevel);
/**
* Creates a simple exception with 1 stack frame. Useful for manual constracting of exception.
*/
@@ -369,7 +368,7 @@ declare module Microsoft.ApplicationInsights.Telemetry {
/**
* Constructs a new instance of the MetricTelemetry object
*/
constructor(name: string, value: number, count?: number, min?: number, max?: number, properties?: Object);
constructor(name: string, value: number, count?: number, min?: number, max?: number, properties?: any);
}
class PageView extends AI.PageViewData implements Microsoft.ApplicationInsights.ISerializable {
@@ -477,7 +476,7 @@ declare module Microsoft.ApplicationInsights.Telemetry {
/**
* Constructs a new instance of the MetricTelemetry object
*/
constructor(message: string, properties?: Object);
constructor(message: string, properties?: any);
}
}
@@ -567,8 +566,12 @@ declare module Microsoft.ApplicationInsights {
disableCorrelationHeaders?: boolean;
disableFlushOnBeforeUnload?: boolean;
enableSessionStorageBuffer?: boolean;
isCookieUseDisabled?: boolean;
cookieDomain?: string;
isRetryDisabled?: boolean;
isPerfAnalyzerEnabled?: boolean;
url?: string;
isStorageUseDisabled?: boolean;
}
/**
@@ -657,7 +660,7 @@ declare module Microsoft.ApplicationInsights {
interface IAppInsights {
config: IConfig;
context: ITelemetryContext;
queue: (() => void)[];
queue: Array<() => void>;
/**
* Starts timing how long the user views a page or other item. Call this when the page opens.
* This method doesn't send any telemetry. Call {@link stopTrackTelemetry} to log the page when it closes.
@@ -717,16 +720,16 @@ declare module Microsoft.ApplicationInsights {
[name: string]: number;
}): any;
/**
* Log an AJAX request
* @param id Event id
* @param absoluteUrl Full url
* @param pathName Leave this parameter blank
* @param totalTime Total time it took for AJAX request to complete
* @param success Whether AJAX request succeeded or failed
* @param resultCode Result code returned from AJAX call
* @param method HTTP verb that was used (GET, POST)
*/
trackAjax(id: string, absoluteUrl: string, pathName: string, totalTime: number, success: boolean, resultCode: number, method?: string): any;
* Log a dependency call
* @param id unique id, this is used by the backend o correlate server requests. Use Util.newId() to generate a unique Id.
* @param method represents request verb (GET, POST, etc.)
* @param absoluteUrl absolute url used to make the dependency request
* @param pathName the path part of the absolute url
* @param totalTime total request time
* @param success indicates if the request was sessessful
* @param resultCode response code returned by the dependency request
*/
trackDependency(id: string, method: string, absoluteUrl: string, pathName: string, totalTime: number, success: boolean, resultCode: number): any;
/**
* Log an exception you have caught.
* @param exception An Error from a catch clause, or the string error message.
@@ -755,7 +758,7 @@ declare module Microsoft.ApplicationInsights {
/**
* Log a diagnostic message.
* @param message A message string
* @param properties map[string, string] - additional data used to filter traces in the portal. Defaults to empty.
* @param properties map[string, string] - additional data used to filter traces in the portal. Defaults to empty.
*/
trackTrace(message: string, properties?: {
[name: string]: string;
@@ -776,7 +779,7 @@ declare module Microsoft.ApplicationInsights {
* Clears the authenticated user id and the account id from the user context.
*/
clearAuthenticatedUserContext(): any;
downloadAndSetup?(config: Microsoft.ApplicationInsights.IConfig): void;
downloadAndSetup?(config: Microsoft.ApplicationInsights.IConfig): any;
/**
* The custom error handler for Application Insights
* @param {string} message - The error message
@@ -790,7 +793,7 @@ declare module Microsoft.ApplicationInsights {
}
declare module 'applicationinsights-js' {
export let AppInsights: Microsoft.ApplicationInsights.IAppInsights;
const AppInsights: Microsoft.ApplicationInsights.IAppInsights;
}
declare var appInsights: Microsoft.ApplicationInsights.IAppInsights;
+8
View File
@@ -0,0 +1,8 @@
{
"extends": "../tslint.json",
"rules": {
"interface-name": [ false ],
"no-internal-module": false,
"no-single-declare-module": false
}
}
+1814 -147
View File
File diff suppressed because it is too large Load Diff
+45 -14
View File
@@ -1,4 +1,4 @@
// Type definitions for ArcGIS API for JavaScript 3.19
// Type definitions for ArcGIS API for JavaScript 3.20
// Project: https://developers.arcgis.com/javascript/3/
// Definitions by: Esri <https://github.com/Esri>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -21,7 +21,6 @@ declare module "esri" {
import Color = require("esri/Color");
import LocationProviderBase = require("esri/tasks/locationproviders/LocationProviderBase");
import PictureMarkerSymbol = require("esri/symbols/PictureMarkerSymbol");
import RouteParameters = require("esri/tasks/RouteParameters");
import SimpleLineSymbol = require("esri/symbols/SimpleLineSymbol");
import Font = require("esri/symbols/Font");
import ArcGISDynamicMapServiceLayer = require("esri/layers/ArcGISDynamicMapServiceLayer");
@@ -263,6 +262,12 @@ declare module "esri" {
/** The symbol in which the BlendRenderer is applied. */
symbol: Symbol;
}
export interface BookmarkItemOptions {
/** The extent for the specified bookmark item. */
extent?: Extent;
/** The name for the bookmark item. */
name?: string;
}
export interface BookmarksOptions {
/** An array of BookmarkItem objects or a json object with the BookmarkItem format to initially display in the bookmark widget. */
bookmarks?: BookmarkItem[];
@@ -282,8 +287,14 @@ declare module "esri" {
latitudeFieldName?: string;
/** The longitude field name. */
longitudeFieldName?: string;
/** Opacity or transparency of layer. */
opacity?: number;
/** An array of strings which correspond to fields to include in the CSVLayer. */
outFields?: string[];
/** Refresh interval of the layer in minutes. */
refreshInterval?: number;
/** Visibility of the layer. */
visible?: boolean;
}
export interface ChooseBestFacilitiesOptions {
/** The URL to the analysis service, for example "http://analysis.arcgis.com/arcgis/rest/services/tasks/GPServer". */
@@ -624,8 +635,8 @@ declare module "esri" {
canModifyStops?: boolean;
/** Center the map at the start of the selected route segment. */
centerAtSegmentStart?: boolean;
/** The returned directions object from the routing solve result. */
directions?: any;
/** The locale used for the directions. */
directionsLanguage?: string;
/** Length units. */
directionsLengthUnits?: string;
/** Enable the dragging of stop locations on the map. */
@@ -658,8 +669,6 @@ declare module "esri" {
printTemplate?: string;
/** When true, the route will return to start point. */
returnToStart?: boolean;
/** Specify the input parameters for the route task. */
routeParams?: RouteParameters;
/** Define the symbol used to draw the route on the map. */
routeSymbol?: SimpleLineSymbol;
/** Specify the service that will be used to calculate directions. */
@@ -672,6 +681,8 @@ declare module "esri" {
segmentSymbol?: SimpleLineSymbol;
/** Defines whether the Directions widget will show the map-click-active toggle button. */
showActivateButton?: boolean;
/** Indicates whether to expose barriers when using the widget. */
showBarriersButton?: boolean;
/** If true, the Clear button is shown. */
showClearButton?: boolean;
/** If true, the toggle button group allowing user to choose between Miles and Kilometers is shown. */
@@ -1076,6 +1087,8 @@ declare module "esri" {
export interface GeoRSSLayerOptions {
/** The template used to display popup window for identify operation. */
infoTemplate?: InfoTemplate;
/** Opacity or transparency of layer. */
opacity?: number;
/** The output spatial reference for the GeoRSSLayer. */
outSpatialReference?: SpatialReference;
/** The default symbol use to display point features. */
@@ -1084,6 +1097,8 @@ declare module "esri" {
polygonSymbol?: Symbol;
/** The default symbol used to display polyline features. */
polylineSymbol?: Symbol;
/** Refresh interval of the layer in minutes. */
refreshInterval?: number;
}
export interface GeocoderOptions {
/** By default, the Geocoder widget uses the Esri World Locator to find search locations. */
@@ -3235,7 +3250,7 @@ declare module "esri/arcgis/Portal" {
tags: string[];
/** The url to the thumbnail image for the user. */
thumbnailUrl: string;
/** The url for the user content. */
/** The URL for the user content. */
userContentUrl: string;
/** The username for the user. */
username: string;
@@ -3554,16 +3569,15 @@ declare module "esri/dijit/BasemapToggle" {
}
declare module "esri/dijit/BookmarkItem" {
import Extent = require("esri/geometry/Extent");
import esri = require("esri");
/** Defines a bookmark for use in the Bookmark widget. */
class BookmarkItem {
/**
* Creates a new BookmarkItem.
* @param name The name for the bookmark item.
* @param extent The extent for the specified bookmark item.
* @param params See options list for parameters.
*/
constructor(name: string, extent: Extent);
constructor(params?: esri.BookmarkItemOptions);
}
export = BookmarkItem;
}
@@ -3815,7 +3829,6 @@ declare module "esri/dijit/Directions" {
import esri = require("esri");
import DirectionsFeatureSet = require("esri/tasks/DirectionsFeatureSet");
import Graphic = require("esri/graphic");
import RouteParameters = require("esri/tasks/RouteParameters");
import RouteTask = require("esri/tasks/RouteTask");
import Point = require("esri/geometry/Point");
import RouteResult = require("esri/tasks/RouteResult");
@@ -3832,14 +3845,14 @@ declare module "esri/dijit/Directions" {
mergedRouteGraphic: Graphic;
/** If specified, this specifies the portal where the produced route layers are going to be stored and accessed. */
portalUrl: string;
/** Routing parameters for the widget. */
routeParams: RouteParameters;
/** Routing task for the widget. */
routeTask: RouteTask;
/** Read-only: The Service Description object returned by the Route REST Endpoint. */
serviceDescription: any;
/** Indicates whether the Directions widget will display the map-click-active toggle button. */
showActivateButton: boolean;
/** Indicates whether to expose barriers when using the widget. */
showBarriersButton: boolean;
/** If true, the Clear button is shown. */
showClearButton: boolean;
/** If true, the toggle button group allowing user to choose between Miles and Kilometers is shown. */
@@ -9230,8 +9243,14 @@ declare module "esri/layers/CSVLayer" {
latitudeFieldName: string;
/** The longitude field name. */
longitudeFieldName: string;
/** Opacity or transparency of layer. */
opacity: number;
/** Refresh interval of the layer in minutes. */
refreshInterval: number;
/** The url to a CSV resource. */
url: string;
/** Visibility of the layer. */
visible: boolean;
/**
* Creates a CSV layer.
* @param url URL to a CSV resource.
@@ -9938,6 +9957,10 @@ declare module "esri/layers/GeoRSSLayer" {
items: Graphic[];
/** The name of the layer. */
name: string;
/** Opacity or transparency of layer. */
opacity: number;
/** Refresh interval of the layer in minutes. */
refreshInterval: number;
/** The publicly accessible URL to a GeoRSS file. */
url: string;
/**
@@ -11703,6 +11726,7 @@ declare module "esri/layers/pixelfilters/StretchFilter" {
declare module "esri/map" {
import esri = require("esri");
import Attribution = require("esri/dijit/Attribution");
import Color = require("esri/Color");
import Extent = require("esri/geometry/Extent");
import GraphicsLayer = require("esri/layers/GraphicsLayer");
import InfoWindowBase = require("esri/InfoWindowBase");
@@ -11721,6 +11745,8 @@ declare module "esri/map" {
attribution: Attribution;
/** Value is true when the map automatically resizes if the browser window or ContentPane widget enclosing the map is resized. */
autoResize: boolean;
/** The background color "behind" the map. */
backgroundColor: Color;
/** An array of IDs corresponding to the layers that make up the map's current basemap. */
basemapLayerIds: string[];
/** The current extent of the map in map units. */
@@ -11924,6 +11950,11 @@ declare module "esri/map" {
* @param immediate By default, the actual resize logic is delayed internally in order to throttle spurious resize events dispatched by some browsers.
*/
resize(immediate?: boolean): void;
/**
* Change the background color of the map.
* @param color Color specified using either a named string (e.g.
*/
setBackgroundColor(color: Color | string): void;
/**
* Change the map's current basemap.
* @param basemap A valid basemap name.
-3
View File
@@ -1,6 +1,3 @@
/// <reference types="node" />
import Archiver = require('archiver');
import FS = require('fs');
+2 -4
View File
@@ -164,7 +164,6 @@ interface SpeechSynthesisVoice {
}
declare namespace Artyom {
interface ArtyomDevice {
isChrome(): boolean;
isMobile(): boolean;
@@ -235,7 +234,7 @@ declare namespace Artyom {
onend(): void;
}
export interface ArtyomJS {
interface ArtyomJS {
/**
* Contains some basic information that artyom needs to know as the type of device and browser
* @see http://ourcodeworld.com/projects/projects-documentation/6/read-doc/artyom-device/artyom-js
@@ -499,13 +498,12 @@ declare namespace Artyom {
/**
* ArtyomBuilder bla, bla...
*/
export class ArtyomBuilder {
class ArtyomBuilder {
/**
* Method to bla, bla, bla...
*/
static getInstance(): ArtyomJS
}
}
// tslint:disable-next-line:export-just-namespace
+21 -22
View File
@@ -6,17 +6,16 @@
interface Dictionary<T> { [key: string]: T; }
interface ErrorCallback<T> { (err?: T): void; }
interface AsyncWaterfallCallback<E> { (err: E, ...args: any[]): void; }
interface AsyncBooleanResultCallback<E> { (err: E, truthValue: boolean): void; }
interface AsyncResultCallback<T, E> { (err: E, result: T): void; }
interface AsyncResultArrayCallback<T, E> { (err: E, results: T[]): void; }
interface AsyncResultObjectCallback<T, E> { (err: E, results: Dictionary<T>): void; }
interface AsyncBooleanResultCallback<E> { (err?: E, truthValue?: boolean): void; }
interface AsyncResultCallback<T, E> { (err?: E, result?: T): void; }
interface AsyncResultArrayCallback<T, E> { (err?: E, results?: (T | undefined)[]): void; }
interface AsyncResultObjectCallback<T, E> { (err: E | undefined, results: Dictionary<T | undefined>): void; }
interface AsyncFunction<T, E> { (callback: (err?: E, result?: T) => void): void; }
interface AsyncIterator<T, E> { (item: T, callback: ErrorCallback<E>): void; }
interface AsyncForEachOfIterator<T, E> { (item: T, key: number|string, callback: ErrorCallback<E>): void; }
interface AsyncResultIterator<T, R, E> { (item: T, callback: AsyncResultCallback<R, E>): void; }
interface AsyncMemoIterator<T, R, E> { (memo: R, item: T, callback: AsyncResultCallback<R, E>): void; }
interface AsyncMemoIterator<T, R, E> { (memo: R | undefined, item: T, callback: AsyncResultCallback<R, E>): void; }
interface AsyncBooleanIterator<T, E> { (item: T, callback: AsyncBooleanResultCallback<E>): void; }
interface AsyncWorker<T, E> { (task: T, callback: ErrorCallback<E>): void; }
@@ -76,7 +75,7 @@ interface AsyncPriorityQueue<T> {
interface AsyncCargo {
length(): number;
payload: number;
payload?: number;
push(task: any, callback? : Function): void;
push(task: any[], callback? : Function): void;
saturated(): void;
@@ -175,7 +174,7 @@ interface Async {
during<E>(test: (testCallback : AsyncBooleanResultCallback<E>) => void, fn: AsyncVoidFunction<E>, callback: ErrorCallback<E>): void;
doDuring<E>(fn: AsyncVoidFunction<E>, test: (testCallback: AsyncBooleanResultCallback<E>) => void, callback: ErrorCallback<E>): void;
forever<E>(next: (next : ErrorCallback<E>) => void, errBack: ErrorCallback<E>) : void;
waterfall<T, E>(tasks: Function[], callback?: AsyncResultCallback<T,E>): void;
waterfall<T, E>(tasks: Function[], callback?: AsyncResultCallback<T, E | Error>): void;
compose(...fns: Function[]): Function;
seq(...fns: Function[]): Function;
applyEach(fns: Function[], argsAndCallback: any[]): void; // applyEach(fns, args..., callback). TS does not support ... for a middle argument. Callback is optional.
@@ -186,29 +185,30 @@ interface Async {
cargo<E>(worker : (tasks: any[], callback : ErrorCallback<E>) => void, payload? : number) : AsyncCargo;
auto<E>(tasks: any, concurrency?: number, callback?: AsyncResultCallback<any, E>): void;
autoInject<E>(tasks: any, callback?: AsyncResultCallback<any, E>): void;
retry<T, E>(opts: number, task: (callback : AsyncResultCallback<T, E>, results: any) => void, callback: AsyncResultCallback<any, E>): void;
retry<T, E>(opts: { times: number, interval: number|((retryCount: number) => number) }, task: (callback: AsyncResultCallback<T, E>, results : any) => void, callback: AsyncResultCallback<any, E>): void;
retryable<T, E>(opts: number | {times: number, interval: number}, task: AsyncFunction<T, E>): AsyncFunction<T, E>;
apply<E>(fn: Function, ...arguments: any[]): AsyncFunction<any,E>;
retry<T, E>(opts: number, task: (callback : AsyncResultCallback<T, E>, results: any) => void, callback: AsyncResultCallback<any, E | Error>): void;
retry<T, E>(opts: { times: number, interval: number|((retryCount: number) => number) }, task: (callback: AsyncResultCallback<T, E>, results : any) => void, callback: AsyncResultCallback<any, E | Error>): void;
retryable<T, E>(opts: number | {times: number, interval: number}, task: AsyncFunction<T, E>): AsyncFunction<T, E | Error>;
apply<E>(fn: Function, ...arguments: any[]): AsyncFunction<any,E | Error>;
nextTick(callback: Function, ...args: any[]): void;
setImmediate: typeof async.nextTick;
reflect<T, E>(fn: AsyncFunction<T, E>) : (callback: (err: void, result: {error?: Error, value?: T}) => void) => void;
reflectAll<T, E>(tasks: AsyncFunction<T, E>[]): ((callback: (err: void, result: {error?: Error, value?: T}) => void) => void)[];
reflect<T, E>(fn: AsyncFunction<T, E>) : (callback: (err: null, result: {error?: E, value?: T}) => void) => void;
reflectAll<T, E>(tasks: AsyncFunction<T, E>[]): ((callback: (err: null, result: {error?: E, value?: T}) => void) => void)[];
timeout<T, E>(fn: AsyncFunction<T, E>, milliseconds: number, info?: any): AsyncFunction<T, E>;
timeout<T, R, E>(fn: AsyncResultIterator<T, R, E>, milliseconds: number, info?: any): AsyncResultIterator<T, R, E>;
timeout<T, E>(fn: AsyncFunction<T, E>, milliseconds: number, info?: any): AsyncFunction<T, E | Error>;
timeout<T, R, E>(fn: AsyncResultIterator<T, R, E>, milliseconds: number, info?: any): AsyncResultIterator<T, R, E | Error>;
times<T, E> (n: number, iterator: AsyncResultIterator<number, T, E>, callback: AsyncResultArrayCallback<T, E>): void;
timesSeries<T, E>(n: number, iterator: AsyncResultIterator<number, T, E>, callback: AsyncResultArrayCallback<T, E>): void;
timesLimit<T, E>(n: number, limit: number, iterator: AsyncResultIterator<number, T, E>, callback: AsyncResultArrayCallback<T, E>): void;
transform<T, R, E>(arr: T[], iteratee: (acc: R[], item: T, key: string, callback: (error?: E) => void) => void): void;
transform<T, R, E>(arr: T[], acc: R[], iteratee: (acc: R[], item: T, key: string, callback: (error?: E) => void) => void): void;
transform<T, R, E>(arr: {[key: string] : T}, iteratee: (acc: {[key: string] : R}, item: T, key: string, callback: (error?: E) => void) => void): void;
transform<T, R, E>(arr: {[key: string] : T}, acc: {[key: string] : R}, iteratee: (acc: {[key: string] : R}, item: T, key: string, callback: (error?: E) => void) => void): void;
transform<T, R, E>(arr: T[], iteratee: (acc: R[], item: T, key: number, callback: (error?: E) => void) => void, callback?: AsyncResultArrayCallback<T, E>): void;
transform<T, R, E>(arr: T[], acc: R[], iteratee: (acc: R[], item: T, key: number, callback: (error?: E) => void) => void, callback?: AsyncResultArrayCallback<T, E>): void;
race<T, E>(tasks: (AsyncFunction<T, E>)[], callback: AsyncResultCallback<T, E>) : void;
transform<T, R, E>(arr: {[key: string] : T}, iteratee: (acc: {[key: string] : R}, item: T, key: string, callback: (error?: E) => void) => void, callback?: AsyncResultObjectCallback<T, E>): void;
transform<T, R, E>(arr: {[key: string] : T}, acc: {[key: string] : R}, iteratee: (acc: {[key: string] : R}, item: T, key: string, callback: (error?: E) => void) => void, callback?: AsyncResultObjectCallback<T, E>): void;
race<T, E>(tasks: (AsyncFunction<T, E>)[], callback: AsyncResultCallback<T, E | Error>) : void;
// Utils
memoize(fn: Function, hasher?: Function): Function;
@@ -226,4 +226,3 @@ declare var async: Async;
declare module "async" {
export = async;
}
+42 -12
View File
@@ -1,44 +1,74 @@
interface StringCallback { (err: Error, result: string): void; }
interface StringCallback { (err?: Error, result?: string): void; }
interface AsyncStringGetter { (callback: StringCallback): void; }
var taskArray: AsyncStringGetter[] = [
function (callback) {
setTimeout(function () {
callback(null, 'one');
callback(undefined, 'one');
}, 200);
},
function (callback) {
setTimeout(function () {
callback(null, 'two');
callback(undefined, 'two');
}, 100);
},
];
async.series(taskArray, function (err, results) { console.log(results[0].match(/o/)) });
async.parallel(taskArray, function (err, results) { console.log(results[0].match(/o/)) });
async.parallelLimit(taskArray, 3, function (err, results) { console.log(results[0].match(/o/)) });
async.series(taskArray, function (err, results) {
if (results) {
let first = results[0];
if (first) {
console.log(first.match(/o/))
}
}
});
async.parallel(taskArray, function (err, results) {
if (results) {
let first = results[0];
if (first) {
console.log(first.match(/o/))
}
}
});
async.parallelLimit(taskArray, 3, function (err, results) {
if (results) {
let first = results[0];
if (first) {
console.log(first.match(/o/))
}
}
});
interface Lookup<T> { [key: string]: T; }
interface NumberCallback { (err: Error, result: number): void; }
interface NumberCallback { (err?: Error, result?: number): void; }
interface AsyncNumberGetter { (callback: NumberCallback): void; }
var taskDict: Lookup<AsyncNumberGetter> = {
one: function(callback){
setTimeout(function(){
callback(null, 1);
callback(undefined, 1);
}, 200);
},
two: function(callback){
setTimeout(function(){
callback(null, 2);
callback(undefined, 2);
}, 100);
}
}
async.series(taskDict, function(err, results) { console.log(results['one'].toFixed(1)) });
async.parallel(taskDict, function(err, results) { console.log(results['one'].toFixed(1)) });
async.parallelLimit(taskDict, 3, function(err, results) { console.log(results['one'].toFixed(1)) });
async.series(taskDict, function(err, results) {
let one = results['one'];
console.log(one && one.toFixed(1))
});
async.parallel(taskDict, function(err, results) {
let one = results['one'];
console.log(one && one.toFixed(1))
});
async.parallelLimit(taskDict, 3, function(err, results) {
let one = results['one'];
console.log(one && one.toFixed(1))
});
+8 -8
View File
@@ -350,9 +350,9 @@ q2.unshift(['task3', 'task4', 'task5'], function (error) {
});
var aq = async.queue<number, number, Error>(function (level: number, callback: (error : Error, newLevel: number) => void) {
var aq = async.queue<number, number, Error>(function (level: number, callback: (error?: Error, newLevel?: number) => void) {
console.log('hello ' + level);
callback(null, level+1);
callback(undefined, level+1);
});
aq.push(1, function (err : Error, newLevel : number) {
@@ -807,9 +807,9 @@ async.some<number, Error>({
// timeout
function myFunction1(foo : any, callback: (err : Error, result : any) => void ) : void {
function myFunction1(foo : any, callback: (err?: Error, result?: any) => void ) : void {
console.log(`async.timeout 1 ${foo}`);
return callback(null, foo);
return callback(undefined, foo);
}
var wrapped1 = async.timeout(myFunction1, 1000);
wrapped1({ bar: 'bar' }, function(err : Error, data : any) {
@@ -817,9 +817,9 @@ wrapped1({ bar: 'bar' }, function(err : Error, data : any) {
});
function myFunction2(callback: (err : Error, result : any) => void ) : void {
function myFunction2(callback: (err?: Error, result?: any) => void ) : void {
console.log(`async.timeout 2`);
return callback(null, { bar: 'bar' });
return callback(undefined, { bar: 'bar' });
}
var wrapped2 = async.timeout(myFunction2, 1000);
@@ -827,9 +827,9 @@ wrapped2( function(err : Error, data : any) {
console.log(`async.timeout 2 end ${data}`);
});
function myFunction3(callback: (err : Error, result : any) => void ) : void {
function myFunction3(callback: (err?: Error, result?: any) => void ) : void {
console.log(`async.timeout 3`);
return callback(null, { bar: 'bar' });
return callback(undefined, { bar: 'bar' });
}
var wrapped3 = async.timeout(myFunction3, 1000, { bar: 'bar' });
+2 -2
View File
@@ -6,7 +6,7 @@
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
@@ -20,4 +20,4 @@
"test/index.ts",
"test/explicit.ts"
]
}
}
-1
View File
@@ -1,5 +1,4 @@
/// <reference types="node" />
/// <reference types="pathwatcher" />
import path = require("path");
import _atom = require("atom");
+1 -1
View File
@@ -3,7 +3,6 @@
// Definitions by: vvakame <https://github.com/vvakame/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="q" />
/// <reference types="jquery" />
/// <reference types="space-pen" />
/// <reference types="emissary" />
@@ -1519,6 +1518,7 @@ declare var atom:AtomCore.IAtom;
declare module "atom" {
import spacePen = require("space-pen");
import Q = require("q");
var $:typeof spacePen.$;
var $$:typeof spacePen.$$;
+3
View File
@@ -12,6 +12,9 @@
"typeRoots": [
"../"
],
"paths": {
"q": [ "q/v0" ]
},
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
@@ -0,0 +1,9 @@
export class ViewModel {
constructor(private knockoutBindable: KnockoutBindable) {
}
activate(settings: any): void {
this.knockoutBindable.applyBindableValues(settings, this);
this.knockoutBindable.applyBindableValues(settings, this, true);
}
}
+18
View File
@@ -0,0 +1,18 @@
// Type definitions for aurelia-knockout 2.0
// Project: https://github.com/code-chris/aurelia-knockout
// Definitions by: Christian Kotzbauer <https://github.com/code-chris>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
interface KnockoutBindable {
/**
* Applys all values from a data object (usually the activation data) to the corresponding instance fields
* in the current view model if they are marked as @bindable. By default all matching values from the data object
* are applied. To only apply observable values set the last parameter to `true`. Subscriptions are created
* for all Knockout observables in the data object to update the view-model values respectively.
*
* @param data - the data object
* @param target - the target view model
* @param applyOnlyObservables - `true` if only observable values should be applied, false by default.
*/
applyBindableValues(data: any, target: any, applyOnlyObservables?: boolean): void;
}
@@ -18,6 +18,6 @@
},
"files": [
"index.d.ts",
"localforage-tests.ts"
"aurelia-knockout-tests.ts"
]
}
}
+28 -6
View File
@@ -1,4 +1,4 @@
import 'auth0-js';
import * as auth0 from 'auth0-js';
let webAuth = new auth0.WebAuth({
domain: 'mine.auth0.com',
@@ -61,10 +61,8 @@ webAuth.signupAndAuthorize({
});
webAuth.client.login({
ealm: 'Username-Password-Authentication', //connection name or HRD domain
realm: 'Username-Password-Authentication', //connection name or HRD domain
username: 'info@auth0.com',
password: 'areallystrongpassword',
audience: 'https://mystore.com/api/v2',
@@ -73,6 +71,26 @@ webAuth.client.login({
// Auth tokens in the result or an error
});
webAuth.popup.buildPopupHandler();
webAuth.popup.preload({});
webAuth.popup.authorize({}, (err, data) => {
if (err) /* handle error */ return;
// do something with data
});
webAuth.popup.loginWithCredentials({}, (err, data) => {
if (err) /* handle error */ return;
// do something with data
});
webAuth.popup.passwordlessVerify({}, (err, data) => {
if (err) /* handle error */ return;
// do something with data
});
webAuth.popup.signupAndLogin({}, (err, data) => {
if (err) /* handle error */ return;
// do something with data
});
let authentication = new auth0.Authentication({
domain: 'me.auth0.com',
clientID: '...',
@@ -101,7 +119,9 @@ authentication.delegation({
refresh_token: 'your_refresh_token',
api_type: 'app'
}, (err, data) => {
if (!err) {
localStorage.setItem('token', data.idToken)
}
});
authentication.loginWithDefaultDirectory({
@@ -146,6 +166,8 @@ let management = new auth0.Management({
management.getUser('asd', (err, user) => {});
management.patchUserMetadata('asd', {role: 'admin'}, (err, user) => {});
management.patchUserMetadata('asd', {role: 'admin'}, (err, user) => {
if (!err && user.email_verified) return; // do something
});
management.linkUser('asd', 'eqwe', (err, user) => {});
+497 -437
View File
@@ -1,456 +1,516 @@
// Type definitions for Auth0.js 8.1
// Type definitions for Auth0.js 8.3
// Project: https://github.com/auth0/auth0.js
// Definitions by: Adrian Chia <https://github.com/adrianchia>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace auth0 {
export as namespace auth0;
export class Authentication {
constructor(options: AuthOptions);
passwordless: PasswordlessAuthentication;
dbConnection: DBConnection;
export class Authentication {
constructor(options: AuthOptions);
/**
* Builds and returns the `/authorize` url in order to initialize a new authN/authZ transaction
*
* @method buildAuthorizeUrl
* @param {Object} options: https://auth0.com/docs/api/authentication#!#get--authorize_db
*/
buildAuthorizeUrl(options: any): string;
passwordless: PasswordlessAuthentication;
dbConnection: DBConnection;
/**
* Builds and returns the Logout url in order to initialize a new authN/authZ transaction
*
* @method buildLogoutUrl
* @param {Object} options: https://auth0.com/docs/api/authentication#!#get--v2-logout
*/
buildLogoutUrl(options?: any): string;
/**
* Builds and returns the `/authorize` url in order to initialize a new authN/authZ transaction
*
* @method buildAuthorizeUrl
* @param {Object} options: https://auth0.com/docs/api/authentication#!#get--authorize_db
*/
buildAuthorizeUrl(options: any): string;
/**
* Makes a call to the `oauth/token` endpoint with `password` grant type
*
* @method loginWithDefaultDirectory
* @param {Object} options: https://auth0.com/docs/api-auth/grant/password
* @param {Function} callback
*/
loginWithDefaultDirectory(options: any, callback: (error?: Auth0Error, authResult?: any) => any): void;
/**
* Builds and returns the Logout url in order to initialize a new authN/authZ transaction
*
* @method buildLogoutUrl
* @param {Object} options: https://auth0.com/docs/api/authentication#!#get--v2-logout
*/
buildLogoutUrl(options?: any): string;
/**
* Makes a call to the `/ro` endpoint
* @param {any} options
* @param {Function} callback
* @deprecated `loginWithResourceOwner` will be soon deprecated, user `login` instead.
*/
loginWithResourceOwner(options: any, callback: (error?: Auth0Error, authResult?: any) => any): void;
/**
* Makes a call to the `oauth/token` endpoint with `password` grant type
*
* @method loginWithDefaultDirectory
* @param {Object} options: https://auth0.com/docs/api-auth/grant/password
* @param {Function} callback
*/
loginWithDefaultDirectory(options: any, callback: Auth0Callback<any>): void;
/**
* Makes a call to the `oauth/token` endpoint with `password-realm` grant type
* @param {any} options
* @param {Function} callback
*/
login(options: any, callback: (error?: Auth0Error, authResult?: any) => any): void;
/**
* Makes a call to the `/ro` endpoint
* @param {any} options
* @param {Function} callback
* @deprecated `loginWithResourceOwner` will be soon deprecated, user `login` instead.
*/
loginWithResourceOwner(options: any, callback: Auth0Callback<any>): void;
/**
* Makes a call to the `oauth/token` endpoint
* @param {any} options
* @param {Function} callback
*/
oauthToken(options: any, callback: (error?: Auth0Error, authResult?: any) => any): void;
/**
* Makes a call to the `oauth/token` endpoint with `password-realm` grant type
* @param {any} options
* @param {Function} callback
*/
login(options: any, callback: Auth0Callback<any>): void;
/**
* Makes a call to the `/ssodata` endpoint
*
* @method getSSOData
* @param {Boolean} withActiveDirectories
* @param {Function} callback
* @deprecated `getSSOData` will be soon deprecated.
*/
getSSOData(callback?: (error?: Auth0Error, authResult?: any) => any): void;
/**
* Makes a call to the `oauth/token` endpoint
* @param {any} options
* @param {Function} callback
*/
oauthToken(options: any, callback: Auth0Callback<any>): void;
/**
* Makes a call to the `/ssodata` endpoint
*
* @method getSSOData
* @param {Boolean} withActiveDirectories
* @param {Function} callback
* @deprecated `getSSOData` will be soon deprecated.
*/
getSSOData(withActiveDirectories: boolean, callback?: (error?: Auth0Error, authResult?: any) => any): void;
/**
* Makes a call to the `/ssodata` endpoint
*
* @method getSSOData
* @param {Function} callback
*/
getSSOData(callback?: Auth0Callback<any>): void;
/**
* Makes a call to the `/userinfo` endpoint and returns the user profile
*
* @method userInfo
* @param {String} accessToken
* @param {Function} callback
*/
userInfo(token: string, callback: (error?: Auth0Error, user?: any) => any): void;
/**
* Makes a call to the `/ssodata` endpoint
*
* @method getSSOData
* @param {Boolean} withActiveDirectories
* @param {Function} callback
*/
getSSOData(withActiveDirectories: boolean, callback?: Auth0Callback<any>): void;
/**
* Makes a call to the `/delegation` endpoint
*
* @method delegation
* @param {Object} options: https://auth0.com/docs/api/authentication#!#post--delegation
* @param {Function} callback
* @deprecated `delegation` will be soon deprecated.
*/
delegation(options: any, callback: (error?: Auth0Error, authResult?: Auth0DelegationToken) => any): any;
/**
* Makes a call to the `/userinfo` endpoint and returns the user profile
*
* @method userInfo
* @param {String} accessToken
* @param {Function} callback
*/
userInfo(token: string, callback: Auth0Callback<Auth0UserProfile>): void;
/**
* Fetches the user country based on the ip.
*
* @method getUserCountry
* @param {Function} callback
*/
getUserCountry(callback: (error?: Auth0Error, result?: any) => any): void;
}
export class PasswordlessAuthentication {
constructor(request: any, option: any);
/**
* Builds and returns the passwordless TOTP verify url in order to initialize a new authN/authZ transaction
*
* @method buildVerifyUrl
* @param {Object} options
* @param {Function} callback
*/
buildVerifyUrl(options: any): string;
/**
* Initializes a new passwordless authN/authZ transaction
*
* @method start
* @param {Object} options: https://auth0.com/docs/api/authentication#passwordless
* @param {Function} callback
*/
start(options: PasswordlessStartOptions, callback: any): void;
/**
* Verifies the passwordless TOTP and returns an error if any.
*
* @method buildVerifyUrl
* @param {Object} options
* @param {Function} callback
*/
verify(options: any, callback: any): void;
}
export class DBConnection {
constructor(request: any, option: any);
/**
* Signup a new user
*
* @method signup
* @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup
* @param {Function} calback
*/
signup(options: any, callback: any): void;
/**
* Initializes the change password flow
*
* @method signup
* @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-change_password
* @param {Function} callback
*/
changePassword(options: ChangePasswordOptions, callback: any): void;
}
export class Management {
constructor(options: ManagementOptions);
/**
* Returns the user profile. https://auth0.com/docs/api/management/v2#!/Users/get_users_by_id
*
* @method getUser
* @param {String} userId
* @param {Function} callback
*/
getUser(userId: string, callback: (error?: Auth0Error, user?: any) => any): void;
/**
* Updates the user metdata. It will patch the user metdata with the attributes sent.
* https://auth0.com/docs/api/management/v2#!/Users/patch_users_by_id
*
* @method patchUserMetadata
* @param {String} userId
* @param {Object} userMetadata
* @param {Function} callback
*/
patchUserMetadata(userId: string, userMetadata: any, callback: (error?: Auth0Error, user?: any) => any): void;
/**
* Link two users. https://auth0.com/docs/api/management/v2#!/Users/post_identities
*
* @method linkUser
* @param {String} userId
* @param {String} secondaryUserToken
* @param {Function} callback
*/
linkUser(userId: string, secondaryUserToken: string, callback: (error?: Auth0Error, user?: any) => any): void;
}
export class WebAuth {
constructor(options: AuthOptions);
client: Authentication;
popup: Popup;
redirect: Redirect;
/**
* Redirects to the hosted login page (`/authorize`) in order to initialize a new authN/authZ transaction
*
* @method authorize
* @param {Object} options: https://auth0.com/docs/api/authentication#!#get--authorize_db
*/
authorize(options: any): void;
/**
* Parse the url hash and extract the returned tokens depending on the transaction.
*
* Only validates id_tokens signed by Auth0 using the RS256 algorithm using the public key exposed
* by the `/.well-known/jwks.json` endpoint. Id tokens signed with other algorithms will not be
* accepted.
*
* @method parseHash
* @param {Object} options:
* @param {String} options.state [OPTIONAL] to verify the response
* @param {String} options.nonce [OPTIONAL] to verify the id_token
* @param {String} options.hash [OPTIONAL] the url hash. If not provided it will extract from window.location.hash
* @param {Function} callback: any(err, token_payload)
*/
parseHash(options: any, callback: (error?: Auth0Error, authResult?: any) => any): void;
/**
* Decodes the id_token and verifies the nonce.
*
* @method validateToken
* @param {String} token
* @param {String} state
* @param {String} nonce
* @param {Function} callback: function(err, {payload, transaction})
*/
validateToken(token: string, state: string, nonce: string, callback: any): void;
/**
* Executes a silent authentication transaction under the hood in order to fetch a new token.
*
* @method renewAuth
* @param {Object} options: any valid oauth2 parameter to be sent to the `/authorize` endpoint
* @param {Function} callback
*/
renewAuth(options: any, callback: (error?: Auth0Error, authResult?: any) => any): void;
/**
* Initialices a change password transaction
*
* @method changePassword
* @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-change_password
* @param {Function} callback
*/
changePassword(options: any, callback: (error?: Auth0Error, authResult?: any) => any): void;
/**
* Signs up a new user
*
* @method signup
* @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup
* @param {Function} callback
*/
signup(options: any, callback: any): void;
/**
* Signs up a new user, automatically logs the user in after the signup and returns the user token.
* The login will be done using /oauth/token with password-realm grant type.
*
* @method signupAndAuthorize
* @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup
* @param {Function} callback
*/
signupAndAuthorize(options: any, callback: (error?: Auth0Error, authResult?: any) => any): void;
/**
* Redirects to the auth0 logout page
*
* @method logout
* @param {Object} options: https://auth0.com/docs/api/authentication#!#get--v2-logout
*/
logout(options: any): void;
passwordlessStart(options: PasswordlessStartOptions, callback: (error?: Auth0Error, data?: any) => any): void;
/**
* Verifies the passwordless TOTP and redirects to finish the passwordless transaction
*
* @method passwordlessVerify
* @param {Object} options:
* @param {Object} options.type: `sms` or `email`
* @param {Object} options.phoneNumber: only if type = sms
* @param {Object} options.email: only if type = email
* @param {Object} options.connection: the connection name
* @param {Object} options.verificationCode: the TOTP code
* @param {Function} callback
*/
passwordlessVerify(options: any, callback: any): void;
}
export class Redirect {
constructor(client: any, options: any);
/**
* Initializes the legacy Lock login flow in a popup
*
* @method loginWithCredentials
* @param {Object} options
* @param {Function} callback
* @deprecated `webauth.popup.loginWithCredentials` will be soon deprecated, use `webauth.client.login` instead.
*/
loginWithCredentials(options: any, callback: any): void;
/**
* Signs up a new user and automatically logs the user in after the signup.
*
* @method signupAndLogin
* @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup
* @param {Function} callback
*/
signupAndLogin(options: any, callback: any): void;
}
export class Popup {
constructor(client: any, options: any);
/**
* Initializes the popup window and returns the instance to be used later in order to avoid being blocked by the browser.
*
* @method preload
* @param {Object} options: receives the window height and width and any other window feature to be sent to window.open
*/
preload(options: any): any;
/**
* Internal use.
*
* @method getPopupHandler
*/
getPopupHandler(options: any, preload: boolean): any;
/**
* Opens in a popup the hosted login page (`/authorize`) in order to initialize a new authN/authZ transaction
*
* @method authorize
* @param {Object} options: https://auth0.com/docs/api/authentication#!#get--authorize_db
* @param {Function} callback
*/
authorize(options: any, callback: any): void;
/**
* Initializes the legacy Lock login flow in a popup
*
* @method loginWithCredentials
* @param {Object} options
* @param {Function} callback
* @deprecated `webauth.popup.loginWithCredentials` will be soon deprecated, use `webauth.client.login` instead.
*/
loginWithCredentials(options: any, callback: any): void;
/**
* Verifies the passwordless TOTP and returns the requested token
*
* @method passwordlessVerify
* @param {Object} options:
* @param {Object} options.type: `sms` or `email`
* @param {Object} options.phoneNumber: only if type = sms
* @param {Object} options.email: only if type = email
* @param {Object} options.connection: the connection name
* @param {Object} options.verificationCode: the TOTP code
* @param {Function} callback
*/
passwordlessVerify(options: any, callback: any): void;
/**
* Signs up a new user and automatically logs the user in after the signup.
*
* @method signupAndLogin
* @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup
* @param {Function} callback
*/
signupAndLogin(options: any, callback: any): void;
}
interface ManagementOptions {
domain: string;
token: string;
_sendTelemetry?: boolean;
_telemetryInfo?: any;
}
interface AuthOptions {
domain: string;
clientID: string;
responseType?: string;
responseMode?: string;
redirectUri?: string;
scope?: string;
audience?: string;
leeway?: number;
_disableDeprecationWarnings?: boolean;
_sendTelemetry?: boolean;
_telemetryInfo?: any;
}
interface PasswordlessAuthOptions {
connection: string;
verificationCode: string;
phoneNumber: string;
email: string;
}
interface Auth0Error {
error: any;
errorDescription: string;
}
interface Auth0DecodedHash {
accessToken?: string;
idToken?: string;
idTokenPayload?: any;
refreshToken?: string;
state?: string;
expiresIn?: number;
tokenType?: string;
}
/** Represents the response from an API Token Delegation request. */
interface Auth0DelegationToken {
/** The length of time in seconds the token is valid for. */
ExpiresIn: number;
/** The JWT for delegated access. */
idToken: string;
/** The type of token being returned. Possible values: "Bearer" */
tokenType: string;
}
interface ChangePasswordOptions {
connection: string;
email: string;
password?: string;
}
interface PasswordlessStartOptions {
connection: string;
send: string;
phoneNumber?: string;
email?: string;
authParams?: any;
}
interface PasswordlessVerifyOptions {
connection: string;
verificationCode: string;
phoneNumber?: string;
email?: string;
}
/**
* Makes a call to the `/delegation` endpoint
*
* @method delegation
* @param {Object} options: https://auth0.com/docs/api/authentication#!#post--delegation
* @param {Function} callback
*/
delegation(options: any, callback: Auth0Callback<Auth0DelegationToken>): any;
/**
* Fetches the user country based on the ip.
*
* @method getUserCountry
* @param {Function} callback
*/
getUserCountry(callback: Auth0Callback<{ countryCode: string }>): void;
}
export class PasswordlessAuthentication {
constructor(request: any, option: any);
/**
* Builds and returns the passwordless TOTP verify url in order to initialize a new authN/authZ transaction
*
* @method buildVerifyUrl
* @param {Object} options
* @param {Function} callback
*/
buildVerifyUrl(options: any): string;
/**
* Initializes a new passwordless authN/authZ transaction
*
* @method start
* @param {Object} options: https://auth0.com/docs/api/authentication#passwordless
* @param {Function} callback
*/
start(options: PasswordlessStartOptions, callback: Auth0Callback<any>): void;
/**
* Verifies the passwordless TOTP and returns an error if any.
*
* @method buildVerifyUrl
* @param {Object} options
* @param {Function} callback
*/
verify(options: any, callback: Auth0Callback<any>): void;
}
export class DBConnection {
constructor(request: any, option: any);
/**
* Signup a new user
*
* @method signup
* @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup
* @param {Function} calback
*/
signup(options: any, callback: Auth0Callback<any>): void;
/**
* Initializes the change password flow
*
* @method signup
* @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-change_password
* @param {Function} callback
*/
changePassword(options: ChangePasswordOptions, callback: Auth0Callback<any>): void;
}
export class Management {
constructor(options: ManagementOptions);
/**
* Returns the user profile. https://auth0.com/docs/api/management/v2#!/Users/get_users_by_id
*
* @method getUser
* @param {String} userId
* @param {Function} callback
*/
getUser(userId: string, callback: Auth0Callback<Auth0UserProfile>): void;
/**
* Updates the user metdata. It will patch the user metdata with the attributes sent.
* https://auth0.com/docs/api/management/v2#!/Users/patch_users_by_id
*
* @method patchUserMetadata
* @param {String} userId
* @param {Object} userMetadata
* @param {Function} callback
*/
patchUserMetadata(userId: string, userMetadata: any, callback: Auth0Callback<Auth0UserProfile>): void;
/**
* Link two users. https://auth0.com/docs/api/management/v2#!/Users/post_identities
*
* @method linkUser
* @param {String} userId
* @param {String} secondaryUserToken
* @param {Function} callback
*/
linkUser(userId: string, secondaryUserToken: string, callback: Auth0Callback<any>): void;
}
export class WebAuth {
constructor(options: AuthOptions);
client: Authentication;
popup: Popup;
redirect: Redirect;
/**
* Redirects to the hosted login page (`/authorize`) in order to initialize a new authN/authZ transaction
*
* @method authorize
* @param {Object} options: https://auth0.com/docs/api/authentication#!#get--authorize_db
*/
authorize(options: any): void;
/**
* Parse the url hash and extract the returned tokens depending on the transaction.
*
* Only validates id_tokens signed by Auth0 using the RS256 algorithm using the public key exposed
* by the `/.well-known/jwks.json` endpoint. Id tokens signed with other algorithms will not be
* accepted.
*
* @method parseHash
* @param {Object} options:
* @param {String} options._idTokenVerification [OPTIONAL] Default: true
* @param {String} options.state [OPTIONAL] to verify the response
* @param {String} options.nonce [OPTIONAL] to verify the id_token
* @param {String} options.hash [OPTIONAL] the url hash. If not provided it will extract from window.location.hash
* @param {Function} callback: any(err, token_payload)
*/
parseHash(options: any, callback: Auth0Callback<Auth0DecodedHash>): void;
/**
* Decodes the id_token and verifies the nonce.
*
* @method validateToken
* @param {String} token
* @param {String} state
* @param {String} nonce
* @param {Function} callback: function(err, {payload, transaction})
*/
validateToken(token: string, state: string, nonce: string, callback: Auth0Callback<any>): void;
/**
* Executes a silent authentication transaction under the hood in order to fetch a new token.
*
* @method renewAuth
* @param {Object} options: any valid oauth2 parameter to be sent to the `/authorize` endpoint
* @param {Function} callback
*/
renewAuth(options: any, callback: Auth0Callback<any>): void;
/**
* Initialices a change password transaction
*
* @method changePassword
* @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-change_password
* @param {Function} callback
*/
changePassword(options: any, callback: Auth0Callback<any>): void;
/**
* Signs up a new user
*
* @method signup
* @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup
* @param {Function} callback
*/
signup(options: any, callback: Auth0Callback<any>): void;
/**
* Signs up a new user, automatically logs the user in after the signup and returns the user token.
* The login will be done using /oauth/token with password-realm grant type.
*
* @method signupAndAuthorize
* @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup
* @param {Function} callback
*/
signupAndAuthorize(options: any, callback: Auth0Callback<any>): void;
/**
* Redirects to the auth0 logout page
*
* @method logout
* @param {Object} options: https://auth0.com/docs/api/authentication#!#get--v2-logout
*/
logout(options: any): void;
/**
* Initialices a passwordless authentication transaction
*
* @method passwordlessStart
* @param {Object} options: https://auth0.com/docs/api/authentication#passwordless
* @param {Object} options.send: `link` or `code`
* @param {Object} options.phoneNumber: send should be code and email not set
* @param {Object} options.email: phoneNumber should be ignored
* @param {Object} options.connection
* @param {Object} options.authParams
* @param {Function} callback
*/
passwordlessStart(options: PasswordlessStartOptions, callback: Auth0Callback<any>): void;
/**
* Verifies the passwordless TOTP and redirects to finish the passwordless transaction
*
* @method passwordlessVerify
* @param {Object} options:
* @param {Object} options.type: `sms` or `email`
* @param {Object} options.phoneNumber: only if type = sms
* @param {Object} options.email: only if type = email
* @param {Object} options.connection: the connection name
* @param {Object} options.verificationCode: the TOTP code
* @param {Function} callback
*/
passwordlessVerify(options: any, callback: Auth0Callback<any>): void;
}
export class Redirect {
constructor(client: any, options: any);
/**
* Initializes the legacy Lock login flow in a popup
*
* @method loginWithCredentials
* @param {Object} options
* @param {Function} callback
* @deprecated `webauth.popup.loginWithCredentials` will be soon deprecated, use `webauth.client.login` instead.
*/
loginWithCredentials(options: any, callback: Auth0Callback<any>): void;
/**
* Signs up a new user and automatically logs the user in after the signup.
*
* @method signupAndLogin
* @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup
* @param {Function} callback
*/
signupAndLogin(options: any, callback: Auth0Callback<any>): void;
}
export class Popup {
constructor(client: any, options: any);
/**
* Returns a new instance of the popup handler
*
* @method buildPopupHandler
*/
buildPopupHandler(): any;
/**
* Initializes the popup window and returns the instance to be used later in order to avoid being blocked by the browser.
*
* @method preload
* @param {Object} options: receives the window height and width and any other window feature to be sent to window.open
*/
preload(options: any): any;
/**
* Opens in a popup the hosted login page (`/authorize`) in order to initialize a new authN/authZ transaction
*
* @method authorize
* @param {Object} options: https://auth0.com/docs/api/authentication#!#get--authorize_db
* @param {Function} callback
*/
authorize(options: any, callback: Auth0Callback<any>): void;
/**
* Initializes the legacy Lock login flow in a popup
*
* @method loginWithCredentials
* @param {Object} options
* @param {Function} callback
* @deprecated `webauth.popup.loginWithCredentials` will be soon deprecated, use `webauth.client.login` instead.
*/
loginWithCredentials(options: any, callback: Auth0Callback<any>): void;
/**
* Verifies the passwordless TOTP and returns the requested token
*
* @method passwordlessVerify
* @param {Object} options:
* @param {Object} options.type: `sms` or `email`
* @param {Object} options.phoneNumber: only if type = sms
* @param {Object} options.email: only if type = email
* @param {Object} options.connection: the connection name
* @param {Object} options.verificationCode: the TOTP code
* @param {Function} callback
*/
passwordlessVerify(options: any, callback: Auth0Callback<any>): void;
/**
* Signs up a new user and automatically logs the user in after the signup.
*
* @method signupAndLogin
* @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup
* @param {Function} callback
*/
signupAndLogin(options: any, callback: Auth0Callback<any>): void;
}
type Auth0Callback<T> = (error: null | Auth0Error, result: T) => void;
interface ManagementOptions {
domain: string;
token: string;
_sendTelemetry?: boolean;
_telemetryInfo?: any;
}
interface AuthOptions {
domain: string;
clientID: string;
responseType?: string;
responseMode?: string;
redirectUri?: string;
scope?: string;
audience?: string;
leeway?: number;
plugins?: any[];
_disableDeprecationWarnings?: boolean;
_sendTelemetry?: boolean;
_telemetryInfo?: any;
}
interface PasswordlessAuthOptions {
connection: string;
verificationCode: string;
phoneNumber: string;
email: string;
}
interface Auth0Error {
error?: any;
errorDescription?: string;
code?: string;
description?: string;
name?: string;
policy?: string;
original?: any;
statusCode?: number;
statusText?: string;
}
interface Auth0DecodedHash {
accessToken?: string;
idToken?: string;
idTokenPayload?: any;
refreshToken?: string;
state?: string;
expiresIn?: number;
tokenType?: string;
}
/** Represents the response from an API Token Delegation request. */
interface Auth0DelegationToken {
/** The length of time in seconds the token is valid for. */
expiresIn: number;
/** The JWT for delegated access. */
idToken: string;
/** The type of token being returned. Possible values: "Bearer" */
tokenType: string;
}
interface ChangePasswordOptions {
connection: string;
email: string;
password?: string;
}
interface PasswordlessStartOptions {
connection: string;
send: string;
phoneNumber?: string;
email?: string;
authParams?: any;
}
interface PasswordlessVerifyOptions {
connection: string;
verificationCode: string;
phoneNumber?: string;
email?: string;
}
interface Auth0UserProfile {
name: string;
nickname: string;
picture: string;
user_id: string;
username?: string;
given_name?: string;
family_name?: string;
email?: string;
email_verified?: string;
clientID: string;
gender?: string;
locale?: string;
identities: Auth0Identity[];
created_at: string;
updated_at: string;
sub: string;
user_metadata?: any;
app_metadata?: any;
}
interface MicrosoftUserProfile extends Auth0UserProfile {
emails?: string[]; //optional depending on whether email addresses permission is granted
}
interface Office365UserProfile extends Auth0UserProfile {
tenantid: string;
upn: string;
}
interface AdfsUserProfile extends Auth0UserProfile {
issuer?: string;
}
interface Auth0Identity {
connection: string;
isSocial: boolean;
provider: string;
user_id: string;
}
+2 -2
View File
@@ -1,4 +1,4 @@
import 'auth0-js/v7';
import * as auth0 from 'auth0-js';
import Auth0Lock from 'auth0-lock';
const CLIENT_ID = "YOUR_AUTH0_APP_CLIENTID";
@@ -38,7 +38,7 @@ lock.show(showOptions);
// "on" event-driven example
lock.on("authenticated", function(authResult : any) {
lock.getProfile(authResult.idToken, function(error, profile) {
lock.getProfile(authResult.idToken, function(error: auth0.Auth0Error, profile: auth0.Auth0UserProfile) {
if (error) {
// Handle error
return;
+13 -10
View File
@@ -1,9 +1,9 @@
// Type definitions for auth0-lock 10.9
// Type definitions for auth0-lock 10.10
// Project: http://auth0.com
// Definitions by: Brian Caruso <https://github.com/carusology>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="auth0-js/v7" />
/// <reference types="auth0-js" />
interface Auth0LockAdditionalSignUpFieldOption {
value: string;
@@ -11,13 +11,13 @@ interface Auth0LockAdditionalSignUpFieldOption {
}
type Auth0LockAdditionalSignUpFieldOptionsCallback =
(error: Auth0Error, options: Auth0LockAdditionalSignUpFieldOption[]) => void;
(error: auth0.Auth0Error, options: Auth0LockAdditionalSignUpFieldOption[]) => void;
type Auth0LockAdditionalSignUpFieldOptionsFunction =
(callback: Auth0LockAdditionalSignUpFieldOptionsCallback) => void;
type Auth0LockAdditionalSignUpFieldPrefillCallback =
(error: Auth0Error, prefill: string) => void;
(error: auth0.Auth0Error, prefill: string) => void;
type Auth0LockAdditionalSignUpFieldPrefillFunction =
(callback: Auth0LockAdditionalSignUpFieldPrefillCallback) => void;
@@ -32,8 +32,8 @@ interface Auth0LockAdditionalSignUpField {
validator?: (input: string) => { valid: boolean; hint?: string };
}
type Auth0LockAvatarUrlCallback = (error: Auth0Error, url: string) => void;
type Auth0LockAvatarDisplayNameCallback = (error: Auth0Error, displayName: string) => void;
type Auth0LockAvatarUrlCallback = (error: auth0.Auth0Error, url: string) => void;
type Auth0LockAvatarDisplayNameCallback = (error: auth0.Auth0Error, displayName: string) => void;
interface Auth0LockAvatarOptions {
url: (email: string, callback: Auth0LockAvatarUrlCallback) => void;
@@ -63,6 +63,7 @@ interface Auth0LockAuthOptions {
redirectUrl?: string;
responseType?: string;
sso?: boolean;
audience?: string;
}
interface Auth0LockPopupOptions {
@@ -101,6 +102,7 @@ interface Auth0LockConstructorOptions {
socialButtonStyle?: "big" | "small";
theme?: Auth0LockThemeOptions;
usernameStyle?: string;
oidcConformant?: boolean;
}
interface Auth0LockFlashMessageOptions {
@@ -123,15 +125,16 @@ interface Auth0LockStatic {
new (clientId: string, domain: string, options?: Auth0LockConstructorOptions): Auth0LockStatic;
// deprecated
getProfile(token: string, callback: (error: Auth0Error, profile: Auth0UserProfile) => void): void;
getUserInfo(token: string, callback: (error: Auth0Error, profile: Auth0UserProfile) => void): void;
getProfile(token: string, callback: (error: auth0.Auth0Error, profile: auth0.Auth0UserProfile) => void): void;
getUserInfo(token: string, callback: (error: auth0.Auth0Error, profile: auth0.Auth0UserProfile) => void): void;
// https://github.com/auth0/lock#resumeauthhash-callback
resumeAuth( hash: string, callback: (error: auth0.Auth0Error, authResult: any) => void): void;
show(options?: Auth0LockShowOptions): void;
hide(): void;
logout(query: any): void;
on(event: "show" | "hide", callback: () => void): void;
on(event: "unrecoverable_error" | "authorization_error", callback: (error: Auth0Error) => void): void;
on(event: "unrecoverable_error" | "authorization_error", callback: (error: auth0.Auth0Error) => void): void;
on(event: "authenticated", callback: (authResult: any) => void): void;
on(event: string, callback: (...args: any[]) => void): void;
}
-2
View File
@@ -1,5 +1,3 @@
/// <reference types="auth0" />
import * as auth0 from 'auth0';
const management = new auth0.ManagementClient({
+1 -1
View File
@@ -34,7 +34,7 @@ function test_client() {
session.publish('com.myapp.hello', ['Hello, world!']);
// 3) register a procedure for remoting
session.register('com.myapp.add2', myInstance.add2);
session.register('com.myapp.add2', myInstance.add2, { invoke: 'roundrobin' });
// 4) call a remote procedure
session.call<number>('com.myapp.add2', [2, 3]).then(
+2 -1
View File
@@ -1,4 +1,4 @@
// Type definitions for AutobahnJS v0.9.6
// Type definitions for AutobahnJS v0.9.7
// Project: http://autobahn.ws/js/
// Definitions by: Elad Zelingher <https://github.com/darkl/>, Andy Hawkins <https://github.com/a904guy/,http://a904guy.com/,http://www.bmbsqd.com>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -177,6 +177,7 @@ declare namespace autobahn {
interface IRegisterOptions {
disclose_caller?: boolean;
invoke?: 'single' | 'roundrobin' | 'random' | 'first' | 'last';
}
export class Connection {
+17
View File
@@ -0,0 +1,17 @@
import * as autopref from 'autoprefixer';
const ap: autopref.Transformer = autopref({
browsers: ['> 5%', 'last 2 versions'],
env: '',
cascade: true,
add: true,
remove: true,
supports: true,
flexbox: true,
grid: true,
stats: {},
});
const ap2: autopref.Transformer = autopref({
flexbox: 'no-2009',
});
const info: string = ap.info();
+31
View File
@@ -0,0 +1,31 @@
// Type definitions for autoprefixer 6.7
// Project: https://github.com/postcss/autoprefixer
// Definitions by: Armando Meziat <https://github.com/odnamrataizem>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import { Plugin, Transformer as PostcssTransformer } from 'postcss';
declare namespace autoprefixer {
interface Options {
browsers?: string[];
env?: string;
cascade?: boolean;
add?: boolean;
remove?: boolean;
supports?: boolean;
flexbox?: boolean | 'no-2009';
grid?: boolean;
stats?: any;
}
interface Transformer extends PostcssTransformer {
info(): string;
}
interface Autoprefixer extends Plugin<Options> {
(opts?: Options): Transformer;
}
}
declare const autoprefixer: autoprefixer.Autoprefixer;
export = autoprefixer;
+5
View File
@@ -0,0 +1,5 @@
{
"dependencies": {
"postcss": "^5.2.15"
}
}
+22
View File
@@ -0,0 +1,22 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"autoprefixer-tests.ts"
]
}
-2
View File
@@ -1,5 +1,3 @@
/// <reference types="autosize" />
// from a NodeList
autosize(document.querySelectorAll('textarea'));
+31 -26
View File
@@ -1,3 +1,5 @@
import * as Awesomplete from 'awesomplete';
var input = document.getElementById("myinput");
new Awesomplete(input, {list: "#mylist"});
@@ -11,45 +13,48 @@ var awesomplete = new Awesomplete(input);
awesomplete.list = ["Ada", "Java", "JavaScript", "LOLCODE", "Node.js", "Ruby on Rails"];
new Awesomplete(input, {
list: [
{ label: "Belarus", value: "BY" },
{ label: "China", value: "CN" },
{ label: "United States", value: "US" }
]
list: [
{ label: "Belarus", value: "BY" },
{ label: "China", value: "CN" },
{ label: "United States", value: "US" }
]
});
// Same with arrays:
new Awesomplete(input, {
list: [
[ "Belarus", "BY" ],
[ "China", "CN" ],
[ "United States", "US" ]
]
list: [
[ "Belarus", "BY" ],
[ "China", "CN" ],
[ "United States", "US" ]
]
});
new Awesomplete('input[type="email"]', {
list: ["aol.com", "att.net", "comcast.net", "facebook.com", "gmail.com", "gmx.com", "googlemail.com", "google.com", "hotmail.com", "hotmail.co.uk", "mac.com", "me.com", "mail.com", "msn.com", "live.com", "sbcglobal.net", "verizon.net", "yahoo.com", "yahoo.co.uk"],
data: function (text: string, input: any) {
return input.slice(0, input.indexOf("@")) + "@" + text;
},
filter: Awesomplete.FILTER_STARTSWITH
list: ["aol.com", "att.net", "comcast.net", "facebook.com", "gmail.com",
"gmx.com", "googlemail.com", "google.com", "hotmail.com",
"hotmail.co.uk", "mac.com", "me.com", "mail.com", "msn.com",
"live.com", "sbcglobal.net", "verizon.net", "yahoo.com", "yahoo.co.uk"],
data: (text: string, input: string) => {
return input.slice(0, input.indexOf("@")) + "@" + text;
},
filter: Awesomplete.FILTER_STARTSWITH
});
new Awesomplete('input[data-multiple]', {
filter: function(text: string, input: any) {
return Awesomplete.FILTER_CONTAINS(text, input.match(/[^,]*$/)[0]);
},
filter: (text: string, input: any) => {
return Awesomplete.FILTER_CONTAINS(text, input.match(/[^,]*$/)[0]);
},
replace: function(text: string) {
var before = this.input.value.match(/^.+,\s*|/)[0];
this.input.value = before + text + ", ";
}
replace: (text: string) => {
var before = this.input.value.match(/^.+,\s*|/)[0];
this.input.value = before + text + ", ";
}
});
var ajax = new XMLHttpRequest();
ajax.open("GET", "https://restcountries.eu/rest/v1/lang/fr", true);
ajax.onload = function() {
var list = JSON.parse(ajax.responseText).map(function(i: any) { return i.name; });
new Awesomplete(document.querySelector("#ajax-example input"),{ list: list });
ajax.onload = () => {
var list = JSON.parse(ajax.responseText).map((i: any) => i.name);
new Awesomplete(document.querySelector("#ajax-example input"), { list });
};
ajax.send();
ajax.send();
+50 -42
View File
@@ -1,49 +1,57 @@
// Type definitions for Awesomplete v1.1.0
// Type definitions for Awesomplete 1.1
// Project: https://leaverou.github.io/awesomplete/
// Definitions by: webbiesdk <https://github.com/webbiesdk/>, Ben Dixon <https://github.com/bmdixon/>
// Definitions by: webbiesdk <https://github.com/webbiesdk/>, Ben Dixon <https://github.com/bmdixon/>, Trevor Bekolay <https://github.com/tbekolay/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare class Awesomplete {
constructor(input: Element | HTMLElement | string, o?: AwesompleteOptions);
static all: Array<any>;
static $$: (expr: string | NodeSelector, con?: any) => NodeList;
static ITEM: (text: string, input: string) => HTMLElement;
static $: {
(expr: string|Element, con?: NodeSelector): string | Element;
regExpEscape: (s: { replace: (arg0: RegExp, arg1: string) => void }) => any;
create: (tag: string, o: any) => HTMLElement;
fire: (target: EventTarget, type: string, properties: any) => any;
siblingIndex: (el: Element) => number;
};
static FILTER_STARTSWITH: (text: string, input: string) => boolean;
static FILTER_CONTAINS: (text: string, input: string) => boolean;
static SORT_BYLENGTH: (a: number | any[], b: number | any[]) => number;
static REPLACE: (text: any) => void;
next: () => void;
container: HTMLElement;
select: (selected?: HTMLElement, originalTarget?: HTMLElement) => void;
previous: () => void;
index: number;
opened: number;
list: string | string[] | Element | { label: string, value: any }[] | [string, string][];
input: HTMLElement | string;
goto: (i: number) => void;
ul: HTMLElement;
close: () => void;
evaluate: () => void;
selected: boolean;
open: () => void;
status: HTMLElement;
constructor(input: Element | HTMLElement | string, o?: Awesomplete.Options);
static all: any[];
static $$: (expr: string | NodeSelector, con?: any) => NodeList;
static ITEM: (text: string, input: string) => HTMLElement;
static $: {
(expr: string|Element, con?: NodeSelector): string | Element;
regExpEscape: (s: { replace: (arg0: RegExp, arg1: string) => void }) => any;
create: (tag: string, o: any) => HTMLElement;
fire: (target: EventTarget, type: string, properties: any) => any;
siblingIndex: (el: Element) => number;
};
static FILTER_STARTSWITH: (text: string, input: string) => boolean;
static FILTER_CONTAINS: (text: string, input: string) => boolean;
static SORT_BYLENGTH: (left: number | any[], right: number | any[]) => number;
static REPLACE: (text: string) => void;
static DATA: (item: Awesomplete.Suggestion) => Awesomplete.Suggestion;
next: () => void;
container: HTMLElement;
select: (selected?: HTMLElement, originalTarget?: HTMLElement) => void;
previous: () => void;
index: number;
opened: number;
list: string | Element | Awesomplete.Suggestion[];
input: HTMLElement | string;
goto: (i: number) => void;
ul: HTMLElement;
close: () => void;
evaluate: () => void;
selected: boolean;
open: () => void;
status: HTMLElement;
}
interface AwesompleteOptions {
list?: string | string[] | Element | { label: string, value: any }[] | [string, string][];
minChars?: Number;
maxItems?: Number;
autoFirst?: boolean;
data?: Function;
filter?: Function;
sort?: Function;
item?: Function;
replace?: Function;
declare namespace Awesomplete {
type Suggestion = string | {label: string | any, value: string | any} | [string, string];
interface Options {
list?: string | string[] | Element | Array<{ label: string, value: any }> | Array<[string, string]>;
minChars?: number;
maxItems?: number;
autoFirst?: boolean;
data?: (item: Suggestion, input: string) => string;
filter?: (text: string, input: string) => boolean;
sort?: (left: number | any[], right: number | any[]) => number;
item?: (text: string, input: string) => HTMLElement;
replace?: (text: string) => void;
}
}
export = Awesomplete;
export as namespace Awesomplete;
+1
View File
@@ -0,0 +1 @@
{ "extends": "../tslint.json" }
+76 -6
View File
@@ -1,5 +1,3 @@
/// <reference types="aws-lambda" />
var str: string = "any string";
var date: Date = new Date();
var anyObj: any = { abc: 123 };
@@ -13,6 +11,51 @@ var clientContextClient: AWSLambda.ClientContextClient;
var context: AWSLambda.Context;
var identity: AWSLambda.CognitoIdentity;
var proxyResult: AWSLambda.ProxyResult;
var snsEvt: AWSLambda.SNSEvent;
var snsEvtRecs: AWSLambda.SNSEventRecord[];
var snsEvtRec: AWSLambda.SNSEventRecord;
var snsMsg: AWSLambda.SNSMessage;
var snsMsgAttr: AWSLambda.SNSMessageAttribute;
var snsMsgAttrs: AWSLambda.SNSMessageAttributes;
var S3CreateEvent: AWSLambda.S3CreateEvent = {
Records: [{
eventVersion: 'string',
eventSource: 'string',
awsRegion: 'string',
eventTime: 'string',
eventName: 'string',
userIdentity: {
principalId: 'string'
},
requestParameters: {
sourceIPAddress: 'string'
},
responseElements: {
'x-amz-request-id': 'string',
'x-amz-id-2': 'string'
},
s3: {
s3SchemaVersion: 'string',
configurationId: 'string',
bucket: {
name: 'string',
ownerIdentity: {
principalId: 'string'
},
arn: 'string'
},
object: {
key: 'string',
size: 1,
eTag: 'string',
versionId: 'string',
sequencer: 'string'
}
}
}
]
};
/* API Gateway Event */
str = apiGwEvt.body;
@@ -44,10 +87,37 @@ str = apiGwEvt.requestContext.resourceId;
str = apiGwEvt.requestContext.resourcePath;
str = apiGwEvt.resource;
/* SNS Event */
snsEvtRecs = snsEvt.Records;
str = snsEvtRec.EventSource;
str = snsEvtRec.EventSubscriptionArn;
str = snsEvtRec.EventVersion;
snsMsg = snsEvtRec.Sns;
str = snsMsg.SignatureVersion;
str = snsMsg.Timestamp;
str = snsMsg.Signature;
str = snsMsg.SigningCertUrl;
str = snsMsg.MessageId;
str = snsMsg.Message;
snsMsgAttrs = snsMsg.MessageAttributes;
str = snsMsg.Type;
str = snsMsg.UnsubscribeUrl;
str = snsMsg.TopicArn;
str = snsMsg.Subject;
snsMsgAttrs["example"] = snsMsgAttr;
str = snsMsgAttr.Type;
str = snsMsgAttr.Value;
/* Lambda Proxy Result */
num = proxyResult.statusCode;
str = proxyResult.headers["example"];
str = proxyResult.body
proxyResult.headers["example"] = str;
proxyResult.headers["example"] = b;
proxyResult.headers["example"] = num;
str = proxyResult.body;
/* Context */
b = context.callbackWaitsForEmptyEventLoop;
@@ -111,5 +181,5 @@ context.fail(error);
context.fail(str);
/* Handler */
let handler: AWSLambda.Handler = (event: any, context: AWSLambda.Context, cb: AWSLambda.Callback) => {};
let proxyHandler: AWSLambda.ProxyHandler = (event: AWSLambda.APIGatewayEvent, context: AWSLambda.Context, cb: AWSLambda.ProxyCallback) => {};
let handler: AWSLambda.Handler = (event: any, context: AWSLambda.Context, cb: AWSLambda.Callback) => { };
let proxyHandler: AWSLambda.ProxyHandler = (event: AWSLambda.APIGatewayEvent, context: AWSLambda.Context, cb: AWSLambda.ProxyCallback) => { };
+82 -4
View File
@@ -1,6 +1,6 @@
// Type definitions for AWS Lambda
// Project: http://docs.aws.amazon.com/lambda
// Definitions by: James Darbyshire <https://github.com/darbio/aws-lambda-typescript>, Michael Skarum <https://github.com/skarum>, Stef Heyenrath <https://github.com/StefH/DefinitelyTyped>, Toby Hede <https://github.com/tobyhede>, Rich Buggy <https://github.com/buggy>
// Definitions by: James Darbyshire <https://github.com/darbio/aws-lambda-typescript>, Michael Skarum <https://github.com/skarum>, Stef Heyenrath <https://github.com/StefH/DefinitelyTyped>, Toby Hede <https://github.com/tobyhede>, Rich Buggy <https://github.com/buggy>, Simon Ramsay <https://github.com/nexus-uw>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// API Gateway "event"
@@ -39,6 +39,84 @@ interface APIGatewayEvent {
resource: string;
}
// SNS "event"
interface SNSMessageAttribute {
Type: string;
Value: string;
}
interface SNSMessageAttributes {
[name: string]: SNSMessageAttribute;
}
interface SNSMessage {
SignatureVersion: string;
Timestamp: string;
Signature: string;
SigningCertUrl: string;
MessageId: string;
Message: string;
MessageAttributes: SNSMessageAttributes;
Type: string;
UnsubscribeUrl: string;
TopicArn: string;
Subject: string;
}
interface SNSEventRecord {
EventVersion: string;
EventSubscriptionArn: string;
EventSource: string;
Sns: SNSMessage;
}
interface SNSEvent {
Records: Array<SNSEventRecord>;
}
/**
* S3Create event
* https://docs.aws.amazon.com/AmazonS3/latest/dev/notification-content-structure.html
*/
interface S3CreateEvent {
Records: [{
eventVersion: string;
eventSource: string;
awsRegion: string
eventTime: string;
eventName: string;
userIdentity: {
principalId: string;
},
requestParameters: {
sourceIPAddress: string;
},
responseElements: {
'x-amz-request-id': string;
'x-amz-id-2': string;
},
s3: {
s3SchemaVersion: string;
configurationId: string;
bucket: {
name: string;
ownerIdentity: {
principalId: string;
},
arn: string;
},
object: {
key: string;
size: number;
eTag: string;
versionId: string;
sequencer: string;
}
}
}
];
}
// Context
// http://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-context.html
interface Context {
@@ -97,7 +175,7 @@ interface ClientContextEnv {
interface ProxyResult {
statusCode: number;
headers?: {
[header: string]: string;
[header: string]: boolean | number | string;
},
body: string;
}
@@ -110,8 +188,8 @@ interface ProxyResult {
* @param context runtime information of the Lambda function that is executing.
* @param callback optional callback to return information to the caller, otherwise return value is null.
*/
export type Handler = (event: any, context: Context, callback?: Callback) => void;
export type ProxyHandler = (event: APIGatewayEvent, context: Context, callback?: ProxyCallback) => void;
export type Handler = (event: any, context: Context, callback?: Callback) => void;
export type ProxyHandler = (event: APIGatewayEvent, context: Context, callback?: ProxyCallback) => void;
/**
* Optional callback parameter.
@@ -1,9 +1,10 @@
/// <reference types="express"/>
import * as awsServerlessExpress from 'aws-serverless-express';
import * as express from 'express';
import { eventContext } from 'aws-serverless-express/middleware';
const app = express();
app.use(eventContext());
const server = awsServerlessExpress.createServer(app, () => {});
const mockEvent = {
+3 -3
View File
@@ -1,6 +1,6 @@
// Type definitions for aws-serverless-express
// Type definitions for aws-serverless-express 2.1
// Project: https://github.com/awslabs/aws-serverless-express
// Definitions by: Ben Speakman <https://github.com/threesquared>
// Definitions by: Ben Speakman <https://github.com/threesquared>, Josh Caffey <https://github.com/jcaffey>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node"/>
@@ -16,4 +16,4 @@ export function proxy(
server: http.Server,
event: any,
context: lambda.Context
): void;
): void;
+8
View File
@@ -0,0 +1,8 @@
import { RequestHandler } from 'express';
export interface Options {
reqPropKey?: string;
deleteHeaders?: boolean;
}
export function eventContext(options?: Options): RequestHandler;
+2 -1
View File
@@ -17,6 +17,7 @@
},
"files": [
"index.d.ts",
"middleware.d.ts",
"aws-serverless-express-tests.ts"
]
}
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "../tslint.json" }
+7
View File
@@ -0,0 +1,7 @@
import * as axel from 'axel';
axel.clear();
axel.bg(0,255,0);
axel.line(1,1,10,10);
axel.cursor.restore();
+37
View File
@@ -0,0 +1,37 @@
// Type definitions for Axel module
// Project: https://github.com/F1LT3R/axel
// Definitions by: Ruslan Molodyko <https://github.com/ruslan-molodyko>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare class Axel {
brush: string;
rows: number;
cols: number;
cursor: cursorInterface;
lerp(p1: number, p2: number, m: number): number;
circ(x: number, y: number, m: number): number;
goto(x: number, y: number): void;
scrub(x1: number, y1: number, w: number, h: number): void;
box(x1: number, y1: number, w: number, h: number): void;
point(x: number, y: number, char: string): void;
dist(x1: number, y1: number, x2: number, y2: number): number;
line(x1: number, y1: number, x2: number, y2: number): void;
text(x: number, y: number, text: string): void;
fg(r: number, g: number, b: number): void;
bg(r: number, g: number, b: number): void;
draw(cb: Function): void;
clear(): void;
}
declare interface cursorInterface {
on(): void;
off(): void;
reset(): void;
restore(): void;
}
declare module 'axel' {
const instance: Axel;
export = instance;
}
+22
View File
@@ -0,0 +1,22 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"axel-tests.ts",
"index.d.ts"
]
}
+52
View File
@@ -0,0 +1,52 @@
import b_ = require("b_");
const blockClass: string = b_("block");
const blockWithModsClass: string = b_("block", {stringMod: "string", boolMod: true, numberMod: 5});
const elemClass: string = b_("block", "elem");
const elemWithModsClass: string = b_("block", "elem", {stringMod: "string", boolMod: true, numberMod: 5});
const withBlock = b_.with("block");
const withBlockClass: string = withBlock();
const withBlockWithModsClass: string = withBlock({stringMod: "string", boolMod: true, numberMod: 5});
const withBlockElemClass: string = withBlock("elem");
const withBlockElemWithModsClass: string = withBlock("elem", {stringMod: "string", boolMod: true, numberMod: 5});
const lockBlock = b_.lock("block");
const lockBlockClass: string = lockBlock();
const lockBlockWithModsClass: string = lockBlock({stringMod: "string", boolMod: true, numberMod: 5});
const lockBlockElemClass: string = lockBlock("elem");
const lockBlockElemWithModsClass: string = lockBlock("elem", {stringMod: "string", boolMod: true, numberMod: 5});
const withElem = b_.with("block", "elem");
const withElemClass: string = withElem();
const withElemWithModsClass: string = withElem({stringMod: "string", boolMod: true, numberMod: 5});
const parameterizedB_ = b_.B({
tailSpace: " ",
elementSeparator: "-",
modSeparator: "_",
modValueSeparator: "-",
classSeparator: " ",
isFullModifier: true
});
const parameterizedBlockClass: string = parameterizedB_("block");
const parameterizedBlockWithModsClass: string = parameterizedB_("block", {stringMod: "string", boolMod: true, numberMod: 5});
const parameterizedElemClass: string = parameterizedB_("block", "elem");
const parameterizedElemWithModsClass: string = parameterizedB_("block", "elem", {stringMod: "string", boolMod: true, numberMod: 5});
const parameterizedWithBlock = parameterizedB_.with("block");
const parameterizedWithBlockClass: string = parameterizedWithBlock();
const parameterizedWithBlockWithModsClass: string = parameterizedWithBlock({stringMod: "string", boolMod: true, numberMod: 5});
const parameterizedWithBlockElemClass: string = parameterizedWithBlock("elem");
const parameterizedWithBlockElemWithModsClass: string = parameterizedWithBlock("elem", {stringMod: "string", boolMod: true, numberMod: 5});
const parameterizedLockBlock = parameterizedB_.lock("block");
const parameterizedLockBlockClass: string = parameterizedLockBlock();
const parameterizedLockBlockWithModsClass: string = parameterizedLockBlock({stringMod: "string", boolMod: true, numberMod: 5});
const parameterizedLockBlockElemClass: string = parameterizedLockBlock("elem");
const parameterizedLockBlockElemWithModsClass: string = parameterizedLockBlock("elem", {stringMod: "string", boolMod: true, numberMod: 5});
const parameterizedWithElem = parameterizedB_.with("block", "elem");
const parameterizedWithElemClass: string = parameterizedWithElem();
const parameterizedWithElemWithModsClass: string = parameterizedWithElem({stringMod: "string", boolMod: true, numberMod: 5});
+40
View File
@@ -0,0 +1,40 @@
// Type definitions for b_ 1.3
// Project: https://github.com/azproduction/b_
// Definitions by: Vasya Aksyonov <https://github.com/outring>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
interface Options {
tailSpace?: string;
elementSeparator?: string;
modSeparator?: string;
modValueSeparator?: string;
classSeparator?: string;
isFullModifier?: boolean;
}
interface Mods {
[name: string]: any;
}
interface Formatter {
(block: string, mods?: Mods): string;
(block: string, elem: string, mods?: Mods): string;
with(block: string): BlockFormatter;
with(block: string, elem: string): ElemFormatter;
lock(block: string): BlockFormatter;
lock(block: string, elem: string): ElemFormatter;
B(options: Options): Formatter;
}
interface BlockFormatter {
(mods?: Mods): string;
(elem: string, mods?: Mods): string;
}
type ElemFormatter = (mods?: Mods) => string;
declare const formatter: Formatter;
export = formatter;
+22
View File
@@ -0,0 +1,22 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"b_-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "../tslint.json" }
-3
View File
@@ -1,7 +1,4 @@
/// <reference types="babel-generator" />
/// <reference types="babel-types" />
// Example from https://github.com/babel/babel/tree/master/packages/babel-template
import template = require('babel-template');
-2
View File
@@ -1,5 +1,3 @@
/// <reference types="babel-types" />
/// <reference types="babylon" />
-5
View File
@@ -1,8 +1,3 @@
/// <reference types="babel-types" />
/// <reference types="babel-types" />
// Example from https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#babylon
import * as babylon from "babylon";
declare function assert(expr: boolean): void;
+15 -5
View File
@@ -1,4 +1,4 @@
// Type definitions for babylon v6.7
// Type definitions for babylon v6.16.1
// Project: https://github.com/babel/babylon
// Definitions by: Troy Gerwien <https://github.com/yortus>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -41,7 +41,17 @@ export interface BabylonOptions {
plugins?: PluginName[];
}
export type PluginName = 'jsx' | 'flow' | 'asyncFunctions' | 'classConstructorCall' | 'doExpressions'
| 'trailingFunctionCommas' | 'objectRestSpread' | 'decorators' | 'classProperties' | 'exportExtensions'
| 'exponentiationOperator' | 'asyncGenerators' | 'functionBind' | 'functionSent' | '*';
export type PluginName =
'estree' |
'jsx' |
'flow' |
'classConstructorCall' |
'doExpressions' |
'objectRestSpread' |
'decorators' |
'classProperties' |
'exportExtensions' |
'asyncGenerators' |
'functionBind' |
'functionSent' |
'dynamicImport';
@@ -1,5 +1,3 @@
/// <reference types="jquery"/>
import * as Backbone from 'backbone';
// Example code.
@@ -26,7 +24,7 @@ class View extends Backbone.Layout<Backbone.Model> {
"mouseleave": "removeElement"
}
}
wrapElement(): void {
this.$el.wrap("<b>");
}
@@ -66,11 +66,11 @@ namespace MarionetteTests {
let regions: {[key: string]: Marionette.Region} = this.layoutView.getRegions();
let prefix: string = this.layoutView.childViewEventPrefix;
let region: Marionette.Region = this.layoutView.removeRegion('main');
let layout: Marionette.LayoutView<Backbone.Model> = this.layoutView.destroy();
let layout: Marionette.View<Backbone.Model> = this.layoutView.destroy();
}
}
class AppLayoutView extends Marionette.LayoutView<Backbone.Model> {
class AppLayoutView extends Marionette.View<Backbone.Model> {
constructor() {
super({ el: 'body' });
}
@@ -111,7 +111,7 @@ namespace MarionetteTests {
}
class MyView extends Marionette.ItemView<MyModel> {
class MyView extends Marionette.View<MyModel> {
behaviors: any;
constructor(model: MyModel) {
@@ -189,7 +189,7 @@ namespace MarionetteTests {
constructor() {
super();
this.childView = MyView;
this.childEvents = {
this.childViewEvents = {
render: function () {
console.log("a childView has been rendered");
}
+105 -231
View File
@@ -4,6 +4,7 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import * as Backbone from 'backbone';
import * as Radio from 'backbone.radio';
export as namespace Marionette;
export = Marionette;
@@ -22,8 +23,6 @@ declare module 'backbone' {
findByIndex(index: number): TView;
findByCid(cid: string): TView;
remove(view: TView): void;
call(method: any): void;
apply(method: any, args?: any[]): void;
//mixins from Collection (copied from Backbone's Collection declaration)
@@ -180,6 +179,27 @@ declare namespace Marionette {
* backbone conventions and utilities like initialize and Backbone.Events.
*/
class Object extends Backbone.Events {
/**
* Defines the Radio channel that will be used for the requests and/or events
*/
channelName: string;
/**
* Returns a Radio.Channel instance using 'channelName'
*/
getChannel(): Backbone.Radio.Channel;
/**
* Defines an events hash with the events to be listened and its respective handlers
*/
radioEvents: any;
/**
* Defines an events hash with the requests to be replied and its respective handlers
*/
radioRequests: any;
/**
* Initialize is called immediately after the Object has been instantiated,
* and is invoked with the same arguments that the constructor received.
@@ -750,7 +770,7 @@ declare namespace Marionette {
/**
* View implements a destroy method, which is called by the region managers automatically. As part of the implementation.
*/
destroy(...args: any[]): void;
destroy(...args: any[]): View<TModel>;
/**
* In several cases you need to access ui elements inside the view to
@@ -772,12 +792,37 @@ declare namespace Marionette {
triggerMethod(name: string, ...args: any[]): any;
/**
* Called on the view instance when the view has been rendered and
* displayed. This event can be used to react to when a view has been
* shown via a region. A common use case for the onShow method is to
* use it to add children views.
* Item views will serialize a model or collection, by default, by calling
* .toJSON on either the model or collection. If both a model and
* collection are attached to an item view, the model will be used as the
* data source. The results of the data serialization will be passed to
* the template that is rendered.
*
* If you need custom serialization for your data, you can provide a serializeData
* method on your view. It must return a valid JSON object, as if you had
* called .toJSON on a model or collection.
*/
onShow(): void;
serializeData(): any;
/**
* Renders the view. It is unwise to override the render method of any
* Marionette view. Instead, you should use the onBeforeRender and
* onRender callbacks to layer in additional functionality to the
* rendering of your view.
*/
render(): any;
/**
* Triggered before an ItemView is rendered.
*/
onBeforeRender(): void;
/**
* Triggered after the view has been rendered. You can implement this in
* your view to provide custom code for dealing with the view's el after
* it has been rendered.
*/
onRender(): void;
/**
* Triggered just after the view has been destroyed.
@@ -814,49 +859,65 @@ declare namespace Marionette {
isDestroyed: boolean;
supportsRenderLifecycle: boolean;
supportsDestroyLifecycle: boolean;
}
/**
* An ItemView is a view that represents a single item. That item may be
* a Backbone.Model or may be a Backbone.Collection. Whichever it is though,
* it will be treated as a single item.
*/
class ItemView<TModel extends Backbone.Model> extends View<TModel> {
constructor(options?: Backbone.ViewOptions<TModel>);
/**
* Item views will serialize a model or collection, by default, by calling
* .toJSON on either the model or collection. If both a model and
* collection are attached to an item view, the model will be used as the
* data source. The results of the data serialization will be passed to
* the template that is rendered.
*
* If you need custom serialization for your data, you can provide a serializeData
* method on your view. It must return a valid JSON object, as if you had
* called .toJSON on a model or collection.
* If you have the need to replace the Region with a region class of your
* own implementation, you can specify an alternate class to use with this
* property.
*/
serializeData(): any;
regionClass: any;
/**
* Renders the view. It is unwise to override the render method of any
* Marionette view. Instead, you should use the onBeforeRender and
* onRender callbacks to layer in additional functionality to the
* rendering of your view.
*/
render(): ItemView<TModel>;
* Regions hash or a method returning the regions hash that maps
* regions/selectors to methods on your View.
**/
regions(): any;
/** Adds a region to the layout view. */
addRegion(name: string, definition: any): Region;
/**
* Triggered before an ItemView is rendered.
* Add multiple regions as a {name: definition, name2: def2} object literal.
*/
onBeforeRender(): void;
addRegions(regions: any): any;
/** Returns a region from the layout view */
getRegion(name: string): Region;
/**
* Triggered after the view has been rendered. You can implement this in
* your view to provide custom code for dealing with the view's el after
* it has been rendered.
* Removes the region with the specified name.
* @param name the name of the region to remove.
*/
onRender(): void;
removeRegion(name: string): Region;
/** Enable easy overriding of the default `RegionManager`
* for customized region interactions and business specific
* view logic for better control over single regions.
*/
getRegionManager(): RegionManager;
/**
* Show a view into the region specified by `regionName`.
*/
showChildView(regionName: string, view: any, options?: RegionShowOptions): void;
/**
* Get the current view that is shown in the region specified by
* `regionName`.
*/
getChildView(regionName: string): Backbone.View<TModel>;
/**
* Returns all regions from the layout view. The results contains an
* Object hash that has `string`s as keys and `Region`s as values.
*/
getRegions(): {[key: string]: Region};
/**
* You can customize the event prefix for events that are forwarded through
* the layout view with this property.
*/
childViewEventPrefix: string;
}
@@ -928,12 +989,12 @@ declare namespace Marionette {
childViewEventPrefix: string;
/**
* You can specify a childEvents hash or method which allows you to
* capture all bubbling childEvents without having to manually set bindings.
* You can specify a childViewEvents hash or method which allows you to
* capture all bubbling childViewEvents without having to manually set bindings.
* The keys of the hash can either be a function or a string that is the
* name of a method on the collection view.
*/
childEvents: any;
childViewEvents: any;
/**
* When a collection has no children, and you need to render a view other than
@@ -1034,37 +1095,9 @@ declare namespace Marionette {
*/
attachHtml(collectionView: CollectionView<TModel, TView>, childView: TView, index: number): void;
/**
* The value returned by this method is the ChildView class that will be
* instantiated when a Model needs to be initially rendered. This method
* also gives you the ability to customize per Model ChildViews.
*/
getChildView<M extends Backbone.Model>(item: M): new (...args:any[]) => TView;
/**
* If you need the emptyView's class chosen dynamically, specify
* getEmptyView.
*/
getEmptyView(): any;
/** Serialize a collection by serializing each of its models. */
serializeCollection(): any;
/**
* Attaches the content of a given view.
* This method can be overridden to optimize rendering,
* or to render in a non standard way.
*
* For example, using `innerHTML` instead of `$el.html`
*
* @example
* attachElContent: function(html) {
* this.el.innerHTML = html;
* return this;
* }
*/
attachElContent(html: string): ItemView<TModel>;
/**
* Reorder DOM after sorting. When your element's rendering
* do not use their index, you can pass reorderOnSort: true
@@ -1132,165 +1165,6 @@ declare namespace Marionette {
onRemoveChild(childView: TView): void;
}
/**
* A CompositeView extends from CollectionView to be used as a composite view
* for scenarios where it should represent both a branch and leaf in a tree
* structure, or for scenarios where a collection needs to be rendered within
* a wrapper template.
*/
class CompositeView<TModel extends Backbone.Model, TView extends View<Backbone.Model>> extends CollectionView<TModel, TView> {
constructor(options?: CollectionViewOptions<TModel>);
/**
* Each childView will be rendered using the childView's template. The
* CompositeView's template is rendered and the childView's templates are
* added to this.
*/
childView: new (...args:any[]) => TView;
/**
* By default the composite view uses the same attachHtml method that the
* collection view provides. This means the view will call jQuery's
* .append to move the HTML contents from the child view instance in to
* the collection view's el.
* This is typically not very useful as a composite view will usually render
* a container DOM element in which the child views should be placed.
* This can be either a string or a function returning a string.
*/
childViewContainer: any;
/**
* Renders the view.
*/
render(): CompositeView<TModel, TView>;
/**
* Invoked before the model has been rendered
*/
onBeforeRenderTemplate(): void;
/**
* Invoked after the model has been rendered.
*/
onRenderTemplate(): void;
/**
* Invoked before the collection of models is rendered
*/
onBeforeRenderCollection(): void;
/**
* Invoked after the collection of models has been rendered
*/
onRenderCollection(): void;
}
interface LayoutViewOptions<TModel extends Backbone.Model> extends Backbone.ViewOptions<TModel> {
/**
* The LayoutView takes an additional parameter where you can pass the regions as option on creation.
*/
regions?:any;
/**
* This option removes the layoutView from the DOM before destroying the
* children preventing repaints as each option is removed. However, it
* makes it difficult to do close animations for a child view (false by
* default)
*/
destroyImmediate?: boolean;
}
/**
* A LayoutView is a hybrid of an ItemView and a collection of Region objects.
* They are ideal for rendering application layouts with multiple sub-regions
* managed by specified region managers.
* A layoutView can also act as a composite-view to aggregate multiple views
* and sub-application areas of the screen allowing applications to attach
* multiple region managers to dynamically rendered HTML.
* You can create complex views by nesting layoutView managers within Regions.
*/
class LayoutView<TModel extends Backbone.Model> extends ItemView<TModel> {
/**
* If you have the need to replace the Region with a region class of your
* own implementation, you can specify an alternate class to use with this
* property.
*/
regionClass: any;
/**
* Constructor.
* A hash that can contain a regions hash that allows you to specify regions per
* LayoutView instance.
*/
constructor(options?: LayoutViewOptions<TModel>);
/**
* Handle destroying regions, and then destroy the view itself.
*/
destroy(): LayoutView<TModel>;
/**
* Regions hash or a method returning the regions hash that maps
* regions/selectors to methods on your View.
**/
regions(): any;
/** Adds a region to the layout view. */
addRegion(name: string, definition: any): Region;
/**
* Add multiple regions as a {name: definition, name2: def2} object literal.
*/
addRegions(regions: any): any;
/** Returns a region from the layout view */
getRegion(name: string): Region;
/**
* Renders the view. It will use the existing region objects the first
* time it is called. Subsequent calls will destroy the views that the
* regions are showing and then reset the `el` for the regions to the
* newly rendered DOM elements.
*/
render(): LayoutView<TModel>;
/**
* Removes the region with the specified name.
* @param name the name of the region to remove.
*/
removeRegion(name: string): Region;
/** Enable easy overriding of the default `RegionManager`
* for customized region interactions and business specific
* view logic for better control over single regions.
*/
getRegionManager(): RegionManager;
/**
* Show a view into the region specified by `regionName`.
*/
showChildView(regionName: string, view: any, options?: RegionShowOptions): void;
/**
* Get the current view that is shown in the region specified by
* `regionName`.
*/
getChildView(regionName: string): Backbone.View<TModel>;
/**
* Returns all regions from the layout view. The results contains an
* Object hash that has `string`s as keys and `Region`s as values.
*/
getRegions(): {[key: string]: Region};
/**
* You can customize the event prefix for events that are forwarded through
* the layout view with this property.
*/
childViewEventPrefix: string;
}
interface AppRouterOptions extends Backbone.RouterOptions {
/**
* The appRoutes.
@@ -1437,7 +1311,7 @@ declare namespace Marionette {
options: any;
/**
/**
* Behaviors can have their own ui hash, which will be mixed into the ui
* hash of its associated View instance. ui elements defined on either the
* Behavior or the View will be made available within events and triggers.
-2
View File
@@ -1,5 +1,3 @@
/// <reference types="jquery" />
function test_events() {
var object = new Backbone.Events();
-3
View File
@@ -1,6 +1,3 @@
/// <reference types="mocha" />
/// <reference types="chai" />
import * as angular from 'angular';
import 'angular-mocks';
-2
View File
@@ -1,5 +1,3 @@
/// <reference types="node" />
import fs = require('fs');
import BatchStream = require('batch-stream');
@@ -1,5 +1,3 @@
/// <reference types="bazinga-translator" />
Translator.fallback = 'en';
Translator.defaultDomain = 'messages';
-2
View File
@@ -1,5 +1,3 @@
/// <reference types="bezier-js" />
function test() {
var bezierjs: typeof BezierJs;
+1
View File
@@ -113,5 +113,6 @@ isBigInteger = x.times( "100" );
isNumber = x.toJSNumber();
isString = x.toString();
isString = x.toString(36);
isNumber = x.valueOf();
+1 -1
View File
@@ -195,7 +195,7 @@ interface BigInteger {
toJSNumber(): number;
/** Converts a bigInt to a string. */
toString(): string;
toString( radix?: number ): string;
/** Converts a bigInt to a native Javascript number. This override allows you to use native arithmetic operators without explicit conversion. */
valueOf(): number;
+443
View File
@@ -0,0 +1,443 @@
var x: BigNumber.BigNumber = new BigNumber(9);
var y = new BigNumber(x);
BigNumber(435.345);
new BigNumber('5032485723458348569331745.33434346346912144534543');
new BigNumber('4.321e+4');
new BigNumber('-735.0918e-430');
new BigNumber(Infinity);
new BigNumber(NaN);
new BigNumber('.5');
new BigNumber('+2');
new BigNumber(-10110100.1, 2);
new BigNumber(-0b10110100);
new BigNumber('123412421.234324', 5);
new BigNumber('ff.8', 16);
new BigNumber('0xff.8');
new BigNumber(9, 2);
new BigNumber(96517860459076817.4395);
new BigNumber('blurgh');
BigNumber.config({ DECIMAL_PLACES: 5 });
new BigNumber(1.23456789);
new BigNumber(1.23456789, 10);
BigNumber.config({ DECIMAL_PLACES: 5 });
var BN = BigNumber.another({ DECIMAL_PLACES: 9 });
x = new BigNumber(1);
y = new BN(1);
x.div(3);
y.div(3);
BN = BigNumber.another();
BN.config({ DECIMAL_PLACES: 9 });
BigNumber.config({ DECIMAL_PLACES: 5 });
BigNumber.set({ DECIMAL_PLACES: 5 });
BigNumber.config(5);
BigNumber.config({ ROUNDING_MODE: 0 });
BigNumber.config(undefined, BigNumber.ROUND_UP);
BigNumber.config({ EXPONENTIAL_AT: 2 });
new BigNumber(12.3);
new BigNumber(123);
new BigNumber(0.123);
new BigNumber(0.0123);
BigNumber.config({ EXPONENTIAL_AT: [-7, 20] });
new BigNumber(123456789);
new BigNumber(0.000000123);
BigNumber.config({ EXPONENTIAL_AT: 1e+9 });
BigNumber.config({ EXPONENTIAL_AT: 0 });
BigNumber.config({ RANGE: 500 });
BigNumber.config().RANGE;
new BigNumber('9.999e499');
new BigNumber('1e500');
new BigNumber('1e-499');
new BigNumber('1e-500');
BigNumber.config({ RANGE: [-3, 4] });
new BigNumber(99999);
new BigNumber(100000);
new BigNumber(0.001);
new BigNumber(0.0001);
BigNumber.config({ ERRORS: false });
BigNumber.config({ CRYPTO: true });
BigNumber.config().CRYPTO;
BigNumber.random();
BigNumber.config({ MODULO_MODE: BigNumber.EUCLID });
BigNumber.config({ MODULO_MODE: 9 });
BigNumber.config({ POW_PRECISION: 100 });
BigNumber.config({
FORMAT: {
decimalSeparator: '.',
groupSeparator: ',',
groupSize: 3,
secondaryGroupSize: 0,
fractionGroupSeparator: ' ',
fractionGroupSize: 0
}
});
BigNumber.config({
DECIMAL_PLACES: 40,
ROUNDING_MODE: BigNumber.ROUND_HALF_CEIL,
EXPONENTIAL_AT: [-10, 20],
RANGE: [-500, 500],
ERRORS: true,
CRYPTO: true,
MODULO_MODE: BigNumber.ROUND_FLOOR,
POW_PRECISION: 80,
FORMAT: {
groupSize: 3,
groupSeparator: ' ',
decimalSeparator: ','
}
});
BigNumber.config(40, 7, [-10, 20], 500, 1, 1, 3, 80);
var obj = BigNumber.config();
obj.ERRORS;
obj.RANGE;
x = new BigNumber('3257869345.0378653');
BigNumber.max(4e9, x, '123456789.9');
var arr = [12, '13', new BigNumber(14)];
BigNumber.max(arr);
x = new BigNumber('3257869345.0378653');
BigNumber.min(4e9, x, '123456789.9');
arr = [2, new BigNumber(-14), '-15.9999', -12];
BigNumber.min(arr);
BigNumber.config({ DECIMAL_PLACES: 10 });
BigNumber.random();
BigNumber.random(20);
BigNumber.config({ ROUNDING_MODE: BigNumber.ROUND_CEIL });
BigNumber.config({ ROUNDING_MODE: 2 });
x = new BigNumber(-0.8);
y = x.absoluteValue();
var z = y.abs();
x = new BigNumber(1.3);
x.ceil();
y = new BigNumber(-1.8);
y.ceil();
x = new BigNumber(Infinity);
y = new BigNumber(5);
x.comparedTo(y);
x.comparedTo(x.minus(1));
y.cmp(NaN);
y.cmp('110', 2);
x = new BigNumber(123.45);
x.decimalPlaces();
y = new BigNumber('9.9e-101');
y.dp();
x = new BigNumber(355);
y = new BigNumber(113);
x.dividedBy(y);
x.div(5);
x.div(47, 16);
x = new BigNumber(5);
y = new BigNumber(3);
x.dividedToIntegerBy(y);
x.divToInt(0.7);
x.divToInt('0.f', 16);
0 === 1e-324;
x = new BigNumber(0);
x.equals('1e-324');
BigNumber(-0).eq(x);
BigNumber(255).eq('ff', 16);
y = new BigNumber(NaN);
y.equals(NaN);
x = new BigNumber(1.8);
x.floor();
y = new BigNumber(-1.3);
y.floor();
0.1 > (0.3 - 0.2);
x = new BigNumber(0.1);
x.greaterThan(BigNumber(0.3).minus(0.2));
BigNumber(0).gt(x);
BigNumber(11, 3).gt(11.1, 2);
x = new BigNumber(0.3).minus(0.2);
x.greaterThanOrEqualTo(0.1);
BigNumber(1).gte(x);
BigNumber(10, 18).gte('i', 36);
x = new BigNumber(1);
x.isFinite();
y = new BigNumber(Infinity);
y.isFinite();
x = new BigNumber(1);
x.isInteger();
y = new BigNumber(123.456);
y.isInt();
x = new BigNumber(NaN);
x.isNaN();
y = new BigNumber('Infinity');
y.isNaN();
x = new BigNumber(-0);
x.isNegative();
y = new BigNumber(2);
y.isNeg();
x = new BigNumber(-0);
x.isZero() && x.isNeg();
y = new BigNumber(Infinity);
y.isZero();
x = new BigNumber(0.3).minus(0.2);
x.lessThan(0.1);
BigNumber(0).lt(x);
BigNumber(11.1, 2).lt(11, 3);
x = new BigNumber(0.1);
x.lessThanOrEqualTo(BigNumber(0.3).minus(0.2));
BigNumber(-1).lte(x);
BigNumber(10, 18).lte('i', 36);
x = new BigNumber(0.3);
x.minus(0.1);
x.sub(0.6, 20);
x = new BigNumber(1);
x.modulo(0.9);
y = new BigNumber(33);
y.mod('a', 33);
x = new BigNumber(1.8);
x.negated();
y = new BigNumber(-1.3);
y.neg();
x = new BigNumber(0.1);
y = x.plus(0.2);
BigNumber(0.7).plus(x).add(y);
x.plus('0.1', 8);
x = new BigNumber(1.234);
x.precision();
y = new BigNumber(987000);
y.sd();
y.sd(true);
y = new BigNumber(x);
y.round();
y.round(1);
y.round(2);
y.round(10);
y.round(0, 1);
y.round(0, 6);
y.round(1, 1);
y.round(1, BigNumber.ROUND_HALF_EVEN);
x = new BigNumber(1.23);
x.shift(3);
x.shift(-3);
x = new BigNumber(16);
x.squareRoot();
y = new BigNumber(3);
y.sqrt();
x = new BigNumber(0.6);
y = x.times(3);
BigNumber('7e+500').times(y);
x.times('-a', 16);
BigNumber.config({ DECIMAL_PLACES: 5, ROUNDING_MODE: 4 });
x = new BigNumber(9876.54321);
x.toDigits();
x.toDigits(6);
x.toDigits(6, BigNumber.ROUND_UP);
x.toDigits(2);
x.toDigits(2, 1);
y = new BigNumber(45.6);
y.toExponential();
y.toExponential(0);
y.toExponential(1);
y.toExponential(1, 1);
y.toExponential(3);
y = new BigNumber(3.456);
y.toFixed();
y.toFixed(0);
y.toFixed(2);
y.toFixed(2, 1);
y.toFixed(5);
var format = {
decimalSeparator: '.',
groupSeparator: ',',
groupSize: 3,
secondaryGroupSize: 0,
fractionGroupSeparator: ' ',
fractionGroupSize: 0
};
BigNumber.config({ FORMAT: format });
x = new BigNumber('123456789.123456789');
x.toFormat();
x.toFormat(1);
format.groupSeparator = ' ';
format.fractionGroupSize = 5;
x.toFormat();
BigNumber.config({
FORMAT: {
decimalSeparator: ',',
groupSeparator: '.',
groupSize: 3,
secondaryGroupSize: 2
}
});
x.toFormat(6);
x = new BigNumber(1.75);
x.toFraction();
var pi = new BigNumber('3.14159265358');
pi.toFraction();
pi.toFraction(100000);
pi.toFraction(10000);
pi.toFraction(100);
pi.toFraction(10);
pi.toFraction(1);
x = new BigNumber('177.7e+457');
y = new BigNumber(235.4325);
z = new BigNumber('0.0098074');
var str = JSON.stringify([x, y, z]);
JSON.parse(str, (key, val) => key === '' ? val : new BigNumber(val));
x = new BigNumber(456.789);
x.toNumber();
{ +x; }
y = new BigNumber('45987349857634085409857349856430985');
y.toNumber();
z = new BigNumber(-0);
1 / +z;
1 / z.toNumber();
x = new BigNumber(0.7);
x.toPower(2);
BigNumber(3).pow(-2);
y = new BigNumber(45.6);
x.toPrecision();
y.toPrecision();
x.toPrecision(1);
y.toPrecision(1);
y.toPrecision(2, 0);
y.toPrecision(2, 1);
x.toPrecision(5);
y.toPrecision(5);
x = new BigNumber(750000);
x.toString();
BigNumber.config({ EXPONENTIAL_AT: 5 });
x.toString();
y = new BigNumber(362.875);
y.toString(2);
y.toString(9);
y.toString(32);
BigNumber.config({ DECIMAL_PLACES: 4 });
z = new BigNumber('1.23456789');
z.toString();
z.toString(10);
x = new BigNumber(123.456);
x.truncated();
y = new BigNumber(-12.3);
y.trunc();
x = new BigNumber('-0');
x.toString();
x.valueOf();
y = new BigNumber('1.777e+457');
y.valueOf();
x = new BigNumber(0.123);
x.toExponential();
x.c;
x.e;
x.s;
z = new BigNumber('-123.4567000e+2');
z.toExponential();
z.c;
z.e;
z.s;
x = new BigNumber(3);
x instanceof BigNumber;
x.isBigNumber;
BN = BigNumber.another();
y = new BN(3);
y instanceof BigNumber;
y.isBigNumber;
y = new BigNumber(-0);
y.c;
y.e;
y.s;
try {
// ...
} catch (e) {
if (e instanceof Error && e.name === 'BigNumber Error') {
// ...
}
}
x = new BigNumber("1.0");
y = new BigNumber("1.1000");
z = x.add(y);
x = new BigNumber("1.20");
y = new BigNumber("3.45000");
z = x.mul(y);
+676
View File
@@ -0,0 +1,676 @@
// Type definitions for bignumber.js 4.0
// Project: https://github.com/MikeMcl/bignumber.js/
// Definitions by: Viktor Smirnov <https://github.com/LaserUnicorns/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
declare var BigNumber: BigNumber.BigNumberStatic;
export as namespace BigNumber;
export = BigNumber;
declare namespace BigNumber {
interface FormatConfig {
/**
* The decimal separator.
*/
decimalSeparator: string;
/**
* The grouping separator of the integer part.
*/
groupSeparator: string;
/**
* The primary grouping size of the integer part.
*/
groupSize: number;
/**
* The secondary grouping size of the integer part.
*/
secondaryGroupSize: number;
/**
* The grouping separator of the fraction part.
*/
fractionGroupSeparator: string;
/**
* The grouping size of the fraction part.
*/
fractionGroupSize: number;
}
interface BigNumberConfig {
/**
* The maximum number of decimal places of the results of operations involving division,
* i.e. division, square root and base conversion operations, and power operations with negative exponents.
*/
DECIMAL_PLACES: number;
/**
* The rounding mode used in the above operations and the default rounding mode of round, `toExponential`, `toFixed`, `toFormat` and `toPrecision`.
*/
ROUNDING_MODE: RoundingMode;
/**
* The exponent value(s) at which `toString` returns exponential notation.
*
* If a single number is assigned, the value is the exponent magnitude.
*
* If an array of two numbers is assigned then the first number is the negative exponent value at and beneath which exponential notation is used,
* and the second number is the positive exponent value at and above which the same.
*/
EXPONENTIAL_AT: number | number[];
/**
* The exponent value(s) beyond which overflow to `Infinity` and underflow to zero occurs.
*
* If a single number is assigned, it is the maximum exponent magnitude:
* values wth a positive exponent of greater magnitude become `Infinity`
* and those with a negative exponent of greater magnitude become zero.
*
* If an array of two numbers is assigned then the first number is the negative exponent limit and the second number is the positive exponent limit.
*/
RANGE: number | number[];
/**
* The value that determines whether BigNumber Errors are thrown.
*
* If `ERRORS` is false, no errors will be thrown.
*/
ERRORS: boolean | 0 | 1;
/**
* The value that determines whether cryptographically-secure pseudo-random number generation is used.
*
* If `CRYPTO` is set to `true` then the `random` method will generate random digits using `crypto.getRandomValues` in browsers that support it,
* or `crypto.randomBytes` if using a version of Node.js that supports it.
*
* If neither function is supported by the host environment then attempting to set `CRYPTO` to `true` will fail, and if `ERRORS` is `true` an exception will be thrown.
*
* If `CRYPTO` is `false` then the source of randomness used will be `Math.random` (which is assumed to generate at least `30` bits of randomness).
*/
CRYPTO: boolean | 0 | 1;
/**
* The modulo mode used when calculating the modulus: `a mod n`.
*
* The quotient, `q = a / n`, is calculated according to the `ROUNDING_MODE` that corresponds to the chosen `MODULO_MODE`.
*
* The remainder, `r`, is calculated as: `r = a - n * q`.
*/
MODULO_MODE: ModuloMode;
/**
* The maximum number of significant digits of the result of the power operation (unless a modulus is specified).
*
* If set to `0`, the number of signifcant digits will not be limited.
*/
POW_PRECISION: number;
/**
* The `FORMAT` object configures the format of the string returned by the toFormat method.
*/
FORMAT: Partial<FormatConfig>;
}
type NumberLike = number | string | BigNumber;
type RoundingMode = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;
type ModuloMode = RoundingMode | 9;
interface BigNumberStatic {
/**
* Returns a new instance of a BigNumber object.
*/
(value: NumberLike, base?: number): BigNumber;
/**
* Returns a new instance of a BigNumber object.
*/
new (value: NumberLike, base?: number): BigNumber;
/**
* Returns a new independent BigNumber constructor with configuration as described by obj, or with the default configuration if obj is null or undefined.
*/
another(obj?: Partial<BigNumberConfig>): BigNumberStatic;
/**
* Configures the settings for this particular BigNumber constructor.
*
*/
config(obj?: Partial<BigNumberConfig>): BigNumberConfig;
/**
* Configures the settings for this particular BigNumber constructor.
*/
config(
DECIMAL_PLACES?: number,
ROUNDING_MODE?: RoundingMode,
EXPONENTIAL_AT?: number | number[],
RANGE?: number | number[],
ERRORS?: boolean | 0 | 1,
CRYPTO?: boolean | 0 | 1,
MODULO_MODE?: ModuloMode,
POW_PRECISION?: number
): BigNumberConfig;
/**
* Configures the settings for this particular BigNumber constructor.
*/
set(obj?: Partial<BigNumberConfig>): BigNumberConfig;
/**
* Configures the settings for this particular BigNumber constructor.
*/
set(
DECIMAL_PLACES?: number,
ROUNDING_MODE?: RoundingMode,
EXPONENTIAL_AT?: number | number[],
RANGE?: number | number[],
ERRORS?: boolean | 0 | 1,
CRYPTO?: boolean | 0 | 1,
MODULO_MODE?: ModuloMode,
POW_PRECISION?: number
): BigNumberConfig;
/**
* Returns a BigNumber whose value is the maximum of `args`.
*/
max(...args: NumberLike[]): BigNumber;
/**
* Returns a BigNumber whose value is the maximum of `args`.
*/
max(args: NumberLike[]): BigNumber;
/**
* Returns a BigNumber whose value is the minimum of `args`.
*/
min(...args: NumberLike[]): BigNumber;
/**
* Returns a BigNumber whose value is the minimum of `args`.
*/
min(args: NumberLike[]): BigNumber;
/**
* Returns a new BigNumber with a pseudo-random value equal to or greater than `0` and less than `1`.
*
* The return value will have `dp` decimal places (or less if trailing zeros are produced).
* If `dp` is omitted then the number of decimal places will default to the current `DECIMAL_PLACES` setting.
*
* Depending on the value of this BigNumber constructor's `CRYPTO` setting and the support for the `crypto` object in the host environment,
* the random digits of the return value are generated by either
* `Math.random` (fastest),
* `crypto.getRandomValues` (Web Cryptography API in recent browsers)
* or `crypto.randomBytes` (Node.js).
*
* If `CRYPTO` is `true`, i.e. one of the `crypto` methods is to be used,
* the value of a returned BigNumber should be cryptographically-secure and statistically indistinguishable from a random value.
*/
random(dp?: number): BigNumber;
/**
* Rounds away from zero
*/
ROUND_UP: 0;
/**
* Rounds towards zero
*/
ROUND_DOWN: 1;
/**
* Rounds towards `Infinity`
*/
ROUND_CEIL: 2;
/**
* Rounds towards `-Infinity`
*/
ROUND_FLOOR: 3;
/**
* Rounds towards nearest neighbour.
* If equidistant, rounds away from zero.
*/
ROUND_HALF_UP: 4;
/**
* Rounds towards nearest neighbour.
* If equidistant, rounds towards zero.
*/
ROUND_HALF_DOWN: 5;
/**
* Rounds towards nearest neighbour.
* If equidistant, rounds towards even neighbour.
*/
ROUND_HALF_EVEN: 6;
/**
* Rounds towards nearest neighbour.
* If equidistant, rounds towards `Infinity`.
*/
ROUND_HALF_CEIL: 7;
/**
* Rounds towards nearest neighbour.
* If equidistant, rounds towards `-Infinity`.
*/
ROUND_HALF_FLOOR: 8;
/**
* The remainder is always positive.
*
* Euclidian division: `q = sign(n) * floor(a / abs(n))`
*/
EUCLID: 9;
}
interface BigNumber {
/**
* Returns a BigNumber whose value is the absolute value, i.e. the magnitude, of the value of this BigNumber.
*/
absoluteValue(): BigNumber;
/**
* Returns a BigNumber whose value is the absolute value, i.e. the magnitude, of the value of this BigNumber.
*/
abs(): BigNumber;
/**
* Returns a BigNumber whose value is the value of this BigNumber rounded to a whole number in the direction of positive Infinity.
*/
ceil(): BigNumber;
/**
* Returns
*
* `1` if the value of this BigNumber is greater than the value of `n`
*
* `-1` if the value of this BigNumber is less than the value of `n`
*
* `0` if this BigNumber and `n` have the same value
*
* `null` if the value of either this BigNumber or `n` is `NaN`
*/
comparedTo(n: NumberLike, base?: number): 1 | -1 | 0 | null;
/**
* Returns
*
* `1` if the value of this BigNumber is greater than the value of `n`
*
* `-1` if the value of this BigNumber is less than the value of `n`
*
* `0` if this BigNumber and `n` have the same value
*
* `null` if the value of either this BigNumber or `n` is `NaN`
*/
cmp(n: NumberLike, base?: number): 1 | -1 | 0 | null;
/**
* Return the number of decimal places of the value of this BigNumber, or `null` if the value of this BigNumber is `±Infinity` or `NaN`.
*/
decimalPlaces(): number;
/**
* Return the number of decimal places of the value of this BigNumber, or `null` if the value of this BigNumber is `±Infinity` or `NaN`.
*/
dp(): number;
/**
* Returns a BigNumber whose value is the value of this BigNumber divided by `n`, rounded according to the current `DECIMAL_PLACES` and `ROUNDING_MODE` configuration.
*/
dividedBy(n: NumberLike, base?: number): BigNumber;
/**
* Returns a BigNumber whose value is the value of this BigNumber divided by `n`, rounded according to the current `DECIMAL_PLACES` and `ROUNDING_MODE` configuration.
*/
div(n: NumberLike, base?: number): BigNumber;
/**
* Return a BigNumber whose value is the integer part of dividing the value of this BigNumber by `n`.
*/
dividedToIntegerBy(n: NumberLike, base?: number): BigNumber;
/**
* Return a BigNumber whose value is the integer part of dividing the value of this BigNumber by `n`.
*/
divToInt(n: NumberLike, base?: number): BigNumber;
/**
* Returns `true` if the value of this BigNumber equals the value of `n`, otherwise returns `false`.
*
* As with JavaScript, `NaN` does not equal `NaN`.
*/
equals(n: NumberLike, base?: number): boolean;
/**
* Returns `true` if the value of this BigNumber equals the value of `n`, otherwise returns `false`.
*
* As with JavaScript, `NaN` does not equal `NaN`.
*/
eq(n: NumberLike, base?: number): boolean;
/**
* Returns a BigNumber whose value is the value of this BigNumber rounded to a whole number in the direction of negative `Infinity`.
*/
floor(): BigNumber;
/**
* Returns `true` if the value of this BigNumber is greater than the value of `n`, otherwise returns `false`.
*/
greaterThan(n: NumberLike, base?: number): boolean;
/**
* Returns `true` if the value of this BigNumber is greater than the value of `n`, otherwise returns `false`.
*/
gt(n: NumberLike, base?: number): boolean;
/**
* Returns `true` if the value of this BigNumber is greater than or equal to the value of `n`, otherwise returns `false`.
*/
greaterThanOrEqualTo(n: NumberLike, base?: number): boolean;
/**
* Returns `true` if the value of this BigNumber is greater than or equal to the value of `n`, otherwise returns `false`.
*/
gte(n: NumberLike, base?: number): boolean;
/**
* Returns `true` if the value of this BigNumber is a finite number, otherwise returns `false`.
*
* The only possible non-finite values of a BigNumber are `NaN`, `Infinity` and `-Infinity`.
*/
isFinite(): boolean;
/**
* Returns `true` if the value of this BigNumber is a whole number, otherwise returns `false`.
*/
isInteger(): boolean;
/**
* Returns `true` if the value of this BigNumber is a whole number, otherwise returns `false`.
*/
isInt(): boolean;
/**
* Returns `true` if the value of this BigNumber is NaN, otherwise returns `false`.
*/
isNaN(): boolean;
/**
* Returns `true` if the value of this BigNumber is negative, otherwise returns `false`.
*/
isNegative(): boolean;
/**
* Returns `true` if the value of this BigNumber is negative, otherwise returns `false`.
*/
isNeg(): boolean;
/**
* Returns `true` if the value of this BigNumber is zero or minus zero, otherwise returns `false`.
*/
isZero(): boolean;
/**
* Returns `true` if the value of this BigNumber is less than the value of `n`, otherwise returns `false`.
*/
lessThan(n: NumberLike, base?: number): boolean;
/**
* Returns `true` if the value of this BigNumber is less than the value of `n`, otherwise returns `false`.
*/
lt(n: NumberLike, base?: number): boolean;
/**
* Returns `true` if the value of this BigNumber is less than or equal to the value of `n`, otherwise returns
*/
lessThanOrEqualTo(n: NumberLike, base?: number): boolean;
/**
* Returns `true` if the value of this BigNumber is less than or equal to the value of `n`, otherwise returns
*/
lte(n: NumberLike, base?: number): boolean;
/**
* Returns a BigNumber whose value is the value of this BigNumber minus `n`.
*/
minus(n: NumberLike, base?: number): BigNumber;
/**
* Returns a BigNumber whose value is the value of this BigNumber minus `n`.
*/
sub(n: NumberLike, base?: number): BigNumber;
/**
* Returns a BigNumber whose value is the value of this BigNumber modulo `n`, i.e. the integer remainder of dividing this BigNumber by `n`.
*
* The value returned, and in particular its sign, is dependent on the value of the `MODULO_MODE` setting of this BigNumber constructor.
* If it is `1` (default value), the result will have the same sign as this BigNumber,
* and it will match that of Javascript's `%` operator (within the limits of double precision) and BigDecimal's `remainder` method.
*/
modulo(n: NumberLike, base?: number): BigNumber;
/**
* Returns a BigNumber whose value is the value of this BigNumber modulo `n`, i.e. the integer remainder of dividing this BigNumber by `n`.
*
* The value returned, and in particular its sign, is dependent on the value of the `MODULO_MODE` setting of this BigNumber constructor.
* If it is `1` (default value), the result will have the same sign as this BigNumber,
* and it will match that of Javascript's `%` operator (within the limits of double precision) and BigDecimal's `remainder` method.
*/
mod(n: NumberLike, base?: number): BigNumber;
/**
* Returns a BigNumber whose value is the value of this BigNumber negated, i.e. multiplied by `-1`.
*/
negated(): BigNumber;
/**
* Returns a BigNumber whose value is the value of this BigNumber negated, i.e. multiplied by `-1`.
*/
neg(): BigNumber;
/**
* Returns a BigNumber whose value is the value of this BigNumber plus `n`.
*/
plus(n: NumberLike, base?: number): BigNumber;
/**
* Returns a BigNumber whose value is the value of this BigNumber plus `n`.
*/
add(n: NumberLike, base?: number): BigNumber;
/**
* Returns the number of significant digits of the value of this BigNumber.
*
* If `z` is `true` or `1` then any trailing zeros of the integer part of a number are counted as significant digits, otherwise they are not.
*/
precision(z?: boolean | 0 | 1): number;
/**
* Returns the number of significant digits of the value of this BigNumber.
*
* If `z` is `true` or `1` then any trailing zeros of the integer part of a number are counted as significant digits, otherwise they are not.
*/
sd(z?: boolean | 0 | 1): number;
/**
* Returns a BigNumber whose value is the value of this BigNumber rounded by rounding mode `rm` to a maximum of `dp` decimal places.
*
* If `dp` is omitted, or is `null` or `undefined`, the return value is `n` rounded to a whole number.
*
* If `rm` is omitted, or is `null` or `undefined`, `ROUNDING_MODE` is used.
*/
round(dp?: number, rm?: RoundingMode): BigNumber;
/**
* Returns a BigNumber whose value is the value of this BigNumber shifted `n` places.
*
* The shift is of the decimal point, i.e. of powers of ten, and is to the left if `n` is negative or to the right if `n` is positive.
*/
shift(n: number): BigNumber;
/**
* Returns a BigNumber whose value is the square root of the value of this BigNumber, rounded according to the current `DECIMAL_PLACES` and `ROUNDING_MODE` configuration.
*
* The return value will be correctly rounded, i.e. rounded as if the result was first calculated to an infinite number of correct digits before rounding.
*/
squareRoot(): BigNumber;
/**
* Returns a BigNumber whose value is the square root of the value of this BigNumber, rounded according to the current `DECIMAL_PLACES` and `ROUNDING_MODE` configuration.
*
* The return value will be correctly rounded, i.e. rounded as if the result was first calculated to an infinite number of correct digits before rounding.
*/
sqrt(): BigNumber;
/**
* Returns a BigNumber whose value is the value of this BigNumber times `n`.
*/
times(n: NumberLike, base?: number): BigNumber;
/**
* Returns a BigNumber whose value is the value of this BigNumber times `n`.
*/
mul(n: NumberLike, base?: number): BigNumber;
/**
* Returns a BigNumber whose value is the value of this BigNumber rounded to `sd` significant digits using rounding mode `rm`.
*
* If `sd` is omitted or is `null` or `undefined`, the return value will not be rounded.
*
* If `rm` is omitted or is `null` or `undefined`, ROUNDING_MODE will be used.
*/
toDigits(sd?: number, rm?: RoundingMode): BigNumber;
/**
* Returns a string representing the value of this BigNumber in exponential notation rounded using rounding mode `rm` to `dp` decimal places,
* i.e with one digit before the decimal point and `dp` digits after it.
*
* If the value of this BigNumber in exponential notation has fewer than `dp` fraction digits, the return value will be appended with zeros accordingly.
*
* If `dp` is omitted, or is `null` or `undefined`, the number of digits after the decimal point defaults to the minimum number of digits necessary to represent the value exactly.
*
* If `rm` is omitted or is `null` or `undefined`, `ROUNDING_MODE` is used.
*/
toExponential(dp?: number, rm?: RoundingMode): string;
/**
* Returns a string representing the value of this BigNumber in normal (fixed-point) notation rounded to `dp` decimal places using rounding mode `rm`.
*
* If the value of this BigNumber in normal notation has fewer than `dp` fraction digits, the return value will be appended with zeros accordingly.
*
* Unlike `Number.prototype.toFixed`, which returns exponential notation if a number is greater or equal to `10e21`, this method will always return normal notation.
*
* If `dp` is omitted or is `null` or `undefined`, the return value will be unrounded and in normal notation.
* This is also unlike `Number.prototype.toFixed`, which returns the value to zero decimal places.
* It is useful when fixed-point notation is required and the current `EXPONENTIAL_AT` setting causes `toString` to return exponential notation.
*
* If `rm` is omitted or is `null` or `undefined`, `ROUNDING_MODE` is used.
*/
toFixed(dp?: number, rm?: RoundingMode): string;
/**
* Returns a string representing the value of this BigNumber in normal (fixed-point) notation rounded to `dp` decimal places using rounding mode `rm`,
* and formatted according to the properties of the `FORMAT` object.
*
* If `dp` is omitted or is `null` or `undefined`, then the return value is not rounded to a fixed number of decimal places.
*
* If `rm` is omitted or is `null` or `undefined`, `ROUNDING_MODE` is used.
*/
toFormat(dp?: number, rm?: RoundingMode): string;
/**
* Returns a string array representing the value of this BigNumber as a simple fraction with an integer numerator and an integer denominator.
* The denominator will be a positive non-zero value less than or equal to `max`.
*
* If a maximum denominator, `max`, is not specified, or is `null` or `undefined`, the denominator will be the lowest value necessary to represent the number exactly.
*/
toFraction(max?: NumberLike): [string, string];
/**
* As `valueOf`.
*/
toJSON(): string;
/**
* Returns the value of this BigNumber as a JavaScript number primitive.
*
* Type coercion with, for example, the unary plus operator will also work, except that a BigNumber with the value minus zero will be converted to positive zero.
*/
toNumber(): number;
/**
* Returns a BigNumber whose value is the value of this BigNumber raised to the power `n`, and optionally modulo a modulus `m`.
*
* If `n` is negative the result is rounded according to the current `DECIMAL_PLACES` and `ROUNDING_MODE` configuration.
*/
toPower(n: number, m?: NumberLike): BigNumber;
/**
* Returns a BigNumber whose value is the value of this BigNumber raised to the power `n`, and optionally modulo a modulus `m`.
*
* If `n` is negative the result is rounded according to the current `DECIMAL_PLACES` and `ROUNDING_MODE` configuration.
*/
pow(n: number, m?: NumberLike): BigNumber;
/**
* Returns a string representing the value of this BigNumber rounded to `sd` significant digits using rounding mode `rm`.
*
* If `sd` is less than the number of digits necessary to represent the integer part of the value in normal (fixed-point) notation, then exponential notation is used.
*
* If `sd` is omitted, or is `null` or `undefined`, then the return value is the same as `n.toString()`.
*
* If `rm` is omitted or is `null` or `undefined`, `ROUNDING_MODE` is used.
*/
toPrecision(sd?: number, rm?: RoundingMode): string;
/**
* Returns a string representing the value of this BigNumber in the specified base, or base `10` if `base` is omitted or is `null` or `undefined`.
*/
toString(base?: number): string;
/**
* Returns a BigNumber whose value is the value of this BigNumber truncated to a whole number.
*/
truncated(): BigNumber;
/**
* Returns a BigNumber whose value is the value of this BigNumber truncated to a whole number.
*/
trunc(): BigNumber;
/**
* As `toString`, but does not accept a base argument and includes the minus sign for negative zero.
*/
valueOf(): string;
/**
* coefficient
* @description Array of base 1e14 numbers
*/
c: number[] | null;
/**
* exponent
* @description Integer, -1000000000 to 1000000000 inclusive
*/
e: number | null;
/**
* sign
*/
s: -1 | 1 | null;
/**
* type identifier
*/
isBigNumber: true;
}
}
+22
View File
@@ -0,0 +1,22 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"bignumber.js-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "../tslint.json" }
-7
View File
@@ -1,10 +1,3 @@
/// <reference path="Microsoft.Maps.AdvancedShapes.d.ts"/>
/// <reference path="Microsoft.Maps.Directions.d.ts"/>
/// <reference path="Microsoft.Maps.Search.d.ts"/>
/// <reference path="Microsoft.Maps.Themes.BingTheme.d.ts"/>
/// <reference path="Microsoft.Maps.Traffic.d.ts"/>
/// <reference path="Microsoft.Maps.VenueMaps.d.ts"/>
namespace BingMapsTests {
// An interactive set of Bing Maps AJAX control usages can be found at http://www.bingmapsportal.com/isdk/ajaxv7
-2
View File
@@ -1,5 +1,3 @@
/// <reference types="bit-array" />
import BitArray = require("bit-array");
const a = new BitArray(32);

Some files were not shown because too many files have changed in this diff Show More