diff --git a/koa-cache-control/index.d.ts b/koa-cache-control/index.d.ts new file mode 100644 index 0000000000..19329fcfec --- /dev/null +++ b/koa-cache-control/index.d.ts @@ -0,0 +1,23 @@ +// Type definitions for koa-cache-control 2.0 +// Project: https://github.com/DaMouse404/koa-cache-control +// Definitions by: Peter Safranek +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import * as Koa from "koa"; + +declare function cacheControl(options?: { + private?: boolean; + public?: boolean; + noStore?: boolean; + noCache?: boolean; + noTransform?: boolean; + mustRevalidate?: boolean; + staleIfError?: number; + staleWhileRevalidate?: number; + maxAge?: number; + sMaxAge?: number; +}): Koa.Middleware; + +declare namespace cacheControl {} + +export = cacheControl; diff --git a/koa-cache-control/koa-cache-control-tests.ts b/koa-cache-control/koa-cache-control-tests.ts new file mode 100644 index 0000000000..c99f4fe862 --- /dev/null +++ b/koa-cache-control/koa-cache-control-tests.ts @@ -0,0 +1,19 @@ +import * as Koa from "koa"; +import * as cacheControl from "koa-cache-control"; + +const app = new Koa(); + +app.use(cacheControl()); +app.use(cacheControl({})); +app.use(cacheControl({ + private: true, + public: true, + noStore: true, + noCache: true, + noTransform: true, + mustRevalidate: true, + staleIfError: 0, + staleWhileRevalidate: 0, + maxAge: 0, + sMaxAge: 0, +})); diff --git a/koa-cache-control/tsconfig.json b/koa-cache-control/tsconfig.json new file mode 100644 index 0000000000..ae4aea7b85 --- /dev/null +++ b/koa-cache-control/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "koa-cache-control-tests.ts" + ] +} diff --git a/koa-cache-control/tslint.json b/koa-cache-control/tslint.json new file mode 100644 index 0000000000..eb88e553a5 --- /dev/null +++ b/koa-cache-control/tslint.json @@ -0,0 +1,7 @@ +{ + "extends": "../tslint.json", + + "noImplicitAny": "true", + "noImplicitThis": "true", + "strictNullChecks": "true" +} diff --git a/tslint.json b/tslint.json index 6b04ae7f36..7847d36674 100644 --- a/tslint.json +++ b/tslint.json @@ -1 +1 @@ -{ "extends": "./node_modules/types-publisher/tslint-definitions.json" } \ No newline at end of file +{ "extends": "./node_modules/types-publisher/tslint-definitions.json" }