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

1 line
8.0 KiB
JSON

{"ast":null,"code":"import { Stmt, Batch } from \"../shared/json_encode.js\";\nimport { impossible } from \"../util.js\";\nexport function 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 impossible(msg, \"Impossible type of ClientMsg\");\n }\n}\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, Stmt);\n } else if (msg.type === \"batch\") {\n w.number(\"stream_id\", msg.streamId);\n w.object(\"batch\", msg.batch, 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, 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 impossible(msg, \"Impossible type of Request\");\n }\n}","map":{"version":3,"names":["Stmt","Batch","impossible","ClientMsg","w","msg","stringRaw","type","jwt","undefined","string","number","requestId","object","request","Request","streamId","stmt","batch","cursorId","maxCount","sql","sqlId"],"sources":["/Users/shoofle/Projects/the-forest/node_modules/@libsql/hrana-client/lib-esm/ws/json_encode.js"],"sourcesContent":["import { Stmt, Batch } from \"../shared/json_encode.js\";\nimport { impossible } from \"../util.js\";\nexport function 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 impossible(msg, \"Impossible type of ClientMsg\");\n }\n}\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, Stmt);\n }\n else if (msg.type === \"batch\") {\n w.number(\"stream_id\", msg.streamId);\n w.object(\"batch\", msg.batch, 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, 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 impossible(msg, \"Impossible type of Request\");\n }\n}\n"],"mappings":"AAAA,SAASA,IAAI,EAAEC,KAAK,QAAQ,0BAA0B;AACtD,SAASC,UAAU,QAAQ,YAAY;AACvC,OAAO,SAASC,SAASA,CAACC,CAAC,EAAEC,GAAG,EAAE;EAC9BD,CAAC,CAACE,SAAS,CAAC,MAAM,EAAED,GAAG,CAACE,IAAI,CAAC;EAC7B,IAAIF,GAAG,CAACE,IAAI,KAAK,OAAO,EAAE;IACtB,IAAIF,GAAG,CAACG,GAAG,KAAKC,SAAS,EAAE;MACvBL,CAAC,CAACM,MAAM,CAAC,KAAK,EAAEL,GAAG,CAACG,GAAG,CAAC;IAC5B;EACJ,CAAC,MACI,IAAIH,GAAG,CAACE,IAAI,KAAK,SAAS,EAAE;IAC7BH,CAAC,CAACO,MAAM,CAAC,YAAY,EAAEN,GAAG,CAACO,SAAS,CAAC;IACrCR,CAAC,CAACS,MAAM,CAAC,SAAS,EAAER,GAAG,CAACS,OAAO,EAAEC,OAAO,CAAC;EAC7C,CAAC,MACI;IACD,MAAMb,UAAU,CAACG,GAAG,EAAE,8BAA8B,CAAC;EACzD;AACJ;AACA,SAASU,OAAOA,CAACX,CAAC,EAAEC,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