* 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 = {})
| 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 | |
| 933 | declare class BuiltRequestProvider extends RequestProvider { |
nothing calls this directly
no test coverage detected
searching dependent graphs…