diff options
author | Alex Browne <stephenalexbrowne@gmail.com> | 2018-11-09 02:15:09 +0800 |
---|---|---|
committer | Alex Browne <stephenalexbrowne@gmail.com> | 2018-12-05 06:24:48 +0800 |
commit | ccad046eb649a60fdf7319a075fa41490d593ae8 (patch) | |
tree | 3c356e71868c7dcc770791dc70e90ae7abc16a30 /packages/pipeline | |
parent | 954c3b9272556723c10fd02ad6b753ac98ca47fa (diff) | |
download | dexon-sol-tools-ccad046eb649a60fdf7319a075fa41490d593ae8.tar dexon-sol-tools-ccad046eb649a60fdf7319a075fa41490d593ae8.tar.gz dexon-sol-tools-ccad046eb649a60fdf7319a075fa41490d593ae8.tar.bz2 dexon-sol-tools-ccad046eb649a60fdf7319a075fa41490d593ae8.tar.lz dexon-sol-tools-ccad046eb649a60fdf7319a075fa41490d593ae8.tar.xz dexon-sol-tools-ccad046eb649a60fdf7319a075fa41490d593ae8.tar.zst dexon-sol-tools-ccad046eb649a60fdf7319a075fa41490d593ae8.zip |
Reorganize entities. Make scripts work from any directory.
Diffstat (limited to 'packages/pipeline')
15 files changed, 38 insertions, 14 deletions
diff --git a/packages/pipeline/src/entities/ExchangeCancelEvent.ts b/packages/pipeline/src/entities/exchange_cancel_event.ts index 698b9e2ec..698b9e2ec 100644 --- a/packages/pipeline/src/entities/ExchangeCancelEvent.ts +++ b/packages/pipeline/src/entities/exchange_cancel_event.ts diff --git a/packages/pipeline/src/entities/ExchangeCancelUpToEvent.ts b/packages/pipeline/src/entities/exchange_cancel_up_to_event.ts index 3ca75ccf7..3ca75ccf7 100644 --- a/packages/pipeline/src/entities/ExchangeCancelUpToEvent.ts +++ b/packages/pipeline/src/entities/exchange_cancel_up_to_event.ts diff --git a/packages/pipeline/src/entities/ExchangeFillEvent.ts b/packages/pipeline/src/entities/exchange_fill_event.ts index 6e549af93..6e549af93 100644 --- a/packages/pipeline/src/entities/ExchangeFillEvent.ts +++ b/packages/pipeline/src/entities/exchange_fill_event.ts diff --git a/packages/pipeline/src/entities/index.ts b/packages/pipeline/src/entities/index.ts new file mode 100644 index 000000000..4cd8d9da2 --- /dev/null +++ b/packages/pipeline/src/entities/index.ts @@ -0,0 +1,7 @@ +export { Block } from './block'; +export { ExchangeCancelEvent } from './exchange_cancel_event'; +export { ExchangeCancelUpToEvent } from './exchange_cancel_up_to_event'; +export { ExchangeFillEvent } from './exchange_fill_event'; +export { Relayer } from './relayer'; +export { SraOrder } from './sra_order'; +export { Transaction } from './transaction'; diff --git a/packages/pipeline/src/entities/SraOrder.ts b/packages/pipeline/src/entities/sra_order.ts index a22f7c4e5..a22f7c4e5 100644 --- a/packages/pipeline/src/entities/SraOrder.ts +++ b/packages/pipeline/src/entities/sra_order.ts diff --git a/packages/pipeline/src/ormconfig.ts b/packages/pipeline/src/ormconfig.ts index eaafeb7d5..39b496ace 100644 --- a/packages/pipeline/src/ormconfig.ts +++ b/packages/pipeline/src/ormconfig.ts @@ -1,11 +1,31 @@ import { ConnectionOptions } from 'typeorm'; +import { + Block, + ExchangeCancelEvent, + ExchangeCancelUpToEvent, + ExchangeFillEvent, + Relayer, + SraOrder, + Transaction, +} from './entities'; + +const entities = [ + Block, + ExchangeCancelEvent, + ExchangeCancelUpToEvent, + ExchangeFillEvent, + Relayer, + SraOrder, + Transaction, +]; + export const testConfig: ConnectionOptions = { type: 'sqlite', database: 'database.sqlite', synchronize: true, logging: false, - entities: ['./lib/src/entities/**/*.js'], + entities, migrations: ['./lib/src/migrations/**/*.js'], cli: { entitiesDir: 'lib/src/entities', @@ -18,7 +38,7 @@ export const deployConfig: ConnectionOptions = { url: process.env.ZEROEX_DATA_PIPELINE_DB_URL, synchronize: true, logging: false, - entities: ['./lib/src/entities/**/*.js'], + entities, migrations: ['./lib/src/migrations/**/*.js'], cli: { entitiesDir: 'lib/src/entities', diff --git a/packages/pipeline/src/parsers/events/index.ts b/packages/pipeline/src/parsers/events/index.ts index abfb7ddb6..7211eed76 100644 --- a/packages/pipeline/src/parsers/events/index.ts +++ b/packages/pipeline/src/parsers/events/index.ts @@ -9,9 +9,7 @@ import { AssetProxyId, ERC721AssetData } from '@0x/types'; import { LogWithDecodedArgs } from 'ethereum-types'; import * as R from 'ramda'; -import { ExchangeCancelEvent } from '../../entities/ExchangeCancelEvent'; -import { ExchangeCancelUpToEvent } from '../../entities/ExchangeCancelUpToEvent'; -import { ExchangeFillEvent } from '../../entities/ExchangeFillEvent'; +import { ExchangeCancelEvent, ExchangeCancelUpToEvent, ExchangeFillEvent } from '../../entities'; import { bigNumbertoStringOrNull } from '../../utils'; export type ExchangeEventEntity = ExchangeFillEvent | ExchangeCancelEvent | ExchangeCancelUpToEvent; diff --git a/packages/pipeline/src/parsers/relayer_registry/index.ts b/packages/pipeline/src/parsers/relayer_registry/index.ts index 50fd12443..a61f4e62a 100644 --- a/packages/pipeline/src/parsers/relayer_registry/index.ts +++ b/packages/pipeline/src/parsers/relayer_registry/index.ts @@ -1,7 +1,7 @@ import * as R from 'ramda'; import { RelayerResponse, RelayerResponseNetwork } from '../../data_sources/relayer-registry'; -import { Relayer } from '../../entities/Relayer'; +import { Relayer } from '../../entities'; export function parseRelayers(rawResp: Map<string, RelayerResponse>): Relayer[] { const parsedAsObject = R.mapObjIndexed(parseRelayer, rawResp); diff --git a/packages/pipeline/src/parsers/sra_orders/index.ts b/packages/pipeline/src/parsers/sra_orders/index.ts index 39c222afd..5cd19b08a 100644 --- a/packages/pipeline/src/parsers/sra_orders/index.ts +++ b/packages/pipeline/src/parsers/sra_orders/index.ts @@ -3,7 +3,7 @@ import { assetDataUtils, orderHashUtils } from '@0x/order-utils'; import { AssetProxyId, ERC721AssetData } from '@0x/types'; import * as R from 'ramda'; -import { SraOrder } from '../../entities/SraOrder'; +import { SraOrder } from '../../entities'; import { bigNumbertoStringOrNull } from '../../utils'; export function parseSraOrders(rawOrdersResponse: OrdersResponse): SraOrder[] { diff --git a/packages/pipeline/src/parsers/web3/index.ts b/packages/pipeline/src/parsers/web3/index.ts index c6647c966..11571278b 100644 --- a/packages/pipeline/src/parsers/web3/index.ts +++ b/packages/pipeline/src/parsers/web3/index.ts @@ -1,7 +1,6 @@ import { BlockWithoutTransactionData, Transaction as EthTransaction } from 'ethereum-types'; -import { Block } from '../../entities/Block'; -import { Transaction } from '../../entities/Transaction'; +import { Block, Transaction } from '../../entities'; export function parseBlock(rawBlock: BlockWithoutTransactionData): Block { if (rawBlock.hash == null) { diff --git a/packages/pipeline/src/scripts/merge_v2_events.ts b/packages/pipeline/src/scripts/merge_v2_events.ts index 227ece121..99a76aa61 100644 --- a/packages/pipeline/src/scripts/merge_v2_events.ts +++ b/packages/pipeline/src/scripts/merge_v2_events.ts @@ -3,7 +3,7 @@ import 'reflect-metadata'; import { Connection, createConnection } from 'typeorm'; import { ExchangeEventsSource } from '../data_sources/contract-wrappers/exchange_events'; -import { ExchangeFillEvent } from '../entities/ExchangeFillEvent'; +import { ExchangeFillEvent } from '../entities'; import { deployConfig } from '../ormconfig'; import { parseExchangeEvents } from '../parsers/events'; diff --git a/packages/pipeline/src/scripts/pull_missing_events.ts b/packages/pipeline/src/scripts/pull_missing_events.ts index 1f71722a3..a108f012f 100644 --- a/packages/pipeline/src/scripts/pull_missing_events.ts +++ b/packages/pipeline/src/scripts/pull_missing_events.ts @@ -5,7 +5,7 @@ import 'reflect-metadata'; import { Connection, createConnection, Repository } from 'typeorm'; import { ExchangeEventsSource } from '../data_sources/contract-wrappers/exchange_events'; -import { ExchangeFillEvent } from '../entities/ExchangeFillEvent'; +import { ExchangeFillEvent } from '../entities'; import { deployConfig } from '../ormconfig'; import { parseExchangeEvents } from '../parsers/events'; diff --git a/packages/pipeline/src/scripts/update_relayer_info.ts b/packages/pipeline/src/scripts/update_relayer_info.ts index 05e045ff4..f54e16b6c 100644 --- a/packages/pipeline/src/scripts/update_relayer_info.ts +++ b/packages/pipeline/src/scripts/update_relayer_info.ts @@ -2,7 +2,7 @@ import 'reflect-metadata'; import { Connection, createConnection } from 'typeorm'; import { RelayerRegistrySource } from '../data_sources/relayer-registry'; -import { Relayer } from '../entities/Relayer'; +import { Relayer } from '../entities'; import { deployConfig } from '../ormconfig'; import { parseRelayers } from '../parsers/relayer_registry'; diff --git a/packages/pipeline/test/parsers/events/index_test.ts b/packages/pipeline/test/parsers/events/index_test.ts index 451988f8e..fdd07f246 100644 --- a/packages/pipeline/test/parsers/events/index_test.ts +++ b/packages/pipeline/test/parsers/events/index_test.ts @@ -4,7 +4,7 @@ import * as chai from 'chai'; import { LogWithDecodedArgs } from 'ethereum-types'; import 'mocha'; -import { ExchangeFillEvent } from '../../../src/entities/ExchangeFillEvent'; +import { ExchangeFillEvent } from '../../../src/entities'; import { _convertToEntity } from '../../../src/parsers/events'; import { chaiSetup } from '../../utils/chai_setup'; diff --git a/packages/pipeline/test/parsers/sra_orders/index_test.ts b/packages/pipeline/test/parsers/sra_orders/index_test.ts index eb181ece5..fee32a0a7 100644 --- a/packages/pipeline/test/parsers/sra_orders/index_test.ts +++ b/packages/pipeline/test/parsers/sra_orders/index_test.ts @@ -3,7 +3,7 @@ import { BigNumber } from '@0x/utils'; import * as chai from 'chai'; import 'mocha'; -import { SraOrder } from '../../../src/entities/SraOrder'; +import { SraOrder } from '../../../src/entities'; import { _convertToEntity } from '../../../src/parsers/sra_orders'; import { chaiSetup } from '../../utils/chai_setup'; |