async getExportStatus()

in src/dataServices/dynamoDbDataService.ts [302:346]


    async getExportStatus(jobId: string, tenantId?: string): Promise<GetExportStatusResponse> {
        this.assertValidTenancyMode(tenantId);
        const jobDetailsParam = DynamoDbParamBuilder.buildGetExportRequestJob(jobId, tenantId);
        const jobDetailsResponse = await this.dynamoDb.getItem(jobDetailsParam).promise();
        if (!jobDetailsResponse.Item) {
            throw new ResourceNotFoundError('$export', jobId);
        }

        const item = DynamoDBConverter.unmarshall(<DynamoDB.AttributeMap>jobDetailsResponse.Item);

        const {
            jobStatus,
            jobOwnerId,
            transactionTime,
            exportType,
            outputFormat,
            since,
            type,
            groupId,
            errorArray = [],
            errorMessage = '',
        } = item;

        const results: { requiresAccessToken?: boolean; exportedFileUrls: { type: string; url: string }[] } =
            jobStatus === 'completed'
                ? await getBulkExportResults(this.bulkExportResultsUrlGenerator, jobId, tenantId)
                : { requiresAccessToken: undefined, exportedFileUrls: [] };

        const getExportStatusResponse: GetExportStatusResponse = {
            jobOwnerId,
            jobStatus,
            requiresAccessToken: results.requiresAccessToken,
            exportedFileUrls: results.exportedFileUrls,
            transactionTime,
            exportType,
            outputFormat,
            since,
            type,
            groupId,
            errorArray,
            errorMessage,
        };

        return getExportStatusResponse;
    }