Skip to content

Commit

Permalink
Build 1.1.4
Browse files Browse the repository at this point in the history
  • Loading branch information
emiliorizzo committed Aug 6, 2020
1 parent dd708ca commit e00e8bb
Show file tree
Hide file tree
Showing 14 changed files with 50 additions and 20 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## [1.1.4] - 2020-08-06

### Updated

- Db.createCollection to the new mongodb driver behavior
- blocks checker service, delay before start.
- config: disable services in config

## [1.1.3] - 2020-08-04

This release requires the regeneration of the DB follow the instructions in [UPDATES.md](UPDATES.md) before starting.
Expand Down
2 changes: 1 addition & 1 deletion dist/dbPatches/tokenAccountBalances.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
var _dataSource = _interopRequireDefault(require("../lib/dataSource.js"));
var _nod3Connect = _interopRequireDefault(require("../lib/nod3Connect"));
var _rskContractParser = _interopRequireDefault(require("rsk-contract-parser"));
var _rskUtils = require("rsk-utils");function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}
var _rskUtils = require("@rsksmart/rsk-utils");function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}

const parser = new _rskContractParser.default({ nod3: _nod3Connect.default });

Expand Down
15 changes: 10 additions & 5 deletions dist/lib/Db.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ class Db {
try {
const db = await this.db();
if (!collectionName) throw new Error('Invalid collection name');
let collection = await db.createCollection(collectionName, options);
let list = await db.listCollections({}, { nameOnly: true }).toArray();
let exists = list.find(c => c.name === collectionName);
if (!exists) await db.createCollection(collectionName, options);
let collection = db.collection(collectionName);
if (dropIndexes) {
this.log.info(`Removing indexes from ${collectionName}`);
await collection.dropIndexes();
Expand All @@ -63,16 +66,18 @@ class Db {
this.log.info(`Creating indexes to ${collectionName}`);
await collection.createIndexes(indexes);
}
if (validate) {
this.log.info(`Validating collection: ${collectionName}`);
await db.admin().validateCollection(collectionName);
}
if (validate) await this.validateCollection(db, collectionName);
return collection;
} catch (err) {
return Promise.reject(err);
}
}

validateCollection(db, collectionName) {
this.log.info(`Validating collection: ${collectionName}`);
return db.admin().validateCollection(collectionName);
}

createCollections(collections, creationOptions = {}) {
let queue = [];
let names = creationOptions.names || {};
Expand Down
7 changes: 7 additions & 0 deletions dist/lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ function makeConfig(config = {}) {
config.api.modules[module] = config.api.modules[module] !== false;
}

// defaults services
const services = config.blocks.services || {};
for (let s in _defaultConfig.default.blocks.services) {
services[s] = config.blocks.services[s] !== false;
}
services.ROUTER = true;
config.blocks.services = services;
// defaults servers/ports
config.source = nodeSources(config.source);
config.blocks.source = config.source;
Expand Down
17 changes: 12 additions & 5 deletions dist/lib/defaultConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,16 @@


var _types = require("./types");
var _delayedFields = _interopRequireDefault(require("./delayedFields"));function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };} /**
* This file provides default values,
* use /config.json, to overwrite settings
*/const setAllModules = (status) => Object.keys(_types.MODULES).
var _delayedFields = _interopRequireDefault(require("./delayedFields"));
var _servicesConfig = require("../services/servicesConfig");function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };} /**
* This file provides default values,
* use /config.json, to overwrite settings
*/const services = Object.assign({}, _servicesConfig.servicesNames);for (let s in services) {
services[s] = true;
}

