{"ast":null,"code":"\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.CursorReqBody = exports.PipelineReqBody = void 0;\nconst json_encode_js_1 = require(\"../shared/json_encode.js\");\nconst util_js_1 = require(\"../util.js\");\nfunction PipelineReqBody(w, msg) {\n if (msg.baton !== undefined) {\n w.string(\"baton\", msg.baton);\n }\n w.arrayObjects(\"requests\", msg.requests, StreamRequest);\n}\nexports.PipelineReqBody = PipelineReqBody;\nfunction StreamRequest(w, msg) {\n w.stringRaw(\"type\", msg.type);\n if (msg.type === \"close\") {\n // do nothing\n } else if (msg.type === \"execute\") {\n w.object(\"stmt\", msg.stmt, json_encode_js_1.Stmt);\n } else if (msg.type === \"batch\") {\n w.object(\"batch\", msg.batch, json_encode_js_1.Batch);\n } else if (msg.type === \"sequence\") {\n if (msg.sql !== undefined) {\n w.string(\"sql\", msg.sql);\n }\n if (msg.sqlId !== undefined) {\n w.number(\"sql_id\", msg.sqlId);\n }\n } else if (msg.type === \"describe\") {\n if (msg.sql !== undefined) {\n w.string(\"sql\", msg.sql);\n }\n if (msg.sqlId !== undefined) {\n w.number(\"sql_id\", msg.sqlId);\n }\n } else if (msg.type === \"store_sql\") {\n w.number(\"sql_id\", msg.sqlId);\n w.string(\"sql\", msg.sql);\n } else if (msg.type === \"close_sql\") {\n w.number(\"sql_id\", msg.sqlId);\n } else if (msg.type === \"get_autocommit\") {\n // do nothing\n } else {\n throw (0, util_js_1.impossible)(msg, \"Impossible type of StreamRequest\");\n }\n}\nfunction CursorReqBody(w, msg) {\n if (msg.baton !== undefined) {\n w.string(\"baton\", msg.baton);\n }\n w.object(\"batch\", msg.batch, json_encode_js_1.Batch);\n}\nexports.CursorReqBody = CursorReqBody;","map":{"version":3,"names":["Object","defineProperty","exports","value","CursorReqBody","PipelineReqBody","json_encode_js_1","require","util_js_1","w","msg","baton","undefined","string","arrayObjects","requests","StreamRequest","stringRaw","type","object","stmt","Stmt","batch","Batch","sql","sqlId","number","impossible"],"sources":["/Users/shoofle/Projects/the-forest/node_modules/@libsql/hrana-client/lib-cjs/http/json_encode.js"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.CursorReqBody = exports.PipelineReqBody = void 0;\nconst json_encode_js_1 = require(\"../shared/json_encode.js\");\nconst util_js_1 = require(\"../util.js\");\nfunction PipelineReqBody(w, msg) {\n if (msg.baton !== undefined) {\n w.string(\"baton\", msg.baton);\n }\n w.arrayObjects(\"requests\", msg.requests, StreamRequest);\n}\nexports.PipelineReqBody = PipelineReqBody;\nfunction StreamRequest(w, msg) {\n w.stringRaw(\"type\", msg.type);\n if (msg.type === \"close\") {\n // do nothing\n }\n else if (msg.type === \"execute\") {\n w.object(\"stmt\", msg.stmt, json_encode_js_1.Stmt);\n }\n else if (msg.type === \"batch\") {\n w.object(\"batch\", msg.batch, json_encode_js_1.Batch);\n }\n else if (msg.type === \"sequence\") {\n if (msg.sql !== undefined) {\n w.string(\"sql\", msg.sql);\n }\n if (msg.sqlId !== undefined) {\n w.number(\"sql_id\", msg.sqlId);\n }\n }\n else if (msg.type === \"describe\") {\n if (msg.sql !== undefined) {\n w.string(\"sql\", msg.sql);\n }\n if (msg.sqlId !== undefined) {\n w.number(\"sql_id\", msg.sqlId);\n }\n }\n else if (msg.type === \"store_sql\") {\n w.number(\"sql_id\", msg.sqlId);\n w.string(\"sql\", msg.sql);\n }\n else if (msg.type === \"close_sql\") {\n w.number(\"sql_id\", msg.sqlId);\n }\n else if (msg.type === \"get_autocommit\") {\n // do nothing\n }\n else {\n throw (0, util_js_1.impossible)(msg, \"Impossible type of StreamRequest\");\n }\n}\nfunction CursorReqBody(w, msg) {\n if (msg.baton !== undefined) {\n w.string(\"baton\", msg.baton);\n }\n w.object(\"batch\", msg.batch, json_encode_js_1.Batch);\n}\nexports.CursorReqBody = CursorReqBody;\n"],"mappings":"AAAA,YAAY;;AACZA,MAAM,CAACC,cAAc,CAACC,OAAO,EAAE,YAAY,EAAE;E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