(
url: string,
_storetype?: string,
signal?: AbortSignal,
)
| 638 | } |
| 639 | |
| 640 | async addToCache( |
| 641 | url: string, |
| 642 | _storetype?: string, |
| 643 | signal?: AbortSignal, |
| 644 | ): Promise<void> { |
| 645 | if (await this.store.has(url)) { |
| 646 | return; |
| 647 | } |
| 648 | const request = new Request( |
| 649 | url, |
| 650 | signal ? { ...DEFAULT_FETCH_OPTIONS, signal } : DEFAULT_FETCH_OPTIONS, |
| 651 | ); |
| 652 | const response = await fetch(request); |
| 653 | if (!response.ok) { |
| 654 | throw new Error( |
| 655 | `ArtifactOPFSCache: Unable to fetch ${url}, received status ${response.status}`, |
| 656 | ); |
| 657 | } |
| 658 | await this.store.write(url, response); |
| 659 | } |
| 660 | |
| 661 | async hasAllKeys(keys: string[]): Promise<boolean> { |
| 662 | const results = await Promise.all( |
no test coverage detected