{"ast":null,"code":"\"use strict\";\n\nvar __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = {\n enumerable: true,\n get: function () {\n return m[k];\n }\n };\n }\n Object.defineProperty(o, k2, desc);\n} : function (o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n});\nvar __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) {\n Object.defineProperty(o, \"default\", {\n enumerable: true,\n value: v\n });\n} : function (o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = this && this.__importStar || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.ServerMsg = void 0;\nconst errors_js_1 = require(\"../errors.js\");\nconst d = __importStar(require(\"../encoding/json/decode.js\"));\nconst json_decode_js_1 = require(\"../shared/json_decode.js\");\nfunction ServerMsg(obj) {\n const type = d.string(obj[\"type\"]);\n if (type === \"hello_ok\") {\n return {\n type: \"hello_ok\"\n };\n } else if (type === \"hello_error\") {\n const error = (0, json_decode_js_1.Error)(d.object(obj[\"error\"]));\n return {\n type: \"hello_error\",\n error\n };\n } else if (type === \"response_ok\") {\n const requestId = d.number(obj[\"request_id\"]);\n const response = Response(d.object(obj[\"response\"]));\n return {\n type: \"response_ok\",\n requestId,\n response\n };\n } else if (type === \"response_error\") {\n const requestId = d.number(obj[\"request_id\"]);\n const error = (0, json_decode_js_1.Error)(d.object(obj[\"error\"]));\n return {\n type: \"response_error\",\n requestId,\n error\n };\n } else {\n throw new errors_js_1.ProtoError(\"Unexpected type of ServerMsg\");\n }\n}\nexports.ServerMsg = ServerMsg;\nfunction Response(obj) {\n const type = d.string(obj[\"type\"]);\n if (type === \"open_stream\") {\n return {\n type: \"open_stream\"\n };\n } else if (type === \"close_stream\") {\n return {\n type: \"close_stream\"\n };\n } else if (type === \"execute\") {\n const result = (0, json_decode_js_1.StmtResult)(d.object(obj[\"result\"]));\n return {\n type: \"execute\",\n result\n };\n } else if (type === \"batch\") {\n const result = (0, json_decode_js_1.BatchResult)(d.object(obj[\"result\"]));\n return {\n type: \"batch\",\n result\n };\n } else if (type === \"open_cursor\") {\n return {\n type: \"open_cursor\"\n };\n } else if (type === \"close_cursor\") {\n return {\n type: \"close_cursor\"\n };\n } else if (type === \"fetch_cursor\") {\n const entries = d.arrayObjectsMap(obj[\"entries\"], json_decode_js_1.CursorEntry);\n const done = d.boolean(obj[\"done\"]);\n return {\n type: \"fetch_cursor\",\n entries,\n done\n };\n } else if (type === \"sequence\") {\n return {\n type: \"sequence\"\n };\n } else if (type === \"describe\") {\n const result = (0, json_decode_js_1.DescribeResult)(d.object(obj[\"result\"]));\n return {\n type: \"describe\",\n result\n };\n } else if (type === \"store_sql\") {\n return {\n type: \"store_sql\"\n };\n } else if (type === \"close_sql\") {\n return {\n type: \"close_sql\"\n };\n } else if (type === \"get_autocommit\") {\n const isAutocommit = d.boolean(obj[\"is_autocommit\"]);\n return {\n type: \"get_autocommit\",\n isAutocommit\n };\n } else {\n throw new errors_js_1.ProtoError(\"Unexpected type of Response\");\n }\n}","map":{"version":3,"names":["__createBinding","Object","create","o","m","k","k2","undefined","desc","getOwnPropertyDescriptor","__esModule","writable","configurable","enumerable","get","defineProperty","__setModuleDefault","v","value","__importStar","mod","result","prototype","hasOwnProperty","call","exports","ServerMsg","errors_js_1","require","d","json_decode_js_1","obj","type","string","error","Error","object","requestId","number","response","Response","ProtoError","StmtResult","BatchResult","entries","arrayObjectsMap","CursorEntry","done","boolean","DescribeResult","isAutocommit"],"sources":["/Users/shoofle/Projects/the-forest/node_modules/@libsql/hrana-client/lib-cjs/ws/json_decode.js"],"sourcesContent":["\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ServerMsg = void 0;\nconst errors_js_1 = require(\"../errors.js\");\nconst d = __importStar(require(\"../encoding/json/decode.js\"));\nconst json_decode_js_1 = require(\"../shared/json_decode.js\");\nfunction ServerMsg(obj) {\n const type = d.string(obj[\"type\"]);\n if (type === \"hello_ok\") {\n return { type: \"hello_ok\" };\n }\n else if (type === \"hello_error\") {\n const error = (0, json_decode_js_1.Error)(d.object(obj[\"error\"]));\n return { type: \"hello_error\", error };\n }\n else if (type === \"response_ok\") {\n const requestId = d.number(obj[\"request_id\"]);\n const response = Response(d.object(obj[\"response\"]));\n return { type: \"response_ok\", requestId, response };\n }\n else if (type === \"response_error\") {\n const requestId = d.number(obj[\"request_id\"]);\n const error = (0, json_decode_js_1.Error)(d.object(obj[\"error\"]));\n return { type: \"response_error\", requestId, error };\n }\n else {\n throw new errors_js_1.ProtoError(\"Unexpected type of ServerMsg\");\n }\n}\nexports.ServerMsg = ServerMsg;\nfunction Response(obj) {\n const type = d.string(obj[\"type\"]);\n if (type === \"open_stream\") {\n return { type: \"open_stream\" };\n }\n else if (type === \"close_stream\") {\n return { type: \"close_stream\" };\n }\n else if (type === \"execute\") {\n const result = (0, json_decode_js_1.StmtResult)(d.object(obj[\"result\"]));\n return { type: \"execute\", result };\n }\n else if (type === \"batch\") {\n const result = (0, json_decode_js_1.BatchResult)(d.object(obj[\"result\"]));\n return { type: \"batch\", result };\n }\n else if (type === \"open_cursor\") {\n return { type: \"open_cursor\" };\n }\n else if (type === \"close_cursor\") {\n return { type: \"close_cursor\" };\n }\n else if (type === \"fetch_cursor\") {\n const entries = d.arrayObjectsMap(obj[\"entries\"], json_decode_js_1.CursorEntry);\n const done = d.boolean(obj[\"done\"]);\n return { type: \"fetch_cursor\", entries, done };\n }\n else if (type === \"sequence\") {\n return { type: \"sequence\" };\n }\n else if (type === \"describe\") {\n const result = (0, json_decode_js_1.DescribeResult)(d.object(obj[\"result\"]));\n return { type: \"describe\", result };\n }\n else if (type === \"store_sql\") {\n return { type: \"store_sql\" };\n }\n else if (type === \"close_sql\") {\n return { type: \"close_sql\" };\n }\n else if (type === \"get_autocommit\") {\n const isAutocommit = d.boolean(obj[\"is_autocommit\"]);\n return { type: \"get_autocommit\", isAutocommit };\n }\n else {\n throw new errors_js_1.ProtoError(\"Unexpected type of Response\");\n }\n}\n"],"mappings":"AAAA,YAAY;;AACZ,IAAIA,eAAe,GAAI,IAAI,IAAI,IAAI,CAACA,eAAe,KAAMC,MAAM,CAACC,MAAM,GAAI,UAASC,CAAC,EAAEC,CAAC,EAAEC,CAAC,EAAEC,EAAE,EAAE;EAC5F,IAAIA,EAAE,KAAKC,SAAS,EAAED,EAAE,GAAGD,CAAC;EAC5B,IAAIG,IAAI,GAAGP,MAAM,CAACQ,wBAAwB,CAACL,CAAC,EAAEC,CAAC,CAAC;EAChD,IAAI,CAACG,IAAI,KAAK,KAAK,IAAIA,IAAI,GAAG,CAACJ,CAAC,CAACM,UAAU,GAAGF,IAAI,CAACG,QAAQ,I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