{"_id":"@creditkarma/thrift-context-filter","_rev":"1-16dc3dcad32679ec0b88c5dc595bc1ab","name":"@creditkarma/thrift-context-filter","dist-tags":{"next":"0.11.0-alpha.0","latest":"0.11.0-alpha.0"},"versions":{"0.11.0-alpha.0":{"name":"@creditkarma/thrift-context-filter","version":"0.11.0-alpha.0","description":"Express server middleware for the Apache Thrift protocol","main":"dist/main/index.js","types":"dist/main/index.d.ts","keywords":[],"scripts":{"clean":"rimraf ./dist ./src/tests/generated","lint":"tslint --fix './src/**/*.ts'","format":"prettier --write 'src/**/*.ts'","codegen":"thrift-typescript --target thrift-server --rootDir ./src/tests --sourceDir ./thrift --outDir ./generated","prebuild":"npm run clean && npm run lint && npm run format && npm run codegen","build":"tsc","test":"npm run test:only","test:only":"lab --timeout 15000 --verbose -l -S -P spec dist/tests/unit"},"peerDependencies":{"@creditkarma/thrift-client":"0.10.x","@creditkarma/thrift-server-core":"0.10.x"},"devDependencies":{"@creditkarma/thrift-client":"^0.11.0-alpha.0","@creditkarma/thrift-server-core":"^0.11.0-alpha.0","@creditkarma/thrift-typescript":"^3.0.3-0","@types/code":"^4.0.5","@types/node":"^8.10.38","code":"^5.2.4","lab":"^18.0.0","prettier":"^1.15.1","rimraf":"^2.6.2","tslint":"^5.11.0","tslint-config-prettier":"^1.15.0","tslint-plugin-prettier":"^2.0.0","typescript":"3.1.x"},"_id":"@creditkarma/thrift-context-filter@0.11.0-alpha.0","_npmVersion":"5.6.0","_nodeVersion":"8.9.4","_npmUser":{"name":"hightimesteddy","email":"hightimesteddy@gmail.com"},"dist":{"integrity":"sha512-FzprZegXE7Hb2QJVnJnNqmcUuybOFiMelYnIJzPSq8BwUvUmhG1sEq9GmEFtSK0PzF31p710sikhVXt/l3yBVg==","shasum":"67977326fb30bd497352b946f0c8b4ca5bccfc51","tarball":"https://registry.npmjs.org/@creditkarma/thrift-context-filter/-/thrift-context-filter-0.11.0-alpha.0.tgz","fileCount":18,"unpackedSize":23859,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcAKceCRA9TVsSAnZWagAA3EAQAIAgmPHrBBEDvzssYN4N\nN/s1qKVv1Mo9QvOQaGmRuZwaLAYOtET6PnubWjmvWP6dgF3fvEqjqClvHLX2\nvvj++HKe3wVfF1v6ooo/Rg0M6dKHchgezm16CoBGait2v9VLAl6OyCE2LCur\ntpeDusCpaF56yhOOj4JXnGnCqcyzBEca0t5c2JIPih+irYJVdq/zDi1rXM/Y\nuIPk4Rtrs8fSn+Ds/xZCvfTCmo1nlr3i4iQVXCiNEKRZtl9xyxMlbgncpGf4\ne2HaPols9k3jOhbCPzLPO20pHe51q7nfurxnqCr9cU5BA1mkA1H0LHHKbQk2\n/JGoQAhzkpur6wgDOGag9OeU8sBDmBiRfTT54797rMpIjZhRjzp8Ex6Vr7vI\nCx/GKwYbfSZx36tvCfvZqM75sZH0pS/XBMLp3UfOQwU5h7RSRWwkQ25+rbtl\n+8SQO7nLQfB/jm0YNyl67wGKPPeCSMtlq+xNh9VSIDVi07UJI+xYyhBByTjW\n2Izr4FupbCGFhDlTlOeNZkXbnb50QiVtdBZaWy/nOb8KLFB5ldurjUsJFgBI\n7dJMQKtzNiZVtBoY7EK5rlrYVk5YqOwUTnTXuiJoYWpx7NXM6iG2T9MDPGkw\n3xD+gdbPWPo2+O20eb2iyG3e1mKybFbak7OuztnWdzuTvoo0jQa4mfEiyMY0\nkZYn\r\n=u4Dz\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAf/HUCP95Dq+7yIqHtBoTIbq1QcULX+nIG54a/xLzbDAiEA97s+75QjVlVp13S4tRjm/XFxTZ59ymukrb15Sa8ZY8c="}]},"maintainers":[{"name":"ouranosskia","email":"UGAPiro@gmail.com"},{"name":"ck-npm","email":"pie@creditkarma.com"},{"name":"hightimesteddy","email":"hightimesteddy@gmail.com"},{"name":"nnanceck","email":"nick.nance@creditkarma.com"},{"name":"wookiehangover","email":"samuel.breed@gmail.com"},{"name":"riley-stroud-ck","email":"riley.stroud@creditkarma.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/thrift-context-filter_0.11.0-alpha.0_1543546653932_0.7797891140376654"},"_hasShrinkwrap":false}},"time":{"created":"2018-11-30T02:57:33.859Z","0.11.0-alpha.0":"2018-11-30T02:57:34.053Z","modified":"2022-04-05T01:46:00.331Z"},"maintainers":[{"name":"ouranosskia","email":"UGAPiro@gmail.com"},{"name":"ck-npm","email":"pie@creditkarma.com"},{"name":"hightimesteddy","email":"hightimesteddy@gmail.com"},{"name":"nnanceck","email":"nick.nance@creditkarma.com"},{"name":"wookiehangover","email":"samuel.breed@gmail.com"},{"name":"riley-stroud-ck","email":"riley.stroud@creditkarma.com"}],"description":"Express server middleware for the Apache Thrift protocol","keywords":[],"readme":"# Thrift Context Filter\n\nWhen using Thrift over HTTP we can use HTTP headers to pass context/metadata between services (tracing, auth). When using TCP we don't have this. Among the options to solve this is to prepend an object onto the head of our TCP payload. `@creditkarma/thrift-client` comes with two filters for helping with this situation.\n\n## Installation\n\n`ThriftContextFilter` has a few `peerDependencies`.\n\n```sh\nnpm install --save @creditkarma/thrift-server-core\nnpm install --save @creditkarma/thrift-client\nnpm install --save @creditkarma/thrift-context-filter\n```\n\n## Usage\n\nThis plugin writes a Thrift struct onto the head of an outgoing payload and reads a struct off of the head of an incoming payload.\n\n```typescript\nimport {\n    createTcpClient,\n} from '@creditkarma/thrift-client'\n\nimport {\n    ThriftContextFilter,\n} from '@creditkarma/thrift-context-filter'\n\nimport {\n    RequestContext,\n    ResponseContext,\n} from './codegen/metadata'\n\nimport {\n    Calculator,\n} from './codegen/calculator'\n\nconst thriftClient: Calculator.Client<RequestContext> =\n    createTcpClient(Calculator.Client, {\n        hostName: 'localhost',\n        port: 8080,\n        register: [ ThriftContextFilter<RequestContext, ResponseContext>({\n            RequestContextClass: RequestContext,\n        }) ]\n    })\n\nthriftClient.add(5, 6, new RequestContext({ traceId: 3827293 })).then((response: number) => {\n    // Do stuff...\n})\n```\n\n### Options\n\nAvailable options for ThriftContextFilter:\n\n* RequestContextClass (required): A class (extending StructLike) that is to be prepended to outgoing requests.\n* ResponseContextClass (optional): A class (extending StructLike) that is prepended to incoming responses. Defaults to nothing.\n* transportType (optional): The type of transport to use. Currently only 'buffered'.\n* protocolType (optional): The type of protocol to use, either 'binary' or 'compact'.\n\n## Contributing\n\nFor more information about contributing new features and bug fixes, see our [Contribution Guidelines](../../CONTRIBUTING.md).\nExternal contributors must sign Contributor License Agreement (CLA)\n\n## License\n\nThis project is licensed under [Apache License Version 2.0](./LICENSE)\n","readmeFilename":"README.md"}