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/connect-timeout/connect-timeout-tests.ts b/connect-timeout/connect-timeout-tests.ts
index 920c7fdc6..4f77b597d 100644
--- a/connect-timeout/connect-timeout-tests.ts
+++ b/connect-timeout/connect-timeout-tests.ts
@@ -3,10 +3,10 @@
///
///
-import express = require("express");
-import timeout = require("connect-timeout");
-import bodyParser = require("body-parser");
-import cookieParser = require("cookie-parser");
+import * as express from "express";
+import timeout from "connect-timeout";
+import * as bodyParser from "body-parser";
+import * as cookieParser from "cookie-parser";
// example of using this top-level; note the use of haltOnTimedout
// after every middleware; it will stop the request flow on a timeout
diff --git a/connect-timeout/connect-timeout.d.ts b/connect-timeout/connect-timeout.d.ts
index 8494a3afb..88bafbad5 100644
--- a/connect-timeout/connect-timeout.d.ts
+++ b/connect-timeout/connect-timeout.d.ts
@@ -23,6 +23,10 @@ declare module Express {
declare module "connect-timeout" {
import express = require("express");
+ /**
+ * @summary Interface for timeout options.
+ * @interface
+ */
interface TimeoutOptions extends Object {
/**
* @summary Controls if this module will "respond" in the form of forwarding an error.
@@ -31,6 +35,5 @@ declare module "connect-timeout" {
respond: boolean;
}
- function timeout(timeout: string, options?: TimeoutOptions): express.RequestHandler;
- export = timeout;
+ export default function timeout(timeout: string, options?: TimeoutOptions): express.RequestHandler;
}
diff --git a/express-brute-memcached/express-brute-memcached-tests.ts b/express-brute-memcached/express-brute-memcached-tests.ts
new file mode 100644
index 000000000..a8d777090
--- /dev/null
+++ b/express-brute-memcached/express-brute-memcached-tests.ts
@@ -0,0 +1,18 @@
+///
+///
+///
+
+import express = require("express");
+import ExpressBrute = require("express-brute");
+import MemcachedStore = require("express-brute-memcached");
+
+var app = express();
+var store = new MemcachedStore("127.0.0.1");
+var bruteforce = new ExpressBrute(store);
+
+app.post('/auth',
+ bruteforce.prevent, // error 403 if we hit this route too often
+ function (req, res, next) {
+ res.send('Success!');
+ }
+);
diff --git a/express-brute-memcached/express-brute-memcached.d.ts b/express-brute-memcached/express-brute-memcached.d.ts
new file mode 100644
index 000000000..4ef41cd69
--- /dev/null
+++ b/express-brute-memcached/express-brute-memcached.d.ts
@@ -0,0 +1,114 @@
+// Type definitions for express-brute-memcached
+// Project: https://github.com/AdamPflug/express-brute-memcached
+// Definitions by: Cyril Schumacher
+// Definitions: https://github.com/borisyankov/DefinitelyTyped
+
+///
+
+declare module "express-brute-memcached" {
+ /**
+ * @summary Memcached options.
+ * @interface
+ */
+ interface MemcachedStoreOptions {
+ prefix: string;
+
+ /**
+ * @summary Maximum key size allowed.
+ * @type {number}
+ */
+ maxKeySize: number;
+
+ /**
+ * @summary Maximum expiration time of keys (in seconds).
+ * @type {number}
+ */
+ maxExpiration: number;
+
+ /**
+ * @summary Maximum size of a value.
+ * @type {number}
+ */
+ maxValue: number;
+
+ /**
+ * @summary Maximum size of the connection pool.
+ * @type {number}
+ */
+ poolSize: number;
+
+ /**
+ * @summary Hashing algorithm used to generate the hashRing values
+ * @type {string}
+ */
+ algorithm: string;
+
+ /**
+ * @summary Time between reconnection attempts (in milliseconds).
+ * @type {number}
+ */
+ reconnect: number;
+
+ /**
+ * @summary Time after which Memcached sends a connection timeout (in milliseconds).
+ * @type {number}
+ */
+ timeout: number;
+
+ /**
+ * @summary Number of socket allocation retries per request.
+ * @type {number}
+ */
+ retries: number;
+
+ /**
+ * @summary Number of failed-attempts to a server before it is regarded as 'dead'.
+ * @type {number}
+ */
+ failures: number;
+
+ /**
+ * @summary Time between a server failure and an attempt to set it up back in service.
+ * @type {number}
+ */
+ retry: number;
+
+ /**
+ * @summary If true, authorizes the automatic removal of dead servers from the pool.
+ * @type {boolean}
+ */
+ remove: boolean;
+
+ /**
+ * @summary An array of server_locations to replace servers that fail and that are removed from the consistent hashing scheme.
+ * @type {Array}
+ */
+ failOverServers: Array;
+
+ /**
+ * @summary True, whether to use md5 as hashing scheme when keys exceed maxKeySize .
+ * @type
+ */
+ keyCompression: boolean;
+
+ /**
+ * @summary Idle timeout for the connections.
+ * @type {number}
+ */
+ idle: number;
+ }
+
+ /**
+ * @summary A memcached store adapter.
+ * @class
+ */
+ export = class MemcachedStore {
+ /**
+ * @summary Constructor.
+ * @constructor
+ * @param {string|Array} hosts The collection.
+ * @param {Object} options The otpions.
+ */
+ constructor(hosts: string|Array, options?: MemcachedStoreOptions);
+ }
+}
diff --git a/express-brute/express-brute.d.ts b/express-brute/express-brute.d.ts
index 7242d44dc..1e672fdfb 100644
--- a/express-brute/express-brute.d.ts
+++ b/express-brute/express-brute.d.ts
@@ -45,85 +45,101 @@ declare module "express-brute" {
}
/**
- * @summary Middleware.
+ * @summary Options for {@link ExpressBrute} class.
+ * @interface
+ */
+ interface ExpressBruteOptions {
+ freeRetries: number;
+ proxyDepth: number;
+ attachResetToRequest: boolean;
+ refreshTimeoutOnRequest: boolean;
+ minWait: number;
+ maxWait: number;
+ lifetime: number;
+ failCallback: (req: express.Request, res: express.Response, next: Function, nextValidRequestDate: any) => void;
+ handleStoreError: any;
+}
+
+/**
+ * @summary Middleware.
+ * @class
+ */
+class ExpressBrute {
+ /**
+ * @summary Constructor.
+ * @constructor
+ * @param {any} store The store.
+ */
+ constructor(store: any);
+
+ /**
+ * @summary Generates middleware that will bounce requests with the same key and IP address that happen faster than the current wait time by calling failCallback.
+ * @param {Object} options The options.
+ */
+ getMiddleware(options: ExpressBruteMiddleware): express.RequestHandler;
+
+ /**
+ * @summary Uses the current proxy trust settings to get the current IP from a request object.
+ * @param {Request} request The HTTP request.
+ * @return {RequestHandler} The Request handler.
+ */
+ getIPFromRequest(request: express.Request): express.RequestHandler;
+
+ /**
+ * @summary Middleware that will bounce requests that happen faster than the current wait time by calling failCallback.
+ * @param {Request} request The HTTP request.
+ * @param {Response} response The HTTP response.
+ * @param {Function} next The next middleware.
+ * @return {RequestHandler} The Request handler.
+ */
+ prevent(request: express.Request, response: express.Response, next: Function): express.RequestHandler;
+
+ /**
+ * @summary Resets the wait time between requests back to its initial value.
+ * @param {string} ip The IP address.
+ * @param {string} key The key. response.
+ * @param {Function} next The next middleware.
+ * @return {RequestHandler} The Request handler.
+ */
+ reset(ip: string, key: string, next: Function): express.RequestHandler;
+}
+
+module ExpressBrute {
+ /**
+ * @summary In-memory store.
* @class
*/
- class ExpressBrute {
+ export class MemoryStore {
/**
* @summary Constructor.
* @constructor
- * @param {any} store The store.
- */
- constructor(store: any);
-
- /**
- * @summary Generates middleware that will bounce requests with the same key and IP address that happen faster than the current wait time by calling failCallback.
* @param {Object} options The options.
*/
- getMiddleware(options: ExpressBruteMiddleware): express.RequestHandler;
+ constructor(options?: MemoryStoreOptions);
+ /**
+ * @summary Gets key value.
+ * @param {string} key The key name.
+ * @param {Function} callbck The callback.
+ */
+ get(key: string, callback: (error: any, data: Object) => void): void;
/**
- * @summary Uses the current proxy trust settings to get the current IP from a request object.
- * @param {Request} request The HTTP request.
- * @return {RequestHandler} The Request handler.
+ * @summary Sets the key value.
+ * @param {string} key The name.
+ * @param {string} value The value.
+ * @param {number} lifetime The lifetime.
+ * @param {Function} callback The callback.
*/
- getIPFromRequest(request: express.Request): express.RequestHandler;
+ set(key: string, value: any, lifetime: number, callback: (error: any) => void): void;
/**
- * @summary Middleware that will bounce requests that happen faster than the current wait time by calling failCallback.
- * @param {Request} request The HTTP request.
- * @param {Response} response The HTTP response.
- * @param {Function} next The next middleware.
- * @return {RequestHandler} The Request handler.
+ * @summary Deletes the key.
+ * @param {string} key The name.
+ * @param {Function} callback The callback.
*/
- prevent(request: express.Request, response: express.Response, next: Function): express.RequestHandler;
-
- /**
- * @summary Resets the wait time between requests back to its initial value.
- * @param {string} ip The IP address.
- * @param {string} key The key. response.
- * @param {Function} next The next middleware.
- * @return {RequestHandler} The Request handler.
- */
- reset(ip: string, key: string, next: Function): express.RequestHandler;
+ reset(key: string, callback: (error: any) => void): void;
}
+}
- module ExpressBrute {
- /**
- * @summary In-memory store.
- * @class
- */
- export class MemoryStore {
- /**
- * @summary Constructor.
- * @constructor
- * @param {Object} options The options.
- */
- constructor(options?: MemoryStoreOptions);
- /**
- * @summary Gets key value.
- * @param {string} key The key name.
- * @param {Function} callbck The callback.
- */
- get(key: string, callback: (error: any, data: Object) => void): void;
-
- /**
- * @summary Sets the key value.
- * @param {string} key The name.
- * @param {string} value The value.
- * @param {number} lifetime The lifetime.
- * @param {Function} callback The callback.
- */
- set(key: string, value: any, lifetime: number, callback: (error: any) => void): void;
-
- /**
- * @summary Deletes the key.
- * @param {string} key The name.
- * @param {Function} callback The callback.
- */
- reset(key: string, callback: (error: any) => void): void;
- }
- }
-
- export = ExpressBrute;
+export = ExpressBrute;
}
diff --git a/i18next-express-middleware/i18next-express-middleware-tests.ts b/i18next-express-middleware/i18next-express-middleware-tests.ts
new file mode 100644
index 000000000..a696f4f8a
--- /dev/null
+++ b/i18next-express-middleware/i18next-express-middleware-tests.ts
@@ -0,0 +1,48 @@
+///
+///
+
+import * as express from "express";
+import * as i18next from "i18next";
+import middleware = require("i18next-express-middleware");
+
+function requestObjectTest() {
+ var i18nextOptions = {};
+ i18next
+ .use(middleware.LanguageDetector)
+ .init(i18nextOptions);
+
+ var app = express();
+ app.use(middleware.handle(i18next, {
+ ignoreRoutes: ["/foo"],
+ removeLngFromUrl: false
+ }));
+}
+
+function detectorOptionsTest() {
+ var options = {
+ // order and from where user language should be detected
+ order: [/*'path', 'session', */ 'querystring', 'cookie', 'header'],
+
+ // keys or params to lookup language from
+ lookupQuerystring: 'lng',
+ lookupCookie: 'i18next',
+ lookupSession: 'lng',
+ lookupFromPathIndex: 0,
+
+ // cache user language
+ caches: false, // ['cookie']
+
+ // optional expire and domain for set cookie
+ cookieExpirationDate: new Date(),
+ cookieDomain: 'myDomain'
+ };
+
+ i18next
+ .use(middleware.LanguageDetector)
+ .init({
+ detection: options
+ });
+
+ var lngDetector = new middleware.LanguageDetector(null, options);
+ lngDetector.init(options);
+}
diff --git a/i18next-express-middleware/i18next-express-middleware.d.ts b/i18next-express-middleware/i18next-express-middleware.d.ts
new file mode 100644
index 000000000..fe51928bf
--- /dev/null
+++ b/i18next-express-middleware/i18next-express-middleware.d.ts
@@ -0,0 +1,96 @@
+// Type definitions for i18next-express-middleware
+// Project: http://i18next.com/
+// Definitions by: Cyril Schumacher
+// Definitions: https://github.com/borisyankov/DefinitelyTyped
+
+///
+///
+
+/**
+ * @summary Interface for Language detector options.
+ * @interface
+ */
+interface LanguageDetectorOptions {
+ caches?: boolean;
+ cookieDomain?: string;
+ cookieExpirationDate?: Date;
+ lookupCookie?: string;
+ lookupFromPathIndex?: number;
+ lookupQuerystring?: string;
+ lookupSession?: string;
+ order?: Array;
+}
+
+declare module "i18next-express-middleware" {
+ import express = require("express");
+ import i18next = require("i18next");
+
+ /**
+ * @summary Interface for middleware to use i18next in express.js.
+ * @interface
+ */
+ export interface i18nextExpressMiddleware {
+ LanguageDetector(): express.Handler;
+ missingKeyHandler(): express.Handler;
+ }
+
+ /**
+ * @summary Interface for own detection functionality.
+ */
+ export interface i18nextCustomDetection {
+ name: string;
+ lookup: (req: express.Request, res: express.Response, options?: Object) => void;
+ cacheUserLanguage: (req: express.Request, res: express.Response, lng?: any, options?: Object) => void;
+ }
+
+ /**
+ * @summary Detects user language from current request.
+ * @class
+ */
+ export class LanguageDetector {
+ /**
+ * @summary Constructor.
+ * @constructor
+ * @param {any} services The services.
+ * @param {Object} options The options.
+ * @param {Object} allOptions The all options.
+ */
+ constructor(services?: any, options?: Object, allOptions?: Object);
+
+ /**
+ * @summary Adds detector.
+ * @param {i18nextCustomDetection} detector The detector to add.
+ */
+ addDetector(detector: i18nextCustomDetection): void;
+
+ // NOTE: add documentation
+ cacheUserLanguage(req: express.Request, res: express.Response, detectionOrder: any): void;
+
+ /**
+ * @summary Detects the language.
+ * @param {Request} req The HTTP request.
+ * @param {Response} res The HTTP response.
+ * @param {detectionOrder} detectionOrder The detection order.
+ */
+ detect(req: express.Request, res: express.Response, detectionOrder: any): void;
+
+ /**
+ * @summary Initializes class.
+ * @param {any} services The services.
+ * @param {Object} options The options.
+ * @param {Object} allOptions The all options.
+ */
+ init(services: any, options?: Object, allOptions?: Object): void;
+ }
+
+ export function getResourcesHandler(i18next: I18nextStatic, options: Object): express.Handler;
+ export function handle(i18next: I18nextStatic, options?: Object): express.Handler;
+
+ /**
+ * @summary Gets handler for missing key.
+ * @param {I18nextStatic} i18next The i18next.
+ * @param {Object} options The options.
+ * @return {express.Handler} The express handler.
+ */
+ export function missingKeyHandler(i18next: I18nextStatic, options: Object): express.Handler;
+}
diff --git a/i18next-sprintf-postprocessor/i18next-sprintf-postprocessor-tests.ts b/i18next-sprintf-postprocessor/i18next-sprintf-postprocessor-tests.ts
new file mode 100644
index 000000000..b2bdf3b8d
--- /dev/null
+++ b/i18next-sprintf-postprocessor/i18next-sprintf-postprocessor-tests.ts
@@ -0,0 +1,10 @@
+///
+
+import * as i18next from "i18next";
+import sprintf from "i18next-sprintf-postprocessor";
+
+function initTest() {
+ const i18nextOptions = {};
+ i18next.use(sprintf).init(i18nextOptions);
+ i18next.init({ overloadTranslationOptionHandler: sprintf.overloadTranslationOptionHandler });
+}
diff --git a/i18next-sprintf-postprocessor/i18next-sprintf-postprocessor.d.ts b/i18next-sprintf-postprocessor/i18next-sprintf-postprocessor.d.ts
new file mode 100644
index 000000000..7983e46aa
--- /dev/null
+++ b/i18next-sprintf-postprocessor/i18next-sprintf-postprocessor.d.ts
@@ -0,0 +1,20 @@
+// Type definitions for i18next-sprintf-postProcessor
+// Project: https://github.com/i18next/i18next-sprintf-postProcessor
+// Definitions by: Cyril Schumacher
+// Definitions: https://github.com/borisyankov/DefinitelyTyped
+
+///
+///
+
+declare module "i18next-sprintf-postprocessor" {
+ import i18next = require("i18next");
+
+ interface i18nextSprintfPostProcessor {
+ (): any;
+ process(value: any, key: string, options: Object): void;
+ overloadTranslationOptionHandler(args: Array): void;
+ }
+
+ var sprintf: i18nextSprintfPostProcessor;
+ export default sprintf;
+}
diff --git a/i18next/i18next.d.ts b/i18next/i18next.d.ts
index 38d91b603..c9a215953 100644
--- a/i18next/i18next.d.ts
+++ b/i18next/i18next.d.ts
@@ -1,11 +1,14 @@
-// Type definitions for i18next v1.5.10
+// Type definitions for i18next v2.0.17
// Project: http://i18next.com
// Definitions by: Maarten Docter
// Definitions: https://github.com/borisyankov/DefinitelyTyped
// Sources: https://github.com/jamuhl/i18next/
+///
///
+///
+///
interface IResourceStore {
[language: string]: IResourceStoreLanguage;
@@ -27,7 +30,12 @@ interface I18nTranslateOptions extends I18nextOptions {
context?: any;
}
-interface I18nextOptions {
+interface i18nextSprintfPostProcessorStatic {
+ overloadTranslationOptionHandler?(args: Array): void;
+ process?(value: any, key: string, options: Object): void;
+}
+
+interface I18nextOptions extends i18nextSprintfPostProcessorStatic {
lng?: string; // Default value: undefined
load?: string; // Default value: 'all'
preload?: string[]; // Default value: []
@@ -99,7 +107,7 @@ interface I18nextStatic {
regexEscape(str: string): string;
};
init(callback?: (err: any, t: (key: string, options?: any) => string) => void ): JQueryDeferred;
- init(options?: I18nextOptions, callback?: (err: any, t: (key: string, options?: any) => string) => void ): JQueryDeferred;
+ init(options?: I18nextOptions|any, callback?: (err: any, t: (key: string, options?: any) => string) => void ): JQueryDeferred; // NOTE: remove any for 'options' parameter.
lng(): string;
loadNamespace(namespace: string, callback?: () => void ): void;
loadNamespaces(namespaces: string[], callback?: () => void ): void;
@@ -124,6 +132,7 @@ interface I18nextStatic {
t(key: string, options?: I18nTranslateOptions): string;
translate(key: string, options?: I18nTranslateOptions): string;
exists(key: string, options?: any): boolean;
+ use(module: any): I18nextStatic;
}
// jQuery extensions