fetch-json-cache 1.3.6 → 1.3.7
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.
- package/dist/cjs/Cache.d.cts +9 -0
- package/dist/cjs/get.d.cts +2 -0
- package/dist/cjs/getSync.d.cts +1 -0
- package/dist/cjs/hash.d.cts +1 -0
- package/dist/cjs/index.d.cts +2 -0
- package/dist/cjs/types.d.cts +13 -0
- package/dist/cjs/update.d.cts +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { CacheOptions, ClearCallback, GetCallback, GetOptions } from './types.js';
|
|
2
|
+
export default class Cache {
|
|
3
|
+
cachePath: string;
|
|
4
|
+
options: CacheOptions;
|
|
5
|
+
constructor(cachePath: string, options?: CacheOptions);
|
|
6
|
+
get<T>(endpoint: string, options?: GetOptions | GetCallback<T>, callback?: GetCallback<T>): undefined | Promise<object | null>;
|
|
7
|
+
getSync<T>(endpoint: string): T | null;
|
|
8
|
+
clear(callback?: ClearCallback): undefined | Promise<undefined>;
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function getCacheAsync<T>(endpoint: string): T;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function hash(data: string): string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface Record<T> {
|
|
2
|
+
headers: object;
|
|
3
|
+
body: T;
|
|
4
|
+
}
|
|
5
|
+
export interface CacheOptions {
|
|
6
|
+
hash?: (string: string) => string;
|
|
7
|
+
}
|
|
8
|
+
export interface GetOptions {
|
|
9
|
+
force?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export type GetCallback<T> = (error?: Error, result?: T) => undefined;
|
|
12
|
+
export type ClearCallback = (error?: Error) => undefined;
|
|
13
|
+
export type UpdateCallback<T> = (error?: Error, result?: T) => undefined;
|
package/package.json
CHANGED