-
Notifications
You must be signed in to change notification settings - Fork 515
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Renaming the packages to official names
[FAB-1897] Per discussions in the community, package names for the node.js SDK has been changed like the following: - hfc to fabric-client - hfc-cop to fabric-ca-client This is step 1 of the alpha release activities [FAB-1896] Change-Id: Ic2cc80bfd467c22c1fe3a6b37a62159bf258aedd Signed-off-by: Jim Zhang <[email protected]>
- Loading branch information
1 parent
4bd1a9d
commit fd85330
Showing
85 changed files
with
2,238 additions
and
151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
'use strict'; | ||
|
||
var gulp = require('gulp'); | ||
var debug = require('gulp-debug'); | ||
|
||
const DEPS = [ | ||
'fabric-client/lib/api.js', | ||
'fabric-client/lib/hash.js', | ||
'fabric-client/lib/utils.js', | ||
'fabric-client/lib/Config.js', | ||
'fabric-client/lib/Remote.js', | ||
'fabric-client/lib/impl/CouchDBKeyValueStore.js', | ||
'fabric-client/lib/impl/CryptoSuite_ECDSA_AES.js', | ||
'fabric-client/lib/impl/ecdsa/*', | ||
'fabric-client/lib/impl/FileKeyValueStore.js' | ||
]; | ||
|
||
gulp.task('ca', function() { | ||
return gulp.src(DEPS, { base: 'fabric-client/' }) | ||
.pipe(debug()) | ||
.pipe(gulp.dest('fabric-ca-client/')); | ||
}); | ||
|
||
module.exports.DEPS = DEPS; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
## Hyperledger Fabric Member Service Client for Node.js | ||
|
||
This package encapsulates the APIs to interact with the Fabric member service to manage user certificates lifecycle such as register, enroll, renew and revoke. There is a separate package that interacts with Peers and Orderers of the Fabric network to deploy chaincodes, send transaction invocations and perform chaincode queries, and that is called `fabric-client`. | ||
|
||
For application developer documentations, please visit [http://fabric-sdk-node.readthedocs.io/en/master/](http://fabric-sdk-node.readthedocs.io/en/master/) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
## Hyperledger Fabric Client for Node.js | ||
|
||
This package encapsulates the APIs to interact with Peers and Orderers of the Fabric network to deploy chaincodes, send transaction invocations and perform chaincode queries. There is a separate package that interacts with the Fabric member service to manage user certificates lifecycle such as register, enroll, renew and revoke, and that is called `fabric-ca-client`. | ||
|
||
For application developer documentations, please visit [http://fabric-sdk-node.readthedocs.io/en/master/](http://fabric-sdk-node.readthedocs.io/en/master/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,152 @@ | ||
/** | ||
* Copyright 2016 IBM All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/** | ||
* This is the configuration class for the "fabric-client" package. | ||
* It provides all configuration settings using "config" node.js package to retrieve the | ||
* settings from JSON based files, environment settings, and command line startup settings | ||
* | ||
* configuration settings will be overridden in this order | ||
* first files are loaded in this order | ||
* $NODE_CONFIG_DIR/default.json | ||
* $NODE_CONFIG_DIR/$NODE_ENV.json | ||
* | ||
* NODE_CONFIG_DIR defaults to './config' the configuration directory is relative to where the application is started | ||
* NODE_ENV defaults to 'development' | ||
* | ||
* then then following environment setting will override file settings | ||
* $NODE_CONFIG | ||
* $ export NODE_CONFIG='{"request-timeout": 3000 }' | ||
* | ||
* then the command line setting will override all | ||
* node myapp.js --NODE_CONFIG='{"request-timeout": 7000 }' | ||
* | ||
* | ||
* see the following for complete information on the configuration settings | ||
* https://www.npmjs.com/package/config | ||
*/ | ||
|
||
'use strict'; | ||
|
||
var nconf = require('nconf'); | ||
var path = require('path'); | ||
|
||
// | ||
// The class representing the hierarchy of configuration settings. | ||
// | ||
// | ||
|
||
var Config = class { | ||
|
||
// Setup nconf to use (search order): | ||
// 1. in memory - all settings added with utils.setConfigSetting(name,value) | ||
// 2. Command-line arguments | ||
// 3. Environment variables (names will be change from AAA-BBB to aaa-bbb) | ||
// 4. user Files - all files added with the addConfigFile(path) | ||
// will be ordered by when added, were last one added will override previously added files | ||
// 5. The file located at 'config/default.json' with default settings | ||
// | ||
constructor() { | ||
nconf.use('memory'); | ||
nconf.argv(); | ||
nconf.env(); | ||
nconf.use('mapenv', {type:'memory'}); | ||
this.mapSettings(nconf.stores['mapenv'], process.env); | ||
this._fileStores = []; | ||
// reference to configuration settings | ||
this._config = nconf; | ||
// setup the location of the default config shipped with code | ||
var default_config = path.resolve( __dirname, '../config/default.json'); | ||
this.reorderFileStores(default_config); | ||
} | ||
|
||
// | ||
// utility method to map (convert) the environment(upper case and underscores) style | ||
// names to configuration (lower case and dashes) style names | ||
// | ||
mapSettings(store, settings) { | ||
for(var key in settings) { | ||
var value = settings[key]; | ||
key = key.toLowerCase(); | ||
key = key.replace(/_/g, '-'); | ||
// if(store.get(key)) { | ||
// throw new Error('Unable to map environment variable to configuration setting. | ||
// There is another config setting with the same converted name:'+key); | ||
// } | ||
store.set(key,value); | ||
} | ||
} | ||
|
||
// | ||
// utility method to reload the file based stores so | ||
// the last one added is on the top of the files hierarchy | ||
// | ||
reorderFileStores(path) { | ||
// first remove all the file stores | ||
for(var x in this._fileStores) { | ||
this._config.remove(this._fileStores[x]); | ||
} | ||
// now add this new file store to the front of the list | ||
this._fileStores.unshift(path); | ||
// now load all the file stores | ||
for(var x in this._fileStores) { | ||
var name = this._fileStores[x]; | ||
this._config.file(name, name); | ||
} | ||
} | ||
|
||
// | ||
// Add an additional file | ||
// | ||
file(path) { | ||
if(typeof path !== 'string') { | ||
throw new Error('The "path" parameter must be a string'); | ||
} | ||
// just reuse the path name as the store name...will be unique | ||
this.reorderFileStores(path); | ||
} | ||
|
||
// | ||
// Get the config setting with name. | ||
// If the setting is not found returns the default value provided. | ||
// | ||
get(name, default_value) { | ||
var return_value = null; | ||
|
||
try { | ||
return_value = this._config.get(name); | ||
} | ||
catch(err) { | ||
return_value = default_value; | ||
} | ||
|
||
if(return_value === null || return_value === undefined) { | ||
return_value = default_value; | ||
} | ||
|
||
return return_value; | ||
} | ||
|
||
// | ||
// Set a value into the 'memory' store of config settings. This will override all other settings | ||
// | ||
set(name, value) { | ||
this._config.set(name,value); | ||
} | ||
|
||
}; | ||
|
||
module.exports = Config; |
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.