import { CosmosContainerClient , cosmosContainerClientTypes } from 'azure-services' ; import { inject , injectable } from 'inversify' ; import { ItemType , OnDemandPageScanBatchRequest , PartitionKey , ScanRunBatchRequest } from 'storage-documents' ; @ injectable ( ) export class ScanDataProvider { public constructor ( @ inject ( cosmosContainerClientTypes . OnDemandScanBatchRequestsCosmosContainerClient ) private readonly cosmosContainerClient ) { } public async writeScanRunBatchRequest ( batchId , scanRunBatchResponse ) { const scanRunBatchRequest = { id : batchId , itemType : ItemType . scanRunBatchRequest , partitionKey : PartitionKey . scanRunBatchRequests , scanRunBatchRequest : scanRunBatchResponse , } ; await this . cosmosContainerClient . writeDocument ( scanRunBatchRequest ) ; } public async deleteBatchRequest ( request ) { await this . cosmosContainerClient . deleteDocument ( request . id , request . partitionKey ) ; } }