the-forest/client/node_modules/.cache/babel-loader/c587aefc39251ab9bd562d028c16682138d62a79a991e44694041738dcc667cc.json

1 line
11 KiB
JSON
Raw Normal View History

2024-09-17 20:35:18 -04:00
{"ast":null,"code":"import { Stmt, Batch } from \"../shared/protobuf_encode.js\";\nimport { impossible } from \"../util.js\";\nexport function 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 impossible(msg, \"Impossible type of ClientMsg\");\n }\n}\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 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, Stmt);\n}\nfunction BatchReq(w, msg) {\n w.int32(1, msg.streamId);\n w.message(2, msg.batch, Batch);\n}\nfunction OpenCursorReq(w, msg) {\n w.int32(1, msg.streamId);\n w.int32(2, msg.cursorId);\n w.message(3, msg.batch, 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":["Stmt","Batch","impossible","ClientMsg","w","msg","type","message","HelloMsg","RequestMsg","jwt","undefined","string","int32","requestId","request","OpenStreamReq","CloseStreamReq","ExecuteReq","BatchReq","OpenCursorReq","CloseCursorReq","FetchCursorReq","SequenceReq","DescribeReq","StoreSqlReq","CloseSqlReq","GetAutocommitReq","streamId","stmt","batch","cursorId","uint32","maxCount","sql","sqlId"],"sources":["/Users/shoofle/Projects/the-forest/node_modules/@libsql/hrana-client/lib-esm/ws/protobuf_encode.js"],"sourcesContent":["import { Stmt, Batch } from \"../shared/protobuf_encode.js\";\nimport { impossible } from \"../util.js\";\nexport function ClientMsg(w, msg) {\n if (msg.type === \"hello\") {\n w.message(1, msg, HelloMsg);\n }\n else if (msg.type === \"request\") {\n w.message(2, msg, RequestMsg);\n }\n else {\n throw impossible(msg, \"Impossible type of ClientMsg\");\n }\n}\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.