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

1 line
8.8 KiB
JSON

{"ast":null,"code":"\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.ClientMsg = void 0;\nconst json_encode_js_1 = require(\"../shared/json_encode.js\");\nconst util_js_1 = require(\"../util.js\");\nfunction ClientMsg(w, msg) {\n w.stringRaw(\"type\", msg.type);\n if (msg.type === \"hello\") {\n if (msg.jwt !== undefined) {\n w.string(\"jwt\", msg.jwt);\n }\n } else if (msg.type === \"request\") {\n w.number(\"request_id\", msg.requestId);\n w.object(\"request\", msg.request, Request);\n } else {\n throw (0, util_js_1.impossible)(msg, \"Impossible type of ClientMsg\");\n }\n}\nexports.ClientMsg = ClientMsg;\nfunction Request(w, msg) {\n w.stringRaw(\"type\", msg.type);\n if (msg.type === \"open_stream\") {\n w.number(\"stream_id\", msg.streamId);\n } else if (msg.type === \"close_stream\") {\n w.number(\"stream_id\", msg.streamId);\n } else if (msg.type === \"execute\") {\n w.number(\"stream_id\", msg.streamId);\n w.object(\"stmt\", msg.stmt, json_encode_js_1.Stmt);\n } else if (msg.type === \"batch\") {\n w.number(\"stream_id\", msg.streamId);\n w.object(\"batch\", msg.batch, json_encode_js_1.Batch);\n } else if (msg.type === \"open_cursor\") {\n w.number(\"stream_id\", msg.streamId);\n w.number(\"cursor_id\", msg.cursorId);\n w.object(\"batch\", msg.batch, json_encode_js_1.Batch);\n } else if (msg.type === \"close_cursor\") {\n w.number(\"cursor_id\", msg.cursorId);\n } else if (msg.type === \"fetch_cursor\") {\n w.number(\"cursor_id\", msg.cursorId);\n w.number(\"max_count\", msg.maxCount);\n } else if (msg.type === \"sequence\") {\n w.number(\"stream_id\", msg.streamId);\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 w.number(\"stream_id\", msg.streamId);\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 w.number(\"stream_id\", msg.streamId);\n } else {\n throw (0, util_js_1.impossible)(msg, \"Impossible type of Request\");\n }\n}","map":{"version":3,"names":["Object","defineProperty","exports","value","ClientMsg","json_encode_js_1","require","util_js_1","w","msg","stringRaw","type","jwt","undefined","string","number","requestId","object","request","Request","impossible","streamId","stmt","Stmt","batch","Batch","cursorId","maxCount","sql","sqlId"],"sources":["/Users/shoofle/Projects/the-forest/node_modules/@libsql/hrana-client/lib-cjs/ws/json_encode.js"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ClientMsg = void 0;\nconst json_encode_js_1 = require(\"../shared/json_encode.js\");\nconst util_js_1 = require(\"../util.js\");\nfunction ClientMsg(w, msg) {\n w.stringRaw(\"type\", msg.type);\n if (msg.type === \"hello\") {\n if (msg.jwt !== undefined) {\n w.string(\"jwt\", msg.jwt);\n }\n }\n else if (msg.type === \"request\") {\n w.number(\"request_id\", msg.requestId);\n w.object(\"request\", msg.request, Request);\n }\n else {\n throw (0, util_js_1.impossible)(msg, \"Impossible type of ClientMsg\");\n }\n}\nexports.ClientMsg = ClientMsg;\nfunction Request(w, msg) {\n w.stringRaw(\"type\", msg.type);\n if (msg.type === \"open_stream\") {\n w.number(\"stream_id\", msg.streamId);\n }\n else if (msg.type === \"close_stream\") {\n w.number(\"stream_id\", msg.streamId);\n }\n else if (msg.type === \"execute\") {\n w.number(\"stream_id\", msg.streamId);\n w.object(\"stmt\", msg.stmt, json_encode_js_1.Stmt);\n }\n else if (msg.type === \"batch\") {\n w.number(\"stream_id\", msg.streamId);\n w.object(\"batch\", msg.batch, json_encode_js_1.Batch);\n }\n else if (msg.type === \"open_cursor\") {\n w.number(\"stream_id\", msg.streamId);\n w.number(\"cursor_id\", msg.cursorId);\n w.object(\"batch\", msg.batch, json_encode_js_1.Batch);\n }\n else if (msg.type === \"close_cursor\") {\n w.number(\"cursor_id\", msg.cursorId);\n }\n else if (msg.type === \"fetch_cursor\") {\n w.number(\"cursor_id\", msg.cursorId);\n w.number(\"max_count\", msg.maxCount);\n }\n else if (msg.type === \"sequence\") {\n w.number(\"stream_id\", msg.streamId);\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 w.number(\"stream_id\", msg.streamId);\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 w.number(\"stream_id\", msg.streamId);\n }\n else {\n throw (0, util_js_1.impossible)(msg, \"Impossible type of Request\");\n }\n}\n"],"mappings":"AAAA,YAAY;;AACZA,MAAM,CAACC,cAAc,CAACC,OAAO,EAAE,YAAY,EAAE;EAAEC,KAAK,EAAE;AAAK,CAAC,CAAC;AAC7DD,OAAO,CAACE,SAAS,GAAG,KAAK,CAAC;AAC1B,MAAMC,gBAAgB,GAAGC,OAAO,CAAC,0BAA0B,CAAC;AAC5D,MAAMC,SAAS,GAAGD,OAAO,CAAC,YAAY,CAAC;AACvC,SAASF,SAASA,CAACI,CAAC,EAAEC,GAAG,EAAE;EACvBD,CAAC,CAACE,SAAS,CAAC,MAAM,EAAED,GAAG,CAACE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