the-forest/client/node_modules/.cache/babel-loader/6a7fef2890037b025e257b4b42191ee9677fc55c5bba65a92bc1205fde2542b6.json

1 line
8.1 KiB
JSON
Raw Normal View History

2024-09-17 20:35:18 -04:00
{"ast":null,"code":"\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.Batch = exports.Stmt = void 0;\nconst util_js_1 = require(\"../util.js\");\nfunction Stmt(w, msg) {\n if (msg.sql !== undefined) {\n w.string(1, msg.sql);\n }\n if (msg.sqlId !== undefined) {\n w.int32(2, msg.sqlId);\n }\n for (const arg of msg.args) {\n w.message(3, arg, Value);\n }\n for (const arg of msg.namedArgs) {\n w.message(4, arg, NamedArg);\n }\n w.bool(5, msg.wantRows);\n}\nexports.Stmt = Stmt;\nfunction NamedArg(w, msg) {\n w.string(1, msg.name);\n w.message(2, msg.value, Value);\n}\nfunction Batch(w, msg) {\n for (const step of msg.steps) {\n w.message(1, step, BatchStep);\n }\n}\nexports.Batch = Batch;\nfunction BatchStep(w, msg) {\n if (msg.condition !== undefined) {\n w.message(1, msg.condition, BatchCond);\n }\n w.message(2, msg.stmt, Stmt);\n}\nfunction BatchCond(w, msg) {\n if (msg.type === \"ok\") {\n w.uint32(1, msg.step);\n } else if (msg.type === \"error\") {\n w.uint32(2, msg.step);\n } else if (msg.type === \"not\") {\n w.message(3, msg.cond, BatchCond);\n } else if (msg.type === \"and\") {\n w.message(4, msg.conds, BatchCondList);\n } else if (msg.type === \"or\") {\n w.message(5, msg.conds, BatchCondList);\n } else if (msg.type === \"is_autocommit\") {\n w.message(6, undefined, Empty);\n } else {\n throw (0, util_js_1.impossible)(msg, \"Impossible type of BatchCond\");\n }\n}\nfunction BatchCondList(w, msg) {\n for (const cond of msg) {\n w.message(1, cond, BatchCond);\n }\n}\nfunction Value(w, msg) {\n if (msg === null) {\n w.message(1, undefined, Empty);\n } else if (typeof msg === \"bigint\") {\n w.sint64(2, msg);\n } else if (typeof msg === \"number\") {\n w.double(3, msg);\n } else if (typeof msg === \"string\") {\n w.string(4, msg);\n } else if (msg instanceof Uint8Array) {\n w.bytes(5, msg);\n } else if (msg === undefined) {\n // do nothing\n } else {\n throw (0, util_js_1.impossible)(msg, \"Impossible type of Value\");\n }\n}\nfunction Empty(_w, _msg) {\n // do nothing\n}","map":{"version":3,"names":["Object","defineProperty","exports","value","Batch","Stmt","util_js_1","require","w","msg","sql","undefined","string","sqlId","int32","arg","args","message","Value","namedArgs","NamedArg","bool","wantRows","name","step","steps","BatchStep","condition","BatchCond","stmt","type","uint32","cond","conds","BatchCondList","Empty","impossible","sint64","double","Uint8Array","bytes","_w","_msg"],"sources":["/Users/shoofle/Projects/the-forest/node_modules/@libsql/hrana-client/lib-cjs/shared/protobuf_encode.js"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Batch = exports.Stmt = void 0;\nconst util_js_1 = require(\"../util.js\");\nfunction Stmt(w, msg) {\n if (msg.sql !== undefined) {\n w.string(1, msg.sql);\n }\n if (msg.sqlId !== undefined) {\n w.int32(2, msg.sqlId);\n }\n for (const arg of msg.args) {\n w.message(3, arg, Value);\n }\n for (const arg of msg.namedArgs) {\n w.message(4, arg, NamedArg);\n }\n w.bool(5, msg.wantRows);\n}\nexports.Stmt = Stmt;\nfunction NamedArg(w, msg) {\n w.string(1, msg.name);\n w.message(2, msg.value, Value);\n}\nfunction Batch(w, msg) {\n for (const step of msg.steps) {\n w.message(1, step, BatchStep);\n }\n}\nexports.Batch = Batch;\nfunction BatchStep(w, msg) {\n if (msg.condition !== undefined) {\n w.message(1, msg.condition, BatchCond);\n }\n w.message(2, msg.stmt, Stmt);\n}\nfunction BatchCond(w, msg) {\n if (msg.type === \"ok\") {\n w.uint32(1, msg.step);\n }\n else if (msg.type === \"error\") {\n w.uint32(2, msg.step);\n }\n else if (msg.type === \"not\") {\n w.message(3, msg.cond, BatchCond);\n }\n else if (msg.type === \"and\") {\n w.message(4, msg.conds, BatchCondList);\n }\n else if (msg.type === \"or\") {\n w.message(5, msg.conds