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

Function open

packages/core/src/storages/request_provider.ts:902–930  ·  view source on GitHub ↗

* Opens a request queue and returns a promise resolving to an instance * of the {@apilink RequestQueue} class. * * {@apilink RequestQueue} represents a queue of URLs to crawl, which is stored either on local filesystem or in the cloud. * The queue is used for deep crawling of web

(queueIdOrName?: string | null, options: StorageManagerOptions = {})

Source from the content-addressed store, hash-verified

900 * @param [options] Open Request Queue options.
901 */
902 static async open(queueIdOrName?: string | null, options: StorageManagerOptions = {}): Promise<RequestProvider> {
903 checkStorageAccess();
904
905 ow(queueIdOrName, ow.optional.any(ow.string, ow.null));
906 ow(
907 options,
908 ow.object.exactShape({
909 config: ow.optional.object.instanceOf(Configuration),
910 storageClient: ow.optional.object,
911 proxyConfiguration: ow.optional.object,
912 }),
913 );
914
915 options.config ??= Configuration.getGlobalConfig();
916 options.storageClient ??= options.config.getStorageClient();
917
918 await purgeDefaultStorages({ onlyPurgeOnce: true, client: options.storageClient, config: options.config });
919
920 const manager = StorageManager.getManager(this as typeof BuiltRequestProvider, options.config);
921 const queue = await manager.openStorage(queueIdOrName, options.storageClient);
922 queue.proxyConfiguration = options.proxyConfiguration;
923
924 const queueInfo = await queue.client.get();
925
926 queue.initialCount = queueInfo?.totalRequestCount ?? 0;
927 queue.initialHandledCount = queueInfo?.handledRequestCount ?? 0;
928
929 return queue;
930 }
931}
932
933declare class BuiltRequestProvider extends RequestProvider {

Callers

nothing calls this directly

Calls 7

checkStorageAccessFunction · 0.90
purgeDefaultStoragesFunction · 0.90
getGlobalConfigMethod · 0.80
getStorageClientMethod · 0.80
getManagerMethod · 0.80
openStorageMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…