const setAllModules = (status) =>
Object.keys(_types.MODULES).
reduce((a, v, i) => {
a[v] = status;
return a;
Expand Down Expand Up @@ -56,7 +62,8 @@ reduce((a, v, i) => {
debug: false,
updateTokenBalances: true, // Update token accounts balances on next block
ports: [3010], // list of services ports, if the list runs out, the services will try to take the next ports starting from the last
address: '127.0.0.1' },
address: '127.0.0.1',
services },

collectionsNames: {
Config: 'config',
Expand Down
2 changes: 1 addition & 1 deletion dist/lib/utils.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use strict";Object.defineProperty(exports, "__esModule", { value: true });var _exportNames = { bigNumberDoc: true, isBigNumber: true, serializeBigNumber: true, isSerializedBigNumber: true, unSerializeBigNumber: true, bigNumberToSring: true, bigNumberSum: true, bigNumberDifference: true, newBigNumber: true, isObj: true, serialize: true, checkBlockHash: true, isBlockHash: true, blockQuery: true, getBestBlock: true, applyDecimals: true, isValidBlockNumber: true, isBlockObject: true, toAscii: true, quantityMarks: true, chunkArray: true, hash: true };exports.hash = exports.chunkArray = exports.quantityMarks = exports.toAscii = exports.isBlockObject = exports.isValidBlockNumber = exports.applyDecimals = exports.getBestBlock = exports.blockQuery = exports.isBlockHash = exports.checkBlockHash = exports.serialize = exports.isObj = exports.newBigNumber = exports.bigNumberDifference = exports.bigNumberSum = exports.bigNumberToSring = exports.unSerializeBigNumber = exports.isSerializedBigNumber = exports.serializeBigNumber = exports.isBigNumber = exports.bigNumberDoc = void 0;var _bignumber = require("bignumber.js");
var _types = require("./types");
var _mongodb = require("mongodb");
var _rskUtils = require("rsk-utils");
var _rskUtils = require("@rsksmart/rsk-utils");

Object.keys(_rskUtils).forEach(function (key) {if (key === "default" || key === "__esModule") return;if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;Object.defineProperty(exports, key, { enumerable: true, get: function () {return _rskUtils[key];} });});var _crypto = _interopRequireDefault(require("crypto"));function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}

Expand Down
5 changes: 4 additions & 1 deletion dist/services/blocks.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
"use strict";Object.defineProperty(exports, "__esModule", { value: true });exports.apps = exports.paths = void 0;
var _config = _interopRequireDefault(require("../lib/config"));
var _servicesConfig = require("./servicesConfig");function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}
const { services } = _config.default.blocks;

const scripts = Object.values(_servicesConfig.servicesNames);
const scripts = Object.entries(_servicesConfig.servicesNames).
filter(([service]) => services[service]).
map(([service, name]) => name);

const scriptName = name => `${name}.js`;

Expand Down
2 changes: 1 addition & 1 deletion dist/services/blocks/blocksChecker.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ async function main() {
const { startService, service } = await (0, _serviceFactory.createService)(serviceConfig, executor, { log });
const { emit } = service;
await startService();
checker.start(emit);
setTimeout(() => checker.start(emit), 5000);
} catch (err) {
console.error(err);
process.exit(9);
Expand Down
2 changes: 1 addition & 1 deletion dist/services/classes/Address.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var _Contract = _interopRequireDefault(require("./Contract"));
var _rskContractParser = require("rsk-contract-parser");
var _Tx = require("./Tx");
var _InternalTx = require("./InternalTx");
var _rskUtils = require("rsk-utils");function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}
var _rskUtils = require("@rsksmart/rsk-utils");function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}

class Address extends _BcThing.BcThing {
constructor(address, { nod3, initConfig, collections, tx, block, log } = {}) {
Expand Down
2 changes: 1 addition & 1 deletion dist/services/classes/TokenAddress.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use strict";Object.defineProperty(exports, "__esModule", { value: true });exports.default = exports.TokenAddress = void 0;var _BcThing = require("./BcThing");
var _Contract = _interopRequireDefault(require("./Contract"));
var _utils = require("../../lib/utils");
var _rskUtils = require("rsk-utils");function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}
var _rskUtils = require("@rsksmart/rsk-utils");function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}

class TokenAddress extends _BcThing.BcThing {
constructor(address, contract) {
Expand Down
2 changes: 1 addition & 1 deletion dist/services/classes/UpdateTokenAccountBalances.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"use strict";Object.defineProperty(exports, "__esModule", { value: true });exports.updateTokenAccountBalances = updateTokenAccountBalances;
var _rskUtils = require("rsk-utils");
var _rskUtils = require("@rsksmart/rsk-utils");
var _rskContractParser = _interopRequireDefault(require("rsk-contract-parser"));function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}

async function updateTokenAccountBalances(block, { nod3, collections, log }) {
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rsk-explorer-api",
"version": "1.1.3",
"version": "1.1.4",
"description": "",
"main": "index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion public/swagger.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"info": {
"title": "rsk-explorer-api",
"version": "1.1.3",
"version": "1.1.4",
"description": "explorer API Documentation"
},
"swagger": "2.0",
Expand Down

0 comments on commit e00e8bb

Please sign in to comment.