async _processBatches(objects: Array<CustomObjectDraft>): Promise<void> { this.logger.info('Starting Import') const batches = CustomObjectsImporter.createBatches(objects, this.batchSize) const uri = CustomObjectsImporter.buildUri(this.apiConfig.projectKey) const existingObjectsRequest = CustomObjectsImporter.buildRequest( uri, 'GET' ) const { body: { results: existingObjects }, // skip below because of flow issue with async/await // todo: remove `FlowFixMe` when [this](https://github.com/facebook/flow/issues/5294) issue is fixed // $FlowFixMe } = await this.client.execute(existingObjectsRequest) const requestsList = batches.map( (newObjects: Array<CustomObjectDraft>): Array<ClientRequest> => this._createOrUpdateObjects(existingObjects, newObjects) ) const functionsList = requestsList.map( (requests: Array<ClientRequest>): Function => this._createPromiseReturningFunction(requests) ) return pSeries(functionsList).then((): Promise<void> => Promise.resolve()) }
async _processBatches(objects: Array<CustomObjectDraft>): Promise<void> { this.logger.info('Starting Import') const batches = CustomObjectsImporter.createBatches(objects, this.batchSize) const uri = CustomObjectsImporter.buildUri(this.apiConfig.projectKey) const existingObjectsRequest = CustomObjectsImporter.buildRequest( uri, 'GET' ) const { body: { results: existingObjects }, // skip below because of flow issue with async/await // todo: remove `FlowFixMe` when [this](https://github.com/facebook/flow/issues/5294) issue is fixed // $FlowFixMe } = await this.client.execute(existingObjectsRequest) const requestsList = batches.map( (newObjects: Array<CustomObjectDraft>): Array<ClientRequest> => this._createOrUpdateObjects(existingObjects, newObjects) ) const functionsList = requestsList.map( (requests: Array<ClientRequest>): Function => this._createPromiseReturningFunction(requests) ) return pSeries(functionsList).then((): Promise<void> => Promise.resolve()) }