1 line
12 KiB
JSON
1 line
12 KiB
JSON
|
{"ast":null,"code":"\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.ClientMsg = void 0;\nconst protobuf_encode_js_1 = require(\"../shared/protobuf_encode.js\");\nconst util_js_1 = require(\"../util.js\");\nfunction ClientMsg(w, msg) {\n if (msg.type === \"hello\") {\n w.message(1, msg, HelloMsg);\n } else if (msg.type === \"request\") {\n w.message(2, msg, RequestMsg);\n } else {\n throw (0, util_js_1.impossible)(msg, \"Impossible type of ClientMsg\");\n }\n}\nexports.ClientMsg = ClientMsg;\nfunction HelloMsg(w, msg) {\n if (msg.jwt !== undefined) {\n w.string(1, msg.jwt);\n }\n}\nfunction RequestMsg(w, msg) {\n w.int32(1, msg.requestId);\n const request = msg.request;\n if (request.type === \"open_stream\") {\n w.message(2, request, OpenStreamReq);\n } else if (request.type === \"close_stream\") {\n w.message(3, request, CloseStreamReq);\n } else if (request.type === \"execute\") {\n w.message(4, request, ExecuteReq);\n } else if (request.type === \"batch\") {\n w.message(5, request, BatchReq);\n } else if (request.type === \"open_cursor\") {\n w.message(6, request, OpenCursorReq);\n } else if (request.type === \"close_cursor\") {\n w.message(7, request, CloseCursorReq);\n } else if (request.type === \"fetch_cursor\") {\n w.message(8, request, FetchCursorReq);\n } else if (request.type === \"sequence\") {\n w.message(9, request, SequenceReq);\n } else if (request.type === \"describe\") {\n w.message(10, request, DescribeReq);\n } else if (request.type === \"store_sql\") {\n w.message(11, request, StoreSqlReq);\n } else if (request.type === \"close_sql\") {\n w.message(12, request, CloseSqlReq);\n } else if (request.type === \"get_autocommit\") {\n w.message(13, request, GetAutocommitReq);\n } else {\n throw (0, util_js_1.impossible)(request, \"Impossible type of Request\");\n }\n}\nfunction OpenStreamReq(w, msg) {\n w.int32(1, msg.streamId);\n}\nfunction CloseStreamReq(w, msg) {\n w.int32(1, msg.streamId);\n}\nfunction ExecuteReq(w, msg) {\n w.int32(1, msg.streamId);\n w.message(2, msg.stmt, protobuf_encode_js_1.Stmt);\n}\nfunction BatchReq(w, msg) {\n w.int32(1, msg.streamId);\n w.message(2, msg.batch, protobuf_encode_js_1.Batch);\n}\nfunction OpenCursorReq(w, msg) {\n w.int32(1, msg.streamId);\n w.int32(2, msg.cursorId);\n w.message(3, msg.batch, protobuf_encode_js_1.Batch);\n}\nfunction CloseCursorReq(w, msg) {\n w.int32(1, msg.cursorId);\n}\nfunction FetchCursorReq(w, msg) {\n w.int32(1, msg.cursorId);\n w.uint32(2, msg.maxCount);\n}\nfunction SequenceReq(w, msg) {\n w.int32(1, msg.streamId);\n if (msg.sql !== undefined) {\n w.string(2, msg.sql);\n }\n if (msg.sqlId !== undefined) {\n w.int32(3, msg.sqlId);\n }\n}\nfunction DescribeReq(w, msg) {\n w.int32(1, msg.streamId);\n if (msg.sql !== undefined) {\n w.string(2, msg.sql);\n }\n if (msg.sqlId !== undefined) {\n w.int32(3, msg.sqlId);\n }\n}\nfunction StoreSqlReq(w, msg) {\n w.int32(1, msg.sqlId);\n w.string(2, msg.sql);\n}\nfunction CloseSqlReq(w, msg) {\n w.int32(1, msg.sqlId);\n}\nfunction GetAutocommitReq(w, msg) {\n w.int32(1, msg.streamId);\n}","map":{"version":3,"names":["Object","defineProperty","exports","value","ClientMsg","protobuf_encode_js_1","require","util_js_1","w","msg","type","message","HelloMsg","RequestMsg","impossible","jwt","undefined","string","int32","requestId","request","OpenStreamReq","CloseStreamReq","ExecuteReq","BatchReq","OpenCursorReq","CloseCursorReq","FetchCursorReq","SequenceReq","DescribeReq","StoreSqlReq","CloseSqlReq","GetAutocommitReq","streamId","stmt","Stmt","batch","Batch","cursorId","uint32","maxCount","sql","sqlId"],"sources":["/Users/shoofle/Projects/the-forest/node_modules/@libsql/hrana-client/lib-cjs/ws/protobuf_encode.js"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ClientMsg = void 0;\nconst protobuf_encode_js_1 = require(\"../shared/protobuf_encode.js\");\nconst util_js_1 = require(\"../util
|