@types/node-fetch-cache 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- node-fetch-cache/LICENSE +21 -0
- node-fetch-cache/README.md +69 -0
- node-fetch-cache/index.d.ts +49 -0
- node-fetch-cache/package.json +27 -0
node-fetch-cache/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Microsoft Corporation.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Installation
|
|
2
|
+
> `npm install --save @types/node-fetch-cache`
|
|
3
|
+
|
|
4
|
+
# Summary
|
|
5
|
+
This package contains type definitions for node-fetch-cache (https://github.com/mistval/node-fetch-cache#readme).
|
|
6
|
+
|
|
7
|
+
# Details
|
|
8
|
+
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node-fetch-cache.
|
|
9
|
+
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node-fetch-cache/index.d.ts)
|
|
10
|
+
````ts
|
|
11
|
+
// Type definitions for node-fetch-cache 3.0
|
|
12
|
+
// Project: https://github.com/mistval/node-fetch-cache#readme
|
|
13
|
+
// Definitions by: Yusuke Fujiki <https://github.com/fujikky>
|
|
14
|
+
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
15
|
+
|
|
16
|
+
import fetch, { Response } from 'node-fetch';
|
|
17
|
+
|
|
18
|
+
declare class NFCResponse extends Response {
|
|
19
|
+
ejectFromCache(): Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
interface Cache {
|
|
23
|
+
get(key: string): Promise<any>;
|
|
24
|
+
remove(key: string): Promise<void>;
|
|
25
|
+
set(value: any): Promise<any>;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
interface MemoryCacheOptions {
|
|
29
|
+
ttl?: number;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export class MemoryCache implements Cache {
|
|
33
|
+
constructor(options?: MemoryCacheOptions);
|
|
34
|
+
get(key: string): Promise<any>;
|
|
35
|
+
remove(key: string): Promise<void>;
|
|
36
|
+
set(value: any): Promise<any>;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
interface FileSystemCacheOptions {
|
|
40
|
+
ttl?: number;
|
|
41
|
+
cacheDirectory?: string;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export class FileSystemCache implements Cache {
|
|
45
|
+
constructor(options?: FileSystemCacheOptions);
|
|
46
|
+
get(key: string): Promise<any>;
|
|
47
|
+
remove(key: string): Promise<void>;
|
|
48
|
+
set(value: any): Promise<any>;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
type FetchBuilder = (cache: Cache) => FetchCache;
|
|
52
|
+
type FetchCache = ((...args: Parameters<typeof fetch>) => Promise<NFCResponse>) & {
|
|
53
|
+
withCache: FetchBuilder;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
declare const defaultFetch: FetchCache;
|
|
57
|
+
export default defaultFetch;
|
|
58
|
+
|
|
59
|
+
export const fetchBuilder: FetchCache;
|
|
60
|
+
|
|
61
|
+
````
|
|
62
|
+
|
|
63
|
+
### Additional Details
|
|
64
|
+
* Last updated: Sun, 08 Jan 2023 23:03:00 GMT
|
|
65
|
+
* Dependencies: [@types/node-fetch](https://npmjs.com/package/@types/node-fetch)
|
|
66
|
+
* Global values: none
|
|
67
|
+
|
|
68
|
+
# Credits
|
|
69
|
+
These definitions were written by [Yusuke Fujiki](https://github.com/fujikky).
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// Type definitions for node-fetch-cache 3.0
|
|
2
|
+
// Project: https://github.com/mistval/node-fetch-cache#readme
|
|
3
|
+
// Definitions by: Yusuke Fujiki <https://github.com/fujikky>
|
|
4
|
+
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
5
|
+
|
|
6
|
+
import fetch, { Response } from 'node-fetch';
|
|
7
|
+
|
|
8
|
+
declare class NFCResponse extends Response {
|
|
9
|
+
ejectFromCache(): Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
interface Cache {
|
|
13
|
+
get(key: string): Promise<any>;
|
|
14
|
+
remove(key: string): Promise<void>;
|
|
15
|
+
set(value: any): Promise<any>;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
interface MemoryCacheOptions {
|
|
19
|
+
ttl?: number;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export class MemoryCache implements Cache {
|
|
23
|
+
constructor(options?: MemoryCacheOptions);
|
|
24
|
+
get(key: string): Promise<any>;
|
|
25
|
+
remove(key: string): Promise<void>;
|
|
26
|
+
set(value: any): Promise<any>;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
interface FileSystemCacheOptions {
|
|
30
|
+
ttl?: number;
|
|
31
|
+
cacheDirectory?: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export class FileSystemCache implements Cache {
|
|
35
|
+
constructor(options?: FileSystemCacheOptions);
|
|
36
|
+
get(key: string): Promise<any>;
|
|
37
|
+
remove(key: string): Promise<void>;
|
|
38
|
+
set(value: any): Promise<any>;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
type FetchBuilder = (cache: Cache) => FetchCache;
|
|
42
|
+
type FetchCache = ((...args: Parameters<typeof fetch>) => Promise<NFCResponse>) & {
|
|
43
|
+
withCache: FetchBuilder;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
declare const defaultFetch: FetchCache;
|
|
47
|
+
export default defaultFetch;
|
|
48
|
+
|
|
49
|
+
export const fetchBuilder: FetchCache;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@types/node-fetch-cache",
|
|
3
|
+
"version": "3.0.0",
|
|
4
|
+
"description": "TypeScript definitions for node-fetch-cache",
|
|
5
|
+
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node-fetch-cache",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"contributors": [
|
|
8
|
+
{
|
|
9
|
+
"name": "Yusuke Fujiki",
|
|
10
|
+
"url": "https://github.com/fujikky",
|
|
11
|
+
"githubUsername": "fujikky"
|
|
12
|
+
}
|
|
13
|
+
],
|
|
14
|
+
"main": "",
|
|
15
|
+
"types": "index.d.ts",
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
|
19
|
+
"directory": "types/node-fetch-cache"
|
|
20
|
+
},
|
|
21
|
+
"scripts": {},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@types/node-fetch": "*"
|
|
24
|
+
},
|
|
25
|
+
"typesPublisherContentHash": "ce78a99bf1fd3447625d498abd28bb6db41bf751994671c2a50ad869415d5082",
|
|
26
|
+
"typeScriptVersion": "4.2"
|
|
27
|
+
}
|