the-forest/client/node_modules/.cache/babel-loader/90534ffac57c43edf2bf40dfefbc349d01ed6302ddde6d89ac6d1fc78e07a710.json
2024-09-17 20:35:18 -04:00

1 line
7.4 KiB
JSON

{"ast":null,"code":"import { impossible } from \"../util.js\";\nexport function 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}\nfunction NamedArg(w, msg) {\n w.string(1, msg.name);\n w.message(2, msg.value, Value);\n}\nexport function Batch(w, msg) {\n for (const step of msg.steps) {\n w.message(1, step, BatchStep);\n }\n}\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 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 impossible(msg, \"Impossible type of Value\");\n }\n}\nfunction Empty(_w, _msg) {\n // do nothing\n}","map":{"version":3,"names":["impossible","Stmt","w","msg","sql","undefined","string","sqlId","int32","arg","args","message","Value","namedArgs","NamedArg","bool","wantRows","name","value","Batch","step","steps","BatchStep","condition","BatchCond","stmt","type","uint32","cond","conds","BatchCondList","Empty","sint64","double","Uint8Array","bytes","_w","_msg"],"sources":["/Users/shoofle/Projects/the-forest/node_modules/@libsql/hrana-client/lib-esm/shared/protobuf_encode.js"],"sourcesContent":["import { impossible } from \"../util.js\";\nexport function 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}\nfunction NamedArg(w, msg) {\n w.string(1, msg.name);\n w.message(2, msg.value, Value);\n}\nexport function Batch(w, msg) {\n for (const step of msg.steps) {\n w.message(1, step, BatchStep);\n }\n}\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, BatchCondList);\n }\n else if (msg.type === \"is_autocommit\") {\n w.message(6, undefined, Empty);\n }\n else {\n throw 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 }\n else if (typeof msg === \"bigint\") {\n w.sint64(2, msg);\n }\n else if (typeof msg === \"number\") {\n w.double(3, msg);\n }\n else if (typeof msg === \"string\") {\n w.string(4, msg);\n }\n else if (msg instanceof Uint8Array) {\n w.bytes(5, msg);\n }\n else if (msg === undefined) {\n // do nothing\n }\n else {\n throw impossible(msg, \"Impossible type of Value\");\n }\n}\nfunction Empty(_w, _msg) {\n // do nothing\n}\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,YAAY;AACvC,OAAO,SAASC,IAAIA,CAACC,CAAC,EAAEC,GAAG,EAAE;EACzB,IAAIA,GAAG,CAACC,GAAG,KAAKC,SAAS,EAAE;IACvBH,CAAC,CAACI,MAAM,CAAC,CAAC,EAAEH,GAAG,CAACC,GAAG,CAAC;EACxB;EACA,IAAID,GAAG,CAACI,KAAK,KAAKF,SAAS,EAAE;IACzBH,CAAC,CAACM,KAAK,CAAC,CAAC,EAAEL,GAAG,CAACI,KAAK,CAAC;EACzB;EACA,KAAK,MAAME,GAAG,IAAIN,GAAG,CAACO,IAAI,EAAE;IACxBR,CAAC,CAACS,OAAO,CAAC,CAAC,EAAEF,GAAG,EAAEG,KAAK,CAAC;EAC5B;EACA,KAAK,MAAMH,GAAG,IAAIN,GAAG,CAACU,SAAS,EAAE;IAC7BX,CAAC,CAACS,OAAO,CAAC,CAAC,EAAEF,GAAG,EAAEK,QAAQ,CAAC;EAC/B;EACAZ,CAAC,CAACa,IAAI,CAAC,CAAC,EAAEZ,GAAG,CAACa,QAAQ,CAAC;AAC3B;AACA,SAASF,QAAQA,CAACZ,CAAC,EAAEC,GAAG,EAAE;EACtBD,CAAC,CAACI,MAAM,CAAC,CAAC,EAAEH,GAAG,CAACc,IAAI,CAAC;EACrBf,CAAC,CAACS,OAAO,CAAC,CAAC,EAAER,GAAG,CAACe,KAAK,EAAEN,KAAK,CAAC;AAClC;AACA,OAAO,SAASO,KAAKA,CAACjB,CAAC,EAAEC,GAAG,EAAE;EAC1B,KAAK,MAAMiB,IAAI,IAAIjB,GAAG,CAACkB,KAAK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