How to use the @creditkarma/thrift-server-core.appendThriftObject function in @creditkarma/thrift-server-core

To help you get started, we’ve selected a few @creditkarma/thrift-server-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github creditkarma / thrift-server / packages / thrift-integration / src / client / connections / TcpConnection.spec.ts View on Github external
const output: thrift.TProtocol = new thrift.BinaryProtocol(
                            writer,
                        )
                        output.writeMessageBegin(
                            'add',
                            thrift.MessageType.CALL,
                            1,
                        )
                        const result = new Calculator.Add__Result({
                            success: 89,
                        })
                        result.write(output)
                        output.writeMessageEnd()
                        const data: Buffer = writer.flush()

                        thrift
                            .appendThriftObject(meta, data, MetadataCodec)
                            .then((extended: Buffer) => {
                                socket.write(frameCodec.encode(extended))
                            })
                    })
                })
github creditkarma / thrift-server / packages / thrift-client-ttwitter-filter / src / main / ThriftClientTTwitterFilter.ts View on Github external
}`,
                                          )
                                        : undefined,
                                sampled:
                                    normalHeaders[ZipkinHeaders.Sampled] ===
                                    '1',
                                client_id:
                                    clientId !== undefined
                                        ? new TTwitter.ClientId(clientId)
                                        : undefined,
                                contexts: [],
                                dest: destHeader,
                                delegations: [],
                            }

                            return appendThriftObject<
                                TTwitter.IResponseHeaderArgs
                            >(
                                requestHeader,
                                request.data,
                                TTwitter.RequestHeaderCodec,
                                transportType,
                                protocolType,
                            ).then((extended: Buffer) => {
                                return next(extended, request.context).then(
                                    (
                                        res: IRequestResponse,
                                    ): Promise => {
                                        return readThriftObject<
                                            TTwitter.IResponseHeader
                                        >(
                                            res.body,
github creditkarma / thrift-server / packages / thrift-integration / src / client / connections / HttpConnection.spec.ts View on Github external
const output: thrift.TProtocol = new thrift.BinaryProtocol(
                                writer,
                            )
                            output.writeMessageBegin(
                                'add',
                                thrift.MessageType.CALL,
                                1,
                            )
                            const result = new Calculator.Add__Result({
                                success: 61,
                            })
                            result.write(output)
                            output.writeMessageEnd()
                            const data: Buffer = writer.flush()

                            thrift
                                .appendThriftObject(
                                    responseHeader,
                                    data,
                                    TTwitter.ResponseHeaderCodec,
                                )
                                .then((extended: Buffer) => {
                                    res.writeHead(200)
                                    res.end(extended)
                                })
                        }
                    },
                )
github creditkarma / thrift-server / packages / thrift-integration / src / client / connections / TcpConnection.spec.ts View on Github external
const output: thrift.TProtocol = new thrift.BinaryProtocol(
                                writer,
                            )
                            output.writeMessageBegin(
                                'add',
                                thrift.MessageType.CALL,
                                1,
                            )
                            const result = new Calculator.Add__Result({
                                success: 61,
                            })
                            result.write(output)
                            output.writeMessageEnd()
                            const data: Buffer = writer.flush()

                            thrift
                                .appendThriftObject(
                                    responseHeader,
                                    data,
                                    TTwitter.ResponseHeaderCodec,
                                )
                                .then((extended: Buffer) => {
                                    socket.write(frameCodec.encode(extended))
                                })
                        }
                    })
                })
github creditkarma / thrift-server / packages / thrift-client-context-filter / src / main / ThriftClientContextFilter.ts View on Github external
handler(
            request: IThriftRequest,
            next: NextFunction,
        ): Promise {
            return appendThriftObject(
                request.context,
                request.data,
                RequestCodec,
                transportType,
                protocolType,
            ).then((extended: Buffer) => {
                return next(extended, request.context).then(
                    (response: IRequestResponse): Promise => {
                        return readThriftObject(
                            response.body,
                            ResponseCodec,
                            transportType,
                            protocolType,
                        ).then(
                            (result: [any, Buffer]): IRequestResponse => {
                                return {