This repository has been archived by the owner on Mar 8, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 723
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make it fail on publish error and add required modules for verdaccio (#…
…3552) Signed-off-by: Nick Lincoln <[email protected]>
- Loading branch information
Showing
52 changed files
with
793 additions
and
283 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
coverage | ||
dist | ||
node_modules | ||
e2e/data/files | ||
e2e/data |
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 |
---|---|---|
|
@@ -63,3 +63,6 @@ npm-debug.log | |
|
||
# Usabilla code template | ||
usabilla.html.template | ||
|
||
#pm2 files | ||
*.pm2 |
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
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,40 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
import path = require('path'); | ||
|
||
export class Constants { | ||
|
||
static readonly shortWait = 5000; | ||
|
||
static readonly longWait = 10000; | ||
|
||
static readonly mlongwait = 30000; | ||
|
||
static readonly vlongwait = 240000; | ||
|
||
static readonly webPlaygroundPort = 3001; | ||
static readonly fabricPlaygroundPort = 3002; | ||
|
||
static readonly sampleNetworks = ['basic-sample-network', 'import-network']; | ||
|
||
static readonly downloadLocation = path.join(__dirname, 'downloads'); | ||
static readonly sampleNetworkDir = path.join(__dirname, 'data/sample-networks'); | ||
static readonly tempDir = path.join(__dirname, 'tmp'); | ||
static readonly scriptsDir = path.join(__dirname, 'scripts'); | ||
|
||
static readonly fabricBaseDir = path.join(__dirname, 'fabric'); | ||
static readonly fabricConfigDir = path.join(Constants.fabricBaseDir, 'hlfv1'); | ||
static readonly peerAdminCardName = 'TestPeerAdmin.card'; | ||
} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
17 changes: 17 additions & 0 deletions
17
...ges/composer-playground/e2e/data/sample-networks/basic-sample-network/README.md
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,17 @@ | ||
# Welcome to Hyperledger Composer! | ||
|
||
This is the "Hello World" of Hyperledger Composer samples. | ||
|
||
This sample defines a business network composed of a single asset type (`SampleAsset`), a single participant type (`SampleParticipant`), a single transaction type (`SampleTransaction`), and a single event type (`SampleEvent`). | ||
|
||
`SampleAssets` are owned by a `SampleParticipant`, and the value property on a `SampleAsset` can be modified by submitting a `SampleTransaction`. The `SampleTransaction` emits a `SampleEvent` that notifies applications of the old and new values for each modified `SampleAsset`. | ||
|
||
To get started inside Hyperledger Composer you can click the Test tab and create instances of `SampleAsset` and `SampleParticipant`. Make sure that the owner property on the `SampleAsset` refers to a `SampleParticipant` that you have created. | ||
|
||
You can then submit a `SampleTransaction`, making sure that the asset property refers to an asset that you created earlier. After the transaction has been processed you should see that the value property on the asset has been modified, and that a `SampleEvent` has been emitted. | ||
|
||
The logic for updating the asset when a `SampleTransaction` is processed is written in `sample.js`. | ||
|
||
Don't forget that you can import more advanced samples into Hyperledger Composer using the Import/Replace button. | ||
|
||
Have fun learning Hyperledger Composer! |
48 changes: 48 additions & 0 deletions
48
packages/composer-playground/e2e/data/sample-networks/basic-sample-network/lib/sample.js
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,48 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
/** | ||
* Sample transaction processor function. | ||
* @param {org.acme.sample.SampleTransaction} tx The sample transaction instance. | ||
* @transaction | ||
*/ | ||
function sampleTransaction(tx) { | ||
|
||
// Save the old value of the asset. | ||
var oldValue = tx.asset.value; | ||
|
||
// Update the asset with the new value. | ||
tx.asset.value = tx.newValue; | ||
|
||
// Get the asset registry for the asset. | ||
return getAssetRegistry('org.acme.sample.SampleAsset') | ||
.then(function (assetRegistry) { | ||
|
||
// Update the asset in the asset registry. | ||
return assetRegistry.update(tx.asset); | ||
|
||
}) | ||
.then(function () { | ||
|
||
// Emit an event for the modified asset. | ||
var event = getFactory().newEvent('org.acme.sample', 'SampleEvent'); | ||
event.asset = tx.asset; | ||
event.oldValue = oldValue; | ||
event.newValue = tx.newValue; | ||
emit(event); | ||
|
||
}); | ||
|
||
} | ||
|
37 changes: 37 additions & 0 deletions
37
packages/composer-playground/e2e/data/sample-networks/basic-sample-network/models/sample.cto
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,37 @@ | ||
/** | ||
* Sample business network definition. | ||
*/ | ||
namespace org.acme.sample | ||
|
||
asset SampleAsset identified by assetId { | ||
o String assetId | ||
--> SampleParticipant owner | ||
o String value | ||
} | ||
|
||
asset SampleComplexAsset identified by assetId { | ||
o String assetId | ||
o Boolean booleanField | ||
o DateTime dateTimeField | ||
o Double doubleField | ||
o Integer integerField | ||
o Long longField | ||
o String[] arrayField optional | ||
} | ||
|
||
participant SampleParticipant identified by participantId { | ||
o String participantId | ||
o String firstName | ||
o String lastName | ||
} | ||
|
||
transaction SampleTransaction { | ||
--> SampleAsset asset | ||
o String newValue | ||
} | ||
|
||
event SampleEvent { | ||
o String oldValue | ||
o String newValue | ||
--> SampleAsset asset | ||
} |
1 change: 1 addition & 0 deletions
1
packages/composer-playground/e2e/data/sample-networks/basic-sample-network/package.json
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 @@ | ||
{"name":"basic-sample-network","version":"0.1.0","description":"The Hello World of Hyperledger Composer samples","scripts":{"prepublish":"mkdirp ./dist && composer archive create --sourceType dir --sourceName . -a ./dist/basic-sample-network.bna","pretest":"npm run lint","lint":"eslint .","postlint":"npm run licchk","licchk":"license-check","postlicchk":"npm run doc","doc":"jsdoc --pedantic --recurse -c jsdoc.conf","test-inner":"mocha --recursive && cucumber-js","test-cover":"nyc npm run test-inner","test":"npm run test-inner"},"repository":{"type":"git","url":"https://github.com/hyperledger/composer-sample-networks.git"},"keywords":["sample","network"],"author":"Hyperledger Composer","license":"Apache-2.0","devDependencies":{"browserfs":"^1.2.0","chai":"^3.5.0","chai-as-promised":"^6.0.0","composer-admin":"latest","composer-cli":"latest","composer-client":"latest","composer-connector-embedded":"latest","composer-cucumber-steps":"latest","cucumber":"^2.2.0","eslint":"^3.6.1","istanbul":"^0.4.5","jsdoc":"^3.4.1","license-check":"^1.1.5","mkdirp":"^0.5.1","mocha":"^3.2.0","moment":"^2.17.1","nyc":"^11.0.2"},"license-check-config":{"src":["**/*.js","!./coverage/**/*","!./node_modules/**/*","!./out/**/*","!./scripts/**/*"],"path":"header.txt","blocking":true,"logInfo":false,"logError":true},"nyc":{"exclude":["coverage/**","features/**","out/**","test/**"],"reporter":["text-summary","html"],"all":true,"check-coverage":true,"statements":100,"branches":100,"functions":100,"lines":100}} |
52 changes: 52 additions & 0 deletions
52
packages/composer-playground/e2e/data/sample-networks/basic-sample-network/permissions.acl
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,52 @@ | ||
/** | ||
* Sample access control list. | ||
*/ | ||
rule AllAccess { | ||
description: "AllAccess - grant everything to everybody" | ||
participant: "org.hyperledger.composer.system.Participant" | ||
operation: ALL | ||
resource: "org.hyperledger.composer.system.**" | ||
action: ALLOW | ||
} | ||
|
||
rule EverybodyCanReadEverything { | ||
description: "Allow all participants read access to all resources" | ||
participant: "org.acme.sample.SampleParticipant" | ||
operation: READ | ||
resource: "org.acme.sample.*" | ||
action: ALLOW | ||
} | ||
|
||
rule EverybodyCanSubmitTransactions { | ||
description: "Allow all participants to submit transactions" | ||
participant: "org.acme.sample.SampleParticipant" | ||
operation: CREATE | ||
resource: "org.acme.sample.SampleTransaction" | ||
action: ALLOW | ||
} | ||
|
||
rule OwnerHasFullAccessToTheirAssets { | ||
description: "Allow all participants full access to their assets" | ||
participant(p): "org.acme.sample.SampleParticipant" | ||
operation: ALL | ||
resource(r): "org.acme.sample.SampleAsset" | ||
condition: (r.owner.getIdentifier() === p.getIdentifier()) | ||
action: ALLOW | ||
} | ||
|
||
rule NetworkAdminUser { | ||
description: "Grant business network administrators full access to user resources" | ||
participant: "org.hyperledger.composer.system.NetworkAdmin" | ||
operation: ALL | ||
resource: "**" | ||
action: ALLOW | ||
} | ||
|
||
rule NetworkAdminSystem { | ||
description: "Grant business network administrators full access to system resources" | ||
participant: "org.hyperledger.composer.system.NetworkAdmin" | ||
operation: ALL | ||
resource: "org.hyperledger.composer.system.**" | ||
action: ALLOW | ||
} | ||
|
17 changes: 17 additions & 0 deletions
17
packages/composer-playground/e2e/data/sample-networks/import-network/README.md
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,17 @@ | ||
# Welcome to Hyperledger Composer! | ||
|
||
This is the "Hello World" of Hyperledger Composer samples. | ||
|
||
This sample defines a business network composed of a single asset type (`SampleAsset`), a single participant type (`SampleParticipant`), a single transaction type (`SampleTransaction`), and a single event type (`SampleEvent`). | ||
|
||
`SampleAssets` are owned by a `SampleParticipant`, and the value property on a `SampleAsset` can be modified by submitting a `SampleTransaction`. The `SampleTransaction` emits a `SampleEvent` that notifies applications of the old and new values for each modified `SampleAsset`. | ||
|
||
To get started inside Hyperledger Composer you can click the Test tab and create instances of `SampleAsset` and `SampleParticipant`. Make sure that the owner property on the `SampleAsset` refers to a `SampleParticipant` that you have created. | ||
|
||
You can then submit a `SampleTransaction`, making sure that the asset property refers to an asset that you created earlier. After the transaction has been processed you should see that the value property on the asset has been modified, and that a `SampleEvent` has been emitted. | ||
|
||
The logic for updating the asset when a `SampleTransaction` is processed is written in `sample.js`. | ||
|
||
Don't forget that you can import more advanced samples into Hyperledger Composer using the Import/Replace button. | ||
|
||
Have fun learning Hyperledger Composer! |
47 changes: 47 additions & 0 deletions
47
packages/composer-playground/e2e/data/sample-networks/import-network/lib/sample.js
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,47 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
/** | ||
* Sample transaction processor function. | ||
* @param {org.acme.sample.SampleTransaction} tx The sample transaction instance. | ||
* @transaction | ||
*/ | ||
function sampleTransaction(tx) { | ||
|
||
// Save the old value of the asset. | ||
var oldValue = tx.asset.value; | ||
|
||
// Update the asset with the new value. | ||
tx.asset.value = tx.newValue; | ||
|
||
// Get the asset registry for the asset. | ||
return getAssetRegistry('org.acme.sample.SampleAsset') | ||
.then(function (assetRegistry) { | ||
|
||
// Update the asset in the asset registry. | ||
return assetRegistry.update(tx.asset); | ||
|
||
}) | ||
.then(function () { | ||
|
||
// Emit an event for the modified asset. | ||
var event = getFactory().newEvent('org.acme.sample', 'SampleEvent'); | ||
event.asset = tx.asset; | ||
event.oldValue = oldValue; | ||
event.newValue = tx.newValue; | ||
emit(event); | ||
|
||
}); | ||
|
||
} |
Oops, something went wrong.