diff --git a/app/lib/blockchain/SqlIndex.ts b/app/lib/blockchain/SqlIndex.ts index c8d539e57e8a5b6fb1acc81737623d24a05a5277..3ab081d5dc87c20608e4b26864445521387653ec 100644 --- a/app/lib/blockchain/SqlIndex.ts +++ b/app/lib/blockchain/SqlIndex.ts @@ -1,14 +1,14 @@ "use strict" import {IndexOperator} from "./interfaces/IndexOperator" -import * as _ from "underscore" const IndexDAL = require('../dal/sqliteDAL/IndexDAL') +const _ = require('underscore') export class SQLIndex implements IndexOperator { private indexes: { [k:string]: any } = {} - constructor(private db, private definitions: any) { + constructor(private db:any, private definitions: any) { } async initIndexer(pkFields: any): Promise<void> { @@ -45,7 +45,7 @@ export class SQLIndex implements IndexOperator { if (this.definitions[subIndex].findTrimable) { return this.definitions[subIndex].findTrimable(maxNumber) } else { - const criterias = {} + const criterias:any = {} criterias[numberField] = { $lt: maxNumber } return this.indexes[subIndex].sqlFind(criterias) } diff --git a/app/lib/indexer.ts b/app/lib/indexer.ts index bed96bc9bf78517d1dc892d06089848beab248a9..7806e7308eede6cbc993217b65651b36ee1e2c5c 100644 --- a/app/lib/indexer.ts +++ b/app/lib/indexer.ts @@ -1,10 +1,10 @@ "use strict"; import {BlockDTO} from "./dto/BlockDTO" import {ConfDTO} from "./dto/ConfDTO" -import {IdentityDTO} from "./dto/IdentityDTO"; +import {IdentityDTO} from "./dto/IdentityDTO" import {RevocationDTO} from "./dto/RevocationDTO" import {CertificationDTO} from "./dto/CertificationDTO" -import {OutputDTO, TransactionDTO} from "./dto/TransactionDTO" +import {TransactionDTO} from "./dto/TransactionDTO" import {DBHead} from "./db/DBHead" const co = require('co'); @@ -956,7 +956,7 @@ export class Indexer { // BR_G07 static async prepareAvgBlockSize(HEAD: DBHead, range: (n:number,m:number,s:string)=>Promise<number[]>) { - HEAD.avgBlockSize = average(await range(1, HEAD.issuersCount, 'bsize')); // TODO: vérifier l'appel asynchrone + HEAD.avgBlockSize = average(await range(1, HEAD.issuersCount, 'bsize')) } // BR_G09 diff --git a/test/blockchain/indexed-blockchain.ts b/test/blockchain/indexed-blockchain.ts index a298e175f39549dfe2636fffbd7b7b2ac4321b63..31edf7393a84fccd64d17cf8574bac43e657b007 100644 --- a/test/blockchain/indexed-blockchain.ts +++ b/test/blockchain/indexed-blockchain.ts @@ -11,7 +11,7 @@ describe('Indexed Blockchain', () => { describe('MemoryIndex', () => { - let blockchain + let blockchain:any describe('PK on one field', () => { @@ -188,7 +188,7 @@ describe('Indexed Blockchain', () => { describe('SqlIndex', () => { - let blockchain + let blockchain:any describe('PK on one field', () => { diff --git a/test/blockchain/lib/ArrayBlockchain.ts b/test/blockchain/lib/ArrayBlockchain.ts index 96ec29cc83d17373483fd1b741b79fa9c03c30c2..2f5f1c27e20fae86a7d8eabd70dd47dcb7784701 100644 --- a/test/blockchain/lib/ArrayBlockchain.ts +++ b/test/blockchain/lib/ArrayBlockchain.ts @@ -5,7 +5,7 @@ export class ArrayBlockchain implements BlockchainOperator { // The blockchain storage private bcArray: any[] = [] - store(b): Promise<any> { + store(b:any): Promise<any> { this.bcArray.push(b) return Promise.resolve(b) } diff --git a/test/blockchain/lib/MemoryIndex.ts b/test/blockchain/lib/MemoryIndex.ts index 9291a0c333783b4ac8199932ff229b084883e7c3..77195982b3da3a7b033098e32bfc1d21bd7cfcca 100644 --- a/test/blockchain/lib/MemoryIndex.ts +++ b/test/blockchain/lib/MemoryIndex.ts @@ -17,7 +17,7 @@ export class MemoryIndex implements IndexOperator { } findTrimable(subIndex: string, numberField: string, maxNumber: number): Promise<any[]> { - const criterias = {} + const criterias:any = {} criterias[numberField] = { $lt: maxNumber } return this.findWhere(subIndex, criterias) } @@ -48,7 +48,7 @@ export class MemoryIndex implements IndexOperator { return Promise.resolve() } - private static matchComplexCriterias(criterias, row): boolean { + private static matchComplexCriterias(criterias:any, row:any): boolean { const criteriaKeys = _.keys(criterias) let matches = true let i = 0 @@ -79,7 +79,7 @@ export class MemoryIndex implements IndexOperator { findWhere(subIndex: string, criterias: {}): Promise<any[]> { let res: any[] = [] - const areBasicCriterias = _.values(criterias).reduce((are, criteria) => are && typeof criteria !== 'function' && typeof criteria !== 'object', true) + const areBasicCriterias = _.values(criterias).reduce((are:boolean, criteria:any) => are && typeof criteria !== 'function' && typeof criteria !== 'object', true) if (areBasicCriterias) { res = _.where(this.indexStorage[subIndex], criterias) } else { diff --git a/test/blockchain/misc-sql-blockchain.ts b/test/blockchain/misc-sql-blockchain.ts index e1b5047b480523bf4b33f99e9f3231445f6eb61d..dc7004991c4267dc8f3bcf0c89a212f22e38a8f2 100644 --- a/test/blockchain/misc-sql-blockchain.ts +++ b/test/blockchain/misc-sql-blockchain.ts @@ -12,7 +12,7 @@ const sqlite = require('../../app/lib/dal/drivers/sqlite') describe('MISC SQL Blockchain', () => { - let blockchain + let blockchain:any before(async () => {