(
configOrOptions?: Configuration | PurgeDefaultStorageOptions,
client?: StorageClient,
)
| 44 | */ |
| 45 | export async function purgeDefaultStorages(config?: Configuration, client?: StorageClient): Promise<void>; |
| 46 | export async function purgeDefaultStorages( |
| 47 | configOrOptions?: Configuration | PurgeDefaultStorageOptions, |
| 48 | client?: StorageClient, |
| 49 | ) { |
| 50 | const options: PurgeDefaultStorageOptions = |
| 51 | configOrOptions instanceof Configuration |
| 52 | ? { |
| 53 | client, |
| 54 | config: configOrOptions, |
| 55 | } |
| 56 | : (configOrOptions ?? {}); |
| 57 | const { config = Configuration.getGlobalConfig(), onlyPurgeOnce = false } = options; |
| 58 | ({ client = config.getStorageClient() } = options); |
| 59 | |
| 60 | const casted = client as StorageClient & { __purged?: boolean }; |
| 61 | |
| 62 | // if `onlyPurgeOnce` is true, will purge anytime this function is called, otherwise - only on start |
| 63 | if (!onlyPurgeOnce || (config.get('purgeOnStart') && !casted.__purged)) { |
| 64 | casted.__purged = true; |
| 65 | await casted.purge?.(); |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | export interface UseStateOptions { |
| 70 | config?: Configuration; |
no test coverage detected
searching dependent graphs…