1 line
12 KiB
JSON
1 line
12 KiB
JSON
|
{"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.CursorRespBody = exports.PipelineRespBody = 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 PipelineRespBody(obj) {\n const baton = d.stringOpt(obj[\"baton\"]);\n const baseUrl = d.stringOpt(obj[\"base_url\"]);\n const results = d.arrayObjectsMap(obj[\"results\"], StreamResult);\n return {\n baton,\n baseUrl,\n results\n };\n}\nexports.PipelineRespBody = PipelineRespBody;\nfunction StreamResult(obj) {\n const type = d.string(obj[\"type\"]);\n if (type === \"ok\") {\n const response = StreamResponse(d.object(obj[\"response\"]));\n return {\n type: \"ok\",\n response\n };\n } else if (type === \"error\") {\n const error = (0, json_decode_js_1.Error)(d.object(obj[\"error\"]));\n return {\n type: \"error\",\n error\n };\n } else {\n throw new errors_js_1.ProtoError(\"Unexpected type of StreamResult\");\n }\n}\nfunction StreamResponse(obj) {\n const type = d.string(obj[\"type\"]);\n if (type === \"close\") {\n return {\n type: \"close\"\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 === \"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 StreamResponse\");\n }\n}\nfunction CursorRespBody(obj) {\n const baton = d.stringOpt(obj[\"baton\"]);\n const baseUrl = d.stringOpt(obj[\"base_url\"]);\n return {\n baton,\n baseUrl\n };\n}\nexports.CursorRespBody = CursorRespBody;","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","CursorRespBody","PipelineRespBody","errors_js_1","require","d","json_decode_js_1","obj","baton","stringOpt","baseUrl
|