Commit graph

16 commits

Author SHA1 Message Date
Mark S. Lewis
10e9377555 Avoid explicit import of grpc-js or fabric-protos in TypeScript apps
Rely on the dependencies of @hyperledger/fabric-gateway making these packages transitively available. Having explicit dependency versions in the application can cause type conflicts due to private member changes in the gRPC Client class across versions.

Also fix some missing or incorrect Node types and engines version contraints.

Signed-off-by: Mark S. Lewis <mark_lewis@uk.ibm.com>
2023-02-10 11:36:41 -05:00
Arnaud J Le Hors
8403da7386 Fix vulnerabilities in typescript chaincode deps
npm audit reveals several high and one critical vulnerabilities in the dependencies:

ansi-regex  4.0.0 - 4.1.0
Severity: high
Inefficient Regular Expression Complexity in chalk/ansi-regex - https://github.com/advisories/GHSA-93q8-gq69-wqmw
fix available via `npm audit fix`
node_modules/nyc/node_modules/ansi-regex

minimist  <=1.2.5
Severity: critical
Prototype Pollution in minimist - https://github.com/advisories/GHSA-xvch-5gv4-984h
Prototype Pollution in minimist - https://github.com/advisories/GHSA-vh95-rmgr-6w4m
fix available via `npm audit fix --force`
Will install mocha@10.0.0, which is a breaking change
node_modules/minimist
node_modules/ts-node/node_modules/minimist
  mkdirp  0.4.1 - 0.5.1
  Depends on vulnerable versions of minimist
  node_modules/mkdirp
    mocha  1.21.5 - 6.2.2 || 7.0.0-esm1 - 7.1.0
    Depends on vulnerable versions of mkdirp
    node_modules/mocha

protobufjs  6.11.0 - 6.11.2
Severity: high
Prototype Pollution in protobufjs - https://github.com/advisories/GHSA-g954-5hwp-pp24
fix available via `npm audit fix`
node_modules/protobufjs

5 vulnerabilities (2 moderate, 2 high, 1 critical)

This change (from running npm audit fix --force) removes all of them:
npm audit
found 0 vulnerabilities

