',
+ 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 4af35c6701..d79e75a07d 100644
--- a/angular-material/angular-material.d.ts
+++ b/angular-material/angular-material.d.ts
@@ -68,12 +68,14 @@ declare namespace angular.material {
interface IPromptDialog extends IPresetDialog {
cancel(cancel: string): IPromptDialog;
- placeholder(placeholder: 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;
@@ -81,7 +83,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
@@ -94,11 +96,12 @@ 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;
@@ -283,4 +286,76 @@ 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;
+ 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;
+ focusOnOpen(): void;
+ }
+
+ interface IPanelPosition {
+ absolute(): IPanelPosition;
+ relativeTo(someElement: string|JQuery|Element): IPanelPosition;
+ top(opt_top: string): IPanelPosition; // default: '0'
+ bottom(opt_bottom: string): IPanelPosition; // default: '0'
+ left(opt_left: string): IPanelPosition; // default: '0'
+ right(opt_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;
+ }
}
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 045f2f5994..51946281ce 100644
--- a/angular-translate/angular-translate.d.ts
+++ b/angular-translate/angular-translate.d.ts
@@ -72,7 +72,7 @@ declare namespace angular.translate {
}
interface ITranslateProvider extends angular.IServiceProvider {
- translations(): ITranslationTable;
+ translations(key?: string): ITranslationTable;
translations(key: string, translationTable: ITranslationTable): ITranslateProvider;
cloakClassName(): string;
cloakClassName(name: string): ITranslateProvider;
diff --git a/angular-websocket/angular-websocket-tests.ts b/angular-websocket/angular-websocket-tests.ts
new file mode 100644
index 0000000000..78ba982aa5
--- /dev/null
+++ b/angular-websocket/angular-websocket-tests.ts
@@ -0,0 +1,25 @@
+///
+
+let dummySocket: ng.websocket.IWebSocket;
+
+let provider: ng.websocket.IWebSocketProvider = (url: string) => {
+ return dummySocket;
+}
+
+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] });
diff --git a/angular-websocket/angular-websocket.d.ts b/angular-websocket/angular-websocket.d.ts
new file mode 100644
index 0000000000..04859a7d16
--- /dev/null
+++ b/angular-websocket/angular-websocket.d.ts
@@ -0,0 +1,86 @@
+// 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 {
+
+ interface IWebSocketProvider {
+ /**
+ * Creates and opens an IWebSocket instance.
+ *
+ * @param url url to connect to
+ * @return websocket instance
+ */
+ (url: string): 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;
+ }
+
+ 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;
+ }
+}
diff --git a/angularjs/angular-animate.d.ts b/angularjs/angular-animate.d.ts
index f68cd60d14..daae229f56 100644
--- a/angularjs/angular-animate.d.ts
+++ b/angularjs/angular-animate.d.ts
@@ -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.
@@ -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-tests.ts b/angularjs/angular-tests.ts
index c804519727..7eaf0be763 100644
--- a/angularjs/angular-tests.ts
+++ b/angularjs/angular-tests.ts
@@ -869,7 +869,7 @@ angular.module('docsTabsExample', [])
angular.module('componentExample', [])
.component('counter', {
- require: ['^ctrl'],
+ require: {'ctrl': '^ctrl'},
bindings: {
count: '='
},
diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts
index 94d6678a24..a5560fe924 100644
--- a/angularjs/angular.d.ts
+++ b/angularjs/angular.d.ts
@@ -156,7 +156,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;
@@ -1707,6 +1707,10 @@ declare namespace angular {
* Use the array form to define dependencies (necessary if strictDi is enabled and you require dependency injection)
*/
templateUrl?: string | Function | (string | Function)[];
+ /**
+ * Define object mapping to other directive or component required controllers.
+ */
+ require?: any;
/**
* Define DOM attribute binding to component properties. Component properties are always bound to the component
* controller and not to the scope.
@@ -1716,7 +1720,7 @@ declare namespace angular {
* Whether transclusion is enabled. Enabled by default.
*/
transclude?: boolean | string | {[slot: string]: string};
- require?: string | string[] | {[controller: string]: string};
+ require?: {[controller: string]: string};
}
interface IComponentTemplateFn {
@@ -1755,7 +1759,7 @@ declare namespace angular {
* 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.
*/
- $postInit?(): void;
+ $postLink?(): void;
}
interface IChangesObject {
@@ -1800,7 +1804,7 @@ declare namespace angular {
* that is passed to the link function instead.
*/
transclude: ITranscludeFunction
- ): IDirectivePrePost;
+ ): void | IDirectivePrePost;
}
interface IDirective {
diff --git a/applicationinsights-js/applicationinsights-js-tests.ts b/applicationinsights-js/applicationinsights-js-tests.ts
index a852259539..b8f5ba7bec 100644
--- a/applicationinsights-js/applicationinsights-js-tests.ts
+++ b/applicationinsights-js/applicationinsights-js-tests.ts
@@ -27,7 +27,26 @@ var config: Microsoft.ApplicationInsights.IConfig = {
cookieDomain: ""
};
-var appInsights = new Microsoft.ApplicationInsights.AppInsights(config);
+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");
@@ -68,7 +87,7 @@ appInsights.config.instrumentationKey = "";
// TelementryContext
-var context = appInsights.context;
+var context: Microsoft.ApplicationInsights.ITelemetryContext = appInsights.context;
context.application.ver = "v0.0.0";
context.application.build = "1.1.1";
@@ -93,4 +112,46 @@ var envelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(data,
context.track(envelope);
-context.addTelemetryInitializer((envelope) => false);
\ No newline at end of file
+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
index f49863b35a..d9ad3c1c9d 100644
--- a/applicationinsights-js/applicationinsights-js.d.ts
+++ b/applicationinsights-js/applicationinsights-js.d.ts
@@ -3,146 +3,228 @@
// 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 {
- class Application {
+ interface IApplication {
/**
* The application version.
*/
ver: string;
-
/**
* The application build version.
*/
build: string;
}
- class Device {
+ 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;
-
- /**
- * Constructs a new instance of the Device class
- */
- constructor();
}
- class User {
+ interface ILocation {
/**
- * The user ID.
+ * Client IP address for reverse lookup
*/
- id: string;
+ ip: string;
+ }
+ interface IInternal {
/**
- * 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;
-
- /**
- * Sets the autheticated user id and the account id in this session.
- *
- * @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.
+ * The SDK version used to create this telemetry item.
*/
- setAuthenticatedUserContext(authenticatedUserId: string, accountId?: string): void;
-
+ sdkVersion: string;
/**
- * Clears the authenticated user id and the account id from the user context.
- * @returns {}
+ * The SDK agent version.
*/
- clearAuthenticatedUserContext(): void;
-
- constructor(config: ITelemetryConfig);
+ agentVersion: string;
}
- class Session {
+ interface ISample {
/**
- * The session ID.
- */
- id: string;
+ * 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.
@@ -151,251 +233,449 @@ declare module Microsoft.ApplicationInsights.Context {
renewalDate: number;
}
- class Location {
+ interface IOperation {
/**
- * Client IP address for reverse lookup
- */
- ip: string;
- }
-
- class Operation {
- /**
- * Unique id
+ * Operation id
*/
id: string;
-
- name: string;
-
- parentId: string;
-
- rootId: string;
-
/**
- * String identifying the bot or test agent.
+ * 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 {
- export class Base {
- public baseType: string;
- constructor()
+ class Domain {
+ constructor();
}
- class Envelope {
- public ver: number;
- public name: string;
- public time: string;
- public sampleRate: number;
- public seq: string;
- public iKey: string;
- public flags: number;
- public deviceId: string;
- public os: string;
- public osVer: string;
- public appId: string;
- public appVer: string;
- public userId: string;
- public tags: any;
- public data: Base;
+ 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 Envelope extends Microsoft.Telemetry.Envelope {
+ 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 {
-
- var Version: string;
-
interface IConfig {
- // The key of your Application Insights resource in Azure
- instrumentationKey: string;
-
- // The Application Insights server
- endpointUrl: string;
-
- emitLineDelimitedJson: boolean;
-
- accountId: string;
-
- // A session is logged if the user is inactive for this time in milliseconds. Default 30 mins.
- sessionRenewalMs: number;
-
- // A session is logged if it has continued for this time in milliseconds. Default 24h.
- sessionExpirationMs: number;
-
- //Default 100k
- maxBatchSizeInBytes: number;
-
- // Default 15s
- maxBatchInterval: number;
-
- // If true, data is sent immediately and not batched.
- enableDebug: boolean;
-
- // If true, telemetry data is not collected or sent. Default false.
- disableTelemetry: boolean;
-
- verboseLogging: boolean;
-
- // Default 10s:
- diagnosticLogInterval: number;
-
- samplingPercentage: number;
-
- autoTrackPageVisitTime: boolean;
-
- // If true, exceptions are not monitored.
- disableExceptionTracking: boolean;
-
- // If true, ajax calls are not monitored.
- disableAjaxTracking: boolean;
-
- // If true, default behavior of trackPageView is changed to record end of page view duration interval when
- // trackPageView is called. If false and no custom duration is provided to trackPageView, the page view
- // performance is calculated using the navigation timing API.
- overridePageViewDuration: boolean;
-
- // Default 500 - controls how many ajax calls will be monitored per page view.
- // Set to -1 to monitor all ajax calls on the page.
- maxAjaxCallsPerView: number;
-
- disableDataLossAnalysis: boolean;
-
- disableCorrelationHeaders: boolean;
-
- disableFlushOnBeforeUnload: boolean;
-
- enableSessionStorageBuffer: boolean;
-
- // Custom cookie domain. This is helpful if you want to share Application Insights cookies across subdomains.
- cookieDomain: string;
+ 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;
}
- interface ISenderConfig {
+ /**
+ * 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 url to which payloads will be sent
+ * 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.
*/
- endpointUrl: () => string;
+ 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 JSON format (normal vs line delimited). True means line delimited JSON.
+ * The object describing a component tracked by this object.
*/
- emitLineDelimitedJson: () => boolean;
- /**
- * The maximum size of a batch in bytes
- */
- maxBatchSizeInBytes: () => number;
- /**
- * The maximum interval allowed between calls to batchInvoke
- */
- maxBatchInterval: () => number;
- /**
- * The master off switch. Do not send any data if set to TRUE
- */
- disableTelemetry: () => boolean;
- /**
- * Store a copy of a send buffer in the session storage
- */
- enableSessionStorageBuffer: () => boolean;
- }
-
- interface ITelemetryConfig extends ISenderConfig {
- instrumentationKey: () => string;
- accountId: () => string;
- sessionRenewalMs: () => number;
- sessionExpirationMs: () => number;
- sampleRate: () => number;
- endpointUrl: () => string;
- cookieDomain: () => string;
- }
-
-
- class TelemetryContext {
- /**
- * The object describing a component tracked by this object.
- */
- application: Context.Application;
-
+ application: Context.IApplication;
/**
* The object describing a device tracked by this object.
*/
- device: Context.Device;
-
+ device: Context.IDevice;
/**
- * The object describing a user tracked by this object.
- */
- user: Context.User;
-
- /**
- * The object describing a session tracked by this object.
- */
- session: Context.Session;
-
+ * The object describing internal settings.
+ */
+ internal: Context.IInternal;
/**
* The object describing a location tracked by this object.
*/
- location: Context.Location;
-
+ location: Context.ILocation;
/**
* The object describing a operation tracked by this object.
*/
- operation: Context.Operation;
-
+ operation: Context.IOperation;
/**
- * Use Sender.ts to send telemetry object to the endpoint
+ * The object describing sampling settings.
+ */
+ sample: Context.ISample;
+ /**
+ * The object describing a user tracked by this object.
*/
- track(envelope: Telemetry.Common.Envelope): Telemetry.Common.Envelope;
-
+ 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: Telemetry.Common.Envelope) => boolean): void;
+ addTelemetryInitializer(telemetryInitializer: (envelope: Microsoft.ApplicationInsights.IEnvelope) => boolean): any;
+ /**
+ * Tracks telemetry object.
+ */
+ track(envelope: Microsoft.ApplicationInsights.IEnvelope): any;
}
- /**
- * The main API that sends telemetry to Application Insights.
- * Learn more: http://go.microsoft.com/fwlink/?LinkID=401493
- */
- class AppInsights {
- constructor(config: IConfig);
-
+ interface IAppInsights {
config: IConfig;
-
- context: TelemetryContext;
-
+ 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): 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?: Object, measurements?: Object): void;
-
+ * 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.
@@ -404,39 +684,61 @@ declare module Microsoft.ApplicationInsights {
* @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?: Object, measurements?: Object, duration?: number): void;
-
+ 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): void;
-
+ 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?: Object, measurements?: Object): void;
-
+ 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?: Object, measurements?: Object): void;
-
- trackAjax(id: string, absoluteUrl: string, pathName: string, totalTime: number, success: boolean, resultCode: number, method?: string): void;
-
+ * 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?: Object, measurements?: Object): void;
+ 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
@@ -447,34 +749,34 @@ declare module Microsoft.ApplicationInsights {
* @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?: Object): void;
-
+ 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?: Object): void;
-
+ trackTrace(message: string, properties?: {
+ [name: string]: string;
+ }): any;
/**
* Immediately send all queued telemetry.
*/
- flush(): void;
-
+ 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): void;
-
+ * 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(): void;
-
+ clearAuthenticatedUserContext(): any;
+ downloadAndSetup?(config: Microsoft.ApplicationInsights.IConfig): void;
/**
* The custom error handler for Application Insights
* @param {string} message - The error message
@@ -483,6 +785,6 @@ declare module Microsoft.ApplicationInsights {
* @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): void;
+ _onerror(message: string, url: string, lineNumber: number, columnNumber: number, error: Error): any;
}
}
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/atmosphere/atmosphere.d.ts b/atmosphere/atmosphere.d.ts
index 239986b3a1..e62df1ea64 100644
--- a/atmosphere/atmosphere.d.ts
+++ b/atmosphere/atmosphere.d.ts
@@ -55,7 +55,7 @@ declare namespace Atmosphere {
connectTimeout?: number;
reconnectInterval?: number;
dropHeaders?: boolean;
- uuid?: number;
+ uuid?: string;
async?: boolean;
shared?: boolean;
readResponsesHeaders?: boolean;
diff --git a/avoscloud-sdk/avoscloud-sdk.d.ts b/avoscloud-sdk/avoscloud-sdk.d.ts
index c3bd03e570..af904a6c8c 100644
--- a/avoscloud-sdk/avoscloud-sdk.d.ts
+++ b/avoscloud-sdk/avoscloud-sdk.d.ts
@@ -797,3 +797,8 @@ declare module "avoscloud-sdk" {
export = AV;
}
+
+declare module 'leanengine' {
+ import alias = require('avoscloud-sdk');
+ export = alias;
+}
diff --git a/aws-sdk/aws-sdk.d.ts b/aws-sdk/aws-sdk.d.ts
index a13e03fe7a..5946d25982 100644
--- a/aws-sdk/aws-sdk.d.ts
+++ b/aws-sdk/aws-sdk.d.ts
@@ -18,6 +18,10 @@ declare module "aws-sdk" {
accessKeyId: string;
}
+ export class EnvironmentCredentials extends Credentials {
+ constructor(profile: string);
+ }
+
export interface Logger {
write?: (chunk: any, encoding?: string, callback?: () => void) => void;
log?: (...messages: any[]) => void;
@@ -86,6 +90,8 @@ declare module "aws-sdk" {
export interface ClientConfigPartial extends Services {
credentials?: Credentials;
region?: string;
+ accessKeyId: string;
+ secretAccessKey: string;
computeChecksums?: boolean;
convertResponseTypes?: boolean;
logger?: Logger;
@@ -138,9 +144,9 @@ declare module "aws-sdk" {
export class SNS {
constructor(options?: any);
- public client: Sns.Client;
+ publish(request: Sns.PublishRequest, callback: (err: any, data: any) => void): void;
}
-
+
export class SimpleWorkflow {
constructor(options?: any);
public client: Swf.Client;
@@ -152,6 +158,51 @@ declare module "aws-sdk" {
getObject(params: s3.GetObjectRequest, callback: (err: any, data: any) => void): void;
}
+ export class STS{
+ constructor(options?: any);
+
+ /**
+ * Returns a set of temporary security credentials (consisting of an access key ID, a secret access key, and a security token) that you can use to access AWS resources that you might not normally have access to.
+ */
+ assumeRole(params: sts.AssumeRoleParams, callback: (err: any, data: any) => void): void;
+
+ /**
+ * Returns a set of temporary security credentials for users who have been authenticated via a SAML authentication response.
+ */
+ assumeRoleWithSAML(params: sts.AssumeRoleWithSAMLParams, callback: (err: any, data: any) => void): void;
+
+ /**
+ * Returns a set of temporary security credentials for users who have been authenticated in a mobile or web application with a web identity provider, such as Amazon Cognito, Login with Amazon, Facebook, Google, or any OpenID Connect-compatible identity provider.
+ */
+ assumeRoleWithWebIdentity(params: sts.AssumeRoleWithWebIdentityParams, callback: (err: any, data: any) => void): void;
+
+ /**
+ * Creates a credentials object from STS response data containing credentials information.
+ */
+ credentialsFrom(params: sts.CredentialsFromParams, callback: (err: any, data: any) => void): void;
+
+ /**
+ * Decodes additional information about the authorization status of a request from an encoded message returned in response to an AWS request.
+ */
+ decodeAuthorizationMessage(params: sts.DecodeAuthorizationMessageParams, callback: (err: any, data: any) => void): void;
+
+ /**
+ * Returns details about the IAM identity whose credentials are used to call the API.
+ */
+ getCallerIdentity(params: {}, callback: (err: any, data: any) => void): void;
+
+ /**
+ * Returns a set of temporary security credentials (consisting of an access key ID, a secret access key, and a security token) for a federated user.
+ */
+ getFederationToken(params: sts.GetFederationTokenParams, callback: (err: any, data: any) => void): void;
+
+ /**
+ * Returns a set of temporary credentials for an AWS account or IAM user.
+ */
+ getSessionToken(params: sts.GetSessionTokenParams, callback: (err: any, data: any) => void): void;
+
+ }
+
export class ECS {
constructor(options?: any);
/**
@@ -1345,4 +1396,60 @@ declare module "aws-sdk" {
taskDefinition: string;
}
}
+
+ export module sts {
+ export interface AssumeRoleParams {
+ RoleArn: string;
+ RoleSessionName: string;
+ DurationSeconds?: number;
+ ExternalId?: string;
+ Policy?: string;
+ SerialNumber?: string;
+ TokenCode?: string;
+ }
+
+ export interface AssumeRoleWithSAMLParams {
+ PrincipalArn: string;
+ RoleArn: string;
+ SAMLAssertion: string;
+ DurationSeconds?: number;
+ Policy?: string;
+ }
+
+ export interface AssumeRoleWithWebIdentityParams {
+ RoleArn: string;
+ RoleSessionName: string;
+ WebIdentityToken: string;
+ DurationSeconds?: number;
+ Policy?: string;
+ ProviderId?: string;
+ }
+
+ export interface CredentialsFromParams {
+ /**
+ * Data retrieved from a call to AWS.STS.getFederatedToken, getSessionToken(), assumeRole(), or assumeRoleWithWebIdentity().
+ */
+ Data: any;
+ /**
+ * An optional credentials object to fill instead of creating a new object. Useful when modifying an existing credentials object from a refresh call.
+ */
+ Credentials?: Credentials
+ }
+
+ export interface DecodeAuthorizationMessageParams {
+ EncodedMessage: string;
+ }
+
+ export interface GetFederationTokenParams {
+ Name: string;
+ DurationSeconds?: number,
+ Policy?: string
+ }
+
+ export interface GetSessionTokenParams {
+ DurationSeconds: number,
+ SerialNumber: string;
+ TokenCode: string;
+ }
+ }
}
diff --git a/azure-mobile-services-client/AzureMobileServicesClient.d.ts b/azure-mobile-services-client/AzureMobileServicesClient.d.ts
index b9749002c9..afd6014598 100644
--- a/azure-mobile-services-client/AzureMobileServicesClient.d.ts
+++ b/azure-mobile-services-client/AzureMobileServicesClient.d.ts
@@ -7,10 +7,11 @@ declare namespace Microsoft.WindowsAzure {
// MobileServiceClient object based on Microsoft Azure documentation: http://msdn.microsoft.com/en-us/library/windowsazure/jj554219.aspx
interface MobileServiceClient {
- new (applicationUrl: string, applicationKey: string): MobileServiceClient;
+ new (applicationUrl: string, applicationKey?: string): MobileServiceClient;
applicationUrl: string;
applicationKey: string;
currentUser: User;
+ push: Push;
//for provider:string use one of ProviderEnum: 'microsoftaccount', 'facebook', 'twitter', 'google'
login(provider: string, token: string, callback: (error: any, user: User) => void ): void;
login(provider: string, token: string): asyncPromise;
@@ -18,8 +19,40 @@ declare namespace Microsoft.WindowsAzure {
login(provider: string): asyncPromise;
logout(): void;
getTable(tableName: string): MobileServiceTable;
- withFilter(serviceFilter: (request: any, next: (request: any, callback: (error:any, response: any) => void ) => void, callback: (error: any, response: any) => void ) => void ) : MobileServiceClient;
- invokeApi(apiName: string, options?:InvokeApiOptions): asyncPromise;
+ withFilter(serviceFilter: (request: any, next: (request: any, callback: (error: any, response: any) => void) => void, callback: (error: any, response: any) => void) => void): MobileServiceClient;
+ /**
+ * Invokes the specified custom api and returns a response object.
+ *
+ * @param apiName The custom api to invoke.
+ * @param options Contains additional parameter information, valid values are:
+ * body: The body of the HTTP request.
+ * method: The HTTP method to use in the request, with the default being POST,
+ * parameters: Any additional query string parameters,
+ * headers: HTTP request headers, specified as an object.
+ * @param callback Optional callback accepting (error, results) parameters.
+ */
+ invokeApi(apiName: string, options?: InvokeApiOptions, callback?: (error: any, results: any) => void): asyncPromise;
+ }
+
+ interface Push
+ {
+ /**
+ * Register a push channel with the Mobile Apps backend to start receiving notifications.
+ *
+ * @param platform The device platform being used - wns, gcm or apns.
+ * @param pushChannel The push channel identifier or URI.
+ * @param templates An object containing template definitions. Template objects should contain body, headers and tags properties.
+ * @param secondaryTiles An object containing template definitions to be used with secondary tiles when using WNS.
+ * @param callback Optional callback accepting (error, results) parameters.
+ */
+ register(platform: string, pushChannel: string, templates?: any, secondaryTiles?: any, callback?: (error: any, results: any) => void): void;
+ /**
+ * Invokes the specified custom api and returns a response object.
+ *
+ * @param pushChannel The push channel identifier or URI.
+ * @param callback Optional callback accepting (error, results) parameters.
+ */
+ unregister(pushChannel: string, callback?: (error: any, results: any) => void): void;
}
interface InvokeApiOptions
@@ -36,6 +69,7 @@ declare namespace Microsoft.WindowsAzure {
accessTokens: any; // { [providerName: string]: string; }
level: string; //for level:string use one of LevelEnum: 'admin','anonymous','authenticated'
userId: string;
+ mobileServiceAuthenticationToken: string;
}
diff --git a/babelify/babelify-tests.ts b/babelify/babelify-tests.ts
new file mode 100644
index 0000000000..6ace8462a9
--- /dev/null
+++ b/babelify/babelify-tests.ts
@@ -0,0 +1,23 @@
+///
+
+import babelify = require("babelify");
+
+module BabelifyTest {
+
+ export function whatDidTheEs6Say(srcPath: string, opts?: babelify.BabelifyOptions) {
+ opts.extensions = opts.extensions || undefined;
+ opts.sourceMapsAbsolute = opts.sourceMapsAbsolute || false;
+ var dst: NodeJS.ReadWriteStream;
+
+ babelify(""); // 'opts' are optional
+
+ babelify(srcPath, opts).on("error", function (err: any) {
+ console.error("babelify error: ", err);
+ });
+
+ babelify.configure(opts)(srcPath).pipe(dst);
+ }
+
+}
+
+export = BabelifyTest;
\ No newline at end of file
diff --git a/babelify/babelify.d.ts b/babelify/babelify.d.ts
new file mode 100644
index 0000000000..2637814a64
--- /dev/null
+++ b/babelify/babelify.d.ts
@@ -0,0 +1,46 @@
+// Type definitions for babelify v7.3.0
+// Project: https://github.com/babel/babelify
+// Definitions by: TeamworkGuy2
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+///
+///
+
+/** Browserify transform for Babel
+ */
+declare module 'babelify' {
+ import stream = require("stream");
+ import babel = require("babel-core");
+
+
+ function Babelify(filename: string, opts?: Babelify.BabelifyOptions): Babelify.BabelifyObject;
+
+ module Babelify {
+
+ export interface BabelifyConstructor {
+ (filename: string, opts: Babelify.BabelifyOptions): Babelify.BabelifyObject;
+ }
+
+ /** In addition to the various purposes documented here, all of the babelify options are passed to babel which passes them on to babel.transform() when each file is transformed */
+ export interface BabelifyOptions extends babel.TransformOptions {
+ /** These are passed to babel.util.canCompile() for each filename
+ * default: null
+ */
+ extensions?: string | string[];
+
+ /** if true, a 'sourceFileName' property with a value equal to the current file being transformed is included with the options passed to babel.transform()
+ * default: false
+ */
+ sourceMapsAbsolute?: boolean;
+ }
+
+ export class BabelifyObject extends stream.Transform {
+ _transform(buf: string | Buffer, encoding: string, callback: () => void): void;
+ _flush(callback: () => void): void;
+ }
+
+ export function configure(opts: Babelify.BabelifyOptions): (filename: string) => Babelify.BabelifyObject;
+ }
+
+ export = Babelify;
+}
diff --git a/backbone/backbone-global.d.ts b/backbone/backbone-global.d.ts
index ef0a10f006..d86305ee3d 100644
--- a/backbone/backbone-global.d.ts
+++ b/backbone/backbone-global.d.ts
@@ -147,7 +147,6 @@ declare namespace Backbone {
/*private*/ set(attributeName: string, value: any, options?: ModelSetOptions): Model;
set(obj: any, options?: ModelSetOptions): Model;
- change(): any;
changedAttributes(attributes?: any): any[];
clear(options?: Silenceable): any;
clone(): Model;
@@ -173,8 +172,12 @@ declare namespace Backbone {
invert(): any;
pick(keys: string[]): any;
pick(...keys: string[]): any;
+ pick(fn: (value: any, key: any, object: any) => any): any;
omit(keys: string[]): any;
omit(...keys: string[]): any;
+ omit(fn: (value: any, key: any, object: any) => any): any;
+ chain(): any;
+ isEmpty(): boolean;
}
class Collection extends ModelBase {
@@ -209,8 +212,8 @@ declare namespace Backbone {
pluck(attribute: string): any[];
push(model: TModel, options?: AddOptions): TModel;
pop(options?: Silenceable): TModel;
- remove(model: TModel, options?: Silenceable): TModel;
- remove(models: TModel[], options?: Silenceable): TModel[];
+ remove(model: {}|TModel, options?: Silenceable): TModel;
+ remove(models: ({}|TModel)[], options?: Silenceable): TModel[];
reset(models?: TModel[], options?: Silenceable): TModel[];
set(models?: TModel[], options?: Silenceable): TModel[];
shift(options?: Silenceable): TModel;
@@ -223,58 +226,72 @@ declare namespace Backbone {
private _removeReference(model: TModel): void;
private _onModelEvent(event: string, model: TModel, collection: Collection, options: any): void;
+ /**
+ * Return a shallow copy of this collection's models, using the same options as native Array#slice.
+ */
+ slice(min: number, max?: number): TModel[];
+
// mixins from underscore
- all(iterator: (element: TModel, index: number) => boolean, context?: any): boolean;
- any(iterator: (element: TModel, index: number) => boolean, context?: any): boolean;
- collect(iterator: (element: TModel, index: number, context?: any) => any[], context?: any): any[];
+ all(iterator?: _.ListIterator, context?: any): boolean;
+ any(iterator?: _.ListIterator, context?: any): boolean;
chain(): any;
- contains(value: any): boolean;
- countBy(iterator: (element: TModel, index: number) => any): _.Dictionary;
- countBy(attribute: string): _.Dictionary;
- detect(iterator: (item: any) => boolean, context?: any): any; // ???
- drop(): TModel;
- drop(n: number): TModel[];
- each(iterator: (element: TModel, index: number, list?: any) => void, context?: any): any;
- every(iterator: (element: TModel, index: number) => boolean, context?: any): boolean;
- filter(iterator: (element: TModel, index: number) => boolean, context?: any): TModel[];
- find(iterator: (element: TModel, index: number) => boolean, context?: any): TModel;
+ collect(iterator: _.ListIterator, context?: any): TResult[];
+ contains(value: TModel): boolean;
+ countBy(iterator?: _.ListIterator): _.Dictionary;
+ countBy(iterator: string): _.Dictionary;
+ detect(iterator: _.ListIterator, context?: any): TModel;
+ difference(others: TModel[]): TModel[];
+ drop(n?: number): TModel[];
+ each(iterator: _.ListIterator, context?: any): TModel[];
+ every(iterator: _.ListIterator, context?: any): boolean;
+ filter(iterator: _.ListIterator, context?: any): TModel[];
+ find(iterator: _.ListIterator, context?: any): TModel;
+ findIndex(predicate: _.ListIterator, context?: any): number;
+ findLastIndex(predicate: _.ListIterator, context?: any): number;
first(): TModel;
first(n: number): TModel[];
- foldl(iterator: (memo: any, element: TModel, index: number) => any, initialMemo: any, context?: any): any;
- forEach(iterator: (element: TModel, index: number, list?: any) => void, context?: any): any;
- groupBy(iterator: (element: TModel, index: number) => string, context?: any): _.Dictionary;
- groupBy(attribute: string, context?: any): _.Dictionary;
- include(value: any): boolean;
- indexOf(element: TModel, isSorted?: boolean): number;
+ foldl(iterator: _.MemoIterator, memo?: TResult, context?: any): TResult;
+ foldr(iterator: _.MemoIterator, memo?: TResult, context?: any): TResult;
+ forEach(iterator: _.ListIterator, context?: any): TModel[];
+ groupBy(iterator: _.ListIterator, context?: any): _.Dictionary;
+ groupBy(iterator: string, context?: any): _.Dictionary;
+ head(): TModel;
+ head(n: number): TModel[];
+ include(value: TModel): boolean;
+ includes(value: TModel): boolean;
+ indexBy(iterator: _.ListIterator, context?: any): _.Dictionary;
+ indexBy(iterator: string, context?: any): _.Dictionary;
+ indexOf(value: TModel, isSorted?: boolean): number;
initial(): TModel;
initial(n: number): TModel[];
- inject(iterator: (memo: any, element: TModel, index: number) => any, initialMemo: any, context?: any): any;
- isEmpty(object: any): boolean;
- invoke(methodName: string, args?: any[]): any;
+ inject(iterator: _.MemoIterator, memo?: TResult, context?: any): TResult;
+ invoke(methodName: string, ...args: any[]): any;
+ isEmpty(): boolean;
last(): TModel;
last(n: number): TModel[];
- lastIndexOf(element: TModel, fromIndex?: number): number;
- map(iterator: (element: TModel, index: number, context?: any) => any, context?: any): any[];
- max(iterator?: (element: TModel, index: number) => any, context?: any): TModel;
- min(iterator?: (element: TModel, index: number) => any, context?: any): TModel;
- reduce(iterator: (memo: any, element: TModel, index: number) => any, initialMemo: any, context?: any): any;
- select(iterator: any, context?: any): any[];
+ lastIndexOf(value: TModel, from?: number): number;
+ map(iterator: _.ListIterator, context?: any): TResult[];
+ max(iterator?: _.ListIterator, context?: any): TModel;
+ min(iterator?: _.ListIterator, context?: any): TModel;
+ partition(iterator: _.ListIterator): TModel[][];
+ reduce(iterator: _.MemoIterator, memo?: TResult, context?: any): TResult;
+ reduceRight(iterator: _.MemoIterator, memo?: TResult, context?: any): TResult;
+ reject(iterator: _.ListIterator, context?: any): TModel[];
+ rest(n?: number): TModel[];
+ sample(): TModel;
+ sample(n: number): TModel[];
+ select(iterator: _.ListIterator, context?: any): TModel[];
+ shuffle(): TModel[];
size(): number;
- shuffle(): any[];
- slice(min: number, max?: number): TModel[];
- some(iterator: (element: TModel, index: number) => boolean, context?: any): boolean;
- sortBy(iterator: (element: TModel, index: number) => number, context?: any): TModel[];
- sortBy(attribute: string, context?: any): TModel[];
- sortedIndex(element: TModel, iterator?: (element: TModel, index: number) => number): number;
- reduceRight(iterator: (memo: any, element: TModel, index: number) => any, initialMemo: any, context?: any): any[];
- reject(iterator: (element: TModel, index: number) => boolean, context?: any): TModel[];
- rest(): TModel;
- rest(n: number): TModel[];
- tail(): TModel;
- tail(n: number): TModel[];
- toArray(): any[];
- without(...values: any[]): TModel[];
+ some(iterator?: _.ListIterator, context?: any): boolean;
+ sortBy(iterator?: _.ListIterator, context?: any): TModel[];
+ sortBy(iterator: string, context?: any): TModel[];
+ tail(n?: number): TModel[];
+ take(): TModel;
+ take(n: number): TModel[];
+ toArray(): TModel[];
+ without(...values: TModel[]): TModel[];
}
class Router extends Events {
@@ -370,7 +387,6 @@ declare namespace Backbone {
$(selector: any): JQuery;
render(): View;
remove(): View;
- make(tagName: any, attributes?: any, content?: any): any;
delegateEvents(events?: EventsHash): any;
delegate(eventName: string, selector: string, listener: Function): View;
undelegateEvents(): any;
diff --git a/backbone/backbone-tests.ts b/backbone/backbone-tests.ts
index 50632712a6..bd961c1c89 100644
--- a/backbone/backbone-tests.ts
+++ b/backbone/backbone-tests.ts
@@ -90,6 +90,25 @@ function test_models() {
note.set({ title: "March 20", content: "In his eyes she eclipses..." });
note.set("title", "A Scandal in Bohemia");
+
+ let strings: string[]
+ let value: any;
+ let values: any[];
+ let bool: boolean;
+
+ // underscore methods
+ strings = note.keys();
+ values = note.values();
+ values = note.pairs();
+ values = note.invert();
+ value = note.pick("foo");
+ value = note.pick("foo", "bar");
+ value = note.pick((value: any, key: any, object: any) => true);
+ value = note.omit("foo");
+ value = note.omit("foo", "bar");
+ value = note.omit((value: any, key: any, object: any) => true);
+ value = note.chain().pick().omit().value();
+ bool = note.isEmpty();
}
class Employee extends Backbone.Model {
@@ -161,6 +180,78 @@ function test_collection() {
book.get("published") === true);
var alphabetical = books.sortBy((book: Book): number => null);
+
+ let one: Book;
+ let models: Book[];
+ let bool: boolean;
+ let numDict: _.Dictionary;
+ let modelDict: _.Dictionary;
+ let modelsDict: _.Dictionary;
+ let num: number;
+
+ models = books.slice(1);
+ models = books.slice(1, 3);
+
+ // underscore methods
+ bool = books.all((value: Book, index: number, list: Book[]) => true);
+ bool = books.any((value: Book, index: number, list: Book[]) => true);
+ bool = books.chain().any((value: Book, index: number, list: Book[]) => true).value();
+ models = books.collect((value: Book, index: number, list: Book[]) => value);
+ bool = books.contains(book1);
+ numDict = books.countBy((value: Book, index: number, list: Book[]) => true);
+ numDict = books.countBy("foo");
+ one = books.detect((value: Book, index: number, list: Book[]) => true);
+ models = books.difference([book1]);
+ models = books.drop();
+ models = books.each((value: Book, index: number, list: Book[]) => true);
+ bool = books.every((value: Book, index: number, list: Book[]) => true);
+ models = books.filter((value: Book, index: number, list: Book[]) => true);
+ one = books.find((value: Book, index: number, list: Book[]) => true);
+ num = books.findIndex((value: Book, index: number, list: Book[]) => true);
+ num = books.findLastIndex((value: Book, index: number, list: Book[]) => true);
+ one = books.first();
+ models = books.first(3);
+ models = books.foldl((prev: Book[], curr: Book, index: number, list: Book[]) => prev, []);
+ models = books.foldr((prev: Book[], curr: Book, index: number, list: Book[]) => prev, []);
+ models = books.forEach((value: Book, index: number, list: Book[]) => true);
+ modelsDict = books.groupBy((value: Book, index: number, list: Book[]) => true);
+ modelsDict = books.groupBy("foo");
+ one = books.head();
+ models = books.head(3);
+ bool = books.include(book1);
+ bool = books.includes(book1);
+ modelDict = books.indexBy((value: Book, index: number, list: Book[]) => true);
+ modelDict = books.indexBy("foo");
+ num = books.indexOf(book1, true);
+ one = books.initial();
+ models = books.initial(3);
+ models = books.inject((prev: Book[], curr: Book, index: number, list: Book[]) => prev, []);
+ one = books.invoke("at", 3);
+ bool = books.isEmpty();
+ one = books.last();
+ models = books.last(3);
+ num = books.lastIndexOf(book1, 3);
+ models = books.map((value: Book, index: number, list: Book[]) => value);
+ one = books.max((value: Book, index: number, list: Book[]) => value);
+ one = books.min((value: Book, index: number, list: Book[]) => value);
+ [models] = books.partition((value: Book, index: number, list: Book[]) => true);
+ models = books.reduce((prev: Book[], curr: Book, index: number, list: Book[]) => prev, []);
+ models = books.reduceRight((prev: Book[], curr: Book, index: number, list: Book[]) => prev, []);
+ models = books.reject((value: Book, index: number, list: Book[]) => true);
+ models = books.rest(3);
+ one = books.sample();
+ models = books.sample(3);
+ models = books.select((value: Book, index: number, list: Book[]) => true);
+ models = books.shuffle();
+ num = books.size();
+ bool = books.some((value: Book, index: number, list: Book[]) => true);
+ models = books.sortBy((value: Book, index: number, list: Book[]) => value);
+ models = books.sortBy("foo");
+ models = books.tail(3);
+ one = books.take();
+ models = books.take(3);
+ models = books.toArray();
+ models = books.without(book1, book1);
}
//////////
diff --git a/backbone/backbone-with-lodash-tests.ts b/backbone/backbone-with-lodash-tests.ts
index e0b04880bf..0ac4efe375 100644
--- a/backbone/backbone-with-lodash-tests.ts
+++ b/backbone/backbone-with-lodash-tests.ts
@@ -91,6 +91,25 @@ function test_models() {
note.set({ title: "March 20", content: "In his eyes she eclipses..." });
note.set("title", "A Scandal in Bohemia");
+
+ let strings: string[]
+ let value: any;
+ let values: any[];
+ let bool: boolean;
+
+ // underscore methods
+ strings = note.keys();
+ values = note.values();
+ values = note.pairs();
+ values = note.invert();
+ value = note.pick("foo");
+ value = note.pick("foo", "bar");
+ value = note.pick((value: any, key: any, object: any) => true);
+ value = note.omit("foo");
+ value = note.omit("foo", "bar");
+ value = note.omit((value: any, key: any, object: any) => true);
+ value = note.chain().pick().omit().value();
+ bool = note.isEmpty();
}
class Employee extends Backbone.Model {
@@ -152,6 +171,78 @@ function test_collection() {
book.get("published") === true);
var alphabetical = books.sortBy((book: Book): number => null);
+
+ let one: Book;
+ let models: Book[];
+ let bool: boolean;
+ let numDict: _.Dictionary;
+ let modelDict: _.Dictionary;
+ let modelsDict: _.Dictionary;
+ let num: number;
+
+ models = books.slice(1);
+ models = books.slice(1, 3);
+
+ // underscore methods
+ bool = books.all((value: Book, index: number, list: Book[]) => true);
+ bool = books.any((value: Book, index: number, list: Book[]) => true);
+ bool = books.chain().any((value: Book, index: number, list: Book[]) => true).value();
+ models = books.collect((value: Book, index: number, list: Book[]) => value);
+ bool = books.contains(book1);
+ numDict = books.countBy((value: Book, index: number, list: Book[]) => true);
+ numDict = books.countBy("foo");
+ one = books.detect((value: Book, index: number, list: Book[]) => true);
+ models = books.difference([book1]);
+ models = books.drop();
+ models = books.each((value: Book, index: number, list: Book[]) => true);
+ bool = books.every((value: Book, index: number, list: Book[]) => true);
+ models = books.filter((value: Book, index: number, list: Book[]) => true);
+ one = books.find((value: Book, index: number, list: Book[]) => true);
+ num = books.findIndex((value: Book, index: number, list: Book[]) => true);
+ num = books.findLastIndex((value: Book, index: number, list: Book[]) => true);
+ one = books.first();
+ models = books.first(3);
+ models = books.foldl((prev: Book[], curr: Book, index: number, list: Book[]) => prev, []);
+ models = books.foldr((prev: Book[], curr: Book, index: number, list: Book[]) => prev, []);
+ models = books.forEach((value: Book, index: number, list: Book[]) => true);
+ modelsDict = books.groupBy((value: Book, index: number, list: Book[]) => true);
+ modelsDict = books.groupBy("foo");
+ one = books.head();
+ models = books.head(3);
+ bool = books.include(book1);
+ bool = books.includes(book1);
+ modelDict = books.indexBy((value: Book, index: number, list: Book[]) => true);
+ modelDict = books.indexBy("foo");
+ num = books.indexOf(book1, true);
+ one = books.initial();
+ models = books.initial(3);
+ models = books.inject((prev: Book[], curr: Book, index: number, list: Book[]) => prev, []);
+ one = books.invoke("at", 3);
+ bool = books.isEmpty();
+ one = books.last();
+ models = books.last(3);
+ num = books.lastIndexOf(book1, 3);
+ models = books.map((value: Book, index: number, list: Book[]) => value);
+ one = books.max((value: Book, index: number, list: Book[]) => value);
+ one = books.min((value: Book, index: number, list: Book[]) => value);
+ [models] = books.partition((value: Book, index: number, list: Book[]) => true);
+ models = books.reduce((prev: Book[], curr: Book, index: number, list: Book[]) => prev, []);
+ models = books.reduceRight((prev: Book[], curr: Book, index: number, list: Book[]) => prev, []);
+ models = books.reject((value: Book, index: number, list: Book[]) => true);
+ models = books.rest(3);
+ one = books.sample();
+ models = books.sample(3);
+ models = books.select((value: Book, index: number, list: Book[]) => true);
+ models = books.shuffle();
+ num = books.size();
+ bool = books.some((value: Book, index: number, list: Book[]) => true);
+ models = books.sortBy((value: Book, index: number, list: Book[]) => value);
+ models = books.sortBy("foo");
+ models = books.tail(3);
+ one = books.take();
+ models = books.take(3);
+ models = books.toArray();
+ models = books.without(book1, book1);
}
//////////
diff --git a/base64-js/base64-js-tests.ts b/base64-js/base64-js-tests.ts
new file mode 100644
index 0000000000..6852ddb626
--- /dev/null
+++ b/base64-js/base64-js-tests.ts
@@ -0,0 +1,6 @@
+///
+
+import * as base64js from 'base64-js';
+
+const bytes: Uint8Array = base64js.toByteArray('shemp');
+const decoded: string = base64js.fromByteArray(new Uint8Array(0));
diff --git a/base64-js/base64-js.d.ts b/base64-js/base64-js.d.ts
new file mode 100644
index 0000000000..cc7d2165c8
--- /dev/null
+++ b/base64-js/base64-js.d.ts
@@ -0,0 +1,10 @@
+// Type definitions for base64-js v1.1.2
+// Project: https://github.com/beatgammit/base64-js
+// Definitions by: Peter Safranek
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+declare module 'base64-js' {
+
+ export function toByteArray(encoded: string): Uint8Array;
+ export function fromByteArray(bytes: Uint8Array): string;
+}
diff --git a/bingmaps/Microsoft.Maps.d.ts b/bingmaps/Microsoft.Maps.d.ts
index 95e39a043e..1e7e464930 100644
--- a/bingmaps/Microsoft.Maps.d.ts
+++ b/bingmaps/Microsoft.Maps.d.ts
@@ -174,6 +174,7 @@ declare namespace Microsoft.Maps {
fixedMapPosition?: boolean;
height?: number;
inertiaIntensity?: number;
+ navigationBarMode?: number;
showBreadcrumb?: boolean;
showCopyright?: boolean;
showDashboard?: boolean;
@@ -216,6 +217,12 @@ declare namespace Microsoft.Maps {
getY(): number;
}
+ export enum NavigationBarMode {
+ default,
+ compact,
+ minified
+ }
+
export enum PixelReference {
control,
page,
@@ -307,6 +314,7 @@ declare namespace Microsoft.Maps {
getZIndex(): number;
setHtmlContent(content: string): void;
setLocation(location: Location): void;
+ setMap(map: Map): void;
setOptions(options: InfoboxOptions): void;
toString(): string;
}
diff --git a/blessed/blessed.d.ts b/blessed/blessed.d.ts
new file mode 100644
index 0000000000..6746afe5f5
--- /dev/null
+++ b/blessed/blessed.d.ts
@@ -0,0 +1,1269 @@
+// Type definitions for blessed 0.1.5
+// Project: https://github.com/chjj/blessed
+// Definitions by: bryn austin bellomy
+// Definitions: https://github.com/borisyankov/DefinitelyTyped
+
+///
+
+declare module "blessed"
+{
+ import events = require('events');
+ import buffer = require('buffer');
+ import child_process = require('child_process');
+
+ module Blessed
+ {
+ export var colors: Colors;
+
+ export interface GenericCallback {
+ (...args:any[]): void;
+ }
+
+ export interface ColorPair {
+ /** background, must be number (-1 for default). */
+ bg?: number;
+ /** foreground, must be number (-1 for default). */
+ fg?: number;
+ }
+
+ export interface Style extends ColorPair {
+ bold?: boolean;
+ underline?: boolean;
+ border: Border;
+ hover: ColorPair;
+ }
+
+ export interface Border extends ColorPair {
+ /** type of border ('line' or 'bg'). */
+ type?: string; //'line'|'bg';
+ /** character to use if bg type, default is space. */
+ ch?: string;
+ }
+
+ export interface Padding {
+ top?:number;
+ right?:number;
+ bottom?:number;
+ left?:number;
+ }
+
+ export interface Position {
+ /** offsets of the element relative to its parent. can be a number, percentage (0-100%), or keyword (center). right and bottom do not accept keywords. */
+ top?:number|string;
+ /** offsets of the element relative to its parent. can be a number, percentage (0-100%), or keyword (center). right and bottom do not accept keywords. */
+ right?:number|string;
+ /** offsets of the element relative to its parent. can be a number, percentage (0-100%), or keyword (center). right and bottom do not accept keywords. */
+ bottom?:number|string;
+ /** offsets of the element relative to its parent. can be a number, percentage (0-100%), or keyword (center). right and bottom do not accept keywords. */
+ left?:number|string;
+ /** width of the element, can be a number, percentage (0-100%), or keyword (half or shrink). */
+ width?:number|string;
+ /** height of the element, can be a number, percentage (0-100%), or keyword (half or shrink). */
+ height?:number|string;
+ }
+
+ export interface KeyCode {
+ name: string;
+ ctrl: boolean;
+ meta: boolean;
+ shift: boolean;
+ sequence: string;
+ full: string;
+ }
+
+ export class Program
+ {
+ /**
+ Wrap the given text in terminal formatting codes corresponding to the given attribute
+ name. The `attr` string can be of the form `red fg` or `52 bg` where `52` is a 0-255
+ integer color number.
+ */
+ text (text:string, attr:string): string;
+ }
+
+ export interface Colors {
+ /** Either pass a hex string, an array of 3 numbers, or three separate numbers representing an RGB value. This returns the 0-255 color number for that color. */
+ match (r:string|number[]|number, g?:number, b?:number): number;
+
+ /** An array of the 255 colors as hex strings. */
+ colors: string[];
+ }
+
+ export interface NodeOptions
+ {
+ screen?: Screen;
+ parent?: Node;
+ children?: Node[];
+ }
+
+ export class Node extends events.EventEmitter
+ {
+ constructor(options?:NodeOptions);
+
+ type : string;
+ options : NodeOptions;
+ parent : Node;
+ screen : Screen;
+ children : Node[];
+ data : any;
+ _ : any;
+ $ : any;
+ index : number;
+
+ // on(event:string, callback:() => void);
+ // on(event:'adopt', callback:() => void);
+ // on(event:'remove', callback:() => void);
+ // on(event:'reparent', callback:() => void);
+ // on(event:'attach', callback:() => void);
+ // on(event:'detach', callback:() => void);
+
+ prepend(node:Node): void;
+ append(node:Node): void;
+ remove(node:Node): void;
+ insert(node:Node, index:number): void;
+ insertBefore(node:Node, refNode:Node): void;
+ insertAfter(node:Node, refNode:Node): void;
+ detach(): void;
+ // emitDescendants(): void;
+ // get(key:string): any;
+ // get(key:string, default:any): any;
+ // set(key:string, value:any): void;
+ }
+
+ export interface ScreenOptions extends NodeOptions
+ {
+ /** the blessed Program to be associated with. will be automatically instantiated if none is provided. */
+ program?: any;
+ /** attempt to perform CSR optimization on all possible elements (not just full-width ones, elements with uniform cells to their sides). this is known to cause flickering with elements that are not full-width, however, it is more optimal for terminal rendering. */
+ smartCSR?: boolean;
+ /** do CSR on any element within 20 cols of the screen edge on either side. faster than smartCSR, but may cause flickering depending on what is on each side of the element. */
+ fastCSR?: boolean;
+ /** attempt to perform back_color_erase optimizations for terminals that support it. it will also work with terminals that don't support it, but only on lines with the default background color. as it stands with the current implementation, it's uncertain how much terminal performance this adds at the cost of overhead within node. */
+ useBCE?: boolean;
+ /** amount of time (in ms) to redraw the screen after the terminal is resized (default: 300). */
+ resizeTimeout?: number;
+ /** the width of tabs within an element's content. */
+ tabSize?: number;
+ /** automatically position child elements with border and padding in mind. */
+ autoPadding?: boolean;
+ /** the name of the logfile to use. if specified but the file does not exist, it will be created. see log method. */
+ log?: string;
+ /** dump all output and input to desired file. can be used together with log option if set as a boolean. */
+ dump?: any;
+ /** debug mode. enables usage of the `debug` method. also creates a debug console which will display when pressing F12. it will display all log and debug messages. */
+ debug?: boolean;
+ /** Array of keys in their full format (e.g. C-c) to ignore when keys are locked. Useful for creating a key that will always exit no matter whether the keys are locked. */
+ ignoreLocked?: string[];
+
+ /** Do not clear the screen, only scroll down enough to make room for the elements on the screen. do not use the alternate screenbuffer. useful for writing a CLI tool or some kind of prompt (experimental - see test/widget-noalt.js) */
+ noAlt?: boolean;
+
+ /** Options for the cursor. */
+ cursor?: CursorOptions;
+ }
+
+ export interface CursorOptions {
+ /** have blessed draw a custom cursor and hide the terminal cursor (experimental). */
+ artificial?: boolean;
+ /** shape of the artificial cursor. can be: block, underline, or line. */
+ shape?: string; //'block'|'underline'|'line';
+ /** whether the artificial cursor blinks. */
+ blink?: boolean;
+ /** color of the artificial cursor. accepts any valid color value (null is default). */
+ color?: string;
+ }
+
+ export interface ScreenEventCallback {
+ (character:string, keyCode:KeyCode): void;
+ }
+
+ export class Screen extends Node
+ {
+ constructor(options?:ScreenOptions);
+
+ /** the blessed Program object. */
+ program: any;
+ /** the blessed Tput object (only available if you passed tput: true to the Program constructor.) */
+ tput: any;
+ /** top of the focus history stack. */
+ focused: any;
+ /** width of the screen (same as program.cols). */
+ width: number;
+ /** height of the screen (same as program.rows). */
+ height: number;
+ /** same as screen.width. */
+ cols: number;
+ /** same as screen.height. */
+ rows: number;
+
+ /** calculated relative left offset. */
+ left: number;
+ /** calculated relative right offset. */
+ right: number;
+ /** calculated relative top offset. */
+ top: number;
+ /** calculated relative bottom offset. */
+ bottom: number;
+ /** calculated absolute left offset. */
+ aleft: number;
+ /** calculated absolute right offset. */
+ aright: number;
+ /** calculated absolute top offset. */
+ atop: number;
+ /** calculated absolute bottom offset. */
+ abottom: number;
+
+
+ /** whether the focused element grabs all keypresses. */
+ grabKeys: boolean;
+ /** prevent keypresses from being received by any element. */
+ lockKeys: boolean;
+ /** the currently hovered element. only set if mouse events are bound. */
+ hover: Element;
+ /** set or get window title. */
+ title: string;
+
+ /** write string to the log file if one was created. */
+ log(...msg:any[]): void;
+ /** same as the log method, but only gets called if the debug option was set. */
+ debug(...msg:string[]): void;
+ /** allocate a new pending screen buffer and a new output screen buffer. */
+ alloc(): void;
+ /** draw the screen based on the contents of the screen buffer. */
+ draw(start:number, end:number): void;
+ /** render all child elements, writing all data to the screen buffer and drawing the screen. */
+ render(): void;
+ /** clear any region on the screen. */
+ clearRegion(x1:number, x2:number, y1:number, y2:number): void;
+ /** fill any region with a character of a certain attribute. */
+ fillRegion(attr:number, ch:string, x1:number, x2:number, y1:number, y2:number): void;
+ /** focus element by offset of focusable elements. */
+ focusOffset(offset:number): void;
+ /** focus previous element in the index. */
+ focusPrevious(): void;
+ /** focus next element in the index. */
+ focusNext(): void;
+ /** push element on the focus stack (equivalent to screen.focused = el). */
+ focusPush(element:Element): void;
+ /** pop element off the focus stack. */
+ focusPop(): void;
+ /** save the focused element. */
+ saveFocus(): void;
+ /** restore the saved focused element. */
+ restoreFocus(): void;
+ /** "rewind" focus to the last visible and attached element. */
+ rewindFocus(): void;
+ /** bind a keypress listener for a specific key. */
+ key(keyEvents:string|string[], callback:ScreenEventCallback): void;
+ /** bind a keypress listener for a specific key once. */
+ onceKey(keyEvents:string|string[], callback:ScreenEventCallback): void;
+ /** remove a keypress listener for a specific key. */
+ unkey(name:string, listener:ScreenEventCallback): void;
+ /** spawn a process in the foreground, return to blessed app after exit. */
+ spawn(file:string, args:string[], options:NodeChildProcessExecOptions): child_process.ChildProcess;
+ /** spawn a process in the foreground, return to blessed app after exit. executes callback on error or exit. */
+ exec(file:string, args:string[], options:NodeChildProcessExecOptions, callback:GenericCallback): child_process.ChildProcess;
+ /** read data from text editor. */
+ readEditor(options:{}, callback:GenericCallback): void;
+ /** set effects based on two events and attributes. */
+ setEffects(el:Element, fel:Element, over:string, out:string, effects:Style, temp?:string): void;
+ /** insert a line into the screen (using csr: this bypasses the output buffer). */
+ insertLine(n:number, y:number, top:number, bottom:number): void;
+ /** delete a line from the screen (using csr: this bypasses the output buffer). */
+ deleteLine(n:number, y:number, top:number, bottom:number): void;
+ /** insert a line at the bottom of the screen. */
+ insertBottom(top:number, bottom:number): void;
+ /** insert a line at the top of the screen. */
+ insertTop(top:number, bottom:number): void;
+ /** delete a line at the bottom of the screen. */
+ deleteBottom(top:number, bottom:number): void;
+ /** delete a line at the top of the screen. */
+ deleteTop(top:number, bottom:number): void;
+
+ /** enable mouse events for the screen and optionally an element (automatically called when a form of on('mouse') is bound). */
+ enableMouse(el?:Element): void;
+ /** enable keypress events for the screen and optionally an element (automatically called when a form of on('keypress') is bound). */
+ enableKeys(el?:Element): void;
+ /** enable key and mouse events. calls bot enableMouse and enableKeys. */
+ enableInput(el?:Element): void;
+
+ /** attempt to copy text to clipboard using iTerm2's propriety sequence. returns true if successful. */
+ copyToClipboard(text:string): boolean;
+ /** attempt to change cursor shape. will not work in all terminals (see artificial cursors for a solution to this). returns true if successful. */
+ cursorShape(shape:string, blink:boolean): boolean;
+ /** attempt to change cursor color. returns true if successful. */
+ cursorColor(color: string): boolean;
+ /** attempt to reset cursor. returns true if successful. */
+ cursorReset(): boolean;
+
+ }
+
+ export interface ElementOptions extends NodeOptions
+ {
+ fg?: string;
+ bg?: string;
+ scrollbar?: ColorPair;
+ focus?: Style;
+ hover?: Style;
+
+ /** border object, see below. */
+ border?: Border;
+ /** positioning options. */
+ position?: Position;
+ /** amount of padding on the inside of the element. can be a number or an object containing the properties: left, right, top, and bottom. */
+ padding?: number|Padding;
+ /** element's text content. */
+ content?: string;
+ /** element is clickable. */
+ clickable?: boolean;
+ /** element is focusable and can receive key input. */
+ input?: boolean;
+ /** element is focused. */
+ focused?: boolean;
+ /** whether the element is hidden. */
+ hidden?: boolean;
+ /** a simple text label for the element. */
+ label?: string;
+ /** a floating text label for the element which appears on mouseover. */
+ hoverText?: string;
+ /** text alignment: left, center, or right. */
+ align?: string;
+ /** vertical text alignment: top, middle, or bottom. */
+ valign?: string;
+ /** shrink/flex/grow to content and child elements. width/height during render. */
+ shrink?: any;
+ /** width of the element, can be a number, percentage (0-100%), or keyword (half or shrink). */
+ width?: number|string;
+ /** height of the element, can be a number, percentage (0-100%), or keyword (half or shrink). */
+ height?: number|string;
+ /** whether the element is scrollable or not. */
+ scrollable?: boolean;
+ /** background character (default is whitespace ). */
+ ch?: string;
+ /** allow the element to be dragged with the mouse. */
+ draggable?: boolean;
+ }
+
+ export class Element extends Node
+ {
+ constructor(options?:ElementOptions);
+
+ /** name of the element. useful for form submission. */
+ name: string;
+ /** border object. */
+ border: Border;
+ /** contains attributes (e.g. fg/bg/underline). see above. */
+ style: Style;
+ /** raw width, height, and offsets. */
+ position: Position;
+ /** type of border (line or bg). bg by default. */
+ type: string; //'line'|'bg';
+ /** character to use if bg type, default is space. */
+ ch: string;
+ /** raw text content. */
+ content: string;
+ /** whether the element is hidden or not. */
+ hidden: boolean;
+ /** whether the element is visible or not. */
+ visible: boolean;
+ /** whether the element is attached to a screen in its ancestry somewhere. */
+ detached: boolean;
+ /** calculated width. */
+ width: number;
+ /** calculated height. */
+ height: number;
+ /** whether the element is draggable. set to true to allow dragging. */
+ draggable: boolean;
+
+
+
+ /** calculated relative left offset. */
+ left: number;
+ /** calculated relative right offset. */
+ right: number;
+ /** calculated relative top offset. */
+ top: number;
+ /** calculated relative bottom offset. */
+ bottom: number;
+ /** calculated absolute left offset. */
+ aleft: number;
+ /** calculated absolute right offset. */
+ aright: number;
+ /** calculated absolute top offset. */
+ atop: number;
+ /** calculated absolute bottom offset. */
+ abottom: number;
+
+
+ /** write content and children to the screen buffer. */
+ render(): void;
+ /** hide element. */
+ hide(): void;
+ /** show element. */
+ show(): void;
+ /** toggle hidden/shown. */
+ toggle(): void;
+ /** focus element. */
+ focus(): void;
+ /** bind a keypress listener for a specific key. */
+ key(name:string|string[], listener:(character?:any, keyCode?:any) => void): void;
+ /** bind a keypress listener for a specific key once. */
+ onceKey(name:string, listener:() => void): void;
+ /** remove a keypress listener for a specific key. */
+ unkey(name:string, listener:() => void): void;
+ /** same as el.on('screen', ...) except this will automatically cleanup listeners after the element is detached. */
+ onScreenEvent(event:string, listener:(...args:any[]) => void): void;
+ /** set the z-index of the element (changes rendering order). */
+ setIndex(z:number): void;
+ /** put the element in front of its siblings. */
+ setFront(): void;
+ /** put the element in back of its siblings. */
+ setBack(): void;
+ /** set the label text for the top-left corner. example options: {text:'foo',side:'left'} */
+ setLabel(textOrOptions:string|{}): void;
+ /** remove the label completely. */
+ removeLabel(): void;
+ /** set the hover text for the bottom-right corner. example options: {text:'foo'} */
+ setHover(textOrOptions:string|{}): void;
+ /** remove the hover label completely. */
+ removeHover(): void;
+ /** set the content. note: when text is input, it will be stripped of all non-SGR escape codes, tabs will be replaced with 8 spaces, and tags will be replaced with SGR codes (if enabled). */
+ setContent(text:string): void;
+ /** return content, slightly different from el.content. assume the above formatting. */
+ getContent(): void;
+ /** similar to setContent, but ignore tags and remove escape codes. */
+ setText(text:string): void;
+ /** similar to getContent, but return content with tags and escape codes removed. */
+ getText(): void;
+ /** insert a line into the box's content. */
+ insertLine(index:number, lines:string|string[]): void;
+ /** delete a line from the box's content. */
+ deleteLine(index:number, numLines:number): void;
+ /** get a line from the box's content. */
+ getLine(index:number): void;
+ /** get a line from the box's content from the visible top. */
+ getBaseLine(index:number): void;
+ /** set a line in the box's content. */
+ setLine(index:number, line:string): void;
+ /** set a line in the box's content from the visible top. */
+ setBaseLine(index:number, line:string): void;
+ /** clear a line from the box's content. */
+ clearLine(index:number): void;
+ /** clear a line from the box's content from the visible top. */
+ clearBaseLine(index:number): void;
+ /** insert a line at the top of the box. */
+ insertTop(lines:string|string[]): void;
+ /** insert a line at the bottom of the box. */
+ insertBottom(lines:string|string[]): void;
+ /** delete a line at the top of the box. */
+ deleteTop(): void;
+ /** delete a line at the bottom of the box. */
+ deleteBottom(): void;
+ /** unshift a line onto the top of the content. */
+ unshiftLine(lines:string|string[]): void;
+ /** shift a line off the top of the content. */
+ shiftLine(index:number): void;
+ /** push a line onto the bottom of the content. */
+ pushLine(lines:string|string[]): void;
+ /** pop a line off the bottom of the content. */
+ popLine(index:number): void;
+ /** an array containing the content lines. */
+ getLines(): void;
+ /** an array containing the lines as they are displayed on the screen. */
+ getScreenLines(): void;
+ /** get a string's real length, taking into account tags. */
+ textLength(text:string): number;
+
+ /** enable dragging of the element. */
+ enableDrag(): void;
+ /** disable dragging of the element. */
+ disableDrag(): void;
+ }
+
+
+ //
+ // Box
+ //
+
+ export interface BoxOptions extends ElementOptions {
+ // intentionally empty
+ }
+
+ export class Box extends Element {
+ constructor(options?:BoxOptions);
+ // intentionally empty
+ }
+
+
+ //
+ // ScrollableBox
+ //
+
+ export interface ScrollableBoxOptions extends BoxOptions {
+ /** a limit to the childBase. default is `Infinity`. */
+ baseLimit: number;
+ /** a option which causes the ignoring of `childOffset`. this in turn causes the childBase to change every time the element is scrolled. */
+ alwaysScroll: boolean;
+ /** object enabling a scrollbar. */
+ scrollbar: ScrollBar;
+ }
+
+ /** A box with scrollable content. */
+ export class ScrollableBox extends Box {
+ constructor(options?:ScrollableBoxOptions);
+
+ /** the offset of the top of the scroll content. */
+ childBase: number;
+ /** the offset of the chosen item/line. */
+ childOffset: number;
+ /** scroll the content by a relative offset. */
+ scroll(offset:number): void;
+ /** scroll the content to an absolute index. */
+ scrollTo(index:number): void;
+ /** same as `scrollTo`. */
+ setScroll(index:number): void;
+ /** set the current scroll index in percentage (0-100). */
+ setScrollPerc(perc:number): void;
+ /** get the current scroll index in lines. */
+ getScroll(): number;
+ /** get the actual height of the scrolling area. */
+ getScrollHeight(): number;
+ /** get the current scroll index in percentage. */
+ getScrollPerc(): number;
+ /** reset the scroll index to its initial state. */
+ resetScroll(): void;
+
+ }
+
+ export interface ScrollBar {
+ /** style of the scrollbar. */
+ style: Style;
+ /** style of the scrollbar track if present (takes regular style options). */
+ track: Style;
+ }
+
+
+ //
+ // ScrollableText
+ //
+
+ export interface ScrollableTextOptions extends ScrollableBoxOptions {
+ /** whether to enable automatic mouse support for this element. */
+ mouse: boolean;
+ /** use predefined keys for navigating the text. */
+ keys: boolean;
+ /** use vi keys with the `keys` option. */
+ vi: boolean;
+ }
+
+ /** __DEPRECATED__ - Use Box with the `scrollable` and `alwaysScroll` options instead. A scrollable text box which can display and scroll text, as well as handle pre-existing newlines and escape codes. */
+ export class ScrollableText extends ScrollableBox {
+ constructor(options?:ScrollableTextOptions);
+ }
+
+
+
+ //
+ // Text
+ //
+
+ export interface TextOptions extends ElementOptions {
+ align?: string; //'left'|'center'|'right';
+ }
+
+ export class Text extends Element {
+ constructor(options?:TextOptions);
+ // intentionally empty
+ }
+
+
+ //
+ // Line
+ //
+
+ export interface LineOptions extends BoxOptions {
+ orientation?: string; //'vertical'|'horizontal';
+ style?: Style;
+ }
+
+ export class Line extends Box {
+ constructor(options?:LineOptions);
+ // intentionally empty
+ }
+
+
+ //
+ // List
+ //
+
+ export interface ListStyle extends Style {
+ selected?: Style;
+ item?: Style;
+ }
+
+ export interface ListOptions extends BoxOptions
+ {
+ style?: ListStyle;
+
+ /** whether to automatically enable mouse support for this list (allows clicking items). */
+ mouse?: boolean;
+ /** use predefined keys for navigating the list. */
+ keys?: any;
+ /** use vi keys with the keys option. */
+ vi?: boolean;
+ /** an array of strings which become the list's items. */
+ items?: string[];
+ /** a function that is called when vi mode is enabled and the key / is pressed. This function accepts a callback function which should be called with the search string. The search string is then used to jump to an item that is found in items. */
+ search?: (callback:(searchString:string) => void) => void;
+ /** whether the list is interactive and can have items selected (default: true). */
+ interactive?: boolean;
+ }
+
+ export class List extends Box
+ {
+ constructor(options?:ListOptions);
+
+ /** The text of the currently selected item. */
+ value:string;
+ /** The items in the list. */
+ items:string[];
+ /** The items in the list. */
+ ritems:string[];
+ /** The index of the current selection. */
+ selected:number;
+
+ /** add an item based on a string. */
+ addItem(text:string): void;
+ /** returns the item index from the list. child can be an element, index, or string. */
+ getItemIndex(child:Element|number|string): void;
+ /** returns the item element. child can be an element, index, or string. */
+ getItem(child:Element|number|string): void;
+ /** removes an item from the list. child can be an element, index, or string. */
+ removeItem(child:Element|number|string): void;
+ /** clears all items from the list. */
+ clearItems(): void;
+ /** sets the list items to multiple strings. */
+ setItems(items:string[]): void;
+ /** Sets the current selection by absolute index. */
+ select(index:number): void;
+ /** Changes the current selection based on current offset. */
+ move(offset:number): void;
+ /** select item above selected. */
+ up(amount:number): void;
+ /** select item below selected. */
+ down(amount:number): void;
+ /** show/focus list and pick an item. the callback is executed with the result. */
+ pick(cwd:string, callback:(err:any, file:string) => void): void;
+
+ /** show/focus list and pick an item. the callback is executed with the result. */
+ pick(callback:(err:any, file:string) => void): void;
+ }
+
+ //
+ // Input
+ //
+
+ export interface InputOptions extends BoxOptions {
+ // intentionally empty
+ }
+
+ export class Input extends Box {
+ constructor(options?:InputOptions);
+ // intentionally empty
+ }
+
+ export interface InputOptions extends BoxOptions {
+ // intentionally empty
+ }
+
+ //
+ // Textarea
+ //
+
+ export interface TextareaOptions extends InputOptions
+ {
+ /** use pre-defined keys (`i` or `enter` for insert, `e` for editor, `C-e` for editor while inserting). */
+ keys?: boolean;
+ /** use pre-defined mouse events (right-click for editor). */
+ mouse?: boolean;
+ /** call `readInput()` when the element is focused. automatically unfocus. */
+ inputOnFocus?: boolean;
+ }
+
+ /** A box which allows multiline text input. */
+ export class Textarea extends Input
+ {
+ constructor(options?:TextareaOptions);
+
+ /** the input text. __read-only__. */
+ value: string;
+
+ /** submit the textarea (emits `submit`). */
+ submit(): void;
+ /** cancel the textarea (emits `cancel`). */
+ cancel(): void;
+ /** grab key events and start reading text from the keyboard. takes a callback which receives the final value. */
+ readInput(callback:GenericCallback): void;
+ /** open text editor in `$EDITOR`, read the output from the resulting file. takes a callback which receives the final value. */
+ readEditor(callback:GenericCallback): void;
+ /** the same as `this.value`, for now. */
+ getValue(): string;
+ /** clear input. */
+ clearValue(): void;
+ /** set value. */
+ setValue(text:string): void;
+ }
+
+
+ //
+ // Textbox
+ //
+
+ export interface TextboxOptions extends TextareaOptions {
+ /** completely hide text. */
+ secret?: boolean;
+ /** replace text with asterisks (`*`). */
+ censor?: boolean;
+ }
+
+ /** A box which allows text input. */
+ export class Textbox extends Textarea {
+ constructor(options?:TextboxOptions);
+
+ /** completely hide text. */
+ secret: boolean;
+ /** replace text with asterisks (`*`). */
+ censor: boolean;
+ }
+
+
+ //
+ // Button
+ //
+
+ export interface ButtonOptions extends InputOptions {
+ }
+
+ /** A button which can be focused and allows key and mouse input. */
+ export class Button extends Input {
+ constructor(options?:ButtonOptions);
+
+ // on(event:string, callback:() => void): void;
+ // on(event:'press', callback:() => void);
+
+ /** press button. emits 'press'. */
+ press(): void;
+ }
+
+
+ //
+ // ProgressBar
+ //
+
+ export interface ProgressBarOptions extends InputOptions {
+ /** can be `horizontal` or `vertical`. */
+ orientation: string;
+ /** the character to fill the bar with (default is space). */
+ pch: string;
+ /** the amount filled (0 - 100). */
+ filled: number;
+ /** same as `filled`. */
+ value: number;
+ /** enable key support. */
+ keys: boolean;
+ /** enable mouse support. */
+ mouse: boolean;
+
+ /** contains the extra key 'bar', which defines the style of the bar contents itself. */
+ style: ProgressBarStyle;
+ }
+
+ export interface ProgressBarStyle extends Style {
+ /** style of the bar contents itself. */
+ bar: Style;
+ }
+
+
+ export class ProgressBar extends Input {
+ constructor(options?:ProgressBarOptions);
+
+ /** progress the bar by a fill amount. */
+ progress(amount:number): void;
+ /** set progress to specific amount. */
+ setProgress(amount:number): void;
+ /** reset the bar. */
+ reset(): void;
+ }
+
+ //
+ // Checkbox
+ //
+
+ export interface CheckboxOptions extends InputOptions {
+ /** whether the element is checked or not. */
+ checked: boolean;
+ /** enable mouse support. */
+ mouse: boolean;
+ }
+
+
+ /** A checkbox which can be used in a form element. */
+ export class Checkbox extends Input
+ {
+ constructor(options?:CheckboxOptions);
+
+ /** the text next to the checkbox (do not use setcontent, use `check.text = ''`). */
+ text: string;
+ /** whether the element is checked or not. */
+ checked: boolean;
+ /** same as `checked`. */
+ value: boolean;
+
+ /** check the element. */
+ check(): void;
+ /** uncheck the element. */
+ uncheck(): void;
+ /** toggle checked state. */
+ toggle(): void;
+ }
+
+
+ //
+ // RadioSet
+ //
+
+ export interface RadioSetOptions extends BoxOptions {
+ }
+
+
+ export class RadioSet extends Box {
+ constructor(options?:RadioSetOptions);
+ }
+
+
+ //
+ // RadioButton
+ //
+
+ export interface RadioButtonOptions extends CheckboxOptions {
+ }
+
+
+ /** A radio button which can be used in a form element. */
+ export class RadioButton extends Checkbox {
+ constructor(options?:RadioButtonOptions);
+ }
+
+
+
+ //
+ // Prompt
+ //
+
+ export interface PromptOptions extends BoxOptions {
+ }
+
+
+ /** A prompt box containing a text input, okay, and cancel buttons (automatically hidden). */
+ export class Prompt extends Box
+ {
+ constructor(options?:PromptOptions);
+
+ /** show the prompt and wait for the result of the textbox. set text and initial value */
+ input(text:string, value:any, callback:(val:any) => void): void;
+ /** show the prompt and wait for the result of the textbox. set text and initial value */
+ setInput(text:string, value:any, callback:(val:any) => void): void;
+ /** show the prompt and wait for the result of the textbox. set text and initial value */
+ readInput(text:string, value:any, callback:(val:any) => void): void;
+ }
+
+
+ //
+ // Question
+ //
+
+ export interface QuestionOptions extends BoxOptions {
+ }
+
+
+ /** A question box containing okay and cancel buttons (automatically hidden). */
+ export class Question extends Box
+ {
+ constructor(options?:QuestionOptions);
+
+ /** ask a `question`. `callback` will yield the result. */
+ ask(question:string, callback:(result:any) => void): void;
+ }
+
+
+ //
+ // Message
+ //
+
+ export interface MessageOptions extends BoxOptions {
+ }
+
+
+ /** A box containing a message to be displayed (automatically hidden). */
+ export class Message extends Box
+ {
+ constructor(options?:MessageOptions);
+
+ /** display a message for a time (default is 3 seconds). set time to 0 for a perpetual message that is dismissed on keypress. */
+ log(text:string, timeOrCallback:number|MessageCallback, callback?:MessageCallback): void;
+ /** display a message for a time (default is 3 seconds). set time to 0 for a perpetual message that is dismissed on keypress. */
+ display(text:string, timeOrCallback:number|MessageCallback, callback?:MessageCallback): void;
+ /** display an error in the same way. */
+ error(text:string, timeOrCallback:number|MessageCallback, callback?:MessageCallback): void;
+ }
+
+ export interface MessageCallback {
+ (): void;
+ }
+
+
+ //
+ // Loading
+ //
+
+ export interface LoadingOptions extends BoxOptions {
+ }
+
+ /** A box with a spinning line to denote loading (automatically hidden). */
+ export class Loading extends Box
+ {
+ constructor(options?:LoadingOptions);
+
+ /** display the loading box with a message. will lock keys until `stop` is called. */
+ load(text:string): void;
+ /** hide loading box. unlock keys. */
+ stop(): void;
+ }
+
+
+ //
+ // Listbar
+ //
+
+ export interface ListbarOptions extends BoxOptions
+ {
+ /** Listbar's `style` object includes sub-styles for `selected` and `item`. */
+ style?: ListbarStyle;
+
+ /** set buttons using an object with keys as titles of buttons, containing of objects containing keys of `keys` and `callback`. */
+ items?: ListbarItemSet;
+ /** set buttons using an object with keys as titles of buttons, containing of objects containing keys of `keys` and `callback`. */
+ commands?: ListbarItemSet;
+ /** automatically bind list buttons to keys 0-9. */
+ autoCommandKeys?: boolean;
+ }
+
+ export interface ListbarItemSet {
+ [name: string]: ListbarItem;
+ }
+
+ export interface ListbarItem {
+ keys: string[];
+ callback: GenericCallback;
+ }
+
+ export interface ListbarStyle extends Style
+ {
+ /** style for a selected item. */
+ selected: Style;
+ /** style for an unselected item. */
+ item: Style;
+ }
+
+ /** A horizontal list. Useful for a main menu bar. */
+ export class Listbar extends Box
+ {
+ constructor(options?:ListbarOptions);
+
+ /** append an item to the bar. */
+ add(item:ListbarItem, callback:GenericCallback): void;
+ /** append an item to the bar. */
+ addItem(item:ListbarItem, callback:GenericCallback): void;
+ /** append an item to the bar. */
+ appendItem(item:ListbarItem, callback:GenericCallback): void;
+
+ /** select button and execute its callback. */
+ selectTab(index: number): void;
+
+ /** set commands (see `commands` option above). */
+ setItems(commands: ListbarItemSet): void;
+ /** select an item on the bar. */
+ select(offset: number): void;
+ /** remove item from the bar. */
+ removeItem(child:ListbarItem): void;
+ /** move focus relatively across the bar. */
+ move(offset: number): void;
+ /** move focus left relatively across the bar. */
+ moveLeft(offset: number): void;
+ /** move focus right relatively across the bar. */
+ moveRight(offset: number): void;
+ }
+
+
+ //
+ // Log
+ //
+
+ export interface LogOptions extends ScrollableTextOptions {
+ /** amount of scrollback allowed. default: Infinity. */
+ scrollback?: number;
+ /** scroll to bottom on input even if the user has scrolled up. default: false. */
+ scrollOnInput?: boolean;
+ }
+
+
+ /** A log permanently scrolled to the bottom. */
+ export class Log extends ScrollableText
+ {
+ constructor(options?:LogOptions);
+
+ /** amount of scrollback allowed. default: Infinity. */
+ scrollback: number;
+ /** scroll to bottom on input even if the user has scrolled up. default: false. */
+ scrollOnInput: boolean;
+
+ /** add a log line. */
+ log(text:string): void;
+ /** add a log line. */
+ add(text:string): void;
+ }
+
+
+ //
+ // Table
+ //
+
+ export interface TableOptions extends BoxOptions
+ {
+ /** array of array of strings representing rows (same as `data`). */
+ rows?: string[][];
+ /** array of array of strings representing rows (same as `rows`). */
+ data?: string[][];
+ /** spaces to attempt to pad on the sides of each cell. `2` by default: one space on each side (only useful if the width is shrunken). */
+ pad?: number;
+ /** do not draw inner cells. */
+ noCellBorders?: boolean;
+ /** fill cell borders with the adjacent background color. */
+ fillCellBorders?: boolean;
+
+ /** includes `header` and `cell` substyles. */
+ style?: TableStyle;
+ }
+
+ export interface TableStyle extends Style {
+ /** header style. */
+ header: Style;
+ /** cell style. */
+ cell: Style;
+ }
+
+ /** A stylized table of text elements. */
+ export class Table extends Box
+ {
+ /** includes `header` and `cell` substyles. */
+ style: TableStyle;
+
+ /** set rows in table. array of arrays of strings. */
+ setData(rows: string[][]): void;
+ /** set rows in table. array of arrays of strings. */
+ setRows(rows: string[][]): void;
+ }
+
+
+ //
+ // ListTable
+ //
+
+ export interface ListTableOptions extends ListOptions
+ {
+ /** array of array of strings representing rows (same as `data`). */
+ rows?: string[][];
+ /** array of array of strings representing rows (same as `rows`). */
+ data?: string[][];
+ /** spaces to attempt to pad on the sides of each cell. `2` by default: one space on each side (only useful if the width is shrunken). */
+ pad?: number;
+
+ /** do not draw inner cells. */
+ noCellBorders?: boolean;
+
+ /** includes `header` and `cell` substyles. */
+ style?: TableStyle;
+ }
+
+ export interface ListTableStyle extends TableStyle {
+ }
+
+
+ /** A stylized table of text elements with a list. */
+ export class ListTable extends List
+ {
+ constructor(options?:ListTableOptions);
+
+ /** set rows in table. array of arrays of strings. */
+ setData(rows: string[][]): void;
+ /** set rows in table. array of arrays of strings. */
+ setRows(rows: string[][]): void;
+ }
+
+ //
+ // Image
+ //
+
+ export interface ImageOptions extends BoxOptions {
+ /** path to image. */
+ file: string;
+ /** path to w3mimgdisplay. if a proper w3mimgdisplay path is not given, blessed will search the entire disk for the binary. */
+ w3m: string;
+ }
+
+
+ /** Display an image in the terminal (jpeg, png, gif) using w3mimgdisplay. Requires w3m to be installed. X11 required: works in xterm, urxvt, and possibly other terminals. */
+ export class Image extends Box
+ {
+ constructor(options?:ImageOptions);
+
+ /** set the image in the box to a new path. */
+ setImage (img:string, callback:GenericCallback): void;
+ /** clear the current image. */
+ clearImage (callback:GenericCallback): void;
+ /** get the size of an image file in pixels. */
+ imageSize (img:string, callback:GenericCallback): void;
+ /** get the size of the terminal in pixels. */
+ termSize (callback:GenericCallback): void;
+ /** get the pixel to cell ratio for the terminal. */
+ getPixelRatio (callback:GenericCallback): void;
+ }
+
+
+ //
+ // Form
+ //
+
+ export interface FormOptions extends BoxOptions {
+ /** allow default keys (tab, vi keys, enter). */
+ keys?:boolean;
+ /** allow vi keys. */
+ vi?:boolean;
+ }
+
+ export class Form extends Box
+ {
+ constructor(options?:FormOptions);
+
+ /** last submitted data. */
+ submission: any;
+
+ // on(event:string, callback:() => void): void;
+ // on(event:'submit', callback:(data) => void): void;
+ // on(event:'cancel', callback:() => void): void;
+ // on(event:'reset', callback:() => void): void;
+
+ next(): void;
+ previous(): void;
+
+ resetSelected(): void;
+ /** focus first form element. */
+ focusFirst(): void;
+ /** focus last form element. */
+ focusLast(): void;
+ /** focus next form element. */
+ focusNext(): void;
+ /** focus previous form element. */
+ focusPrevious(): void;
+ /** submit the form. */
+ submit(): void;
+ /** discard the form. */
+ cancel(): void;
+ /** clear the form. */
+ reset(): void;
+ }
+
+
+ //
+ // FileManager
+ //
+
+ export interface FileManagerOptions extends ListOptions {
+ cwd?: string;
+ }
+
+ export interface DirectoryEntry {
+ name: string;
+ text: string;
+ dir: boolean;
+ symlink: boolean;
+ }
+
+ export class FileManager extends List
+ {
+ constructor(options?:FileManagerOptions);
+
+ cwd: string;
+
+ useFormatter (formatterFn:(entry:DirectoryEntry) => DirectoryEntry): void;
+
+ /** refresh the file list (perform a readdir on cwd and update the list items). */
+ refresh (cwd?:string, callback?:() => void): void;
+
+ /** refresh the file list. */
+ refresh (callback?:() => void): void;
+
+ /** reset back to original cwd. */
+ reset (cwd?:string, callback?:() => void): void;
+ }
+
+
+ //
+ // Terminal
+ //
+
+ export interface TerminalOptions extends BoxOptions
+ {
+ /** handler for input data. */
+ handler?: (userInput:Buffer) => void;
+ /** name of shell. $SHELL by default. */
+ shell?:string;
+ /** args for shell. */
+ args?:any;
+ /** can be line, underline, and block. */
+ cursor?:string; //'line'|'underline'|'block';
+ }
+
+ export class Terminal extends Box
+ {
+ /** reference to the headless term.js terminal. */
+ term: any;
+ /** reference to the pty.js pseudo terminal. */
+ pty: any;
+
+ /** write data to the terminal. */
+ write(data:string): void;
+
+ /** nearly identical to `element.screenshot`, however, the specified region includes the terminal's _entire_ scrollback, rather than just what is visible on the screen. */
+ screenshot(xi?:number, xl?:number, yi?:number, yl?:number): string;
+ }
+
+
+ export interface NodeChildProcessExecOptions
+ {
+ cwd?: string;
+ stdio?: any;
+ customFds?: any;
+ env?: any;
+ encoding?: string;
+ timeout?: number;
+ maxBuffer?: number;
+ killSignal?: string;
+ }
+ }
+
+ export = Blessed;
+}
+
+
+
diff --git a/body-parser/body-parser.d.ts b/body-parser/body-parser.d.ts
index 16f639dfaf..f7e691a365 100644
--- a/body-parser/body-parser.d.ts
+++ b/body-parser/body-parser.d.ts
@@ -33,7 +33,7 @@ declare module "body-parser" {
/**
* passed to JSON.parse().
*/
- receiver?: (key: string, value: any) => any;
+ reviver?: (key: string, value: any) => any;
/**
* parse extended syntax with the qs module. (default: true)
*/
@@ -65,7 +65,7 @@ declare module "body-parser" {
/**
* passed to JSON.parse().
*/
- receiver?: (key: string, value: any) => any;
+ reviver?: (key: string, value: any) => any;
}): express.RequestHandler;
export function raw(options?: {
diff --git a/bootstrap-fileinput/bootstrap-fileinput.d.ts b/bootstrap-fileinput/bootstrap-fileinput.d.ts
new file mode 100644
index 0000000000..fadfadd612
--- /dev/null
+++ b/bootstrap-fileinput/bootstrap-fileinput.d.ts
@@ -0,0 +1,1039 @@
+// Type definitions for bootstrap-fileinput
+// Project: https://github.com/kartik-v/bootstrap-fileinput
+// Definitions by: Ché Coxshall
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+///
+
+interface JQuery {
+ fileinput: (options?: BootstrapFileInput.FileInputOptions) => JQuery;
+}
+
+
+declare module BootstrapFileInput {
+ interface FileInputOptions {
+ /**
+ Language configuration for the plugin to enable the plugin to display messages for your locale (you must set the ISO code for the language).
+ You can have multiple language widgets on the same page.
+ The locale JS file for the language code must be defined as mentioned in the translations section: http://plugins.krajee.com/file-input#translations
+ */
+ language?: string;
+ /**
+ Whether to display the file caption.
+ Defaults to true.
+ */
+ showCaption?: boolean;
+ /**
+ Whether to display the file preview.
+ Defaults to true.
+ */
+ showPreview?: boolean;
+ /**
+ Whether to display the file remove/clear button.
+ Defaults to true.
+ */
+ showRemove?: boolean;
+ /**
+ Whether to display the file upload button.
+ Defaults to true.
+ This will default to a form submit button, unless the uploadUrl is specified.
+ */
+ showUpload?: boolean;
+ /**
+ Whether to display the file upload cancel button.
+ Defaults to true.
+ This will be only enabled and displayed when an AJAX upload is in process.
+ */
+ showCancel?: boolean;
+ /**
+ Whether to display the close icon in the preview.
+ Defaults to true.
+ This will be only parsed when showPreview is true or when you are using the {close} tag in your preview templates.
+ */
+ showClose?: boolean;
+ /**
+ Whether to persist display of the uploaded file thumbnails in the preview window (for ajax uploads) until the remove/clear button is pressed.
+ Defaults to true.
+ When set to false, a next batch of files selected for upload will clear these thumbnails from preview.
+ */
+ showUploadedThumbs?: boolean;
+ /**
+ Whether to automatically replace the files in the preview after the maxFileCount limit is reached and a new set of file(s) is/are selected.
+ This will only work if a valid maxFileCount is set.
+ Defaults to false.
+ */
+ autoReplace?: boolean;
+ /**
+ Any additional CSS class to append to the caption container.
+ */
+ captionClass?: string;
+ /**
+ Any additional CSS class to append to the preview container.
+ */
+ previewClass?: string;
+ /**
+ Any additional CSS class to append to the main plugin container.
+ */
+ mainClass?: string;
+ /**
+ The initial preview content to be displayed.
+ You can pass the minimal HTML markup for displaying your image, text, or file.
+ If set as a string, this will display a single file in the initial preview if there is no delimiter. You can set a delimiter (as defined in initialDelimiter) to show multiple files in initial preview.
+ If set as an array, it will display all files in the array as an initial preview (useful for multiple file upload scenarios).
+ The following CSS classes will need to be added for displaying each file type as per the plugin style theme:
+ image files: Include CSS class file-preview-image
+ text files: Include CSS class file-preview-text
+ other files: Include CSS class file-preview-other
+ */
+ initialPreview?: string | any[];
+ /**
+ the count of initial preview items that will be added to the count of files selected in preview. This is applicable when displaying the right caption, when overwriteInitial is set to false.
+ */
+ initialPreviewCount?: number;
+ /**
+ the delimiter to be used for splitting the initial preview content as individual file thumbnails (applicable only if initialPreview is passed as a string instead of array). Defaults to *$$*.
+ */
+ initialPreviewDelimiter?: string;
+ /**
+ the configuration for setting up important properties for each initialPreview item (that is setup as part of initialPreview).
+ */
+ initialPreviewConfig?: PreviewConfig[];
+ /**
+ whether the delete button will be displayed for each thumbnail that has been created with initialPreview.
+ */
+ initialPreviewShowDelete?: boolean;
+ /**
+ whether the file thumbnail should be removed from preview on error. Defaults to false.
+ */
+ removeFromPreviewOnError?: boolean;
+ /**
+ this will be a list of tags used in thumbnail templates that will be replaced dynamically within the thumbnail markup, when the thumbnail is rendered.
+ */
+ previewThumbTags?: { [key: string]: string; }
+ /**
+ this is an extension of previewThumbTags specifically for initial preview content - but will be configured as an array of objects corresponding to each initial preview thumbnail. The initial preview thumbnails set via initialPreview will read this configuration for replacing tags.
+ */
+ initialPreviewThumbTags?: { [key: string]: string; }
+ /**
+ the extra data that will be passed as data to the initial preview delete url/AJAX server call via POST.
+ This will be overridden by the initialPreviewConfig['extra'] property.
+ This property is only applicable for ajax deletions in initial preview and when you have set a value for initialPreviewConfig['url'] or deleteUrl.
+ This can be setup either as an object (associative array of keys and values) or as a function callback.
+ Note
+ The ajax delete action will send the following data to server via POST:
+ key: the key setting as setup in initialPreviewConfig['key']
+ any other extra data passed as key: value pairs either via initialPreviewConfig['extra'] OR deleteExtraData if former is not set.
+ */
+ deleteExtraData?: {} | { (): {} };
+ /**
+ the URL for deleting the image/content in the initial preview via AJAX post response. This will be overridden by the initialPreviewConfig['url'] property.
+ Note
+ The ajax delete action will send the following data to server via POST:
+ key: the key setting as setup in initialPreviewConfig['key']
+ any other extra data passed as key: value pairs either via initialPreviewConfig['extra'] OR deleteExtraData if former is not set.
+ */
+ deleteUrl?: string;
+ /**
+ the initial preview caption text to be displayed.
+ If you do not set a value here and initialPreview is set to true this will default to "{preview-file-count} files selected", where {preview-file-count} is the count of the files passed in initialPreview.
+ */
+ initialCaption?: string;
+ /**
+ whether you wish to overwrite the initial preview content and caption setup.
+ This defaults to true, whereby, any initialPreview content set will be overwritten, when new file is uploaded or when files are cleared.
+ Setting it to false will help displaying a saved image or file from database always - useful especially when using the multiple file upload feature.
+ */
+ overwriteInitial?: boolean;
+ /**
+ the templates configuration for rendering each part of the layout.
+ */
+ layoutTemplates?: LayoutTemplates;
+ /**
+ the templates configuration for rendering each preview file type.
+ */
+ previewTemplates?: PreviewTemplates;
+ /**
+ the list of allowed file types for upload.
+ This by default is set to null which means the plugin supports all file types for upload.
+ If an invalid file type is found, then a validation error message as set in msgInvalidFileType will be raised.
+ Note:
+ You need to be careful in case you are setting both allowedFileTypes and allowedFileExtensions. In this case, the allowedFileTypes property is validated first and generally precedes the allowedFileExtensions setting (and the latter validation maybe skipped).
+ */
+ allowedFileTypes?: ("image" | "html" | "text" | "video" | "audio" | "flash" | "object")[];
+ /**
+ the list of allowed file extensions for upload.
+ This by default is set to null which means the plugin supports all file extensions for upload.
+ If an invalid file extension is found, then a validation error message as set in msgInvalidFileExtension will be raised.
+ Note:
+ You need to be careful in case you are setting both allowedFileTypes and allowedFileExtensions. In this case, the allowedFileTypes property is validated first and generally precedes the allowedFileExtensions setting (and the latter validation maybe skipped).
+ */
+ allowedFileExtensions?: string[];
+ /**
+ the list of allowed preview types for your widget.
+ This by default supports all file types for preview.
+ The plugin by default treats each file as an object if it does not match any of the previous types.
+ To disable this behavior, you can remove object from the list of allowedPreviewTypes OR fine tune it through allowedPreviewMimeTypes.
+ To disable content preview for all file-types and show the previewIcon instead as a thumbnail, set this to null, empty, or false.
+ */
+ allowedPreviewTypes?: ("image" | "html" | "text" | "video" | "audio" | "flash" | "object")[];
+ /**
+ the list of allowed mime types for preview.
+ This is set to null by default which means all possible mime types are allowed.
+ This setting works in combination with allowedPreviewTypes to filter only the needed file types allowed for preview.
+ */
+ allowedPreviewMimeTypes?: string[];
+ /**
+ the default content / markup to show by default in the preview window whenever the files are cleared or the input is cleared.
+ This can be useful for use cases like showing the default user profile picture or profile image before upload to overwrite.
+ This is a bit different from initialPreview in the sense, that the initialPreview content will always be displayed unless it is deleted or overwritten based on overwriteInitial.
+ The defaultPreviewContent on the other hand will only be shown ONLY on initialization OR whenever you clear the preview.
+ At other times when files have been selected this will be overwritten temporarily until file(s) selected is/are cleared.
+ This property can be useful to display for example a default user profile picture (or saved picture) in the preview window unless the user selects a picture.
+ */
+ defaultPreviewContent?: string;
+ /**
+ the list of additional custom tags that will be replaced in the layout templates.
+ */
+ customLayoutTags?: {};
+ /**
+ the list of additional custom tags that will be replaced in the preview templates.
+ */
+ customPreviewTags?: {};
+ /**
+ the format settings (width and height) for rendering each preview file type.
+ */
+ previewSettings?: PreviewSettings;
+ /**
+ the settings to validate and identify each file type when a file is selected for upload.
+ This is a list of callbacks, which accepts the file mime type and file name as a parameter.
+ */
+ fileTypeSettings?: FileTypeSettings;
+ /**
+ the icon to be shown in each preview file thumbnail when an unreadable file type for preview is detected. Defaults to .
+ */
+ previewFileIcon?: string;
+ /**
+ the CSS class to be applied to the preview file icon container. Defaults to file-icon-4x.
+ */
+ previewFileIconClass?: string;
+ /**
+ the preview icon markup settings for each file extension (type).
+ You need to set this as key: value pairs, where the key corresponds to a file extension (e.g. doc, docx, xls etc.), and the value corresponds to the markup of the icon to be rendered.
+ If this is not set OR a file extension is not set here, the preview will default to previewFileIcon.
+ Note that displaying the icons instead of file content is controlled via allowedPreviewTypes and allowedPreviewMimeTypes
+ */
+ previewFileIconSettings?: PreviewFileIconSettings;
+ /**
+ the extensions to be auto derived for each file extension (type).
+ This is useful if you want to set the same icon for multiple file extension types.
+ You need to set this as `key: value` pairs, where the key corresponds to a file extension as set in previewFileIconSettings (e.g. doc, docx, xls etc.).
+ The value will be a function callback that accepts the following parameter:
+ ext: string, the file extension (without the . [dot]) of the file currently selected in the preview.
+ You can configure the callback to match the set of file extensions (via regex or similar) for each `key` and return a boolean output if the file extension matches.
+ */
+ previewFileExtSettings?: PreviewFileExtSettings;
+ /**
+ the CSS class for the each of the button labels for browse, remove, upload, and cancel.
+ Defaults to hidden-xs, which automatically hides the button labels for small screen devices and renders as smaller iconic buttons to fit to the screen.
+ */
+ buttonLabelClass?: string;
+ /**
+ the label to display for the file picker/browse button. Defaults to Browse ….
+ */
+ browseLabel?: string;
+ /**
+ the icon to display before the label for the file picker/browse button. Defaults to .
+ */
+ browseIcon?: string;
+ /**
+ the CSS class for the file picker/browse button. Defaults to btn btn-primary.
+ */
+ browseClass?: string;
+ /**
+ the label to display for the file remove button. Defaults to Remove.
+ */
+ removeLabel?: string;
+ /**
+ the icon to display before the label for the file picker/remove button. Defaults to .
+ */
+ removeIcon?: string;
+ /**
+ the CSS class for the file remove button. Defaults to btn btn-default.
+ */
+ removeClass?: string;
+ /**
+ the title to display on hover for the file remove button. Defaults to Clear selected files.
+ */
+ removeTitle?: string;
+ /**
+ the label to display for the file upload button. Defaults to Upload.
+ */
+ uploadLabel?: string;
+ /**
+ the icon to display before the label for the file upload button. Defaults to .
+ */
+ uploadIcon?: string;
+ /**
+ the CSS class for the file upload button. Defaults to btn btn-default.
+ */
+ uploadClass?: string;
+ /**
+ the title to display on hover for the file remove button.
+ Defaults to Upload selected files.
+ */
+ uploadTitle?: string;
+ /**
+ the URL for the upload processing action (typically for ajax based processing).
+ Defaults to null.
+ If this is not set or null, then the upload button action will default to form submission.
+ NOTE:
+ This is MANDATORY if you want to use advanced features like drag & drop, append/remove files, selectively upload files via ajax etc.
+ The plugin automatically send $_FILES data to the server with the input `name` attribute as the key if provided.
+ If input name is not set, the key defaults to file-data.
+ */
+ uploadUrl?: string;
+ /**
+ whether the batch upload of multiple files will be asynchronous/in parallel.
+ Defaults to true.
+ */
+ uploadAsync?: boolean;
+ /**
+ the extra data that will be passed as data to the url/AJAX server call via POST.
+ This property is only applicable for ajax uploads and when you have set a value for uploadUrl.
+ This can be setup either as an object (associative array of keys and values) or as a function callback.
+ As an object, it can be set for example as:
+ { id: 100, value: '100 Details' }
+ Note that for uploading individual file via thumbnail, the function callback can also receive the thumbnail previewId and index as parameters. These are described below:
+ previewId: the identifier for the preview file container (only available when uploading each thumbnail file)
+ index: the zero-based sequential index of the loaded file in the preview list (only available when uploading each thumbnail file)
+ */
+ uploadExtraData?: {} | ((previewId?: string, index?: number) => {});
+ /**
+ the minimum allowed image height in px if you are uploading image files.
+ Defaults to null which means no limit on image height.
+ */
+ minImageHeight?: number;
+ /**
+ the maximum allowed image width in px if you are uploading image files.
+ Defaults to null which means no limit on image width.
+ Note that if you set resizeImage property to true, then the entire image will be resized within this width (depending on resizePreference).
+ */
+ maxImageWidth?: number;
+ /**
+ the maximum allowed image height in px if you are uploading image files.
+ Defaults to null which means no limit on image height.
+ Note that if you set resizeImage property to true, then the entire image will be resized within this height (depending on resizePreference).
+ */
+ maxImageHeight?: number;
+ /**
+ whether to add ability to resize uploaded images. Defaults to false.
+ Note that resizing images requires HTML5 canvas support which is supported on most modern browsers.
+ In addition, you must include the JavaScript-Canvas-to-Blob plugin by blueimp by including canvas-to-blob.js in your application.
+ This JS file must be loaded before fileinput.js on the page.
+ The JavaScript-Canvas-to-Blob source files are available in js/plugins folder of bootstrap-fileinput project page.
+ The canvas-to-blob.js plugin is a polyfill for canvas.toBlob method and is needed for allowing the resized image files via HTML5 canvas to be returned as a blob
+ */
+ resizeImage?: boolean;
+ /**
+ preference to resize the image based on width or height.
+ Defaults to width.
+ This property is parsed only when resizeImage is true.
+ If set to width, the maxImageWidth property is first tested and if image size is greater than this, then the image is resized to maxImageWidth.
+ The image height is resized and adjusted in the same ratio as width.
+ In case, the image width is already less than maxImageWidth then the maxImageHeight property is used to resize and width is adjusted in same ratio.
+ This will behave conversely, when resizePreference is set to height - the maxImageHeight will be first tested against image height and then the rest of steps will be similarly parsed with preference given to height instead of width as before.
+ */
+ resizePreference?: "width" | "height";
+ /**
+ the quality of the resized image. This must be a decimal number between 0.00 to 1.00.
+ Defaults to 0.92.
+ */
+ resizeImageQuality?: number;
+ /**
+ the default image mime type of the converted image after resize.
+ Defaults to image/jpeg.
+ */
+ resizeDefaultImageType?: string;
+ /**
+ the maximum file size for upload in KB.
+ If set to 0, it means size allowed is unlimited.
+ Defaults to 0.
+ */
+ maxFileSize?: number;
+ /**
+ the minimum number of files allowed for each multiple upload.
+ If set to 0, it means number of files are optional.
+ Defaults to 0.
+ */
+ minFileCount?: number;
+ /**
+ the maximum number of files allowed for each multiple upload.
+ If set to 0, it means number of files allowed is unlimited.
+ Defaults to 0.
+ */
+ maxFileCount?: number;
+ /**
+ whether to include initial preview file count (server uploaded files) in validating minFileCount and maxFileCount.
+ Defaults to false.
+ */
+ validateInitialCount?: boolean;
+ /**
+ the message that will be displayed when ZERO files are found.
+ Defaults to No.
+ */
+ msgNo?: string;
+ /**
+ the message that will be displayed within the progress bar when file upload is aborted or cancelled.
+ Defaults to Cancelled.
+ */
+ msgCancelled?: string;
+ /**
+ the title displayed (before the file name) on hover of the zoom button for zooming the file content in a modal window.
+ This is currently applicable only for text file previews.
+ Defaults to View details.
+ */
+ msgZoomTitle?: string;
+ /**
+ the heading of the modal dialog that displays the zoomed file content.
+ This is currently applicable only for text file previews.
+ Defaults to Detailed Preview.
+ */
+ msgZoomModalHeading?: string;
+ /**
+ the message to be displayed when the file size exceeds maximum size.
+ Defaults to:
+ File "{name}" ({size} KB) exceeds maximum allowed upload size of {maxSize} KB. Please retry your upload!
+ where:
+ {name}: will be replaced by the file name being uploaded
+ {size}: will be replaced by the uploaded file size
+ {maxSize}: will be replaced by the maxFileSize parameter.
+ */
+ msgSizeTooLarge?: string;
+ /**
+ message to be displayed when the file count is less than the minimum count as set in minFileCount.
+ Defaults to:
+ You must select at least {n} {files} to upload. Please retry your upload!
+ where:
+ {n}: will be replaced by the allowed minimum files as set in minFileCount.
+ {files}: will be replaced with fileSingle or filePlural properties in locale file depending on the minFileCount.
+ */
+ msgFilesTooLess?: string;
+ /**
+ the message to be displayed when the file count exceeds maximum count as set in maxFileCount.
+ Defaults to:
+ Number of files selected for upload ({n}) exceeds maximum allowed limit of {m}. Please retry your upload!
+ where:
+ {n}: will be replaced by number of files selected for upload
+ {m}: will be replaced by the allowed maximum files as set in maxFileCount
+ */
+ msgFilesTooMany?: string;
+ /**
+ the exception message to be displayed when the file selected is not found by the FileReader.
+ Defaults to:
+ File "{name}" not found!
+ where:
+ {name}: will be replaced by the file name being uploaded
+ */
+ msgFileNotFound?: string;
+ /**
+ the exception message to be displayed when the file selected is not allowed to be accessed due to a security exception.
+ Defaults to:
+ Security restrictions prevent reading the file "{name}".
+ where:
+ {name}: will be replaced by the file name being uploaded
+ */
+ msgFileSecured?: string;
+ /**
+ the exception message to be displayed when the file selected is not readable by the FileReader API.
+ Defaults to:
+ File "{name}" is not readable.
+ where:
+ {name}: will be replaced by the file name being uploaded
+ */
+ msgFileNotReadable?: string;
+ /**
+ the exception message to be displayed when the file preview upload is aborted.
+ Defaults to:
+ File preview aborted for "{name}".
+ where:
+ {name}: will be replaced by the file name being uploaded
+ */
+ msgFilePreviewAborted?: string;
+ /**
+ the exception message to be displayed for any other error when previewing the file.
+ Defaults to:
+ An error occurred while reading the file "{name}".
+ where:
+ {name}: will be replaced by the file name being uploaded
+ */
+ msgFilePreviewError?: string;
+ /**
+ the message to be displayed when the file type is not in one of the file types set in allowedFileTypes.
+ Defaults to:
+ Invalid type for file "{name}". Only "{types}" files are supported.
+ where:
+ {name}: will be replaced by the file name being uploaded
+ {types}: will be replaced by the comma separated list of types defined in allowedFileTypes.
+ */
+ msgInvalidFileType?: string;
+ /**
+ the message to be displayed when the file type is not in one of the file extensions set in allowedFileExtensions.
+ Defaults to:
+ Invalid extension for file "{name}". Only "{extensions}" files are supported.
+ where:
+ {name}: will be replaced by the file name being uploaded
+ {extensions}: will be replaced by the comma separated list of extensions defined in allowedFileExtensions.
+ */
+ msgInvalidFileExtension?: string;
+ /**
+ the message to be displayed when an ongoing ajax file upload is aborted by pressing the Cancel button.
+ Defaults to The file upload was aborted.
+ If this is set to null or empty, the internal ajax error message will be displayed - Defaults to File Upload Error.
+ */
+ msgUploadAborted?: string;
+ /**
+ the exception message to be displayed within the caption container (instead of msgFilesSelected), when a validation error is encountered.
+ Defaults to File Upload Error.
+ */
+ msgValidationError?: string;
+ /**
+ the css class for the validation error message displayed in the caption container.
+ Defaults to text-danger.
+ */
+ msgValidationErrorClass?: string;
+ /**
+ the icon to be displayed before the validation error in the caption container.
+ Defaults to
+ */
+ msgValidationErrorIcon?: string;
+ /**
+ the css class for the error message to be displayed in the preview window when the file size exceeds maxSize.
+ Defaults to file-error-message.
+ */
+ msgErrorClass?: string;
+ /**
+ the message displayed when the files are getting read and loaded for preview.
+ Defaults to
+ Loading file {index} of {files} …
+ The following special variables will be replaced:
+ {index}: the sequence number of the current file being loaded.
+ {files}: the total number of files selected for upload.
+ */
+ msgLoading?: string;
+ /**
+ the progress message displayed as each file is loaded for preview.
+ Defaults to:
+ Loading file {index} of {files} - {name} - {percent}% completed.
+ The following variables will be replaced:
+ {index}: the sequence number of the current file being loaded.
+ {files}: the total number of files selected for upload.
+ {percent}: the percentage of file read and loaded.
+ {name}: the name of the current file being loaded.
+ */
+ msgProgress?: string;
+ /**
+ the progress message displayed in caption window when multiple (more than one) files are selected.
+ Defaults to:
+ {n} files selected.
+ The following variables will be replaced:
+ {n}: the number of files selected.
+ */
+ msgSelected?: string;
+ /**
+ the message displayed when a folder has been dragged to the drop zone.
+ Defaults to:
+ Drag & drop files only! {n} folder(s) dropped were skipped.
+ The following variables will be replaced:
+ {n}: the number of folders dropped.
+ */
+ msgFoldersNotAllowed?: string;
+ /**
+ the exception message to be displayed when the file selected for preview is an image and its width is less than the minImageWidth setting.
+ Defaults to:
+ Width of image file "{name}" must be at least {size} px.
+ where:
+ {name}: will be replaced by the file name being uploaded.
+ {size}: will be replaced by the minImageWidth setting.
+ */
+ msgImageWidthSmall?: string;
+ /**
+ the exception message to be displayed when the file selected for preview is an image and its height is less than the minImageHeight setting.
+ Defaults to:
+ Height of image file "{name}" must be at least {size} px.
+ where:
+ {name}: will be replaced by the file name being uploaded.
+ {size}: will be replaced by the minImageHeight setting.
+ */
+ msgImageHeightSmall?: string;
+ /**
+ the exception message to be displayed when the file selected for preview is an image and its width exceeds the maxImageWidth setting.
+ Defaults to:
+ Width of image file "{name}" cannot exceed {size} px.
+ where:
+ {name}: will be replaced by the file name being uploaded.
+ {size}: will be replaced by the maxImageWidth setting.
+ */
+ msgImageWidthLarge?: string;
+ /**
+ the exception message to be displayed when the file selected for preview is an image and its height exceeds the maxImageHeight setting.
+ Defaults to:
+ Height of image file "{name}" cannot exceed {size} px.
+ where:
+ {name}: will be replaced by the file name being uploaded.
+ {size}: will be replaced by the maxImageHeight setting.
+ */
+ msgImageHeightLarge?: string;
+ /**
+ the upload progress bar CSS class to be applied when AJAX upload is in process (applicable only for ajax uploads).
+ Defaults to progress-bar progress-bar-success progress-bar-striped active.
+ */
+ progressClass?: string;
+ /**
+ the upload progress bar CSS class to be applied when AJAX upload is in process (applicable only for ajax uploads).
+ Defaults to progress-bar progress-bar-success progress-bar-striped active.
+ */
+ progressCompleteClass?: string;
+ /**
+ the upload progress bar CSS class to be applied when AJAX upload is cancelled or aborted.
+ Defaults to progress-bar progress-bar-danger.
+ */
+ progressErrorClass?: string;
+ /**
+ the type of files that are to be displayed in the preview window.
+ Defaults to image.
+ Can be one of the following:
+ image: Only image type files will be shown in preview.
+ text: Only text type files will be shown in preview.
+ any: Both image and text files content will be shown in preview.
+ Files other than image or text will be displayed as a thumbnail with the filename in the preview window.
+ */
+ previewFileType?: "image" | "text" | "any";
+ /**
+ the icon for zooming the file content in a new modal dialog.
+ This is currently applicable only for text file previews.
+ Defaults to
+ */
+ zoomIndicator?: string;
+ /**
+ the identifier for the container element displaying the error (e.g. '#id').
+ If not set, will default to the container with CSS class kv-fileinput-error inside the preview container (identified by elPreviewContainer).
+ The msgErrorClass will be automatically appended to this container before displaying the error.
+ */
+ elErrorContainer?: string;
+ /**
+ the identifier for the container element containing the caption (e.g. '#id').
+ If not set, will default to the container with CSS class file-caption inside the main plugin container.
+ */
+ elCaptionContainer?: string;
+ /**
+ the identifier for the container element containing the caption text (e.g. '#id').
+ If not set, will default to the container with CSS class file-caption-name inside the main plugin container.
+ */
+ elCaptionText?: string;
+ /**
+ the identifier for the container element containing the preview (e.g. '#id').
+ If not set, will default to the container with CSS class file-preview inside the main plugin container.
+ */
+ elPreviewContainer?: string;
+ /**
+ the identifier for the element containing the preview image thumbnails (e.g. '#id').
+ If not set, will default to the container with CSS class file-preview-thumbnails inside the main plugin container.
+ */
+ elPreviewImage?: string;
+ /**
+ the identifier for the element containing the preview progress status (e.g. '#id').
+ If not set, will default to the container with CSS class file-preview-status inside the main plugin container.
+ */
+ elPreviewStatus?: string;
+ /**
+ a callback to convert the filename as a slug string eliminating special characters.
+ If not set, it will use the plugin's own internal slugDefault method.
+ This callback function includes the filename as parameter and must return a converted filename string.
+ */
+ slugCallback?: (filename: string) => string;
+ /**
+ whether to enable a drag and drop zone for dragging and dropping files to.
+ This is available only for ajax based uploads.
+ Defaults to true.
+ */
+ dropZoneEnabled?: boolean;
+ /**
+ title to be displayed in the drag and drop zone.
+ This is available only for ajax based uploads.
+ Defaults to:
+ Drag & drop files here ….
+ */
+ dropZoneTitle?: string;
+ /**
+ CSS class for the drag & drop zone title.
+ Defaults to file-drop-zone-title.
+ */
+ dropZoneTitleClass?: string;
+ /**
+ configuration for setting up file actions for newly selected file thumbnails in the preview window.
+ */
+ fileActionsettings?: FileActionSettings;
+ /**
+ markup for additional action buttons to display within the initial preview thumbnails (for example displaying an image edit button).
+ The following tag can be used in the markup and will be automatically replaced:
+ {dataKey}: Will be replaced with the key set within initialPreviewConfig.
+ */
+ otherActionButtons?: string;
+ /**
+ the encoding to be used while reading a text file.
+ Applicable only for previewing text files.
+ Defaults to UTF-8.
+ */
+ textEncoding?: string;
+ /**
+ additional ajax settings to pass to the plugin before submitting the ajax request for upload.
+ Applicable only for ajax uploads.
+ This can be useful to pass additional tokens to headers or one can use it for setting other ajax options for advanced cases.
+ Refer the jQuery ajax documentation for the various settings you can configure.
+ */
+ ajaxSettings?: JQueryAjaxSettings;
+ /**
+ additional ajax settings to pass to the plugin before submitting the delete ajax request in each initial preview thumbnail.
+ Applicable only for ajax uploads.
+ This can be useful to pass additional tokens to headers or one can use it for setting other ajax options for advanced cases.
+ Refer the jQuery ajax documentation for the various settings you can configure.
+ */
+ ajaxDeleteSettings?: JQueryAjaxSettings;
+ /**
+ whether to show details of the error stack from the server log when an error is encountered via ajax response.
+ Defaults to true.
+ */
+ showAjaxErrorDetails?: boolean;
+ }
+
+ interface PreviewConfig {
+ /**
+ the caption or filename to display for each initial preview item content.
+ */
+ caption: string;
+ /**
+ the CSS width of the image/ content displayed.
+ */
+ width: string;
+ /**
+ the URL for deleting the image/ content in the initial preview via AJAX post response.This will default to deleteUrl if not set.
+ */
+ url: string;
+ /**
+ the key that will be passed as data to the url via AJAX POST.
+ */
+ key: string | {};
+ /**
+ the additional frame css class to set for the file's thumbnail frame.
+ */
+ frameClass: string;
+ /**
+ the HTML attribute settings (set as key:value pairs) for the thumbnail frame.
+ */
+ frameAttr: {};
+ /**
+ the extra data that will be passed as data to the initial preview delete url / AJAX server call via POST.This will default to deleteExtraData if not set.
+ */
+ extra: {} | Function;
+ }
+
+ interface LayoutTemplates {
+ /**
+ the template for rendering the widget with caption.
+ The following tags will be parsed and replaced automatically:
+ {class}: the CSS class as set in the mainClass property.
+ {close}: will be replaced with the close (cross) icon (by default on top right of the preview window). The layout template to control this markup is layoutTemplates.close.
+ {preview}: the content parsed by the previewTemplate and will be displayed only if showPreview is true.
+ {caption}: the content parsed by the captionTemplate and will be displayed only if showCaption is true.
+ {remove}: the file remove/clear button and will be displayed only if showRemove is true.
+ {upload}: the file upload button and will be displayed only if showUpload is true.
+ {cancel}: the file upload cancel button that will be displayed when AJAX upload is in process to abort the AJAX upload.
+ {browse}: the main file browse button to select your files for input.
+ */
+ main1?: string;
+ /**
+ the template for rendering the widget without caption.
+ The following tags will be parsed and replaced automatically:
+ {class}: the CSS class as set in the mainClass property.
+ {close}: will be replaced with the close (cross) icon (by default on top right of the preview window). The layout template to control this markup is layoutTemplates.close.
+ {preview}: the content parsed by the previewTemplate and will be displayed only if showPreview is true.
+ {caption}: the content parsed by the captionTemplate and will be displayed only if showCaption is true.
+ {remove}: the file remove/clear button and will be displayed only if showRemove is true.
+ {upload}: the file upload button and will be displayed only if showUpload is true.
+ {cancel}: the file upload cancel button that will be displayed when AJAX upload is in process to abort the AJAX upload.
+ {browse}: the main file browse button to select your files for input.
+ */
+ main2?: string;
+ /**
+ the template for rendering the preview.
+ The following tags will be parsed and replaced automatically:
+ {class}: the CSS class as set in the previewClass property.
+ */
+ preview?: string;
+ /**
+ the icon to render before the caption text.
+ */
+ icon?: string;
+ /**
+ the template for rendering the caption.
+ The following tags will be parsed and replaced automatically:
+ {class}: the CSS class as set in the captionClass property.
+ */
+ caption?: string;
+ /**
+ the template for rendering the modal (for text file preview zooming).
+ */
+ modal?: string;
+ /**
+ the template for the progress bar when upload is in progress (for batch/mass uploads and within each preview thumbnail for async/single uploads).
+ The upload progress bar when displayed within each thumbnail will be wrapped inside a container having a CSS class of `file-thumb-progress`.
+ The following tags will be parsed and replaced automatically:
+ {percent}: will be replaced with the upload progress percentage.
+ */
+ progress?: string;
+ /**
+ the template for the footer section of each file preview thumbnail.
+ The following tags will be parsed and replaced automatically:
+ {actions}: will be replaced with the output of the actions template.
+ {class}: the CSS class as set in the progressClass or progressCompleteClass property (depending on the progress percentage).
+ */
+ footer?: string;
+ /**
+ the template for the file action buttons to be displayed within the thumbnail footer.
+ The following tags will be parsed and replaced automatically:
+ {upload}: will be replaced with the output of the actionUpload template.
+ {delete}: will be replaced with the output of the actionDelete template.
+ */
+ actions?: string;
+ /**
+ the template for the file delete action button within the thumbnail footer.
+ The following tags will be parsed and replaced automatically:
+ {removeClass}: the css class for the remove button. Will be replaced with the removeClass set within fileActionSettings.
+ {removeIcon}: the icon for the remove button. Will be replaced with the removeIcon set within fileActionSettings.
+ {removeTitle}: the title to display on hover for the remove button. Will be replaced with the removeTitle set within fileActionSettings.
+ {dataUrl}: the URL for deleting the file thumbnail for initialPreview content only. Will be replaced with the url set within initialPreviewConfig.
+ {dataKey}: the key (additional data) that will be passed to the URL above via POST to the AJAX call. Will be replaced with the key set within initialPreviewConfig.
+ */
+ actionDelete?: string;
+ /**
+ the template for the file upload action button within the thumbnail footer.
+ The following tags will be parsed and replaced automatically:
+ {uploadClass}: the css class for the upload button. Will be replaced with the uploadClass set within fileActionSettings.
+ {uploadIcon}: the icon for the upload button. Will be replaced with the uploadIcon set within fileActionSettings.
+ {uploadTitle}: the title to display on hover for the upload button. Will be replaced with the uploadTitle set within fileActionSettings.
+ */
+ actionUpload?: string;
+ /**
+ The template for upload, remove, and cancel buttons.
+ The following tags will be parsed and replaced automatically:
+ {type}: the HTML button type, defaults to button for most buttons and submit for form based uploads.
+ {title}: the title to display on button hover.
+ {css}: the CSS class for the button. This is derived from settings for uploadClass or removeClass or cancelClass.
+ {status}: the disabled status for the button if available (else will be blank).
+ {icon}: the button icon as identified by uploadIcon or removeIcon or cancelIcon.
+ {label}: the button label as identified by uploadLabel or removeLabel or cancelLabel.
+ */
+ btnDefault?: string;
+ /**
+ The template for upload button when used with ajax (i.e. when uploadUrl is set).
+ The following tags will be parsed and replaced automatically:
+ {type}: the HTML button type, defaults to button for most buttons and submit for form based uploads.
+ {title}: the title to display on button hover.
+ {css}: the CSS class for the button. This is derived from settings for uploadClass.
+ {status}: the disabled status for the button if available (else will be blank).
+ {icon}: the button icon as identified by uploadIcon.
+ {label}: the button label as identified by uploadLabel.
+ {href}: applicable only for Upload button for ajax uploads and will be replaced with the uploadUrl property.
+ */
+ btnLink?: string;
+ /**
+ The template for the browse button.
+ {type}: the HTML button type, defaults to button for most buttons and submit for form based uploads.
+ {title}: the title to display on button hover.
+ {css}: the CSS class for the button. This is derived from settings for browseClass.
+ {status}: the disabled status for the button if available (else will be blank).
+ {icon}: the button icon as identified by browseIcon.
+ {label}: the button label as identified by browseLabel.
+ */
+ btnBrowse?: string;
+ }
+
+ interface PreviewTemplates {
+ /**
+ the preview template for image files.
+ The following tags will be parsed and replaced automatically:
+ {previewId}: will be replaced with the generated identifier for the preview frame container.
+ {data}: will be replaced with the data source for each preview type.
+ {width}: will be replaced with the width for the file type as set in previewSettings.
+ {height}: will be replaced with the height for the file type as set in previewSettings.
+ {caption}: will be replaced with the file name.
+ {type}: will be replaced with the file type.
+ */
+ image?: string;
+ /**
+ the preview template for text files.
+ The following tags will be parsed and replaced automatically:
+ {previewId}: will be replaced with the generated identifier for the preview frame container.
+ {data}: will be replaced with the data source for each preview type.
+ {width}: will be replaced with the width for the file type as set in previewSettings.
+ {height}: will be replaced with the height for the file type as set in previewSettings.
+ {caption}: will be replaced with the file name.
+ {type}: will be replaced with the file type.
+ {dialog}: Will be replaced with the JS code to launch the modal dialog.
+ {zoomTitle}: This will be replaced with the msgZoomTitle property. This is the title that is displayed on hover of the zoom button (which on clicking will display the text file).
+ {zoomInd}: This will be replaced with the zoomIndicator property. This is the title that is displayed on hover of the zoom button (which on clicking will display the text file).
+ {heading}: This represents the modal dialog heading title. This will be replaced with the msgZoomModalHeading property.
+ */
+ text?: string;
+ /**
+ the preview template for html files.
+ The following tags will be parsed and replaced automatically:
+ {previewId}: will be replaced with the generated identifier for the preview frame container.
+ {data}: will be replaced with the data source for each preview type.
+ {width}: will be replaced with the width for the file type as set in previewSettings.
+ {height}: will be replaced with the height for the file type as set in previewSettings.
+ {caption}: will be replaced with the file name.
+ {type}: will be replaced with the file type.
+ */
+ html?: string;
+ /**
+ the preview template for video files (supported by HTML 5 video tag).
+ The following tags will be parsed and replaced automatically:
+ {previewId}: will be replaced with the generated identifier for the preview frame container.
+ {data}: will be replaced with the data source for each preview type.
+ {width}: will be replaced with the width for the file type as set in previewSettings.
+ {height}: will be replaced with the height for the file type as set in previewSettings.
+ {caption}: will be replaced with the file name.
+ {type}: will be replaced with the file type.
+ */
+ video?: string;
+ /**
+ the preview template for audio files (supported by HTML 5 audio tag).
+ The following tags will be parsed and replaced automatically:
+ {previewId}: will be replaced with the generated identifier for the preview frame container.
+ {data}: will be replaced with the data source for each preview type.
+ {width}: will be replaced with the width for the file type as set in previewSettings.
+ {height}: will be replaced with the height for the file type as set in previewSettings.
+ {caption}: will be replaced with the file name.
+ {type}: will be replaced with the file type.
+ */
+ audio?: string;
+ /**
+ the preview template for flash files (supported currently on webkit browsers).
+ The following tags will be parsed and replaced automatically:
+ {previewId}: will be replaced with the generated identifier for the preview frame container.
+ {data}: will be replaced with the data source for each preview type.
+ {width}: will be replaced with the width for the file type as set in previewSettings.
+ {height}: will be replaced with the height for the file type as set in previewSettings.
+ {caption}: will be replaced with the file name.
+ {type}: will be replaced with the file type.
+ */
+ flash?: string;
+ /**
+ the preview template for all other files - by default treated as object. To disable this behavior, configure the allowedPreviewTypes property.
+ The following tags will be parsed and replaced automatically:
+ {previewId}: will be replaced with the generated identifier for the preview frame container.
+ {data}: will be replaced with the data source for each preview type.
+ {width}: will be replaced with the width for the file type as set in previewSettings.
+ {height}: will be replaced with the height for the file type as set in previewSettings.
+ {caption}: will be replaced with the file name.
+ {type}: will be replaced with the file type.
+ */
+ object?: string;
+ /**
+ this template is used ONLY for rendering the initialPreview markup content passed directly as a raw format.
+ The following tags will be parsed and replaced automatically:
+ {content}: will be replaced with the raw HTML markup as set in initialPreview..
+ */
+ generic?: string;
+ }
+
+ interface PreviewSettings {
+ image?: { width?: string; height?: string; };
+ html?: { width?: string; height?: string; };
+ text?: { width?: string; height?: string; };
+ video?: { width?: string; height?: string; };
+ audio?: { width?: string; height?: string; };
+ flash?: { width?: string; height?: string; };
+ object?: { width?: string; height?: string; };
+ other?: { width?: string; height?: string; };
+ }
+
+ interface FileTypeSettings {
+ image: (vType: string, vName: string) => boolean;
+ html: (vType: string, vName: string) => boolean;
+ text: (vType: string, vName: string) => boolean;
+ video: (vType: string, vName: string) => boolean;
+ audio: (vType: string, vName: string) => boolean;
+ flash: (vType: string, vName: string) => boolean;
+ object: (vType: string, vName: string) => boolean;
+ other: (vType: string, vName: string) => boolean;
+ }
+
+ interface PreviewFileIconSettings {
+ [key: string]: string;
+ }
+
+ interface PreviewFileExtSettings {
+ [key: string]: (ext: string) => boolean;
+ }
+
+ interface FileActionSettings {
+ /**
+ icon for remove button to be displayed in each file thumbnail.
+ */
+ removeIcon: string;
+ /**
+ CSS class for the remove button in each file thumbnail.
+ */
+ removeClass: string;
+ /**
+ title for remove button in each file thumbnail.
+ */
+ removeTitle: string;
+ /**
+ icon for upload button to be displayed in each file thumbnail.
+ */
+ uploadIcon: string;
+ /**
+ CSS class for the remove button in each file thumbnail.
+ */
+ uploadClass: string;
+ /**
+ title for remove button in each file thumbnail.
+ */
+ uploadTitle: string;
+ /**
+ an indicator (HTML markup) for new pending upload displayed in each file thumbnail.
+ */
+ indicatorNew: string;
+ /**
+ an indicator (HTML markup) for successful upload displayed in each file thumbnail.
+ */
+ indicatorSuccess: string;
+ /**
+ an indicator (HTML markup) for error in upload displayed in each file thumbnail.
+ */
+ indicatorError: string;
+ /**
+ an indicator (HTML markup) for ongoing upload displayed in each file thumbnail.
+ */
+ indicatorLoading: string;
+ /**
+ title to display on hover of indicator for new pending upload in each file thumbnail.
+ */
+ indicatorNewTitle: string;
+ /**
+ title to display on hover of indicator for successful in each file thumbnail.
+ */
+ indicatorSuccessTitle: string;
+ /**
+ title to display on hover of indicator for error in upload in each file thumbnail.
+ */
+ indicatorErrorTitle: string;
+ /**
+ title to display on hover of indicator for ongoing upload in each file thumbnail.
+ */
+ indicatorLoadingTitle: string;
+ }
+}
\ No newline at end of file
diff --git a/bootstrap.datepicker/bootstrap.datepicker.d.ts b/bootstrap.datepicker/bootstrap.datepicker.d.ts
index 686cc6b423..f60a0ffed6 100644
--- a/bootstrap.datepicker/bootstrap.datepicker.d.ts
+++ b/bootstrap.datepicker/bootstrap.datepicker.d.ts
@@ -15,7 +15,7 @@
* http://bootstrap-datepicker.readthedocs.org/en/release/options.html
*/
interface DatepickerOptions {
- format?: string;
+ format?: string | DatepickerCustomFormatOptions;
weekStart?: number;
startDate?: any;
endDate?: any;
@@ -38,6 +38,11 @@ interface DatepickerOptions {
assumeNearbyYear?: any;
}
+interface DatepickerCustomFormatOptions {
+ toDisplay?(date: string, format: any, language: any): string;
+ toValue?(date: string, format: any, language: any): Date;
+}
+
interface DatepickerEventObject extends JQueryEventObject {
date: Date;
format(format?: string): string;
diff --git a/bootstrap/bootstrap-tests.ts b/bootstrap/bootstrap-tests.ts
index c497e0abcd..f7cfdeab43 100644
--- a/bootstrap/bootstrap-tests.ts
+++ b/bootstrap/bootstrap-tests.ts
@@ -44,3 +44,8 @@ $('.typeahead').typeahead({
});
$('#navbar').affix();
+
+$('.item').emulateTransitionEnd(2000);
+
+$.support.transition = false;
+console.log(($.support.transition as TransitionEventNames).end === "transitionend");
diff --git a/bootstrap/bootstrap.d.ts b/bootstrap/bootstrap.d.ts
index b0e8fbf858..ae84454332 100644
--- a/bootstrap/bootstrap.d.ts
+++ b/bootstrap/bootstrap.d.ts
@@ -53,7 +53,7 @@ interface PopoverOptions {
}
interface CollapseOptions {
- parent?: any;
+ parent?: any;
toggle?: boolean;
}
@@ -79,6 +79,10 @@ interface AffixOptions {
target?: any;
}
+interface TransitionEventNames {
+ end: string;
+}
+
interface JQuery {
modal(options?: ModalOptions): JQuery;
modal(options?: ModalOptionsBackdropString): JQuery;
@@ -114,6 +118,12 @@ interface JQuery {
typeahead(options?: TypeaheadOptions): JQuery;
affix(options?: AffixOptions): JQuery;
+
+ emulateTransitionEnd(duration: number): JQuery;
+}
+
+interface JQuerySupport {
+ transition: boolean | TransitionEventNames;
}
declare module "bootstrap" {
diff --git a/browser-pack/browser-pack-tests.ts b/browser-pack/browser-pack-tests.ts
new file mode 100644
index 0000000000..4cf20249e8
--- /dev/null
+++ b/browser-pack/browser-pack-tests.ts
@@ -0,0 +1,33 @@
+///
+
+import browserPack = require("browser-pack");
+
+module BrowserPackTest {
+
+ export function packIt(opts?: BrowserPack.Options) {
+ var packOpts: BrowserPack.Options = {
+ basedir: opts.basedir || "./",
+ externalRequireName: opts.externalRequireName || "require",
+ hasExports: opts.hasExports || false,
+ prelude: opts.prelude || undefined,
+ preludePath: opts.preludePath || undefined,
+ raw: opts.raw || false,
+ sourceMapPrefix: opts.sourceMapPrefix || '//#',
+ standalone: opts.standalone || undefined,
+ standaloneModule: opts.standaloneModule || undefined,
+ };
+
+ var res = browserPack(); // 'opts' are optional
+ var res2 = browserPack(packOpts);
+
+ // ensure return value is a stream
+ var res3 = res.pipe(res2);
+
+ res.on("error", function (err: any) {
+ console.error("browser-pack error: ", err);
+ });
+ }
+
+}
+
+export = BrowserPackTest;
\ No newline at end of file
diff --git a/browser-pack/browser-pack.d.ts b/browser-pack/browser-pack.d.ts
new file mode 100644
index 0000000000..52b96ce134
--- /dev/null
+++ b/browser-pack/browser-pack.d.ts
@@ -0,0 +1,61 @@
+// Type definitions for browser-pack v6.0.1
+// Project: https://github.com/substack/browser-pack
+// Definitions by: TeamworkGuy2
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+///
+
+/** pack node-style source files from a json stream into a browser bundle
+ */
+declare module BrowserPack {
+
+ export interface Options {
+ /** Whether the bundle should include require= (or the opts.externalRequireName) so that
+ * require() is available outside the bundle
+ */
+ hasExports?: boolean;
+
+ /** A string to use in place of 'require' if opts.hasExports is specified, default is 'require'
+ */
+ externalRequireName?: string;
+
+ /** Specify a custom prelude, but know what you're doing first. See the prelude.js file in
+ * this repo for the default prelude. If you specify a custom prelude, you must also specify
+ * a valid opts.preludePath to the prelude source file for sourcemaps to work
+ */
+ prelude?: string;
+
+ /** prelude.js path if a custom opts.prelude is specified
+ */
+ preludePath?: string;
+
+ /** Used if opts.preludePath is undefined, this is used to resolve the prelude.js file location, default: 'process.cwd()'
+ */
+ basedir?: string;
+
+ /** if given, the writable end of the stream will expect objects to be written to
+ * it instead of expecting a stream of json text it will need to parse, default false
+ */
+ raw?: boolean;
+
+ /** External string name to use for UMD, if not provided, UMD declaration is not wrapped around output
+ */
+ standalone?: string;
+
+ /** Sets the internal module name to export for standalone
+ */
+ standaloneModule?: string;
+
+ /** If given and source maps are computed, the opts.sourceMapPrefix string will be used instead of default: '//#'
+ */
+ sourceMapPrefix?: string;
+ }
+
+}
+
+declare module "browser-pack" {
+ /** pack node-style source files from a json stream into a browser bundle
+ */
+ function browserPack(opts?: BrowserPack.Options): NodeJS.ReadWriteStream;
+ export = browserPack;
+}
\ No newline at end of file
diff --git a/browser-resolve/browser-resolve-tests.ts b/browser-resolve/browser-resolve-tests.ts
new file mode 100644
index 0000000000..071b17a1d2
--- /dev/null
+++ b/browser-resolve/browser-resolve-tests.ts
@@ -0,0 +1,39 @@
+///
+
+import * as browserResolve from 'browser-resolve';
+
+function basic_test_async(callback: (err?: Error, resolved?: string) => void) {
+ browserResolve('typescript', function(error, resolved) {
+ if (error) {
+ return callback(error);
+ }
+ callback(null, resolved);
+ });
+}
+
+function basic_test_sync() {
+ var resolved = browserResolve.sync('typescript');
+}
+
+function options_test_async() {
+ browserResolve('typescript', {
+ browser: 'jsnext:main',
+ filename: './browser-resolve/browser-resolve.js',
+ modules: {
+ fs: './fs-shim.js'
+ }
+ }, function(error, resolved) {
+ if (error) {
+ console.error(error);
+ return;
+ }
+ console.log(resolved);
+ });
+}
+
+function options_test_sync() {
+ var resolved = browserResolve.sync('typescript', {
+ filename: './browser-resolve/browser-resolve.js',
+ modules: {}
+ });
+}
diff --git a/browser-resolve/browser-resolve.d.ts b/browser-resolve/browser-resolve.d.ts
new file mode 100644
index 0000000000..8c1456c8f0
--- /dev/null
+++ b/browser-resolve/browser-resolve.d.ts
@@ -0,0 +1,61 @@
+// Type definitions for browser-resolve
+// Project: https://github.com/defunctzombie/node-browser-resolve
+// Definitions by: Mario Nebl
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+///
+
+declare module 'browser-resolve' {
+ import * as resolve from 'resolve';
+
+ /**
+ * Callback invoked when resolving asynchronously
+ *
+ * @param error
+ * @param resolved Absolute path to resolved identifier
+ */
+ type resolveCallback = (err?: Error, resolved?: string) => void;
+
+ /**
+ * Resolve a module path and call cb(err, path [, pkg])
+ *
+ * @param id Identifier to resolve
+ * @param callback
+ */
+ function browserResolve(id: string, cb: resolveCallback): void;
+
+ /**
+ * Resolve a module path and call cb(err, path [, pkg])
+ *
+ * @param id Identifier to resolve
+ * @param options Options to use for resolving, optional.
+ * @param callback
+ */
+ function browserResolve(id: string, opts: browserResolve.AsyncOpts, cb: resolveCallback): void;
+
+ /**
+ * Returns a module path
+ *
+ * @param id Identifier to resolve
+ * @param options Options to use for resolving, optional.
+ */
+ function browserResolveSync(id: string, opts?: browserResolve.SyncOpts): string;
+
+ namespace browserResolve {
+ interface Opts {
+ // the 'browser' property to use from package.json (defaults to 'browser')
+ browser?: string;
+ // the calling filename where the require() call originated (in the source)
+ filename?: string;
+ // modules object with id to path mappings to consult before doing manual resolution (use to provide core modules)
+ modules?: any;
+ }
+
+ export interface AsyncOpts extends resolve.AsyncOpts, Opts {}
+ export interface SyncOpts extends resolve.SyncOpts, Opts {}
+
+ export var sync: typeof browserResolveSync;
+ }
+
+ export = browserResolve
+}
diff --git a/bytebuffer/bytebuffer.d.ts b/bytebuffer/bytebuffer.d.ts
index e87fb710d8..a58509e4c6 100644
--- a/bytebuffer/bytebuffer.d.ts
+++ b/bytebuffer/bytebuffer.d.ts
@@ -23,6 +23,11 @@ declare class ByteBuffer
*/
static DEFAULT_CAPACITY: number;
+ /**
+ * Default endianess of false for big endian.
+ */
+ static DEFAULT_ENDIAN: boolean;
+
/**
* Default no assertions flag of false.
*/
@@ -96,7 +101,7 @@ declare class ByteBuffer
/**
* Allocates a new ByteBuffer backed by a buffer of the specified capacity.
*/
- static allocate( capacity?: number, littleEndian?: number, noAssert?: boolean ): ByteBuffer;
+ static allocate( capacity?: number, littleEndian?: boolean, noAssert?: boolean ): ByteBuffer;
/**
* Decodes a base64 encoded string to binary like window.atob does.
diff --git a/cache-manager/cache-manager-tests.ts b/cache-manager/cache-manager-tests.ts
new file mode 100644
index 0000000000..36eeb4c141
--- /dev/null
+++ b/cache-manager/cache-manager-tests.ts
@@ -0,0 +1,51 @@
+///
+
+import * as cacheManager from 'cache-manager'
+
+const memoryCache = cacheManager.caching({ store: 'memory', max: 100, ttl: 10/*seconds*/ });
+const ttl = 5;
+
+memoryCache.set('foo', 'bar', { ttl: ttl }, (err) => {
+
+ if (err) {
+ throw err;
+ }
+
+ memoryCache.get('foo', (err, result) => {
+
+ // console.log(result);
+
+ memoryCache.del('foo', (err) => {
+ });
+
+ });
+});
+
+function getUser(id: number, cb: Function) {
+
+ cb(null, { id: id, name: 'Bob' });
+}
+
+const userId = 123;
+const key = 'user_' + userId;
+
+// Note: ttl is optional in wrap()
+memoryCache.wrap<{ id: number, name: string }>(key, (cb) => {
+
+ getUser(userId, cb);
+
+}, { ttl: ttl }, (err, user) => {
+
+ //console.log(user);
+
+ // Second time fetches user from memoryCache
+ memoryCache.wrap<{ id: number, name: string }>(key, (cb) => {
+
+ getUser(userId, cb);
+
+ }, (err, user) => {
+
+ //console.log(user);
+
+ });
+});
diff --git a/cache-manager/cache-manager.d.ts b/cache-manager/cache-manager.d.ts
new file mode 100644
index 0000000000..9570857f01
--- /dev/null
+++ b/cache-manager/cache-manager.d.ts
@@ -0,0 +1,36 @@
+// Type definitions for cache-manager v1.2.0
+// Project: https://github.com/BryanDonovan/node-cache-manager
+// Definitions by: Simon Gausmann
+// Definitions: https://github.com/borisyankov/DefinitelyTyped
+declare module 'cache-manager' {
+
+
+ interface CachingConfig {
+ ttl: number;
+ }
+ interface StoreConfig extends CachingConfig {
+ store: string;
+ max?: number;
+ isCacheableValue?: (value: any) => boolean;
+ }
+ interface Cache {
+ set(key: string, value: T, options: CachingConfig, callback?: (error: any) => void): void;
+ set(key: string, value: T, ttl: number, callback?: (error: any) => void): void;
+
+ wrap(key: string, wrapper: (callback: (error: any, result: T) => void) => void, options: CachingConfig, callback: (error: any, result: T) => void): void;
+ wrap(key: string, wrapper: (callback: (error: any, result: T) => void) => void, callback: (error: any, result: T) => void): void;
+
+ get(key: string, callback: (error: any, result: T) => void): void;
+
+ del(key: string, callback?: (error: any) => void): void;
+ }
+
+
+
+ module cacheManager {
+ function caching(ICongig: StoreConfig): Cache;
+ function multiCaching(Caches: Cache[]): Cache;
+ }
+
+ export = cacheManager;
+}
diff --git a/cassandra-driver/cassandra-driver.d.ts b/cassandra-driver/cassandra-driver.d.ts
new file mode 100644
index 0000000000..0da40f2081
--- /dev/null
+++ b/cassandra-driver/cassandra-driver.d.ts
@@ -0,0 +1,761 @@
+// Type definitions for nodejs-driver v0.8.2
+// Project: https://github.com/datastax/nodejs-driver
+// Definitions by: Marc Fisher
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+///
+///
+
+declare module "cassandra-driver" {
+ type Callback = Function;
+ type ResultCallback = (err: Error, result: types.ResultSet) => void;
+
+ import * as events from "events";
+ import * as stream from "stream";
+ import _Long = require("long");
+
+ namespace policies {
+ namespace addressResolution {
+ var EC2MultiRegionTranslator: EC2MultiRegionTranslatorStatic;
+
+ interface AddressTranslator {
+ translate(address: string, port: number, callback: Callback): void;
+ }
+
+ interface EC2MultiRegionTranslatorStatic {
+ new(): EC2MultiRegionTranslator;
+ }
+
+ interface EC2MultiRegionTranslator extends AddressTranslator {
+ logError(address: string, err: Error): void;
+ }
+ }
+
+ namespace loadBalancing {
+ var DCAwareRoundRobinPolicy: DCAwareRoundRobinPolicyStatic;
+ var RoundRobinPolicy: RoundRobinPolicyStatic;
+ var TokenAwarePolicy: TokenAwarePolicyStatic;
+ var WhiteListPolicy: WhiteListPolicyStatic;
+
+ interface LoadBalancingPolicy {
+ init(client: Client, hosts: HostMap, callback: Callback): void;
+ getDistance(host: Host): types.distance;
+ newQueryPlan(keyspace: string, queryOptions: any, callback: Callback): void;
+ }
+
+ interface DCAwareRoundRobinPolicyStatic {
+ new(localDc?: string, usedHostsPerRemoteDc?: number): DCAwareRoundRobinPolicy;
+ }
+
+ interface DCAwareRoundRobinPolicy extends LoadBalancingPolicy {
+ localHostsArray: Array;
+ remoteHostsArray: Array;
+ }
+
+ interface RoundRobinPolicyStatic {
+ new(): RoundRobinPolicy;
+ }
+
+ interface RoundRobinPolicy extends LoadBalancingPolicy {}
+
+ interface TokenAwarePolicyStatic {
+ new(childPolicy: LoadBalancingPolicy): TokenAwarePolicy;
+ }
+
+ interface TokenAwarePolicy extends LoadBalancingPolicy {}
+
+ interface WhiteListPolicyStatic {
+ new(childPolicy: LoadBalancingPolicy, whiteList: Array): WhiteListPolicy;
+ }
+
+ interface WhiteListPolicy extends LoadBalancingPolicy {}
+ }
+
+ namespace reconnection {
+ var ConstantReconnectionPolicy: ConstantReconnectionPolicyStatic;
+ var ExponentialReconnectionPolicy: ExponentialReconnectionPolicyStatic;
+
+ interface ReconnectionPolicy {
+ newSchedule(): {next: Function};
+ }
+
+ interface ConstantReconnectionPolicyStatic {
+ new(delay: number): ConstantReconnectionPolicy;
+ }
+
+ interface ConstantReconnectionPolicy extends ReconnectionPolicy {}
+
+ interface ExponentialReconnectionPolicyStatic {
+ new(baseDelay: number, maxDelay: number, startWithNoDelay: boolean): ExponentialReconnectionPolicy;
+ }
+
+ interface ExponentialReconnectionPolicy extends ReconnectionPolicy {}
+ }
+
+ namespace retry {
+ var RetryPolicy: RetryPolicyStatic;
+
+ interface DecisionInfo {
+ decision: number;
+ consistency: number;
+ }
+
+ interface RequestInfo {
+ request: any,
+ nbRetry: number
+ }
+
+ enum retryDecision {
+ rethrow = 0,
+ retry,
+ ignore
+ }
+
+ interface RetryPolicyStatic {
+ new (): RetryPolicy;
+
+ retryDecision: any;
+ }
+
+ interface RetryPolicy {
+ onReadTimeout(requestInfo: RequestInfo, consistency: types.consistencies, received: number, blockFor: number, isDataPresent: boolean): DecisionInfo;
+ onUnavailable(requestInfo: RequestInfo, consistency: types.consistencies, required: number, alive: number): DecisionInfo;
+ onWriteTimeout(requestInfo: RequestInfo, consistency: types.consistencies, received: number, blockFor: number, writeType: string): DecisionInfo;
+ rethrowResult(): { decision: retryDecision };
+ retryResult(): { decision: retryDecision, consistency: types.consistencies, useCurrentHost: boolean };
+ }
+ }
+ }
+
+ namespace types {
+ var BigDecimal: BigDecimalStatic;
+ var InetAddress: InetAddressStatic;
+ var Integer: IntegerStatic;
+ var LocalDate: LocalDateStatic;
+ var LocalTime: LocalTimeStatic;
+ var Long: _Long;
+ var ResultSet: ResultSetStatic;
+ var ResultStream: ResultStreamStatic;
+ var Row: RowStatic;
+ var TimeUuid: TimeUuidStatic;
+ var Tuple: TupleStatic;
+ var Uuid: UuidStatic;
+
+ enum consistencies {
+ any = 0,
+ one,
+ two,
+ three,
+ quorum,
+ all,
+ localQuorm,
+ eachQuorum,
+ serial,
+ localSerial,
+ localOne
+ }
+
+ enum dataTypes {
+ custom = 0,
+ ascii,
+ bigint,
+ blob,
+ boolean,
+ counter,
+ decimal,
+ double,
+ float,
+ int,
+ text,
+ timestamp,
+ uuid,
+ varchar,
+ varint,
+ timeuuid,
+ inet,
+ date,
+ time,
+ smallint,
+ tinyint,
+ list,
+ map,
+ set,
+ udt,
+ tuple
+ }
+
+ enum distance {
+ local = 0,
+ remote,
+ ignored
+ }
+
+ interface responseErrorCodes { [key:string]:number; }
+ interface unset { unset: boolean; }
+
+ function generateTimestamp(date?: Date, microseconds?: number): _Long;
+ function timeuuid(options?: {msecs: number | Date, node: Buffer, clockseq: number, nsecs: number}, buffer?: Buffer, offset?: number): string;
+
+ interface BigDecimalStatic {
+ new (unscaledValue: number, scale: number): BigDecimal;
+
+ fromBuffer(buf: Buffer): BigDecimal;
+ toBuffer(value: BigDecimal): Buffer;
+ fromString(value: string): BigDecimal;
+ fromNumber(value: number): BigDecimal;
+ }
+
+ interface BigDecimal {
+ equals(other: BigDecimal): boolean;
+ inspect(): string;
+ notEquals(other: BigDecimal): boolean;
+ compare(other: BigDecimal): number;
+ subtract(other: BigDecimal): BigDecimal;
+ add(other: BigDecimal): BigDecimal;
+ greaterThan(other: BigDecimal): boolean;
+ isNegative(): boolean;
+ isZero(): boolean;
+ toString(): string;
+ toNumber(): number;
+ toJSON(): string;
+ }
+
+ interface InetAddressStatic {
+ new(buffer: Buffer): InetAddress;
+
+ fromString(value: string): InetAddress;
+ }
+
+ interface InetAddress {
+ equals(other: InetAddress): boolean;
+ getBuffer(): Buffer;
+ inspect(): string;
+ toString(): string;
+ toJSON(): string;
+
+ length: number;
+ version: number;
+ }
+
+ interface IntegerStatic {
+ new(bits: Array, sign: number): Integer;
+
+ fromInt(value: number): Integer;
+ fromNumber(value: number): Integer;
+ fromBits(bits: Array): Integer;
+ fromString(str: string, opt_radix?: number): Integer;
+ fromBuffer(bits: Buffer): Integer;
+ toBuffer(value: Integer): Buffer;
+
+ ZERO: Integer;
+ ONE: Integer;
+ }
+
+ interface Integer {
+ toInt(): number;
+ toNumber(): number;
+ toString(opt_radix?: number): string;
+ getBits(index: number): number;
+ getBitsUnsigned(index: number): number;
+ getSign(): number;
+ isZero(): boolean;
+ isNegative(): boolean;
+ isOdd(): boolean;
+ equals(other: Integer): boolean;
+ notEquals(other: Integer): boolean;
+ greaterThan(other: Integer): boolean;
+ greaterThanOrEqual(other: Integer): boolean;
+ lessThan(other: Integer): boolean;
+ lessThanOrEqual(other: Integer): boolean;
+ compare(other: Integer): number;
+ shorten(numBits: number): Integer;
+ negate(): Integer;
+ add(other: Integer): Integer;
+ subtract(other: Integer): Integer;
+ multiply(other: Integer): Integer;
+ divide(other: Integer): Integer;
+ modulo(other: Integer): Integer;
+ not(): Integer;
+ and(other: Integer): Integer;
+ or(other: Integer): Integer;
+ xor(other: Integer): Integer;
+ shiftLeft(numBits: number): Integer;
+ shiftRight(numBits: number): Integer;
+ inspect(): string;
+ abs(): Integer;
+ toJSON(): string;
+ }
+
+ interface LocalDateStatic {
+ new(year: number, month: number, day: number): LocalDate;
+
+ now(): LocalDate;
+ utcNow(): LocalDate;
+ fromDate(date: Date): LocalDate;
+ fromString(value: string): LocalDate;
+ fromBuffer(buffer: Buffer): LocalDate;
+ }
+
+ interface LocalDate {
+ _value: number;
+ year: number;
+ month: number;
+ day: number;
+
+ equals(other: LocalDate): boolean;
+ inspect(): string;
+ toBuffer(): Buffer;
+ toString(): string;
+ toJSON(): string;
+ }
+
+ interface LocalTimeStatic {
+ new (totalNanoseconds: _Long): LocalTime;
+
+ fromString(value: string): LocalTime;
+ now(nanoseconds?: number): LocalTime;
+ fromDate(date: Date, nanoseconds: number): LocalTime;
+ fromMilliseconds(milliseconds: number, nanoseconds?: number): LocalTime;
+ fromBuffer(value: Buffer): LocalTime;
+ }
+
+ interface LocalTime {
+ hour: number;
+ minute: number;
+ second: number;
+ nanosecond: number;
+
+ compare(other: LocalTime): boolean;
+ equals(other: LocalTime): boolean;
+ getTotalNanoseconds(): _Long;
+ inspect(): string;
+ toBuffer(): Buffer;
+ toString(): string;
+ toJSON(): string;
+ }
+
+ interface ResultSetStatic {
+ new(response: any, host: string, triedHost: { [key:string]: any }, consistency: consistencies): ResultSet;
+ }
+
+ interface ResultSet {
+ info: {
+ queriedHost: Host,
+ triedHosts: { [key:string]:string; },
+ achievedConsistency: consistencies,
+ traceId: Uuid,
+ warnings: Array,
+ customPayload: any
+ };
+ rows: Array;
+ rowLength: number;
+ columns: Array<{ [key:string]:string; }>;
+ pageState: string;
+ nextPage: any; // function
+
+ first(): Row;
+ getPageState(): string;
+ getColumns(): Array<{ [key:string]:string; }>;
+ }
+
+ interface ResultStreamStatic {
+ new (opt: any): ResultSet;
+ }
+
+ interface ResultStream extends stream.Readable {
+ buffer: Buffer;
+ paused: boolean;
+
+ _read(): void;
+ _valve(readNext: Function): void;
+ add(chunk: Buffer): void;
+ }
+
+ interface RowStatic {
+ new(columns: Array<{ [key:string]:string; }>): Row;
+ }
+
+ interface Row {
+ get(columnName: string|number): { [key:string]:any; };
+ values(): Array<{ [key:string]:any; }>;
+ keys(): Array;
+ forEach(callback: Callback): void;
+ }
+
+ interface TimeUuidStatic {
+ new (value?: Date, ticks?: number, nodeId?: string|Buffer, clockId?: string|Buffer): TimeUuid;
+
+ fromDate(date: Date, ticks?: number, nodeId?: string|Buffer, clockId?: string|Buffer): TimeUuid;
+ fromString(value: string): TimeUuid;
+ min(date: Date, ticks?: number): TimeUuid;
+ max(date: Date, ticks?: number): TimeUuid;
+ now(nodeId?: string|Buffer, clockId?: string|Buffer): TimeUuid;
+ }
+
+ interface TimeUuid extends Uuid {
+ getDatePrecision(): { date: Date, ticks: number };
+ getDate(): Date;
+ getNodeId(): Buffer;
+ getNodeIdString(): string;
+ }
+
+ interface TupleStatic {
+ new (...arguments: Array): Tuple;
+
+ fromArray(elements: Array): Tuple;
+ }
+
+ interface Tuple {
+ elements: Array;
+ length: number;
+
+ get(index: number): any;
+ toString(): string;
+ toJSON(): string;
+ values(): Array;
+ }
+
+ interface UuidStatic {
+ new (buffer: Buffer): Uuid;
+
+ fromString(value: string): Uuid;
+ random(): Uuid;
+ }
+
+ interface Uuid {
+ buffer: Buffer;
+
+ getBuffer(): Buffer;
+ equals(other: types.Uuid): boolean;
+ toString(): string;
+ inspect(): string;
+ toJSON(): string;
+ }
+ }
+
+ var Client: ClientStatic;
+ var Host: HostStatic;
+ var HostMap: HostMapStatic;
+ var Encoder: EncoderStatic;
+
+ interface ClientOptions {
+ contactPoints: Array,
+ keyspace: string,
+ policies?: {
+ addressResolution?: policies.addressResolution.AddressTranslator,
+ loadBalancing?: policies.loadBalancing.LoadBalancingPolicy,
+ reconnection?: policies.reconnection.ReconnectionPolicy,
+ retry?: policies.retry.RetryPolicy
+ },
+ queryOptions?: QueryOptions,
+ pooling?: {
+ heartBeatInterval: number,
+ coreConnectionsPerHost: { [key:number]:number; },
+ warmup: boolean;
+ },
+ protocolOptions?: {
+ port: number,
+ maxSchemaAgreementWaitSeconds: number,
+ maxVersion: number
+ },
+ socketOptions?: {
+ connectTimeout: number,
+ defunctReadTimeoutThreshold: number,
+ keepAlive: boolean,
+ keepAliveDelay: number,
+ readTimeout: number,
+ tcpNoDelay: boolean,
+ coalescingThreshold: number
+ },
+ authProvider?: auth.AuthProvider,
+ sslOptions?: any,
+ encoding?: {
+ map: Function,
+ set: Function,
+ copyBuffer: boolean,
+ useUndefinedAsUnset: boolean
+ }
+ }
+
+ interface QueryOptions {
+ autoPage?: boolean;
+ captureStackTrace?: boolean;
+ consistency: number;
+ customPayload?: any;
+ fetchSize?: number;
+ hints: Array | Array>;
+ logged?: boolean;
+ pageState?: Buffer|string;
+ prepare?: boolean;
+ readTimeout?: number;
+ retry?: policies.retry.RetryPolicy;
+ retryOnTimeout?: boolean;
+ routingIndexes?: Array;
+ routingKey?: Buffer | Array;
+ routingNames?: Array;
+ serialConsistency?: number;
+ timestamp?: number | _Long;
+ traceQuery?: boolean;
+ }
+
+ interface ClientStatic {
+ new(options?: ClientOptions): Client;
+ }
+
+ interface Client extends events.EventEmitter {
+ hosts: HostMap;
+ keyspace: string;
+ metadata: metadata.Metadata;
+
+ batch(queries: Array|Array<{query: string, params?: any}>, options: QueryOptions, callback: ResultCallback): void;
+ connect(callback: Callback): void;
+ eachRow(query: string, params?: any, options?: QueryOptions, rowCallback?: Callback, callback?: Callback): void;
+ execute(query: string, params?: any, options?: QueryOptions, callback?: ResultCallback): void;
+ getReplicas(keyspace: string, token: Buffer): Array; // TODO: Should this be a more explicit return?
+ shutdown(callback?: Callback): void;
+ stream(query: string, params?: any, options?: QueryOptions, callback?: Callback): void;
+ }
+
+ interface HostStatic {
+ new(address: string, protocolVersion: number, options: ClientOptions): Host;
+ }
+
+ interface Host extends events.EventEmitter {
+ address: string;
+ cassandraVersion: string;
+ dataCenter: string;
+ rack: string;
+ tokens: Array;
+
+ canBeConsideredAsUp(): boolean;
+ getCassandraVersion(): Array;
+ isUp(): boolean;
+ }
+
+ interface HostMapStatic {
+ new (): HostMap;
+ }
+
+ interface HostMap extends events.EventEmitter {
+ length: number;
+
+ forEach(callback: Callback): void;
+ get(key: string): Host;
+ keys(): Array;
+ remove(key: string): void;
+ removeMultiple(keys: Array): void;
+ set(key: string, value: Host): void;
+ values(): Array;
+ }
+
+ interface EncoderStatic {
+ new(protocolVersion: number, options: ClientOptions) : Encoder;
+ }
+
+ interface Encoder {
+ decode(buffer: Buffer, type: {code: number, info?: any}): void;
+ encode(value: any, typeInfo?: string|number|{code: number, info?: any}): Buffer;
+ }
+
+ namespace auth {
+ var Authenticator: AuthenticatorStatic;
+ var PlainTextAuthProvider: PlainTextAuthProviderStatic;
+
+ interface AuthenticatorStatic {
+ new (): Authenticator;
+ }
+
+ interface Authenticator {
+ evaluateChallenge(challenge: Buffer, callback: Callback): void;
+ initialResponse(callback: Callback): void;
+ onAuthenticationSuccess(token?: Buffer): void;
+ }
+
+ interface AuthProvider {
+ newAuthenticator(endpoint: string, name: string): void;
+ }
+
+ interface PlainTextAuthProviderStatic {
+ new (username: string, password: string): PlainTextAuthProvider;
+ }
+
+ interface PlainTextAuthProvider extends AuthProvider {
+ newAuthenticator(endpoint: string, name: string): void;
+ }
+ }
+
+ namespace errors {
+ abstract class DriverError {
+ constructor(message: string, constructor?: any);
+ }
+
+ class ArgumentError extends DriverError {
+ constructor(message: string);
+ }
+
+ class AuthenticationError extends DriverError {
+ constructor(message: string);
+ }
+
+ class DriverInternalError extends DriverError {
+ constructor(message: string);
+ }
+
+ class NoHostAvailableError extends DriverError {
+ constructor(innerErrors: any, message?: string);
+ }
+
+ class NotSupportedError extends DriverError {
+ constructor(message: string);
+ }
+
+ class OperationTimedOutError extends DriverError {}
+
+ class ResponseError extends DriverError {
+ constructor(code: number, message: string);
+ }
+ }
+
+ namespace metadata {
+ var Aggregate: AggregateStatic;
+ var Index: IndexStatic;
+ var MaterializedView: MaterializedViewStatic;
+ var Metadata: MetadataStatic;
+ var SchemaFunction: SchemaFunctionStatic;
+ var TableMetadata: TableMetadataStatic;
+
+ type caching = "all" | "keys_only" | "rows_only" | "none";
+
+ interface AggregateStatic {
+ new (): Aggregate;
+ }
+
+ interface Aggregate {
+ argumentTypes: Array<{ code: number, info: any}>;
+ finalFunction: string;
+ initCondition: string;
+ keyspaceName: string,
+ returnType: string;
+ signature: Array;
+ stateFunction: string;
+ stateType: string;
+ }
+
+ interface DataTypeInfo {
+ code: number,
+ info: string | DataTypeInfo | Array,
+ options: {
+ frozen: boolean,
+ reversed: boolean
+ }
+ }
+
+ interface ColumnInfo {
+ name: string,
+ type: DataTypeInfo
+ }
+
+ interface DataCollection {
+ bloomFilterFalsePositiveChance: number;
+ caching: caching;
+ clusterKeys: Array<{ c: ColumnInfo, index: number, order: string }>;
+ clusteringOrder: Array;
+ columns: Array;
+ columnsByName: { [key: string]: ColumnInfo };
+ comment: string;
+ compactionClass: string;
+ compactionOptions: any;
+ compression: any;
+ crcCheckChange?: number;
+ defaultTtl: number;
+ extensions: any;
+ gcGraceSeconds: number;
+ localReadRepairChance: number;
+ maxIndexInterval?: number;
+ minIndexInterval?: number;
+ name: string;
+ partitionKeys: Array<{ c: ColumnInfo, index: number }>
+ populateCacheOnFlush: boolean;
+ readRepairChance: number;
+ speculateRetry: string;
+ }
+
+ enum IndexType {
+ custom = 0,
+ keys,
+ composites
+ }
+
+ interface IndexStatic {
+ new (name: string, target: string, kind: IndexType, options: Object): Index;
+
+ fromRows(indexRows: Array): Array;
+ fromColumnRows(columnRows: Array, columnsByName: { [key:string]: ColumnInfo }): Array;
+ }
+
+ interface Index {
+ kind: IndexType;
+ name: string;
+ options: Object;
+ target: string;
+
+ isCompositesKind(): boolean;
+ isCustomKind(): boolean;
+ isKeysKind(): boolean;
+ }
+
+ interface MaterializedViewStatic {
+ new (name: string): MaterializedView;
+ }
+
+ interface MaterializedView extends DataCollection {}
+
+ interface MetadataStatic {
+ new (options: ClientOptions, controlConnection: any): Metadata;
+ }
+
+ interface Metadata {
+ clearPrepared(): void;
+
+ getAggregate(keyspaceName: string, name: string, signature: Array | Array<{ code: number, info: any }>, callback: Callback): void;
+ getAggregates(keyspaceName: string, name: string, callback: Callback): void;
+ getFunction(keyspaceName: string, name: string, signature: Array | Array<{ code: number, info: any }>, callback: Callback): void;
+ getFunctions(keyspaceName: string, name: string, callback: Callback): void;
+ getMaterializedView(keyspaceName: string, name: string, callback: Callback): void;
+ getReplicas(keyspaceName: string, tokenBuffer: Buffer): Array;
+ getTable(keyspaceName: string, name: string, callback: Callback): void;
+ getTrace(traceId: types.Uuid, callback: Callback): void;
+ getUdt(keyspaceName: string, name: string, callback: Callback): void;
+ refreshKeyspace(name: string, callback?: Callback): void;
+ refreshKeyspaces(callback?: Callback): void;
+ }
+
+ interface SchemaFunctionStatic {
+ new (): SchemaFunction;
+ }
+
+ interface SchemaFunction {
+ argumentNames: Array;
+ argumentTypes: Array<{ code: number, info: any}>;
+ body: string;
+ calledOnNullInput: boolean;
+ keyspaceName: string,
+ language: string;
+ name: string;
+ returnType: string;
+ signature: Array;
+ }
+
+ interface TableMetadataStatic {
+ new (name: string): TableMetadata;
+ }
+
+ interface TableMetadata extends DataCollection {
+ indexes: Array;
+ indexInterval?: number;
+ isCompact: boolean;
+ memtableFlushPeriod: number;
+ replicateOnWrite: boolean;
+ }
+ }
+}
\ No newline at end of file
diff --git a/cassandra-driver/cassandra-driver.tests.ts b/cassandra-driver/cassandra-driver.tests.ts
new file mode 100644
index 0000000000..3eebf93018
--- /dev/null
+++ b/cassandra-driver/cassandra-driver.tests.ts
@@ -0,0 +1,11 @@
+///
+
+import * as cassandra from 'cassandra-driver';
+import * as util from 'util';
+
+var client = new cassandra.Client({ contactPoints: ['h1', 'h2'], keyspace: 'ks1'});
+
+var query = 'SELECT email, last_name FROM user_profiles WHERE key=?';
+client.execute(query, ['guy'], function(err, result) {
+ console.log('got user profile with email ' + result.rows[0].email);
+});
\ No newline at end of file
diff --git a/chai-things/chai-things.d.ts b/chai-things/chai-things.d.ts
index 823329808c..2636c9dcea 100644
--- a/chai-things/chai-things.d.ts
+++ b/chai-things/chai-things.d.ts
@@ -1,7 +1,7 @@
// Type definitions for chai-things
// Project: https://github.com/chaijs/chai-things
// Definitions by: David Broder-Rodgers
-// Definitions: https://github.com/DavidBR-SW/DefinitelyTyped
+// Definitions: https://github.com/borisyankov/DefinitelyTyped
///
@@ -25,14 +25,14 @@ declare namespace Chai {
interface Anything extends Assertion {
(): any;
- that: Assertion
- with: Assertion
+ that: Assertion;
+ with: Assertion;
}
interface Something extends Assertion {
(): any;
- that: Assertion
- with: Assertion
+ that: Assertion;
+ with: Assertion;
}
interface Item {
diff --git a/chai/chai-3.2.0-tests.ts b/chai/chai-3.2.0-tests.ts
index 9b646b1529..cb1b74b8f1 100644
--- a/chai/chai-3.2.0-tests.ts
+++ b/chai/chai-3.2.0-tests.ts
@@ -1930,6 +1930,24 @@ suite('assert', () => {
}, 'expected 5 to be below 5');
});
+ test('isAtLeast', () => {
+ assert.isAtLeast(5, 3);
+ assert.isAtLeast(5, 5);
+
+ err(() => {
+ assert.isAtLeast(3, 5);
+ }, 'expected 3 to be greater than or equal to 5');
+ });
+
+ test('isAtMost', () => {
+ assert.isAtMost(3, 5);
+ assert.isAtMost(5, 5);
+
+ err(() => {
+ assert.isAtMost(5, 3);
+ }, 'expected 5 to be less than or equal to 3');
+ });
+
test('extensible', () => { assert.extensible({}); });
test('isExtensible', () => { assert.isExtensible({}); });
test('notExtensible', () => { assert.notExtensible(Object.preventExtensions({})); });
diff --git a/chai/chai-3.2.0.d.ts b/chai/chai-3.2.0.d.ts
index 87b0c08e6f..6dc653b72f 100644
--- a/chai/chai-3.2.0.d.ts
+++ b/chai/chai-3.2.0.d.ts
@@ -271,6 +271,9 @@ declare namespace Chai {
isAbove(val: number, abv: number, msg?: string): void;
isBelow(val: number, blw: number, msg?: string): void;
+ isAtMost(val: number, atmst: number, msg?: string): void;
+ isAtLeast(val: number, atlst: number, msg?: string): void;
+
isFunction(val: any, msg?: string): void;
isNotFunction(val: any, msg?: string): void;
diff --git a/chai/chai.d.ts b/chai/chai.d.ts
index 0ebc855022..8eb0995947 100644
--- a/chai/chai.d.ts
+++ b/chai/chai.d.ts
@@ -378,7 +378,20 @@ declare namespace Chai {
}
export interface Config {
+ /**
+ * Default: false
+ */
includeStack: boolean;
+
+ /**
+ * Default: true
+ */
+ showDiff: boolean;
+
+ /**
+ * Default: 40
+ */
+ truncateThreshold: number;
}
export class AssertionError {
diff --git a/chartist/chartist.d.ts b/chartist/chartist.d.ts
index 6c679dc1d8..0e92364812 100644
--- a/chartist/chartist.d.ts
+++ b/chartist/chartist.d.ts
@@ -105,7 +105,7 @@ declare namespace Chartist {
plugins?: Array; // all of these plugins seem to be functions with options, but keeping type any for now
update(data: Object, options?: T, override?: boolean): void;
- detatch(): void;
+ detach(): void;
/**
* Use this function to register event handlers. The handler callbacks are synchronous and will run in the main thread rather than the event loop.
diff --git a/ckeditor/ckeditor.d.ts b/ckeditor/ckeditor.d.ts
index bba377090f..9d8728338f 100644
--- a/ckeditor/ckeditor.d.ts
+++ b/ckeditor/ckeditor.d.ts
@@ -641,7 +641,7 @@ declare namespace CKEDITOR {
filebrowserImageBrowseLinkUrl?: string;
filebrowserImageBrowseUrl?: string;
filebrowserImageUploadUrl?: string;
- filebrowserUploadUr?: string;
+ filebrowserUploadUrl?: string;
filebrowserWindowFeatures?: string;
filebrowserWindowHeight?: number | string;
filebrowserWindowWidth?: number | string;
diff --git a/cliff/cliff.d.ts b/cliff/cliff.d.ts
new file mode 100644
index 0000000000..e0db79c986
--- /dev/null
+++ b/cliff/cliff.d.ts
@@ -0,0 +1,14 @@
+// Type definitions for cliff 0.1.10
+// Project: https://github.com/flatiron/cliff
+// Definitions by: bryn austin bellomy
+// Definitions: https://github.com/borisyankov/DefinitelyTyped
+
+
+declare module "cliff" {
+ export function inspect(obj:any): string;
+ export function stringifyRows(rows:string[][], colors?:string[]): string;
+ export function stringifyObjectRows(rows:Array<{}>, keys:string[], colors?:string[]): string;
+ export function putRows(level:string, rows:string[][], colors?:string[]): void;
+ export function putObjectRows(level:string, rows:Array<{}>, keys:string[], colors?:string[]): void;
+ export function putObject(level:string, object:any, rewriters?:any, padding?:any): void;
+}
diff --git a/codemirror/codemirror.d.ts b/codemirror/codemirror.d.ts
index f513057216..b1bf33e2d2 100644
--- a/codemirror/codemirror.d.ts
+++ b/codemirror/codemirror.d.ts
@@ -220,14 +220,7 @@ declare namespace CodeMirror {
/** Get an { left , top , width , height , clientWidth , clientHeight } object that represents the current scroll position, the size of the scrollable area,
and the size of the visible area(minus scrollbars). */
- getScrollInfo(): {
- left: any;
- top: any;
- width: any;
- height: any;
- clientWidth: any;
- clientHeight: any;
- }
+ getScrollInfo(): CodeMirror.ScrollInfo;
/** Scrolls the given element into view. pos is a { line , ch } position, referring to a given character, null, to refer to the cursor.
The margin parameter is optional. When given, it indicates the amount of pixels around the given area that should be made visible as well. */
@@ -609,6 +602,15 @@ declare namespace CodeMirror {
text: string;
}
+ interface ScrollInfo {
+ left: any;
+ top: any;
+ width: any;
+ height: any;
+ clientWidth: any;
+ clientHeight: any;
+ }
+
interface TextMarker {
/** Remove the mark. */
clear(): void;
diff --git a/commangular/commangular-mock.d.ts b/commangular/commangular-mock.d.ts
new file mode 100644
index 0000000000..134e4d0d1e
--- /dev/null
+++ b/commangular/commangular-mock.d.ts
@@ -0,0 +1,73 @@
+// Type definitions for Commangular Mock 0.9.0
+// Project: http://commangular.org
+// Definitions by: Hiraash Thawfeek
+// Definitions: https://github.com/borisyankov/DefinitelyTyped
+
+declare module commangular {
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Commangular Static
+ // see http://commangular.org/docs/#commangular-namespace
+ ///////////////////////////////////////////////////////////////////////////
+ interface ICommAngularStatic {
+
+ /**
+ * Mock dispatch function for testing commands.
+ */
+ dispatch( ec: ICommandCall, callback: Function ): void;
+ }
+
+ interface ICommandCall {
+ /**
+ * Name of the command that needs to
+ * execute
+ */
+ command: string;
+
+ /**
+ * Data that needs to be passed to the command
+ */
+ data?: any;
+ }
+
+
+ /**
+ * Object type expected to be passed into the callback function
+ * of the dispatch() function
+ */
+ interface ICommandInfo {
+ /**
+ * The data that was passed into the command
+ * @param key The property name that is in the object that was passed
+ */
+ dataPassed( key : string ) : any;
+
+ /**
+ * The data that was returned by the command
+ * @param key The result key that was defined in the command. If no result
+ * was defined use 'lastResult' as the key
+ */
+ resultKey( key: string ): any;
+
+ /**
+ * Indicates if the command execution was cancelled.
+ */
+ canceled( ): boolean;
+
+ /**
+ * Indicates if the command was executed????
+ */
+ commandExecuted( ): boolean;
+ }
+
+}
+
+
+/**
+* Mock dispatch function for testing commands.
+* @param ec an ICommandCall object
+* @param callback The function that will be called upon the completion of the command
+* function should expecte an ICommandInfo paramter.
+*/
+declare function dispatch( ec: commangular.ICommandCall, callback: Function ): void;
+
diff --git a/commangular/commangular.d.ts b/commangular/commangular.d.ts
new file mode 100644
index 0000000000..b03a22574e
--- /dev/null
+++ b/commangular/commangular.d.ts
@@ -0,0 +1,273 @@
+// Type definitions for Commangular 0.9.0
+// Project: http://commangular.org
+// Definitions by: Hiraash Thawfeek
+// Definitions: https://github.com/borisyankov/DefinitelyTyped
+
+///
+
+declare var commangular: commangular.ICommAngularStatic;
+
+declare module commangular {
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Commangular Static
+ // see http://commangular.org/docs/#commangular-namespace
+ ///////////////////////////////////////////////////////////////////////////
+ interface ICommAngularStatic {
+
+ /**
+ * Use this function to create and register a command with Commangular
+ *
+ * @param commandName It's the name of the command you are creating. It's useful to reference the command from the command provider.
+ * @param commandFunction It's the command class that will be executed when commangular runs this command.
+ * It has to be something that implements ICommand. Same as angular syntax
+ * @param commandConfig It's and object with paramaters to configure the command execution.
+ */
+ create (commandName: string, commandFunction: Function, commandConfig?:ICommandConfig) : void;
+ command (commandName: string, commandFunction: Function, commandConfig?:ICommandConfig) : void;
+
+ /**
+ * This function allows you to hijack the execution before or after and
+ * execute some cross cutting functionality.
+ * see http://commangular.org/docs/#command-aspects
+ * @param aspectDescriptor The interceptor descriptor has two parts 'Where' and 'What'.
+ * Where do you want to intercept? you've 5 options :
+ * - @Before : The interceptor will be executed before the command. You will be able to
+ * cancel the command or modify the data that will be injected in the command or do
+ * some other operation you need before the command execution.
+ * - @After : The interceptor will be executed just after the command and before any other next
+ * command. You can get the lastResult from the command, cancel execution etc etc.
+ * - @AfterExecution : This intercetor is executed just after the command execute method and
+ * it can get the result from the command and update it before the onResult method is executed.
+ * - @AfterThrowing : This interceptor will be executed if the command or any interceptor of
+ * the command throws an exception. You can get the error throwed injected to do what you need.
+ * - @Around : The interceptor is executed around a command.That means that a especial
+ * object 'processor' will be injected in the interceptor and you can invoke the command
+ * or the next interceptor. It will be better explained below.
+ * @param aspectFunction It's the command class execute function that will be run for the given aspect.
+ * @param order You can chain any number of interceptors to the same command, so if you need to executed
+ * the interceptor in a specific order you can indicate it here. An order of 0 is assigned by default.
+ */
+ aspect ( aspectDescriptor: string, aspectFunction: ICommand, order: number ) : void;
+
+ /**
+ * Event aspects work the same way command aspects do, but they intercept all the command groups instead,
+ * so you can run some function before the command group starts it's execution , after or when any
+ * command or interceptor in the group throw an exception.
+ * see http://commangular.org/docs/#event-aspects
+ * @param aspectDescriptor The interceptor descriptor has two parts 'Where' and 'What'.
+ * Where do you want to intercept? you've 3 options :
+ * - @Before : The interceptor will be executed before the command. You will be able to
+ * cancel the command or modify the data that will be injected in the command or do
+ * some other operation you need before the command execution.
+ * - @After : The interceptor will be executed just after the command and before any other next
+ * command. You can get the lastResult from the command, cancel execution etc etc.
+ * - @AfterThrowing : This interceptor will be executed if the command or any interceptor of
+ * the command throws an exception. You can get the error throwed injected to do what you need.
+ * @param aspectFunction It's the command class execute function that will be run for the given aspect.
+ * @param order You can chain any number of interceptors to the same command, so if you need to executed
+ * the interceptor in a specific order you can indicate it here. An order of 0 is assigned by default.
+ */
+ eventAspect( aspectDescriptor: string, aspectFunction: ICommand, order: number ) : void;
+
+ /**
+ * TBD
+ */
+ resolver( commandName: string, resolverFunction : Function ) : void;
+
+ /**
+ * Clears all commands and aspects registered with commangular.
+ */
+ reset() : void;
+
+ /**
+ * Can be used to enable/disable debug
+ */
+ debug( enableDebug : boolean ) : void;
+
+ /**
+ * TBD
+ */
+ build() : void;
+ }
+
+ /**
+ * The command function/object
+ * see http://commangular.org/docs/#commangular-namespace
+ */
+ interface ICommand {
+ /**
+ * This function is what gets called when the command executes.
+ * It can take parameters in as injected by angular
+ */
+ execute() : any;
+
+ }
+
+ interface IResultCommand extends ICommand{
+ /**
+ * Is executed after the execute method and the interception chain and can receive
+ * the result from the execute method of the same command.
+ *
+ * @param result Value/object returned by the execution.
+ */
+ onResult ( result: any ) : void;
+
+ /**
+ * Is executed when the executed method ends with an error. Can receive the error throw by the execute method.
+ * @param error The error that occured during execution
+ */
+ onError ( error: Error ) : void;
+ }
+
+ /**
+ * The result object expected in the promise returned by the dispatch function
+ * This must be extended to add custom result keys
+ * see http://commangular.org/docs/#returning-result-from-commands
+ */
+ interface ICommandResult {
+ /**
+ * By defualt the result of the command will be found in this property
+ */
+ lastResult : any;
+ }
+
+ /**
+ * Command creation configuration
+ * see http://commangular.org/docs/#the-command-config-object
+ */
+ interface ICommandConfig {
+ /**
+ * This property instruct commangular to keep the value returned by the command in the value
+ * key passed in 'resultKey'. It has to be a string. It means that after the execution of this
+ * commands you will be able to inject on the next command using that key and the result of the command will be injected.
+ */
+ resultKey : string;
+ }
+
+ /**
+ * All the command configuration of your application is done in an angular config block and
+ * with the $commangularProvider. The provider is responsible to build the command strutures and
+ * map them to the desired event names. You can create multiple configs blocks in angular, so you
+ * can have multiple command config blocks to separate functional parts of your application.
+ * see http://commangular.org/docs/#using-the-provider
+ */
+ interface ICommAngularProvider {
+
+ /**
+ * This function lets you map a even name to a command sequence
+ * @param eventName An event that will be watched by commangular
+ */
+ mapTo( eventName: string ) : ICommAngularDescriptor;
+
+ /**
+ * Used along with mapTo function. Creates a sequence of commands that
+ * execute after one and other
+ * see http://commangular.org/docs/#building-command-sequences
+ */
+ asSequence(): ICommAngularDescriptor;
+
+ /**
+ * Used along with mapTo function. Maps commands to be executed parallel
+ * see http://commangular.org/docs/#building-parallel-commands
+ */
+ asParallel(): ICommAngularDescriptor;
+
+ /**
+ * A command flow is a decision point inside the command group.You can have any number
+ * of flows inside a command group and nesting them how you perfer.
+ * see http://commangular.org/docs/#building-command-flows
+ */
+ asFlow(): ICommAngularDescriptor;
+
+ findCommand( eventName: string ): ICommAngularDescriptor;
+
+ }
+
+ /**
+ * The service that enables the execution of commands
+ * see http://commangular.org/docs/#dispatching-events
+ */
+ interface ICommAngularService {
+
+ /**
+ * This function executes the given command sequence.
+ * see http://commangular.org/docs/#dispatching-events
+ * @param eventName Name of the even that will trigger a command sequence
+ * @param data Data of any type that will be passed to the command.
+ */
+ dispatch( eventName: string, data?: any ) : ng.IPromise;
+ }
+
+ interface ICommAngularDescriptor {
+
+ /**
+ * Used along with mapTo function. Creates a sequence of commands that
+ * execute after one and other
+ * see http://commangular.org/docs/#building-command-sequences
+ */
+ asSequence (): ICommAngularDescriptor;
+
+ /**
+ * Used along with mapTo function. Maps commands to be executed parallel
+ * see http://commangular.org/docs/#building-parallel-commands
+ */
+ asParallel(): ICommAngularDescriptor;
+
+ /**
+ * A command flow is a decision point inside the command group.You can have any number
+ * of flows inside a command group and nesting them how you perfer.
+ * see http://commangular.org/docs/#building-command-flows
+ */
+ asFlow(): ICommAngularDescriptor;
+
+ /**
+ * Add commands to a descriptor.
+ * @param command The name that was used to create the command.
+ */
+ add ( command: string ): ICommAngularDescriptor;
+
+ /**
+ * Add descriptor to a descriptor.
+ * @param descriptor Another descriptor attached to a sequnce of commands.
+ */
+ add ( descriptor: ICommAngularDescriptor ): ICommAngularDescriptor;
+
+ /**
+ * This is to be used with flowing commands to attach an expression that
+ * evaluates using Angular $parse.
+ * see http://commangular.org/docs/#building-command-flows
+ * @param expression A string form expression that can make use of services to validate conditions.
+ * @param services A comma seperated list of services that are used in the above expression
+ */
+ link ( expression: string, services?: string ): ICommAngularDescriptor;
+
+ /**
+ * Works with the link function to attach a command to the flow if the
+ * expression becomes truthy.
+ * see http://commangular.org/docs/#building-command-flows
+ * @param command The name that was used to create the command.
+ */
+ to ( command: string ): ICommAngularDescriptor;
+
+ }
+
+}
+
+/**
+ * Extending the angular rootScope to include the dispatch function in all scopes.
+ */
+declare module angular {
+
+ interface IRootScopeService {
+
+ /**
+ * Commangular method to execute a command.
+ * @param eventName Name of the even that will trigger a command sequence
+ * @param data Data of any type that will be passed to the command.
+ */
+ dispatch( eventName: string, data?: any ) : ng.IPromise;
+
+ }
+
+}
\ No newline at end of file
diff --git a/common-tags/common-tags-tests.ts b/common-tags/common-tags-tests.ts
new file mode 100644
index 0000000000..9114f4414c
--- /dev/null
+++ b/common-tags/common-tags-tests.ts
@@ -0,0 +1,156 @@
+///
+
+import * as commonTags from 'common-tags';
+
+/* Test Built-in Tags */
+
+commonTags.commaLists `
+ I like ${['apples', 'bananas', 'watermelons']}
+ They're good!
+`;
+
+commonTags.commaListsAnd`
+ I like ${['apples', 'bananas', 'watermelons']}
+ They're good!
+`;
+
+commonTags.commaListsOr`
+ I like ${['apples', 'bananas', 'watermelons']}
+ They're good!
+`;
+
+let fruits = ['apple', 'orange', 'watermelon'];
+
+commonTags.html`
+
+
+ ${fruits.map(fruit => `
${fruit}
`)}
+ ${'
kiwi
\n
guava
'}
+
+
+`;
+
+commonTags.codeBlock`
+
+
+ ${fruits.map(fruit => `
${fruit}
`)}
+ ${'
kiwi
\n
guava
'}
+
+
+`;
+
+commonTags.source`
+
+
+ ${fruits.map(fruit => `
${fruit}
`)}
+ ${'
kiwi
\n
guava
'}
+
+
+`;
+
+commonTags.oneLine`
+ foo
+ bar
+ baz
+`;
+
+commonTags.oneLineTrim`
+ https://news.com/article
+ ?utm_source=designernews.co
+`;
+
+commonTags.oneLineCommaLists`
+ I like ${['apples', 'bananas', 'watermelons']}
+ They're good!
+`;
+
+commonTags.oneLineCommaListsOr`
+ I like ${['apples', 'bananas', 'watermelons']}
+ They're good!
+`;
+
+commonTags.oneLineCommaListsAnd`
+ I like ${['apples', 'bananas', 'watermelons']}
+ They're good!
+`;
+
+commonTags.inlineLists`
+ I like ${['apples', 'bananas', 'watermelons']}
+ They're good!
+`;
+
+commonTags.oneLineInlineLists`
+ I like ${['apples', 'bananas', 'watermelons']}
+ They're good!
+`;
+
+let verb = 'notice';
+
+commonTags.stripIndent`
+ This is a multi-line string.
+ You'll ${verb} that it is indented.
+ We don't want to output this indentation.
+ But we do want to keep this line indented.
+`;
+
+commonTags.stripIndents`
+ This is a multi-line string.
+ You'll ${verb} that it is indented.
+ We don't want to output this indentation.
+ We don't want to keep this line indented either.
+`;
+
+/* Test Tag Constructor */
+
+new commonTags.TemplateTag();
+
+const substitutionReplacer = (oldValue : string, newValue : string) => ({
+ onSubstitution(substitution : string, resultSoFar : string) {
+ if (substitution === oldValue) {
+ return newValue;
+ }
+ return substitution;
+ }
+});
+
+new commonTags.TemplateTag(substitutionReplacer('fizz', 'buzz'));
+
+new commonTags.TemplateTag(
+ substitutionReplacer('fizz', 'buzz'),
+ substitutionReplacer('foo', 'bar')
+);
+
+new commonTags.TemplateTag([
+ substitutionReplacer('fizz', 'buzz'),
+ substitutionReplacer('foo', 'bar')
+]);
+
+new commonTags.TemplateTag({});
+
+new commonTags.TemplateTag({
+ onEndResult: endResult => `${endResult}!`
+});
+
+new commonTags.TemplateTag({
+ onSubstitution: substitution => `${substitution}!`,
+ onEndResult: endResult => `${endResult}!`
+});
+
+/* Tests Built-in Transformers */
+
+new commonTags.TemplateTag(commonTags.trimResultTransformer());
+new commonTags.TemplateTag(commonTags.trimResultTransformer('left'));
+new commonTags.TemplateTag(commonTags.trimResultTransformer('right'));
+
+new commonTags.TemplateTag(commonTags.stripIndentTransformer());
+new commonTags.TemplateTag(commonTags.stripIndentTransformer('initial'));
+new commonTags.TemplateTag(commonTags.stripIndentTransformer('all'));
+
+new commonTags.TemplateTag(commonTags.replaceResultTransformer('foo', 'bar'));
+
+new commonTags.TemplateTag(commonTags.inlineArrayTransformer());
+new commonTags.TemplateTag(commonTags.inlineArrayTransformer({}));
+new commonTags.TemplateTag(commonTags.inlineArrayTransformer({separator: 'foo'}));
+new commonTags.TemplateTag(commonTags.inlineArrayTransformer({conjunction: 'bar'}));
+
+new commonTags.TemplateTag(commonTags.splitStringTransformer('foo'));
diff --git a/common-tags/common-tags.d.ts b/common-tags/common-tags.d.ts
new file mode 100644
index 0000000000..aa443ac33d
--- /dev/null
+++ b/common-tags/common-tags.d.ts
@@ -0,0 +1,62 @@
+// Type definitions for common-tags v1.2.1
+// Project: https://github.com/declandewet/common-tags
+// Definitions by: Viktor Zozuliak
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+declare module 'common-tags' {
+ type TemplateTag = (literals: string[], ...placeholders: any[]) => string;
+
+ type TemplateTransformer = {
+ onSubstitution?: (substitution: string, resultSoFar: string) => string;
+ onEndResult?: (endResult : string) => string;
+ }
+
+ /* Built-in Tags */
+ export var commaLists: TemplateTag;
+
+ export var commaListsAnd: TemplateTag;
+
+ export var commaListsOr: TemplateTag;
+
+ export var html: TemplateTag;
+
+ export var codeBlock: TemplateTag;
+
+ export var source: TemplateTag;
+
+ export var oneLine: TemplateTag;
+
+ export var oneLineTrim: TemplateTag;
+
+ export var oneLineCommaLists: TemplateTag;
+
+ export var oneLineCommaListsOr: TemplateTag;
+
+ export var oneLineCommaListsAnd: TemplateTag;
+
+ export var inlineLists: TemplateTag;
+
+ export var oneLineInlineLists: TemplateTag;
+
+ export var stripIndent: TemplateTag;
+
+ export var stripIndents: TemplateTag;
+
+ /* New Tag Constructor */
+ export var TemplateTag: {
+ new(): TemplateTag;
+ new(...transformers: TemplateTransformer[]): TemplateTag;
+ new(transformers: TemplateTransformer[]): TemplateTag;
+ };
+
+ /* Built-in Transformers */
+ export var trimResultTransformer: (side?: 'left'|'right') => TemplateTransformer;
+
+ export var stripIndentTransformer: (type?: 'initial'|'all') => TemplateTransformer;
+
+ export var replaceResultTransformer: (replaceWhat: string, replaceWith: string) => TemplateTransformer;
+
+ export var inlineArrayTransformer: (opts?: {separator?: string, conjunction?: string}) => TemplateTransformer;
+
+ export var splitStringTransformer: (splitBy: string) => TemplateTransformer;
+}
diff --git a/component-emitter/component-emitter-tests.ts b/component-emitter/component-emitter-tests.ts
new file mode 100644
index 0000000000..e6c6a5b1ab
--- /dev/null
+++ b/component-emitter/component-emitter-tests.ts
@@ -0,0 +1,52 @@
+/// // only for require
+///
+// These are all of the examples from https://www.npmjs.com/package/component-emitter as of June 18, 2016
+
+
+// These are all of the examples from https://www.npmjs.com/package/component-emitter as of June 18, 2016
+
+var Emitter = require('component-emitter');
+var emitter = new Emitter;
+emitter.emit('something');
+
+
+
+
+var user = { name: 'tobi' };
+Emitter(user);
+
+(user).emit('im a user');
+
+
+
+// this example modified from the one on https://www.npmjs.com/package/component-emitter
+var User = Object.create({
+ someUserFunction: () => {console.log('someUserFunction called!')}
+})
+var another_user = Emitter(User);
+another_user.someUserFunction()
+another_user.on('hi', () => {console.log('Hi called')})
+another_user.emit('hi')
+
+
+// Additional sample code for this test
+function handleSomeRecurringEvent(event_data: any) {
+ console.log('handle some-recurring-event')
+}
+emitter.on('some-recurring-event', handleSomeRecurringEvent)
+
+
+emitter.once('some-single-shot-event', (event_data: any) => {console.log('handle some-single-shot-event')})
+
+
+emitter.off()
+emitter.off('some-recurring-event')
+emitter.off('some-recurring-event', handleSomeRecurringEvent)
+
+var event_data = {some: 'data'}
+emitter.emit('some-recurring-event')
+emitter.emit('some-recurring-event', event_data)
+
+emitter.listeners('some-recurring-event')
+
+emitter.hasListeners('some-recurring-event')
diff --git a/component-emitter/component-emitter.d.ts b/component-emitter/component-emitter.d.ts
new file mode 100644
index 0000000000..28ce4f4bc9
--- /dev/null
+++ b/component-emitter/component-emitter.d.ts
@@ -0,0 +1,19 @@
+// Type definitions for component-emitter v1.2.1
+// Project: https://www.npmjs.com/package/component-emitter
+// Definitions by: Peter Snider
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped/emitter-component
+
+
+interface Emitter {
+ (obj?: Object): Emitter;
+ on(event: string, listener: Function): Emitter;
+ once(event: string, listener: Function): Emitter;
+ off(event?: string, listener?: Function): Emitter;
+ emit(event: string, ...args: any[]): boolean;
+ listeners(event: string): Function[];
+ hasListeners(event: string): boolean;
+}
+
+declare module 'component-emitter' {
+ var Emitter: Emitter;
+}
diff --git a/connect-redis/connect-redis-tests.ts b/connect-redis/connect-redis-tests.ts
new file mode 100644
index 0000000000..abc14977ee
--- /dev/null
+++ b/connect-redis/connect-redis-tests.ts
@@ -0,0 +1,7 @@
+///
+///
+
+import * as connectRedis from "connect-redis";
+import * as session from "express-session";
+
+let RedisStore = connectRedis(session);
diff --git a/connect-redis/connect-redis.d.ts b/connect-redis/connect-redis.d.ts
new file mode 100644
index 0000000000..b3a1529569
--- /dev/null
+++ b/connect-redis/connect-redis.d.ts
@@ -0,0 +1,43 @@
+// Type definitions for connect-redis
+// Project: https://npmjs.com/package/connect-redis
+// Definitions by: Xavier Stouder
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+///
+///
+///
+
+declare module "connect-redis" {
+ import * as express from "express";
+ import * as session from "express-session";
+ import * as redis from "redis";
+
+
+ function s(options: (options?: session.SessionOptions) => express.RequestHandler): s.RedisStore;
+
+ namespace s {
+ interface RedisStore extends session.Store {
+ new (options: RedisStoreOptions): session.Store;
+ }
+ interface RedisStoreOptions {
+ client?: redis.RedisClient;
+ host?: string;
+ port?: number;
+ socket?: string;
+ url?: string;
+ ttl?: number;
+ disableTTL?: boolean;
+ db?: number;
+ pass?: string;
+ prefix?: string;
+ unref?: boolean;
+ serializer?: Serializer | JSON;
+ }
+ interface Serializer {
+ stringify: Function;
+ parse: Function;
+ }
+ }
+
+ export = s;
+}
diff --git a/cordova-plugin-ibeacon/cordova-plugin-ibeacon.d.ts b/cordova-plugin-ibeacon/cordova-plugin-ibeacon.d.ts
index 537ae00071..1c7a293716 100644
--- a/cordova-plugin-ibeacon/cordova-plugin-ibeacon.d.ts
+++ b/cordova-plugin-ibeacon/cordova-plugin-ibeacon.d.ts
@@ -16,7 +16,8 @@ declare namespace BeaconPlugin {
export interface LocationManager {
delegate: Delegate;
BeaconRegion: BeaconRegion;
- onDomDelegateReady(): void;
+ Region: Region;
+ onDomDelegateReady(): Q.Promise;
startMonitoringForRegion(region: Region): Q.Promise;
stopMonitoringForRegion(region: Region): Q.Promise;
requestStateForRegion(region: Region): Q.Promise;
diff --git a/cordova-plugin-x-socialsharing/cordova-plugin-x-socialsharing.d.ts b/cordova-plugin-x-socialsharing/cordova-plugin-x-socialsharing.d.ts
index a8dd93c586..d498a981be 100755
--- a/cordova-plugin-x-socialsharing/cordova-plugin-x-socialsharing.d.ts
+++ b/cordova-plugin-x-socialsharing/cordova-plugin-x-socialsharing.d.ts
@@ -9,6 +9,18 @@ interface Plugins {
declare module SocialSharingPlugin {
+ interface ShareOptions {
+ message: string;
+ subject?: string;
+ files?: string | string[];
+ url?: string;
+ }
+
+ interface ShareResult {
+ completed: boolean;
+ app: any;
+ }
+
export interface SocialSharing {
/**
@@ -23,6 +35,8 @@ declare module SocialSharingPlugin {
share(message: string, subject?: string, fileOrFileArray?: string | string[], url?: string, successCallback?: (succeeded: boolean) => void, errorCallback?: (errormsg: string) => void): void;
+ shareWithOptions(options: ShareOptions, successCallback?: (result: ShareResult) => void, errorCallback?: (errormsg: string) => void): void;
+
shareViaTwitter(message: string, file?: string, url?: string, successCallback?: (succeeded: boolean) => void, errorCallback?: (errormsg: string) => void): void;
shareViaFacebook(message: string, fileOrFileArray?: string | string[], url?: string, successCallback?: (succeeded: boolean) => void, errorCallback?: (errormsg: string) => void): void;
@@ -47,4 +61,4 @@ declare module SocialSharingPlugin {
saveToPhotoAlbum(fileOrFileArray: string | string[], successCallback?: (succeeded: boolean) => void, errorCallback?: (errormsg: string) => void): void;
}
-}
\ No newline at end of file
+}
diff --git a/cucumber/cucumber.d.ts b/cucumber/cucumber.d.ts
index d0e742d9c2..6c4273e4e0 100644
--- a/cucumber/cucumber.d.ts
+++ b/cucumber/cucumber.d.ts
@@ -29,8 +29,20 @@ declare namespace cucumber {
}
interface HookScenario{
- attach(text: string, mimeType?: string, callback?: (err?:any) => void): void;
- isFailed() : boolean;
+ getKeyword():string;
+ getName():string;
+ getDescription():string;
+ getUri():string;
+ getLine():number;
+ getTags():string[];
+ getException():Error;
+ getAttachments():any[];
+ attach(data:any, mimeType?:string, callback?:(err?:any) => void):void;
+ isSuccessful():boolean;
+ isFailed():boolean;
+ isPending():boolean;
+ isUndefined():boolean;
+ isSkipped():boolean;
}
interface HookCode {
diff --git a/d3/d3.d.ts b/d3/d3.d.ts
index 683fb8532c..b35d898522 100644
--- a/d3/d3.d.ts
+++ b/d3/d3.d.ts
@@ -292,17 +292,17 @@ declare namespace d3 {
*/
datum(): Datum;
- /**
- * Set the data item for each node in the selection.
- * @param value the constant element to use for each node
- */
- datum(value: NewDatum): Update;
-
/**
* Derive the data item for each node in the selection. Useful for situations such as the HTML5 'dataset' attribute.
* @param value the function to compute data for each node
*/
datum(value: (datum: Datum, index: number, outerIndex: number) => NewDatum): Update;
+
+ /**
+ * Set the data item for each node in the selection.
+ * @param value the constant element to use for each node
+ */
+ datum(value: NewDatum): Update;
/**
* Reorders nodes in the selection based on the given comparator. Nodes are re-inserted into the document once sorted.
@@ -1111,8 +1111,7 @@ declare namespace d3 {
export function deviation(array: number[]): number;
export function deviation(array: T[], accessor: (datum: T, index: number) => number): number;
- export function bisectLeft(array: number[], x: number, lo?: number, hi?: number): number;
- export function bisectLeft(array: string[], x: string, lo?: number, hi?: number): number;
+ export function bisectLeft(array: T[], x: T, lo?: number, hi?: number): number;
export var bisect: typeof bisectRight;
@@ -3064,6 +3063,8 @@ declare namespace d3 {
}
export interface Partition {
+ (root: T): T[];
+
nodes(root: T): T[];
links(nodes: T[]): partition.Link[];
diff --git a/d3kit/d3kit-tests.ts b/d3kit/d3kit-tests.ts
new file mode 100644
index 0000000000..1b8d2a24f9
--- /dev/null
+++ b/d3kit/d3kit-tests.ts
@@ -0,0 +1,1112 @@
+///
+///
+///
+///
+
+/* jshint expr: true */
+
+var expect = chai.expect;
+describe('Skeleton', function(){
+ var element: Element, $element: d3.Selection, $svg: d3.Selection, skeleton: d3kit.Skeleton;
+
+ beforeEach(function(done){
+ element = document.body.appendChild(document.createElement('div')) as Element;
+ skeleton = new d3kit.Skeleton(element, null, ['custom1', 'custom2']);
+ $element = d3.select(element);
+ $svg = $element.select('svg');
+ done();
+ });
+
+ describe('new Skeleton()', function(){
+ it('should create