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

1 line
7.2 KiB
JSON

{"ast":null,"code":"import { ProtoError } from \"../errors.js\";\nimport * as d from \"../encoding/json/decode.js\";\nimport { Error, StmtResult, BatchResult, DescribeResult } from \"../shared/json_decode.js\";\nexport function 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}\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 = Error(d.object(obj[\"error\"]));\n return {\n type: \"error\",\n error\n };\n } else {\n throw new 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 = StmtResult(d.object(obj[\"result\"]));\n return {\n type: \"execute\",\n result\n };\n } else if (type === \"batch\") {\n const result = 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 = 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 ProtoError(\"Unexpected type of StreamResponse\");\n }\n}\nexport function 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}","map":{"version":3,"names":["ProtoError","d","Error","StmtResult","BatchResult","DescribeResult","PipelineRespBody","obj","baton","stringOpt","baseUrl","results","arrayObjectsMap","StreamResult","type","string","response","StreamResponse","object","error","result","isAutocommit","boolean","CursorRespBody"],"sources":["/Users/shoofle/Projects/the-forest/node_modules/@libsql/hrana-client/lib-esm/http/json_decode.js"],"sourcesContent":["import { ProtoError } from \"../errors.js\";\nimport * as d from \"../encoding/json/decode.js\";\nimport { Error, StmtResult, BatchResult, DescribeResult } from \"../shared/json_decode.js\";\nexport function 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 { baton, baseUrl, results };\n}\nfunction StreamResult(obj) {\n const type = d.string(obj[\"type\"]);\n if (type === \"ok\") {\n const response = StreamResponse(d.object(obj[\"response\"]));\n return { type: \"ok\", response };\n }\n else if (type === \"error\") {\n const error = Error(d.object(obj[\"error\"]));\n return { type: \"error\", error };\n }\n else {\n throw new ProtoError(\"Unexpected type of StreamResult\");\n }\n}\nfunction StreamResponse(obj) {\n const type = d.string(obj[\"type\"]);\n if (type === \"close\") {\n return { type: \"close\" };\n }\n else if (type === \"execute\") {\n const result = StmtResult(d.object(obj[\"result\"]));\n return { type: \"execute\", result };\n }\n else if (type === \"batch\") {\n const result = BatchResult(d.object(obj[\"result\"]));\n return { type: \"batch\", result };\n }\n else if (type === \"sequence\") {\n return { type: \"sequence\" };\n }\n else if (type === \"describe\") {\n const result = 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 ProtoError(\"Unexpected type of StreamResponse\");\n }\n}\nexport function CursorRespBody(obj) {\n const baton = d.stringOpt(obj[\"baton\"]);\n const baseUrl = d.stringOpt(obj[\"base_url\"]);\n return { baton, baseUrl };\n}\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,cAAc;AACzC,OAAO,KAAKC,CAAC,MAAM,4BAA4B;AAC/C,SAASC,KAAK,EAAEC,UAAU,EAAEC,WAAW,EAAEC,cAAc,QAAQ,0BAA0B;AACzF,OAAO,SAASC,gBAAgBA,CAACC,GAAG,EAAE;EAClC,MAAMC,KAAK,GAAGP,CAAC,CAACQ,SAAS,CAACF,GAAG,CAAC,OAAO,CAAC,CAAC;EACvC,MAAMG,OAAO,GAAGT,CAAC,CAACQ,SAAS,CAACF,GAAG,CAAC,UAAU,CAAC,CAAC;EAC5C,MAAMI,OAAO,GAAGV,CAAC,CAACW,eAAe,CAACL,GAAG,CAAC,SAAS,CAAC,EAAEM,YAAY,CAAC;EAC/D,OAAO;IAAEL,KAAK;IAAEE,OAAO;IAAEC;EAAQ,CAAC;AACtC;AACA,SAASE,YAAYA,CAACN,GAAG,EAAE;EACvB,MAAMO,IAAI,GAAGb,CAAC,CAACc,MAAM,CAACR,GAAG,CAAC,MAAM,CAAC,CAAC;EAClC,IAAIO,IAAI,KAAK,IAAI,EAAE;IACf,MAAME,QAAQ,GAAGC,cAAc,CAAChB,CAAC,CAACiB,MAAM,CAACX,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC;IAC1D,OAAO;MAAEO,IAAI,EAAE,IAAI;MAAEE;IAAS,CAAC;EACnC,CAAC,MACI,IAAIF,IAAI,KAAK,OAAO,EAAE;IACvB,MAAMK,KAAK,GAAGjB,KAAK,CAACD,CAAC,CAACiB,MAAM,CAACX,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;IAC3C,OAAO;MAAEO,IAAI,EAAE,OAAO;MAAEK;IAAM,CAAC;EACnC,CAAC,MACI;IACD,MAA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