1 |
|
2 |
|
3 |
|
4 |
|
5 | export declare class PnPClientStorageWrapper implements IPnPClientStore {
|
6 | private store;
|
7 | defaultTimeoutMinutes: number;
|
8 | |
9 |
|
10 |
|
11 | enabled: boolean;
|
12 | |
13 |
|
14 |
|
15 |
|
16 |
|
17 | constructor(store: Storage, defaultTimeoutMinutes?: number);
|
18 | static bind(store: Storage): IPnPClientStore;
|
19 | /**
|
20 | * Get a value from storage, or null if that value does not exist
|
21 | *
|
22 | * @param key The key whose value we want to retrieve
|
23 | */
|
24 | get<T>(key: string): T | null;
|
25 | /**
|
26 | * Adds a value to the underlying storage
|
27 | *
|
28 | * @param key The key to use when storing the provided value
|
29 | * @param o The value to store
|
30 | * @param expire Optional, if provided the expiration of the item, otherwise the default is used
|
31 | */
|
32 | put(key: string, o: any, expire?: Date): void;
|
33 | /**
|
34 | * Deletes a value from the underlying storage
|
35 | *
|
36 | * @param key The key of the pair we want to remove from storage
|
37 | */
|
38 | delete(key: string): void;
|
39 | /**
|
40 | * Gets an item from the underlying storage, or adds it if it does not exist using the supplied getter function
|
41 | *
|
42 | * @param key The key to use when storing the provided value
|
43 | * @param getter A function which will upon execution provide the desired value
|
44 | * @param expire Optional, if provided the expiration of the item, otherwise the default is used
|
45 | */
|
46 | getOrPut<T>(key: string, getter: () => Promise<T>, expire?: Date): Promise<T>;
|
47 | /**
|
48 | * Deletes any expired items placed in the store by the pnp library, leaves other items untouched
|
49 | */
|
50 | deleteExpired(): Promise<void>;
|
51 | /**
|
52 | * Used to determine if the wrapped storage is available currently
|
53 | */
|
54 | private test;
|
55 | /**
|
56 | * Creates the persistable to store
|
57 | */
|
58 | private createPersistable;
|
59 | /**
|
60 | * Deletes expired items added by this library in this.store and sets a timeout to call itself
|
61 | */
|
62 | private cacheExpirationHandler;
|
63 | }
|
64 | /**
|
65 | * Interface which defines the operations provided by a client storage object
|
66 | */
|
67 | export interface IPnPClientStore {
|
68 | |
69 |
|
70 |
|
71 | enabled: boolean;
|
72 | |
73 |
|
74 |
|
75 |
|
76 |
|
77 | get(key: string): any;
|
78 | |
79 |
|
80 |
|
81 |
|
82 |
|
83 |
|
84 |
|
85 | put(key: string, o: any, expire?: Date): void;
|
86 | |
87 |
|
88 |
|
89 |
|
90 |
|
91 | delete(key: string): void;
|
92 | |
93 |
|
94 |
|
95 |
|
96 |
|
97 |
|
98 |
|
99 | getOrPut<T>(key: string, getter: () => Promise<T>, expire?: Date): Promise<T>;
|
100 | /**
|
101 | * Removes any expired items placed in the store by the pnp library, leaves other items untouched
|
102 | */
|
103 | deleteExpired(): Promise<void>;
|
104 | }
|
105 | /**
|
106 | * A class that will establish wrappers for both local and session storage
|
107 | */
|
108 | export declare class PnPClientStorage {
|
109 | private _local;
|
110 | private _session;
|
111 | /**
|
112 | * Creates a new instance of the PnPClientStorage class
|
113 | *
|
114 | * @constructor
|
115 | */
|
116 | constructor(_local?: IPnPClientStore | null, _session?: IPnPClientStore | null);
|
117 | /**
|
118 | * Provides access to the local storage of the browser
|
119 | */
|
120 | get local(): IPnPClientStore;
|
121 | /**
|
122 | * Provides access to the session storage of the browser
|
123 | */
|
124 | get session(): IPnPClientStore;
|
125 | }
|
126 | //# sourceMappingURL=storage.d.ts.map |
\ | No newline at end of file |