A repeated Instance.
+ *
+ * InstanceForm is an utility class for repeated {@link Instance}. It is designed for shrinking
+ * volume of network message I/O by storing {@link count repeated count}.
+ *
+ * @author Jeongho Nam
+ */
+ class InstanceForm extends samchon.protocol.Entity {
+ /**
+ * A duplicated Instance.
+ */
+ private instance;
+ /**
+ * Repeated count of the {@link instance}.
+ */
+ private count;
+ /**
+ * Default Constructor.
+ */
+ constructor(instance?: Instance, count?: number);
+ /**
+ * @inheritdoc
+ */
+ construct(xml: samchon.library.XML): void;
+ private createInstance(xml);
+ key(): any;
+ getInstance(): Instance;
+ getCount(): number;
+ setCount(val: number): void;
+ $name: string;
+ $width: string;
+ $height: string;
+ $length: string;
+ $count: string;
+ /**
+ * @inheritdoc
+ */
+ TAG(): string;
+ /**
+ * @inheritdoc
+ */
+ toXML(): samchon.library.XML;
+ /**
+ * Repeated {@link instance} to {@link InstanceArray}.
+ *
+ * @details
+ *
Contains the {@link instance repeated instance} to an {@link InstanceArray} to make
+ * {@link instance} to participate in the packing process. The returned {@link InstanceArray} will be
+ * registered on {@link Packer.instanceArray}.
+ *
+ * @return An array of instance containing repeated {@link instance}.
+ */
+ toInstanceArray(): InstanceArray;
+ }
+}
+declare namespace bws.packer {
+ class WrapperArray extends samchon.protocol.EntityArrayCollection {
+ /**
+ * Default Constructor.
+ */
+ constructor();
+ /**
+ * @inheritdoc
+ */
+ createChild(xml: samchon.library.XML): Wrapper;
+ /**
+ * Get (calculate) price.
+ */
+ getPrice(): number;
+ /**
+ * Get (calculate) utilization rate.
+ */
+ getUtilization(): number;
+ /**
+ * @inheritdoc
+ */
+ TAG(): string;
+ /**
+ * @inheritdoc
+ */
+ CHILD_TAG(): string;
+ }
+}
+declare namespace bws.packer {
+ class GAWrapperArray extends WrapperArray {
+ protected instanceArray: InstanceArray;
+ protected result: std.HashMap;
+ private price;
+ /**
+ * @brief Validity of this sequence list.
+ */
+ private valid;
+ /**
+ * Construct from instances.
+ *
+ * @param instanceArray Instances to be wrapped.
+ */
+ constructor(instanceArray: InstanceArray);
+ /**
+ * @brief Copy Constructor.
+ */
+ constructor(genes: GAWrapperArray);
+ private constructResult();
+ /**
+ * @brief Get optimization result.
+ *
+ * @return result map.
+ */
+ getResult(): std.HashMap;
+ less(obj: GAWrapperArray): boolean;
+ }
+}
+declare namespace bws.packer {
+ /**
+ * An interface of physical 3D-instances.
+ *
+ * @author Jeongho Nam
+ */
+ interface Instance extends samchon.protocol.IEntity {
+ /**
+ * Get name.
+ */
+ getName(): string;
+ /**
+ * Get width, length on the X-axis in 3D.
+ */
+ getWidth(): number;
+ /**
+ * Get height, length on the Y-axis in 3D.
+ */
+ getHeight(): number;
+ /**
+ * Get length, length on the Z-axis in 3D.
+ */
+ getLength(): number;
+ /**
+ * Get (calculate) volume.
+ *
+ * @return width x height x length
+ */
+ getVolume(): number;
+ /**
+ * Set name.
+ */
+ setName(val: string): void;
+ /**
+ * Set width, length on the X-axis in 3D.
+ */
+ setWidth(val: number): void;
+ /**
+ * Set height, length on the Y-axis in 3D.
+ */
+ setHeight(val: number): void;
+ /**
+ * Set length, length on the Z-axis in 3D.
+ */
+ setLength(val: number): void;
+ /**
+ * A type, identifier of derived class.
+ *
+ * Derived types
+ *
+ * - {@link Product product}
+ * - {@link Wrapper wrapper}
+ *
+ */
+ TYPE(): string;
+ }
+}
+declare namespace bws.packer {
+ /**
+ * An array of Instance objects.
+ *
+ * @author Jeongho Nam
+ */
+ class InstanceArray extends samchon.protocol.EntityArray {
+ /**
+ * Default Constructor.
+ */
+ constructor();
+ /**
+ * @inheritdoc
+ */
+ createChild(xml: samchon.library.XML): Instance;
+ /**
+ * @inheritdoc
+ */
+ TAG(): string;
+ /**
+ * @inheritdoc
+ */
+ CHILD_TAG(): string;
+ }
+}
+declare namespace bws.packer {
+ /**
+ * A product.
+ *
+ * @author Jeongho Nam
+ */
+ class Product extends samchon.protocol.Entity implements Instance {
+ /**
+ * Name, key of the Product.
+ *
+ * The name must be unique because a name identifies a {@link Product}.
+ */
+ protected name: string;
+ /**
+ * Width of the Product, length on the X-axis in 3D.
+ */
+ protected width: number;
+ /**
+ * Height of the Product, length on the Y-axis in 3D.
+ */
+ protected height: number;
+ /**
+ * Length of the Product, length on the Z-axis in 3D.
+ */
+ protected length: number;
+ /**
+ * Default Constructor.
+ */
+ constructor();
+ /**
+ * Construct from members.
+ *
+ * @param name Name, identifier of the Product.
+ * @param width Width, length on the X-axis in 3D.
+ * @param height Height, length on the Y-axis in 3D.
+ * @param length Length, length on the Z-axis in 3D.
+ */
+ constructor(name: string, width: number, height: number, length: number);
+ /**
+ * Key of a Product is its name.
+ */
+ key(): any;
+ /**
+ * @inheritdoc
+ */
+ getName(): string;
+ /**
+ * @inheritdoc
+ */
+ getWidth(): number;
+ /**
+ * @inheritdoc
+ */
+ getHeight(): number;
+ /**
+ * @inheritdoc
+ */
+ getLength(): number;
+ /**
+ * @inheritdoc
+ */
+ getVolume(): number;
+ /**
+ * @inheritdoc
+ */
+ setName(val: string): void;
+ /**
+ * @inheritdoc
+ */
+ setWidth(val: number): void;
+ /**
+ * @inheritdoc
+ */
+ setHeight(val: number): void;
+ /**
+ * @inheritdoc
+ */
+ setLength(val: number): void;
+ /**
+ * @inheritdoc
+ */
+ TYPE(): string;
+ /**
+ * @inheritdoc
+ */
+ TAG(): string;
+ /**
+ * @inheritdoc
+ */
+ toXML(): samchon.library.XML;
+ }
+}
+declare namespace bws.packer {
+ /**
+ * Wrap represents an act wrap(ping).
+ *
+ * {@link Wrap} is a class represents an act wrapping an {@link Instance} to an {@link Wrapper}.
+ * To represent the relationship, Wrap uses Bridge and Capsular patterns to links and intermediates
+ * relationship between Wrapper and Instance.
+ *
+ * Wrap also helps packing optimization and 3d-visualization with its own members
+ * {@link orientation} and position variables {@link x}, {@link y} and {@link z}.
+ *
+ * @author Jeongho Nam
+ */
+ class Wrap extends samchon.protocol.Entity {
+ /**
+ * A wrapper wrapping the {@link instance}.
+ */
+ protected wrapper: Wrapper;
+ /**
+ * An instance wrapped into the {@link wrapper}.
+ */
+ protected instance: Instance;
+ /**
+ * Coordinate-X of the instance placement in the wrapper.
+ */
+ protected x: number;
+ /**
+ * Coordinate-Y of the instance placement in the wrapper.
+ */
+ protected y: number;
+ /**
+ * Coordinate-Z of the instance placement in the wrapper.
+ */
+ protected z: number;
+ /**
+ * Placement orientation of wrapped {@link instance}.
+ */
+ protected orientation: number;
+ /**
+ *
+ */
+ protected color: number;
+ /**
+ * Construct from a Wrapper.
+ *
+ * @param wrapper A wrapper who will contain an instance.
+ */
+ constructor(wrapper: Wrapper);
+ /**
+ * Construct from a Wrapper and Instance with its position and default orientation 1.
+ *
+ * @param wrapper A wrapper who contains the instance.
+ * @param instance An instance contained into the wrapper.
+ * @param x Coordinate-X of the {@link instance} placement in the {@link wrapper}.
+ * @param y Coordinate-Y of the {@link instance} placement in the {@link wrapper}.
+ * @param z Coordinate-Z of the {@link instance} placement in the {@link wrapper}.
+ */
+ constructor(wrapper: Wrapper, instance: Instance, x: number, y: number, z: number);
+ /**
+ * Construct from a Wrapper and Instance with its position and orientation.
+ *
+ * @param wrapper A wrapper who contains the instance.
+ * @param instance An instance contained into the wrapper.
+ * @param x Coordinate-X of the {@link instance} placement in the {@link wrapper}.
+ * @param y Coordinate-Y of the {@link instance} placement in the {@link wrapper}.
+ * @param z Coordinate-Z of the {@link instance} placement in the {@link wrapper}.
+ * @param orientation Placement orientation of wrapped {@link instance}.
+ */
+ constructor(wrapper: Wrapper, instance: Instance, x: number, y: number, z: number, orientation: number);
+ /**
+ * @inheritdoc
+ */
+ construct(xml: samchon.library.XML): void;
+ /**
+ * Factory method of wrapped Instance.
+ *
+ * @param type Type of contained Instance's type.
+ */
+ protected createInstance(type: string): Instance;
+ /**
+ * Set orientation.
+ *
+ * @param orientation Orientation code (1 to 6).
+ */
+ setOrientation(orientation: number): void;
+ /**
+ * Set position.
+ *
+ * @param x Coordinate-X of the instance placement in the wrapper.
+ * @param y Coordinate-Y of the instance placement in the wrapper.
+ * @param z Coordinate-Z of the instance placement in the wrapper.
+ */
+ setPosition(x: number, y: number, z: number): void;
+ /**
+ * @brief Estimate orientation by given size.
+ *
+ * @param width Width by placement.
+ * @param height Height by placement.
+ * @param length Length by placement.
+ */
+ estimateOrientation(width: number, height: number, length: number): void;
+ /**
+ * @brief Orientation change is occured in level of the packer.
+ *
+ * @details orientation Packer's new orientation.
+ */
+ changeWrapperOrientation(orientation: number): void;
+ /**
+ * Get wrapper.
+ */
+ getWrapper(): Wrapper;
+ /**
+ * Get instance.
+ */
+ getInstance(): Instance;
+ /**
+ * Get x.
+ */
+ getX(): number;
+ /**
+ * Get y.
+ */
+ getY(): number;
+ /**
+ * Get z.
+ */
+ getZ(): number;
+ /**
+ * Get orientation.
+ */
+ getOrientation(): number;
+ /**
+ * Get width.
+ */
+ getWidth(): number;
+ /**
+ * Get height.
+ */
+ getHeight(): number;
+ /**
+ * Get length.
+ */
+ getLength(): number;
+ /**
+ * Get volume.
+ */
+ getVolume(): number;
+ $instanceName: string;
+ $layoutScale: string;
+ $position: string;
+ /**
+ * @inheritdoc
+ */
+ TAG(): string;
+ /**
+ * @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;
+ }
+}
+declare namespace bws.packer {
+ /**
+ * A wrapper wrapping instances.
+ *
+ * @author Jeongho Nam
+ */
+ class Wrapper extends samchon.protocol.EntityDeque implements Instance {
+ /**
+ * Name, key of the Wrapper.
+ *
+ * The name represents a type of Wrapper and identifies the Wrapper.
+ */
+ protected name: string;
+ /**
+ * Price, cost of using an Wrapper.
+ */
+ protected price: number;
+ /**
+ * Width of the Wrapper, length on the X-axis in 3D.
+ */
+ protected width: number;
+ /**
+ * Height of the Wrapper, length on the Y-axis in 3D.
+ */
+ protected height: number;
+ /**
+ * Length of the Wrapper, length on the Z-axis in 3D.
+ */
+ protected length: number;
+ /**
+ * Thickness, margin of a Wrapper causes shrinkness of containable volume.
+ *
+ * The thickness reduces each dimension's containable size (dimension - 2*thickness),
+ * so finally, it reduces total containable volume (-8 * thickness^3).
+ */
+ protected thickness: number;
+ /**
+ * Default Constructor.
+ */
+ constructor();
+ /**
+ * Copy Constructor.
+ */
+ constructor(wrapper: Wrapper);
+ /**
+ * Construct from members.
+ *
+ * @param name Name, identifier of a Wrapper.
+ * @param price Price, issued cost for a type of the Wrapper.
+ * @param width Width, dimensional length on the X-axis in 3D.
+ * @param height Height, dimensional length on the Y-axis in 3D.
+ * @param length Length, dimensional length on the Z-axis in 3D.
+ * @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;
+ /**
+ * Key of a Wrapper is its name.
+ */
+ key(): any;
+ /**
+ * Get name.
+ */
+ getName(): string;
+ /**
+ * Get price.
+ */
+ getPrice(): number;
+ /**
+ * Get width, length on X-axis in 3D.
+ */
+ getWidth(): number;
+ /**
+ * Get height, length on Y-axis in 3D.
+ */
+ getHeight(): number;
+ /**
+ * Get length, length on Z-axis in 3D.
+ */
+ getLength(): number;
+ /**
+ * Get thickness.
+ */
+ getThickness(): number;
+ /**
+ * Get (calculate) containable width, length on the X-axis in 3D.
+ *
+ * Calculates containable width considering the {@link thickness}.
+ *
+ * @return width - (2 x thickness)
+ */
+ getContainableWidth(): number;
+ /**
+ * Get (calculate) containable height, length on the Y-axis in 3D.
+ *
+ * Calculates containable height considering the {@link thickness}.
+ *
+ * @return height - (2 x thickness)
+ */
+ getContainableHeight(): number;
+ /**
+ * Get (calculate) containable length, length on the Z-axis in 3D.
+ *
+ * Calculates containable length considering the {@link thickness}.
+ *
+ * @return length - (2 x thickness)
+ */
+ getContainableLength(): number;
+ /**
+ * Get (calculate) volume.
+ *
+ * Notice
+ * If {@link thickness} of the Wrapper is not 0, the volume does not mean containable volume.
+ * In that case, use {@link containableVolume} instead.
+ *
+ * @return width x height x length
+ */
+ getVolume(): number;
+ /**
+ * Get (calculate) containable volume.
+ *
+ * Calculates containable volume considering the {@link thickness}.
+ *
+ * @return volume - {(2 x thickness) ^ 3}
+ */
+ getContainableVolume(): number;
+ /**
+ * Get utilization ratio of containable volume.
+ *
+ * @return utilization ratio.
+ */
+ getUtilization(): number;
+ equal_to(obj: Wrapper): boolean;
+ /**
+ * Wrapper is enough greater?
+ *
+ * Test whether the Wrapper is enough greater than an Instance to contain.
+ *
+ * @param instance An Instance to test.
+ * @return Enough greater or not.
+ */
+ containable(instance: Instance): boolean;
+ /**
+ * @inheritdoc
+ */
+ setName(val: string): void;
+ /**
+ * Set price.
+ */
+ setPrice(val: number): void;
+ /**
+ * @inheritdoc
+ */
+ setWidth(val: number): void;
+ /**
+ * @inheritdoc
+ */
+ setHeight(val: number): void;
+ /**
+ * @inheritdoc
+ */
+ setLength(val: number): void;
+ /**
+ * Set thickness.
+ */
+ setThickness(val: number): void;
+ $name: string;
+ $price: string;
+ $width: string;
+ $height: string;
+ $length: string;
+ $thickness: string;
+ $scale: string;
+ $spaceUtilization: string;
+ /**
+ * @inheritdoc
+ */
+ TYPE(): string;
+ /**
+ * @inheritdoc
+ */
+ TAG(): string;
+ /**
+ * @inheritdoc
+ */
+ CHILD_TAG(): string;
+ /**
+ * @inheritdoc
+ */
+ toXML(): samchon.library.XML;
+ private static scene;
+ private static renderer;
+ private static camera;
+ private static trackball;
+ private static mouse;
+ private static BOUNDARY_THICKNESS;
+ /**
+ * Convert to a canvas containing 3D elements.
+ *
+ * @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();
+ }
+}
+declare namespace bws.packer {
+ /**
+ * A group of {@link Wrapper Wrappers} with same type.
+ *
+ * @author Jeongho Nam
+ */
+ class WrapperGroup extends WrapperArray {
+ /**
+ * A sample, standard of the WrapperGroup.
+ *
+ * The sample represents what type of Wrappers are grouped into the WrapperGroup.
+ */
+ protected sample: Wrapper;
+ /**
+ * Allocated instances.
+ */
+ protected allocatedInstanceArray: InstanceArray;
+ /**
+ * Default Constructor.
+ */
+ constructor();
+ /**
+ * Copy Constructor.
+ */
+ constructor(wrapperGroup: WrapperGroup);
+ /**
+ * Construct from a sample.
+ *
+ * @param sample A sample, standard of the WrapperGroup.
+ */
+ constructor(sample: Wrapper);
+ /**
+ * Construct from members of the {@link sample}.
+ *
+ * @param name Name, identifier of the sample.
+ * @param price Price, issued cost for a type of the sample.
+ * @param width Width, dimensional length on the X-axis in 3D, of the sample.
+ * @param height Height, dimensional length on the Y-axis in 3D, of the sample.
+ * @param length Length, dimensional length on the Z-axis in 3D, of the sample.
+ * @param thickness A thickness, causes shrinkness on containable volume, of the sample.
+ */
+ constructor(name: string, price: number, width: number, height: number, length: number, thickness: number);
+ /**
+ * Key of a WrapperGroup is dependent on its sample.
+ */
+ key(): any;
+ /**
+ * Get sample.
+ */
+ getSample(): Wrapper;
+ /**
+ * Get allocated instances.
+ */
+ getAllocatedInstanceArray(): InstanceArray;
+ /**
+ * Get (calculate) price.
+ *
+ * @return (Price of the sample) x (numbers of children Wrappers)
+ */
+ getPrice(): number;
+ /**
+ * @inheritdoc
+ */
+ getUtilization(): number;
+ /**
+ * Allocate instance(s) to the WrapperGroup.
+ *
+ * Inspect the instance is enough small to be wrapped into an empty wrapper. If the instance
+ * is enough small, registers the instance (or repeated instances) to the {@link reserveds} and
+ * returns true. If the instance is too large to be capsuled, returns false.
+ *
+ * Note
+ * The word the instance is enough small to be wrapped into the empty wrapper means
+ * the instance can be contained into an empty, a new wrapper contaning nothing literally.
+ *
+ * In the method allocate(), it doesn't consider how many instances are wrapped into ordinary
+ * wrapper and how much volumes are consumed.
+ *
+ * @param instance An Instance to allocate.
+ * @param n Repeating number of the instance.
+ *
+ * @return Whether the instance is enough small to be wrapped into a (new) wrapper
+ * of same type with the sample.
+ */
+ allocate(instance: Instance, n?: number): boolean;
+ /**
+ * Run optimization in level of the group.
+ *
+ * The optimization routine begins by creating a {@link Wrapper} like the {@link sample}. Then
+ * try to pack {@link allocatedInstanceArray allocated instances} to the {@link Wrapper} as a lot as
+ * possible. If there're some {@link Wrappers} can't be packed by overloading, then create a new
+ * {@link Wrapper} again and try to pack {@link allocatedInstanceArray instances} again, too.
+ *
+ * Repeats those steps until all {@link alloctedInstanceArray instances} are {@link Wrap packed}
+ * so that there's not any {@link Instance instance} left.
+ *
+ * Warning
+ * When call this {@link optimize optimize()} method, ordinary children {@link Wrapper} objects
+ * in the {@link WrapperGroup} will be substituted with the newly optimized {@link Wrapper} objects.
+ */
+ optimize(): void;
+ /**
+ * Wrap allocated instances into a new {@link Wrapper}.
+ *
+ * {@link Wrap Wraps} instances to a new Wrapper which is copied from the sample.
+ * After the wrapping is done, the new {@link Wrapper} is registered to the {@link WrapperGroup}
+ * as a child and instances failed to wrap by overloading is returned.
+ *
+ * @param instanceArray instances to {@link Wrap wrap} into a new {@link Wrapper}.
+ *
+ * @return Instances failed to {@link Wrap wrap} by overloading.
+ * @see boxologic
+ */
+ private pack(instanceArray);
+ /**
+ * @inheritdoc
+ */
+ TAG(): string;
+ }
+}
+declare namespace bws.packer {
+ abstract class Editor extends React.Component<{
+ dataProvider: samchon.protocol.EntityArrayCollection;
+ }, {}> {
+ 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 {
+ application: PackerApplication;
+ instances: InstanceFormArray;
+ wrappers: WrapperArray;
+ }
+ class ItemEditor extends React.Component {
+ private clear(event);
+ private open(event);
+ private save(event);
+ private pack(event);
+ render(): JSX.Element;
+ }
+ class InstanceEditor extends Editor {
+ protected createColumns(): AdazzleReactDataGrid.Column[];
+ }
+ class WrapperEditor extends Editor {
+ 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 {
+ 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 {
+ application: PackerApplication;
+ wrappers: WrapperArray;
+ }
+}
diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md
index 6140babecd..7ebdcc514f 100644
--- a/CONTRIBUTORS.md
+++ b/CONTRIBUTORS.md
@@ -695,7 +695,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
* [:link:](heap/heap.d.ts) [heap](https://github.com/qiao/heap.js) by [Ryan McNamara](https://github.com/ryan10132)
* [:link:](heatmap.js/heatmap.d.ts) [heatmap.js](https://github.com/pa7/heatmap.js) by [Yang Guan](https://github.com/lookuptable)
* [:link:](hellojs/hellojs.d.ts) [hello.js](http://adodson.com/hello.js) by [Pavel Zika](https://github.com/PavelPZ)
-* [:link:](helmet/helmet.d.ts) [helmet](https://github.com/helmetjs/helmet) by [Cyril Schumacher](https://github.com/cyrilschumacher)
+* [:link:](helmet/helmet.d.ts) [helmet](https://github.com/helmetjs/helmet) by [Cyril Schumacher](https://github.com/cyrilschumacher), [Evan Hahn](https://github.com/EvanHahn)
* [:link:](highcharts/highcharts.d.ts) [Highcharts](http://www.highcharts.com) by [Damiano Gambarotto](http://github.com/damianog), [Dan Lewi Harkestad](http://github.com/baltie)
* [:link:](highcharts-ng/highcharts-ng.d.ts) [highcharts-ng](https://github.com/pablojim/highcharts-ng) by [Scott Hatcher](https://github.com/scatcher)
* [:link:](highland/highland.d.ts) [Highland](http://highlandjs.org) by [Bart van der Schoor](https://github.com/Bartvds)
@@ -1123,10 +1123,11 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
* [:link:](moment/moment.d.ts) [Moment.js](https://github.com/timrwood/moment) by [Michael Lakerveld](https://github.com/Lakerfield), [Aaron King](https://github.com/kingdango), [Hiroki Horiuchi](https://github.com/horiuchi), [Dick van den Brink](https://github.com/DickvdBrink), [Adi Dahiya](https://github.com/adidahiya), [Matt Brooks](https://github.com/EnableSoftware)
* [:link:](moment-range/moment-range.d.ts) [Moment.js](https://github.com/gf3/moment-range) by [Bart van den Burg](https://github.com/Burgov), [Wilgert Velinga](https://github.com/wilgert)
* [:link:](mongodb/mongodb.d.ts) [MongoDB](https://github.com/mongodb/node-mongodb-native/tree/2.1) by [Federico Caselli](https://github.com/CaselIT)
-* [:link:](mongoose/mongoose.d.ts) [Mongoose](http://mongoosejs.com) by [horiuchi](https://github.com/horiuchi)
+* [:link:](mongoose/mongoose.d.ts) [Mongoose](http://mongoosejs.com) by [simonxca](https://github.com/simonxca), [horiuchi](https://github.com/horiuchi)
* [:link:](mongoose-auto-increment/mongoose-auto-increment.d.ts) [mongoose-auto-increment](https://github.com/codetunnel/mongoose-auto-increment) by [Aya Morisawa](https://github.com/AyaMorisawa)
* [:link:](mongoose-deep-populate/mongoose-deep-populate.d.ts) [mongoose-deep-populate](https://github.com/buunguyen/mongoose-deep-populate) by [Aya Morisawa](https://github.com/AyaMorisawa)
* [:link:](mongoose-mock/mongoose-mock.d.ts) [mongoose-mock](https://github.com/JohanObrink/mongoose-mock) by [jt000](https://github.com/jt000)
+* [:link:](mongoose-promise/mongoose-promise.d.ts) [mongoose-promise](http://mongoosejs.com/docs/api.html#promise-js) by [simonxca](https://github.com/simonxca)
* [:link:](morgan/morgan.d.ts) [morgan](https://github.com/expressjs/morgan) by [James Roland Cabresos](https://github.com/staticfunction)
* [:link:](mousetrap/mousetrap-global-bind.d.ts) [Mousetrap 1.4.6's global-bind extension](http://craig.is/killing/mice#extensions.global) by [Andrew Bradley](https://github.com/cspotcode)
* [:link:](mousetrap/mousetrap.d.ts) [Mousetrap 1.5.x](http://craig.is/killing/mice) by [Dániel Tar](https://github.com/qcz)
diff --git a/CybozuLabs-md5/CybozuLabs-md5-tests.ts b/CybozuLabs-md5/CybozuLabs-md5-tests.ts
new file mode 100644
index 0000000000..16dd05b059
--- /dev/null
+++ b/CybozuLabs-md5/CybozuLabs-md5-tests.ts
@@ -0,0 +1,9 @@
+///
+
+var hash: string;
+hash = CybozuLabs.MD5.calc("abc");
+hash = CybozuLabs.MD5.calc("abc", CybozuLabs.MD5.BY_ASCII);
+hash = CybozuLabs.MD5.calc("abc", CybozuLabs.MD5.BY_UTF16);
+
+var version: string;
+version = CybozuLabs.MD5.VERSION;
\ No newline at end of file
diff --git a/CybozuLabs-md5/CybozuLabs-md5.d.ts b/CybozuLabs-md5/CybozuLabs-md5.d.ts
new file mode 100644
index 0000000000..6e1f31739d
--- /dev/null
+++ b/CybozuLabs-md5/CybozuLabs-md5.d.ts
@@ -0,0 +1,11 @@
+// Type definitions for CybozuLabs.MD5
+// Project: http://labs.cybozu.co.jp/blog/mitsunari/2007/07/md5js_1.html
+// Definitions by: MIZUNE Pine
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+declare namespace CybozuLabs.MD5 {
+ var VERSION: string;
+ var BY_ASCII: number;
+ var BY_UTF16: number;
+ function calc(str: string, option?: number): string;
+}
diff --git a/FileSaver/FileSaver-tests.ts b/FileSaver/FileSaver-tests.ts
index 4cfae373e3..bf05141aaf 100644
--- a/FileSaver/FileSaver-tests.ts
+++ b/FileSaver/FileSaver-tests.ts
@@ -1,5 +1,14 @@
///
+import {saveAs as importedSaveAs} from "file-saver";
+function testImportedSaveAs() {
+ var data: Blob = new Blob(["Hello, world!"], {type: "text/plain;charset=utf-8"});
+ var filename: string = 'hello world.txt';
+ var disableAutoBOM = true;
+
+ importedSaveAs(data, filename, disableAutoBOM);
+}
+
/**
* @summary Test for "saveAs" function.
*/
diff --git a/FileSaver/FileSaver.d.ts b/FileSaver/FileSaver.d.ts
index 6919fa385f..534ce4fe1c 100644
--- a/FileSaver/FileSaver.d.ts
+++ b/FileSaver/FileSaver.d.ts
@@ -15,7 +15,7 @@ interface FileSaver {
* @type {Blob}
*/
data: Blob,
-
+
/**
* @summary File name.
* @type {DOMString}
@@ -31,3 +31,8 @@ interface FileSaver {
}
declare var saveAs: FileSaver;
+
+declare module "file-saver" {
+ var fileSaver: { saveAs: typeof saveAs };
+ export = fileSaver
+}
diff --git a/README.md b/README.md
index 5c218aaa19..b188982fbf 100644
--- a/README.md
+++ b/README.md
@@ -24,7 +24,7 @@ Please see the [contribution guide](http://definitelytyped.org/guides/contributi
* Directly from the GitHub repos
* [NuGet packages](http://nuget.org/packages?q=DefinitelyTyped)
-* [TypeScript Definition manager](https://github.com/DefinitelyTyped/tsd)
+* [Typings - TypeScript Definition Manager](https://github.com/typings/typings)
## List of definitions
@@ -32,7 +32,7 @@ Please see the [contribution guide](http://definitelytyped.org/guides/contributi
## Requested definitions
-Here is are the [currently requested definitions](https://github.com/DefinitelyTyped/DefinitelyTyped/labels/Definition%3ARequest).
+Here are the [currently requested definitions](https://github.com/DefinitelyTyped/DefinitelyTyped/labels/Definition%3ARequest).
## License
diff --git a/ace/ace.d.ts b/ace/ace.d.ts
index 4a137075b0..1ac19c7c63 100644
--- a/ace/ace.d.ts
+++ b/ace/ace.d.ts
@@ -77,9 +77,6 @@ declare namespace AceAjax {
onTextInput(text: any): void;
}
- var KeyBinding: {
- new(editor: Editor): KeyBinding;
- }
export interface TextMode {
@@ -1037,6 +1034,8 @@ declare namespace AceAjax {
**/
export interface Editor {
+ on(ev: string, callback: (e: any) => any): void;
+
addEventListener(ev: 'change', callback: (ev: EditorChangeEvent) => any): void;
addEventListener(ev: string, callback: Function): void;
diff --git a/ace/tests/ace-default-tests.ts b/ace/tests/ace-default-tests.ts
index f8a280c1a2..798550dec9 100644
--- a/ace/tests/ace-default-tests.ts
+++ b/ace/tests/ace-default-tests.ts
@@ -5,6 +5,9 @@ var editor = ace.edit("editor");
editor.setTheme("ace/theme/monokai");
editor.getSession().setMode("ace/mode/javascript");
+editor.on("blur", (e) => e);
+editor.on("change", (e) => e);
+
editor.setTheme("ace/theme/twilight");
editor.getSession().setMode("ace/mode/javascript");
diff --git a/adal-angular/adal-tests.ts b/adal-angular/adal-tests.ts
index 598134d0a0..db984d95ba 100644
--- a/adal-angular/adal-tests.ts
+++ b/adal-angular/adal-tests.ts
@@ -12,4 +12,14 @@ var config : adal.Config = {
var auth = new AuthenticationContext(config);
-var userName: string = auth.getCachedUser().userName;
\ No newline at end of file
+Logging.log = (message: string) => {
+ console.log(message);
+}
+
+Logging.level = 4;
+
+auth.info("Logging message");
+
+var userName: string = auth.getCachedUser().userName;
+var postLogoutRedirectUrl = auth.config.postLogoutRedirectUri;
+var isValidRequest = auth.getRequestInfo('hash').valid;
\ No newline at end of file
diff --git a/adal-angular/adal.d.ts b/adal-angular/adal.d.ts
index c5a64efd0b..a896d687ec 100644
--- a/adal-angular/adal.d.ts
+++ b/adal-angular/adal.d.ts
@@ -4,37 +4,51 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare var AuthenticationContext: adal.AuthenticationContextStatic;
+declare var Logging: adal.Logging;
declare module 'adal' {
- export = AuthenticationContext;
+ export = { AuthenticationContext, Logging };
}
declare namespace adal {
interface Config {
- tenant?: string,
- clientId: string,
- redirectUri?: string,
- cacheLocation?: string,
- displayCall?: (urlNavigate: string) => any,
- correlationId?: string,
- loginResource?: string,
- resource?: string
- endpoints?: any // If you need to send CORS api requests.
- extraQueryParameter?: string
+ tenant?: string;
+ clientId: string;
+ redirectUri?: string;
+ cacheLocation?: string;
+ displayCall?: (urlNavigate: string) => any;
+ correlationId?: string;
+ loginResource?: string;
+ resource?: string;
+ endpoints?: any; // If you need to send CORS api requests.
+ extraQueryParameter?: string;
+ postLogoutRedirectUri?: string; // redirect url after succesful logout operation
}
interface User {
- userName: string,
- profile: any
+ userName: string;
+ profile: any;
}
interface RequestInfo {
- valid: boolean,
- parameters: any,
- stateMatch: boolean,
- stateResponse: string,
- requestType: string
+ valid: boolean;
+ parameters: any;
+ stateMatch: boolean;
+ stateResponse: string;
+ requestType: string;
+ }
+
+ interface Logging {
+ log: (message: string) => void;
+ level: LoggingLevel;
+ }
+
+ enum LoggingLevel {
+ ERROR = 0,
+ WARNING = 1,
+ INFO = 2,
+ VERBOSE = 3
}
interface AuthenticationContextStatic {
@@ -51,6 +65,10 @@ declare namespace adal {
* Saves the resulting Idtoken in localStorage.
*/
login(): void;
+
+ /**
+ * Indicates whether login is in progress now or not.
+ */
loginInProgress(): boolean;
/**
@@ -118,9 +136,9 @@ declare namespace adal {
/**
* Gets requestInfo from given hash.
- * @returns {string} error message related to login
+ * @returns {RequestInfo} for appropriate hash.
*/
- getRequestInfo(hash: string): string;
+ getRequestInfo(hash: string): RequestInfo;
/**
* Saves token from hash that is received from redirect.
@@ -134,6 +152,11 @@ declare namespace adal {
*/
getResourceForEndpoint(endpoint: string): string;
+ /**
+ * Handles redirection after login operation.
+ * Gets access token from url and saves token to the (local/session) storage
+ * or saves error in case unsuccessful login.
+ */
handleWindowCallback(): void;
log(level: number, message: string, error: any): void;
diff --git a/ajv/ajv-tests.ts b/ajv/ajv-tests.ts
new file mode 100644
index 0000000000..e6413fd824
--- /dev/null
+++ b/ajv/ajv-tests.ts
@@ -0,0 +1,74 @@
+///
+
+import * as Ajv from 'ajv';
+var ajv = new Ajv(); // options can be passed, e.g. {allErrors: true}
+var validate = ajv.compile({});
+var valid = validate({});
+if (!valid) console.log(validate.errors);
+
+var valid = ajv.validate({}, {});
+if (!valid) console.log(ajv.errors);
+
+ajv.addSchema({}, 'mySchema');
+var valid = ajv.validate('mySchema', {});
+if (!valid) console.log(ajv.errorsText());
+
+ajv.addKeyword('range', {
+ type: 'number', compile: function (sch, parentSchema) {
+ var min: any = sch[0];
+ var max: any = sch[1];
+
+ return parentSchema.exclusiveRange === true
+ ? function (data) { return data > min && data < max; }
+ : function (data) { return data >= min && data <= max; }
+ }
+});
+
+var schema = { "range": [2, 4], "exclusiveRange": true };
+var validate = ajv.compile(schema);
+console.log(validate(2.01)); // true
+console.log(validate(3.99)); // true
+console.log(validate(2)); // false
+console.log(validate(4)); // false
+
+declare var request: any;
+function loadSchema(uri: any, callback: any) {
+ request.json(uri, function (err: any, res: any, body: any) {
+ if (err || res.statusCode >= 400)
+ callback(err || new Error('Loading error: ' + res.statusCode));
+ else
+ callback(null, body);
+ });
+}
+var ajv = new Ajv({ loadSchema: loadSchema });
+
+ajv.compileAsync(schema, function (err, validate) {
+ if (err) return;
+ var valid = validate({});
+});
+
+declare var knex: any;
+function checkIdExists(schema: any, data: any) {
+ return knex(schema.table)
+ .select('id')
+ .where('id', data)
+ .then(function (rows: any) {
+ return true;
+ });
+}
+
+var validate = ajv.compile(schema);
+
+(validate({ userId: 1, postId: 19 }) as PromiseLike)
+ .then(function (valid) {
+ // "valid" is always true here
+ console.log('Data is valid');
+ }, function (err) {
+ if (!(err instanceof Ajv.ValidationError)) throw err;
+ // data is invalid
+ console.log('Validation errors:', err.errors);
+ });
+
+var ajv = new Ajv({ /* async: 'es7', */ transpile: 'nodent' });
+var validate = ajv.compile(schema); // transpiled es7 async function
+(validate({}) as PromiseLike).then(() => { }, () => { });
diff --git a/ajv/ajv.d.ts b/ajv/ajv.d.ts
new file mode 100644
index 0000000000..d8bfd56ef3
--- /dev/null
+++ b/ajv/ajv.d.ts
@@ -0,0 +1,112 @@
+// Type definitions for ajv
+// Project: https://github.com/epoberezkin/ajv
+// Definitions by: York Yao
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+declare module "ajv" {
+ class Ajv {
+ /**
+ * Create Ajv instance.
+ */
+ constructor(options?: Ajv.AjvOptions);
+ /**
+ * Generate validating function and cache the compiled schema for future use.
+ */
+ compile(schema: any): Ajv.AjvValidate;
+ /**
+ * Asyncronous version of compile method that loads missing remote schemas using asynchronous function in options.loadSchema.
+ */
+ compileAsync(schema: any, callback: (error: Error, validate: Ajv.AjvValidate) => void): void;
+ /**
+ * Validate data using passed schema (it will be compiled and cached).
+ */
+ validate(schema: any, data: any): boolean | PromiseLike;
+ errors: Ajv.ValidationError[];
+ /**
+ * Add schema(s) to validator instance.
+ */
+ addSchema(schema: any, key: string): void;
+ /**
+ * Adds meta schema(s) that can be used to validate other schemas.
+ * That function should be used instead of addSchema because there may be instance options that would compile a meta schema incorrectly (at the moment it is removeAdditional option).
+ */
+ addMetaSchema(schema: any, key: string): void;
+ /**
+ * Validates schema.
+ * This method should be used to validate schemas rather than validate due to the inconsistency of uri format in JSON-Schema standard.
+ */
+ validateSchema(schema: any): Boolean;
+ /**
+ * Retrieve compiled schema previously added with addSchema by the key passed to addSchema or by its full reference (id).
+ * Returned validating function has schema property with the reference to the original schema.
+ */
+ getSchema(key: string): Ajv.AjvValidate;
+ /**
+ * Remove added/cached schema.
+ * Even if schema is referenced by other schemas it can be safely removed as dependent schemas have local references.
+ */
+ removeSchema(schema: any): void;
+ /**
+ * Add custom format to validate strings. It can also be used to replace pre-defined formats for Ajv instance.
+ */
+ addFormat(name: string, format: any): void;
+ /**
+ * Add custom validation keyword to Ajv instance.
+ */
+ addKeyword(keyword: string, definition: Ajv.AjxKeywordDefinition): void;
+ errorsText(): any;
+ static ValidationError: Function;
+ }
+ namespace Ajv {
+ type AjvOptions = {
+ v5?: boolean;
+ allErrors?: boolean;
+ verbose?: boolean;
+ jsonPointers?: boolean;
+ uniqueItems?: boolean;
+ unicode?: boolean;
+ format?: string;
+ formats?: any;
+ schemas?: any;
+ missingRefs?: boolean;
+ loadSchema?(uri: string, callback: (error: Error, body: any) => void): void;
+ removeAdditional?: boolean;
+ useDefaults?: boolean;
+ coerceTypes?: boolean;
+ async?: any;
+ transpile?: string;
+ meta?: boolean;
+ validateSchema?: boolean;
+ addUsedSchema?: boolean;
+ inlineRefs?: boolean;
+ passContext?: boolean;
+ loopRequired?: number;
+ ownProperties?: boolean;
+ multipleOfPrecision?: boolean;
+ errorDataPath?: string,
+ messages?: boolean;
+ beautify?: boolean;
+ cache?: any;
+ }
+ type AjvValidate = ((data: any) => boolean | PromiseLike) & {
+ errors: ValidationError[];
+ }
+ type AjxKeywordDefinition = {
+ async?: boolean;
+ type: string;
+ compile?: (schema: any, parentsSchema: any) => ((data: any) => boolean | PromiseLike);
+ validate?: (schema: any, data: any) => boolean;
+ }
+ type ValidationError = {
+ keyword: string;
+ dataPath: string;
+ schemaPath: string;
+ params: any;
+ message: string;
+ schema: any;
+ parentSchema: any;
+ data: any;
+ }
+ }
+ export = Ajv;
+}
diff --git a/alexa-sdk/alexa-sdk-tests.ts b/alexa-sdk/alexa-sdk-tests.ts
new file mode 100644
index 0000000000..e161c5bf38
--- /dev/null
+++ b/alexa-sdk/alexa-sdk-tests.ts
@@ -0,0 +1,25 @@
+///
+///
+
+import * as Alexa from "alexa-sdk";
+
+exports.handler = function(event: Alexa.RequestBody, context: Alexa.Context, callback: Function) {
+ let alexa = Alexa.handler(event, context);
+ alexa.registerHandlers(handlers);
+ alexa.execute();
+};
+
+let handlers: Alexa.Handlers = {
+ 'LaunchRequest': function () {
+ var self: Alexa.Handler = this;
+ self.emit('SayHello');
+ },
+ 'HelloWorldIntent': function () {
+ var self: Alexa.Handler = this;
+ self.emit('SayHello');
+ },
+ 'SayHello': function () {
+ var self: Alexa.Handler = this;
+ self.emit(':tell', 'Hello World!');
+ }
+};
diff --git a/alexa-sdk/alexa-sdk.d.ts b/alexa-sdk/alexa-sdk.d.ts
new file mode 100644
index 0000000000..5866d8c4ee
--- /dev/null
+++ b/alexa-sdk/alexa-sdk.d.ts
@@ -0,0 +1,132 @@
+// Type definitions for Alexa SDK for Node.js v1.0.3
+// Project: https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs
+// Definitions by: Pete Beegle
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+declare module 'alexa-sdk' {
+ export function handler(event: RequestBody, context: Context, callback?: Function): AlexaObject;
+ export function CreateStateHandler(state: string, obj: any): any;
+ export var StateString: string;
+
+ interface AlexaObject {
+ _event: any;
+ _context: any;
+ _callback: any;
+ state: any;
+ appId: any;
+ response: any;
+ dynamoDBTableName: any;
+ saveBeforeResponse: boolean;
+ registerHandlers: (...handlers: Handlers[]) => any;
+ execute: () => void;
+ }
+
+ interface Handlers {
+ [intent: string]: () => void;
+ }
+
+ interface Handler {
+ on: any;
+ emit(event: string, ...args: any[]): boolean;
+ emitWithState: any;
+ state: any;
+ handler: any;
+ event: RequestBody;
+ attributes: any;
+ context: any;
+ name: any;
+ isOverriden: any;
+ }
+
+ interface Context {
+ callbackWaitsForEmptyEventLoop: boolean;
+ logGroupName: string;
+ logStreamName: string;
+ functionName: string;
+ memoryLimitInMB: string;
+ functionVersion: string;
+ invokeid: string;
+ awsRequestId: string;
+ }
+
+ interface RequestBody {
+ version: string;
+ session: Session;
+ request: LaunchRequest | IntentRequest | SessionEndedRequest;
+ }
+
+ interface Session {
+ new: boolean;
+ sessionId: string;
+ attributes: any;
+ application: SessionApplication;
+ user: SessionUser;
+ }
+
+ interface SessionApplication {
+ applicationId: string;
+ }
+
+ interface SessionUser {
+ userId: string;
+ accessToken: string;
+ }
+
+ interface LaunchRequest extends IRequest {}
+
+ interface IntentRequest extends IRequest {
+ intent: Intent;
+ }
+
+ interface Intent {
+ name: string;
+ slots: any;
+ }
+
+ interface SessionEndedRequest extends IRequest{
+ reason: string;
+ }
+
+ interface IRequest {
+ type: "LaunchRequest" | "IntentRequest" | "SessionEndedRequest";
+ requestId: string;
+ timeStamp: string;
+ }
+
+ interface ResponseBody {
+ version: string;
+ sessionAttributes?: any;
+ response: Response;
+ }
+
+ interface Response {
+ outputSpeech?: OutputSpeech;
+ card?: Card;
+ reprompt?: Reprompt;
+ shouldEndSession: boolean;
+ }
+
+ interface OutputSpeech {
+ type: "PlainText" | "SSML";
+ text?: string;
+ ssml?: string;
+ }
+
+ interface Card {
+ type: "Simple" | "Standard" | "LinkAccount";
+ title?: string;
+ content?: string;
+ text?: string;
+ image?: Image;
+ }
+
+ interface Image {
+ smallImageUrl: string;
+ largeImageUrl: string;
+ }
+
+ interface Reprompt {
+ outputSpeech: OutputSpeech;
+ }
+}
+
diff --git a/alt/alt.d.ts b/alt/alt.d.ts
index 20da159f35..575d476451 100644
--- a/alt/alt.d.ts
+++ b/alt/alt.d.ts
@@ -53,8 +53,8 @@ declare namespace AltJS {
export type Source = {[name:string]: () => SourceModel};
export interface SourceModel {
- local(state:any):any;
- remote(state:any):Promise;
+ local(state:any, ...args: any[]):any;
+ remote(state:any, ...args: any[]):Promise;
shouldFetch?(fetchFn:(...args:Array) => boolean):void;
loading?:(args:any) => void;
success?:(state:S) => void;
diff --git a/amcharts/AmCharts.d.ts b/amcharts/AmCharts.d.ts
index a54ed5d515..27998956b8 100644
--- a/amcharts/AmCharts.d.ts
+++ b/amcharts/AmCharts.d.ts
@@ -26,6 +26,19 @@ declare namespace AmCharts {
/** Clears all the charts on page, removes listeners and intervals. */
function clear();
+
+ /** Create chart by params. */
+ function makeChart(selector: string, params: any, delay?: number): AmChart;
+
+ /** Set a method to be called before initializing the chart.
+ * When the method is called, the chart instance is passed as an attribute.
+ * You can use this feature to preprocess chart data or do some other things you need
+ * before initializing the chart.
+ * @param {Function} handler - The method to be called.
+ * @param {string[]} types - Which chart types should call this method. Defaults to all
+ * if none is passed.
+ */
+ function addInitHandler(handler: Function, types: string[]);
/** AmPieChart class creates pie/donut chart. In order to display pie chart you need to set at least three properties - dataProvider, titleField and valueField.
@example
@@ -36,7 +49,7 @@ declare namespace AmCharts {
chart.dataProvider = chartData;
chart.write("chartdiv");
*/
- class AmPieChart {
+ class AmPieChart extends AmChart {
/** Name of the field in chart's dataProvider which holds slice's alpha. */
alphaField: string;
/** Pie lean angle (for 3D effect). Valid range is 0 - 90. */
@@ -187,19 +200,6 @@ declare namespace AmCharts {
rollOverSlice(index: number);
/** Shows slice. index - the number of a slice or Slice object. */
showSlice(index: number);
-
- /** Adds event listener of the type "clickSlice" or "pullInSlice" or "pullOutSlice" to the object.
- @param type Always "clickSlice" or "pullInSlice" or "pullOutSlice".
- @param handler
- If the type is "clickSlice", dispatched when user clicks on a slice.
- If the type is "pullInSlice", dispatched when user clicks on a slice and the slice is pulled-in.
- If the type is "pullOutSlice", dispatched when user clicks on a slice and the slice is pulled-out.
- If the type is "rollOutSlice", dispatched when user rolls-out of the slice.
- If the type is "rollOverSlice", dispatched when user rolls-over the slice.
- */
- addListener(type: string, handler: (e: {/** Always "rollOverSlice". */
- type: string; dataItem: Slice;
- }) => void );
}
/** AmRadarChart is the class you have to use for radar and polar chart types.
@@ -1016,7 +1016,7 @@ If you do not set properties such as dashLength, lineAlpha, lineColor, etc - val
bold - specifies if text is bold (true/false),
url - url
*/
- addLabel(x: number, y: number, text: string, align: string, size: number, color: string, rotation: number, alpha: number, bold: boolean, url: string);
+ addLabel(x: number|string, y: number|string, text: string, align: string, size?: number, color?: string, rotation?: number, alpha?: number, bold?: boolean, url?: string);
/** Adds a legend to the chart.
By default, you don't need to create div for your legend, however if you want it to be positioned in some different way, you can create div anywhere you want and pass id or reference to your div as a second parameter.
(NOTE: This method will not work on StockPanel.)
diff --git a/angular-deferred-bootstrap/angular-deferred-bootstrap-tests.ts b/angular-deferred-bootstrap/angular-deferred-bootstrap-tests.ts
new file mode 100644
index 0000000000..d8a07444d1
--- /dev/null
+++ b/angular-deferred-bootstrap/angular-deferred-bootstrap-tests.ts
@@ -0,0 +1,11 @@
+///
+///
+
+deferredBootstrapper.bootstrap(
+ {
+ element: window.document,
+ module: "myApp",
+ resolve: {
+ configuration: ["$http", ($http: ng.IHttpService) => $http.get("config.json")]
+ }
+ });
diff --git a/angular-deferred-bootstrap/angular-deferred-bootstrap.d.ts b/angular-deferred-bootstrap/angular-deferred-bootstrap.d.ts
new file mode 100644
index 0000000000..a76226761c
--- /dev/null
+++ b/angular-deferred-bootstrap/angular-deferred-bootstrap.d.ts
@@ -0,0 +1,20 @@
+// Type definitions for angular-deferred-bootstrap v0.1.9
+// Project: https://github.com/philippd/angular-deferred-bootstrap
+// Definitions by: Markus Wagner
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+///
+
+declare var deferredBootstrapper: angular.IDeferredBootstrapperStatic;
+
+declare module angular {
+ interface IDeferredBootstrapperStatic {
+ bootstrap(configParam: IConfigParam): ng.IPromise
+ }
+
+ interface IConfigParam {
+ element?: Node,
+ module?: string,
+ resolve: any
+ }
+}
\ No newline at end of file
diff --git a/angular-environment/angular-environment.d.ts b/angular-environment/angular-environment.d.ts
index 483474410c..94972d1383 100644
--- a/angular-environment/angular-environment.d.ts
+++ b/angular-environment/angular-environment.d.ts
@@ -14,6 +14,11 @@ declare namespace angular.environment {
* loads the correct environment variables.
*/
check: () => void;
+ /**
+ * Retrieves the correct version of a
+ * variable for the current environment.
+ */
+ read: (key: string) => any;
}
interface Service {
/**
diff --git a/angular-es/angular-es-tests.ts b/angular-es/angular-es-tests.ts
new file mode 100644
index 0000000000..2e44d5d0a8
--- /dev/null
+++ b/angular-es/angular-es-tests.ts
@@ -0,0 +1,157 @@
+///
+
+//
+// @Component
+//
+import { Component } from 'angular-es';
+@Component({
+ selector: '',
+ template: ''
+})
+class MyComponentController {
+
+}
+
+//
+// @Config
+//
+import { Config } from 'angular-es';
+
+@Config()
+class MyConfig {
+
+}
+
+//
+// @Constant
+//
+import { Constant } from 'angular-es';
+
+@Constant('MyConstant')
+class MyConstant {
+ foo = 'foo';
+ bar = 'bar';
+}
+
+//
+// @Controller
+//
+import { Controller } from 'angular-es';
+
+@Controller('MyController')
+class MyController {
+
+}
+
+//
+// @Decorator
+//
+import { Decorator } from 'angular-es';
+
+@Decorator('MyServiceDecorator')
+class MyServiceDecorator {
+
+}
+
+//
+// @Directive
+//
+import { Directive } from 'angular-es';
+
+@Directive('MyDirective')
+class MyDirective {
+
+}
+
+//
+// @Factory
+//
+import { Factory } from 'angular-es';
+
+@Factory('MyFactory')
+class MyFactory {
+}
+
+//
+// @Filter
+//
+import { Filter } from 'angular-es';
+
+@Filter('MyFilter')
+class MyFilter {
+}
+
+//
+// @Inject
+//
+import { Inject } from 'angular-es';
+
+@Inject('fooBar')
+class MyFooService {
+
+ @Inject('bazBar')
+ myMethod(bazBar: Object) {
+ }
+
+ constructor(fooBar: Object) {
+ }
+}
+
+//
+// @InjectAsProperty
+//
+import { InjectAsProperty } from 'angular-es';
+
+@InjectAsProperty('fooBar')
+class MyFooBarService {
+ fooBar: Object;
+
+ myMethod() {
+ this.fooBar !== undefined;
+ }
+}
+
+//
+// @Module
+//
+import { Module } from 'angular-es';
+
+@Module('my.module')
+@Service('MyModuleService')
+class MyModuleService {
+}
+
+//
+// @Provider
+//
+import { Provider } from 'angular-es';
+
+@Provider('MyProvider')
+class MyProvider {
+}
+
+//
+// @Run
+//
+import { Run } from 'angular-es';
+
+@Run()
+class MyRunBlock {
+}
+
+//
+// @Service
+//
+import { Service } from 'angular-es';
+
+@Service('MyService')
+class MyService {
+}
+//
+// @Value
+//
+import { Value } from 'angular-es';
+
+@Value('MyValue')
+class MyValue {
+}
diff --git a/angular-es/angular-es.d.ts b/angular-es/angular-es.d.ts
new file mode 100644
index 0000000000..10979ae15c
--- /dev/null
+++ b/angular-es/angular-es.d.ts
@@ -0,0 +1,187 @@
+// Type definitions for angular-es v0.0.3
+// Project: https://github.com/mbutsykin/angular-es
+// Definitions by: mbutsykin
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+declare module 'angular-es' {
+
+ interface ClassDecorator {
+ (target: TFunction): TFunction|void;
+ }
+
+ interface MethodDecorator {
+ (target: Object, propertyKey: string|symbol, descriptor: TypedPropertyDescriptor): TypedPropertyDescriptor|void;
+ }
+
+ /**
+ * Decorated target
+ */
+ interface ngESDecorator extends ClassDecorator, MethodDecorator {
+ (target: Object|Function,
+ ngName?: string,
+ ngArguments?: Array,
+ ngType?: string,
+ injectAsProperty?: Array): void;
+ }
+
+ /**
+ * Component interface
+ * @see https://docs.angularjs.org/guide/component
+ */
+ interface iComponent {
+ template: string,
+ selector: string,
+ controllerAs?: string,
+ require?: string,
+ templateUrl?: string,
+ transclude?: string,
+ bindings?: Object
+ }
+
+ /**
+ * Register component
+ *
+ * @param {Object} component - component config
+ *
+ * @returns {ngESDecorator} - decorated class
+ */
+ var Component: (component: iComponent) => ngESDecorator;
+
+ /**
+ * Register config block
+ */
+ var Config: () => ngESDecorator;
+
+ /**
+ * Register constant
+ *
+ * @param {string} name - constant name
+ *
+ * @returns {ngESDecorator} - decorated class
+ */
+ var Constant: (name: string) => ngESDecorator;
+
+ /**
+ * Register controller
+ *
+ * @param {string} name - controller name
+ *
+ * @returns {ngESDecorator} - decorated class
+ */
+ var Controller: (name: string) => ngESDecorator;
+
+ /**
+ * Register decorator
+ *
+ * @param {string} name - provider name to decorate
+ *
+ * @returns {ngESDecorator} - decorated class
+ */
+ var Decorator: (name: string) => ngESDecorator;
+
+ /**
+ * Register directive
+ *
+ * @param {string} name - directive selector, can be in hyphen-case
+ *
+ * @returns {ngESDecorator} - decorated class
+ */
+ var Directive: (name: string) => ngESDecorator;
+
+ /**
+ * Register factory
+ *
+ * @param {string} name - factory name
+ *
+ * @returns {ngESDecorator} - decorated class
+ */
+ var Factory: (name: string) => ngESDecorator;
+
+ /**
+ * Register filter
+ *
+ * @param {string} name - filter name
+ *
+ * @returns {ngESDecorator} - decorated class
+ */
+ var Filter: (name: string) => ngESDecorator;
+
+ /**
+ * Add $inject property to target
+ *
+ * @param {Array} dependencies - dependencies to inject
+ *
+ * @returns {ngESDecorator} - decorated class
+ */
+ var Inject: (...dependencies: Array) => ngESDecorator;
+
+ /**
+ * Inject dependencies as properties to target
+ *
+ * @param {Array} dependencies - dependencies to inject
+ *
+ * @returns {ngESDecorator} - decorated class
+ */
+ var InjectAsProperty: (...dependencies: Array) => ngESDecorator;
+
+ /**
+ * Attach target to the specified module
+ *
+ * @param {string} name - module name
+ *
+ * @returns {ngESDecorator} - decorated class
+ */
+ var Module: (name: string) => ngESDecorator;
+
+ /**
+ * Register provider
+ *
+ * @param {string} name - provider name
+ *
+ * @returns {ngESDecorator} - decorated class
+ */
+ var Provider: (name: string) => ngESDecorator;
+
+ /**
+ * Register run block
+ *
+ * @returns {ngESDecorator} - decorated class
+ */
+ var Run: () => ngESDecorator;
+
+ /**
+ * Register service
+ *
+ * @param {string} name - service name
+ *
+ * @returns {ngESDecorator} - decorated class
+ */
+ var Service: (name: string) => ngESDecorator;
+
+ /**
+ * Register value
+ *
+ * @param {string} name - value name
+ *
+ * @returns {ngESDecorator} - decorated class
+ */
+ var Value: (name: string) => ngESDecorator;
+
+ export {
+ Component,
+ Config,
+ Constant,
+ Controller,
+ Decorator,
+ Directive,
+ Factory,
+ Filter,
+ Inject,
+ InjectAsProperty,
+ Module,
+ Provider,
+ Run,
+ Service,
+ Value,
+ }
+}
diff --git a/angular-local-storage/angular-local-storage.d.ts b/angular-local-storage/angular-local-storage.d.ts
index b2bcf377d2..7efc681491 100644
--- a/angular-local-storage/angular-local-storage.d.ts
+++ b/angular-local-storage/angular-local-storage.d.ts
@@ -56,6 +56,15 @@ declare namespace angular.local.storage {
* @param val
*/
set(key:string, val:string):boolean;
+ /**
+ * Directly adds a value to cookies with an expiration.
+ * Note: Typically used as a fallback if local storage is not supported.
+ * Returns: Boolean
+ * @param key
+ * @param val
+ * @param daysToExpiry
+ */
+ set(key:string, val:string, daysToExpiry:number):boolean;
/**
* Directly get a value from a cookie.
* Returns: value from local storage
diff --git a/angular-material/angular-material-tests.ts b/angular-material/angular-material-tests.ts
index 3c70dd27e8..4464c599e3 100644
--- a/angular-material/angular-material-tests.ts
+++ b/angular-material/angular-material-tests.ts
@@ -30,7 +30,11 @@ myApp.config((
myApp.controller('BottomSheetController', ($scope: ng.IScope, $mdBottomSheet: ng.material.IBottomSheetService) => {
$scope['openBottomSheet'] = () => {
$mdBottomSheet.show({
- template: 'Hello!'
+ template: 'Hello!',
+ clickOutsideToClose: true,
+ disableBackdrop: true,
+ disableParentScroll: false,
+ parent: () => {}
});
};
$scope['hideBottomSheet'] = $mdBottomSheet.hide.bind($mdBottomSheet, 'hide');
@@ -55,6 +59,28 @@ myApp.controller('DialogController', ($scope: ng.IScope, $mdDialog: ng.material.
$scope['confirmDialog'] = () => {
$mdDialog.show($mdDialog.confirm().htmlContent('Confirm!'));
};
+ $scope['promptDialog'] = () => {
+ $mdDialog.show($mdDialog.prompt().textContent('Prompt!'));
+ };
+ $scope['promptDialog'] = () => {
+ $mdDialog.show($mdDialog.prompt().htmlContent('Prompt!'));
+ };
+ $scope['promptDialog'] = () => {
+ $mdDialog.show($mdDialog.prompt().cancel('Prompt "Cancel" button text'));
+ };
+ $scope['promptDialog'] = () => {
+ $mdDialog.show($mdDialog.prompt().placeholder('Prompt input placeholder text'));
+ };
+ $scope['promptDialog'] = () => {
+ $mdDialog.show($mdDialog.prompt().initialValue('Buddy'));
+ };
+ $scope['prerenderedDialog'] = () => {
+ $mdDialog.show({
+ template: 'Hello!',
+ contentElement: '#myDialog',
+ clickOutsideToClose: true
+ });
+ };
$scope['hideDialog'] = $mdDialog.hide.bind($mdDialog, 'hide');
$scope['cancelDialog'] = $mdDialog.cancel.bind($mdDialog, 'cancel');
});
@@ -93,8 +119,64 @@ myApp.controller('SidenavController', ($scope: ng.IScope, $mdSidenav: ng.materia
$scope['close'] = () => $mdSidenav(componentId).close();
$scope['isOpen'] = $mdSidenav(componentId).isOpen();
$scope['isLockedOpen'] = $mdSidenav(componentId).isLockedOpen();
+
+ $scope['asyncLookup'] = $mdSidenav(componentId, true).then((instance) => {
+ instance.toggle();
+ instance.open();
+ instance.close();
+ instance.isOpen();
+ instance.isLockedOpen();
+ });
});
myApp.controller('ToastController', ($scope: ng.IScope, $mdToast: ng.material.IToastService) => {
$scope['openToast'] = () => $mdToast.show($mdToast.simple().textContent('Hello!'));
});
+
+myApp.controller('PanelController', ($scope: ng.IScope, $mdPanel: ng.material.IPanelService) => {
+ $scope['createPanel'] = () => {
+ var config = {
+ template: 'Hello!
',
+ hasBackdrop: true,
+ disableParentScroll: true,
+ zIndex: 150
+ };
+
+ $mdPanel.create(config);
+
+ var panelRef = $mdPanel.create(config);
+ panelRef.open()
+ .then((ref: ng.material.IPanelRef) => {
+ ref.addClass('foo');
+ ref.removeClass('bar');
+ ref.close();
+ })
+ .finally(() => {
+ panelRef = undefined;
+ });
+ };
+
+ $scope['openPanel'] = () => {
+ $mdPanel.open({
+ template: 'Hello!
',
+ hasBackdrop: true,
+ disableParentScroll: true,
+ zIndex: 150
+ })
+ .then((panelRef: ng.material.IPanelRef) => {
+ panelRef.addClass('foo');
+ panelRef.removeClass('bar');
+ panelRef.close();
+ });
+ };
+
+ $scope['newPanelPosition'] = () => {
+ $mdPanel.newPanelPosition().absolute().center();
+ $mdPanel.newPanelPosition().relativeTo('.demo-menu-open-button').addPanelPosition("ALIGN_START", "BELOW");
+ };
+
+ $scope['newPanelAnimation'] = () => {
+ $mdPanel.newPanelAnimation().openFrom('.some-target');
+ $mdPanel.newPanelAnimation().openFrom({top: 0, left: 0});
+ };
+});
diff --git a/angular-material/angular-material.d.ts b/angular-material/angular-material.d.ts
index 12fe28a9b8..23da7bceb2 100644
--- a/angular-material/angular-material.d.ts
+++ b/angular-material/angular-material.d.ts
@@ -1,9 +1,15 @@
-// Type definitions for Angular Material 1.0.0-rc5+ (angular.material module)
+// Type definitions for Angular Material 1.1.0-rc5+ (angular.material module)
// Project: https://github.com/angular/material
-// Definitions by: Matt Traynham
+// Definitions by: Alex Staroselsky , Blake Bigelow , Peter Hajdu
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
///
+
+declare module 'angular-material' {
+ var _: string;
+ export = _;
+}
+
declare namespace angular.material {
interface IBottomSheetOptions {
@@ -13,11 +19,12 @@ declare namespace angular.material {
preserveScope?: boolean; // default: false
controller?: string|Function;
locals?: {[index: string]: any};
- targetEvent?: MouseEvent;
- resolve?: {[index: string]: angular.IPromise}
+ clickOutsideToClose?: boolean;
+ disableBackdrop?: boolean;
+ escapeToClose?: boolean;
+ resolve?: {[index: string]: angular.IPromise};
controllerAs?: string;
- bindToController?: boolean;
- parent?: string|Element|JQuery; // default: root node
+ parent?: Function|string|Object; // default: root node
disableParentScroll?: boolean; // default: true
}
@@ -60,9 +67,16 @@ declare namespace angular.material {
cancel(cancel: string): IConfirmDialog;
}
+ interface IPromptDialog extends IPresetDialog {
+ cancel(cancel: string): IPromptDialog;
+ placeholder(placeholder: string): IPromptDialog;
+ initialValue(initialValue: string): IPromptDialog;
+ }
+
interface IDialogOptions {
templateUrl?: string;
template?: string;
+ contentElement?: string|Element;
autoWrap?: boolean; // default: true
targetEvent?: MouseEvent;
openFrom?: any;
@@ -70,7 +84,7 @@ declare namespace angular.material {
scope?: angular.IScope; // default: new child scope
preserveScope?: boolean; // default: false
disableParentScroll?: boolean; // default: true
- hasBackdrop?: boolean // default: true
+ hasBackdrop?: boolean; // default: true
clickOutsideToClose?: boolean; // default: false
escapeToClose?: boolean; // default: true
focusOnOpen?: boolean; // default: true
@@ -83,13 +97,15 @@ declare namespace angular.material {
onShowing?: Function;
onComplete?: Function;
onRemoving?: Function;
- fullscreen?: boolean;
+ skipHide?: boolean;
+ fullscreen?: boolean; // default: false
}
interface IDialogService {
- show(dialog: IDialogOptions|IAlertDialog|IConfirmDialog): angular.IPromise;
+ show(dialog: IDialogOptions|IAlertDialog|IConfirmDialog|IPromptDialog): angular.IPromise;
confirm(): IConfirmDialog;
alert(): IAlertDialog;
+ prompt(): IPromptDialog;
hide(response?: any): angular.IPromise;
cancel(response?: any): void;
}
@@ -119,6 +135,7 @@ declare namespace angular.material {
}
interface ISidenavService {
+ (component: string, enableWait: boolean): angular.IPromise;
(component: string): ISidenavObject;
}
@@ -230,6 +247,7 @@ declare namespace angular.material {
extendPalette(name: string, palette: IPalette): IPalette;
setDefaultTheme(theme: string): void;
alwaysWatchTheme(alwaysWatch: boolean): void;
+ setNonce(nonce: string): void;
}
interface IDateLocaleProvider {
@@ -271,4 +289,98 @@ declare namespace angular.material {
grey: IPalette;
'blue-grey': IPalette;
}
+
+ interface IPanelConfig {
+ template?: string;
+ templateUrl?: string;
+ controller?: string|Function;
+ controllerAs?: string;
+ bindToController?: boolean; // default: true
+ locals?: {[index: string]: any};
+ resolve?: {[index: string]: angular.IPromise}
+ attachTo?: string|JQuery|Element;
+ propagateContainerEvents?: boolean;
+ panelClass?: string;
+ zIndex?: number; // default: 80
+ position?: IPanelPosition;
+ clickOutsideToClose?: boolean; // default: false
+ escapeToClose?: boolean; // default: false
+ trapFocus?: boolean; // default: false
+ focusOnOpen?: boolean; // default: true
+ fullscreen?: boolean; // default: false
+ animation?: IPanelAnimation;
+ hasBackdrop?: boolean; // default: false
+ disableParentScroll?: boolean; // default: false
+ onDomAdded?: Function;
+ onOpenComplete?: Function;
+ onRemoving?: Function;
+ onDomRemoved?: Function;
+ origin?: string|JQuery|Element;
+ }
+
+ interface IPanelRef {
+ id: string;
+ config: IPanelConfig;
+ isAttached: boolean;
+ open(): angular.IPromise;
+ close(): angular.IPromise;
+ attach(): angular.IPromise;
+ detach(): angular.IPromise;
+ show(): angular.IPromise;
+ hide(): angular.IPromise;
+ destroy(): void;
+ addClass(newClass: string): void;
+ removeClass(oldClass: string): void;
+ toggleClass(toggleClass: string): void;
+ updatePosition(position: IPanelPosition): void;
+ }
+
+ interface IPanelPosition {
+ absolute(): IPanelPosition;
+ relativeTo(someElement: string|JQuery|Element): IPanelPosition;
+ top(top?: string): IPanelPosition; // default: '0'
+ bottom(bottom?: string): IPanelPosition; // default: '0'
+ start(start?: string): IPanelPosition; // default: '0'
+ end(end?: string): IPanelPosition; // default: '0'
+ left(left?: string): IPanelPosition; // default: '0'
+ right(right?: string): IPanelPosition; // default: '0'
+ centerHorizontally(): IPanelPosition;
+ centerVertically(): IPanelPosition;
+ center(): IPanelPosition;
+ addPanelPosition(xPosition: string, yPosition: string): IPanelPosition;
+ withOffsetX(offsetX: string): IPanelPosition;
+ withOffsetY(offsetY: string): IPanelPosition;
+ }
+
+ interface IPanelAnimation {
+ openFrom(from: string|Element|Event|{top: number, left: number}): IPanelAnimation;
+ closeTo(to: string|Element|{top: number, left: number}): IPanelAnimation;
+ withAnimation(cssClass: string|{open: string, close: string}): IPanelAnimation;
+ }
+
+ interface IPanelService {
+ create(opt_config: IPanelConfig): IPanelRef;
+ open(opt_config: IPanelConfig): angular.IPromise;
+ newPanelPosition(): IPanelPosition;
+ newPanelAnimation(): IPanelAnimation;
+ xPosition: {
+ CENTER: string,
+ ALIGN_START: string,
+ ALIGN_END: string,
+ OFFSET_START: string,
+ OFFSET_END: string,
+ };
+ yPosition: {
+ CENTER: string,
+ ALIGN_TOPS: string,
+ ALIGN_BOTTOMS: string,
+ ABOVE: string,
+ BELOW: string,
+ };
+ animation: {
+ SLIDE: string,
+ SCALE: string,
+ FADE: string,
+ };
+ }
}
diff --git a/angular-permission/angular-permission-tests.ts b/angular-permission/angular-permission-tests.ts
index cc9cd7c367..c6d5b91a8d 100644
--- a/angular-permission/angular-permission-tests.ts
+++ b/angular-permission/angular-permission-tests.ts
@@ -1,10 +1,11 @@
///
-import permission = angular.permission;
+import permissionNamespace = angular.permission;
+import { permission, ngPermission, uiPermission } from "angular-permission";
angular
- .module('fooModule', ['permission', 'user'])
- .run(function (PermissionStore: permission.PermissionStore, User: any) {
+ .module('fooModule', [permission, ngPermission, uiPermission, 'user'])
+ .run(function (PermissionStore: permissionNamespace.PermissionStore, User: any) {
// Define anonymous permission
PermissionStore
.definePermission('anonymous', function (stateParams) {
@@ -22,8 +23,8 @@ angular
hasPermissionDefinition(permission: string) : angular.IPromise;
}
- angular.module('barModule', ['permission', 'user'])
- .run(function (PermissionStore: permission.PermissionStore, User: BackendUserService, $q: angular.IQService) {
+ angular.module('barModule', [permission, 'user'])
+ .run(function (PermissionStore: permissionNamespace.PermissionStore, User: BackendUserService, $q: angular.IQService) {
PermissionStore
// Define user permission calling back-end
.definePermission('user', function (stateParams) {
@@ -64,14 +65,14 @@ angular
PermissionStore.removePermissionDefinition('user');
- let permissions: Array = PermissionStore.getStore();
+ let permissions: Array = PermissionStore.getStore();
});
angular
- .module('fooModule', ['permission', 'user'])
- .run(function (RoleStore: permission.RoleStore, User: any) {
+ .module('fooModule', [permission, 'user'])
+ .run(function (RoleStore: permissionNamespace.RoleStore, User: any) {
RoleStore
// Permission array validated role
// Library will internally validate if 'user' and 'editor' permissions are valid when checking if role is valid
@@ -88,5 +89,5 @@ angular
RoleStore.removeRoleDefinition('user');
- let roles: Array = RoleStore.getStore();
+ let roles: Array = RoleStore.getStore();
});
diff --git a/angular-permission/angular-permission.d.ts b/angular-permission/angular-permission.d.ts
index fecbafb29b..138c8892ce 100644
--- a/angular-permission/angular-permission.d.ts
+++ b/angular-permission/angular-permission.d.ts
@@ -173,3 +173,9 @@ declare namespace angular.permission {
options?: angular.ui.IStateOptions;
}
}
+
+declare module "angular-permission" {
+ export var permission: string;
+ export var ngPermission: string;
+ export var uiPermission: string;
+}
diff --git a/angular-q-spread/angular-q-spread-tests.ts b/angular-q-spread/angular-q-spread-tests.ts
new file mode 100644
index 0000000000..932ecc4fa9
--- /dev/null
+++ b/angular-q-spread/angular-q-spread-tests.ts
@@ -0,0 +1,42 @@
+///
+
+interface IMyService {
+ getFirstname(): ng.IPromise;
+ getLastname(): ng.IPromise;
+}
+
+interface IScope {
+ name: string;
+}
+
+function TestCtrl($scope: IScope, $q: ng.IQService, MyService: IMyService) {
+ $scope.name = null;
+
+ function firstCallback(firstname: string, lastname: string)
+ {
+ return firstname + ' ' + lastname;
+ }
+
+ function anotherCallback(fullname: string)
+ {
+ $scope.name = fullname;
+ }
+
+ function failureCallback(reason: any)
+ {
+ alert('Could not load data: ' + reason);
+ }
+
+ $q
+ .all([
+ MyService.getFirstname(),
+ MyService.getLastname()
+ ])
+ .spread(firstCallback)
+ .then(anotherCallback)
+ .catch(failureCallback);
+};
+
+TestCtrl.$inject = ['$scope', '$q', 'MyService'];
+
+angular.module('test').controller('TestCtrl', TestCtrl);
diff --git a/angular-q-spread/angular-q-spread.d.ts b/angular-q-spread/angular-q-spread.d.ts
new file mode 100644
index 0000000000..3eb37dc4e0
--- /dev/null
+++ b/angular-q-spread/angular-q-spread.d.ts
@@ -0,0 +1,17 @@
+// Type definitions for angular-q-spread module
+// Project: https://www.npmjs.com/package/angular-q-spread
+// Definitions by: rafw87
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+///
+
+declare module angular {
+ interface IPromise {
+ /**
+ This method can be used as a replacement for then. Similarly, it takes two parameters, a callback when all promises are resolved and a callback for failure. The resolve callback is going to be called with the result of the list of promises passed to $q.all as separate parameters instead of one parameters which is an array.
+ * @param successCallback Callback for resolved promise, similar to then's one, but takes multiple parameters instead of single array parameter
+ * @param errorCallback Callback for error, the same as for then
+ */
+ spread(successCallback: (...promiseValues: any[]) => IPromise|TResult, errorCallback?: (reason: any) => any): IPromise;
+ }
+}
diff --git a/angular-translate/angular-translate.d.ts b/angular-translate/angular-translate.d.ts
index c4eca39a95..0187e33cab 100644
--- a/angular-translate/angular-translate.d.ts
+++ b/angular-translate/angular-translate.d.ts
@@ -13,7 +13,7 @@ declare module "angular-translate" {
declare namespace angular.translate {
interface ITranslationTable {
- [key: string]: any;
+ [key: string]: string | ITranslationTable;
}
interface ILanguageKeyAlias {
@@ -68,10 +68,11 @@ declare namespace angular.translate {
loaderCache(): any;
isReady(): boolean;
onReady(): angular.IPromise;
+ resolveClientLocale():string;
}
interface ITranslateProvider extends angular.IServiceProvider {
- translations(): ITranslationTable;
+ translations(key?: string): ITranslationTable;
translations(key: string, translationTable: ITranslationTable): ITranslateProvider;
cloakClassName(): string;
cloakClassName(name: string): ITranslateProvider;
@@ -94,8 +95,9 @@ declare namespace angular.translate {
use(key: string): ITranslateProvider;
storageKey(): string;
storageKey(key: string): void; // JeroMiya - the library should probably return ITranslateProvider but it doesn't here
+ uniformLanguageTag(options: string | Object): ITranslateProvider;
useUrlLoader(url: string): ITranslateProvider;
- useStaticFilesLoader(options: IStaticFilesLoaderOptions): ITranslateProvider;
+ useStaticFilesLoader(options: IStaticFilesLoaderOptions | { files: IStaticFilesLoaderOptions[] }): ITranslateProvider;
useLoader(loaderFactory: string, options?: any): ITranslateProvider;
useLocalStorage(): ITranslateProvider;
useCookieStorage(): ITranslateProvider;
@@ -111,6 +113,7 @@ declare namespace angular.translate {
registerAvailableLanguageKeys(): string[];
registerAvailableLanguageKeys(languageKeys: string[], aliases?: ILanguageKeyAlias): ITranslateProvider;
useLoaderCache(cache?: any): ITranslateProvider;
+ resolveClientLocale():string;
}
}
diff --git a/angular-ui-bootstrap/angular-ui-bootstrap-tests.ts b/angular-ui-bootstrap/angular-ui-bootstrap-tests.ts
index 7851d2da37..d92c90bc60 100644
--- a/angular-ui-bootstrap/angular-ui-bootstrap-tests.ts
+++ b/angular-ui-bootstrap/angular-ui-bootstrap-tests.ts
@@ -181,6 +181,10 @@ testApp.controller('TestCtrl', (
$log.log('modal rendered');
});
+ modalInstance.closed.then(()=> {
+ $log.log('modal closed');
+ });
+
modalInstance.result.then((closeResult:any)=> {
$log.log('modal closed', closeResult);
}, (dismissResult:any)=> {
diff --git a/angular-ui-bootstrap/angular-ui-bootstrap.d.ts b/angular-ui-bootstrap/angular-ui-bootstrap.d.ts
index 29ad03485b..dd129d141d 100644
--- a/angular-ui-bootstrap/angular-ui-bootstrap.d.ts
+++ b/angular-ui-bootstrap/angular-ui-bootstrap.d.ts
@@ -270,6 +270,11 @@ declare namespace angular.ui.bootstrap {
* A promise that is resolved when a modal is rendered.
*/
rendered: angular.IPromise;
+
+ /**
+ * A promise that is resolved when a modal is closed and the animation completes.
+ */
+ closed: angular.IPromise;
}
interface IModalScope extends angular.IScope {
@@ -382,6 +387,19 @@ declare namespace angular.ui.bootstrap {
* @default 'model-open'
*/
openedClass?: string;
+
+ /**
+ * CSS class(es) to be added to the top modal window.
+ */
+
+ windowTopClass?: string;
+
+ /**
+ * Appends the modal to a specific element.
+ *
+ * @default 'body'
+ */
+ appendTo?: angular.IAugmentedJQuery;
}
interface IModalStackService {
diff --git a/angular-ui-router/angular-ui-router-tests.ts b/angular-ui-router/angular-ui-router-tests.ts
index 9c5db1754a..a588faa448 100644
--- a/angular-ui-router/angular-ui-router-tests.ts
+++ b/angular-ui-router/angular-ui-router-tests.ts
@@ -1,6 +1,7 @@
///
-var myApp = angular.module('testModule');
+import uiRouterModule from "angular-ui-router";
+var myApp = angular.module("testModule", [uiRouterModule]);
interface MyAppScope extends ng.IScope {
items: string[];
@@ -141,7 +142,7 @@ class UrlLocatorTestService implements IUrlLocatorTestService {
private $state: ng.ui.IStateService
) {
$rootScope.$on("$locationChangeSuccess", (event: ng.IAngularEvent) => this.onLocationChangeSuccess(event));
- $rootScope.$on('$stateNotFound', (event: ng.IAngularEvent, unfoundState: ng.ui.IUnfoundState, fromState: ng.ui.IState, fromParams: {}) =>
+ $rootScope.$on('$stateNotFound', (event: ng.IAngularEvent, unfoundState: ng.ui.IUnfoundState, fromState: ng.ui.IState, fromParams: {}) =>
this.onStateNotFound(event, unfoundState, fromState, fromParams));
}
@@ -164,14 +165,14 @@ class UrlLocatorTestService implements IUrlLocatorTestService {
});
}
}
-
+
private onStateNotFound(event: ng.IAngularEvent,
unfoundState: ng.ui.IUnfoundState,
fromState: ng.ui.IState,
fromParams: {}) {
var unfoundTo: string = unfoundState.to;
var unfoundToParams: {} = unfoundState.toParams;
- var unfoundOptions: ng.ui.IStateOptions = unfoundState.options
+ var unfoundOptions: ng.ui.IStateOptions = unfoundState.options
}
private stateServiceTest() {
diff --git a/angular-ui-router/angular-ui-router.d.ts b/angular-ui-router/angular-ui-router.d.ts
index 0512528097..7e4f097c8c 100644
--- a/angular-ui-router/angular-ui-router.d.ts
+++ b/angular-ui-router/angular-ui-router.d.ts
@@ -7,13 +7,7 @@
// Support for AMD require and CommonJS
declare module 'angular-ui-router' {
- // Since angular-ui-router adds providers for a bunch of
- // injectable dependencies, it doesn't really return any
- // actual data except the plain string 'ui.router'.
- //
- // As such, I don't think anybody will ever use the actual
- // default value of the module. So I've only included the
- // the types. (@xogeny)
+ export default "ui.router";
export type IState = angular.ui.IState;
export type IStateProvider = angular.ui.IStateProvider;
export type IUrlMatcher = angular.ui.IUrlMatcher;
@@ -35,7 +29,7 @@ declare namespace angular.ui {
/**
* String HTML content, or function that returns an HTML string
*/
- template?: string | {(): string};
+ template?: string | {(params: IStateParamsService): string};
/**
* String URL path to template file OR Function, returns URL path string
*/
@@ -44,6 +38,10 @@ declare namespace angular.ui {
* Function, returns HTML content string
*/
templateProvider?: Function | Array;
+ /**
+ * String, component name
+ */
+ component?: string;
/**
* A controller paired to the state. Function, annotated array or name as String
*/
@@ -105,7 +103,7 @@ declare namespace angular.ui {
toParams: {},
options: IStateOptions
}
-
+
interface IStateProvider extends angular.IServiceProvider {
state(name:string, config:IState): IStateProvider;
state(config:IState): IStateProvider;
@@ -229,9 +227,9 @@ declare namespace angular.ui {
*/
notify?: boolean;
/**
- * {boolean=false}, If true will force transition even if the state or params have not changed, aka a reload of the same state. It differs from reloadOnSearch because you'd use this when you want to force a reload when everything is the same, including search params.
+ * {boolean=false|string|IState}, If true will force transition even if the state or params have not changed, aka a reload of the same state. It differs from reloadOnSearch because you'd use this when you want to force a reload when everything is the same, including search params.
*/
- reload?: boolean;
+ reload?: boolean | string | IState;
}
interface IHrefOptions {
diff --git a/angular-websocket/angular-websocket-tests.ts b/angular-websocket/angular-websocket-tests.ts
new file mode 100644
index 0000000000..e7cb30fe49
--- /dev/null
+++ b/angular-websocket/angular-websocket-tests.ts
@@ -0,0 +1,71 @@
+///
+
+let dummySocket: ng.websocket.IWebSocket;
+let dummyPromise: ng.IPromise;
+let dummyScope: ng.IScope;
+
+let provider: ng.websocket.IWebSocketProvider = (url: string, protocols?:string[] | ng.websocket.IWebSocketConfigOptions, options?: ng.websocket.IWebSocketConfigOptions) => {
+ return dummySocket;
+}
+
+let socketWithProtocol = provider("wss://localhost", "protocol");
+let socketWithProtocols = provider("wss://localhost", ["protocol-a", "protocol-b"]);
+
+let socketWithOptions = provider("wss://localhost", {
+ scope: dummyScope,
+ rootScopeFailOver: true,
+ useApplyAsync: true,
+ initialTimeout: 100,
+ maxTimeout: 300000,
+ reconnectIfNotNormalClose: true,
+ binaryType: "blob"
+});
+
+let socketWithProtocolAndOptions = provider("wss://localhost", "protocol", {
+ scope: dummyScope,
+ rootScopeFailOver: true,
+ useApplyAsync: true,
+ initialTimeout: 100,
+ maxTimeout: 300000,
+ reconnectIfNotNormalClose: true,
+ binaryType: "blob"
+});
+
+let socket = provider("wss://localhost");
+
+socket.onOpen((event) => {})
+ .onClose((event) => {})
+ .onError((event) => {})
+ .onMessage((event) => {});
+
+socket.onMessage((event) => {}, { filter: /Some Filter/ })
+ .onMessage((event) => {}, { filter: 'Some Filter' })
+ .onMessage((event) => {}, { filter: 'Some Filter', autoApply: true })
+ .onMessage((event) => {}, { autoApply: false });
+
+socket.close(true);
+socket.close();
+
+socket.send("Some great data here!").finally(() => {});
+socket.send({ list: [1, 2, 3, 4] });
+
+socket.socket.send("data");
+socket.socket.close();
+socket.socket.close(1);
+socket.socket.close(1, "reason");
+
+socket.sendQueue.push({ message: "msg", defered: dummyPromise });
+
+socket.onOpenCallbacks.push((event: Event) => {});
+socket.onCloseCallbacks.push((event: CloseEvent) => {});
+socket.onErrorCallbacks.push((event: Event) => {});
+socket.onMessageCallbacks.push({ fn: (event: MessageEvent) => {}, pattern: 'Some Filter', autoApply: true });
+socket.onMessageCallbacks.push({ fn: (event: MessageEvent) => {}, pattern: /Some Filter/, autoApply: true });
+socket.onMessageCallbacks.push({ fn: (event: MessageEvent) => {}, pattern: undefined, autoApply: true });
+
+socket.readyState = 0;
+
+socket.initialTimeout = 10;
+
+socket.maxTimeout = 5000;
+
diff --git a/angular-websocket/angular-websocket.d.ts b/angular-websocket/angular-websocket.d.ts
new file mode 100644
index 0000000000..6929561f9c
--- /dev/null
+++ b/angular-websocket/angular-websocket.d.ts
@@ -0,0 +1,157 @@
+// Type definitions for angular-websocket v2.0
+// Project: https://github.com/AngularClass/angular-websocket
+// Definitions by: Nick Veys
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+///
+
+declare namespace angular.websocket {
+
+ /**
+ * Options available to be specified for IWebSocketProvider.
+ */
+ type IWebSocketConfigOptions = {
+ scope?: ng.IScope;
+ rootScopeFailOver?: boolean;
+ useApplyAsync?: boolean;
+ initialTimeout?: number;
+ maxTimeout?: number;
+ binaryType?: "blob" | "arraybuffer";
+ reconnectIfNotNormalClose?: boolean;
+ }
+ interface IWebSocketProvider {
+ /**
+ * Creates and opens an IWebSocket instance.
+ *
+ * @param url url to connect to
+ * @return websocket instance
+ */
+ (url: string, protocols?: string | string[] | IWebSocketConfigOptions, options?: IWebSocketConfigOptions): IWebSocket;
+ }
+
+ /** Options available to be specified for IWebSocket.onMessage */
+ type IWebSocketMessageOptions = {
+
+ /**
+ * If specified, only messages that match the filter will cause the message event
+ * to be fired.
+ */
+ filter?: string | RegExp;
+
+ /** If true, each message handled will safely call `$rootScope.$digest()`. */
+ autoApply?: boolean;
+ }
+
+ /** Type corresponding to onMessage callbaks stored in $Websocket#onMessageCallbacks instance. */
+ type IWebSocketMessageHandler = {
+ fn: (evt: MessageEvent) => void;
+ pattern: string | RegExp;
+ autoApply: boolean;
+ }
+
+ /** Type corresponding to items stored in $WebSocket#sendQueue instance. */
+ type IWebSocketQueueItem = {
+ message: any;
+ defered: ng.IPromise;
+ }
+
+ interface IWebSocket {
+
+ /**
+ * Adds a callback to be executed each time a socket connection is opened for
+ * this instance.
+ *
+ * @param event event object
+ * @returns this instance, for method chaining
+ */
+ onOpen(callback: (event: Event) => void): IWebSocket;
+
+ /**
+ * Adds a callback to be executed each time a socket connection is closed for
+ * this instance.
+ *
+ * @param event event object
+ * @returns this instance, for method chaining
+ */
+ onClose(callback: (event: CloseEvent) => void): IWebSocket;
+
+ /**
+ * Adds a callback to be executed each time a socket connection is closed for
+ * this instance.
+ *
+ * @param event event object
+ * @returns this instance, for method chaining
+ */
+ onError(callback: (event: Event) => void): IWebSocket;
+
+ /**
+ * Adds a callback to be executed each time a socket connection has an error for
+ * this instance.
+ *
+ * @param event event object
+ * @returns this instance, for method chaining
+ */
+ onMessage(callback: (event: MessageEvent) => void, options?: IWebSocketMessageOptions): IWebSocket;
+
+ /**
+ * Closes the underlying socket, as long as no data is still being sent from the client.
+ *
+ * @param force if `true`, force close even if data is still being sent
+ * @returns this instance, for method chaining
+ */
+ close(force?: boolean): IWebSocket;
+
+ /**
+ * Adds data to a queue, and attempts to send if the socket is ready.
+ *
+ * @param data data to send, if this is an object, it will be stringified before sending
+ */
+ send(data: string | {}): ng.IPromise;
+
+ /**
+ * WebSocket instance.
+ */
+ socket: WebSocket;
+
+ /**
+ * Queue of send calls to be made on socket when socket is able to receive data.
+ */
+ sendQueue: IWebSocketQueueItem[];
+
+ /**
+ * List of callbacks to be executed when the socket is opened.
+ */
+ onOpenCallbacks: ((evt: Event) => void)[];
+
+ /**
+ * List of callbacks to be executed when a message is received from the socket.
+ */
+ onMessageCallbacks: IWebSocketMessageHandler[];
+
+ /**
+ * List of callbacks to be executed when an error is received from the socket.
+ */
+ onErrorCallbacks: ((evt: Event) => void)[];
+
+ /**
+ * List of callbacks to be executed when the socket is closed.
+ */
+ onCloseCallbacks: ((evt: CloseEvent) => void)[];
+
+ /**
+ * Returns either the readyState value from the underlying WebSocket instance
+ * or a proprietary value representing the internal state
+ */
+ readyState: number;
+
+ /**
+ * The initial timeout.
+ */
+ initialTimeout: number;
+
+ /**
+ * Maximun timeout used to determine reconnection delay.
+ */
+ maxTimeout: number;
+ }
+}
diff --git a/angular-xeditable/angular-xeditable-tests.ts b/angular-xeditable/angular-xeditable-tests.ts
new file mode 100644
index 0000000000..9264c47f41
--- /dev/null
+++ b/angular-xeditable/angular-xeditable-tests.ts
@@ -0,0 +1,15 @@
+///
+
+var myApp = angular.module('testModule', ['xeditable']);
+
+myApp.run(["editableOptions", (editableOptions: angular.xeditable.IEditableOptions) => {
+
+ editableOptions.activate = "select";
+ editableOptions.activationEvent = "click";
+ editableOptions.blurElem = "ignore";
+ editableOptions.blurForm = "submit";
+ editableOptions.buttons = "no";
+ editableOptions.icon_set = "font-awesome";
+ editableOptions.isDisabled = true;
+ editableOptions.theme = "bs3";
+}]);
\ No newline at end of file
diff --git a/angular-xeditable/angular-xeditable.d.ts b/angular-xeditable/angular-xeditable.d.ts
new file mode 100644
index 0000000000..026fc5d2fb
--- /dev/null
+++ b/angular-xeditable/angular-xeditable.d.ts
@@ -0,0 +1,98 @@
+// Type definitions for Angular xEditable 0.2.0 (angular.xeditable module)
+// Project: https://vitalets.github.io/angular-xeditable/
+// Definitions by: Joao Monteiro
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+///
+
+declare namespace angular.xeditable {
+
+ interface IEditableOptions {
+
+ /**
+ * Theme. Possible values `bs3`, `bs2`, `default`
+ */
+ theme: string;
+
+ /**
+ * Icon Set. Possible values `font-awesome`, `default`.
+ */
+ icon_set: string;
+
+ /**
+ * Whether to show buttons for single editalbe element.
+ * Possible values `right` (default), `no`.
+ */
+ buttons: string;
+
+ /**
+ * Default value for `blur` attribute of single editable element.
+ * Can be `cancel|submit|ignore`.
+ */
+ blurElem: string;
+
+ /**
+ * Default value for `blur` attribute of editable form.
+ * Can be `cancel|submit|ignore`.
+ */
+ blurForm: string;
+
+ /**
+ * How input elements get activated. Possible values: `focus|select|none`.
+ */
+ activate: string;
+
+ /**
+ * Whether to disable x-editable. Can be overloaded on each element.
+ */
+ isDisabled: boolean;
+
+ /*
+ * Event, on which the edit mode gets activated.
+ * Can be any event.
+ */
+ activationEvent: string;
+ }
+
+ interface IEditableFormController extends angular.IFormController {
+
+ /**
+ * Shows form with editable controls.
+ */
+ $show(): void;
+
+ /**
+ * Hides form with editable controls without saving.
+ */
+ $hide(): void;
+
+ /**
+ * Sets focus on form field specified by `name`.
+ * When trying to set the focus on a form field of a new row in the editable table, the `$activate` call needs to be wrapped in a `$timeout` call so that the form is rendered before the `$activate` function is called.
+ *
+ * @param name name of field
+ */
+ $activate(name: string): void;
+
+ /**
+ * Triggers `oncancel` event and calls `$hide()`.
+ */
+ $cancel(): void;
+
+ $setWaiting(value: boolean): void;
+
+ /**
+ * Shows error message for particular field.
+ *
+ * @param name name of field
+ * @param msg error message
+ */
+ $setError(name: string, msg: string): void;
+
+ $submit(): void;
+
+ $save(): void;
+
+ }
+
+}
diff --git a/angularjs/angular-animate.d.ts b/angularjs/angular-animate.d.ts
index 2f3cbc0f18..2451976bf5 100644
--- a/angularjs/angular-animate.d.ts
+++ b/angularjs/angular-animate.d.ts
@@ -19,14 +19,14 @@ declare namespace angular.animate {
}
interface IAnimateCallbackObject {
- eventFn?: (element: IAugmentedJQuery, doneFunction: Function, options: IAnimationOptions) => any;
- setClass?: (element: IAugmentedJQuery, addedClasses: string, removedClasses: string, doneFunction: Function, options: IAnimationOptions) => any;
- addClass?: (element: IAugmentedJQuery, addedClasses: string, doneFunction: Function, options: IAnimationOptions) => any;
- removeClass?: (element: IAugmentedJQuery, removedClasses: string, doneFunction: Function, options: IAnimationOptions) => any;
- enter?: (element: IAugmentedJQuery, doneFunction: Function, options: IAnimationOptions) => any;
- leave?: (element: IAugmentedJQuery, doneFunction: Function, options: IAnimationOptions) => any;
- move?: (element: IAugmentedJQuery, doneFunction: Function, options: IAnimationOptions) => any;
- animate?: (element: IAugmentedJQuery, fromStyles: string, toStyles: string, doneFunction: Function, options: IAnimationOptions) => any;
+ eventFn?: (element: JQuery, doneFunction: Function, options: IAnimationOptions) => any;
+ setClass?: (element: JQuery, addedClasses: string, removedClasses: string, doneFunction: Function, options: IAnimationOptions) => any;
+ addClass?: (element: JQuery, addedClasses: string, doneFunction: Function, options: IAnimationOptions) => any;
+ removeClass?: (element: JQuery, removedClasses: string, doneFunction: Function, options: IAnimationOptions) => any;
+ enter?: (element: JQuery, doneFunction: Function, options: IAnimationOptions) => any;
+ leave?: (element: JQuery, doneFunction: Function, options: IAnimationOptions) => any;
+ move?: (element: JQuery, doneFunction: Function, options: IAnimationOptions) => any;
+ animate?: (element: JQuery, fromStyles: string, toStyles: string, doneFunction: Function, options: IAnimationOptions) => any;
}
interface IAnimationPromise extends IPromise {}
@@ -43,7 +43,7 @@ declare namespace angular.animate {
* @param container the container element that will capture each of the animation events that are fired on itself as well as among its children
* @param callback the callback function that will be fired when the listener is triggered
*/
- on(event: string, container: JQuery, callback: Function): void;
+ on(event: string, container: JQuery, callback: (element?: JQuery, phase?: string) => any): void;
/**
* Deregisters an event listener based on the event which has been associated with the provided element.
@@ -52,7 +52,7 @@ declare namespace angular.animate {
* @param container the container element the event listener was placed on
* @param callback the callback function that was registered as the listener
*/
- off(event: string, container?: JQuery, callback?: Function): void;
+ off(event: string, container?: JQuery, callback?: (element?: JQuery, phase?: string) => any): void;
/**
* Associates the provided element with a host parent element to allow the element to be animated even if it exists outside of the DOM structure of the Angular application.
@@ -69,8 +69,8 @@ declare namespace angular.animate {
* @param value If provided then set the animation on or off.
* @returns current animation state
*/
+ enabled(value?: boolean): boolean;
enabled(element: JQuery, value?: boolean): boolean;
- enabled(value: boolean): boolean;
/**
* Cancels the provided animation.
@@ -183,16 +183,6 @@ declare namespace angular.animate {
* see https://docs.angularjs.org/api/ngAnimate/#applying-directive-specific-styles-to-an-animation
*/
interface IAnimationOptions {
- /**
- * The ending CSS styles (a key/value object) that will be applied across the animation via a CSS transition.
- */
- to?: Object;
-
- /**
- * The starting CSS styles (a key/value object) that will be applied at the start of the animation.
- */
- from?: Object;
-
/**
* The DOM event (e.g. enter, leave, move). When used, a generated CSS class of ng-EVENT and
* ng-EVENT-active will be applied to the element during the animation. Multiple events can be provided when
@@ -200,6 +190,12 @@ declare namespace angular.animate {
*/
event?: string;
+ /**
+ * Indicates that the ng-prefix will be added to the event class. Setting to false or
+ * omitting will turn ng-EVENT and ng-EVENT-active in EVENT and EVENT-active. Unused if event is omitted.
+ */
+ structural?: boolean;
+
/**
* The CSS easing value that will be applied to the transition or keyframe animation (or both).
*/
@@ -208,12 +204,22 @@ declare namespace angular.animate {
/**
* The raw CSS transition style that will be used (e.g. 1s linear all).
*/
- transition?: string;
+ transitionStyle?: string;
/**
* The raw CSS keyframe animation style that will be used (e.g. 1s my_animation linear).
*/
- keyframe?: string;
+ keyframeStyle?: string;
+
+ /**
+ * The starting CSS styles (a key/value object) that will be applied at the start of the animation.
+ */
+ from?: Object;
+
+ /**
+ * The ending CSS styles (a key/value object) that will be applied across the animation via a CSS transition.
+ */
+ to?: Object;
/**
* A space separated list of CSS classes that will be added to the element and spread across the animation.
@@ -250,11 +256,16 @@ declare namespace angular.animate {
/**
* The numeric index representing the stagger item (e.g. a value of 5 is equal to the sixth item
* in the stagger; therefore when a stagger option value of 0.1 is used then there will be a stagger delay of 600ms)
- * applyClassesEarly - Whether or not the classes being added or removed will be used when detecting the animation.
- * This is set by $animate when enter/leave/move animations are fired to ensure that the CSS classes are resolved in time.
- * (Note that this will prevent any transitions from occuring on the classes being added and removed.)
+ *
*/
staggerIndex?: number;
+
+ /**
+ * Whether or not the provided from and to styles will be removed once the animation is closed. This is useful for
+ * when the styles are used purely for the sake of the animation and do not have a lasting visual effect on the element
+ * (e.g. a colapse and open animation). By default this value is set to false.
+ */
+ cleanupStyles?: boolean;
}
interface IAnimateCssRunner {
diff --git a/angularjs/angular-component-router.d.ts b/angularjs/angular-component-router.d.ts
index 2c56ef3a21..3b037b58b1 100644
--- a/angularjs/angular-component-router.d.ts
+++ b/angularjs/angular-component-router.d.ts
@@ -428,4 +428,55 @@ declare namespace angular {
interface OnReuse {
$routerOnReuse(next?: angular.ComponentInstruction, prev?: angular.ComponentInstruction): any;
}
+
+ /**
+ * Runtime representation a type that a Component or other object is instances of.
+ *
+ * An example of a `Type` is `MyCustomComponent` class, which in JavaScript is be represented by
+ * the `MyCustomComponent` constructor function.
+ */
+ interface Type extends Function {
+ }
+
+ /**
+ * `RouteDefinition` defines a route within a {@link RouteConfig} decorator.
+ *
+ * Supported keys:
+ * - `path` or `aux` (requires exactly one of these)
+ * - `component`, `loader`, `redirectTo` (requires exactly one of these)
+ * - `name` or `as` (optional) (requires exactly one of these)
+ * - `data` (optional)
+ *
+ * See also {@link Route}, {@link AsyncRoute}, {@link AuxRoute}, and {@link Redirect}.
+ */
+ interface RouteDefinition {
+ path?: string;
+ aux?: string;
+ component?: Type | ComponentDefinition | string;
+ loader?: Function;
+ redirectTo?: any[];
+ as?: string;
+ name?: string;
+ data?: any;
+ useAsDefault?: boolean;
+ }
+
+ /**
+ * Represents either a component type (`type` is `component`) or a loader function
+ * (`type` is `loader`).
+ *
+ * See also {@link RouteDefinition}.
+ */
+ interface ComponentDefinition {
+ type: string;
+ loader?: Function;
+ component?: Type;
+ }
+
+ // Supplement IComponentOptions from angular.d.ts with router-specific
+ // fields.
+ interface IComponentOptions {
+ $canActivate?: () => boolean;
+ $routeConfig?: RouteDefinition[];
+ }
}
diff --git a/angularjs/angular-mocks-tests.ts b/angularjs/angular-mocks-tests.ts
index 8790e68cf3..ed72401d0c 100644
--- a/angularjs/angular-mocks-tests.ts
+++ b/angularjs/angular-mocks-tests.ts
@@ -137,15 +137,19 @@ requestHandler = httpBackendService.expect('GET', /test.local/);
requestHandler = httpBackendService.expect('GET', /test.local/, 'response data');
requestHandler = httpBackendService.expect('GET', /test.local/, 'response data', { header: 'value' });
requestHandler = httpBackendService.expect('GET', /test.local/, 'response data', function (headers: Object): boolean { return true; });
+requestHandler = httpBackendService.expect('GET', /test.local\/(\d+)/, 'response data', function (headers: Object): boolean { return true; }, ['id']);
requestHandler = httpBackendService.expect('GET', /test.local/, /response data/);
requestHandler = httpBackendService.expect('GET', /test.local/, /response data/, { header: 'value' });
requestHandler = httpBackendService.expect('GET', /test.local/, /response data/, function (headers: Object): boolean { return true; });
+requestHandler = httpBackendService.expect('GET', /test.local\/(\d+)/, /response data/, function (headers: Object): boolean { return true; }, ['id']);
requestHandler = httpBackendService.expect('GET', /test.local/, function (data: string): boolean { return true; });
requestHandler = httpBackendService.expect('GET', /test.local/, function (data: string): boolean { return true; }, { header: 'value' });
requestHandler = httpBackendService.expect('GET', /test.local/, function (data: string): boolean { return true; }, function (headers: Object): boolean { return true; });
+requestHandler = httpBackendService.expect('GET', /test.local\/(\d+)/, function (data: string): boolean { return true; }, function (headers: Object): boolean { return true; }, ['id']);
requestHandler = httpBackendService.expect('GET', /test.local/, { key: 'value' });
requestHandler = httpBackendService.expect('GET', /test.local/, { key: 'value' }, { header: 'value' });
requestHandler = httpBackendService.expect('GET', /test.local/, { key: 'value' }, function (headers: Object): boolean { return true; });
+requestHandler = httpBackendService.expect('GET', /test.local\/(\d+)/, { key: 'value' }, function (headers: Object): boolean { return true; }, ['id']);
requestHandler = httpBackendService.expect('GET', (url: string) => { return true; });
requestHandler = httpBackendService.expect('GET', (url: string) => { return true; }, 'response data');
requestHandler = httpBackendService.expect('GET', (url: string) => { return true; }, 'response data', { header: 'value' });
@@ -163,17 +167,21 @@ requestHandler = httpBackendService.expect('GET', (url: string) => { return true
requestHandler = httpBackendService.expectDELETE('http://test.local');
requestHandler = httpBackendService.expectDELETE('http://test.local', { header: 'value' });
requestHandler = httpBackendService.expectDELETE(/test.local/, { header: 'value' });
+requestHandler = httpBackendService.expectDELETE(/test.local\/(\d+)/, { header: 'value' }, ['id']);
requestHandler = httpBackendService.expectDELETE((url: string) => { return true; }, { header: 'value' });
requestHandler = httpBackendService.expectGET('http://test.local');
requestHandler = httpBackendService.expectGET('http://test.local', { header: 'value' });
requestHandler = httpBackendService.expectGET(/test.local/, { header: 'value' });
+requestHandler = httpBackendService.expectGET(/test.local\/(\d+)/, { header: 'value' }, ['id']);
requestHandler = httpBackendService.expectGET((url: string) => { return true; }, { header: 'value' });
requestHandler = httpBackendService.expectHEAD('http://test.local');
requestHandler = httpBackendService.expectHEAD('http://test.local', { header: 'value' });
requestHandler = httpBackendService.expectHEAD(/test.local/, { header: 'value' });
+requestHandler = httpBackendService.expectHEAD(/test.local\/(\d+)/, { header: 'value' }, ['id']);
requestHandler = httpBackendService.expectHEAD((url: string) => { return true; }, { header: 'value' });
requestHandler = httpBackendService.expectJSONP('http://test.local');
requestHandler = httpBackendService.expectJSONP(/test.local/);
+requestHandler = httpBackendService.expectJSONP(/test.local\/(\d+)/, ['id']);
requestHandler = httpBackendService.expectJSONP((url: string) => { return true; });
requestHandler = httpBackendService.expectPATCH('http://test.local');
@@ -188,12 +196,15 @@ requestHandler = httpBackendService.expectPATCH('http://test.local', { key: 'val
requestHandler = httpBackendService.expectPATCH(/test.local/);
requestHandler = httpBackendService.expectPATCH(/test.local/, 'response data');
requestHandler = httpBackendService.expectPATCH(/test.local/, 'response data', { header: 'value' });
+requestHandler = httpBackendService.expectPATCH(/test.local\/(\d+)/, 'response data', { header: 'value' }, ['id']);
requestHandler = httpBackendService.expectPATCH(/test.local/, /response data/);
requestHandler = httpBackendService.expectPATCH(/test.local/, /response data/, { header: 'value' });
requestHandler = httpBackendService.expectPATCH(/test.local/, function (data: string): boolean { return true; });
requestHandler = httpBackendService.expectPATCH(/test.local/, function (data: string): boolean { return true; }, { header: 'value' });
+requestHandler = httpBackendService.expectPATCH(/test.local\/(\d+)/, function (data: string): boolean { return true; }, { header: 'value' }, ['id']);
requestHandler = httpBackendService.expectPATCH(/test.local/, { key: 'value' });
requestHandler = httpBackendService.expectPATCH(/test.local/, { key: 'value' }, { header: 'value' });
+requestHandler = httpBackendService.expectPATCH(/test.local\/(\d+)/, { key: 'value' }, { header: 'value' }, ['id']);
requestHandler = httpBackendService.expectPATCH((url: string) => { return true; });
requestHandler = httpBackendService.expectPATCH((url: string) => { return true; }, 'response data');
requestHandler = httpBackendService.expectPATCH((url: string) => { return true; }, 'response data', { header: 'value' });
@@ -216,12 +227,15 @@ requestHandler = httpBackendService.expectPOST('http://test.local', { key: 'valu
requestHandler = httpBackendService.expectPOST(/test.local/);
requestHandler = httpBackendService.expectPOST(/test.local/, 'response data');
requestHandler = httpBackendService.expectPOST(/test.local/, 'response data', { header: 'value' });
+requestHandler = httpBackendService.expectPOST(/test.local\/(\d+)/, 'response data', { header: 'value' }, ['id']);
requestHandler = httpBackendService.expectPOST(/test.local/, /response data/);
requestHandler = httpBackendService.expectPOST(/test.local/, /response data/, { header: 'value' });
+requestHandler = httpBackendService.expectPOST(/test.local\/(\d+)/, /response data/, { header: 'value' }, ['id']);
requestHandler = httpBackendService.expectPOST(/test.local/, function (data: string): boolean { return true; });
requestHandler = httpBackendService.expectPOST(/test.local/, function (data: string): boolean { return true; }, { header: 'value' });
requestHandler = httpBackendService.expectPOST(/test.local/, { key: 'value' });
requestHandler = httpBackendService.expectPOST(/test.local/, { key: 'value' }, { header: 'value' });
+requestHandler = httpBackendService.expectPOST(/test.local\/(\d+)/, { key: 'value' }, { header: 'value' }, ['id']);
requestHandler = httpBackendService.expectPOST((url: string) => { return true; });
requestHandler = httpBackendService.expectPOST((url: string) => { return true; }, 'response data');
requestHandler = httpBackendService.expectPOST((url: string) => { return true; }, 'response data', { header: 'value' });
@@ -244,12 +258,16 @@ requestHandler = httpBackendService.expectPUT('http://test.local', { key: 'value
requestHandler = httpBackendService.expectPUT(/test.local/);
requestHandler = httpBackendService.expectPUT(/test.local/, 'response data');
requestHandler = httpBackendService.expectPUT(/test.local/, 'response data', { header: 'value' });
+requestHandler = httpBackendService.expectPUT(/test.local\/(\d+)/, 'response data', { header: 'value' }, ['id']);
requestHandler = httpBackendService.expectPUT(/test.local/, /response data/);
requestHandler = httpBackendService.expectPUT(/test.local/, /response data/, { header: 'value' });
+requestHandler = httpBackendService.expectPUT(/test.local\/(\d+)/, /response data/, { header: 'value' }, ['id']);
requestHandler = httpBackendService.expectPUT(/test.local/, function (data: string): boolean { return true; });
requestHandler = httpBackendService.expectPUT(/test.local/, function (data: string): boolean { return true; }, { header: 'value' });
+requestHandler = httpBackendService.expectPUT(/test.local\/(\d+)/, function (data: string): boolean { return true; }, { header: 'value' }, ['id']);
requestHandler = httpBackendService.expectPUT(/test.local/, { key: 'value' });
requestHandler = httpBackendService.expectPUT(/test.local/, { key: 'value' }, { header: 'value' });
+requestHandler = httpBackendService.expectPUT(/test.local\/(\d+)/, { key: 'value' }, { header: 'value' }, ['id']);
requestHandler = httpBackendService.expectPUT((url: string) => { return true; });
requestHandler = httpBackendService.expectPUT((url: string) => { return true; }, 'response data');
requestHandler = httpBackendService.expectPUT((url: string) => { return true; }, 'response data', { header: 'value' });
@@ -276,16 +294,24 @@ requestHandler = httpBackendService.when('GET', 'http://test.local', { key: 'val
requestHandler = httpBackendService.when('GET', /test.local/);
requestHandler = httpBackendService.when('GET', /test.local/, 'response data');
requestHandler = httpBackendService.when('GET', /test.local/, 'response data', { header: 'value' });
+requestHandler = httpBackendService.when('GET', /test.local\/(\d+)/, 'response data', { header: 'value' }, ['id']);
requestHandler = httpBackendService.when('GET', /test.local/, 'response data', function (headers: Object): boolean { return true; });
+requestHandler = httpBackendService.when('GET', /test.local\/(\d+)/, 'response data', function (headers: Object): boolean { return true; }, ['id']);
requestHandler = httpBackendService.when('GET', /test.local/, /response data/);
requestHandler = httpBackendService.when('GET', /test.local/, /response data/, { header: 'value' });
+requestHandler = httpBackendService.when('GET', /test.local\/(\d+)/, /response data/, { header: 'value' }, ['id']);
requestHandler = httpBackendService.when('GET', /test.local/, /response data/, function (headers: Object): boolean { return true; });
+requestHandler = httpBackendService.when('GET', /test.local\/(\d+)/, /response data/, function (headers: Object): boolean { return true; }, ['id']);
requestHandler = httpBackendService.when('GET', /test.local/, function (data: string): boolean { return true; });
requestHandler = httpBackendService.when('GET', /test.local/, function (data: string): boolean { return true; }, { header: 'value' });
+requestHandler = httpBackendService.when('GET', /test.local\/(\d+)/, function (data: string): boolean { return true; }, { header: 'value' }, ['id']);
requestHandler = httpBackendService.when('GET', /test.local/, function (data: string): boolean { return true; }, function (headers: Object): boolean { return true; });
+requestHandler = httpBackendService.when('GET', /test.local\/(\d+)/, function (data: string): boolean { return true; }, function (headers: Object): boolean { return true; }, ['id']);
requestHandler = httpBackendService.when('GET', /test.local/, { key: 'value' });
requestHandler = httpBackendService.when('GET', /test.local/, { key: 'value' }, { header: 'value' });
+requestHandler = httpBackendService.when('GET', /test.local\/(\d+)/, { key: 'value' }, { header: 'value' }, ['id']);
requestHandler = httpBackendService.when('GET', /test.local/, { key: 'value' }, function (headers: Object): boolean { return true; });
+requestHandler = httpBackendService.when('GET', /test.local\/(\d+)/, { key: 'value' }, function (headers: Object): boolean { return true; }, ['id']);
requestHandler = httpBackendService.when('GET', (url: string) => { return true; });
requestHandler = httpBackendService.when('GET', (url: string) => { return true; }, 'response data');
requestHandler = httpBackendService.when('GET', (url: string) => { return true; }, 'response data', { header: 'value' });
@@ -303,17 +329,21 @@ requestHandler = httpBackendService.when('GET', (url: string) => { return true;
requestHandler = httpBackendService.whenDELETE('http://test.local');
requestHandler = httpBackendService.whenDELETE('http://test.local', { header: 'value' });
requestHandler = httpBackendService.whenDELETE(/test.local/, { header: 'value' });
+requestHandler = httpBackendService.whenDELETE(/test.local\/(\d+)/, { header: 'value' }, ['id']);
requestHandler = httpBackendService.whenDELETE((url: string) => { return true; }, { header: 'value' });
requestHandler = httpBackendService.whenGET('http://test.local');
requestHandler = httpBackendService.whenGET('http://test.local', { header: 'value' });
requestHandler = httpBackendService.whenGET(/test.local/, { header: 'value' });
+requestHandler = httpBackendService.whenGET(/test.local\/(\d+)/, { header: 'value' }, ['id']);
requestHandler = httpBackendService.whenGET((url: string) => { return true; }, { header: 'value' });
requestHandler = httpBackendService.whenHEAD('http://test.local');
requestHandler = httpBackendService.whenHEAD('http://test.local', { header: 'value' });
requestHandler = httpBackendService.whenHEAD(/test.local/, { header: 'value' });
+requestHandler = httpBackendService.whenHEAD(/test.local\/(\d+)/, { header: 'value' }, ['id']);
requestHandler = httpBackendService.whenHEAD((url: string) => { return true; }, { header: 'value' });
requestHandler = httpBackendService.whenJSONP('http://test.local');
requestHandler = httpBackendService.whenJSONP(/test.local/);
+requestHandler = httpBackendService.whenJSONP(/test.local\/(\d+)/, ['id']);
requestHandler = httpBackendService.whenJSONP((url: string) => { return true; });
requestHandler = httpBackendService.whenPATCH('http://test.local');
@@ -328,12 +358,16 @@ requestHandler = httpBackendService.whenPATCH('http://test.local', { key: 'value
requestHandler = httpBackendService.whenPATCH(/test.local/);
requestHandler = httpBackendService.whenPATCH(/test.local/, 'response data');
requestHandler = httpBackendService.whenPATCH(/test.local/, 'response data', { header: 'value' });
+requestHandler = httpBackendService.whenPATCH(/test.local\/(\d+)/, 'response data', { header: 'value' }, ['id']);
requestHandler = httpBackendService.whenPATCH(/test.local/, /response data/);
requestHandler = httpBackendService.whenPATCH(/test.local/, /response data/, { header: 'value' });
+requestHandler = httpBackendService.whenPATCH(/test.local\/(\d+)/, /response data/, { header: 'value' }, ['id']);
requestHandler = httpBackendService.whenPATCH(/test.local/, function (data: string): boolean { return true; });
requestHandler = httpBackendService.whenPATCH(/test.local/, function (data: string): boolean { return true; }, { header: 'value' });
+requestHandler = httpBackendService.whenPATCH(/test.local\/(\d+)/, function (data: string): boolean { return true; }, { header: 'value' }, ['id']);
requestHandler = httpBackendService.whenPATCH(/test.local/, { key: 'value' });
requestHandler = httpBackendService.whenPATCH(/test.local/, { key: 'value' }, { header: 'value' });
+requestHandler = httpBackendService.whenPATCH(/test.local\/(\d+)/, { key: 'value' }, { header: 'value' }, ['id']);
requestHandler = httpBackendService.whenPATCH((url: string) => { return true; });
requestHandler = httpBackendService.whenPATCH((url: string) => { return true; }, 'response data');
requestHandler = httpBackendService.whenPATCH((url: string) => { return true; }, 'response data', { header: 'value' });
@@ -356,12 +390,16 @@ requestHandler = httpBackendService.whenPOST('http://test.local', { key: 'value'
requestHandler = httpBackendService.whenPOST(/test.local/);
requestHandler = httpBackendService.whenPOST(/test.local/, 'response data');
requestHandler = httpBackendService.whenPOST(/test.local/, 'response data', { header: 'value' });
+requestHandler = httpBackendService.whenPOST(/test.local\/(\d+)/, 'response data', { header: 'value' }, ['id']);
requestHandler = httpBackendService.whenPOST(/test.local/, /response data/);
requestHandler = httpBackendService.whenPOST(/test.local/, /response data/, { header: 'value' });
+requestHandler = httpBackendService.whenPOST(/test.local\/(\d+)/, /response data/, { header: 'value' }, ['id']);
requestHandler = httpBackendService.whenPOST(/test.local/, function (data: string): boolean { return true; });
requestHandler = httpBackendService.whenPOST(/test.local/, function (data: string): boolean { return true; }, { header: 'value' });
+requestHandler = httpBackendService.whenPOST(/test.local\/(\d+)/, function (data: string): boolean { return true; }, { header: 'value' }, ['id']);
requestHandler = httpBackendService.whenPOST(/test.local/, { key: 'value' });
requestHandler = httpBackendService.whenPOST(/test.local/, { key: 'value' }, { header: 'value' });
+requestHandler = httpBackendService.whenPOST(/test.local\/(\d+)/, { key: 'value' }, { header: 'value' }, ['id']);
requestHandler = httpBackendService.whenPOST((url: string) => { return true; });
requestHandler = httpBackendService.whenPOST((url: string) => { return true; }, 'response data');
requestHandler = httpBackendService.whenPOST((url: string) => { return true; }, 'response data', { header: 'value' });
@@ -384,12 +422,16 @@ requestHandler = httpBackendService.whenPUT('http://test.local', { key: 'value'
requestHandler = httpBackendService.whenPUT(/test.local/);
requestHandler = httpBackendService.whenPUT(/test.local/, 'response data');
requestHandler = httpBackendService.whenPUT(/test.local/, 'response data', { header: 'value' });
+requestHandler = httpBackendService.whenPUT(/test.local\/(\d+)/, 'response data', { header: 'value' }, ['id']);
requestHandler = httpBackendService.whenPUT(/test.local/, /response data/);
requestHandler = httpBackendService.whenPUT(/test.local/, /response data/, { header: 'value' });
+requestHandler = httpBackendService.whenPUT(/test.local\/(\d+)/, /response data/, { header: 'value' }, ['id']);
requestHandler = httpBackendService.whenPUT(/test.local/, function (data: string): boolean { return true; });
requestHandler = httpBackendService.whenPUT(/test.local/, function (data: string): boolean { return true; }, { header: 'value' });
+requestHandler = httpBackendService.whenPUT(/test.local\/(\d+)/, function (data: string): boolean { return true; }, { header: 'value' }, ['id']);
requestHandler = httpBackendService.whenPUT(/test.local/, { key: 'value' });
requestHandler = httpBackendService.whenPUT(/test.local/, { key: 'value' }, { header: 'value' });
+requestHandler = httpBackendService.whenPUT(/test.local\/(\d+)/, { key: 'value' }, { header: 'value' }, ['id']);
requestHandler = httpBackendService.whenPUT((url: string) => { return true; });
requestHandler = httpBackendService.whenPUT((url: string) => { return true; }, 'response data');
requestHandler = httpBackendService.whenPUT((url: string) => { return true; }, 'response data', { header: 'value' });
@@ -410,6 +452,13 @@ requestHandler.passThrough().passThrough();
requestHandler.respond((method, url, data, headers) => [404, 'data', { header: 'value' }, 'responseText']);
requestHandler.respond((method, url, data, headers) => [404, 'data', { header: 'value' }, 'responseText']).respond({});
requestHandler.respond((method, url, data, headers) => { return [404, { key: 'value' }, { header: 'value' }, 'responseText']; });
+requestHandler.respond((method, url, data, headers, params) => {
+ if(params.id === 1) {
+ return [200, { key: 'value'}, { header: 'value'}, 'responseText'];
+ } else {
+ return [404, { key: 'value' }, { header: 'value' }, 'responseText'];
+ }
+});
requestHandler.respond('data');
requestHandler.respond('data').respond({});
requestHandler.respond(expectedData);
diff --git a/angularjs/angular-mocks.d.ts b/angularjs/angular-mocks.d.ts
index 9031cc56d1..d1b204862f 100644
--- a/angularjs/angular-mocks.d.ts
+++ b/angularjs/angular-mocks.d.ts
@@ -1,4 +1,4 @@
-// Type definitions for Angular JS 1.3 (ngMock, ngMockE2E module)
+// Type definitions for Angular JS 1.5 (ngMock, ngMockE2E module)
// Project: http://angularjs.org
// Definitions by: Diego Vilar , Tony Curtis
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -157,8 +157,9 @@ declare namespace angular {
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
+ * @param keys Array of keys to assign to regex matches in the request url.
*/
- expect(method: string, url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean)) :mock.IRequestHandler;
+ expect(method: string, url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean), keys?: Object[]) :mock.IRequestHandler;
/**
* Creates a new request expectation for DELETE requests.
@@ -166,8 +167,9 @@ declare namespace angular {
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url is as expected.
* @param headers HTTP headers object to be compared with the HTTP headers in the request.
+ * @param keys Array of keys to assign to regex matches in the request url.
*/
- expectDELETE(url: string | RegExp | ((url: string) => boolean), headers?: Object): mock.IRequestHandler;
+ expectDELETE(url: string | RegExp | ((url: string) => boolean), headers?: Object, keys?: Object[]): mock.IRequestHandler;
/**
* Creates a new request expectation for GET requests.
@@ -175,8 +177,9 @@ declare namespace angular {
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param headers HTTP headers object to be compared with the HTTP headers in the request.
+ * @param keys Array of keys to assign to regex matches in the request url.
*/
- expectGET(url: string | RegExp | ((url: string) => boolean), headers?: Object): mock.IRequestHandler;
+ expectGET(url: string | RegExp | ((url: string) => boolean), headers?: Object, keys?: Object[]): mock.IRequestHandler;
/**
* Creates a new request expectation for HEAD requests.
@@ -184,16 +187,19 @@ declare namespace angular {
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param headers HTTP headers object to be compared with the HTTP headers in the request.
+ * @param keys Array of keys to assign to regex matches in the request url.
*/
- expectHEAD(url: string | RegExp | ((url: string) => boolean), headers?: Object): mock.IRequestHandler;
+ expectHEAD(url: string | RegExp | ((url: string) => boolean), headers?: Object, keys?: Object[]): mock.IRequestHandler;
+
/**
* Creates a new request expectation for JSONP requests.
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, or if function returns false.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
- */
- expectJSONP(url: string | RegExp | ((url: string) => boolean)): mock.IRequestHandler;
+ * @param keys Array of keys to assign to regex matches in the request url.
+ */
+ expectJSONP(url: string | RegExp | ((url: string) => boolean), keys?: Object[]): mock.IRequestHandler;
/**
* Creates a new request expectation for PATCH requests.
@@ -202,8 +208,9 @@ declare namespace angular {
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
+ * @param keys Array of keys to assign to regex matches in the request url.
*/
- expectPATCH(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object): mock.IRequestHandler;
+ expectPATCH(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object, keys?: Object[]): mock.IRequestHandler;
/**
* Creates a new request expectation for POST requests.
@@ -212,8 +219,9 @@ declare namespace angular {
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
+ * @param keys Array of keys to assign to regex matches in the request url.
*/
- expectPOST(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object): mock.IRequestHandler;
+ expectPOST(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object, keys?: Object[]): mock.IRequestHandler;
/**
* Creates a new request expectation for PUT requests.
@@ -222,8 +230,9 @@ declare namespace angular {
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
+ * @param keys Array of keys to assign to regex matches in the request url.
*/
- expectPUT(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object): mock.IRequestHandler;
+ expectPUT(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object, keys?: Object[]): mock.IRequestHandler;
/**
* Creates a new backend definition.
@@ -232,40 +241,46 @@ declare namespace angular {
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
+ * @param keys Array of keys to assign to regex matches in the request url.
*/
- when(method: string, url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler;
+ when(method: string, url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean), keys?: Object[]): mock.IRequestHandler;
/**
* Creates a new backend definition for DELETE requests.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
+ * @param keys Array of keys to assign to regex matches in the request url.
*/
- whenDELETE(url: string | RegExp | ((url: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler;
+ whenDELETE(url: string | RegExp | ((url: string) => boolean), headers?: Object | ((object: Object) => boolean), keys?: Object[]): mock.IRequestHandler;
/**
* Creates a new backend definition for GET requests.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
+ * @param keys Array of keys to assign to regex matches in request url described above
+ * @param keys Array of keys to assign to regex matches in the request url.
*/
- whenGET(url: string | RegExp | ((url: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler;
+ whenGET(url: string | RegExp | ((url: string) => boolean), headers?: Object | ((object: Object) => boolean), keys?: Object[]): mock.IRequestHandler;
/**
* Creates a new backend definition for HEAD requests.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
+ * @param keys Array of keys to assign to regex matches in the request url.
*/
- whenHEAD(url: string | RegExp | ((url: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler;
+ whenHEAD(url: string | RegExp | ((url: string) => boolean), headers?: Object | ((object: Object) => boolean), keys?: Object[]): mock.IRequestHandler;
/**
* Creates a new backend definition for JSONP requests.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
+ * @param keys Array of keys to assign to regex matches in the request url.
*/
- whenJSONP(url: string | RegExp | ((url: string) => boolean)): mock.IRequestHandler;
+ whenJSONP(url: string | RegExp | ((url: string) => boolean), keys?: Object[]): mock.IRequestHandler;
/**
* Creates a new backend definition for PATCH requests.
@@ -273,8 +288,9 @@ declare namespace angular {
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
+ * @param keys Array of keys to assign to regex matches in the request url.
*/
- whenPATCH(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler;
+ whenPATCH(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean), keys?: Object[]): mock.IRequestHandler;
/**
* Creates a new backend definition for POST requests.
@@ -282,8 +298,9 @@ declare namespace angular {
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
+ * @param keys Array of keys to assign to regex matches in the request url.
*/
- whenPOST(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler;
+ whenPOST(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean), keys?: Object[]): mock.IRequestHandler;
/**
* Creates a new backend definition for PUT requests.
@@ -291,8 +308,9 @@ declare namespace angular {
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
+ * @param keys Array of keys to assign to regex matches in the request url.
*/
- whenPUT(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler;
+ whenPUT(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean), keys?: Object[]): mock.IRequestHandler;
}
export module mock {
@@ -302,9 +320,9 @@ declare namespace angular {
/**
* Controls the response for a matched request using a function to construct the response.
* Returns the RequestHandler object for possible overrides.
- * @param func Function that receives the request HTTP method, url, data, and headers and returns an array containing response status (number), data, headers, and status text.
+ * @param func Function that receives the request HTTP method, url, data, headers, and an array of keys to regex matches in the request url and returns an array containing response status (number), data, headers, and status text.
*/
- respond(func: ((method: string, url: string, data: string | Object, headers: Object) => [number, string | Object, Object, string])): IRequestHandler;
+ respond(func: ((method: string, url: string, data: string | Object, headers: Object, params?: any) => [number, string | Object, Object, string])): IRequestHandler;
/**
* Controls the response for a matched request using supplied static data to construct the response.
diff --git a/angularjs/angular-resource.d.ts b/angularjs/angular-resource.d.ts
index 0fb9351342..441a7e1d3d 100644
--- a/angularjs/angular-resource.d.ts
+++ b/angularjs/angular-resource.d.ts
@@ -95,7 +95,7 @@ declare namespace angular.resource {
(params: Object, data: Object, success?: Function, error?: Function): IResourceArray;
}
- // Baseclass for everyresource with default actions.
+ // Baseclass for every resource with default actions.
// If you define your new actions for the resource, you will need
// to extend this interface and typecast the ResourceClass to it.
//
@@ -113,7 +113,7 @@ declare namespace angular.resource {
// Also, static calls always return the IResource (or IResourceArray) retrieved
// https://github.com/angular/angular.js/blob/v1.2.0/src/ngResource/resource.js#L538-L549
interface IResourceClass {
- new(dataOrParams? : any) : T;
+ new(dataOrParams? : any) : T & IResource;
get: IResourceMethod;
query: IResourceArrayMethod;
diff --git a/angularjs/angular-tests.ts b/angularjs/angular-tests.ts
index 0539ae62ac..ef3e29b4c8 100644
--- a/angularjs/angular-tests.ts
+++ b/angularjs/angular-tests.ts
@@ -476,6 +476,8 @@ function test_angular_forEach() {
var element = angular.element("div.myApp");
var scope: ng.IScope = element.scope();
var isolateScope: ng.IScope = element.isolateScope();
+isolateScope = element.find('div.foo').isolateScope();
+isolateScope = element.children().isolateScope();
// $timeout signature tests
@@ -867,7 +869,7 @@ angular.module('docsTabsExample', [])
angular.module('componentExample', [])
.component('counter', {
- require: ['^ctrl'],
+ require: {'ctrl': '^ctrl'},
bindings: {
count: '='
},
@@ -1096,6 +1098,12 @@ function parseTyping() {
}
}
+function parseWithParams() {
+ var $parse: angular.IParseService;
+ var compiledExp = $parse('a.b.c', () => null);
+ var compiledExp = $parse('a.b.c', null, false);
+}
+
function doBootstrap(element: Element | JQuery, mode: string): ng.auto.IInjectorService {
if (mode === 'debug') {
return angular.bootstrap(element, ['main', function($provide: ng.auto.IProvideService) {
@@ -1103,11 +1111,11 @@ function doBootstrap(element: Element | JQuery, mode: string): ng.auto.IInjector
$delegate['debug'] = true;
});
}, 'debug-helpers'], {
- debugInfoEnabled: true
+ strictDi: true
});
}
return angular.bootstrap(element, ['main'], {
- debugInfoEnabled: false
+ strictDi: false
});
}
diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts
index 3d2b248637..e64496604f 100644
--- a/angularjs/angular.d.ts
+++ b/angularjs/angular.d.ts
@@ -41,7 +41,6 @@ declare namespace angular {
interface IAngularBootstrapConfig {
strictDi?: boolean;
- debugInfoEnabled?: boolean;
}
///////////////////////////////////////////////////////////////////////////
@@ -81,7 +80,7 @@ declare namespace angular {
*
* If jQuery is available, angular.element is an alias for the jQuery function. If jQuery is not available, angular.element delegates to Angular's built-in subset of jQuery, called "jQuery lite" or "jqLite."
*/
- element: IAugmentedJQueryStatic;
+ element: JQueryStatic;
equals(value1: any, value2: any): boolean;
extend(destination: any, ...sources: any[]): any;
@@ -119,14 +118,14 @@ declare namespace angular {
fromJson(json: string): any;
identity(arg?: T): T;
injector(modules?: any[], strictDi?: boolean): auto.IInjectorService;
- isArray(value: any): boolean;
- isDate(value: any): boolean;
+ isArray(value: any): value is Array;
+ isDate(value: any): value is Date;
isDefined(value: any): boolean;
isElement(value: any): boolean;
- isFunction(value: any): boolean;
- isNumber(value: any): boolean;
- isObject(value: any): boolean;
- isString(value: any): boolean;
+ isFunction(value: any): value is Function;
+ isNumber(value: any): value is number;
+ isObject(value: any): value is Object;
+ isString(value: any): value is string;
isUndefined(value: any): boolean;
lowercase(str: string): string;
@@ -156,7 +155,7 @@ declare namespace angular {
noop(...args: any[]): void;
reloadWithDebugInfo(): void;
- toJson(obj: any, pretty?: boolean): string;
+ toJson(obj: any, pretty?: boolean | number): string;
uppercase(str: string): string;
version: {
full: string;
@@ -388,10 +387,11 @@ declare namespace angular {
$invalid: boolean;
$submitted: boolean;
$error: any;
+ $name: string;
$pending: any;
- $addControl(control: INgModelController): void;
- $removeControl(control: INgModelController): void;
- $setValidity(validationErrorKey: string, isValid: boolean, control: INgModelController): void;
+ $addControl(control: INgModelController | IFormController): void;
+ $removeControl(control: INgModelController | IFormController): void;
+ $setValidity(validationErrorKey: string, isValid: boolean, control: INgModelController | IFormController): void;
$setDirty(): void;
$setPristine(): void;
$commitViewValue(): void;
@@ -874,7 +874,7 @@ declare namespace angular {
// see http://docs.angularjs.org/api/ng.$parseProvider
///////////////////////////////////////////////////////////////////////////
interface IParseService {
- (expression: string): ICompiledExpression;
+ (expression: string, interceptorFn?: (value: any, scope: IScope, locals: any) => any, expensiveChecks?: boolean): ICompiledExpression;
}
interface IParseProvider {
@@ -883,6 +883,24 @@ declare namespace angular {
unwrapPromises(): boolean;
unwrapPromises(value: boolean): IParseProvider;
+
+ /**
+ * Configure $parse service to add literal values that will be present as literal at expressions.
+ *
+ * @param literalName Token for the literal value. The literal name value must be a valid literal name.
+ * @param literalValue Value for this literal. All literal values must be primitives or `undefined`.
+ **/
+ addLiteral(literalName: string, literalValue: any): void;
+
+ /**
+ * Allows defining the set of characters that are allowed in Angular expressions. The function identifierStart will get called to know if a given character is a valid character to be the first character for an identifier. The function identifierContinue will get called to know if a given character is a valid character to be a follow-up identifier character. The functions identifierStart and identifierContinue will receive as arguments the single character to be identifier and the character code point. These arguments will be string and numeric. Keep in mind that the string parameter can be two characters long depending on the character representation. It is expected for the function to return true or false, whether that character is allowed or not.
+ * Since this function will be called extensivelly, keep the implementation of these functions fast, as the performance of these functions have a direct impact on the expressions parsing speed.
+ *
+ * @param identifierStart The function that will decide whether the given character is a valid identifier start character.
+ * @param identifierContinue The function that will decide whether the given character is a valid identifier continue character.
+ **/
+ setIdentifierFns(identifierStart?: (character: string, codePoint: number) => boolean,
+ identifierContinue?: (character: string, codePoint: number) => boolean): void;
}
interface ICompiledExpression {
@@ -968,7 +986,10 @@ declare namespace angular {
// DocumentService
// see http://docs.angularjs.org/api/ng.$document
///////////////////////////////////////////////////////////////////////////
- interface IDocumentService extends IAugmentedJQuery {}
+ interface IDocumentService extends JQuery {
+ // Must return intersection type for index signature compatibility with JQuery
+ [index: number]: HTMLElement & Document;
+ }
///////////////////////////////////////////////////////////////////////////
// ExceptionHandlerService
@@ -1231,15 +1252,15 @@ declare namespace angular {
// This corresponds to the "publicLinkFn" returned by $compile.
interface ITemplateLinkingFunction {
- (scope: IScope, cloneAttachFn?: ICloneAttachFunction): IAugmentedJQuery;
+ (scope: IScope, cloneAttachFn?: ICloneAttachFunction): JQuery;
}
// This corresponds to $transclude (and also the transclude function passed to link).
interface ITranscludeFunction {
// If the scope is provided, then the cloneAttachFn must be as well.
- (scope: IScope, cloneAttachFn: ICloneAttachFunction): IAugmentedJQuery;
+ (scope: IScope, cloneAttachFn: ICloneAttachFunction): JQuery;
// If one argument is provided, then it's assumed to be the cloneAttachFn.
- (cloneAttachFn?: ICloneAttachFunction): IAugmentedJQuery;
+ (cloneAttachFn?: ICloneAttachFunction): JQuery;
}
///////////////////////////////////////////////////////////////////////////
@@ -1656,50 +1677,6 @@ declare namespace angular {
// see http://angularjs.blogspot.com.br/2015/11/angularjs-15-beta2-and-14-releases.html
// and http://toddmotto.com/exploring-the-angular-1-5-component-method/
///////////////////////////////////////////////////////////////////////////
- /**
- * Runtime representation a type that a Component or other object is instances of.
- *
- * An example of a `Type` is `MyCustomComponent` class, which in JavaScript is be represented by
- * the `MyCustomComponent` constructor function.
- */
- interface Type extends Function {
- }
-
- /**
- * `RouteDefinition` defines a route within a {@link RouteConfig} decorator.
- *
- * Supported keys:
- * - `path` or `aux` (requires exactly one of these)
- * - `component`, `loader`, `redirectTo` (requires exactly one of these)
- * - `name` or `as` (optional) (requires exactly one of these)
- * - `data` (optional)
- *
- * See also {@link Route}, {@link AsyncRoute}, {@link AuxRoute}, and {@link Redirect}.
- */
- interface RouteDefinition {
- path?: string;
- aux?: string;
- component?: Type | ComponentDefinition | string;
- loader?: Function;
- redirectTo?: any[];
- as?: string;
- name?: string;
- data?: any;
- useAsDefault?: boolean;
- }
-
- /**
- * Represents either a component type (`type` is `component`) or a loader function
- * (`type` is `loader`).
- *
- * See also {@link RouteDefinition}.
- */
- interface ComponentDefinition {
- type: string;
- loader?: Function;
- component?: Type;
- }
-
/**
* Component definition object (a simplified directive definition object)
*/
@@ -1709,7 +1686,7 @@ declare namespace angular {
* controller if passed as a string. Empty function by default.
* Use the array form to define dependencies (necessary if strictDi is enabled and you require dependency injection)
*/
- controller?: string | Function | (string | Function)[];
+ controller?: string | Function | (string | Function)[] | IComponentController;
/**
* An identifier name for a reference to the controller. If present, the controller will be published to scope under
* the controllerAs name. If not present, this will default to be the same as the component name.
@@ -1742,11 +1719,58 @@ declare namespace angular {
* Whether transclusion is enabled. Enabled by default.
*/
transclude?: boolean | string | {[slot: string]: string};
- require?: string | string[] | {[controller: string]: string};
+ /**
+ * Requires the controllers of other directives and binds them to this component's controller.
+ * The object keys specify the property names under which the required controllers (object values) will be bound.
+ * Note that the required controllers will not be available during the instantiation of the controller,
+ * but they are guaranteed to be available just before the $onInit method is executed!
+ */
+ require?: {[controller: string]: string};
}
interface IComponentTemplateFn {
- ( $element?: IAugmentedJQuery, $attrs?: IAttributes ): string;
+ ( $element?: JQuery, $attrs?: IAttributes ): string;
+ }
+
+ /**
+ * Components have a well-defined lifecycle Each component can implement "lifecycle hooks". These are methods that
+ * will be called at certain points in the life of the component.
+ * @url https://docs.angularjs.org/guide/component
+ */
+ interface IComponentController {
+ /**
+ * Called on each controller after all the controllers on an element have been constructed and had their bindings
+ * initialized (and before the pre & post linking functions for the directives on this element). This is a good
+ * place to put initialization code for your controller.
+ */
+ $onInit?(): void;
+ /**
+ * Called whenever one-way bindings are updated. The changesObj is a hash whose keys are the names of the bound
+ * properties that have changed, and the values are an {@link IChangesObject} object of the form
+ * { currentValue, previousValue, isFirstChange() }. Use this hook to trigger updates within a component such as
+ * cloning the bound value to prevent accidental mutation of the outer value.
+ */
+ $onChanges?(changesObj: {[property:string]: IChangesObject}): void;
+ /**
+ * Called on a controller when its containing scope is destroyed. Use this hook for releasing external resources,
+ * watches and event handlers.
+ */
+ $onDestroy?(): void;
+ /**
+ * Called after this controller's element and its children have been linked. Similar to the post-link function this
+ * hook can be used to set up DOM event handlers and do direct DOM manipulation. Note that child elements that contain
+ * templateUrl directives will not have been compiled and linked since they are waiting for their template to load
+ * asynchronously and their own compilation and linking has been suspended until that occurs. This hook can be considered
+ * analogous to the ngAfterViewInit and ngAfterContentInit hooks in Angular 2. Since the compilation process is rather
+ * different in Angular 1 there is no direct mapping and care should be taken when upgrading.
+ */
+ $postLink?(): void;
+ }
+
+ interface IChangesObject {
+ currentValue: any;
+ previousValue: any;
+ isFirstChange(): boolean;
}
///////////////////////////////////////////////////////////////////////////
@@ -1762,7 +1786,7 @@ declare namespace angular {
interface IDirectiveLinkFn {
(
scope: IScope,
- instanceElement: IAugmentedJQuery,
+ instanceElement: JQuery,
instanceAttributes: IAttributes,
controller: {},
transclude: ITranscludeFunction
@@ -1776,7 +1800,7 @@ declare namespace angular {
interface IDirectiveCompileFn {
(
- templateElement: IAugmentedJQuery,
+ templateElement: JQuery,
templateAttributes: IAttributes,
/**
* @deprecated
@@ -1785,7 +1809,7 @@ declare namespace angular {
* that is passed to the link function instead.
*/
transclude: ITranscludeFunction
- ): IDirectivePrePost;
+ ): void | IDirectivePrePost;
}
interface IDirective {
@@ -1818,44 +1842,14 @@ declare namespace angular {
}
/**
- * angular.element
- * when calling angular.element, angular returns a jQuery object,
- * augmented with additional methods like e.g. scope.
- * see: http://docs.angularjs.org/api/angular.element
+ * These interfaces are kept for compatibility with older versions of these type definitions.
+ * Actually, Angular doesn't create a special subclass of jQuery objects. It extends jQuery.prototype
+ * like jQuery plugins do, that's why all jQuery objects have these Angular-specific methods, not
+ * only those returned from angular.element.
+ * See: http://docs.angularjs.org/api/angular.element
*/
- interface IAugmentedJQueryStatic extends JQueryStatic {
- (selector: string, context?: any): IAugmentedJQuery;
- (element: Element): IAugmentedJQuery;
- (object: {}): IAugmentedJQuery;
- (elementArray: Element[]): IAugmentedJQuery;
- (object: JQuery): IAugmentedJQuery;
- (func: Function): IAugmentedJQuery;
- (array: any[]): IAugmentedJQuery;
- (): IAugmentedJQuery;
- }
-
- interface IAugmentedJQuery extends JQuery {
- // TODO: events, how to define?
- //$destroy
-
- find(selector: string): IAugmentedJQuery;
- find(element: any): IAugmentedJQuery;
- find(obj: JQuery): IAugmentedJQuery;
- controller(): any;
- controller(name: string): any;
- injector(): any;
- scope(): IScope;
-
- /**
- * Overload for custom scope interfaces
- */
- scope(): T;
- isolateScope(): IScope;
-
- inheritedData(key: string, value: any): JQuery;
- inheritedData(obj: { [key: string]: any; }): JQuery;
- inheritedData(key?: string): any;
- }
+ interface IAugmentedJQueryStatic extends JQueryStatic {}
+ interface IAugmentedJQuery extends JQuery {}
///////////////////////////////////////////////////////////////////////////
// AUTO module (angular.js)
@@ -1870,6 +1864,33 @@ declare namespace angular {
annotate(fn: Function, strictDi?: boolean): string[];
annotate(inlineAnnotatedFunction: any[]): string[];
get(name: string, caller?: string): T;
+ get(name: '$anchorScroll'): IAnchorScrollService
+ get(name: '$cacheFactory'): ICacheFactoryService
+ get(name: '$compile'): ICompileService
+ get(name: '$controller'): IControllerService
+ get(name: '$document'): IDocumentService
+ get(name: '$exceptionHandler'): IExceptionHandlerService
+ get(name: '$filter'): IFilterService
+ get(name: '$http'): IHttpService
+ get(name: '$httpBackend'): IHttpBackendService
+ get(name: '$httpParamSerializer'): IHttpParamSerializer
+ get(name: '$httpParamSerializerJQLike'): IHttpParamSerializer
+ get(name: '$interpolate'): IInterpolateService
+ get(name: '$interval'): IIntervalService
+ get(name: '$locale'): ILocaleService
+ get(name: '$location'): ILocationService
+ get(name: '$log'): ILogService
+ get(name: '$parse'): IParseService
+ get(name: '$q'): IQService
+ get(name: '$rootElement'): IRootElementService
+ get(name: '$rootScope'): IRootScopeService
+ get(name: '$sce'): ISCEService
+ get(name: '$sceDelegate'): ISCEDelegateService
+ get(name: '$templateCache'): ITemplateCacheService
+ get(name: '$templateRequest'): ITemplateRequestService
+ get(name: '$timeout'): ITimeoutService
+ get(name: '$window'): IWindowService
+ get(name: '$xhrFactory'): IXhrFactory
has(name: string): boolean;
instantiate(typeConstructor: Function, locals?: any): T;
invoke(inlineAnnotatedFunction: any[]): any;
@@ -1930,3 +1951,20 @@ declare namespace angular {
(obj: Object): string;
}
}
+
+interface JQuery {
+ // TODO: events, how to define?
+ //$destroy
+
+ find(element: any): JQuery;
+ find(obj: JQuery): JQuery;
+ controller(name?: string): any;
+ injector(): ng.auto.IInjectorService;
+ /** It's declared generic for custom scope interfaces */
+ scope(): T;
+ isolateScope(): T;
+
+ inheritedData(key: string, value: any): JQuery;
+ inheritedData(obj: { [key: string]: any; }): JQuery;
+ inheritedData(key?: string): any;
+}
diff --git a/angularjs/legacy/angular-1.4.d.ts b/angularjs/legacy/angular-1.4.d.ts
index 22c504712e..2cb129dca1 100644
--- a/angularjs/legacy/angular-1.4.d.ts
+++ b/angularjs/legacy/angular-1.4.d.ts
@@ -886,7 +886,7 @@ declare namespace angular {
// see http://docs.angularjs.org/api/ng.$parseProvider
///////////////////////////////////////////////////////////////////////////
interface IParseService {
- (expression: string): ICompiledExpression;
+ (expression: string, interceptorFn?: (value: any, scope: IScope, locals: any) => any, expensiveChecks?: boolean): ICompiledExpression;
}
interface IParseProvider {
diff --git a/angularjs/legacy/angular-mocks-1.3-tests.ts b/angularjs/legacy/angular-mocks-1.3-tests.ts
new file mode 100644
index 0000000000..3a3db64470
--- /dev/null
+++ b/angularjs/legacy/angular-mocks-1.3-tests.ts
@@ -0,0 +1,403 @@
+///
+
+///////////////////////////////////////
+// IAngularStatic
+///////////////////////////////////////
+var angular: ng.IAngularStatic;
+var mock: ng.IMockStatic;
+
+mock = angular.mock;
+
+
+///////////////////////////////////////
+// IMockStatic
+///////////////////////////////////////
+var date: Date;
+
+mock.dump({ key: 'value' });
+
+mock.inject(
+ function () { return 1; },
+ function () { return 2; }
+ );
+
+mock.inject(
+ ['$rootScope', function ($rootScope: ng.IRootScopeService) { return 1; }]);
+
+// This overload is not documented on the website, but flows from
+// how the injector works.
+mock.inject(
+ ['$rootScope', function ($rootScope: ng.IRootScopeService) { return 1; }],
+ ['$rootScope', function ($rootScope: ng.IRootScopeService) { return 2; }]);
+
+mock.module('module1', 'module2');
+mock.module(
+ function () { return 1; },
+ function () { return 2; }
+ );
+mock.module({ module1: function () { return 1; } });
+
+date = mock.TzDate(-7, '2013-1-1T15:00:00Z');
+date = mock.TzDate(-8, 12345678);
+
+
+///////////////////////////////////////
+// IExceptionHandlerProvider
+///////////////////////////////////////
+var exceptionHandlerProvider: ng.IExceptionHandlerProvider;
+
+exceptionHandlerProvider.mode('log');
+
+
+///////////////////////////////////////
+// ITimeoutService
+///////////////////////////////////////
+var timeoutService: ng.ITimeoutService;
+
+timeoutService.flush();
+timeoutService.flush(1234);
+timeoutService.flushNext();
+timeoutService.flushNext(1234);
+timeoutService.verifyNoPendingTasks();
+
+////////////////////////////////////////
+// IIntervalService
+////////////////////////////////////////
+var intervalService: ng.IIntervalService;
+var intervalServiceTimeActuallyAdvanced: number;
+
+intervalServiceTimeActuallyAdvanced = intervalService.flush();
+intervalServiceTimeActuallyAdvanced = intervalService.flush(1234);
+
+///////////////////////////////////////
+// ILogService, ILogCall
+///////////////////////////////////////
+var logService: ng.ILogService;
+var logCall: ng.ILogCall;
+var logs: string[];
+
+logService.assertEmpty();
+logService.reset();
+
+logCall = logService.debug;
+logCall = logService.error;
+logCall = logService.info;
+logCall = logService.log;
+logCall = logService.warn;
+
+logs = logCall.logs;
+
+
+///////////////////////////////////////
+// IHttpBackendService
+///////////////////////////////////////
+var httpBackendService: ng.IHttpBackendService;
+var requestHandler: ng.mock.IRequestHandler;
+
+httpBackendService.flush();
+httpBackendService.flush(1234);
+httpBackendService.resetExpectations();
+httpBackendService.verifyNoOutstandingExpectation();
+httpBackendService.verifyNoOutstandingRequest();
+
+requestHandler = httpBackendService.expect('GET', 'http://test.local');
+requestHandler = httpBackendService.expect('GET', 'http://test.local', 'response data');
+requestHandler = httpBackendService.expect('GET', 'http://test.local', 'response data', { header: 'value' });
+requestHandler = httpBackendService.expect('GET', 'http://test.local', 'response data', function (headers: Object): boolean { return true; });
+requestHandler = httpBackendService.expect('GET', 'http://test.local', /response data/);
+requestHandler = httpBackendService.expect('GET', 'http://test.local', /response data/, { header: 'value' });
+requestHandler = httpBackendService.expect('GET', 'http://test.local', /response data/, function (headers: Object): boolean { return true; });
+requestHandler = httpBackendService.expect('GET', 'http://test.local', function (data: string): boolean { return true; });
+requestHandler = httpBackendService.expect('GET', 'http://test.local', function (data: string): boolean { return true; }, { header: 'value' });
+requestHandler = httpBackendService.expect('GET', 'http://test.local', function (data: string): boolean { return true; }, function (headers: Object): boolean { return true; });
+requestHandler = httpBackendService.expect('GET', 'http://test.local', { key: 'value' });
+requestHandler = httpBackendService.expect('GET', 'http://test.local', { key: 'value' }, { header: 'value' });
+requestHandler = httpBackendService.expect('GET', 'http://test.local', { key: 'value' }, function (headers: Object): boolean { return true; });
+requestHandler = httpBackendService.expect('GET', /test.local/);
+requestHandler = httpBackendService.expect('GET', /test.local/, 'response data');
+requestHandler = httpBackendService.expect('GET', /test.local/, 'response data', { header: 'value' });
+requestHandler = httpBackendService.expect('GET', /test.local/, 'response data', function (headers: Object): boolean { return true; });
+requestHandler = httpBackendService.expect('GET', /test.local/, /response data/);
+requestHandler = httpBackendService.expect('GET', /test.local/, /response data/, { header: 'value' });
+requestHandler = httpBackendService.expect('GET', /test.local/, /response data/, function (headers: Object): boolean { return true; });
+requestHandler = httpBackendService.expect('GET', /test.local/, function (data: string): boolean { return true; });
+requestHandler = httpBackendService.expect('GET', /test.local/, function (data: string): boolean { return true; }, { header: 'value' });
+requestHandler = httpBackendService.expect('GET', /test.local/, function (data: string): boolean { return true; }, function (headers: Object): boolean { return true; });
+requestHandler = httpBackendService.expect('GET', /test.local/, { key: 'value' });
+requestHandler = httpBackendService.expect('GET', /test.local/, { key: 'value' }, { header: 'value' });
+requestHandler = httpBackendService.expect('GET', /test.local/, { key: 'value' }, function (headers: Object): boolean { return true; });
+requestHandler = httpBackendService.expect('GET', (url: string) => { return true; });
+requestHandler = httpBackendService.expect('GET', (url: string) => { return true; }, 'response data');
+requestHandler = httpBackendService.expect('GET', (url: string) => { return true; }, 'response data', { header: 'value' });
+requestHandler = httpBackendService.expect('GET', (url: string) => { return true; }, 'response data', function (headers: Object): boolean { return true; });
+requestHandler = httpBackendService.expect('GET', (url: string) => { return true; }, /response data/);
+requestHandler = httpBackendService.expect('GET', (url: string) => { return true; }, /response data/, { header: 'value' });
+requestHandler = httpBackendService.expect('GET', (url: string) => { return true; }, /response data/, function (headers: Object): boolean { return true; });
+requestHandler = httpBackendService.expect('GET', (url: string) => { return true; }, function (data: string): boolean { return true; });
+requestHandler = httpBackendService.expect('GET', (url: string) => { return true; }, function (data: string): boolean { return true; }, { header: 'value' });
+requestHandler = httpBackendService.expect('GET', (url: string) => { return true; }, function (data: string): boolean { return true; }, function (headers: Object): boolean { return true; });
+requestHandler = httpBackendService.expect('GET', (url: string) => { return true; }, { key: 'value' });
+requestHandler = httpBackendService.expect('GET', (url: string) => { return true; }, { key: 'value' }, { header: 'value' });
+requestHandler = httpBackendService.expect('GET', (url: string) => { return true; }, { key: 'value' }, function (headers: Object): boolean { return true; });
+
+requestHandler = httpBackendService.expectDELETE('http://test.local');
+requestHandler = httpBackendService.expectDELETE('http://test.local', { header: 'value' });
+requestHandler = httpBackendService.expectDELETE(/test.local/, { header: 'value' });
+requestHandler = httpBackendService.expectDELETE((url: string) => { return true; }, { header: 'value' });
+requestHandler = httpBackendService.expectGET('http://test.local');
+requestHandler = httpBackendService.expectGET('http://test.local', { header: 'value' });
+requestHandler = httpBackendService.expectGET(/test.local/, { header: 'value' });
+requestHandler = httpBackendService.expectGET((url: string) => { return true; }, { header: 'value' });
+requestHandler = httpBackendService.expectHEAD('http://test.local');
+requestHandler = httpBackendService.expectHEAD('http://test.local', { header: 'value' });
+requestHandler = httpBackendService.expectHEAD(/test.local/, { header: 'value' });
+requestHandler = httpBackendService.expectHEAD((url: string) => { return true; }, { header: 'value' });
+requestHandler = httpBackendService.expectJSONP('http://test.local');
+requestHandler = httpBackendService.expectJSONP(/test.local/);
+requestHandler = httpBackendService.expectJSONP((url: string) => { return true; });
+
+requestHandler = httpBackendService.expectPATCH('http://test.local');
+requestHandler = httpBackendService.expectPATCH('http://test.local', 'response data');
+requestHandler = httpBackendService.expectPATCH('http://test.local', 'response data', { header: 'value' });
+requestHandler = httpBackendService.expectPATCH('http://test.local', /response data/);
+requestHandler = httpBackendService.expectPATCH('http://test.local', /response data/, { header: 'value' });
+requestHandler = httpBackendService.expectPATCH('http://test.local', function (data: string): boolean { return true; });
+requestHandler = httpBackendService.expectPATCH('http://test.local', function (data: string): boolean { return true; }, { header: 'value' });
+requestHandler = httpBackendService.expectPATCH('http://test.local', { key: 'value' });
+requestHandler = httpBackendService.expectPATCH('http://test.local', { key: 'value' }, { header: 'value' });
+requestHandler = httpBackendService.expectPATCH(/test.local/);
+requestHandler = httpBackendService.expectPATCH(/test.local/, 'response data');
+requestHandler = httpBackendService.expectPATCH(/test.local/, 'response data', { header: 'value' });
+requestHandler = httpBackendService.expectPATCH(/test.local/, /response data/);
+requestHandler = httpBackendService.expectPATCH(/test.local/, /response data/, { header: 'value' });
+requestHandler = httpBackendService.expectPATCH(/test.local/, function (data: string): boolean { return true; });
+requestHandler = httpBackendService.expectPATCH(/test.local/, function (data: string): boolean { return true; }, { header: 'value' });
+requestHandler = httpBackendService.expectPATCH(/test.local/, { key: 'value' });
+requestHandler = httpBackendService.expectPATCH(/test.local/, { key: 'value' }, { header: 'value' });
+requestHandler = httpBackendService.expectPATCH((url: string) => { return true; });
+requestHandler = httpBackendService.expectPATCH((url: string) => { return true; }, 'response data');
+requestHandler = httpBackendService.expectPATCH((url: string) => { return true; }, 'response data', { header: 'value' });
+requestHandler = httpBackendService.expectPATCH((url: string) => { return true; }, /response data/);
+requestHandler = httpBackendService.expectPATCH((url: string) => { return true; }, /response data/, { header: 'value' });
+requestHandler = httpBackendService.expectPATCH((url: string) => { return true; }, function (data: string): boolean { return true; });
+requestHandler = httpBackendService.expectPATCH((url: string) => { return true; }, function (data: string): boolean { return true; }, { header: 'value' });
+requestHandler = httpBackendService.expectPATCH((url: string) => { return true; }, { key: 'value' });
+requestHandler = httpBackendService.expectPATCH((url: string) => { return true; }, { key: 'value' }, { header: 'value' });
+
+requestHandler = httpBackendService.expectPOST('http://test.local');
+requestHandler = httpBackendService.expectPOST('http://test.local', 'response data');
+requestHandler = httpBackendService.expectPOST('http://test.local', 'response data', { header: 'value' });
+requestHandler = httpBackendService.expectPOST('http://test.local', /response data/);
+requestHandler = httpBackendService.expectPOST('http://test.local', /response data/, { header: 'value' });
+requestHandler = httpBackendService.expectPOST('http://test.local', function (data: string): boolean { return true; });
+requestHandler = httpBackendService.expectPOST('http://test.local', function (data: string): boolean { return true; }, { header: 'value' });
+requestHandler = httpBackendService.expectPOST('http://test.local', { key: 'value' });
+requestHandler = httpBackendService.expectPOST('http://test.local', { key: 'value' }, { header: 'value' });
+requestHandler = httpBackendService.expectPOST(/test.local/);
+requestHandler = httpBackendService.expectPOST(/test.local/, 'response data');
+requestHandler = httpBackendService.expectPOST(/test.local/, 'response data', { header: 'value' });
+requestHandler = httpBackendService.expectPOST(/test.local/, /response data/);
+requestHandler = httpBackendService.expectPOST(/test.local/, /response data/, { header: 'value' });
+requestHandler = httpBackendService.expectPOST(/test.local/, function (data: string): boolean { return true; });
+requestHandler = httpBackendService.expectPOST(/test.local/, function (data: string): boolean { return true; }, { header: 'value' });
+requestHandler = httpBackendService.expectPOST(/test.local/, { key: 'value' });
+requestHandler = httpBackendService.expectPOST(/test.local/, { key: 'value' }, { header: 'value' });
+requestHandler = httpBackendService.expectPOST((url: string) => { return true; });
+requestHandler = httpBackendService.expectPOST((url: string) => { return true; }, 'response data');
+requestHandler = httpBackendService.expectPOST((url: string) => { return true; }, 'response data', { header: 'value' });
+requestHandler = httpBackendService.expectPOST((url: string) => { return true; }, /response data/);
+requestHandler = httpBackendService.expectPOST((url: string) => { return true; }, /response data/, { header: 'value' });
+requestHandler = httpBackendService.expectPOST((url: string) => { return true; }, function (data: string): boolean { return true; });
+requestHandler = httpBackendService.expectPOST((url: string) => { return true; }, function (data: string): boolean { return true; }, { header: 'value' });
+requestHandler = httpBackendService.expectPOST((url: string) => { return true; }, { key: 'value' });
+requestHandler = httpBackendService.expectPOST((url: string) => { return true; }, { key: 'value' }, { header: 'value' });
+
+requestHandler = httpBackendService.expectPUT('http://test.local');
+requestHandler = httpBackendService.expectPUT('http://test.local', 'response data');
+requestHandler = httpBackendService.expectPUT('http://test.local', 'response data', { header: 'value' });
+requestHandler = httpBackendService.expectPUT('http://test.local', /response data/);
+requestHandler = httpBackendService.expectPUT('http://test.local', /response data/, { header: 'value' });
+requestHandler = httpBackendService.expectPUT('http://test.local', function (data: string): boolean { return true; });
+requestHandler = httpBackendService.expectPUT('http://test.local', function (data: string): boolean { return true; }, { header: 'value' });
+requestHandler = httpBackendService.expectPUT('http://test.local', { key: 'value' });
+requestHandler = httpBackendService.expectPUT('http://test.local', { key: 'value' }, { header: 'value' });
+requestHandler = httpBackendService.expectPUT(/test.local/);
+requestHandler = httpBackendService.expectPUT(/test.local/, 'response data');
+requestHandler = httpBackendService.expectPUT(/test.local/, 'response data', { header: 'value' });
+requestHandler = httpBackendService.expectPUT(/test.local/, /response data/);
+requestHandler = httpBackendService.expectPUT(/test.local/, /response data/, { header: 'value' });
+requestHandler = httpBackendService.expectPUT(/test.local/, function (data: string): boolean { return true; });
+requestHandler = httpBackendService.expectPUT(/test.local/, function (data: string): boolean { return true; }, { header: 'value' });
+requestHandler = httpBackendService.expectPUT(/test.local/, { key: 'value' });
+requestHandler = httpBackendService.expectPUT(/test.local/, { key: 'value' }, { header: 'value' });
+requestHandler = httpBackendService.expectPUT((url: string) => { return true; });
+requestHandler = httpBackendService.expectPUT((url: string) => { return true; }, 'response data');
+requestHandler = httpBackendService.expectPUT((url: string) => { return true; }, 'response data', { header: 'value' });
+requestHandler = httpBackendService.expectPUT((url: string) => { return true; }, /response data/);
+requestHandler = httpBackendService.expectPUT((url: string) => { return true; }, /response data/, { header: 'value' });
+requestHandler = httpBackendService.expectPUT((url: string) => { return true; }, function (data: string): boolean { return true; });
+requestHandler = httpBackendService.expectPUT((url: string) => { return true; }, function (data: string): boolean { return true; }, { header: 'value' });
+requestHandler = httpBackendService.expectPUT((url: string) => { return true; }, { key: 'value' });
+requestHandler = httpBackendService.expectPUT((url: string) => { return true; }, { key: 'value' }, { header: 'value' });
+
+requestHandler = httpBackendService.when('GET', 'http://test.local');
+requestHandler = httpBackendService.when('GET', 'http://test.local', 'response data');
+requestHandler = httpBackendService.when('GET', 'http://test.local', 'response data', { header: 'value' });
+requestHandler = httpBackendService.when('GET', 'http://test.local', 'response data', function (headers: Object): boolean { return true; });
+requestHandler = httpBackendService.when('GET', 'http://test.local', /response data/);
+requestHandler = httpBackendService.when('GET', 'http://test.local', /response data/, { header: 'value' });
+requestHandler = httpBackendService.when('GET', 'http://test.local', /response data/, function (headers: Object): boolean { return true; });
+requestHandler = httpBackendService.when('GET', 'http://test.local', function (data: string): boolean { return true; });
+requestHandler = httpBackendService.when('GET', 'http://test.local', function (data: string): boolean { return true; }, { header: 'value' });
+requestHandler = httpBackendService.when('GET', 'http://test.local', function (data: string): boolean { return true; }, function (headers: Object): boolean { return true; });
+requestHandler = httpBackendService.when('GET', 'http://test.local', { key: 'value' });
+requestHandler = httpBackendService.when('GET', 'http://test.local', { key: 'value' }, { header: 'value' });
+requestHandler = httpBackendService.when('GET', 'http://test.local', { key: 'value' }, function (headers: Object): boolean { return true; });
+requestHandler = httpBackendService.when('GET', /test.local/);
+requestHandler = httpBackendService.when('GET', /test.local/, 'response data');
+requestHandler = httpBackendService.when('GET', /test.local/, 'response data', { header: 'value' });
+requestHandler = httpBackendService.when('GET', /test.local/, 'response data', function (headers: Object): boolean { return true; });
+requestHandler = httpBackendService.when('GET', /test.local/, /response data/);
+requestHandler = httpBackendService.when('GET', /test.local/, /response data/, { header: 'value' });
+requestHandler = httpBackendService.when('GET', /test.local/, /response data/, function (headers: Object): boolean { return true; });
+requestHandler = httpBackendService.when('GET', /test.local/, function (data: string): boolean { return true; });
+requestHandler = httpBackendService.when('GET', /test.local/, function (data: string): boolean { return true; }, { header: 'value' });
+requestHandler = httpBackendService.when('GET', /test.local/, function (data: string): boolean { return true; }, function (headers: Object): boolean { return true; });
+requestHandler = httpBackendService.when('GET', /test.local/, { key: 'value' });
+requestHandler = httpBackendService.when('GET', /test.local/, { key: 'value' }, { header: 'value' });
+requestHandler = httpBackendService.when('GET', /test.local/, { key: 'value' }, function (headers: Object): boolean { return true; });
+requestHandler = httpBackendService.when('GET', (url: string) => { return true; });
+requestHandler = httpBackendService.when('GET', (url: string) => { return true; }, 'response data');
+requestHandler = httpBackendService.when('GET', (url: string) => { return true; }, 'response data', { header: 'value' });
+requestHandler = httpBackendService.when('GET', (url: string) => { return true; }, 'response data', function (headers: Object): boolean { return true; });
+requestHandler = httpBackendService.when('GET', (url: string) => { return true; }, /response data/);
+requestHandler = httpBackendService.when('GET', (url: string) => { return true; }, /response data/, { header: 'value' });
+requestHandler = httpBackendService.when('GET', (url: string) => { return true; }, /response data/, function (headers: Object): boolean { return true; });
+requestHandler = httpBackendService.when('GET', (url: string) => { return true; }, function (data: string): boolean { return true; });
+requestHandler = httpBackendService.when('GET', (url: string) => { return true; }, function (data: string): boolean { return true; }, { header: 'value' });
+requestHandler = httpBackendService.when('GET', (url: string) => { return true; }, function (data: string): boolean { return true; }, function (headers: Object): boolean { return true; });
+requestHandler = httpBackendService.when('GET', (url: string) => { return true; }, { key: 'value' });
+requestHandler = httpBackendService.when('GET', (url: string) => { return true; }, { key: 'value' }, { header: 'value' });
+requestHandler = httpBackendService.when('GET', (url: string) => { return true; }, { key: 'value' }, function (headers: Object): boolean { return true; });
+
+requestHandler = httpBackendService.whenDELETE('http://test.local');
+requestHandler = httpBackendService.whenDELETE('http://test.local', { header: 'value' });
+requestHandler = httpBackendService.whenDELETE(/test.local/, { header: 'value' });
+requestHandler = httpBackendService.whenDELETE((url: string) => { return true; }, { header: 'value' });
+requestHandler = httpBackendService.whenGET('http://test.local');
+requestHandler = httpBackendService.whenGET('http://test.local', { header: 'value' });
+requestHandler = httpBackendService.whenGET(/test.local/, { header: 'value' });
+requestHandler = httpBackendService.whenGET((url: string) => { return true; }, { header: 'value' });
+requestHandler = httpBackendService.whenHEAD('http://test.local');
+requestHandler = httpBackendService.whenHEAD('http://test.local', { header: 'value' });
+requestHandler = httpBackendService.whenHEAD(/test.local/, { header: 'value' });
+requestHandler = httpBackendService.whenHEAD((url: string) => { return true; }, { header: 'value' });
+requestHandler = httpBackendService.whenJSONP('http://test.local');
+requestHandler = httpBackendService.whenJSONP(/test.local/);
+requestHandler = httpBackendService.whenJSONP((url: string) => { return true; });
+
+requestHandler = httpBackendService.whenPATCH('http://test.local');
+requestHandler = httpBackendService.whenPATCH('http://test.local', 'response data');
+requestHandler = httpBackendService.whenPATCH('http://test.local', 'response data', { header: 'value' });
+requestHandler = httpBackendService.whenPATCH('http://test.local', /response data/);
+requestHandler = httpBackendService.whenPATCH('http://test.local', /response data/, { header: 'value' });
+requestHandler = httpBackendService.whenPATCH('http://test.local', function (data: string): boolean { return true; });
+requestHandler = httpBackendService.whenPATCH('http://test.local', function (data: string): boolean { return true; }, { header: 'value' });
+requestHandler = httpBackendService.whenPATCH('http://test.local', { key: 'value' });
+requestHandler = httpBackendService.whenPATCH('http://test.local', { key: 'value' }, { header: 'value' });
+requestHandler = httpBackendService.whenPATCH(/test.local/);
+requestHandler = httpBackendService.whenPATCH(/test.local/, 'response data');
+requestHandler = httpBackendService.whenPATCH(/test.local/, 'response data', { header: 'value' });
+requestHandler = httpBackendService.whenPATCH(/test.local/, /response data/);
+requestHandler = httpBackendService.whenPATCH(/test.local/, /response data/, { header: 'value' });
+requestHandler = httpBackendService.whenPATCH(/test.local/, function (data: string): boolean { return true; });
+requestHandler = httpBackendService.whenPATCH(/test.local/, function (data: string): boolean { return true; }, { header: 'value' });
+requestHandler = httpBackendService.whenPATCH(/test.local/, { key: 'value' });
+requestHandler = httpBackendService.whenPATCH(/test.local/, { key: 'value' }, { header: 'value' });
+requestHandler = httpBackendService.whenPATCH((url: string) => { return true; });
+requestHandler = httpBackendService.whenPATCH((url: string) => { return true; }, 'response data');
+requestHandler = httpBackendService.whenPATCH((url: string) => { return true; }, 'response data', { header: 'value' });
+requestHandler = httpBackendService.whenPATCH((url: string) => { return true; }, /response data/);
+requestHandler = httpBackendService.whenPATCH((url: string) => { return true; }, /response data/, { header: 'value' });
+requestHandler = httpBackendService.whenPATCH((url: string) => { return true; }, function (data: string): boolean { return true; });
+requestHandler = httpBackendService.whenPATCH((url: string) => { return true; }, function (data: string): boolean { return true; }, { header: 'value' });
+requestHandler = httpBackendService.whenPATCH((url: string) => { return true; }, { key: 'value' });
+requestHandler = httpBackendService.whenPATCH((url: string) => { return true; }, { key: 'value' }, { header: 'value' });
+
+requestHandler = httpBackendService.whenPOST('http://test.local');
+requestHandler = httpBackendService.whenPOST('http://test.local', 'response data');
+requestHandler = httpBackendService.whenPOST('http://test.local', 'response data', { header: 'value' });
+requestHandler = httpBackendService.whenPOST('http://test.local', /response data/);
+requestHandler = httpBackendService.whenPOST('http://test.local', /response data/, { header: 'value' });
+requestHandler = httpBackendService.whenPOST('http://test.local', function (data: string): boolean { return true; });
+requestHandler = httpBackendService.whenPOST('http://test.local', function (data: string): boolean { return true; }, { header: 'value' });
+requestHandler = httpBackendService.whenPOST('http://test.local', { key: 'value' });
+requestHandler = httpBackendService.whenPOST('http://test.local', { key: 'value' }, { header: 'value' });
+requestHandler = httpBackendService.whenPOST(/test.local/);
+requestHandler = httpBackendService.whenPOST(/test.local/, 'response data');
+requestHandler = httpBackendService.whenPOST(/test.local/, 'response data', { header: 'value' });
+requestHandler = httpBackendService.whenPOST(/test.local/, /response data/);
+requestHandler = httpBackendService.whenPOST(/test.local/, /response data/, { header: 'value' });
+requestHandler = httpBackendService.whenPOST(/test.local/, function (data: string): boolean { return true; });
+requestHandler = httpBackendService.whenPOST(/test.local/, function (data: string): boolean { return true; }, { header: 'value' });
+requestHandler = httpBackendService.whenPOST(/test.local/, { key: 'value' });
+requestHandler = httpBackendService.whenPOST(/test.local/, { key: 'value' }, { header: 'value' });
+requestHandler = httpBackendService.whenPOST((url: string) => { return true; });
+requestHandler = httpBackendService.whenPOST((url: string) => { return true; }, 'response data');
+requestHandler = httpBackendService.whenPOST((url: string) => { return true; }, 'response data', { header: 'value' });
+requestHandler = httpBackendService.whenPOST((url: string) => { return true; }, /response data/);
+requestHandler = httpBackendService.whenPOST((url: string) => { return true; }, /response data/, { header: 'value' });
+requestHandler = httpBackendService.whenPOST((url: string) => { return true; }, function (data: string): boolean { return true; });
+requestHandler = httpBackendService.whenPOST((url: string) => { return true; }, function (data: string): boolean { return true; }, { header: 'value' });
+requestHandler = httpBackendService.whenPOST((url: string) => { return true; }, { key: 'value' });
+requestHandler = httpBackendService.whenPOST((url: string) => { return true; }, { key: 'value' }, { header: 'value' });
+
+requestHandler = httpBackendService.whenPUT('http://test.local');
+requestHandler = httpBackendService.whenPUT('http://test.local', 'response data');
+requestHandler = httpBackendService.whenPUT('http://test.local', 'response data', { header: 'value' });
+requestHandler = httpBackendService.whenPUT('http://test.local', /response data/);
+requestHandler = httpBackendService.whenPUT('http://test.local', /response data/, { header: 'value' });
+requestHandler = httpBackendService.whenPUT('http://test.local', function (data: string): boolean { return true; });
+requestHandler = httpBackendService.whenPUT('http://test.local', function (data: string): boolean { return true; }, { header: 'value' });
+requestHandler = httpBackendService.whenPUT('http://test.local', { key: 'value' });
+requestHandler = httpBackendService.whenPUT('http://test.local', { key: 'value' }, { header: 'value' });
+requestHandler = httpBackendService.whenPUT(/test.local/);
+requestHandler = httpBackendService.whenPUT(/test.local/, 'response data');
+requestHandler = httpBackendService.whenPUT(/test.local/, 'response data', { header: 'value' });
+requestHandler = httpBackendService.whenPUT(/test.local/, /response data/);
+requestHandler = httpBackendService.whenPUT(/test.local/, /response data/, { header: 'value' });
+requestHandler = httpBackendService.whenPUT(/test.local/, function (data: string): boolean { return true; });
+requestHandler = httpBackendService.whenPUT(/test.local/, function (data: string): boolean { return true; }, { header: 'value' });
+requestHandler = httpBackendService.whenPUT(/test.local/, { key: 'value' });
+requestHandler = httpBackendService.whenPUT(/test.local/, { key: 'value' }, { header: 'value' });
+requestHandler = httpBackendService.whenPUT((url: string) => { return true; });
+requestHandler = httpBackendService.whenPUT((url: string) => { return true; }, 'response data');
+requestHandler = httpBackendService.whenPUT((url: string) => { return true; }, 'response data', { header: 'value' });
+requestHandler = httpBackendService.whenPUT((url: string) => { return true; }, /response data/);
+requestHandler = httpBackendService.whenPUT((url: string) => { return true; }, /response data/, { header: 'value' });
+requestHandler = httpBackendService.whenPUT((url: string) => { return true; }, function (data: string): boolean { return true; });
+requestHandler = httpBackendService.whenPUT((url: string) => { return true; }, function (data: string): boolean { return true; }, { header: 'value' });
+requestHandler = httpBackendService.whenPUT((url: string) => { return true; }, { key: 'value' });
+requestHandler = httpBackendService.whenPUT((url: string) => { return true; }, { key: 'value' }, { header: 'value' });
+
+
+///////////////////////////////////////
+// IRequestHandler
+///////////////////////////////////////
+var expectedData = { key: 'value'};
+requestHandler.passThrough();
+requestHandler.passThrough().passThrough();
+requestHandler.respond((method, url, data, headers) => [404, 'data', { header: 'value' }, 'responseText']);
+requestHandler.respond((method, url, data, headers) => [404, 'data', { header: 'value' }, 'responseText']).respond({});
+requestHandler.respond((method, url, data, headers) => { return [404, { key: 'value' }, { header: 'value' }, 'responseText']; });
+requestHandler.respond('data');
+requestHandler.respond('data').respond({});
+requestHandler.respond(expectedData);
+requestHandler.respond({ key: 'value' });
+requestHandler.respond({ key: 'value' }, { header: 'value' });
+requestHandler.respond({ key: 'value' }, { header: 'value' }, 'responseText');
+requestHandler.respond(404, 'data');
+requestHandler.respond(404, 'data').respond({});
+requestHandler.respond(404, { key: 'value' });
+requestHandler.respond(404, { key: 'value' }, { header: 'value' });
+requestHandler.respond(404, { key: 'value' }, { header: 'value' }, 'responseText');
diff --git a/angularjs/legacy/angular-mocks-1.3.d.ts b/angularjs/legacy/angular-mocks-1.3.d.ts
new file mode 100644
index 0000000000..1850ac266c
--- /dev/null
+++ b/angularjs/legacy/angular-mocks-1.3.d.ts
@@ -0,0 +1,318 @@
+// Type definitions for Angular JS 1.3 (ngMock, ngMockE2E module)
+// Project: http://angularjs.org
+// Definitions by: Diego Vilar , Tony Curtis
+// Definitions: https://github.com/borisyankov/DefinitelyTyped
+
+///
+
+declare module "angular-mocks/ngMock" {
+ var _: string;
+ export = _;
+}
+
+declare module "angular-mocks/ngMockE2E" {
+ var _: string;
+ export = _;
+}
+
+declare module "angular-mocks/ngAnimateMock" {
+ var _: string;
+ export = _;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// ngMock module (angular-mocks.js)
+///////////////////////////////////////////////////////////////////////////////
+declare module angular {
+
+ ///////////////////////////////////////////////////////////////////////////
+ // AngularStatic
+ // We reopen it to add the MockStatic definition
+ ///////////////////////////////////////////////////////////////////////////
+ interface IAngularStatic {
+ mock: IMockStatic;
+ }
+
+ // see https://docs.angularjs.org/api/ngMock/function/angular.mock.inject
+ interface IInjectStatic {
+ (...fns: Function[]): any;
+ (...inlineAnnotatedConstructor: any[]): any; // this overload is undocumented, but works
+ strictDi(val?: boolean): void;
+ }
+
+ interface IMockStatic {
+ // see https://docs.angularjs.org/api/ngMock/function/angular.mock.dump
+ dump(obj: any): string;
+
+ inject: IInjectStatic
+
+ // see https://docs.angularjs.org/api/ngMock/function/angular.mock.module
+ module(...modules: any[]): any;
+
+ // see https://docs.angularjs.org/api/ngMock/type/angular.mock.TzDate
+ TzDate(offset: number, timestamp: number): Date;
+ TzDate(offset: number, timestamp: string): Date;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // ExceptionHandlerService
+ // see https://docs.angularjs.org/api/ngMock/service/$exceptionHandler
+ // see https://docs.angularjs.org/api/ngMock/provider/$exceptionHandlerProvider
+ ///////////////////////////////////////////////////////////////////////////
+ interface IExceptionHandlerProvider extends IServiceProvider {
+ mode(mode: string): void;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // TimeoutService
+ // see https://docs.angularjs.org/api/ngMock/service/$timeout
+ // Augments the original service
+ ///////////////////////////////////////////////////////////////////////////
+ interface ITimeoutService {
+ flush(delay?: number): void;
+ flushNext(expectedDelay?: number): void;
+ verifyNoPendingTasks(): void;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // IntervalService
+ // see https://docs.angularjs.org/api/ngMock/service/$interval
+ // Augments the original service
+ ///////////////////////////////////////////////////////////////////////////
+ interface IIntervalService {
+ flush(millis?: number): number;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // LogService
+ // see https://docs.angularjs.org/api/ngMock/service/$log
+ // Augments the original service
+ ///////////////////////////////////////////////////////////////////////////
+ interface ILogService {
+ assertEmpty(): void;
+ reset(): void;
+ }
+
+ interface ILogCall {
+ logs: string[];
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // HttpBackendService
+ // see https://docs.angularjs.org/api/ngMock/service/$httpBackend
+ ///////////////////////////////////////////////////////////////////////////
+ interface IHttpBackendService {
+ /**
+ * Flushes all pending requests using the trained responses.
+ * @param count Number of responses to flush (in the order they arrived). If undefined, all pending requests will be flushed.
+ */
+ flush(count?: number): void;
+
+ /**
+ * Resets all request expectations, but preserves all backend definitions.
+ */
+ resetExpectations(): void;
+
+ /**
+ * Verifies that all of the requests defined via the expect api were made. If any of the requests were not made, verifyNoOutstandingExpectation throws an exception.
+ */
+ verifyNoOutstandingExpectation(): void;
+
+ /**
+ * Verifies that there are no outstanding requests that need to be flushed.
+ */
+ verifyNoOutstandingRequest(): void;
+
+ /**
+ * Creates a new request expectation.
+ * Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
+ * Returns an object with respond method that controls how a matched request is handled.
+ * @param method HTTP method.
+ * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
+ * @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
+ * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
+ */
+ expect(method: string, url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean)) :mock.IRequestHandler;
+
+ /**
+ * Creates a new request expectation for DELETE requests.
+ * Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
+ * Returns an object with respond method that controls how a matched request is handled.
+ * @param url HTTP url string, regular expression or function that receives a url and returns true if the url is as expected.
+ * @param headers HTTP headers object to be compared with the HTTP headers in the request.
+ */
+ expectDELETE(url: string | RegExp | ((url: string) => boolean), headers?: Object): mock.IRequestHandler;
+
+ /**
+ * Creates a new request expectation for GET requests.
+ * Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
+ * Returns an object with respond method that controls how a matched request is handled.
+ * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
+ * @param headers HTTP headers object to be compared with the HTTP headers in the request.
+ */
+ expectGET(url: string | RegExp | ((url: string) => boolean), headers?: Object): mock.IRequestHandler;
+
+ /**
+ * Creates a new request expectation for HEAD requests.
+ * Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
+ * Returns an object with respond method that controls how a matched request is handled.
+ * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
+ * @param headers HTTP headers object to be compared with the HTTP headers in the request.
+ */
+ expectHEAD(url: string | RegExp | ((url: string) => boolean), headers?: Object): mock.IRequestHandler;
+
+ /**
+ * Creates a new request expectation for JSONP requests.
+ * Throws a preformatted error if expectation(s) don't match supplied string, regular expression, or if function returns false.
+ * Returns an object with respond method that controls how a matched request is handled.
+ * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
+ */
+ expectJSONP(url: string | RegExp | ((url: string) => boolean)): mock.IRequestHandler;
+
+ /**
+ * Creates a new request expectation for PATCH requests.
+ * Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
+ * Returns an object with respond method that controls how a matched request is handled.
+ * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
+ * @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
+ * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
+ */
+ expectPATCH(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object): mock.IRequestHandler;
+
+ /**
+ * Creates a new request expectation for POST requests.
+ * Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
+ * Returns an object with respond method that controls how a matched request is handled.
+ * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
+ * @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
+ * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
+ */
+ expectPOST(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object): mock.IRequestHandler;
+
+ /**
+ * Creates a new request expectation for PUT requests.
+ * Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
+ * Returns an object with respond method that controls how a matched request is handled.
+ * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
+ * @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
+ * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
+ */
+ expectPUT(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object): mock.IRequestHandler;
+
+ /**
+ * Creates a new backend definition.
+ * Returns an object with respond method that controls how a matched request is handled.
+ * @param method HTTP method.
+ * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
+ * @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
+ * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
+ */
+ when(method: string, url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler;
+
+ /**
+ * Creates a new backend definition for DELETE requests.
+ * Returns an object with respond method that controls how a matched request is handled.
+ * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
+ * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
+ */
+ whenDELETE(url: string | RegExp | ((url: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler;
+
+ /**
+ * Creates a new backend definition for GET requests.
+ * Returns an object with respond method that controls how a matched request is handled.
+ * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
+ * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
+ */
+ whenGET(url: string | RegExp | ((url: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler;
+
+ /**
+ * Creates a new backend definition for HEAD requests.
+ * Returns an object with respond method that controls how a matched request is handled.
+ * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
+ * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
+ */
+ whenHEAD(url: string | RegExp | ((url: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler;
+
+ /**
+ * Creates a new backend definition for JSONP requests.
+ * Returns an object with respond method that controls how a matched request is handled.
+ * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
+ * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
+ */
+ whenJSONP(url: string | RegExp | ((url: string) => boolean)): mock.IRequestHandler;
+
+ /**
+ * Creates a new backend definition for PATCH requests.
+ * Returns an object with respond method that controls how a matched request is handled.
+ * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
+ * @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
+ * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
+ */
+ whenPATCH(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler;
+
+ /**
+ * Creates a new backend definition for POST requests.
+ * Returns an object with respond method that controls how a matched request is handled.
+ * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
+ * @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
+ * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
+ */
+ whenPOST(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler;
+
+ /**
+ * Creates a new backend definition for PUT requests.
+ * Returns an object with respond method that controls how a matched request is handled.
+ * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
+ * @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
+ * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
+ */
+ whenPUT(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler;
+ }
+
+ export module mock {
+ // returned interface by the the mocked HttpBackendService expect/when methods
+ interface IRequestHandler {
+
+ /**
+ * Controls the response for a matched request using a function to construct the response.
+ * Returns the RequestHandler object for possible overrides.
+ * @param func Function that receives the request HTTP method, url, data, and headers and returns an array containing response status (number), data, headers, and status text.
+ */
+ respond(func: ((method: string, url: string, data: string | Object, headers: Object) => [number, string | Object, Object, string])): IRequestHandler;
+
+ /**
+ * Controls the response for a matched request using supplied static data to construct the response.
+ * Returns the RequestHandler object for possible overrides.
+ * @param status HTTP status code to add to the response.
+ * @param data Data to add to the response.
+ * @param headers Headers object to add to the response.
+ * @param responseText Response text to add to the response.
+ */
+ respond(status: number, data: string | Object, headers?: Object, responseText?: string): IRequestHandler;
+
+ /**
+ * Controls the response for a matched request using the HTTP status code 200 and supplied static data to construct the response.
+ * Returns the RequestHandler object for possible overrides.
+ * @param data Data to add to the response.
+ * @param headers Headers object to add to the response.
+ * @param responseText Response text to add to the response.
+ */
+ respond(data: string | Object, headers?: Object, responseText?: string): IRequestHandler;
+
+ // Available when ngMockE2E is loaded
+ /**
+ * Any request matching a backend definition or expectation with passThrough handler will be passed through to the real backend (an XHR request will be made to the server.)
+ */
+ passThrough(): IRequestHandler;
+ }
+
+ }
+
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// functions attached to global object (window)
+///////////////////////////////////////////////////////////////////////////////
+//Use `angular.mock.module` instead of `module`, as `module` conflicts with commonjs.
+//declare var module: (...modules: any[]) => any;
+declare var inject: angular.IInjectStatic;
\ No newline at end of file
diff --git a/aphrodite/aphrodite-tests.tsx b/aphrodite/aphrodite-tests.tsx
new file mode 100644
index 0000000000..76d28ca43f
--- /dev/null
+++ b/aphrodite/aphrodite-tests.tsx
@@ -0,0 +1,82 @@
+///
+///
+
+import * as React from "react";
+import { StyleSheet, css, StyleSheetServer, StyleSheetTestUtils } from "aphrodite";
+
+const styles = StyleSheet.create({
+ red: {
+ backgroundColor: 'red'
+ },
+ blue: {
+ backgroundColor: 'blue'
+ },
+ hover: {
+ ':hover': {
+ backgroundColor: 'red'
+ }
+ },
+ small: {
+ '@media (max-width: 600px)': {
+ backgroundColor: 'red',
+ }
+ }
+});
+
+const coolFont = {
+ fontFamily: "CoolFont",
+ fontStyle: "normal",
+ fontWeight: "normal",
+ src: "url('coolfont.woff2') format('woff2')"
+};
+
+const withFont = StyleSheet.create({
+ headingText: {
+ fontFamily: coolFont,
+ fontSize: 20
+ },
+ bodyText: {
+ fontFamily: [coolFont, "sans-serif"],
+ fontSize: 12
+ }
+});
+
+
+class App extends React.Component<{}, {}> {
+ render() {
+ return
+
+ This is red.
+
+
+ This turns red on hover.
+
+
+ This turns red when the browser is less than 600px width.
+
+
+ This is blue.
+
+
+ This is blue and turns red when the browser is less than
+ 600px width.
+
+
+ With font
+
+
;
+ }
+}
+
+const output = StyleSheetServer.renderStatic(() => {
+ return "test";
+});
+
+output.css.content;
+output.css.renderedClassNames;
+output.html;
+
+StyleSheet.rehydrate(output.css.renderedClassNames);
+
+StyleSheetTestUtils.suppressStyleInjection();
+StyleSheetTestUtils.clearBufferAndResumeStyleInjection();
diff --git a/aphrodite/aphrodite.d.ts b/aphrodite/aphrodite.d.ts
new file mode 100644
index 0000000000..89d8646e54
--- /dev/null
+++ b/aphrodite/aphrodite.d.ts
@@ -0,0 +1,76 @@
+// Type definitions for Aphrodite 0.5.0
+// Project: https://github.com/Khan/aphrodite
+// Definitions by: Alexey Svetliakov
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+///
+
+declare module "aphrodite" {
+ import * as React from "react";
+
+ /**
+ * Aphrodite style declaration
+ */
+ export interface StyleDeclaration {
+ [key: string]: React.CSSProperties;
+ }
+
+ interface StyleSheetStatic {
+ /**
+ * Create style sheet
+ */
+ create(styles: T): T;
+ /**
+ * Rehydrate class names from server renderer
+ */
+ rehydrate(renderedClassNames: string[]): void;
+ }
+
+ export var StyleSheet: StyleSheetStatic;
+ /**
+ * Get class names from passed styles
+ */
+ export function css(...styles: any[]): string;
+
+ interface StaticRendererResult {
+ html: string;
+ css: {
+ content: string;
+ renderedClassNames: string[];
+ }
+ }
+
+ /**
+ * Utilities for using Aphrodite server-side.
+ */
+ interface StyleSheetServerStatic {
+ renderStatic(renderFunc: () => string): StaticRendererResult;
+ }
+
+ export var StyleSheetServer: StyleSheetServerStatic;
+
+ interface StyleSheetTestUtilsStatic {
+ /**
+ * Prevent styles from being injected into the DOM.
+ *
+ * This is useful in situations where you'd like to test rendering UI
+ * components which use Aphrodite without any of the side-effects of
+ * Aphrodite happening. Particularly useful for testing the output of
+ * components when you have no DOM, e.g. testing in Node without a fake DOM.
+ *
+ * Should be paired with a subsequent call to
+ * clearBufferAndResumeStyleInjection.
+ */
+ suppressStyleInjection(): void;
+ /**
+ * Opposite method of preventStyleInject.
+ */
+ clearBufferAndResumeStyleInjection(): void;
+ }
+
+ export var StyleSheetTestUtils: StyleSheetTestUtilsStatic;
+}
+
+declare module "aphrodite/no-important" {
+ export * from "aphrodite";
+}
diff --git a/apigee-access/apigee-access-tests.ts b/apigee-access/apigee-access-tests.ts
new file mode 100644
index 0000000000..99baec8021
--- /dev/null
+++ b/apigee-access/apigee-access-tests.ts
@@ -0,0 +1,67 @@
+///
+import apigee from "apigee-access";
+
+//Sample code from
+// https://www.npmjs.com/package/apigee-access
+
+var request: any = null;
+
+// Variables
+var val1 = apigee.getVariable(request, 'TestVariable');
+
+apigee.setIntVariable(request, 'TestVariable', '123');
+apigee.setIntVariable(request, 'TestVariable2', 42);
+
+apigee.deleteVariable(request, 'TestVariable');
+
+// Mode
+console.log('The deployment mode is ' + apigee.getMode());
+
+// Cache
+var cache = apigee.getCache('cache');
+var customCache = apigee.getCache('MyCustomCache',
+ { resource: 'MyCustomrResource' });
+cache.put('key2', 'Hello, World!', 120);
+cache.put('key4', 'Hello, World!', function (err: any) {
+});
+
+cache.get('key', function (err: any, data: any) {
+});
+
+cache.remove('key');
+
+// Secure Vault
+var orgVault = apigee.getVault('vault1', 'organization');
+orgVault.get('key1', function (err: any, secretValue: any) {
+});
+
+// Quota Service
+var quota = apigee.getQuota();
+quota.apply({ identifier: 'Foo', allow: 10, timeUnit: 'hour' },
+ function (err: any, result: any) {
+ console.log('Quota applied: %j', result);
+ });
+
+quota.apply({
+ identifier: 'Foo',
+ timeUnit: 'hour',
+ allow: 100
+}, quotaResult);
+
+quota.apply({
+ identifier: 'Bar',
+ timeUnit: 'minute',
+ interval: 5,
+ allow: 500
+}, quotaResult);
+
+quota.apply({
+ identifier: 'Foo',
+ timeUnit: 'hour',
+ allow: 100,
+ weight: 10
+}, quotaResult);
+
+function quotaResult(err: any, r: any) {
+ if (err) { console.error('Quota failed'); }
+}
\ No newline at end of file
diff --git a/apigee-access/apigee-access.d.ts b/apigee-access/apigee-access.d.ts
new file mode 100644
index 0000000000..af34724023
--- /dev/null
+++ b/apigee-access/apigee-access.d.ts
@@ -0,0 +1,58 @@
+// Type definitions for apigee-access
+// Project: https://www.npmjs.com/package/apigee-access
+// Definitions by: Casper Skydt
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+declare module ApigeeAccess {
+
+ function getVariable(request: any, name: string): string | number | boolean;
+ function setVariable(request: any, name: string, value: string | number | boolean ): void;
+ function setIntVariable(request: any, name: string, value: string | number): void;
+ function deleteVariable(request: any, name: string): void;
+ function getCache(name: string, options?: CacheOptions): any;
+ function getVault(name: string, scope?: "organization" | "environment"): SecureVault;
+ function getQuota(options?: any): QuotaService;
+ function getMode(): "apigee" | "standalone";
+
+ interface CacheOptions{
+ resource?: string;
+ scope?: "global" | "application" | "exclusive";
+ defaultTtl?: number;
+ timeout?: number;
+ }
+
+ interface Cache{
+ put(key: string, data: any, ttl?: number, callback?: (err: any) => void): void;
+ get(key: string, callback: (err: any, data: any) => void): void;
+ remove(key: string, callback?: (err: any) => void): void;
+ }
+
+ interface SecureVault{
+ getKeys(callback: (err: any, data: any) => void): void;
+ get(key: string, callback: (err: any, data: any) => void): void;
+ }
+
+ interface QuotaService{
+ apply(options?: QuotaServiceApplyOptions, callback?: (err: any, data: QuotaServiceApplyCallbackData) => void): void;
+ }
+
+ interface QuotaServiceApplyOptions{
+ identifier: string;
+ timeUnit: "minute" | "hour" | "day" | "week" | "month";
+ allow: number;
+ interval?: number;
+ weight?: number;
+ }
+
+ interface QuotaServiceApplyCallbackData{
+ used: number;
+ allowed: number;
+ isAllowed: boolean;
+ expiryTime: number;
+ timestamp: number;
+ }
+}
+
+declare module "apigee-access"{
+ export default ApigeeAccess;
+}
\ No newline at end of file
diff --git a/app-root-path/app-root-path-tests.ts b/app-root-path/app-root-path-tests.ts
new file mode 100644
index 0000000000..64d8cdab6b
--- /dev/null
+++ b/app-root-path/app-root-path-tests.ts
@@ -0,0 +1,10 @@
+///
+import * as root from 'app-root-path';
+
+let resolvedPath: string;
+resolvedPath = root.resolve('../dir');
+resolvedPath = root.path;
+resolvedPath = root.toString();
+let resolvedModule: any = root.require('app-root-path');
+root.setPath('C:\\app-root');
+
diff --git a/app-root-path/app-root-path.d.ts b/app-root-path/app-root-path.d.ts
new file mode 100644
index 0000000000..7cccc59e01
--- /dev/null
+++ b/app-root-path/app-root-path.d.ts
@@ -0,0 +1,39 @@
+// Type definitions for app-root-path 1.2.1
+// Project: https://github.com/inxilpro/node-app-root-path
+// Definitions by: Shant Marouti
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+declare module 'app-root-path' {
+ interface RootPath {
+
+ /**
+ * Application root directory absolute path
+ * @type {string}
+ */
+ path: string;
+
+ /**
+ * Resolves relative path from root to absolute path
+ * @param {string} pathToModule
+ * @returns {string}
+ */
+ resolve(pathToModule: string): string;
+
+ /**
+ * Resolve module by relative addressing from root
+ * @param {string} pathToModule
+ * @returns {*}
+ */
+ require(pathToModule: string): any;
+
+ /**
+ * Explicitly set root path
+ * @param {string} explicitlySetPath
+ */
+ setPath(explicitlySetPath: string): void;
+
+ toString(): string;
+ }
+ var RootPath: RootPath;
+ export = RootPath;
+}
\ No newline at end of file
diff --git a/applicationinsights-js/applicationinsights-js-tests.ts b/applicationinsights-js/applicationinsights-js-tests.ts
new file mode 100644
index 0000000000..b8f5ba7bec
--- /dev/null
+++ b/applicationinsights-js/applicationinsights-js-tests.ts
@@ -0,0 +1,157 @@
+///
+// More samples on: https://github.com/Microsoft/ApplicationInsights-JS/blob/master/API-reference.md
+
+var config: Microsoft.ApplicationInsights.IConfig = {
+ instrumentationKey: "",
+ endpointUrl: "endpointUrl",
+ emitLineDelimitedJson: false,
+ accountId: "accountId",
+ sessionRenewalMs: 30,
+ sessionExpirationMs: 24 * 60 * 60 * 1000,
+ maxBatchSizeInBytes: 100 * 1024,
+ maxBatchInterval: 15,
+ enableDebug: false,
+ disableTelemetry: false,
+ verboseLogging: false,
+ diagnosticLogInterval: 10,
+ samplingPercentage: 100,
+ autoTrackPageVisitTime: true,
+ disableExceptionTracking: false,
+ disableAjaxTracking: false,
+ overridePageViewDuration: false,
+ maxAjaxCallsPerView: -1,
+ disableDataLossAnalysis: true,
+ disableCorrelationHeaders: true,
+ disableFlushOnBeforeUnload: false,
+ enableSessionStorageBuffer: false,
+ cookieDomain: ""
+};
+
+var appInsights: Microsoft.ApplicationInsights.IAppInsights = {
+ 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 }
+};
+
+// trackPageView
+appInsights.trackPageView("page1");
+appInsights.trackPageView("page2", "http://example.com", null, null, 1000);
+
+// startTrackPage
+appInsights.startTrackPage("page");
+
+// stopTrackPage
+appInsights.stopTrackPage("page");
+appInsights.stopTrackPage("page", "http://example.com", null, null);
+
+// trackEvent
+appInsights.trackEvent("page1");
+appInsights.trackEvent("page1", null, null);
+
+// trackMetric
+appInsights.trackMetric("page1", 999);
+appInsights.trackMetric("page1", 999, 1, 1, 2, null);
+
+// trackException
+appInsights.trackException(new Error("sample error"));
+appInsights.trackException(new Error("sample error"), "handledAt", null, null);
+
+// trackTrace
+appInsights.trackTrace("message");
+appInsights.trackTrace("message", null);
+
+// flush
+appInsights.flush();
+
+// setAuthenticatedUserContext
+appInsights.setAuthenticatedUserContext("userId");
+appInsights.setAuthenticatedUserContext("userId", "accountId");
+
+// set config dynamically
+appInsights.config.instrumentationKey = "";
+
+
+// TelementryContext
+var context: Microsoft.ApplicationInsights.ITelemetryContext = appInsights.context;
+
+context.application.ver = "v0.0.0";
+context.application.build = "1.1.1";
+
+context.device.type = "sampleDevice";
+context.device.locale = "en-US";
+
+context.user.id = "userId";
+context.user.authenticatedId = "authId";
+
+context.session.id = "sessionId";
+context.session.isFirst = true;
+
+context.location.ip = "127.0.0.1";
+
+context.operation.id = "1";
+context.operation.syntheticSource = "testAgent";
+
+// track
+var data = new Microsoft.Telemetry.Base();
+var envelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(data, "name");
+
+context.track(envelope);
+
+context.addTelemetryInitializer((envelope) => false);
+
+// track event
+var eventObj = new Microsoft.ApplicationInsights.Telemetry.Event("test", null, null);
+var eventData = new Microsoft.ApplicationInsights.Telemetry.Common.Data(Microsoft.ApplicationInsights.Telemetry.Event.dataType, eventObj);
+var eventEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(eventData, Microsoft.ApplicationInsights.Telemetry.Event.envelopeType);
+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.dataType, exceptionObj);
+var exceptionEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(exceptionData, Microsoft.ApplicationInsights.Telemetry.Exception.envelopeType);
+context.track(exceptionEnvelope);
+
+// track metric
+var metricObj = new Microsoft.ApplicationInsights.Telemetry.Metric("name", 1234, 1, 0, 100, null);
+var metricData = new Microsoft.ApplicationInsights.Telemetry.Common.Data(Microsoft.ApplicationInsights.Telemetry.Metric.dataType, metricObj);
+var metricEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(metricData, Microsoft.ApplicationInsights.Telemetry.Metric.envelopeType);
+context.track(metricEnvelope);
+
+// track page view
+var pageViewObj = new Microsoft.ApplicationInsights.Telemetry.PageView("page name", "url", 999, null, null);
+var pageViewData = new Microsoft.ApplicationInsights.Telemetry.Common.Data(Microsoft.ApplicationInsights.Telemetry.PageView.dataType, pageViewObj);
+var pageViewEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(pageViewData, Microsoft.ApplicationInsights.Telemetry.PageView.envelopeType);
+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.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.dataType, remoteDepObj);
+var remoteDepEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(remoteDepData, Microsoft.ApplicationInsights.Telemetry.RemoteDependencyData.envelopeType);
+context.track(pageViewPerfEnvelope);
+
+// track trace
+var traceObj = new Microsoft.ApplicationInsights.Telemetry.Trace("message", null);
+var traceData = new Microsoft.ApplicationInsights.Telemetry.Common.Data(Microsoft.ApplicationInsights.Telemetry.Trace.dataType, traceObj);
+var traceEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(traceData, Microsoft.ApplicationInsights.Telemetry.Trace.envelopeType);
+context.track(traceEnvelope);
\ No newline at end of file
diff --git a/applicationinsights-js/applicationinsights-js.d.ts b/applicationinsights-js/applicationinsights-js.d.ts
new file mode 100644
index 0000000000..ba154e5fe6
--- /dev/null
+++ b/applicationinsights-js/applicationinsights-js.d.ts
@@ -0,0 +1,796 @@
+// Type definitions for ApplicationInsights-JS v0.23.2
+// Project: https://github.com/Microsoft/ApplicationInsights-JS
+// Definitions by: Kamil Szostak
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+declare module AI {
+ enum SeverityLevel {
+ Verbose = 0,
+ Information = 1,
+ Warning = 2,
+ Error = 3,
+ Critical = 4,
+ }
+
+ enum DependencyKind {
+ SQL = 0,
+ Http = 1,
+ Other = 2,
+ }
+
+ enum DependencySourceType {
+ Undefined = 0,
+ Aic = 1,
+ Apmc = 2,
+ }
+
+ class StackFrame {
+ level: number;
+ method: string;
+ assembly: string;
+ fileName: string;
+ line: number;
+ constructor();
+ }
+
+ class ExceptionDetails {
+ id: number;
+ outerId: number;
+ typeName: string;
+ message: string;
+ hasFullStack: boolean;
+ stack: string;
+ parsedStack: StackFrame[];
+ constructor();
+ }
+
+ enum DataPointType {
+ Measurement = 0,
+ Aggregation = 1,
+ }
+
+ class DataPoint {
+ name: string;
+ kind: AI.DataPointType;
+ value: number;
+ count: number;
+ min: number;
+ max: number;
+ stdDev: number;
+ constructor();
+ }
+
+ class EventData extends Microsoft.Telemetry.Domain {
+ ver: number;
+ name: string;
+ properties: any;
+ measurements: any;
+ constructor();
+ }
+
+ class PageViewData extends AI.EventData {
+ ver: number;
+ url: string;
+ name: string;
+ duration: string;
+ referrer: string;
+ referrerData: string;
+ properties: any;
+ measurements: any;
+ constructor();
+ }
+
+ class PageViewPerfData extends AI.PageViewData {
+ ver: number;
+ url: string;
+ perfTotal: string;
+ name: string;
+ duration: string;
+ networkConnect: string;
+ referrer: string;
+ sentRequest: string;
+ referrerData: string;
+ receivedResponse: string;
+ domProcessing: string;
+ properties: any;
+ measurements: any;
+ constructor();
+ }
+
+ class RemoteDependencyData extends Microsoft.Telemetry.Domain {
+ ver: number;
+ name: string;
+ id: string;
+ resultCode: string;
+ kind: AI.DataPointType;
+ value: number;
+ count: number;
+ min: number;
+ max: number;
+ stdDev: number;
+ dependencyKind: AI.DependencyKind;
+ success: boolean;
+ async: boolean;
+ dependencySource: AI.DependencySourceType;
+ commandName: string;
+ dependencyTypeName: string;
+ properties: any;
+ constructor();
+ }
+
+ class MessageData extends Microsoft.Telemetry.Domain {
+ ver: number;
+ message: string;
+ severityLevel: AI.SeverityLevel;
+ properties: any;
+ constructor();
+ }
+}
+
+declare module Microsoft.ApplicationInsights.Context {
+ interface IApplication {
+ /**
+ * The application version.
+ */
+ ver: string;
+ /**
+ * The application build version.
+ */
+ build: string;
+ }
+
+ interface IDevice {
+ /**
+ * The type for the current device.
+ */
+ type: string;
+ /**
+ * A device unique ID.
+ */
+ id: string;
+ /**
+ * The device OEM for the current device.
+ */
+ oemName: string;
+ /**
+ * The device model for the current device.
+ */
+ model: string;
+ /**
+ * The IANA interface type for the internet connected network adapter.
+ */
+ network: number;
+ /**
+ * The application screen resolution.
+ */
+ resolution: string;
+ /**
+ * The current display language of the operating system.
+ */
+ locale: string;
+ /**
+ * The IP address.
+ */
+ ip: string;
+ /**
+ * The device language.
+ */
+ language: string;
+ /**
+ * The OS name.
+ */
+ os: string;
+ /**
+ * The OS version.
+ */
+ osversion: string;
+ }
+
+ interface ILocation {
+ /**
+ * Client IP address for reverse lookup
+ */
+ ip: string;
+ }
+
+ interface IInternal {
+ /**
+ * The SDK version used to create this telemetry item.
+ */
+ sdkVersion: string;
+ /**
+ * The SDK agent version.
+ */
+ agentVersion: string;
+ }
+
+ interface ISample {
+ /**
+ * Sample rate
+ */
+ sampleRate: number;
+ }
+
+ interface ISession {
+ /**
+ * The session ID.
+ */
+ id: string;
+ /**
+ * The true if this is the first session
+ */
+ isFirst: boolean;
+ /**
+ * The date at which this guid was genereated.
+ * Per the spec the ID will be regenerated if more than acquisitionSpan milliseconds ellapse from this time.
+ */
+ acquisitionDate: number;
+ /**
+ * The date at which this session ID was last reported.
+ * This value should be updated whenever telemetry is sent using this ID.
+ * Per the spec the ID will be regenerated if more than renewalSpan milliseconds elapse from this time with no activity.
+ */
+ renewalDate: number;
+ }
+
+ interface IOperation {
+ /**
+ * Operation id
+ */
+ id: string;
+ /**
+ * Operation name
+ */
+ name: string;
+ /**
+ * Parent operation id
+ */
+ parentId: string;
+ /**
+ * Root operation id
+ */
+ rootId: string;
+ /**
+ * Synthetic source of the operation
+ */
+ syntheticSource: string;
+ }
+
+ interface IUser {
+ /**
+ * The telemetry configuration.
+ */
+ config: any;
+ /**
+ * The user ID.
+ */
+ id: string;
+ /**
+ * Authenticated user id
+ */
+ authenticatedId: string;
+ /**
+ * The account ID.
+ */
+ accountId: string;
+ /**
+ * The account acquisition date.
+ */
+ accountAcquisitionDate: string;
+ /**
+ * The user agent string.
+ */
+ agent: string;
+ /**
+ * The store region.
+ */
+ storeRegion: string;
+ }
+}
+
+declare module Microsoft.Telemetry {
+ class Domain {
+ constructor();
+ }
+
+ class Base {
+ baseType: string;
+ constructor();
+ }
+
+ class Data extends Microsoft.Telemetry.Base {
+ baseType: string;
+ baseData: TDomain;
+ constructor();
+ }
+}
+
+declare module Microsoft.ApplicationInsights.Telemetry {
+
+ class Event implements Microsoft.ApplicationInsights.ISerializable {
+ static envelopeType: string;
+ static dataType: string;
+ ver: number;
+ name: string;
+ properties: any;
+ measurements: any;
+ aiDataContract: {
+ ver: Microsoft.ApplicationInsights.FieldType;
+ name: Microsoft.ApplicationInsights.FieldType;
+ properties: Microsoft.ApplicationInsights.FieldType;
+ measurements: Microsoft.ApplicationInsights.FieldType;
+ };
+ /**
+ * Constructs a new instance of the EventTelemetry object
+ */
+ constructor(name: string, properties?: Object, measurements?: Object);
+ }
+
+ class Exception implements Microsoft.ApplicationInsights.ISerializable {
+ static envelopeType: string;
+ static dataType: string;
+ ver: number;
+ handledAt: string;
+ exceptions: AI.ExceptionDetails[];
+ severityLevel: AI.SeverityLevel;
+ problemId: string;
+ crashThreadId: number;
+ properties: any;
+ measurements: any;
+ aiDataContract: {
+ ver: Microsoft.ApplicationInsights.FieldType;
+ handledAt: Microsoft.ApplicationInsights.FieldType;
+ exceptions: Microsoft.ApplicationInsights.FieldType;
+ severityLevel: Microsoft.ApplicationInsights.FieldType;
+ properties: Microsoft.ApplicationInsights.FieldType;
+ measurements: Microsoft.ApplicationInsights.FieldType;
+ };
+ /**
+ * Constructs a new isntance of the ExceptionTelemetry object
+ */
+ constructor(exception: Error, handledAt?: string, properties?: Object, measurements?: Object, severityLevel?: AI.SeverityLevel);
+ /**
+ * Creates a simple exception with 1 stack frame. Useful for manual constracting of exception.
+ */
+ static CreateSimpleException(message: string, typeName: string, assembly: string, fileName: string, details: string, line: number, handledAt?: string): Telemetry.Exception;
+ }
+
+ class Metric implements Microsoft.ApplicationInsights.ISerializable {
+ static envelopeType: string;
+ static dataType: string;
+ ver: number;
+ metrics: AI.DataPoint[];
+ properties: any;
+ aiDataContract: {
+ ver: Microsoft.ApplicationInsights.FieldType;
+ metrics: Microsoft.ApplicationInsights.FieldType;
+ properties: Microsoft.ApplicationInsights.FieldType;
+ };
+ /**
+ * Constructs a new instance of the MetricTelemetry object
+ */
+ constructor(name: string, value: number, count?: number, min?: number, max?: number, properties?: Object);
+ }
+
+ class PageView extends AI.PageViewData implements Microsoft.ApplicationInsights.ISerializable {
+ static envelopeType: string;
+ static dataType: string;
+ aiDataContract: {
+ ver: Microsoft.ApplicationInsights.FieldType;
+ name: Microsoft.ApplicationInsights.FieldType;
+ url: Microsoft.ApplicationInsights.FieldType;
+ duration: Microsoft.ApplicationInsights.FieldType;
+ properties: Microsoft.ApplicationInsights.FieldType;
+ measurements: Microsoft.ApplicationInsights.FieldType;
+ };
+ /**
+ * Constructs a new instance of the PageEventTelemetry object
+ */
+ constructor(name?: string, url?: string, durationMs?: number, properties?: any, measurements?: any);
+ }
+
+ class PageViewPerformance extends AI.PageViewPerfData implements Microsoft.ApplicationInsights.ISerializable {
+ static envelopeType: string;
+ static dataType: string;
+ aiDataContract: {
+ ver: Microsoft.ApplicationInsights.FieldType;
+ name: Microsoft.ApplicationInsights.FieldType;
+ url: Microsoft.ApplicationInsights.FieldType;
+ duration: Microsoft.ApplicationInsights.FieldType;
+ perfTotal: Microsoft.ApplicationInsights.FieldType;
+ networkConnect: Microsoft.ApplicationInsights.FieldType;
+ sentRequest: Microsoft.ApplicationInsights.FieldType;
+ receivedResponse: Microsoft.ApplicationInsights.FieldType;
+ domProcessing: Microsoft.ApplicationInsights.FieldType;
+ properties: Microsoft.ApplicationInsights.FieldType;
+ measurements: Microsoft.ApplicationInsights.FieldType;
+ };
+ /**
+ * Field indicating whether this instance of PageViewPerformance is valid and should be sent
+ */
+ private isValid;
+ /**
+ * Indicates whether this instance of PageViewPerformance is valid and should be sent
+ */
+ getIsValid(): boolean;
+ private durationMs;
+ /**
+ * Gets the total duration (PLT) in milliseconds. Check getIsValid() before using this method.
+ */
+ getDurationMs(): number;
+ /**
+ * Constructs a new instance of the PageEventTelemetry object
+ */
+ constructor(name: string, url: string, unused: number, properties?: any, measurements?: any);
+ static getPerformanceTiming(): PerformanceTiming;
+ /**
+ * Returns true is window performance timing API is supported, false otherwise.
+ */
+ static isPerformanceTimingSupported(): PerformanceTiming;
+ /**
+ * As page loads different parts of performance timing numbers get set. When all of them are set we can report it.
+ * Returns true if ready, false otherwise.
+ */
+ static isPerformanceTimingDataReady(): boolean;
+ static getDuration(start: any, end: any): number;
+ }
+
+ class RemoteDependencyData extends AI.RemoteDependencyData implements Microsoft.ApplicationInsights.ISerializable {
+ static envelopeType: string;
+ static dataType: string;
+ aiDataContract: {
+ id: Microsoft.ApplicationInsights.FieldType;
+ ver: Microsoft.ApplicationInsights.FieldType;
+ name: Microsoft.ApplicationInsights.FieldType;
+ kind: Microsoft.ApplicationInsights.FieldType;
+ value: Microsoft.ApplicationInsights.FieldType;
+ count: Microsoft.ApplicationInsights.FieldType;
+ min: Microsoft.ApplicationInsights.FieldType;
+ max: Microsoft.ApplicationInsights.FieldType;
+ stdDev: Microsoft.ApplicationInsights.FieldType;
+ dependencyKind: Microsoft.ApplicationInsights.FieldType;
+ success: Microsoft.ApplicationInsights.FieldType;
+ async: Microsoft.ApplicationInsights.FieldType;
+ dependencySource: Microsoft.ApplicationInsights.FieldType;
+ commandName: Microsoft.ApplicationInsights.FieldType;
+ dependencyTypeName: Microsoft.ApplicationInsights.FieldType;
+ properties: Microsoft.ApplicationInsights.FieldType;
+ resultCode: Microsoft.ApplicationInsights.FieldType;
+ };
+ /**
+ * Constructs a new instance of the RemoteDependencyData object
+ */
+ constructor(id: string, absoluteUrl: string, commandName: string, value: number, success: boolean, resultCode: number, method?: string);
+ private formatDependencyName(method, absoluteUrl);
+ }
+
+ class Trace extends AI.MessageData implements Microsoft.ApplicationInsights.ISerializable {
+ static envelopeType: string;
+ static dataType: string;
+ aiDataContract: {
+ ver: Microsoft.ApplicationInsights.FieldType;
+ message: Microsoft.ApplicationInsights.FieldType;
+ severityLevel: Microsoft.ApplicationInsights.FieldType;
+ measurements: Microsoft.ApplicationInsights.FieldType;
+ properties: Microsoft.ApplicationInsights.FieldType;
+ };
+ /**
+ * Constructs a new instance of the MetricTelemetry object
+ */
+ constructor(message: string, properties?: Object);
+ }
+}
+
+declare module Microsoft.ApplicationInsights.Telemetry.Common {
+ class Base extends Microsoft.Telemetry.Base implements Microsoft.ApplicationInsights.ISerializable {
+ /**
+ * The data contract for serializing this object.
+ */
+ aiDataContract: {};
+ }
+
+ class Data extends Microsoft.Telemetry.Data implements Microsoft.ApplicationInsights.ISerializable {
+ /**
+ * The data contract for serializing this object.
+ */
+ aiDataContract: {
+ baseType: FieldType;
+ baseData: FieldType;
+ };
+ /**
+ * Constructs a new instance of telemetry data.
+ */
+ constructor(type: string, data: TDomain);
+ }
+
+ class Envelope implements IEnvelope {
+ ver: number;
+ name: string;
+ time: string;
+ sampleRate: number;
+ seq: string;
+ iKey: string;
+ flags: number;
+ deviceId: string;
+ os: string;
+ osVer: string;
+ appId: string;
+ appVer: string;
+ userId: string;
+ tags: any;
+ data: Base;
+
+ /**
+ * The data contract for serializing this object.
+ */
+ aiDataContract: any;
+ /**
+ * Constructs a new instance of telemetry data.
+ */
+ constructor(data: Microsoft.Telemetry.Base, name: string);
+ }
+
+ class DataSanitizer {
+ static sanitizeKeyAndAddUniqueness(key: any, map: any): any;
+ static sanitizeKey(name: any): any;
+ static sanitizeString(value: any): any;
+ static sanitizeUrl(url: any): any;
+ static sanitizeMessage(message: any): any;
+ static sanitizeException(exception: any): any;
+ static sanitizeProperties(properties: any): any;
+ static sanitizeMeasurements(measurements: any): any;
+ static padNumber(num: any): string;
+ }
+}
+
+declare module Microsoft.ApplicationInsights {
+ interface IConfig {
+ instrumentationKey?: string;
+ endpointUrl?: string;
+ emitLineDelimitedJson?: boolean;
+ accountId?: string;
+ sessionRenewalMs?: number;
+ sessionExpirationMs?: number;
+ maxBatchSizeInBytes?: number;
+ maxBatchInterval?: number;
+ enableDebug?: boolean;
+ disableExceptionTracking?: boolean;
+ disableTelemetry?: boolean;
+ verboseLogging?: boolean;
+ diagnosticLogInterval?: number;
+ samplingPercentage?: number;
+ autoTrackPageVisitTime?: boolean;
+ disableAjaxTracking?: boolean;
+ overridePageViewDuration?: boolean;
+ maxAjaxCallsPerView?: number;
+ disableDataLossAnalysis?: boolean;
+ disableCorrelationHeaders?: boolean;
+ disableFlushOnBeforeUnload?: boolean;
+ enableSessionStorageBuffer?: boolean;
+ cookieDomain?: string;
+ url?: string;
+ }
+
+ /**
+ * Enum is used in aiDataContract to describe how fields are serialized.
+ * For instance: (Fieldtype.Required | FieldType.Array) will mark the field as required and indicate it's an array
+ */
+ enum FieldType {
+ Default = 0,
+ Required = 1,
+ Array = 2,
+ Hidden = 4,
+ }
+
+ interface ISerializable {
+ /**
+ * The set of fields for a serializeable object.
+ * This defines the serialization order and a value of true/false
+ * for each field defines whether the field is required or not.
+ */
+ aiDataContract: any;
+ }
+
+ interface IEnvelope extends ISerializable {
+ ver: number;
+ name: string;
+ time: string;
+ sampleRate: number;
+ seq: string;
+ iKey: string;
+ flags: number;
+ deviceId: string;
+ os: string;
+ osVer: string;
+ appId: string;
+ appVer: string;
+ userId: string;
+ tags: {
+ [name: string]: any;
+ };
+ }
+
+ interface ITelemetryContext {
+ /**
+ * The object describing a component tracked by this object.
+ */
+ application: Context.IApplication;
+ /**
+ * The object describing a device tracked by this object.
+ */
+ device: Context.IDevice;
+ /**
+ * The object describing internal settings.
+ */
+ internal: Context.IInternal;
+ /**
+ * The object describing a location tracked by this object.
+ */
+ location: Context.ILocation;
+ /**
+ * The object describing a operation tracked by this object.
+ */
+ operation: Context.IOperation;
+ /**
+ * The object describing sampling settings.
+ */
+ sample: Context.ISample;
+ /**
+ * The object describing a user tracked by this object.
+ */
+ user: Context.IUser;
+ /**
+ * The object describing a session tracked by this object.
+ */
+ session: Context.ISession;
+ /**
+ * Adds telemetry initializer to the collection. Telemetry initializers will be called one by one
+ * before telemetry item is pushed for sending and in the order they were added.
+ */
+ addTelemetryInitializer(telemetryInitializer: (envelope: Microsoft.ApplicationInsights.IEnvelope) => boolean): any;
+ /**
+ * Tracks telemetry object.
+ */
+ track(envelope: Microsoft.ApplicationInsights.IEnvelope): any;
+ }
+
+ interface IAppInsights {
+ config: IConfig;
+ context: ITelemetryContext;
+ queue: (() => 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.
+ * @param name A string that idenfities this item, unique within this HTML document. Defaults to the document title.
+ */
+ startTrackPage(name?: string): any;
+ /**
+ * Logs how long a page or other item was visible, after {@link startTrackPage}. Call this when the page closes.
+ * @param name The string you used as the name in startTrackPage. Defaults to the document title.
+ * @param url String - a relative or absolute URL that identifies the page or other item. Defaults to the window location.
+ * @param properties map[string, string] - additional data used to filter pages and metrics in the portal. Defaults to empty.
+ * @param measurements map[string, number] - metrics associated with this page, displayed in Metrics Explorer on the portal. Defaults to empty.
+ */
+ stopTrackPage(name?: string, url?: string, properties?: {
+ [name: string]: string;
+ }, measurements?: {
+ [name: string]: number;
+ }): any;
+ /**
+ * Logs that a page or other item was viewed.
+ * @param name The string you used as the name in startTrackPage. Defaults to the document title.
+ * @param url String - a relative or absolute URL that identifies the page or other item. Defaults to the window location.
+ * @param properties map[string, string] - additional data used to filter pages and metrics in the portal. Defaults to empty.
+ * @param measurements map[string, number] - metrics associated with this page, displayed in Metrics Explorer on the portal. Defaults to empty.
+ * @param duration number - the number of milliseconds it took to load the page. Defaults to undefined. If set to default value, page load time is calculated internally.
+ */
+ trackPageView(name?: string, url?: string, properties?: {
+ [name: string]: string;
+ }, measurements?: {
+ [name: string]: number;
+ }, duration?: number): any;
+ /**
+ * Start timing an extended event. Call {@link stopTrackEvent} to log the event when it ends.
+ * @param name A string that identifies this event uniquely within the document.
+ */
+ startTrackEvent(name: string): any;
+ /**
+ * Log an extended event that you started timing with {@link startTrackEvent}.
+ * @param name The string you used to identify this event in startTrackEvent.
+ * @param properties map[string, string] - additional data used to filter events and metrics in the portal. Defaults to empty.
+ * @param measurements map[string, number] - metrics associated with this event, displayed in Metrics Explorer on the portal. Defaults to empty.
+ */
+ stopTrackEvent(name: string, properties?: {
+ [name: string]: string;
+ }, measurements?: {
+ [name: string]: number;
+ }): any;
+ /**
+ * Log a user action or other occurrence.
+ * @param name A string to identify this event in the portal.
+ * @param properties map[string, string] - additional data used to filter events and metrics in the portal. Defaults to empty.
+ * @param measurements map[string, number] - metrics associated with this event, displayed in Metrics Explorer on the portal. Defaults to empty.
+ */
+ trackEvent(name: string, properties?: {
+ [name: string]: string;
+ }, measurements?: {
+ [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 an exception you have caught.
+ * @param exception An Error from a catch clause, or the string error message.
+ * @param properties map[string, string] - additional data used to filter events and metrics in the portal. Defaults to empty.
+ * @param measurements map[string, number] - metrics associated with this event, displayed in Metrics Explorer on the portal. Defaults to empty.
+ * @param severityLevel AI.SeverityLevel - severity level
+ */
+ trackException(exception: Error, handledAt?: string, properties?: {
+ [name: string]: string;
+ }, measurements?: {
+ [name: string]: number;
+ }, severityLevel?: AI.SeverityLevel): any;
+ /**
+ * Log a numeric value that is not associated with a specific event. Typically used to send regular reports of performance indicators.
+ * To send a single measurement, use just the first two parameters. If you take measurements very frequently, you can reduce the
+ * telemetry bandwidth by aggregating multiple measurements and sending the resulting average at intervals.
+ * @param name A string that identifies the metric.
+ * @param average Number representing either a single measurement, or the average of several measurements.
+ * @param sampleCount The number of measurements represented by the average. Defaults to 1.
+ * @param min The smallest measurement in the sample. Defaults to the average.
+ * @param max The largest measurement in the sample. Defaults to the average.
+ */
+ trackMetric(name: string, average: number, sampleCount?: number, min?: number, max?: number, properties?: {
+ [name: string]: string;
+ }): any;
+ /**
+ * 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.
+ */
+ trackTrace(message: string, properties?: {
+ [name: string]: string;
+ }): any;
+ /**
+ * Immediately send all queued telemetry.
+ */
+ flush(): any;
+ /**
+ * Sets the autheticated user id and the account id in this session.
+ * User auth id and account id should be of type string. They should not contain commas, semi-colons, equal signs, spaces, or vertical-bars.
+ *
+ * @param authenticatedUserId {string} - The authenticated user id. A unique and persistent string that represents each authenticated user in the service.
+ * @param accountId {string} - An optional string to represent the account associated with the authenticated user.
+ */
+ setAuthenticatedUserContext(authenticatedUserId: string, accountId?: string): any;
+ /**
+ * Clears the authenticated user id and the account id from the user context.
+ */
+ clearAuthenticatedUserContext(): any;
+ downloadAndSetup?(config: Microsoft.ApplicationInsights.IConfig): void;
+ /**
+ * The custom error handler for Application Insights
+ * @param {string} message - The error message
+ * @param {string} url - The url where the error was raised
+ * @param {number} lineNumber - The line number where the error was raised
+ * @param {number} columnNumber - The column number for the line where the error was raised
+ * @param {Error} error - The Error object
+ */
+ _onerror(message: string, url: string, lineNumber: number, columnNumber: number, error: Error): any;
+ }
+}
+
+declare module 'applicationinsights-js' {
+ export let AppInsights: Microsoft.ApplicationInsights.IAppInsights;
+}
+
+declare var appInsights: Microsoft.ApplicationInsights.IAppInsights;
\ No newline at end of file
diff --git a/applicationinsights/applicationinsights.d.ts b/applicationinsights/applicationinsights.d.ts
index 17ca4a479f..96d5773fa5 100644
--- a/applicationinsights/applicationinsights.d.ts
+++ b/applicationinsights/applicationinsights.d.ts
@@ -341,9 +341,31 @@ interface Client {
trackMetric(name: string, value: number, count?:number, min?: number, max?: number, stdDev?: number, properties?: {
[key: string]: string;
}): void;
+
+ /**
+ * Log an incoming http request to your server. The request data will be tracked during the response "finish" event if it is successful or the request "error"
+ * event if it fails. The request duration is automatically calculated as the timespan between when the trackRequest method was called, and when the response "finish"
+ * or request "error" events were fired.
+ * @param request The http.ServerRequest object to track
+ * @param response The http.ServerResponse object for this request
+ * @param properties map[string, string] - additional data used to filter requests in the portal. Defaults to empty.
+ */
trackRequest(request: any /* http.ServerRequest */, response: any /* http.ServerResponse */, properties?: {
[key: string]: string;
}): void;
+
+ /**
+ * Log an incoming http request to your server. The request data is tracked synchronously rather than waiting for the response "finish"" or request "error"" events.
+ * Use this if you need your request telemetry to respect custom app insights operation and user context (for example if you set any appInsights.client.context.tags).
+ * @param request The http.ServerRequest object to track
+ * @param response The http.ServerResponse object for this request
+ * @param ellapsedMilliseconds The duration for this request. Defaults to 0.
+ * @param properties map[string, string] - additional data used to filter requests in the portal. Defaults to empty.
+ * @param error An error that was returned for this request if it was unsuccessful. Defaults to null.
+ */
+ trackRequestSync(request: any /*http.ServerRequest */, response: any /*http.ServerResponse */, ellapsedMilliseconds?: number, properties?: {
+ [key: string]: string;}, error?: any) : void;
+
/**
* Log information about a dependency of your app. Typically used to track the time database calls or outgoing http requests take from your server.
* @param name The name of the dependency (i.e. "myDatabse")
diff --git a/arcgis-js-api/arcgis-js-api.d.ts b/arcgis-js-api/arcgis-js-api.d.ts
index 01d8a02c12..65765fbb09 100644
--- a/arcgis-js-api/arcgis-js-api.d.ts
+++ b/arcgis-js-api/arcgis-js-api.d.ts
@@ -1,4 +1,4 @@
-// Type definitions for ArcGIS API for JavaScript v3.16
+// Type definitions for ArcGIS API for JavaScript v3.17
// Project: http://js.arcgis.com
// Definitions by: Esri
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -18,7 +18,6 @@ declare module "esri" {
import BasemapLayer = require("esri/dijit/BasemapLayer");
import Symbol = require("esri/symbols/Symbol");
import BookmarkItem = require("esri/dijit/BookmarkItem");
- import Units = require("esri/units");
import Color = require("esri/Color");
import LocationProviderBase = require("esri/tasks/locationproviders/LocationProviderBase");
import PictureMarkerSymbol = require("esri/symbols/PictureMarkerSymbol");
@@ -45,6 +44,7 @@ declare module "esri" {
import QueryTask = require("esri/tasks/QueryTask");
import TextSymbol = require("esri/symbols/TextSymbol");
import StandardGeographyQueryTask = require("esri/tasks/geoenrichment/StandardGeographyQueryTask");
+ import WMSLayerInfo = require("esri/layers/WMSLayerInfo");
import WMTSLayerInfo = require("esri/layers/WMTSLayerInfo");
export interface AGSMouseEvent extends MouseEvent {
@@ -354,7 +354,7 @@ declare module "esri" {
/** Radius of the circle. */
radius?: number;
/** Unit of the radius. */
- radiusUnit?: Units;
+ radiusUnit?: string;
}
export interface CircleOptions2 {
/** The center point of the circle. */
@@ -366,7 +366,7 @@ declare module "esri" {
/** The radius of the circle. */
radius?: number;
/** Unit of the radius. */
- radiusUnit?: Units;
+ radiusUnit?: string;
}
export interface ClassedColorSliderOptions {
/** Data map containing renderer information. */
@@ -643,6 +643,8 @@ declare module "esri" {
minStops?: number;
/** When true, stops on the route are re-ordered to provide an optimal route. */
optimalRoute?: boolean;
+ /** If specified, this specifies the portal where the produced route layers are going to be stored and accessed. */
+ portalUrl?: string;
/** URL link to a custom print page. */
printPage?: string;
/** If available, this print task is used to display an overview map of the route on the directions print page (Added at v3.11). */
@@ -677,6 +679,8 @@ declare module "esri" {
showReturnToStartOption?: boolean;
/** Display the 'Show Reverse Stops' button. */
showReverseStopsButton?: boolean;
+ /** Applicable if the widget works with a Network Analyst Server federated with ArcGIS Online or Portal. */
+ showSaveButton?: boolean;
/** Highlight the route segment when a directions step is clicked. */
showSegmentHighlight?: boolean;
/** Display a popup with segment details when a direction step is clicked. */
@@ -911,6 +915,8 @@ declare module "esri" {
layer: FeatureLayer;
}
export interface FeatureTableOptions {
+ /** The number of features a service will try to fetch. */
+ batchCount?: number;
/** Object defining the date options specifically for formatting date and time editors. */
dateOptions?: any;
/** Sets the editing state for the FeatureTable. */
@@ -931,12 +937,18 @@ declare module "esri" {
menuFunctions?: any[];
/** Attribute fields to include in the FeatureTable. */
outFields?: string[];
+ /** Displays or hides the attachment column. */
+ showAttachments?: boolean;
/** Displays the data type of the field right under the field label. */
showDataTypes?: boolean;
+ /** Displays or hides total number of features and selected number of features in the grid header. */
+ showFeatureCount?: boolean;
/** Displays or hides the FeatureTable header. */
showGridHeader?: boolean;
/** Displays or hides 'Options' drop-down menu of the FeatureTable. */
showGridMenu?: boolean;
+ /** Displays or hides the 'Statistics' option in column menus for numeric fields. */
+ showStatistics?: boolean;
/** Enables an interaction between the map and the feature table. */
syncSelection?: boolean;
/** Enables pan/zoom to selected features on the map when the table in 'sync selection' mode. */
@@ -1187,10 +1199,20 @@ declare module "esri" {
gdbVersion?: string;
}
export interface ImageServiceMeasureOptions {
+ /** The angular unit in which directions of line segments will be calculated. */
+ angularUnit?: string;
+ /** The area unit in which areas of polygons will be calculated. */
+ areaUnit?: string;
+ /** Defines whether to show the widget result in a popup or in the widget's result area when the widget has 'toolbar' layout. */
+ displayMeasureResultInPopup?: boolean;
/** Symbol to be used when drawing a polygon or extent. */
fillSymbol?: SimpleFillSymbol;
/** Image service layer with which the toolbar is associated. */
layer: ArcGISImageServiceLayer;
+ /** Defines the layout of the widget. */
+ layout?: string;
+ /** The linear unit in which height, length, or perimeters will be calculated. */
+ linearUnit?: string;
/** Symbol to be used when drawing a line. */
lineSymbol?: SimpleLineSymbol;
/** Map instance with which the toolbar is associate. */
@@ -1402,9 +1424,9 @@ declare module "esri" {
/** Flag for showing full list of units in the Location tool. */
advancedLocationUnits?: boolean;
/** The default area unit for the measure area tool. */
- defaultAreaUnit?: Units;
+ defaultAreaUnit?: string;
/** The default length unit for the measure distance tool. */
- defaultLengthUnit?: Units;
+ defaultLengthUnit?: string;
/** Allows the user to immediately measure previously-created geometry on dijit creation. */
geometry?: Point | Polyline | Polygon;
/** Line symbol used to draw the lines for the measure line and measure distance tools. */
@@ -2190,6 +2212,28 @@ declare module "esri" {
/** The well-known ID of the spatial reference used by the WFSLayer. */
wkid?: string;
}
+ export interface WMSLayerInfoOptions {
+ /** All the bounding extents defined for this layer. */
+ allExtents?: Extent[];
+ /** A description of the WMS layer. */
+ description?: string;
+ /** The extent of the WMS Layer. */
+ extent?: Extent;
+ /** The URL to the legend image. */
+ legendURL?: string;
+ /** The name of the WMS layer. */
+ name: string;
+ /** Returns true if the layer can be queried and the service supports GetFeatureInfo with either text/html or text/plain formats. */
+ queryable?: boolean;
+ /** Indicates if this layer should be included in the popup. */
+ showPopup?: boolean;
+ /** All the spatial references defined for this layer. */
+ spatialReferences?: SpatialReference[];
+ /** WMSLayerInfos of the layer's sub layers. */
+ subLayers?: WMSLayerInfo[];
+ /** The title of the WMS layer. */
+ title?: string;
+ }
export interface WMSLayerOptions {
/** Specify the map image format, valid options are png,jpg,bmp,gif,svg. */
format?: string;
@@ -3732,6 +3776,8 @@ declare module "esri/dijit/Directions" {
maxStopsReached: boolean;
/** Read-only: The graphic for the calculated route. */
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. */
@@ -3744,6 +3790,8 @@ declare module "esri/dijit/Directions" {
showClearButton: boolean;
/** If true, the toggle button group allowing user to choose between Miles and Kilometers is shown. */
showMilesKilometersOption: boolean;
+ /** Applicable if the widget works with a Network Analyst Server federated with ArcGIS Online or Portal. */
+ showSaveButton: boolean;
/** If true, and supported by the service, then two toggle button groups are shown: one to allow user to choose between driving a car, a truck, or walking, and one more group to choose between fastest or shortest routes. */
showTravelModesOption: boolean;
/** An array of graphics that define the stop locations along the route. */
@@ -3792,6 +3840,11 @@ declare module "esri/dijit/Directions" {
* @param index The index of the route segment to highlight.
*/
highlightSegment(index: number): void;
+ /**
+ * Loads a stored route layer from either ArcGIS Online or Portal
+ * @param itemId The itemId of the stored route layer from either ArcGIS Online or Portal.
+ */
+ loadRoute(itemId: string): any;
/**
* Remove the stop at the specified index.
* @param index The index of the stop to remove.
@@ -3801,6 +3854,16 @@ declare module "esri/dijit/Directions" {
removeStops(): any;
/** Resets the directions widget removing any directions, stops and map graphics. */
reset(): any;
+ /**
+ * Specify the language used for the directions.
+ * @param locale The locale used for the directions.
+ */
+ setDirectionsLanguage(locale: string): any;
+ /**
+ * Specify the length units used for the directions widget.
+ * @param units The length units used for the directions widget.
+ */
+ setDirectionsLengthUnits(units: string): any;
/**
* If widget runs with Travel Modes enabled, call this method to switch to particular Travel mode programmatically.
* @param travelModeName Travel mode.
@@ -3843,10 +3906,16 @@ declare module "esri/dijit/Directions" {
on(type: "directions-finish", listener: (event: { result: RouteResult; target: Directions }) => void): esri.Handle;
/** Fires when the route services starts to calculate the route. */
on(type: "directions-start", listener: (event: { target: Directions }) => void): esri.Handle;
+ /** Fires after a user clicks the Save or Save as New button and subsequently does not have permission to create an item in ArcGIS Online or Portal. */
+ on(type: "feature-collection-created", listener: (event: { target: Directions }) => void): esri.Handle;
/** Fires when the directions widget has fully loaded. */
on(type: "load", listener: (event: { target: Directions }) => void): esri.Handle;
/** Fires when the widget starts or stops listening for map clicks. */
on(type: "map-click-active", listener: (event: { mapClickActive: boolean; target: Directions }) => void): esri.Handle;
+ /** Fires after a user clicks the Save or Save as New button for the first time in order to store a new route in either ArcGIS Online or Portal. */
+ on(type: "route-item-created", listener: (event: { target: Directions }) => void): esri.Handle;
+ /** Fires when a existing route layer item is successfully updated in ArcGIS Online or Portal after user clicks the Save button. */
+ on(type: "route-item-updated", listener: (event: { target: Directions }) => void): esri.Handle;
/** Fired when you hover over a route segment in the directions display. */
on(type: "segment-highlight", listener: (event: { graphic: Graphic; target: Directions }) => void): esri.Handle;
/** Fires when a route segment is selected in the directions display. */
@@ -3901,6 +3970,8 @@ declare module "esri/dijit/FeatureTable" {
/** Creates an instance of the FeatureTable widget within the provided DOM node. */
class FeatureTable {
+ /** The number of features a service will try to fetch. */
+ batchCount: number;
/** Read-only: A reference to the column objects and their parameters. */
columns: any[];
/** Read-only: Reference to the dataStore used by the dGrid. */
@@ -3909,6 +3980,8 @@ declare module "esri/dijit/FeatureTable" {
dateOptions: any;
/** Sets the editing state for the FeatureTable. */
editable: boolean;
+ /** Event trigger(s) used to display editing interface for an individual cell. */
+ editOn: string | any;
/** Read-only: Number of records displayed in FeatureTable. */
featureCount: number;
/** The featureLayer that the table is associated with. */
@@ -3937,12 +4010,18 @@ declare module "esri/dijit/FeatureTable" {
selectedRowIds: number[];
/** Read-only: Each element in the array is an object that contains name-value pair of fields and field values associated with the selected rows. */
selectedRows: any[];
- /** Displays the data type of the field right under the field label in the column header. */
+ /** Displays or hides the attachment column. */
+ showAttachments: boolean;
+ /** Displays or hides the data type of the field right under the field label in the column header. */
showDataTypes: boolean;
+ /** Displays or hides total number of features and selected number of features in the grid header. */
+ showFeatureCount: boolean;
/** Displays or hides the FeatureTable header. */
showGridHeader: boolean;
/** Displays or hides 'Options' drop-down menu of the FeatureTable. */
showGridMenu: boolean;
+ /** Displays or hides the 'Statistics' option in column menus for numeric fields. */
+ showStatistics: boolean;
/** Enables an interaction between the map and the feature table. */
syncSelection: boolean;
/** Enables pans to selected features on the map when the table in 'sync selection' mode. */
@@ -3953,6 +4032,29 @@ declare module "esri/dijit/FeatureTable" {
* @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into.
*/
constructor(params: esri.FeatureTableOptions, srcNodeRef: Node | string);
+ /** Removes all current selections including subsets from filterSelectedRecords(). */
+ clearSelection(): void;
+ /** Destroys the FeatureTable widget. */
+ destroy(): void;
+ /**
+ * Allows users to see the sub-set of currently selected records (uses dGrid.query).
+ * @param toggle When true only a subset of currently selected features will be displayed in the FeatureTable.
+ */
+ filterSelectedRecords(toggle: boolean): void;
+ /**
+ * Queries and gets selected features from the FeatureLayer instead of the store.
+ * @param id Array of row ids
+ */
+ getFeatureDataById(id: number[]): any;
+ /**
+ * Gets row object by the row ID.
+ * @param id row ID
+ */
+ getRowDataById(id: number): any;
+ /** Refreshes the data in the grid. */
+ refresh(): void;
+ /** Resizes the grid's container. */
+ resize(): void;
/** Finalizes the creation of the widget. */
startup(): void;
/** Fires when the grid column is resized. */
@@ -4286,8 +4388,13 @@ declare module "esri/dijit/ImageServiceMeasure" {
/**
* Creates an instance of the ImageServiceMeasure widget.
* @param params An Object containing constructor options.
+ * @param srcNode Reference or id of the HTML element where the widget should be rendered.
*/
- constructor(params: esri.ImageServiceMeasureOptions);
+ constructor(params: esri.ImageServiceMeasureOptions, srcNode: Node | string);
+ /** Destroys the ImageServiceMeasure widget. */
+ destroy(): void;
+ /** Finalizes the creation of the widget. */
+ startup(): void;
}
export = ImageServiceMeasure;
}
@@ -4528,9 +4635,14 @@ declare module "esri/dijit/LayerSwipe" {
declare module "esri/dijit/Legend" {
import esri = require("esri");
+ import Map = require("esri/map");
/** The legend dijit displays a label and symbol for some or all of the layers in the map. */
class Legend {
+ /** Specify a subset of the layers in the map to display in the legend. */
+ layerInfos: any[];
+ /** Reference to the map. */
+ map: Map;
/**
* Creates a new Legend dijit.
* @param params Parameters used to configure the dijit.
@@ -4555,7 +4667,7 @@ declare module "esri/dijit/LocateButton" {
import Symbol = require("esri/symbols/Symbol");
import Graphic = require("esri/graphic");
- /** LocateButton provides a simple button to locate and zoom to the users current location. */
+ /** LocateButton provides a simple button to locate and zoom to the user's location. */
class LocateButton {
/** Centers the map to the location when a new position is returned. */
centerAt: boolean;
@@ -6767,7 +6879,7 @@ declare module "esri/dijit/editing/Add" {
import esri = require("esri");
import OperationBase = require("esri/OperationBase");
- /** The esri/dijit/editing namespace contains editing related operations that inherit from OperationBase. */
+ /** This class is used with the UndoManager to provide undo/redo functionality of Add operations when editing. */
class Add extends OperationBase {
/**
* Create a new Add operation.
@@ -6810,7 +6922,7 @@ declare module "esri/dijit/editing/Cut" {
import esri = require("esri");
import OperationBase = require("esri/OperationBase");
- /** The esri/dijit/editing namespace contains editing related operations that inherit from OperationBase. */
+ /** This class is used with the UndoManager to provide undo/redo functionality of Cut operations when editing. */
class Cut extends OperationBase {
/**
* Create a new Cut operation.
@@ -6829,7 +6941,7 @@ declare module "esri/dijit/editing/Delete" {
import esri = require("esri");
import OperationBase = require("esri/OperationBase");
- /** The esri/dijit/editing namespace contains editing related operations that inherit from OperationBase. */
+ /** This class is used with the UndoManager to provide undo/redo functionality of Delete operations when editing. */
class Delete extends OperationBase {
/**
* Create a new Delete operation.
@@ -6929,7 +7041,7 @@ declare module "esri/dijit/editing/Union" {
import esri = require("esri");
import OperationBase = require("esri/OperationBase");
- /** The esri/dijit/editing namespace contains editing related operations that inherit from OperationBase. */
+ /** This class is used with the UndoManager to provide undo/redo functionality of Union operations when editing. */
class Union extends OperationBase {
/**
* Create a new Union operation.
@@ -6948,7 +7060,7 @@ declare module "esri/dijit/editing/Update" {
import esri = require("esri");
import OperationBase = require("esri/OperationBase");
- /** The esri/dijit/editing namespace contains editing related operations that inherit from OperationBase. */
+ /** This class is used with the UndoManager to provide undo/redo functionality of Update operations when editing. */
class Update extends OperationBase {
/**
* Create a new Update operation.
@@ -8353,8 +8465,9 @@ declare module "esri/geometry/webMercatorUtils" {
/**
* Converts geometry from Web Mercator units to geographic units.
* @param geometry The geometry to convert.
+ * @param isLinear Indicates whether to work with linear values, i.e., do not normalize.
*/
- webMercatorToGeographic(geometry: Geometry): Geometry;
+ webMercatorToGeographic(geometry: Geometry, isLinear?: boolean): Geometry;
/**
* Translates the given Web Mercator coordinates to Longitude and Latitude.
* @param x The x coordinate value to convert.
@@ -10809,8 +10922,6 @@ declare module "esri/layers/VectorTileLayer" {
initialExtent: Extent;
/** The spatial reference of the layer. */
spatialReference: SpatialReference;
- /** The style object of the service with fully qualified URLs for glyphs and sprite. */
- style: any;
/** Contains information about the tiling scheme for the layer. */
tileInfo: TileInfo;
/** The URL to the vector tile service or style JSON that will be used to draw the layer. */
@@ -10821,6 +10932,8 @@ declare module "esri/layers/VectorTileLayer" {
* @param options Optional parameters.
*/
constructor(url: string | any, options?: esri.VectorTileLayerOptions);
+ /** Returns an object that contains the current style information for the layer. */
+ getStyle(): any;
/**
* Changes the style properties used to render the layers.
* @param styleUrl A url to a JSON file containing the stylesheet information to render the layer.
@@ -10835,14 +10948,15 @@ declare module "esri/layers/VectorTileLayer" {
declare module "esri/layers/WFSLayer" {
import esri = require("esri");
+ import GraphicsLayer = require("esri/layers/GraphicsLayer");
import Field = require("esri/layers/Field");
import Extent = require("esri/geometry/Extent");
import Graphic = require("esri/graphic");
import InfoTemplate = require("esri/InfoTemplate");
import Renderer = require("esri/renderers/Renderer");
- /** (Currently in beta) A layer for OGC Web Feature Services (WFS). */
- class WFSLayer {
+ /** (Currently in beta) A layer for OGC Web Feature Services (WFS). */
+ class WFSLayer extends GraphicsLayer {
/** An array of fields in the layer. */
fields: Field[];
/** The full extent of the layer. */
@@ -10864,17 +10978,11 @@ declare module "esri/layers/WFSLayer" {
* @param options See options table below for full descriptions of the properties needed for this object.
*/
constructor(options: esri.WFSLayerOptions);
- /** Creates the getFeature parameter based on the version, nsLayerName, nsGeometryFieldName, mode, wkid, inverseFilter, maxFeatures constructor parameters. */
- buildRequest(): string;
/**
- * Gets the WFS layer capabilities.
- * @param callback An array of WFS layers in JSON format.
+ * Creates a WFSLayer using the provided JSON object.
+ * @param json The input JSON.
*/
- getCapabilities(callback?: Function): void;
- /** Performs the getFeature request. */
- getFeature(): void;
- /** Returns a JSON Object containing all of the WFS parameters. */
- getWFSParameters(): any;
+ fromJson(json: Object): void;
/** Redraws all the graphics in the layer. */
redraw(): void;
/** Refreshes the features in the WFS layer. */
@@ -10885,8 +10993,8 @@ declare module "esri/layers/WFSLayer" {
setPointSymbol(): void;
/** Sets the default polygon symbol to be used if no renderer is specified. */
setPolygonSymbol(): void;
- /** Sets the WFS parameters using the provided JSON Object. */
- setWFSParameters(): void;
+ /** Converts the WFSLayer instance to a JSON object. */
+ toJson(): any;
}
export = WFSLayer;
}
@@ -10952,6 +11060,7 @@ declare module "esri/layers/WMSLayer" {
}
declare module "esri/layers/WMSLayerInfo" {
+ import esri = require("esri");
import Extent = require("esri/geometry/Extent");
/** The WMSLayerInfo class defines and provides information about layers in a WMS service. */
@@ -10966,6 +11075,10 @@ declare module "esri/layers/WMSLayerInfo" {
legendURL: string;
/** The layer name. */
name: string;
+ /** Returns true if the layer can be queried and the service supports GetFeatureInfo with either text/html or text/plain formats */
+ queryable: boolean;
+ /** Indicates if this layer should be included in the popup. */
+ showPopup: boolean;
/** An array of WKIDs of all spatial references defined for the layer. */
spatialReferences: number[];
/** WMSLayerInfos of the layer's sub layers. */
@@ -10974,9 +11087,9 @@ declare module "esri/layers/WMSLayerInfo" {
title: string;
/**
* Creates a new WMSLayerInfo object.
- * @param layer WMSLayerInfo layer object.
+ * @param options See options list for parameters.
*/
- constructor(layer: any);
+ constructor(options?: esri.WMSLayerInfoOptions);
}
export = WMSLayerInfo;
}
@@ -11584,7 +11697,7 @@ declare module "esri/opsdashboard/DataSourceProxy" {
displayFieldName: string;
/** Read-only: The collection of fields. */
fields: Field[];
- /** The geometry type. */
+ /** Read-only: The geometry type. */
geometryType: string;
/** Read-only: The id of the data source. */
id: string;
@@ -11611,8 +11724,8 @@ declare module "esri/opsdashboard/DataSourceProxy" {
executeQuery(query: Query): any;
/** An object that contains service level metadata about whether or not the layer supports queries using statistics, order by fields, DISTINCT, pagination, query with distance, and returning queries with extents. */
getAdvancedQueryCapabilities(): any;
- /** Retrieve the associated data source that supports selection. */
- getAssociatedSelectionDataSourceProxy(): any;
+ /** Retrieve the associated id of the data source that supports selection. */
+ getAssociatedSelectionDataSourceId(): any;
/** Get the associated popupInfo for the data source if any available. */
getPopupInfo(): any;
/** Get the associated render object for the data source if any available. */
@@ -11666,12 +11779,17 @@ declare module "esri/opsdashboard/ExtensionBase" {
static POLYLINE: any;
/** Read-only: Indicates if the host application is the Windows Operations Dashboard. */
isNative: boolean;
+ /** Read Only: It will list all of the Portal helper services. */
+ portalHelperServices: string;
/** Read-only: The URL to the ArcGIS.com site or in-house portal that you are currently signed in to. */
portalUrl: string;
/** Get the collection of data sources from the host application. */
getDataSourceProxies(): any;
- /** Get the data source corresponding to the data source id from the host application. */
- getDataSourceProxy(): any;
+ /**
+ * Get the data source corresponding to the data source id from the host application.
+ * @param dataSourceId The data source id
+ */
+ getDataSourceProxy(dataSourceId: string): any;
/** Get the collection of map widgets from the host application. */
getMapWidgetProxies(): any;
/**
@@ -11791,7 +11909,7 @@ declare module "esri/opsdashboard/GraphicsLayerProxy" {
minScale: number;
/** Read-only: The current host graphics layer opacity ratio. */
opacity: number;
- /** The current renderer used by the host graphics layer. */
+ /** Read-only: The current renderer used by the host graphics layer. */
renderer: Renderer;
/** Read-only: The current host graphics layer visibility. */
visible: boolean;
@@ -11928,8 +12046,6 @@ declare module "esri/opsdashboard/MapWidgetProxy" {
destroyGraphicsLayerProxy(graphicsLayerProxy: GraphicsLayerProxy): void;
/** Gets the current host map extent. */
getMapExtent(): any;
- /** Called by the host application when the extent of the host map has changed. */
- mapExtentChanged(): void;
/**
* Pans the map to a new location.
* @param mapPoint A new location with the same spatial reference as the host map.
@@ -14088,7 +14204,7 @@ declare module "esri/tasks/FindTask" {
url: string;
/**
* Creates a new FindTask object.
- * @param url URL to the ArcGIS Server REST resource that represents a layer in a service.
+ * @param url URL to the ArcGIS Server REST resource that represents a map service.
* @param options Optional parameters.
*/
constructor(url: string, options?: esri.FindTaskOptions);
@@ -15343,6 +15459,8 @@ declare module "esri/tasks/RouteParameters" {
startTimeIsUTC: boolean;
/** The set of stops loaded as network locations during analysis. */
stops: any;
+ /** If true , the TimeWindowStart and TimeWindowEnd attributes of a stop are in UTC time (milliseconds). */
+ timeWindowsAreUTC: boolean;
/** Travel modes define how a pedestrian, car, truck or other medium of transportation moves through the street network. */
travelMode: any;
/** If true, the hierarchy attribute for the network should be used in analysis. */
@@ -16696,7 +16814,7 @@ declare module "esri/tasks/query" {
static SPATIAL_REL_TOUCHES: any;
/** The feature from feature class 1 is completely enclosed by the feature from feature class 2. */
static SPATIAL_REL_WITHIN: any;
- /** Distance to buffer input geometry. */
+ /** Buffer distance for input geometries. */
distance: number;
/** The geometry to apply to the spatial filter. */
geometry: Geometry;
@@ -16738,7 +16856,7 @@ declare module "esri/tasks/query" {
text: string;
/** Specify a time extent for the query. */
timeExtent: TimeExtent;
- /** Distance unit. */
+ /** The unit for calculating the buffer distance. */
units: string;
/** A where clause for the query. */
where: string;
@@ -17055,7 +17173,7 @@ declare module "esri/toolbars/navigation" {
* @param symbol The SimpleFillSymbol used for the rubber band zoom.
*/
setZoomSymbol(symbol: Symbol): void;
- /** Zoom to full extent of base layer. */
+ /** Zoom to initial extent of base layer. */
zoomToFullExtent(): void;
/** Zoom to next extent in extent history. */
zoomToNextExtent(): void;
diff --git a/archiver/archiver.d.ts b/archiver/archiver.d.ts
index d5133555a4..b31c8ad619 100644
--- a/archiver/archiver.d.ts
+++ b/archiver/archiver.d.ts
@@ -24,7 +24,7 @@ declare module "archiver" {
interface Archiver extends STREAM.Transform {
pipe(writeStream: FS.WriteStream): void;
- append(readStream: FS.ReadStream, name: nameInterface): void;
+ append(source: FS.ReadStream | Buffer | string, name: nameInterface): void;
finalize(): void;
}
diff --git a/argv/argv-tests.ts b/argv/argv-tests.ts
new file mode 100644
index 0000000000..6d73c53ec7
--- /dev/null
+++ b/argv/argv-tests.ts
@@ -0,0 +1,15 @@
+///
+import argv = require('argv');
+argv.version( 'v1.0' );
+argv.info( 'Special script info' );
+argv.clear()
+.option({
+ name: 'option',
+ short: 'o',
+ type: 'string',
+ description: 'Defines an option for your script',
+ example: "'script --opiton=value' or 'script -o value'"
+})
+.run([ '--option=123', '-o', '123' ]);
+argv.run();
+argv.help();
diff --git a/argv/argv.d.ts b/argv/argv.d.ts
new file mode 100644
index 0000000000..182ffde861
--- /dev/null
+++ b/argv/argv.d.ts
@@ -0,0 +1,59 @@
+// Type definitions for argv
+// Project: https://www.npmjs.com/package/argv
+// Definitions by: Hookclaw
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+declare module "argv" {
+ // argv module
+ type args = {
+ targets:string[],
+ options:{[key:string]:any}
+ };
+
+ type helpOption = {
+ name: string,
+ type: string,
+ short?: string,
+ description?: string,
+ example?: string
+ };
+
+ type module = {
+ mod: string,
+ description: string,
+ options: {[key:string]:helpOption}
+ };
+
+ type typeFunction = (value:any, ...arglist:any[]) => any;
+
+ type argv = {
+
+ // Runs the arguments parser
+ run: ( argv?:string[] ) => args,
+
+ // Adding options to definitions list
+ option: ( mod:helpOption|helpOption[] ) => argv,
+
+ // Creating module
+ mod: ( object:module|module[] ) => argv,
+
+ // Creates custom type function
+ type: ( name:string|{[key:string]:typeFunction}, callback?:typeFunction ) => any,
+
+ // Setting version number, and auto setting version option
+ version: ( v:string ) => argv,
+
+ // Description setup
+ info: ( mod:string, description?:module ) => argv,
+
+ // Cleans out current options
+ clear: () => argv,
+
+ // Prints out the help doc
+ help: ( mod?:string ) => argv
+
+ };
+
+ var argv:argv;
+
+ export = argv;
+}
diff --git a/array-find-index/array-find-index-tests.ts b/array-find-index/array-find-index-tests.ts
new file mode 100644
index 0000000000..8c69a531e2
--- /dev/null
+++ b/array-find-index/array-find-index-tests.ts
@@ -0,0 +1,10 @@
+///
+
+import * as arrayFindIndex from 'array-find-index';
+
+arrayFindIndex(['rainbow', 'unicorn', 'pony'], x => x === 'unicorn');
+
+const ctx = {foo: 'rainbow'};
+arrayFindIndex(['rainbow', 'unicorn', 'pony'], function (x) {
+ return x === this.foo;
+}, ctx);
diff --git a/array-find-index/array-find-index.d.ts b/array-find-index/array-find-index.d.ts
new file mode 100644
index 0000000000..650cac2a16
--- /dev/null
+++ b/array-find-index/array-find-index.d.ts
@@ -0,0 +1,13 @@
+// Type definitions for array-find-index
+// Project: https://github.com/sindresorhus/array-find-index
+// Definitions by: Sam Verschueren
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+declare module "array-find-index" {
+ type Predicate = (element: any, index: number, array: any[]) => boolean;
+
+ function arrayFindIndex(arr: any[], predicate: Predicate): number;
+ function arrayFindIndex(arr: any[], predicate: Predicate, ctx: any): number;
+ namespace arrayFindIndex {}
+ export = arrayFindIndex;
+}
diff --git a/async/async-tests.ts b/async/async-tests.ts
index 037481b6fa..63640cecf6 100644
--- a/async/async-tests.ts
+++ b/async/async-tests.ts
@@ -378,6 +378,7 @@ async.auto({
async.retry(3, function (callback, results) { }, function (err, result) { });
async.retry({ times: 3, interval: 200 }, function (callback, results) { }, function (err, result) { });
+async.retry({ times: 3, interval: (retryCount) => { return 200 * retryCount; } }, function (callback, results) { }, function (err, result) { });
async.parallel([
@@ -391,13 +392,6 @@ function (results) {
]);
});
-var sys;
-var iterator = async.iterator([
- function () { sys.p('one'); },
- function () { sys.p('two'); },
- function () { sys.p('three'); }
-]);
-
async.parallel([
async.apply(fs.writeFile, 'testfile1', 'test1'),
async.apply(fs.writeFile, 'testfile2', 'test2'),
diff --git a/async/async.d.ts b/async/async.d.ts
index 066685e3c7..96da35c1ea 100644
--- a/async/async.d.ts
+++ b/async/async.d.ts
@@ -1,4 +1,4 @@
-// Type definitions for Async 1.4.2
+// Type definitions for Async 2.0.1
// Project: https://github.com/caolan/async
// Definitions by: Boris Yankov , Arseniy Maximov , Joe Herman
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -12,10 +12,10 @@ interface AsyncResultObjectCallback { (err: Error, results: Dictionary): v
interface AsyncFunction { (callback: (err?: Error, result?: T) => void): void; }
interface AsyncIterator { (item: T, callback: ErrorCallback): void; }
-interface AsyncForEachOfIterator { (item: T, key: number, callback: ErrorCallback): void; }
+interface AsyncForEachOfIterator { (item: T, key: number|string, callback: ErrorCallback): void; }
interface AsyncResultIterator { (item: T, callback: AsyncResultCallback): void; }
interface AsyncMemoIterator { (memo: R, item: T, callback: AsyncResultCallback): void; }
-interface AsyncBooleanIterator { (item: T, callback: (truthValue: boolean) => void): void; }
+interface AsyncBooleanIterator { (item: T, callback: (err: string, truthValue: boolean) => void): void; }
interface AsyncWorker { (task: T, callback: ErrorCallback): void; }
interface AsyncVoidFunction { (callback: ErrorCallback): void; }
@@ -37,6 +37,13 @@ interface AsyncQueue {
pause(): void
resume(): void;
kill(): void;
+ workersList(): {
+ data: T,
+ callback: Function
+ }[];
+ error(error: Error, data: any): void;
+ unsaturated(): void;
+ buffer: number;
}
interface AsyncPriorityQueue {
@@ -54,6 +61,14 @@ interface AsyncPriorityQueue {
pause(): void;
resume(): void;
kill(): void;
+ workersList(): {
+ data: T,
+ priority: number,
+ callback: Function
+ }[];
+ error(error: Error, data: any): void;
+ unsaturated(): void;
+ buffer: number;
}
interface AsyncCargo {
@@ -85,26 +100,35 @@ interface Async {
map(arr: T[], iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): any;
mapSeries(arr: T[], iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): any;
mapLimit(arr: T[], limit: number, iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): any;
- filter(arr: T[], iterator: AsyncBooleanIterator, callback?: (results: T[]) => any): any;
- select(arr: T[], iterator: AsyncBooleanIterator, callback?: (results: T[]) => any): any;
- filterSeries(arr: T[], iterator: AsyncBooleanIterator, callback?: (results: T[]) => any): any;
- selectSeries(arr: T[], iterator: AsyncBooleanIterator, callback?: (results: T[]) => any): any;
- filterLimit(arr: T[], limit: number, iterator: AsyncBooleanIterator, callback?: (results: T[]) => any): any;
- selectLimit(arr: T[], limit: number, iterator: AsyncBooleanIterator, callback?: (results: T[]) => any): any;
- reject(arr: T[], iterator: AsyncBooleanIterator, callback?: (results: T[]) => any): any;
- rejectSeries(arr: T[], iterator: AsyncBooleanIterator, callback?: (results: T[]) => any): any;
- rejectLimit(arr: T[], limit: number, iterator: AsyncBooleanIterator, callback?: (results: T[]) => any): any;
+ mapValuesLimit(obj: {[name: string]: T}, limit: number, iteratee: (value: string, key: T, callback: AsyncResultCallback) => void, callback: AsyncResultCallback): void;
+ mapValues(obj: {[name: string]: T}, iteratee: (value: string, key: T, callback: AsyncResultCallback) => void, callback: AsyncResultCallback): void;
+ mapValuesSeries: typeof async.mapValues;
+ filter(arr: T[], iterator: AsyncBooleanIterator, callback?: AsyncResultArrayCallback): any;
+ select(arr: T[], iterator: AsyncBooleanIterator, callback?: AsyncResultArrayCallback): any;
+ filterSeries(arr: T[], iterator: AsyncBooleanIterator, callback?: AsyncResultArrayCallback): any;
+ selectSeries(arr: T[], iterator: AsyncBooleanIterator, callback?: AsyncResultArrayCallback): any;
+ filterLimit(arr: T[], limit: number, iterator: AsyncBooleanIterator, callback?: AsyncResultArrayCallback): any;
+ selectLimit(arr: T[], limit: number, iterator: AsyncBooleanIterator, callback?: AsyncResultArrayCallback): any;
+ reject(arr: T[], iterator: AsyncBooleanIterator, callback?: AsyncResultArrayCallback): any;
+ rejectSeries(arr: T[], iterator: AsyncBooleanIterator, callback?: AsyncResultArrayCallback): any;
+ rejectLimit(arr: T[], limit: number, iterator: AsyncBooleanIterator, callback?: AsyncResultArrayCallback): any;
reduce(arr: T[], memo: R, iterator: AsyncMemoIterator, callback?: AsyncResultCallback): any;
inject(arr: T[], memo: R, iterator: AsyncMemoIterator, callback?: AsyncResultCallback): any;
foldl(arr: T[], memo: R, iterator: AsyncMemoIterator, callback?: AsyncResultCallback): any;
reduceRight(arr: T[], memo: R, iterator: AsyncMemoIterator, callback: AsyncResultCallback): any;
foldr(arr: T[], memo: R, iterator: AsyncMemoIterator, callback: AsyncResultCallback): any;
- detect(arr: T[], iterator: AsyncBooleanIterator, callback?: (result: T) => void): any;
- detectSeries(arr: T[], iterator: AsyncBooleanIterator, callback?: (result: T) => void): any;
- detectLimit(arr: T[], limit: number, iterator: AsyncBooleanIterator, callback?: (result: T) => void): any;
+ detect(arr: T[], iterator: AsyncBooleanIterator, callback?: AsyncResultCallback): any;
+ find: typeof async.detect;
+ detectSeries(arr: T[], iterator: AsyncBooleanIterator, callback?: AsyncResultCallback): any;
+ findSeries: typeof async.detectSeries;
+ detectLimit(arr: T[], limit: number, iterator: AsyncBooleanIterator, callback?: AsyncResultCallback): any;
+ findLimit: typeof async.detectLimit;
sortBy(arr: T[], iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback