{"_id":"@apexsupplychain/asc-conv-rest-api","_rev":"2-89ce88dfb3bd727f8a74d551afa8916d","name":"@apexsupplychain/asc-conv-rest-api","dist-tags":{"next":"0.1.5-next.1","latest":"0.1.5-next.0"},"versions":{"0.1.5-next.0":{"name":"@apexsupplychain/asc-conv-rest-api","version":"0.1.5-next.0","description":"Rest API generator for the Convector Framework","main":"./dist/index.js","typings":"./dist/index.d.ts","scripts":{"clean":"rimraf dist","build":"npm run clean && tsc","prepare":"npm run build","lint":"tslint --fix -c './tslint.json' -p -p './tsconfig.json'","test":"mocha -r ts-node/register tests/**/*.spec.ts --reporter spec","install-locally":"npm run build && npm link"},"bin":{"asc-conv-rest-api":"./dist/command.js"},"dependencies":{"async":"^2.1.4","basic":"^2.0.3","chai":"^4.2.0","chalk":"^1.1.3","commander":"^2.9.0","ejs":"^2.6.1","fs-extra":"^7.0.1","inquirer":"^2.0.0","insight":"^0.10.1","mem-fs":"^1.1.3","mem-fs-editor":"^5.1.0","mocha":"^5.2.0","path":"^0.12.7","reflect-metadata":"^0.1.13","safe-json-stringify":"^1.2.0","shelljs":"^0.8.3","to-absolute-glob":"^2.0.2","ts-simple-ast":"^16.0.4","tslib":"^1.9.0","update-notifier":"^2.5.0"},"devDependencies":{"@types/chai":"^4.1.7","@types/fs-extra":"^5.0.4","@types/mocha":"^5.2.5","@types/node":"^10.12.20","lerna":"^3.10.7","rimraf":"^2.6.3","ts-node":"^6.0.3","tsc":"^1.20150623.0","tslint":"^5.12.1","typescript":"^2.9.2"},"author":{"name":"apexsupplychain","url":"https://github.com/apexsupplychain"},"collaborators":["Diego Juliao <djuliao@yuxiglobal.com> (https://github.com/dianjuar)"],"license":"Apache-2.0","repository":{"type":"git","url":"git+ssh://git@github.com/apexsupplychain/convector-rest-api.git"},"bugs":{"url":"https://github.com/apexsupplychain/convector-rest-api/issues"},"homepage":"https://github.com/apexsupplychain/convector-rest-api#readme","keywords":["convector","restapi","websocket","blockchain"],"gitHead":"d2586b241596d835a1e490cd12483d86613fa929","_id":"@apexsupplychain/asc-conv-rest-api@0.1.5-next.0","_npmVersion":"6.4.1","_nodeVersion":"8.16.1","_npmUser":{"name":"dianjuar","email":"dianjuar@gmail.com"},"dist":{"integrity":"sha512-Vu0rPLj96auJsrmcGMw/4BB8plBaV0eU2heQwOMvs1uyBuEwy5rmwuPa/tzqDWJKQLL07cZVW+xQSzhe0rSHsw==","shasum":"aa746e0d740e0fd24fdfa24cc7f278617b9e0ce9","tarball":"https://registry.npmjs.org/@apexsupplychain/asc-conv-rest-api/-/asc-conv-rest-api-0.1.5-next.0.tgz","fileCount":123,"unpackedSize":293009,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdqi98CRA9TVsSAnZWagAAMvEP/3SkfiJ4OHS3d+tt28Qw\nPr8utz52Ax9qT0T2unMj9Vi6CZ9DXkGn1zQd8OP3V5+brxMHe6yLU1RxxgwD\neoSDcbWHWoMw0KEuhy1F1N8yOB1FPoDToDY1v37wb/48GLBcTbArCxJK+kL8\niDtVgVzAm2gVA7ngsWsQp06PPBi9CU9EDLFrBHKeaRZ9aZpGu3Yv0PQOu2m1\nN719cFSLS1D6nzPyVz1kqxWgo7loim5J7L3LT3DlPz0YPlnsf3ihMP18joI1\n6jPw45TdKV9yUxfr0HUVNpBQHDz9oMyvak+asdVzC3Mh8bfTs05SM3qr4Z/m\nJKTU5kY2yCMgIsOk9Pub/h4dwN3tmWmqdUI0fLbNsJD5dHDDkz3TetvQVGPY\nwSNqG3v63NR2wX6VeQPBYrjaiNoONl97esbWJD1LBskAPZm/S6uYMK0ICETI\nCbpovmWg3NwFhe0XM9gXL9JNG35ifeE70SYqZLgQHRAPyxY3aTjKc5Jesh0n\nScbif4n2gZY6/QwDxKZ8ApdRvFLARcsnXHlIgD48SjHeA9VwTOcWMHy0TDUs\naTpWVmT8u2CoqMRVCenR5HpeMDEjvQEGPuYBsdbG3TbrXpMU+gCDA9u5kOO5\neMmGmWg5BZGrVf/sAHI24OkbWO+G1mA1ZAouhGBpsK0k7uMee7xV/o/LDSw2\nWZo6\r\n=w0Ft\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCID7B8DCfOQojhD0eCULSYAVxGzXLetsbcR0mSgNuS9IfAiEArxj5CIeXKV/Y7l+dQvaPnHWQHybooIpauZAMNACQnrY="}]},"maintainers":[{"name":"dianjuar","email":"dianjuar@gmail.com"},{"name":"edfullman","email":"ed@foxtrotcode.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/asc-conv-rest-api_0.1.5-next.0_1571434363556_0.32101596194590676"},"_hasShrinkwrap":false},"0.1.5-next.1":{"name":"@apexsupplychain/asc-conv-rest-api","version":"0.1.5-next.1","description":"Rest API generator for the Convector Framework","main":"./dist/index.js","typings":"./dist/index.d.ts","scripts":{"clean":"rimraf dist","build":"npm run clean && tsc","prepare":"npm run build","lint":"tslint --fix -c './tslint.json' -p -p './tsconfig.json'","test":"mocha -r ts-node/register tests/**/*.spec.ts --reporter spec","install-locally":"npm run build && npm link"},"bin":{"asc-conv-rest-api":"./dist/command.js"},"dependencies":{"async":"^2.1.4","basic":"^2.0.3","chai":"^4.2.0","chalk":"^1.1.3","commander":"^2.9.0","ejs":"^2.6.1","fs-extra":"^7.0.1","inquirer":"^2.0.0","insight":"^0.10.1","mem-fs":"^1.1.3","mem-fs-editor":"^5.1.0","mocha":"^5.2.0","path":"^0.12.7","reflect-metadata":"^0.1.13","safe-json-stringify":"^1.2.0","shelljs":"^0.8.3","to-absolute-glob":"^2.0.2","ts-simple-ast":"^16.0.4","tslib":"^1.9.0","update-notifier":"^2.5.0"},"devDependencies":{"@types/chai":"^4.1.7","@types/fs-extra":"^5.0.4","@types/mocha":"^5.2.5","@types/node":"^10.12.20","lerna":"^3.10.7","rimraf":"^2.6.3","ts-node":"^6.0.3","tsc":"^1.20150623.0","tslint":"^5.12.1","typescript":"^2.9.2"},"author":{"name":"apexsupplychain","url":"https://github.com/apexsupplychain"},"collaborators":["Diego Juliao <djuliao@yuxiglobal.com> (https://github.com/dianjuar)"],"license":"Apache-2.0","repository":{"type":"git","url":"git+ssh://git@github.com/apexsupplychain/convector-rest-api.git"},"bugs":{"url":"https://github.com/apexsupplychain/convector-rest-api/issues"},"homepage":"https://github.com/apexsupplychain/convector-rest-api#readme","keywords":["convector","restapi","websocket","blockchain"],"readme":"# conv-rest-api\n\nThis project is under development and will soon be integrated into the [Convector CLI](https://github.com/worldsibu/convector-cli).\n\nThis project aims to provide an easy way for generating automatically client API for Convector projects.\n\n## How to use\n\nTo generate an API, you first need a Convector CLI generated project. Since the `conv-rest-api` is based on the Convector CLI standards and conventions, so manually projects generated may not work with it.\n\nIn the **root of your project** create a json file called `api.json`. This structure will map the smart contract to the Express API.\n\n```json\n[\n    {\n        \"function\": \"<function-name>\",\n        \"controller\": \"<controller-class-name>\",\n        \"verb\": \"get|post|put|delete\"\n    },\n    {\n        ...\n    }\n]\n```\n\n### Example\n\nIf your smart contract project has the following structure:\n\n* `./packages/participants/src/participant.controller.ts`\n* `./packages/person/src/person.controller.ts`\n\nAnd the controller files look like this:\n\n#### participant.controller.ts\n\n```ts\n@Controller('participant')\nexport class ParticipantController extends ConvectorController {\n  get fullIdentity(): ClientIdentity {\n    const stub = (BaseStorage.current as any).stubHelper;\n    return new ClientIdentity(stub.getStub());\n  };\n\n  @Invokable()\n  public async register(\n    @Param(yup.string())\n    id: string,\n    @Param(yup.string())\n    name: string,\n  ) {\n      //...\n  }\n}\n```\n\n#### person.controller.ts\n\n```ts\n@Controller('person')\nexport class PersonController extends ConvectorController<ChaincodeTx> {\n  @GetAll('Person')\n  @Invokable()\n  public async getone(\n    @Param(Person)\n    id: string) {\n        // ...\n  }\n  @Create('Person')\n  @Invokable()\n  public async create(\n    @Param(Person)\n    person: Person\n  ) {\n      // ...\n  }\n}\n```\n\nThen your `api.json`\n\n```json\n[\n    {\n        \"function\": \"register\",\n        \"controller\": \"ParticipantController\"\n    },\n    {\n        \"function\": \"create\",\n        \"verb\": \"post\",\n        \"controller\": \"PersonController\"\n    },\n    {\n        \"function\": \"getone\",\n        \"verb\": \"get\",\n        \"controller\": \"PersonController\"\n    }\n]\n```\n\nOnce that's ready, globally install the `conv-rest-api` util and generate your API!\n\n> Beware that it will *remove* and recreate a folder in your root `./packages/` folder called `server`.\n\n```bash\nnpm i -g @worldsibu/conv-rest-api\n\n# Inside your Convector CLI generated project's root\nconv-rest-api generate api -c <chaincode-project-name> -f ./<chaincode-config-file>\n# I.e.: conv-rest-api generate api -c person -f ./org1.person.config.json\n\n# Compile everything\n[npx] lerna bootstrap\n\n# Start the server\n[npx] lerna run start --scope server --stream\n```\n\n## Support\n\n* For recommendations, feature requests, or bugs go to our [issues section](/issues).\n* News on Convector, subscribe to our [Newsletter](https://worldsibu.tech/subscribe/).\n* Need support? Chat directly with our team and the growing community, join our [Discord](https://discord.gg/twRwpWt).\n\n## Contributions\n\nSpecial thanks to Luca Tamburrano for starting this amazingly useful project for the community.\n","readmeFilename":"README.md","gitHead":"83f8f4e265b38aa567eebd15f7127a2a007a37d1","_id":"@apexsupplychain/asc-conv-rest-api@0.1.5-next.1","_npmVersion":"6.4.1","_nodeVersion":"8.16.1","_npmUser":{"name":"dianjuar","email":"dianjuar@gmail.com"},"dist":{"integrity":"sha512-+i5tM2ch6PMG9HxfbFUUhn5J9KqwRDAKxkhl5zoYmJphMZpxG2QsE026MXqO1ULBk1NY1x2LQ2OiMoCGE0Ogjw==","shasum":"2dfb8c86d228a630aa79a35f545e969671708c24","tarball":"https://registry.npmjs.org/@apexsupplychain/asc-conv-rest-api/-/asc-conv-rest-api-0.1.5-next.1.tgz","fileCount":123,"unpackedSize":292930,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdsef/CRA9TVsSAnZWagAAsVwP/ie0aEM7VILHSqLP3Kpe\n5PQ/yDB8e/+LyEC2sFNivqT3Q4QO4mFhUbGTIJxwNrIY0jmTMQ9RmTu2MTLs\nHgLGj+vOd6W/ItX1Z8NAzagailXbkpgi1w83CPGhmKFPQrckLQdSdeTZyu6Z\nMyasbFRUxKIoUFlVrapV5+VQW4zC2krWc9kDxo0kSKEJyzHBgaQC6tpo7jRU\nTFijVev9XGhzCAiKgB/Qtztg3QVojny3Rx7uqVFuBN9iGS3hc3GHOUc78nMx\n+JNqHKxZmu/hvvkEgrvssberYr1mWpO4obVh5PDAE2MTO3UUEZAQXxXW2QBd\nNUKOsnzCcN8EI8hlz3kOBHjDOxFN1stLTm2Vsff7f9ZIXCi3JB4LklfZSU9P\nPsLcsCSvbAdVORGVNicPtCSO3OwUI0eFnud+W5pVujDGIGGuveW8JcC7Fxjk\n1XUpUKYLgoUp0zBlM8W0lTZ66A0U8nFVUHCfqz2y8xI5c4HIrhGsTfOwYMA4\nB728o4/h/2H6Ogs/Fthd+iAOTrSv4fOC1onWGnzMHyO0TdOddlCsrSCrtUaE\n5BlTxRD8Cg2MtS+pXwp+DguKTnxDP8DH/xLSxf2/6zNDEkmmX0bcm/kOnzlv\nWxez7Hzby4L0qEP8tNOXEAXqttwGSoq6E1QfbGyHuEpQwdP6LLG/8oB7bDWg\nVoVG\r\n=Z+uD\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDXbb5dRMjoFvBX1OCz+SmcuKsr5qDgTRBLXwQQyddMaAIhAMiMvlXz3w8XHdR3bGKL786qJA6PYgdfyOv18R9nkZp0"}]},"maintainers":[{"name":"dianjuar","email":"dianjuar@gmail.com"},{"name":"edfullman","email":"ed@foxtrotcode.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/asc-conv-rest-api_0.1.5-next.1_1571940351328_0.2872438301713651"},"_hasShrinkwrap":false}},"time":{"created":"2019-10-18T21:32:43.328Z","0.1.5-next.0":"2019-10-18T21:32:43.708Z","modified":"2022-04-04T14:33:14.214Z","0.1.5-next.1":"2019-10-24T18:05:51.492Z"},"maintainers":[{"name":"dianjuar","email":"dianjuar@gmail.com"},{"name":"edfullman","email":"ed@foxtrotcode.com"}],"description":"Rest API generator for the Convector Framework","homepage":"https://github.com/apexsupplychain/convector-rest-api#readme","keywords":["convector","restapi","websocket","blockchain"],"repository":{"type":"git","url":"git+ssh://git@github.com/apexsupplychain/convector-rest-api.git"},"author":{"name":"apexsupplychain","url":"https://github.com/apexsupplychain"},"bugs":{"url":"https://github.com/apexsupplychain/convector-rest-api/issues"},"license":"Apache-2.0","readme":"","readmeFilename":""}