diff --git a/acc-wizard/acc-wizard.ts.tscparams b/acc-wizard/acc-wizard.ts.tscparams
deleted file mode 100644
index 934bc29ef..000000000
--- a/acc-wizard/acc-wizard.ts.tscparams
+++ /dev/null
@@ -1 +0,0 @@
---noImplicitAny
\ No newline at end of file
diff --git a/amplifyjs/amplifyjs.d.ts b/amplifyjs/amplifyjs.d.ts
index 961d815c6..3eb8829e4 100644
--- a/amplifyjs/amplifyjs.d.ts
+++ b/amplifyjs/amplifyjs.d.ts
@@ -179,4 +179,4 @@ interface amplifyStatic {
}
declare var amplify: amplifyStatic;
-
+declare module "amplify" { export =amplify; }
diff --git a/angular-idle/angular-idle-tests.ts b/angular-idle/angular-idle-tests.ts
index fc39bf72a..e6eb1a9f2 100644
--- a/angular-idle/angular-idle-tests.ts
+++ b/angular-idle/angular-idle-tests.ts
@@ -1,23 +1,53 @@
///
angular.module('app', ['ngIdle'])
- .config(['$keepaliveProvider', '$idleProvider',
- ($keepaliveProvider: ng.idle.IKeepAliveProvider, $idleProvider: ng.idle.IIdleProvider) => {
- $idleProvider.activeOn('mousemove keydown DOMMouseScroll mousewheel mousedown');
- $idleProvider.idleDuration(5);
- $idleProvider.warningDuration(5);
- $idleProvider.keepalive(true)
- $idleProvider.autoResume(true);
- $keepaliveProvider.interval(10);
+ .config(['KeepaliveProvider', 'IdleProvider', 'TitleProvider',
+ (keepaliveProvider: angular.idle.IKeepAliveProvider, idleProvider: angular.idle.IIdleProvider,
+ titleProvider: angular.idle.ITitleProvider) => {
+ idleProvider.interrupt('mousemove keydown DOMMouseScroll mousewheel mousedown');
+ idleProvider.idle(5);
+ idleProvider.timeout(5);
+ idleProvider.keepalive(true)
+ idleProvider.autoResume(true);
+
+ const config: ng.IRequestConfig = {
+ url: "http://google.com",
+ method: "GET"
+ };
+
+ keepaliveProvider.http(config.url); // should accept string and ng.IRequestConfig
+ keepaliveProvider.http(config);
+ keepaliveProvider.interval(10);
+
+ titleProvider.enabled(true);
}])
- .run(['$keepalive', '$idle', ($keepalive: ng.idle.IKeepAliveService, $idle: ng.idle.IIdleService) => {
- $idle.watch();
-
- if ($idle.running() || $idle.idling()) {
- $idle.unwatch();
+ .run(['Keepalive', 'Idle', 'Title', (Keepalive: angular.idle.IKeepAliveService, Idle: angular.idle.IIdleService,
+ Title: angular.idle.ITitleService) => {
+ Idle.setTimeout(Idle.getTimeout());
+ Idle.setIdle(Idle.getIdle());
+
+ Idle.watch();
+ Idle.interrupt();
+
+ const expired: boolean = Idle.isExpired();
+
+ if (Idle.running() || Idle.idling()) {
+ Idle.unwatch();
}
-
- $keepalive.start();
- $keepalive.ping();
- $keepalive.stop();
+
+ Keepalive.start();
+ Keepalive.ping();
+ Keepalive.stop();
+ Keepalive.setInterval(10);
+
+ Title.setEnabled(Title.isEnabled());
+ Title.original(Title.original());
+ Title.value(Title.value());
+ Title.store(false);
+ Title.store();
+ Title.restore();
+ Title.idleMessage(Title.idleMessage());
+ Title.timedOutMessage(Title.timedOutMessage());
+ Title.setAsIdle(120);
+ Title.setAsTimedOut();
}]);
\ No newline at end of file
diff --git a/angular-idle/angular-idle.d.ts b/angular-idle/angular-idle.d.ts
index 4e1e98fb5..725beac67 100644
--- a/angular-idle/angular-idle.d.ts
+++ b/angular-idle/angular-idle.d.ts
@@ -1,4 +1,4 @@
-// Type definitions for ng-idle v0.3.5
+// Type definitions for ng-idle v1.1.1
// Project: http://hackedbychinese.github.io/ng-idle/
// Definitions by: mthamil
// Definitions: https://github.com/borisyankov/DefinitelyTyped
@@ -8,7 +8,99 @@
declare module angular.idle {
/**
- * Used to configure the $keepalive service.
+ * Used to configure the Title service.
+ */
+ interface ITitleProvider extends IServiceProvider {
+
+ /**
+ * Enables or disables the Title functionality.
+ *
+ * @param enabled Boolean, default is true.
+ */
+ enabled(enabled: boolean): void;
+ }
+
+ interface ITitleService {
+
+ /**
+ * Allows the title functionality to be enabled or disabled on the fly.
+ */
+ setEnabled(enabled: boolean): void;
+
+ /**
+ * Returns whether or not the title functionality has been enabled.
+ */
+ isEnabled(): boolean;
+
+ /**
+ * Will store val as the "original" title of the document.
+ *
+ * Tracking the original title is important when restoring the title after displaying, for example, the idle warning message.
+ */
+ original(val: string): void;
+
+ /**
+ * Returns the "original" title value that has been previously set.
+ *
+ * Tracking the original title is important when restoring the title after displaying, for example, the idle warning message.
+ */
+ original(): string;
+
+ /**
+ * Changes the actual title of the document.
+ */
+ value(val: string): void;
+
+ /**
+ * Returns the current document title.
+ */
+ value(): string;
+
+ /**
+ * If overwrite is false or unspecified, updates the "original" title with the current document title
+ * if it has not already been stored. If overwrite is true, the current document title is stored regardless.
+ */
+ store(overwrite?: boolean): void;
+
+ /**
+ * Sets the title to the original value (if it was stored or set previously).
+ */
+ restore(): void;
+
+ /**
+ * Sets the text to use as the message displayed when the user is idle.
+ */
+ idleMessage(val: string): void;
+
+ /**
+ * Gets the text to use as the message displayed when the user is idle.
+ */
+ idleMessage(): string;
+
+ /**
+ * Sets the text to use as the message displayed when the user is timed out.
+ */
+ timedOutMessage(val: string): void;
+
+ /**
+ * Gets the text to use as the message displayed when the user is timed out.
+ */
+ timedOutMessage(): string;
+
+ /**
+ * Stores the original title if it hasn't been already, determines the number minutes, seconds,
+ * and total seconds from countdown, and displays the idleMessage with the aforementioned values interpolated.
+ */
+ setAsIdle(countdown: number): void;
+
+ /**
+ * Stores the original title if it hasn't been already, and displays the timedOutMessage.
+ */
+ setAsTimedOut(): void;
+ }
+
+ /**
+ * Used to configure the Keepalive service.
*/
interface IKeepAliveProvider extends IServiceProvider {
@@ -18,24 +110,24 @@ declare module angular.idle {
* You can specify a string, which it will assume to be a URL to a simple GET request.
* Otherwise, you can use the same options $http takes. However, cache will always be false.
*
- * @param value May be string or object, default is null.
+ * @param value May be string or IRequestConfig, default is null.
*/
- http(value: any): void;
+ http(value: string | IRequestConfig): void;
/**
* This specifies how often the keepalive event is triggered and the
* HTTP request is issued.
*
- * @param seconds Integer, default is 5 minutes. Must be greater than 0.
+ * @param seconds Integer, default is 10 minutes. Must be greater than 0.
*/
interval(seconds: number): void;
}
/**
- * $keepalive will use a timeout to periodically wake, broadcast a $keepalive event on the root scope,
- * and optionally make an $http request. By default, the $idle service will stop and start $keepalive
+ * Keepalive will use a timeout to periodically wake, broadcast a Keepalive event on the root scope,
+ * and optionally make an $http request. By default, the Idle service will stop and start Keepalive
* when a user becomes idle or returns from idle, respectively. It is also started automatically when
- * $idle.watch() is called. This can be disabled by configuring the $idleProvider.
+ * Idle.watch() is called. This can be disabled by configuring the IdleProvider.
*/
interface IKeepAliveService {
@@ -53,20 +145,25 @@ declare module angular.idle {
* Performs one ping only.
*/
ping(): void;
+
+ /**
+ * Changes the interval value at runtime.
+ * You will need to restart the pinging process by calling start() manually for the changes to be reflected.
+ */
+ setInterval(seconds: number): void;
}
/**
- * Used to configure the $idle service.
+ * Used to configure the Idle service.
*/
interface IIdleProvider extends IServiceProvider {
-
/**
* Specifies the DOM events the service will watch to reset the idle timeout.
* Multiple events should be separated by a space.
*
* @param events string, default 'mousemove keydown DOMMouseScroll mousewheel mousedown'
*/
- activeOn(events: string): void;
+ interrupt(events: string): void;
/**
* The idle timeout duration in seconds. After this amount of time passes without the user
@@ -75,7 +172,7 @@ declare module angular.idle {
*
* @param seconds integer, default is 20min
*/
- idleDuration(seconds: number): void;
+ idle(seconds: number): void;
/**
* The amount of time the user has to respond (in seconds) before they have been considered
@@ -83,19 +180,20 @@ declare module angular.idle {
*
* @param seconds integer, default is 30s
*/
- warningDuration(seconds: number): void;
+ timeout(seconds: number): void;
/**
- * When true, user activity will automatically interrupt the warning countdown and reset the
- * idle state. If false, you will need to manually call watch() when you want to start
- * watching for idleness again.
+ * When true or idle, user activity will automatically interrupt the warning countdown
+ * and reset the idle state. If false or off, you will need to manually call watch()
+ * when you want to start watching for idleness again. If notIdle, user activity will
+ * only automatically interrupt if the user is not yet idle.
*
- * @param enabled boolean, default is true
+ * @param enabled boolean or string, possible values: off/false, idle/true, or notIdle
*/
- autoResume(enabled: boolean): void;
+ autoResume(enabled: boolean | string): void;
/**
- * When true, the $keepalive service is automatically stopped and started as needed.
+ * When true, the Keepalive service is automatically stopped and started as needed.
*
* @param enabled boolean, default is true
*/
@@ -103,13 +201,39 @@ declare module angular.idle {
}
/**
- * $idle, once watch() is called, will start a timeout which if expires, will enter a warning state
+ * Idle, once watch() is called, will start a timeout which if expires, will enter a warning state
* countdown. Once the countdown reaches zero, idle will broadcast a timeout event indicating the
* user has timed out (where your app should log them out or whatever you like). If the user performs
* an action that triggers a watched DOM event that bubbles up to document.body, this will reset the
* idle/warning state and start the process over again.
*/
interface IIdleService {
+ /**
+ * Gets the current idle value
+ */
+ getIdle(): number;
+
+ /**
+ * Gets the current timeout value
+ */
+ getTimeout(): number;
+
+ /**
+ * Updates the idle value (see IdleProvider.idle()) and
+ * restarts the watch if its running.
+ */
+ setIdle(idle: number): void;
+
+ /**
+ * Updates the timeout value (see IdleProvider.timeout()) and
+ * restarts the watch if its running.
+ */
+ setTimeout(timeout: number): void;
+
+ /**
+ * Whether user has timed out (meaning idleDuration + timeout has passed without any activity)
+ */
+ isExpired(): boolean;
/**
* Whether or not the watch() has been called and it is watching for idleness.
@@ -130,5 +254,10 @@ declare module angular.idle {
* Stops watching for idleness, and resets the idle/warning state.
*/
unwatch(): void;
+
+ /**
+ * Manually trigger the idle interrupt that normally occurs during user activity.
+ */
+ interrupt(): any;
}
}
diff --git a/angular-meteor/angular-meteor.d.ts b/angular-meteor/angular-meteor.d.ts
index 6df5bc63d..e536e3203 100644
--- a/angular-meteor/angular-meteor.d.ts
+++ b/angular-meteor/angular-meteor.d.ts
@@ -51,6 +51,16 @@ declare module angular.meteor {
* @return This method returns this, which the the reactive context, in order to provide the ability to chain the logic.
*/
helpers(definitions : { [helperName : string] : () => Mongo.Cursor }): IScope;
+
+ /**
+ * This method is a wrapper of Tracker.autorun and shares exactly the same API.
+ * The autorun method is part of the ReactiveContext, and available on every context and $scope.
+ * The argument of this method is a callback, which will be called each time Autorun will be used.
+ * The Autorun will stop automatically when when it's context ($scope) is destroyed.
+ *
+ * @param runFunc - The function to run. It receives one argument: the Computation object that will be returned.
+ */
+ autorun(runFunc : () => void) : Tracker.Computation;
}
/**
diff --git a/angular-toastr/angular-toastr.d.ts b/angular-toastr/angular-toastr.d.ts
index 96e8e78cc..698b88634 100644
--- a/angular-toastr/angular-toastr.d.ts
+++ b/angular-toastr/angular-toastr.d.ts
@@ -10,27 +10,27 @@ declare module "angular-toastr" {
export = _;
}
-interface IToastBaseConfig {
- allowHtml?: boolean;
- closeButton?: boolean;
- closeHtml?: string;
- extendedTimeOut?: number;
- messageClass?: string;
- onHidden?: Function;
- onShown?: Function;
- onTap?: Function;
- progressBar?: boolean;
- tapToDismiss?: boolean;
- templates?: {
- toast?: string;
- progressbar?: string;
- };
- timeOut?: number;
- titleClass?: string;
- toastClass?: string;
-}
-
declare module angular.toastr {
+ interface IToastBaseConfig {
+ allowHtml?: boolean;
+ closeButton?: boolean;
+ closeHtml?: string;
+ extendedTimeOut?: number;
+ messageClass?: string;
+ onHidden?: Function;
+ onShown?: Function;
+ onTap?: Function;
+ progressBar?: boolean;
+ tapToDismiss?: boolean;
+ templates?: {
+ toast?: string;
+ progressbar?: string;
+ };
+ timeOut?: number;
+ titleClass?: string;
+ toastClass?: string;
+ }
+
interface IToastContainerConfig {
autoDismiss?: boolean;
containerId?: string;
diff --git a/angular-translate/angular-translate-tests.ts b/angular-translate/angular-translate-tests.ts
index a19d27ade..8ef1ab2e3 100644
--- a/angular-translate/angular-translate-tests.ts
+++ b/angular-translate/angular-translate-tests.ts
@@ -26,6 +26,7 @@ app.config(($translateProvider: angular.translate.ITranslateProvider) => {
$translateProvider.preferredLanguage('en');
$translateProvider.useLoader('customLoader');
+ $translateProvider.forceAsyncReload(true);
});
interface Scope extends ng.IScope {
diff --git a/angular-translate/angular-translate.d.ts b/angular-translate/angular-translate.d.ts
index 960012a57..379bd05ec 100644
--- a/angular-translate/angular-translate.d.ts
+++ b/angular-translate/angular-translate.d.ts
@@ -87,6 +87,7 @@ declare module angular.translate {
fallbackLanguage(): ITranslateProvider;
fallbackLanguage(language: string): ITranslateProvider;
fallbackLanguage(languages: string[]): ITranslateProvider;
+ forceAsyncReload(value: boolean): ITranslateProvider;
use(): string;
use(key: string): ITranslateProvider;
storageKey(): string;
diff --git a/angular-ui-router/angular-ui-router.d.ts b/angular-ui-router/angular-ui-router.d.ts
index 324ec676c..d5a52ff73 100644
--- a/angular-ui-router/angular-ui-router.d.ts
+++ b/angular-ui-router/angular-ui-router.d.ts
@@ -257,6 +257,7 @@ declare module angular.ui {
transitionTo(state: string, params?: {}, options?: IStateOptions): angular.IPromise;
transitionTo(state: IState, params?: {}, options?: IStateOptions): angular.IPromise;
includes(state: string, params?: {}): boolean;
+ includes(state: string, params?: {}, options?:any): boolean;
is(state:string, params?: {}): boolean;
is(state: IState, params?: {}): boolean;
href(state: IState, params?: {}, options?: IHrefOptions): string;
diff --git a/angularjs/angular-component-router.d.ts b/angularjs/angular-component-router.d.ts
index da93596ca..228db1e01 100644
--- a/angularjs/angular-component-router.d.ts
+++ b/angularjs/angular-component-router.d.ts
@@ -36,6 +36,9 @@ declare module angular {
* ```
*/
interface Instruction {
+ component: ComponentInstruction;
+ child: Instruction;
+ auxInstruction: {[key: string]: Instruction};
urlPath(): string;
diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts
index 14ccdbf04..d1197dec1 100644
--- a/angularjs/angular.d.ts
+++ b/angularjs/angular.d.ts
@@ -1876,6 +1876,7 @@ declare module angular {
provider(name: string, provider: IServiceProvider): IServiceProvider;
provider(name: string, serviceProviderConstructor: Function): IServiceProvider;
service(name: string, constructor: Function): IServiceProvider;
+ service(name: string, inlineAnnotatedFunction: any[]): IServiceProvider;
value(name: string, value: any): IServiceProvider;
}
diff --git a/any-db/any-db.d.ts b/any-db/any-db.d.ts
index 04817623a..f14befb20 100644
--- a/any-db/any-db.d.ts
+++ b/any-db/any-db.d.ts
@@ -50,7 +50,7 @@ declare module "any-db" {
/**
* Result rows
*/
- rows: Object[];
+ rows: any[];
/**
* Result field descriptions
*/
diff --git a/autobahn/autobahn.d.ts b/autobahn/autobahn.d.ts
index 6debcca7c..7d5589dad 100644
--- a/autobahn/autobahn.d.ts
+++ b/autobahn/autobahn.d.ts
@@ -4,7 +4,6 @@
// Definitions: https://github.com/borisyankov/DefinitelyTyped
///
-///
declare module autobahn {
@@ -194,7 +193,7 @@ declare module autobahn {
type: string;
}
- type DeferFactory = () => JQueryPromise;
+ type DeferFactory = () => When.Promise;
type OnChallengeHandler = (session: Session, method: string, extra: any) => When.Promise;
diff --git a/aws-sdk/aws-sdk.d.ts b/aws-sdk/aws-sdk.d.ts
index f89059463..b482cad48 100644
--- a/aws-sdk/aws-sdk.d.ts
+++ b/aws-sdk/aws-sdk.d.ts
@@ -56,6 +56,7 @@ declare module "aws-sdk" {
directconnect?: any;
dynamodb?: any;
ec2?: any;
+ ecs?: any;
elasticache?: any;
elasticbeanstalk?: any;
elastictranscoder?: any;
@@ -147,7 +148,18 @@ declare module "aws-sdk" {
export class S3 {
constructor(options?: any);
- public client: s3.Client;
+ putObject(params: s3.PutObjectRequest, callback: (err: any, data: any) => void): void;
+ getObject(params: s3.GetObjectRequest, callback: (err: any, data: any) => void): void;
+ }
+
+ export class ECS {
+ constructor(options?: any);
+
+ createService(params: ecs.CreateServicesParams, callback: (err: any, data: any) => void): void;
+ describeServices(params: ecs.DescribeServicesParams, callback: (err: any, data: any) => void): void;
+ describeTaskDefinition(params: ecs.DescribeTaskDefinitionParams, callback: (err: any, data: any) => void): void;
+ registerTaskDefinition(params: ecs.RegisterTaskDefinitionParams, callback: (err: any, data: any) => void): void;
+ updateService(params: ecs.UpdateServiceParams, callback: (err: any, data: any) => void): void;
}
export class DynamoDB {
@@ -1042,14 +1054,7 @@ declare module "aws-sdk" {
}
export module s3 {
-
- export interface Client {
- config: ClientConfig;
-
- putObject(params: PutObjectRequest, callback: (err: any, data: any) => void): void;
- getObject(params: GetObjectRequest, callback: (err: any, data: any) => void): void;
- }
-
+
export interface PutObjectRequest {
ACL?: string;
Body?: any;
@@ -1091,4 +1096,102 @@ declare module "aws-sdk" {
}
}
+
+ export module ecs {
+ export interface CreateServicesParams {
+ desiredCount: number;
+ serviceName: string;
+ taskDefinition: string;
+ clientToken?: string;
+ cluster?: string;
+ deploymentConfiguration?: {
+ maximumPercent?: number;
+ minimumHealthyPercent?: number;
+ };
+ loadBalancers?: {
+ containerName?: string;
+ containerPort?: number;
+ loadBalancerName?: string;
+ }[];
+ role?: string;
+ }
+
+ export interface DescribeServicesParams {
+ services: string[];
+ cluster: string;
+ }
+
+ export interface DescribeTaskDefinitionParams {
+ taskDefinition: string;
+ }
+
+ export interface RegisterTaskDefinitionParams {
+ containerDefinitions: {
+ command?: string[],
+ cpu?: number,
+ disableNetworking?: boolean,
+ dnsSearchDomains?: string[],
+ dnsServers?: string[],
+ dockerLabels?: any,
+ dockerSecurityOptions?: string[],
+ entryPoint?: string[],
+ environment?: any[],
+ essential?: boolean,
+ extraHosts?: {
+ hostName: string,
+ ipAddress: string
+ }[];
+ hostname?: string,
+ image?: string,
+ links?: string[],
+ logConfiguration?: {
+ logDriver: string,
+ options: any
+ }[],
+ memory?: number,
+ mountPoints?: {
+ containerPath: string,
+ readOnly: boolean,
+ sourceVolume: string
+ }[];
+ name?: string,
+ portMappings?: {
+ containerPort?: number,
+ hostPort?: number,
+ protocol: string
+ }[];
+ privileged?: boolean,
+ readonlyRootFilesystem?: boolean,
+ ulimits?: {
+ hardLimit: number,
+ name: string,
+ softLimit: number
+ }[];
+ user?: string,
+ volumesFrom?: {
+ readOnly?: boolean,
+ sourceContainer?: string
+ }[],
+ workingDirectory?: string
+ }[];
+ family: string;
+ volumes?: {
+ host: {
+ sourcePath: string
+ },
+ name: string
+ }[];
+ }
+
+ export interface UpdateServiceParams {
+ service: string;
+ cluster?: string;
+ deploymentConfiguration?: {
+ maximumPercent: number;
+ minimumHealthyPercent: number;
+ };
+ desiredCount?: number;
+ taskDefinition: string;
+ }
+ }
}
diff --git a/axios/axios-tests.ts b/axios/axios-tests.ts
index 3f692307a..184292c92 100644
--- a/axios/axios-tests.ts
+++ b/axios/axios-tests.ts
@@ -8,21 +8,64 @@ interface Repository {
name: string;
}
+interface Issue {
+ id: number;
+ title: string;
+}
+
+axios.interceptors.request.use(config => {
+ console.log("Method:" + config.method + " Url:" +config.url);
+ return config;
+});
+
+axios.interceptors.response.use(config => {
+ console.log("Status:" + config.status);
+ return config;
+});
+
axios.get("https://api.github.com/repos/mzabriskie/axios")
.then(r => console.log(r.config.method));
-axios({
+var getRepoDetails = axios({
url: "https://api.github.com/repos/mzabriskie/axios",
method: HttpMethod[HttpMethod.GET],
headers: {},
-}).then(r => console.log("ID:" + r.data.id + " Name: " + r.data.name));
+}).then(r => {
+ console.log("ID:" + r.data.id + " Name: " + r.data.name);
+ return r;
+});
axios.post("http://example.com/", {}, {
transformRequest: (data: any) => data
});
-axios.post("http://example.com/", {}, {
+axios.post("http://example.com/", {
+ headers: {'X-Custom-Header': 'foobar'}
+}, {
transformRequest: [
(data: any) => data
]
});
+
+var getRepoIssue = axios.get("https://api.github.com/repos/mzabriskie/axios/issues/1");
+
+var axiosInstance = axios.create({
+ baseURL: "https://api.github.com/repos/mzabriskie/axios/",
+ timeout: 1000
+});
+
+axiosInstance.request({url: "issues/1"});
+
+axios.all([getRepoDetails, getRepoDetails]).then(([repo1, repo2]) => {
+ var sumIds = repo1.data.id + repo2.data.id;
+ console.log("Sum ID:" + sumIds);
+ return sumIds;
+});
+
+var repoSum = (repo1: Axios.AxiosXHR, repo2: Axios.AxiosXHR) => {
+ var sumIds = repo1.data.id + repo2.data.id;
+ console.log("Sum ID:" + sumIds);
+ return sumIds;
+};
+
+axios.all([getRepoDetails, getRepoDetails]).then(axios.spread(repoSum));
diff --git a/axios/axios.d.ts b/axios/axios.d.ts
index 48f57a73a..7348ec651 100644
--- a/axios/axios.d.ts
+++ b/axios/axios.d.ts
@@ -1,162 +1,276 @@
-// Type definitions for axios 0.5.2
+// Type definitions for axios 0.8.1
// Project: https://github.com/mzabriskie/axios
// Definitions by: Marcel Buesing
// Definitions: https://github.com/borisyankov/DefinitelyTyped
-///
-
declare module Axios {
- /**
- * - request body data type
- */
- interface AxiosXHRConfigBase {
+ interface IThenable {
+ then(onFulfilled?: (value: R) => U | IThenable, onRejected?: (error: any) => U | IThenable): IThenable;
+ then(onFulfilled?: (value: R) => U | IThenable, onRejected?: (error: any) => void): IThenable;
+ }
+
+ interface IPromise extends IThenable {
+ then(onFulfilled?: (value: R) => U | IThenable, onRejected?: (error: any) => U | IThenable): IPromise;
+ then(onFulfilled?: (value: R) => U | IThenable, onRejected?: (error: any) => void): IPromise;
+ catch(onRejected?: (error: any) => U | IThenable): IPromise;
+ }
/**
- * Change the request data before it is sent to the server.
- * This is only applicable for request methods 'PUT', 'POST', and 'PATCH'
- * The last function in the array must return a string or an ArrayBuffer
+ * HTTP Basic auth details
*/
- transformRequest?: ((data:T) => U)|[(data:T) => U];
+ interface AxiosHttpBasicAuth {
+ username: string;
+ password: string;
+ }
/**
- * change the response data to be made before it is passed to then/catch
+ * Common axios XHR config interface
+ * - request body data type
*/
- transformResponse?: (data:T) => U;
+ interface AxiosXHRConfigBase {
+ /**
+ * will be prepended to `url` unless `url` is absolute.
+ * It can be convenient to set `baseURL` for an instance
+ * of axios to pass relative URLs to methods of that instance.
+ */
+ baseURL?: string;
+
+ /**
+ * custom headers to be sent
+ */
+ headers?: Object;
+
+ /**
+ * URL parameters to be sent with the request
+ */
+ params?: Object;
+
+ /**
+ * optional function in charge of serializing `params`
+ * (e.g. https://www.npmjs.com/package/qs, http://api.jquery.com/jquery.param/)
+ */
+ paramsSerializer?: (params: Object) => string;
+
+ /**
+ * specifies the number of milliseconds before the request times out.
+ * If the request takes longer than `timeout`, the request will be aborted.
+ */
+ timeout?: number;
+
+ /**
+ * indicates whether or not cross-site Access-Control requests
+ * should be made using credentials
+ */
+ withCredentials?: boolean;
+
+ /**
+ * indicates that HTTP Basic auth should be used, and supplies
+ * credentials. This will set an `Authorization` header,
+ * overwriting any existing `Authorization` custom headers you have
+ * set using `headers`.
+ */
+ auth?: AxiosHttpBasicAuth;
+
+ /**
+ * indicates the type of data that the server will respond with
+ * options are 'arraybuffer', 'blob', 'document', 'json', 'text'
+ */
+ responseType?: string;
+
+ /**
+ * name of the cookie to use as a value for xsrf token
+ */
+ xsrfCookieName?: string;
+
+ /**
+ * name of the http header that carries the xsrf token value
+ */
+ xsrfHeaderName?: string;
+
+ /**
+ * Change the request data before it is sent to the server.
+ * This is only applicable for request methods 'PUT', 'POST', and 'PATCH'
+ * The last function in the array must return a string or an ArrayBuffer
+ */
+ transformRequest?: ((data: T) => U) | [(data: T) => U];
+
+ /**
+ * change the response data to be made before it is passed to then/catch
+ */
+ transformResponse?: (data: T) => U;
+ }
/**
- * custom headers to be sent
+ * - request body data type
*/
- headers?: Object;
+ interface AxiosXHRConfig extends AxiosXHRConfigBase {
+ /**
+ * server URL that will be used for the request, options are:
+ * GET, PUT, POST, DELETE, CONNECT, HEAD, OPTIONS, TRACE, PATCH
+ */
+ url: string;
+
+ /**
+ * request method to be used when making the request
+ */
+ method?: string;
+
+ /**
+ * data to be sent as the request body
+ * Only applicable for request methods 'PUT', 'POST', and 'PATCH'
+ * When no `transformRequest` is set, must be a string, an ArrayBuffer or a hash
+ */
+ data?: T;
+ }
/**
- * URL parameters to be sent with the request
+ * - expected response type,
+ * - request body data type
*/
- params?: Object;
+ interface AxiosXHR {
+ /**
+ * Response that was provided by the server
+ */
+ data: T;
+
+ /**
+ * HTTP status code from the server response
+ */
+ status: number;
+
+ /**
+ * HTTP status message from the server response
+ */
+ statusText: string;
+
+ /**
+ * headers that the server responded with
+ */
+ headers: Object;
+
+ /**
+ * config that was provided to `axios` for the request
+ */
+ config: AxiosXHRConfig;
+ }
+
+ interface Interceptor {
+ /**
+ * intercept request before it is sent
+ */
+ request: RequestInterceptor;
+
+ /**
+ * intercept response of request when it is received.
+ */
+ response: ResponseInterceptor
+ }
+
+ interface RequestInterceptor {
+ /**
+ * - request body data type
+ */
+ use(fn: (config: AxiosXHRConfig) => AxiosXHRConfig): void;
+ }
+
+ interface ResponseInterceptor {
+ /**
+ * - expected response type
+ */
+ use(fn: (config: AxiosXHR) => AxiosXHR): void;
+ }
/**
- * indicates whether or not cross-site Access-Control requests
- * should be made using credentials
+ * - expected response type,
+ * - request body data type
*/
- withCredentials?: boolean;
+ interface AxiosInstance {
+
+ /**
+ * Send request as configured
+ */
+ (config: AxiosXHRConfig): IPromise>;
+
+ /**
+ * Send request as configured
+ */
+ new (config: AxiosXHRConfig): IPromise>;
+
+ /**
+ * Send request as configured
+ */
+ request(config: AxiosXHRConfig): IPromise>;
+
+ /**
+ * intercept requests or responses before they are handled by then or catch
+ */
+ interceptors: Interceptor;
+
+ /**
+ * equivalent to `Promise.all`
+ */
+ all(values: [T1 | IPromise>, T2 | IPromise>, T3 | IPromise>, T4 | IPromise>, T5 | IPromise>, T6 | IPromise>, T7 | IPromise>, T8 | IPromise>, T9 | IPromise>, T10 | IPromise>]): IPromise<[AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR]>;
+ all(values: [T1 | IPromise>, T2 | IPromise>, T3 | IPromise>, T4 | IPromise>, T5 | IPromise>, T6 | IPromise>, T7 | IPromise>, T8 | IPromise>, T9 | IPromise>]): IPromise<[AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR]>;
+ all(values: [T1 | IPromise>, T2 | IPromise>, T3 | IPromise>, T4 | IPromise>, T5 | IPromise>, T6 | IPromise>, T7 | IPromise>, T8 | IPromise>]): IPromise<[AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR]>;
+ all(values: [T1 | IPromise>, T2 | IPromise>, T3 | IPromise>, T4 | IPromise>, T5 | IPromise>, T6 | IPromise>, T7 | IPromise>]): IPromise<[AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR]>;
+ all(values: [T1 | IPromise>, T2 | IPromise>, T3 | IPromise>, T4 | IPromise>, T5 | IPromise>, T6 | IPromise>]): IPromise<[AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR]>;
+ all(values: [T1 | IPromise>, T2 | IPromise>, T3 | IPromise>, T4 | IPromise>, T5 | IPromise>]): IPromise<[AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR]>;
+ all(values: [T1 | IPromise>, T2 | IPromise>, T3 | IPromise>, T4 | IPromise>]): IPromise<[AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR]>;
+ all(values: [T1 | IPromise>, T2 | IPromise>, T3 | IPromise>]): IPromise<[AxiosXHR, AxiosXHR, AxiosXHR]>;
+ all(values: [T1 | IPromise>, T2 | IPromise>]): IPromise<[AxiosXHR, AxiosXHR]>;
+
+ /**
+ * spread array parameter to `fn`.
+ * note: alternative to `spread`, destructuring assignment.
+ */
+ spread(fn: (t1: T1, t2: T2) => U): (arr: ([T1, T2])) => U;
+
+ /**
+ * convenience alias, method = GET
+ */
+ get(url: string, config?: AxiosXHRConfigBase): IPromise>;
+
+
+ /**
+ * convenience alias, method = DELETE
+ */
+ delete(url: string, config?: AxiosXHRConfigBase): IPromise>;
+
+ /**
+ * convenience alias, method = HEAD
+ */
+ head(url: string, config?: AxiosXHRConfigBase): IPromise>;
+
+ /**
+ * convenience alias, method = POST
+ */
+ post(url: string, data?: any, config?: AxiosXHRConfigBase): IPromise>;
+
+ /**
+ * convenience alias, method = PUT
+ */
+ put(url: string, data?: any, config?: AxiosXHRConfigBase): IPromise>;
+
+ /**
+ * convenience alias, method = PATCH
+ */
+ patch(url: string, data?: any, config?: AxiosXHRConfigBase): IPromise>;
+ }
/**
- * indicates the type of data that the server will respond with
- * options are 'arraybuffer', 'blob', 'document', 'json', 'text'
+ * - expected response type,
*/
- responseType?: string;
-
- /**
- * name of the cookie to use as a value for xsrf token
- */
- xsrfCookieName?: string;
-
- /**
- * name of the http header that carries the xsrf token value
- */
- xsrfHeaderName?: string;
-
- }
-
- /**
- * - request body data type
- */
- interface AxiosXHRConfig extends AxiosXHRConfigBase {
- /**
- * server URL that will be used for the request, options are:
- * GET, PUT, POST, DELETE, CONNECT, HEAD, OPTIONS, TRACE, PATCH
- */
- url: string;
-
- /**
- * request method to be used when making the request
- */
- method?: string;
-
- /**
- * data to be sent as the request body
- * Only applicable for request methods 'PUT', 'POST', and 'PATCH'
- * When no `transformRequest` is set, must be a string, an ArrayBuffer or a hash
- */
- data?: T;
- }
-
- /**
- * - expected response type,
- * - request body data type
- */
- interface AxiosXHR {
- /**
- * Response that was provided by the server
- */
- data: T;
-
- /**
- * HTTP status code from the server response
- */
- status: number;
-
- /**
- * HTTP status message from the server response
- */
- statusText: string;
-
- /**
- * headers that the server responded with
- */
- headers: Object;
-
- /**
- * config that was provided to `axios` for the request
- */
- config: AxiosXHRConfig;
- }
-
- /**
- * - expected response type,
- * - request body data type
- */
- interface AxiosStatic {
-
- (config: AxiosXHRConfig): Promise>;
-
- new (config: AxiosXHRConfig): Promise>;
-
- /**
- * convenience alias, method = GET
- */
- get(url: string, config?: AxiosXHRConfigBase): Promise>;
-
-
- /**
- * convenience alias, method = DELETE
- */
- delete(url: string, config?: AxiosXHRConfigBase): Promise>;
-
- /**
- * convenience alias, method = HEAD
- */
- head(url: string, config?: AxiosXHRConfigBase): Promise>;
-
- /**
- * convenience alias, method = POST
- */
- post(url: string, data?: any, config?: AxiosXHRConfigBase): Promise>;
-
- /**
- * convenience alias, method = PUT
- */
- put(url: string, data?: any, config?: AxiosXHRConfigBase): Promise>;
-
- /**
- * convenience alias, method = PATCH
- */
- patch(url: string, data?: any, config?: AxiosXHRConfigBase): Promise>;
- }
+ interface AxiosStatic extends AxiosInstance {
+ /**
+ * create a new instance of axios with a custom config
+ */
+ create(config: AxiosXHRConfigBase): AxiosInstance;
+ }
}
declare var axios: Axios.AxiosStatic;
declare module "axios" {
- export = axios;
+ export = axios;
}
diff --git a/azure-mobile-apps/azure-mobile-apps-tests.ts b/azure-mobile-apps/azure-mobile-apps-tests.ts
new file mode 100644
index 000000000..093932c2f
--- /dev/null
+++ b/azure-mobile-apps/azure-mobile-apps-tests.ts
@@ -0,0 +1,87 @@
+///
+
+import express = require('express');
+import mobileApps = require('azure-mobile-apps');
+import logger = require('azure-mobile-apps/src/logger');
+import queries = require('azure-mobile-apps/src/query');
+
+var app = express(),
+ mobileApp = mobileApps();
+
+// various configuration permutations
+mobileApps({
+ debug: true,
+ data: {
+ provider: 'mssql',
+ server: '',
+ user: '',
+ database: '',
+ password: ''
+ }
+});
+
+mobileApps({
+ data: {
+ provider: 'memory'
+ }
+})
+
+// it would be nice to integrate with winston
+mobileApps({ logging: { level: 'silly', transports: [{}] } })
+
+// various custom middleware syntaxes
+mobileApp.use(function (req: any, res: any, next: any) { next(); });
+mobileApp.use([function () {}, function () {}]);
+mobileApp.use(function () {}, function () {});
+mobileApp.use(function () {}).use(function () {});
+
+// basic syntax for tables and api
+mobileApp.tables.add('todoitem');
+mobileApp.tables.add('todoitem', { authorize: true });
+mobileApp.tables.add('todoitem', mobileApps.table());
+mobileApp.tables.import('tables');
+mobileApp.api.add('api', { authorize: true, get: function () {}, delete: function () {} });
+mobileApp.api.import('api');
+
+// Express.Table, instantiated from the mobile app
+var table = mobileApp.table()
+table.use(function (req: Express.Request, res: Express.Response, next: any) {
+ next(new Error());
+});
+table.use([function () {}, function () {}]);
+table.read(function (context: Azure.MobileApps.Context) {
+ context.query.where({ p1: 'test' });
+ return context.execute()
+ .then(function (result: any) {
+ return result;
+ })
+ .catch(function (error: any) { })
+ .then(function () {});
+});
+table.insert(function (context: Azure.MobileApps.Context) {
+ context.query.id = 'anotherId';
+ context.query.single = true;
+ context.item.userId = context.user.id;
+ context.push.send('tag', {}, function (error, result) {});
+ context.push.gcm.send('tag', {}, function (error, result) {});
+ context.push.apns.send('tag', { payload: { } }, function (error, result) {});
+ context.push.wns.sendToastText01('tag', '', { headers: { } }, function (error, result) {});
+});
+table.read.use(function () {});
+table.read.use([function () {}, function () {}]);
+table.read.use(function () {}, function () {});
+table.use(function () {}).use(function () {}).read(function () {}).use(function () {})
+
+// Express.Table, instantiated from the static require('azure-mobile-apps').table()
+// This is going to be interesting if we ever support more than one provider
+var table2 = mobileApps.table();
+table2.read(function (context: Azure.MobileApps.Context) {})
+
+// Logger
+logger.silly('test', 'message');
+logger.error('Something happened', new Error());
+mobileApps.logger.debug('a debug message')
+
+// Query
+queries.create('table').where({ x: 10 }).select('col1,col2');
+mobileApps.query.create('table');
\ No newline at end of file
diff --git a/azure-mobile-apps/azure-mobile-apps.d.ts b/azure-mobile-apps/azure-mobile-apps.d.ts
new file mode 100644
index 000000000..5441515fe
--- /dev/null
+++ b/azure-mobile-apps/azure-mobile-apps.d.ts
@@ -0,0 +1,279 @@
+// Type definitions for azure-mobile-apps v2.0.0-beta3
+// Project: https://github.com/Azure/azure-mobile-apps-node/
+// Definitions by: Microsoft Azure
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+///
+///
+
+declare module "azure-mobile-apps" {
+ interface AzureMobileApps {
+ (configuration?: Azure.MobileApps.Configuration): Azure.MobileApps.Platforms.Express.MobileApp;
+ table(): Azure.MobileApps.Platforms.Express.Table;
+ logger: Azure.MobileApps.Logger;
+ query: Azure.MobileApps.Query;
+ }
+
+ var out: AzureMobileApps;
+ export = out;
+}
+declare module "azure-mobile-apps/src/logger" {
+ var logger: Azure.MobileApps.Logger;
+ export = logger;
+}
+
+declare module "azure-mobile-apps/src/query" {
+ var query: Azure.MobileApps.Query;
+ export = query;
+}
+
+declare module Azure.MobileApps {
+ // the additional Platforms namespace is required to avoid collisions with the main Express namespace
+ export module Platforms {
+ export module Express {
+ interface MobileApp {
+ configuration: Configuration;
+ tables: Tables;
+ table(): Table;
+ api: Api;
+ use(...middleware: Middleware[]): MobileApp;
+ use(middleware: Middleware[]): MobileApp;
+ }
+
+ interface Api {
+ add(name: string, definition: ApiDefinition): void;
+ import(fileOrFolder: string): void;
+ }
+
+ interface Table {
+ authorize?: boolean;
+ autoIncrement?: boolean;
+ dynamicSchema?: boolean;
+ name: string;
+ columns?: any;
+ schema: string;
+
+ use(...middleware: Middleware[]): Table;
+ use(middleware: Middleware[]): Table;
+ read: TableOperation;
+ update: TableOperation;
+ insert: TableOperation;
+ delete: TableOperation;
+ undelete: TableOperation;
+ }
+
+ interface TableOperation {
+ (operationHandler: (context: Context) => void): Table;
+ use(...middleware: Middleware[]): Table;
+ use(middleware: Middleware[]): Table;
+ }
+
+ interface Tables {
+ configuration: Configuration;
+ add(name: string, definition?: Table | TableDefinition): void;
+ import(fileOrFolder: string): void;
+ initialize(): Thenable;
+ }
+ }
+ }
+
+ export module Data {
+ interface Table {
+ read(query: QueryJs): Thenable;
+ update(item: any, query: QueryJs): Thenable;
+ insert(item: any): Thenable;
+ delete(query: QueryJs, version: string): Thenable;
+ undelete(query: QueryJs, version: string): Thenable;
+ truncate(): Thenable;
+ initialize(): Thenable;
+ schema(): Thenable