Signed-off-by: Arnaud J Le Hors <lehors@us.ibm.com>
2022-08-03 12:00:58 -04:00
Matthew B White
4bbffdf2f2
Update Node.js dockerfile (#805)
Signed-off-by: Matthew B White <whitemat@uk.ibm.com>
2022-08-01 11:50:47 +00:00
Arnaud J Le Hors
8d7f3ca037
Fix sample external chaincode Dockerfile (#645)
Podman isn't as lenient as docker when it comes to the syntax of the
Dockerfile and insists on getting the ARG command properly scoped.
This fixes this error:
...
[2/2] STEP 12/15: EXPOSE $CC_SERVER_PORT
Error: error building at STEP "EXPOSE $CC_SERVER_PORT": EXPOSE requires at least one argument

Signed-off-by: Arnaud J Le Hors <lehors@us.ibm.com>
2022-03-09 08:47:59 +00:00
Matthew B White
96623f1bd5
Adding examples of CCAAS and support into the test-network (#560)
- Updated the test-network with examples of runnig CCAAS
- Updating the asset transfer basic with how to run chaincode as a service.

Signed-off-by: Matthew B White <whitemat@uk.ibm.com>
2021-12-17 13:18:22 +00:00
Mark S. Lewis
72559dfbb5
More Gateway asset-transfer-basic tweaks to support docs (#556)
Signed-off-by: Mark S. Lewis <mark_lewis@uk.ibm.com>
2021-12-10 08:51:21 +00:00
Tatsuya Sato
8c1c36ae09 Fix type error when using the latest sort-keys-recursive
The latest version (2.1.2) of sort-keys-recursive adds TypeScript
typing, which includes export default function.
This change has caused the TS2349 type error.

This patch modifies the import form in assetTransfer.ts to fix the error.

Signed-off-by: Tatsuya Sato <tatsuya.sato.so@hitachi.com>
2021-11-05 11:47:55 -04:00
sapthasurendran
56a1bf3e19
* Made consistent lint command (#495)
* Removed global install of lint modules
* Fixed Lint Issues

Signed-off-by: sapthasurendran <saptha.surendran@ibm.com>

added lint script forapplication javascript

Signed-off-by: sapthasurendran <saptha.surendran@ibm.com>

updated lint command  for chaincode javascript

Signed-off-by: sapthasurendran <saptha.surendran@ibm.com>

updated lint script

Signed-off-by: sapthasurendran <saptha.surendran@ibm.com>

remove installing dependencies

Signed-off-by: sapthasurendran <saptha.surendran@ibm.com>

added lint script to js projects

Signed-off-by: sapthasurendran <saptha.surendran@ibm.com>

added more lint scripts

Signed-off-by: sapthasurendran <saptha.surendran@ibm.com>

added more lint scripts

Signed-off-by: sapthasurendran <saptha.surendran@ibm.com>

added missing npm lint command

Signed-off-by: sapthasurendran <saptha.surendran@ibm.com>

added missing eslint npm module

Signed-off-by: sapthasurendran <saptha.surendran@ibm.com>

Fix missing npm lint command

Signed-off-by: sapthasurendran <saptha.surendran@ibm.com>

added missing eslint npm module to auction-simple javascctipt app

Signed-off-by: sapthasurendran <saptha.surendran@ibm.com>

added eslint npm module

Signed-off-by: sapthasurendran <saptha.surendran@ibm.com>

added eslint dependency

Signed-off-by: sapthasurendran <saptha.surendran@ibm.com>

added eslint dependency

Signed-off-by: sapthasurendran <saptha.surendran@ibm.com>

added eslint dependency

Signed-off-by: sapthasurendran <saptha.surendran@ibm.com>

Single command for ts js lint

Signed-off-by: sapthasurendran <saptha.surendran@ibm.com>

Fix or condition in lint.sh

Signed-off-by: sapthasurendran <saptha.surendran@ibm.com>
2021-10-06 13:33:29 +01:00
fraVlaca
53f0ef0d92
updated chaincodes for asset-transfer-basic in order to show good example on how achieving determinism over json (#486)
* updated chaincodes for asset-trnsfer-basic in order to show good example on how achieving determinism in json

Signed-off-by: fraVlaca <ocsenarf@outlook.com>

* final fixes for chaincode-java of asset-tranfer-basic

Signed-off-by: fraVlaca <ocsenarf@outlook.com>

* removed extra unused excheptions

Signed-off-by: fraVlaca <ocsenarf@outlook.com>

* corrected indentation of contract in the chancode-javasript of asset-trnsfer-basic

Signed-off-by: fraVlaca <ocsenarf@outlook.com>

* last fixes for chaincode-javascript of asset-transfer-basic

Signed-off-by: fraVlaca <ocsenarf@outlook.com>

* last last fixes for chaincode-javascript of asset-transfer-basic

Signed-off-by: fraVlaca <ocsenarf@outlook.com>
2021-09-06 13:47:25 +01:00
James Taylor
f84754ea3b
Update CreateAsset txn in basic js and ts sample (#460)
The Golang and Java sample chaincode returned an error when trying to create an asset which already exists

JavaScript and TypeScript samples should now do the same

Signed-off-by: James Taylor <jamest@uk.ibm.com>
2021-07-16 14:10:12 -04:00
Brett Logan
4c3fe17310 Refactor GetAllAssets
GetAllAssets uses getStateByRange which returns an iterator.
Refactored code to make use of the iterator as this code did
not function in its previous state

Signed-off-by: Brett Logan <brett.t.logan@ibm.com>
2020-07-27 23:51:51 -04:00
Brett Logan
bd38f9220b Capitalize Function Names
Short of creating a second application that calls
the lowerCase version of functions, since Go requires
the functions be exported, capitalizing them in the
Node and Typescript chaincode seems the simplest solution

Signed-off-by: Brett Logan <brett.t.logan@ibm.com>
2020-07-27 23:51:51 -04:00
Brett Logan
e31ecf3165 Decorate Typescript Chaincode
Add the contract-api specific annotations and
enable the experimental features.

Also properly format code according to the linter

Signed-off-by: Brett Logan <brett.t.logan@ibm.com>
2020-07-27 23:51:51 -04:00
Arnaud J Le Hors
7771b4f216
Revert "Remove Typescript References (#258)" (#261)
This reverts commit 7a23d7872a.
2020-07-23 17:06:57 +02:00
Brett Logan
7a23d7872a
Remove Typescript References (#258)
As the Typescript examples are essentially just reiterations
of the same Javascript code, there is no benefit to having
providing examples in both languages. The functional code
was exactly the same in both languages. On the contrary it
meant we widened the surface of maitainence and thus we are
removing due to the limited benefit provided by the example
chaincode and applications.

Signed-off-by: Brett Logan <brett.t.logan@ibm.com>
2020-07-22 21:57:54 +02:00
Chongxin Luo
a42bbba2c5 Adding chaincode-typescript to asset-transfer-basic sample.
Signed-off-by: Chongxin Luo <Chongxin.Luo@ibm.com>
2020-06-25 12:06:13 -04:00