Skip to content

Commit b3af4b0

Browse files
author
Kedar
authored
Merge pull request #22 from OpenSTFoundation/release-0.9
Releasing v0.9.0 to master
2 parents 6c85b11 + 02cee1b commit b3af4b0

24 files changed

+2368
-190
lines changed

.gitignore

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,19 @@ build/Release
3131
# https://docs.npmjs.com/cli/shrinkwrap#caveats
3232
node_modules
3333

34+
tests/scripts/st-poa/
35+
36+
tests/scripts/poa-genesis.json
37+
38+
tests/scripts/pw
39+
40+
3441
# Dev Folder
3542
.dev
3643

3744
# Debug log from npm
3845
npm-debug.log
3946
.vscode
4047

41-
.DS_Store
48+
.DS_Store
49+

.travis.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
dist: trusty
2+
language: node_js
3+
cache:
4+
directories:
5+
- ~/.ethash
6+
sudo: required
7+
branches:
8+
only:
9+
- master
10+
- develop
11+
notifications:
12+
email:
13+
recipients:
14+
- ci.report@ost.com
15+
on_success: always
16+
on_failure: always
17+
node_js:
18+
- "8"
19+
before_install:
20+
- sudo apt-get update
21+
- sudo apt-get install nodejs
22+
- sudo apt-get install npm
23+
- sudo apt-get install software-properties-common
24+
- sudo add-apt-repository -y ppa:ethereum/ethereum
25+
- sudo apt-get update
26+
- sudo bash tests/scripts/install_geth_1_8_3.sh
27+
- geth version
28+
install:
29+
- npm install
30+
before_script:
31+
- mkdir -p ~/.ethash
32+
- geth makedag 0 ~/.ethash
33+
- node tests/scripts/setup_geth.js
34+
script:
35+
- node_modules/mocha/bin/mocha tests/mocha/lib/logger/custom_console_logger.js --timeout 5000 --exit
36+
- node_modules/mocha/bin/mocha tests/mocha/lib/ost_web3/ost-web3.js --timeout 50000 --exit
37+
- node_modules/mocha/bin/mocha tests/mocha/lib/promise_context/promise_context.js --timeout 50000 --exit
38+
- node_modules/mocha/bin/mocha tests/mocha/lib/promise_context/promise_queue_manager.js --timeout 50000 --exit
39+
- node_modules/mocha/bin/mocha tests/mocha/lib/formatter/response_helper.js --timeout 5000 --exit
40+
- node_modules/mocha/bin/mocha tests/mocha/lib/web3_pool/ost_web3_pool_factory.js --timeout 50000 --exit
41+
42+
after_script:
43+
- kill $(ps aux | grep 'geth' | awk '{print $2}')

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
## OpenST-Base v0.9.0 (17 May 2018)
2+
- OpenST Base repository was created and all the common functionality which different openst modules need were moved to it. Example - Logger, response helper, promise context, promise queue manager and web3.
3+
- Log level support was introduced and non-important logs were moved to debug log level.
4+
- Standardized error codes are now being used in OpenST Base.

README.md

Lines changed: 64 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -182,18 +182,75 @@ Log Level only controls what needs to be logged.
182182
| trace | TRACE |
183183
184184
185-
# OpenST formatter usage
185+
# OpenST response formatter usage
186186
187187
```bash
188+
189+
const rootPrefix = '.'
190+
, paramErrorConfig = require(rootPrefix + '/tests/mocha/lib/formatter/param_error_config')
191+
, apiErrorConfig = require(rootPrefix + '/tests/mocha/lib/formatter/api_error_config')
192+
;
193+
188194
const OSTCore = require('@openstfoundation/openst-base')
189-
, ResponseHelper = OSTCore.responseHelper;
195+
, ResponseHelper = OSTCore.responseHelper
196+
, responseHelper = new ResponseHelper({
197+
moduleName: 'companyRestFulApi'
198+
});
190199

191-
responseHelper = new ResponseHelper();
200+
//using error function
201+
responseHelper.error({
202+
internal_error_identifier: 's_vt_1',
203+
api_error_identifier: 'test_1',
204+
debug_options: {client_id: 1234},
205+
error_config: {
206+
param_error_config: paramErrorConfig,
207+
api_error_config: apiErrorConfig
208+
}
209+
});
192210

193-
//using successWithData function
194-
responseHelper.successWithData({field: value});
211+
//using paramValidationError function
212+
responseHelper.paramValidationError({
213+
internal_error_identifier:"s_vt_2",
214+
api_error_identifier: "test_1",
215+
params_error_identifiers: ["user_name_inappropriate"],
216+
debug_options: {client_id: 1234},
217+
error_config: {
218+
param_error_config: paramErrorConfig,
219+
api_error_config: apiErrorConfig
220+
}
221+
});
195222

196-
//using error function
197-
responseHelper.error("err_code", "Unhandled result", {}, {sendErrorEmail: false});
223+
// Result object is returned from responseHelper method invocations above, we can chain several methods as shown below
224+
225+
responseHelper.error({
226+
internal_error_identifier: 's_vt_1',
227+
api_error_identifier: 'invalid_api_params',
228+
debug_options: {client_id: 1234},
229+
error_config: {
230+
param_error_config: paramErrorConfig,
231+
api_error_config: apiErrorConfig
232+
}
233+
}).isSuccess();
234+
235+
responseHelper.error({
236+
internal_error_identifier: 's_vt_1',
237+
api_error_identifier: 'invalid_api_params',
238+
debug_options: {client_id: 1234},
239+
error_config: {
240+
param_error_config: paramErrorConfig,
241+
api_error_config: apiErrorConfig
242+
}
243+
}).isFailure();
244+
245+
responseHelper.error({
246+
internal_error_identifier: 's_vt_1',
247+
api_error_identifier: 'invalid_api_params',
248+
debug_options: {client_id: 1234},
249+
error_config: {
250+
param_error_config: paramErrorConfig,
251+
api_error_config: apiErrorConfig
252+
}
253+
}).toHash();
254+
198255

199256
```

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.9.0-beta.13
1+
0.9.0

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const rootPrefix = '.'
1313
, PCQueueManager = require( rootPrefix + '/lib/promise_context/promise_queue_manager' )
1414
, Web3PoolFactory = require( rootPrefix + '/lib/web3_pool/ost_web3_pool_factory' )
1515
, Web3Pool = require( rootPrefix + '/lib/web3_pool/ost_web3_pool' )
16-
, responseHelper = require(rootPrefix + '/lib/formatter/response')
16+
, responseHelper = require(rootPrefix + '/lib/formatter/response_helper')
1717
;
1818

1919
// Expose all libs here.

lib/formatter/response.js

Lines changed: 0 additions & 165 deletions
This file was deleted.

0 commit comments

Comments
 (0)