Skip to content

Commit

Permalink
Fix tslint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffreyssmith2nd committed Aug 8, 2018
1 parent 0dcdaf3 commit a845cad
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 25 deletions.
14 changes: 7 additions & 7 deletions src/demux/handlers/AbstractActionHandler.test.ts
Expand Up @@ -5,12 +5,6 @@ class TestActionHandler extends AbstractActionHandler {
// tslint:disable-next-line
public async handleWithState() {}

// tslint:disable-next-line
protected async loadIndexState(): Promise<IndexState> { return { blockNumber: 0, blockHash: "" } }

// tslint:disable-next-line
protected async updateIndexState() {}

// tslint:disable-next-line
public async rollbackTo() {}

Expand All @@ -29,9 +23,15 @@ class TestActionHandler extends AbstractActionHandler {
public _runEffects(state: any, block: Block, context: any) {
this.runEffects(state, block, context)
}

// tslint:disable-next-line
protected async loadIndexState(): Promise<IndexState> { return { blockNumber: 0, blockHash: "" } }

// tslint:disable-next-line
protected async updateIndexState() {}
}

const rawBlock= {
const rawBlock = {
actions: [
{
payload: {
Expand Down
5 changes: 3 additions & 2 deletions src/demux/handlers/AbstractActionHandler.ts
Expand Up @@ -74,8 +74,9 @@ export abstract class AbstractActionHandler {
protected abstract async updateIndexState(state: any, block: Block, isReplay: boolean, context?: any): Promise<void>

/**
* Returns a promise for the `lastProcessedBlockNumber` and `lastProcessedBlockHash` meta state, coinciding with the block
* that has just been processed. These are the same values written by `updateIndexState()`.
* Returns a promise for the `lastProcessedBlockNumber` and `lastProcessedBlockHash` meta state,
* coinciding with the block that has just been processed.
* These are the same values written by `updateIndexState()`.
* @returns A promise that resolves to an `IndexState`
*/
protected abstract async loadIndexState(): Promise<IndexState>
Expand Down
4 changes: 2 additions & 2 deletions src/demux/handlers/postgres/MassiveActionHandler.test.ts
@@ -1,10 +1,10 @@
import Docker from "dockerode"
import massive from "massive"
import { MassiveActionHandler } from "./MassiveActionHandler"
import { JsonActionReader } from "../../readers/testing/JsonActionReader"
import { MassiveActionHandler } from "./MassiveActionHandler"
import blockchain from "./testHelpers/blockchain.json"
import * as migrate from "./testHelpers/migrate"
import * as dockerUtils from "./testHelpers/docker"
import * as migrate from "./testHelpers/migrate"
import updaters from "./testHelpers/updaters"

const docker = new Docker()
Expand Down
2 changes: 1 addition & 1 deletion src/demux/handlers/postgres/MassiveActionHandler.ts
@@ -1,5 +1,5 @@
import { AbstractActionHandler } from "../AbstractActionHandler"
import { Block, Effect, IndexState, Updater } from "../../../../index"
import { AbstractActionHandler } from "../AbstractActionHandler"

/**
* Connects to a Postgres database using [MassiveJS](https://github.com/dmfay/massive-js). This expects that
Expand Down
2 changes: 1 addition & 1 deletion src/demux/handlers/postgres/testHelpers/migrate.ts
@@ -1,5 +1,5 @@
import * as path from "path"
import { QueryFile, IDatabase } from "pg-promise"
import { IDatabase, QueryFile } from "pg-promise"

function loadQueryFile(file: string) {
const fullPath = path.join(__dirname, file)
Expand Down
18 changes: 9 additions & 9 deletions src/demux/readers/AbstractActionReader.ts
Expand Up @@ -141,14 +141,6 @@ export abstract class AbstractActionReader {
}
}

/**
* When history is exhausted in rollback(), this is run to handle the situation. If left unimplemented,
* then only instantiate with `onlyIrreversible` set to true.
*/
protected rollbackExhausted() {
throw Error("Rollback history has been exhausted, and no rollback exhaustion handling has been implemented.")
}

/**
* Move to the specified block.
*/
Expand All @@ -165,7 +157,7 @@ export abstract class AbstractActionReader {

// Check if block exists in history
let toDelete = -1
for (let i = this.blockHistory.length-1; i >= 0; i--) {
for (let i = this.blockHistory.length - 1; i >= 0; i--) {
if (this.blockHistory[i].blockNumber === blockNumber) {
break
} else {
Expand All @@ -183,4 +175,12 @@ export abstract class AbstractActionReader {
this.currentBlockData = await this.getBlock(this.currentBlockNumber)
}
}

/**
* When history is exhausted in rollback(), this is run to handle the situation. If left unimplemented,
* then only instantiate with `onlyIrreversible` set to true.
*/
protected rollbackExhausted() {
throw Error("Rollback history has been exhausted, and no rollback exhaustion handling has been implemented.")
}
}
2 changes: 1 addition & 1 deletion src/demux/readers/eos/NodeosBlock.ts
@@ -1,5 +1,5 @@
import { EosAction } from "./interfaces"
import { Block } from "../../../../index"
import { EosAction } from "./interfaces"

export class NodeosBlock implements Block {
public actions: EosAction[]
Expand Down
2 changes: 1 addition & 1 deletion src/demux/readers/testing/JsonActionReader.ts
@@ -1,6 +1,6 @@
import { AbstractActionReader } from "../AbstractActionReader"
import request from "request-promise-native"
import { Block } from "../../../../index"
import { AbstractActionReader } from "../AbstractActionReader"

/**
* Reads from an array of `Block` objects, useful for testing.
Expand Down
2 changes: 1 addition & 1 deletion tslint.json
Expand Up @@ -8,7 +8,7 @@
"rules": {
"object-literal-sort-keys": false,
"interface-name": [true, "never-prefix"],
"no-console": [true, "log", "error"],
"no-console": [true, "log"],
"semicolon": [true, "never"],
"ter-indent": [true, 2]
},
Expand Down

0 comments on commit a845cad

Please sign in to comment.