Added typings for tough-cookie-filestore

This commit is contained in:
Christian Friedow
2018-08-06 11:41:35 +02:00
parent bc0c933415
commit 461a6b2fb8
4 changed files with 69 additions and 0 deletions
+42
View File
@@ -0,0 +1,42 @@
// Type definitions for tough-cookie-filestore 0.0
// Project: https://github.com/mitsuru/tough-cookie-filestore
// Definitions by: Christian Friedow <https://github.com/friedow>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export interface Cookie {
domain: string;
path: string;
key: string;
}
export default class FileCookieStore {
idx: {
[domain: string]: {
[path: string]: {
[key: string]: Cookie,
},
},
};
filePath: string;
synchronous: boolean;
constructor(filePath: string);
inspect(): string;
findCookie(domain: string, path: string, key: string, cb: (whatever: null, cookie: Cookie | null | undefined) => void): void;
findCookies(domain: string, path: string, cb: (whatever: null, cookies: Cookie[]) => void): void;
putCookie(cookie: Cookie, path: string, key: string, cb: (whatever: null) => void): void;
updateCookie(oldCookie: Cookie, newCookie: Cookie, cb: (whatever: null) => void): void;
removeCookie(domain: string, path: string, key: string, cb: (whatever: null) => void): void;
removeCookies(domain: string, path: string, cb: (whatever: null) => void): void;
saveToFile(filePath: string, data: any, cb: () => void): void;
loadFromFile(filePath: string, cb: (data: any) => void): void;
}
@@ -0,0 +1,3 @@
import FileCookieStore from 'tough-cookie-filestore';
const cookiestore = new FileCookieStore('cookies.json');
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"tough-cookie-filestore-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }