{"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.requestId);\n const request = msg.request;\n if (request.type === \"open_stream\") {\n w.message(2, request, OpenStreamReq);\n }\n else if (request.type === \"close_stream\") {\n w.message(3, request, CloseStreamReq);\n }\n else if (request.type === \"execute\") {\n w.message(4, request, ExecuteReq);\n }\n else if (request.type === \"batch\") {\n w.message(5, request, BatchReq);\n }\n else if (request.type === \"open_cursor\") {\n w.message(6, request, OpenCursorReq);\n }\n else if (request.type === \"close_cursor\") {\n w.message(7, request, CloseCursorReq);\n }\n else if (request.type === \"fetch_cursor\") {\n w.message(8, request, FetchCursorReq);\n }\n else if (request.type === \"sequence\") {\n w.message(9, request, SequenceReq);\n }\n else if (request.type === \"describe\") {\n w.message(10, request, DescribeReq);\n }\n else if (request.type === \"store_sql\") {\n w.message(11, request, StoreSqlReq);\n }\n else if (request.type === \"close_sql\") {\n w.message(12, request, CloseSqlReq);\n }\n else if (request.type === \"get_autocommit\") {\n w.message(13, request, GetAutocommitReq);\n }\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}\n"],"mappings":"AAAA,SAASA,IAAI,EAAEC,KAAK,QAAQ,8BAA8B;AAC1D,SAASC,UAAU,QAAQ,YAAY;AACvC,OAAO,SAASC,SAASA,CAACC,CAAC,EAAEC,GAAG,EAAE;EAC9B,IAAIA,GAAG,CAACC,IAAI,KAAK,OAAO,EAAE;IACtBF,CAAC,CAACG,OAAO,CAAC,CAAC,EAAEF,GAAG,EAAEG,QAAQ,CAAC;EAC/B,CAAC,MACI,IAAIH,GAAG,CAACC,IAAI,KAAK,SAAS,EAAE;IAC7BF,CAAC,CAACG,OAAO,CAAC,CAAC,EAAEF,GAAG,EAAEI,UAAU,CAAC;EACjC,CAAC,MACI;IACD,MAAMP,UAAU,CAACG,GAAG,EAAE,8BAA8B,CAAC;EACzD;AACJ;AACA,SAASG,QAAQA,CAACJ,CAAC,EAAEC,GAAG,EAAE;EACtB,IAAIA,GAAG,CAACK,GAAG,KAAKC,SAAS,EAAE;IACvBP,CAAC,CAACQ,MAAM,CAAC,CAAC,EAAEP,GAAG,CAACK,GAAG,CAAC;EACxB;AACJ;AACA,SAASD,UAAUA,CAACL,CAAC,EAAEC,GAAG,EAAE;EACxBD,CAAC,CAACS,KAAK,CAAC,CAAC,EAAER,GAAG,CAACS,SAAS,CAAC;EACzB,MAAMC,OAAO,GAAGV,GAAG,CAACU,OAAO;EAC3B,IAAIA,OAAO,CAACT,IAAI,KAAK,aAAa,EAAE;IAChCF,CAAC,CAACG,OAAO,CAAC,CAAC,EAAEQ,OAAO,EAAEC,aAAa,CAAC;EACxC,CAAC,MACI,IAAID,OAAO,CAACT,IAAI,KAAK,cAAc,EAAE;IACtCF,CAAC,CAACG,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