v0.9.0
Pre-releaseImportant Breaking Changes
ACLs
The ACL syntax for specifying namespaces has changed. Previously, there was no way to distinguish between a namespace or class in ACLs. For example, org.acme.sample
could be a namespace, or a sample
asset in the org.acme
namespace. This ambiguity caused issue 946 ACL File validation broken when models with similar namespaces are loaded.
The syntax now uses a similar notation to imports in model files. For example, org.acme.sample
should now be org.acme.sample.*
as shown in this common ACL rule:
rule EverybodyCanReadEverything {
description: "Allow all participants read access to all resources"
participant: "org.acme.sample.SampleParticipant"
operation: READ
resource: "org.acme.sample.*"
action: ALLOW
}
System types
There are main elements of the Composer model file are asset transaction participant and event. Within a network, specific types can extend other types. This release adds in a system namespace, org.hyperledger.composer.system
that contains an abstract type for all assets, transactions, participants and events. These abstract types will be the implicit super-type of any other type unless that type already extends something.
The org.hyperledger.composer.system.Event
and org.hyperlegder.composer.system.Transaction
have two properties each of an identifier and timestamp. In effect they are as follows
abstract transaction Transaction identified by transactionId{
o String transactionId
o DateTime timestamp
}
abstract event Event identified by eventId{
o String eventId
o DateTime timestamp
}
The impact of this change is that
- any user defined transactions and/or events that have a 'transactionId' or 'eventId' or 'timestamp' will need to be removed.
- the network archive will need to be updated as a result
- ACLs might need to be updated if the current ACLs do not specifically include an allow for any type.
Reason for the change
Having to specify a transactionId in your own models was cumbersome; this will make future models easier to write and more future-proof. Likewise with events.
It also enables finer-grained control of the access control rules and permits future expansion to control operational access.
more information is available in issue 920
This includes a simple bash script that can be used to recursive search model files for possible places updates are required.
Queries
The queryNative
runtime API introduced in v0.8.0 that allowed you to execute a CouchDB query against Hyperledger Fabric v1.0 has been removed. This API was always planned to be temporary, to give users the ability to run complex queries over data before we released something better.
Note that queryNative
has several limitations - ACL rules are not applied to the results, nor is the data parsed and validated, and ACLs are not applied - limitations that we do not want to carry forwards.
We have introduced a new Composer query language (CQL) in #1234. The documentation will have details on using this, but it allows you to write queries in a high level language, which is similar to SQL:
SELECT org.acme.Driver
WHERE (_$ageParam < age)
ORDER BY [lastName ASC, firstName DESC]
LIMIT _$limitParam
SKIP _$skipParam
Composer queries can be defined in a query file (queries.qry
) in the business network definition and referenced by name, or can be created on the fly. Composer queries can include parameters, denoted by a leading _$
.
There are two new APIs for doing this on the runtime, buildQuery
(for building dynamic queries) and query
(for executing a named or dynamic query).
There are also two new APIs for executing these queries from the client side, BusinessNetworkConnection.buildQuery
and BusinessNetworkConnection.query
.
Please see the new trade-network sample for how to use queries:
https://github.com/hyperledger/composer-sample-networks/tree/master/packages/trade-network
Removal of deprecated methods
There are several methods that have been deprecated for a while now, and v0.9.0 is a good excuse to remove them.
ModelFile.getFileName()
This should not affect anybody, as this is an internal method. However, if anybody is using this, then ModelFile.getName()
is the correct method to be called.
Factory.newInstance()
This will affect anybody that is using the client APIs, or writing business network unit tests, but has been using this deprecated method. Please use Factory.newResource()
instead.
BusinessNetworkConnection.existsAssetRegistry()
If anybody is using this, then BusinessNetworkConnection.assetRegistryExists()
is the correct method to be called.
Composer Playground
As of this release, previous versions of Composer Playground will not be able to import samples from github through the playground interface any more. This is more applicable to users who have remained at
0.7.x versions of Composer Playground in order to be able to work with Hyperledger Fabric service providers whose services remain at Hyperledger Fabric alpha.1 releases.
Troubleshooting
Please ask on RocketChat for help if required. Please note that many issues can be resolved by stopping, starting docker containers, and also removing images.
Guidance on cleaning up existing images are described here.
Other Changes
- Range constraints not enforced (#1391)
- ACL support for VSCode extension (#383)
Documentation
-
You will see we have made some large changes to the way that our documentation is structured. This is a continuation of delivering a better docs experience for everyone! All the content has stayed the same, but we are making better use of your screen real-estate.
-
Known issue is on mobile at this point. Whilst navigable, we are looking to improve this further.