{"action":"created","issue":{"url":"https://api.github.com/repos/hyperledger/composer/issues/3169","repository_url":"https://api.github.com/repos/hyperledger/composer","labels_url":"https://api.github.com/repos/hyperledger/composer/issues/3169/labels{/name}","comments_url":"https://api.github.com/repos/hyperledger/composer/issues/3169/comments","events_url":"https://api.github.com/repos/hyperledger/composer/issues/3169/events","html_url":"https://github.com/hyperledger/composer/issues/3169","id":289258721,"node_id":"MDU6SXNzdWUyODkyNTg3MjE=","number":3169,"title":"As a composer developer, I want to access third-party packages from my Transaction Processor functions","user":{"login":"andrew-coleman","id":7985120,"node_id":"MDQ6VXNlcjc5ODUxMjA=","avatar_url":"https://avatars1.githubusercontent.com/u/7985120?v=4","gravatar_id":"","url":"https://api.github.com/users/andrew-coleman","html_url":"https://github.com/andrew-coleman","followers_url":"https://api.github.com/users/andrew-coleman/followers","following_url":"https://api.github.com/users/andrew-coleman/following{/other_user}","gists_url":"https://api.github.com/users/andrew-coleman/gists{/gist_id}","starred_url":"https://api.github.com/users/andrew-coleman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrew-coleman/subscriptions","organizations_url":"https://api.github.com/users/andrew-coleman/orgs","repos_url":"https://api.github.com/users/andrew-coleman/repos","events_url":"https://api.github.com/users/andrew-coleman/events{/privacy}","received_events_url":"https://api.github.com/users/andrew-coleman/received_events","type":"User","site_admin":false},"labels":[{"id":799184949,"node_id":"MDU6TGFiZWw3OTkxODQ5NDk=","url":"https://api.github.com/repos/hyperledger/composer/labels/improvement%20proposal","name":"improvement proposal","color":"f7beed","default":false},{"id":904510608,"node_id":"MDU6TGFiZWw5MDQ1MTA2MDg=","url":"https://api.github.com/repos/hyperledger/composer/labels/stale","name":"stale","color":"ffffff","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-01-17T13:04:46Z","updated_at":"2018-08-29T08:46:56Z","closed_at":"2018-05-01T10:41:40Z","author_association":"MEMBER","body":"## Abstract\r\nModify the Composer API and Transaction Processor (TP) Function framework to support Javascript TP logic that is packaged as an ES6 module, and consumes the Composer API as an imported module rather than via global functions.\r\n\r\n## Motivation\r\nCurrently the framework and API for Transaction Processor functions relies on global functions rather than the standard ES6 module import/expert mechanism.  One consequence of this is that third-party NPM modules cannot be accessed from  TP functions.\r\n\r\nThis issue is part of a larger initiative to align the APIs of Fabric and Composer to create a more consistent developer experience between these two components.  It also address the requirements of users who wish to access third-party node modules from within their TP logic.  This new format will also make it easier for the developer to unit test their TP code using frameworks such as Mocha.\r\n\r\n## Specification\r\nTransaction Processing functions will be written in Javascript files that conform to the ES6 module specification.  Functions that are to be invoked by Composer transactions must be exported by the module.  Any third party modules required by the TP functions can be imported using the node.js ‘require’ mechanism or the ES6 module ‘import’ statement.  The Composer TP API will also be packaged as a module so that API functions that are currently available as globals (e.g. `getAssetRegistry()`, etc) will need to be imported/required like any other module.\r\n\r\n## Rationale\r\nThis capability has been requested by several users, and in some cases has been a blocker to using Composer services.  \r\n\r\n## Backwards Compatibility\r\nThis is a breaking change and will require existing TP code to be upgraded to use the ES6 module syntax.\r\n\r\n## Test Cases\r\nThe unit tests and integration tests that contain TP functions will need to be modified to the new format.  New tests will be written to test the ability to import external modules.\r\n\r\n## Implementation\r\nThis implementation of this first of all requires https://github.com/hyperledger/composer/issues/3160 to be implemented.  Following this, the composer framework will be modified to import Transaction Processor functions packaged as an ES6 module.  The Composer API will also be packaged as a module.\r\n\r\n## Copyright\r\nThis document is licensed under the Creative Commons Attribution 4.0 International Public License.\r\n"},"comment":{"url":"https://api.github.com/repos/hyperledger/composer/issues/comments/416875367","html_url":"https://github.com/hyperledger/composer/issues/3169#issuecomment-416875367","issue_url":"https://api.github.com/repos/hyperledger/composer/issues/3169","id":416875367,"node_id":"MDEyOklzc3VlQ29tbWVudDQxNjg3NTM2Nw==","user":{"login":"nasht00","id":329834,"node_id":"MDQ6VXNlcjMyOTgzNA==","avatar_url":"https://avatars0.githubusercontent.com/u/329834?v=4","gravatar_id":"","url":"https://api.github.com/users/nasht00","html_url":"https://github.com/nasht00","followers_url":"https://api.github.com/users/nasht00/followers","following_url":"https://api.github.com/users/nasht00/following{/other_user}","gists_url":"https://api.github.com/users/nasht00/gists{/gist_id}","starred_url":"https://api.github.com/users/nasht00/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nasht00/subscriptions","organizations_url":"https://api.github.com/users/nasht00/orgs","repos_url":"https://api.github.com/users/nasht00/repos","events_url":"https://api.github.com/users/nasht00/events{/privacy}","received_events_url":"https://api.github.com/users/nasht00/received_events","type":"User","site_admin":false},"created_at":"2018-08-29T08:46:56Z","updated_at":"2018-08-29T08:46:56Z","author_association":"CONTRIBUTOR","body":"This should not be closed...."}}
{"actor":{"display_login":"nasht00"}}