Skip to content
This repository has been archived by the owner on Jan 7, 2020. It is now read-only.

Commit

Permalink
Merge branch 'master' into test-loginForTest
Browse files Browse the repository at this point in the history
  • Loading branch information
bochaco authored Aug 7, 2018
2 parents 79d1c54 + c5d2ff3 commit 0d30397
Show file tree
Hide file tree
Showing 8 changed files with 299 additions and 190 deletions.
25 changes: 14 additions & 11 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
@@ -1,32 +1,35 @@
# safe_app nodejs Change Log

[Unreleased]
[0.9.0] - 27-7-2018
### Added
- New binding `simulateNetworkDisconnect()` function to simulate a network disconnection event useful for applications testing purposes.
- Support for forcing the use of mock by providing `forceUseMock` boolean to the initialisation options of each safeApp instance, i.e. each safeApp instance can either use mock or prod libs independently.
- Ability to pass user metadata when inserting and updating file in MutableData
- Prevents download of `system_uri` if `NODE_ENV=mobile_prod` or `NODE_ENV=mobile_dev`

### Changed
- Upgrade safe_app native library to commit `a9b4c05` and adapt to minor API changes
- Upgrade safe_app native library to v0.8.0
- Removing `forEach` binding function from the MutableData entries API as it was removed from safe_app lib
- Adding `listEntries` binding function to the MutableData entries API which returns an array with all entries
- Moves asynchronous app initialisation opertions out of SAFEApp constructor and into class method
- Moves asynchronous app initialisation operations out of SAFEApp constructor and into class method
- The `initializeApp` function is now asynchronous
- `webFetch` may receive multipart range requests
- changes fromAuthURI to fromAuthUri
- changes loginFromURI to loginFromUri
- uses delete instead of remove as entry mutation action
- changes initializeApp to use an s instead of z
- `webFetch` can now receive multipart range requests
- Changed `fromAuthURI` to `fromAuthUri`
- Changed `loginFromURI` to `loginFromUri`
- Uses `delete` instead of `remove` as entry mutation action
- Changed `initializeApp` to use an `s` instead of `z`
- Network state callback invoked from `INIT` to `CONNECTED` states
- Simplifies test helper functions
- Upgrades deps_downloader to v0.2.0
- Simplified test helper functions
- Upgraded deps_downloader to v0.2.0
- Isolated `webFetch` helper functions for testing
- Unregistered client connection event triggers network status update

### Fixed
- Fixed some tests which were giving false positive results
- Added missing error handling for `app_reconnect` to prevent false connection status

## SAFE libraries Dependencies
- safe_app: a9b4c05
- safe_app: v0.8.0
- system_uri: v0.4.0
- deps_downloader: v0.2.0

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@maidsafe/safe-node-app",
"version": "0.8.1",
"version": "0.9.0",
"description": "A safe_app library for Node.js",
"license": "(MIT OR BSD-3-Clause)",
"main": "src/index.js",
Expand Down Expand Up @@ -72,7 +72,7 @@
},
"safe_app": {
"mirror": "https://s3.eu-west-2.amazonaws.com/safe-client-libs",
"version": "a9b4c05",
"version": "0.8.0",
"targetDir": "src/native/prod",
"filename": "safe_app",
"filePattern": "^.*\\.(dll|so|dylib)$",
Expand Down
2 changes: 1 addition & 1 deletion src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const lib = require('./native/lib');
const consts = require('./consts');
const errConst = require('./error_const');
const makeError = require('./native/_error.js');
const webFetch = require('./web_fetch.js');
const { webFetch } = require('./web_fetch.js');

/**
* Validates appInfo and properly handles error
Expand Down
5 changes: 4 additions & 1 deletion src/native/_app.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ module.exports = {
}

app.connection = appCon;
app.networkState = consts.NET_STATE_CONNECTED;
app._networkStateUpdated(null, consts.NET_STATE_CONNECTED);
resolve(app);
});

Expand Down Expand Up @@ -90,6 +90,9 @@ module.exports = {
return new Promise((resolve, reject) => {
const result_cb = ffi.Callback("void", [t.VoidPtr, t.FfiResultPtr], (user_data, resultPtr) => {
const result = helpers.makeFfiResult(resultPtr);
if (result.error_code !== 0) {
return reject(makeError(result.error_code, result.error_description));
}

app._networkStateUpdated(null, consts.NET_STATE_CONNECTED);
resolve(result);
Expand Down
16 changes: 0 additions & 16 deletions src/native/_nfs.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,22 +53,6 @@ const readFileInfo = (fileInfo) => {
? new Buffer(0)
: new Buffer(ref.reinterpret(file.user_metadata_ptr, file.user_metadata_len));

if (user_metadata_ptr) {
try {
if(typeof user_metadata_ptr === 'object') {
user_metadata_ptr = user_metadata_ptr;
} else {
user_metadata_ptr = JSON.parse(user_metadata_ptr.toString());
}

} catch (e) {
// we can safely ignore this
if (console && console.warn) {
console.warn(`Parsing user metadata '${user_metadata_ptr}' of '${data_map_name}' failed: ${e}`)
}
}
}

let retFile = {
data_map_name,
size,
Expand Down
Loading

0 comments on commit 0d30397

Please sign in to comment.