MCPcopy
hub / github.com/apify/crawlee / purgeDefaultStorages

Function purgeDefaultStorages

packages/core/src/storages/utils.ts:46–67  ·  view source on GitHub ↗
(
    configOrOptions?: Configuration | PurgeDefaultStorageOptions,
    client?: StorageClient,
)

Source from the content-addressed store, hash-verified

44 */
45export async function purgeDefaultStorages(config?: Configuration, client?: StorageClient): Promise<void>;
46export 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
69export interface UseStateOptions {
70 config?: Configuration;

Callers 6

openFunction · 0.90
openMethod · 0.90
restoreStateMethod · 0.90
initializeMethod · 0.90
openMethod · 0.90
runMethod · 0.90

Calls 4

getGlobalConfigMethod · 0.80
getStorageClientMethod · 0.80
getMethod · 0.65
purgeMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…