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

1 line
40 KiB
JSON

{"ast":null,"code":"import { Request, Headers } from \"@libsql/isomorphic-fetch\";\nimport { ClientError, HttpServerError, ProtocolVersionError, ProtoError, ClosedError, InternalError } from \"../errors.js\";\nimport { readJsonObject, writeJsonObject, readProtobufMessage, writeProtobufMessage } from \"../encoding/index.js\";\nimport { IdAlloc } from \"../id_alloc.js\";\nimport { Queue } from \"../queue.js\";\nimport { queueMicrotask } from \"../queue_microtask.js\";\nimport { errorFromProto } from \"../result.js\";\nimport { Sql } from \"../sql.js\";\nimport { Stream } from \"../stream.js\";\nimport { impossible } from \"../util.js\";\nimport { HttpCursor } from \"./cursor.js\";\nimport { PipelineReqBody as json_PipelineReqBody } from \"./json_encode.js\";\nimport { PipelineReqBody as protobuf_PipelineReqBody } from \"./protobuf_encode.js\";\nimport { CursorReqBody as json_CursorReqBody } from \"./json_encode.js\";\nimport { CursorReqBody as protobuf_CursorReqBody } from \"./protobuf_encode.js\";\nimport { PipelineRespBody as json_PipelineRespBody } from \"./json_decode.js\";\nimport { PipelineRespBody as protobuf_PipelineRespBody } from \"./protobuf_decode.js\";\nexport class HttpStream extends Stream {\n #client;\n #baseUrl;\n #jwt;\n #fetch;\n #baton;\n #queue;\n #flushing;\n #cursor;\n #closing;\n #closeQueued;\n #closed;\n #sqlIdAlloc;\n /** @private */\n constructor(client, baseUrl, jwt, customFetch) {\n super(client.intMode);\n this.#client = client;\n this.#baseUrl = baseUrl.toString();\n this.#jwt = jwt;\n this.#fetch = customFetch;\n this.#baton = undefined;\n this.#queue = new Queue();\n this.#flushing = false;\n this.#closing = false;\n this.#closeQueued = false;\n this.#closed = undefined;\n this.#sqlIdAlloc = new IdAlloc();\n }\n /** Get the {@link HttpClient} object that this stream belongs to. */\n client() {\n return this.#client;\n }\n /** @private */\n _sqlOwner() {\n return this;\n }\n /** Cache a SQL text on the server. */\n storeSql(sql) {\n const sqlId = this.#sqlIdAlloc.alloc();\n this.#sendStreamRequest({\n type: \"store_sql\",\n sqlId,\n sql\n }).then(() => undefined, error => this._setClosed(error));\n return new Sql(this, sqlId);\n }\n /** @private */\n _closeSql(sqlId) {\n if (this.#closed !== undefined) {\n return;\n }\n this.#sendStreamRequest({\n type: \"close_sql\",\n sqlId\n }).then(() => this.#sqlIdAlloc.free(sqlId), error => this._setClosed(error));\n }\n /** @private */\n _execute(stmt) {\n return this.#sendStreamRequest({\n type: \"execute\",\n stmt\n }).then(response => {\n return response.result;\n });\n }\n /** @private */\n _batch(batch) {\n return this.#sendStreamRequest({\n type: \"batch\",\n batch\n }).then(response => {\n return response.result;\n });\n }\n /** @private */\n _describe(protoSql) {\n return this.#sendStreamRequest({\n type: \"describe\",\n sql: protoSql.sql,\n sqlId: protoSql.sqlId\n }).then(response => {\n return response.result;\n });\n }\n /** @private */\n _sequence(protoSql) {\n return this.#sendStreamRequest({\n type: \"sequence\",\n sql: protoSql.sql,\n sqlId: protoSql.sqlId\n }).then(_response => {\n return undefined;\n });\n }\n /** Check whether the SQL connection underlying this stream is in autocommit state (i.e., outside of an\n * explicit transaction). This requires protocol version 3 or higher.\n */\n getAutocommit() {\n this.#client._ensureVersion(3, \"getAutocommit()\");\n return this.#sendStreamRequest({\n type: \"get_autocommit\"\n }).then(response => {\n return response.isAutocommit;\n });\n }\n #sendStreamRequest(request) {\n return new Promise((responseCallback, errorCallback) => {\n this.#pushToQueue({\n type: \"pipeline\",\n request,\n responseCallback,\n errorCallback\n });\n });\n }\n /** @private */\n _openCursor(batch) {\n return new Promise((cursorCallback, errorCallback) => {\n this.#pushToQueue({\n type: \"cursor\",\n batch,\n cursorCallback,\n errorCallback\n });\n });\n }\n /** @private */\n _cursorClosed(cursor) {\n if (cursor !== this.#cursor) {\n throw new InternalError(\"Cursor was closed, but it was not associated with the stream\");\n }\n this.#cursor = undefined;\n queueMicrotask(() => this.#flushQueue());\n }\n /** Immediately close the stream. */\n close() {\n this._setClosed(new ClientError(\"Stream was manually closed\"));\n }\n /** Gracefully close the stream. */\n closeGracefully() {\n this.#closing = true;\n queueMicrotask(() => this.#flushQueue());\n }\n /** True if the stream is closed. */\n get closed() {\n return this.#closed !== undefined || this.#closing;\n }\n /** @private */\n _setClosed(error) {\n if (this.#closed !== undefined) {\n return;\n }\n this.#closed = error;\n if (this.#cursor !== undefined) {\n this.#cursor._setClosed(error);\n }\n this.#client._streamClosed(this);\n for (;;) {\n const entry = this.#queue.shift();\n if (entry !== undefined) {\n entry.errorCallback(error);\n } else {\n break;\n }\n }\n if ((this.#baton !== undefined || this.#flushing) && !this.#closeQueued) {\n this.#queue.push({\n type: \"pipeline\",\n request: {\n type: \"close\"\n },\n responseCallback: () => undefined,\n errorCallback: () => undefined\n });\n this.#closeQueued = true;\n queueMicrotask(() => this.#flushQueue());\n }\n }\n #pushToQueue(entry) {\n if (this.#closed !== undefined) {\n throw new ClosedError(\"Stream is closed\", this.#closed);\n } else if (this.#closing) {\n throw new ClosedError(\"Stream is closing\", undefined);\n } else {\n this.#queue.push(entry);\n queueMicrotask(() => this.#flushQueue());\n }\n }\n #flushQueue() {\n if (this.#flushing || this.#cursor !== undefined) {\n return;\n }\n if (this.#closing && this.#queue.length === 0) {\n this._setClosed(new ClientError(\"Stream was gracefully closed\"));\n return;\n }\n const endpoint = this.#client._endpoint;\n if (endpoint === undefined) {\n this.#client._endpointPromise.then(() => this.#flushQueue(), error => this._setClosed(error));\n return;\n }\n const firstEntry = this.#queue.shift();\n if (firstEntry === undefined) {\n return;\n } else if (firstEntry.type === \"pipeline\") {\n const pipeline = [firstEntry];\n for (;;) {\n const entry = this.#queue.first();\n if (entry !== undefined && entry.type === \"pipeline\") {\n pipeline.push(entry);\n this.#queue.shift();\n } else if (entry === undefined && this.#closing && !this.#closeQueued) {\n pipeline.push({\n type: \"pipeline\",\n request: {\n type: \"close\"\n },\n responseCallback: () => undefined,\n errorCallback: () => undefined\n });\n this.#closeQueued = true;\n break;\n } else {\n break;\n }\n }\n this.#flushPipeline(endpoint, pipeline);\n } else if (firstEntry.type === \"cursor\") {\n this.#flushCursor(endpoint, firstEntry);\n } else {\n throw impossible(firstEntry, \"Impossible type of QueueEntry\");\n }\n }\n #flushPipeline(endpoint, pipeline) {\n this.#flush(() => this.#createPipelineRequest(pipeline, endpoint), resp => decodePipelineResponse(resp, endpoint.encoding), respBody => respBody.baton, respBody => respBody.baseUrl, respBody => handlePipelineResponse(pipeline, respBody), error => pipeline.forEach(entry => entry.errorCallback(error)));\n }\n #flushCursor(endpoint, entry) {\n const cursor = new HttpCursor(this, endpoint.encoding);\n this.#cursor = cursor;\n this.#flush(() => this.#createCursorRequest(entry, endpoint), resp => cursor.open(resp), respBody => respBody.baton, respBody => respBody.baseUrl, _respBody => entry.cursorCallback(cursor), error => entry.errorCallback(error));\n }\n #flush(createRequest, decodeResponse, getBaton, getBaseUrl, handleResponse, handleError) {\n let promise;\n try {\n const request = createRequest();\n const fetch = this.#fetch;\n promise = fetch(request);\n } catch (error) {\n promise = Promise.reject(error);\n }\n this.#flushing = true;\n promise.then(resp => {\n if (!resp.ok) {\n return errorFromResponse(resp).then(error => {\n throw error;\n });\n }\n return decodeResponse(resp);\n }).then(r => {\n this.#baton = getBaton(r);\n this.#baseUrl = getBaseUrl(r) ?? this.#baseUrl;\n handleResponse(r);\n }).catch(error => {\n this._setClosed(error);\n handleError(error);\n }).finally(() => {\n this.#flushing = false;\n this.#flushQueue();\n });\n }\n #createPipelineRequest(pipeline, endpoint) {\n return this.#createRequest(new URL(endpoint.pipelinePath, this.#baseUrl), {\n baton: this.#baton,\n requests: pipeline.map(entry => entry.request)\n }, endpoint.encoding, json_PipelineReqBody, protobuf_PipelineReqBody);\n }\n #createCursorRequest(entry, endpoint) {\n if (endpoint.cursorPath === undefined) {\n throw new ProtocolVersionError(\"Cursors are supported only on protocol version 3 and higher, \" + `but the HTTP server only supports version ${endpoint.version}.`);\n }\n return this.#createRequest(new URL(endpoint.cursorPath, this.#baseUrl), {\n baton: this.#baton,\n batch: entry.batch\n }, endpoint.encoding, json_CursorReqBody, protobuf_CursorReqBody);\n }\n #createRequest(url, reqBody, encoding, jsonFun, protobufFun) {\n let bodyData;\n let contentType;\n if (encoding === \"json\") {\n bodyData = writeJsonObject(reqBody, jsonFun);\n contentType = \"application/json\";\n } else if (encoding === \"protobuf\") {\n bodyData = writeProtobufMessage(reqBody, protobufFun);\n contentType = \"application/x-protobuf\";\n } else {\n throw impossible(encoding, \"Impossible encoding\");\n }\n const headers = new Headers();\n headers.set(\"content-type\", contentType);\n if (this.#jwt !== undefined) {\n headers.set(\"authorization\", `Bearer ${this.#jwt}`);\n }\n return new Request(url.toString(), {\n method: \"POST\",\n headers,\n body: bodyData\n });\n }\n}\nfunction handlePipelineResponse(pipeline, respBody) {\n if (respBody.results.length !== pipeline.length) {\n throw new ProtoError(\"Server returned unexpected number of pipeline results\");\n }\n for (let i = 0; i < pipeline.length; ++i) {\n const result = respBody.results[i];\n const entry = pipeline[i];\n if (result.type === \"ok\") {\n if (result.response.type !== entry.request.type) {\n throw new ProtoError(\"Received unexpected type of response\");\n }\n entry.responseCallback(result.response);\n } else if (result.type === \"error\") {\n entry.errorCallback(errorFromProto(result.error));\n } else if (result.type === \"none\") {\n throw new ProtoError(\"Received unrecognized type of StreamResult\");\n } else {\n throw impossible(result, \"Received impossible type of StreamResult\");\n }\n }\n}\nasync function decodePipelineResponse(resp, encoding) {\n if (encoding === \"json\") {\n const respJson = await resp.json();\n return readJsonObject(respJson, json_PipelineRespBody);\n } else if (encoding === \"protobuf\") {\n const respData = await resp.arrayBuffer();\n return readProtobufMessage(new Uint8Array(respData), protobuf_PipelineRespBody);\n } else {\n throw impossible(encoding, \"Impossible encoding\");\n }\n}\nasync function errorFromResponse(resp) {\n const respType = resp.headers.get(\"content-type\") ?? \"text/plain\";\n if (respType === \"application/json\") {\n const respBody = await resp.json();\n if (\"message\" in respBody) {\n return errorFromProto(respBody);\n }\n }\n let message = `Server returned HTTP status ${resp.status}`;\n if (respType === \"text/plain\") {\n const respBody = (await resp.text()).trim();\n if (respBody !== \"\") {\n message += `: ${respBody}`;\n }\n }\n return new HttpServerError(message, resp.status);\n}","map":{"version":3,"names":["Request","Headers","ClientError","HttpServerError","ProtocolVersionError","ProtoError","ClosedError","InternalError","readJsonObject","writeJsonObject","readProtobufMessage","writeProtobufMessage","IdAlloc","Queue","queueMicrotask","errorFromProto","Sql","Stream","impossible","HttpCursor","PipelineReqBody","json_PipelineReqBody","protobuf_PipelineReqBody","CursorReqBody","json_CursorReqBody","protobuf_CursorReqBody","PipelineRespBody","json_PipelineRespBody","protobuf_PipelineRespBody","HttpStream","client","baseUrl","jwt","fetch","baton","queue","flushing","cursor","closing","closeQueued","closed","sqlIdAlloc","constructor","customFetch","intMode","toString","undefined","_sqlOwner","storeSql","sql","sqlId","alloc","sendStreamRequest","type","then","error","_setClosed","_closeSql","free","_execute","stmt","response","result","_batch","batch","_describe","protoSql","_sequence","_response","getAutocommit","_ensureVersion","isAutocommit","#sendStreamRequest","request","Promise","responseCallback","errorCallback","pushToQueue","_openCursor","cursorCallback","_cursorClosed","flushQueue","close","closeGracefully","_streamClosed","entry","shift","push","#pushToQueue","#flushQueue","length","endpoint","_endpoint","_endpointPromise","firstEntry","pipeline","first","flushPipeline","flushCursor","#flushPipeline","flush","createPipelineRequest","resp","decodePipelineResponse","encoding","respBody","handlePipelineResponse","forEach","#flushCursor","createCursorRequest","open","_respBody","#flush","createRequest","decodeResponse","getBaton","getBaseUrl","handleResponse","handleError","promise","reject","ok","errorFromResponse","r","catch","finally","#createPipelineRequest","URL","pipelinePath","requests","map","#createCursorRequest","cursorPath","version","#createRequest","url","reqBody","jsonFun","protobufFun","bodyData","contentType","headers","set","method","body","results","i","respJson","json","respData","arrayBuffer","Uint8Array","respType","get","message","status","text","trim"],"sources":["/Users/shoofle/Projects/the-forest/node_modules/@libsql/hrana-client/lib-esm/http/stream.js"],"sourcesContent":["import { Request, Headers } from \"@libsql/isomorphic-fetch\";\nimport { ClientError, HttpServerError, ProtocolVersionError, ProtoError, ClosedError, InternalError, } from \"../errors.js\";\nimport { readJsonObject, writeJsonObject, readProtobufMessage, writeProtobufMessage, } from \"../encoding/index.js\";\nimport { IdAlloc } from \"../id_alloc.js\";\nimport { Queue } from \"../queue.js\";\nimport { queueMicrotask } from \"../queue_microtask.js\";\nimport { errorFromProto } from \"../result.js\";\nimport { Sql } from \"../sql.js\";\nimport { Stream } from \"../stream.js\";\nimport { impossible } from \"../util.js\";\nimport { HttpCursor } from \"./cursor.js\";\nimport { PipelineReqBody as json_PipelineReqBody } from \"./json_encode.js\";\nimport { PipelineReqBody as protobuf_PipelineReqBody } from \"./protobuf_encode.js\";\nimport { CursorReqBody as json_CursorReqBody } from \"./json_encode.js\";\nimport { CursorReqBody as protobuf_CursorReqBody } from \"./protobuf_encode.js\";\nimport { PipelineRespBody as json_PipelineRespBody } from \"./json_decode.js\";\nimport { PipelineRespBody as protobuf_PipelineRespBody } from \"./protobuf_decode.js\";\nexport class HttpStream extends Stream {\n #client;\n #baseUrl;\n #jwt;\n #fetch;\n #baton;\n #queue;\n #flushing;\n #cursor;\n #closing;\n #closeQueued;\n #closed;\n #sqlIdAlloc;\n /** @private */\n constructor(client, baseUrl, jwt, customFetch) {\n super(client.intMode);\n this.#client = client;\n this.#baseUrl = baseUrl.toString();\n this.#jwt = jwt;\n this.#fetch = customFetch;\n this.#baton = undefined;\n this.#queue = new Queue();\n this.#flushing = false;\n this.#closing = false;\n this.#closeQueued = false;\n this.#closed = undefined;\n this.#sqlIdAlloc = new IdAlloc();\n }\n /** Get the {@link HttpClient} object that this stream belongs to. */\n client() {\n return this.#client;\n }\n /** @private */\n _sqlOwner() {\n return this;\n }\n /** Cache a SQL text on the server. */\n storeSql(sql) {\n const sqlId = this.#sqlIdAlloc.alloc();\n this.#sendStreamRequest({ type: \"store_sql\", sqlId, sql }).then(() => undefined, (error) => this._setClosed(error));\n return new Sql(this, sqlId);\n }\n /** @private */\n _closeSql(sqlId) {\n if (this.#closed !== undefined) {\n return;\n }\n this.#sendStreamRequest({ type: \"close_sql\", sqlId }).then(() => this.#sqlIdAlloc.free(sqlId), (error) => this._setClosed(error));\n }\n /** @private */\n _execute(stmt) {\n return this.#sendStreamRequest({ type: \"execute\", stmt }).then((response) => {\n return response.result;\n });\n }\n /** @private */\n _batch(batch) {\n return this.#sendStreamRequest({ type: \"batch\", batch }).then((response) => {\n return response.result;\n });\n }\n /** @private */\n _describe(protoSql) {\n return this.#sendStreamRequest({\n type: \"describe\",\n sql: protoSql.sql,\n sqlId: protoSql.sqlId\n }).then((response) => {\n return response.result;\n });\n }\n /** @private */\n _sequence(protoSql) {\n return this.#sendStreamRequest({\n type: \"sequence\",\n sql: protoSql.sql,\n sqlId: protoSql.sqlId,\n }).then((_response) => {\n return undefined;\n });\n }\n /** Check whether the SQL connection underlying this stream is in autocommit state (i.e., outside of an\n * explicit transaction). This requires protocol version 3 or higher.\n */\n getAutocommit() {\n this.#client._ensureVersion(3, \"getAutocommit()\");\n return this.#sendStreamRequest({\n type: \"get_autocommit\",\n }).then((response) => {\n return response.isAutocommit;\n });\n }\n #sendStreamRequest(request) {\n return new Promise((responseCallback, errorCallback) => {\n this.#pushToQueue({ type: \"pipeline\", request, responseCallback, errorCallback });\n });\n }\n /** @private */\n _openCursor(batch) {\n return new Promise((cursorCallback, errorCallback) => {\n this.#pushToQueue({ type: \"cursor\", batch, cursorCallback, errorCallback });\n });\n }\n /** @private */\n _cursorClosed(cursor) {\n if (cursor !== this.#cursor) {\n throw new InternalError(\"Cursor was closed, but it was not associated with the stream\");\n }\n this.#cursor = undefined;\n queueMicrotask(() => this.#flushQueue());\n }\n /** Immediately close the stream. */\n close() {\n this._setClosed(new ClientError(\"Stream was manually closed\"));\n }\n /** Gracefully close the stream. */\n closeGracefully() {\n this.#closing = true;\n queueMicrotask(() => this.#flushQueue());\n }\n /** True if the stream is closed. */\n get closed() {\n return this.#closed !== undefined || this.#closing;\n }\n /** @private */\n _setClosed(error) {\n if (this.#closed !== undefined) {\n return;\n }\n this.#closed = error;\n if (this.#cursor !== undefined) {\n this.#cursor._setClosed(error);\n }\n this.#client._streamClosed(this);\n for (;;) {\n const entry = this.#queue.shift();\n if (entry !== undefined) {\n entry.errorCallback(error);\n }\n else {\n break;\n }\n }\n if ((this.#baton !== undefined || this.#flushing) && !this.#closeQueued) {\n this.#queue.push({\n type: \"pipeline\",\n request: { type: \"close\" },\n responseCallback: () => undefined,\n errorCallback: () => undefined,\n });\n this.#closeQueued = true;\n queueMicrotask(() => this.#flushQueue());\n }\n }\n #pushToQueue(entry) {\n if (this.#closed !== undefined) {\n throw new ClosedError(\"Stream is closed\", this.#closed);\n }\n else if (this.#closing) {\n throw new ClosedError(\"Stream is closing\", undefined);\n }\n else {\n this.#queue.push(entry);\n queueMicrotask(() => this.#flushQueue());\n }\n }\n #flushQueue() {\n if (this.#flushing || this.#cursor !== undefined) {\n return;\n }\n if (this.#closing && this.#queue.length === 0) {\n this._setClosed(new ClientError(\"Stream was gracefully closed\"));\n return;\n }\n const endpoint = this.#client._endpoint;\n if (endpoint === undefined) {\n this.#client._endpointPromise.then(() => this.#flushQueue(), (error) => this._setClosed(error));\n return;\n }\n const firstEntry = this.#queue.shift();\n if (firstEntry === undefined) {\n return;\n }\n else if (firstEntry.type === \"pipeline\") {\n const pipeline = [firstEntry];\n for (;;) {\n const entry = this.#queue.first();\n if (entry !== undefined && entry.type === \"pipeline\") {\n pipeline.push(entry);\n this.#queue.shift();\n }\n else if (entry === undefined && this.#closing && !this.#closeQueued) {\n pipeline.push({\n type: \"pipeline\",\n request: { type: \"close\" },\n responseCallback: () => undefined,\n errorCallback: () => undefined,\n });\n this.#closeQueued = true;\n break;\n }\n else {\n break;\n }\n }\n this.#flushPipeline(endpoint, pipeline);\n }\n else if (firstEntry.type === \"cursor\") {\n this.#flushCursor(endpoint, firstEntry);\n }\n else {\n throw impossible(firstEntry, \"Impossible type of QueueEntry\");\n }\n }\n #flushPipeline(endpoint, pipeline) {\n this.#flush(() => this.#createPipelineRequest(pipeline, endpoint), (resp) => decodePipelineResponse(resp, endpoint.encoding), (respBody) => respBody.baton, (respBody) => respBody.baseUrl, (respBody) => handlePipelineResponse(pipeline, respBody), (error) => pipeline.forEach((entry) => entry.errorCallback(error)));\n }\n #flushCursor(endpoint, entry) {\n const cursor = new HttpCursor(this, endpoint.encoding);\n this.#cursor = cursor;\n this.#flush(() => this.#createCursorRequest(entry, endpoint), (resp) => cursor.open(resp), (respBody) => respBody.baton, (respBody) => respBody.baseUrl, (_respBody) => entry.cursorCallback(cursor), (error) => entry.errorCallback(error));\n }\n #flush(createRequest, decodeResponse, getBaton, getBaseUrl, handleResponse, handleError) {\n let promise;\n try {\n const request = createRequest();\n const fetch = this.#fetch;\n promise = fetch(request);\n }\n catch (error) {\n promise = Promise.reject(error);\n }\n this.#flushing = true;\n promise.then((resp) => {\n if (!resp.ok) {\n return errorFromResponse(resp).then((error) => {\n throw error;\n });\n }\n return decodeResponse(resp);\n }).then((r) => {\n this.#baton = getBaton(r);\n this.#baseUrl = getBaseUrl(r) ?? this.#baseUrl;\n handleResponse(r);\n }).catch((error) => {\n this._setClosed(error);\n handleError(error);\n }).finally(() => {\n this.#flushing = false;\n this.#flushQueue();\n });\n }\n #createPipelineRequest(pipeline, endpoint) {\n return this.#createRequest(new URL(endpoint.pipelinePath, this.#baseUrl), {\n baton: this.#baton,\n requests: pipeline.map((entry) => entry.request),\n }, endpoint.encoding, json_PipelineReqBody, protobuf_PipelineReqBody);\n }\n #createCursorRequest(entry, endpoint) {\n if (endpoint.cursorPath === undefined) {\n throw new ProtocolVersionError(\"Cursors are supported only on protocol version 3 and higher, \" +\n `but the HTTP server only supports version ${endpoint.version}.`);\n }\n return this.#createRequest(new URL(endpoint.cursorPath, this.#baseUrl), {\n baton: this.#baton,\n batch: entry.batch,\n }, endpoint.encoding, json_CursorReqBody, protobuf_CursorReqBody);\n }\n #createRequest(url, reqBody, encoding, jsonFun, protobufFun) {\n let bodyData;\n let contentType;\n if (encoding === \"json\") {\n bodyData = writeJsonObject(reqBody, jsonFun);\n contentType = \"application/json\";\n }\n else if (encoding === \"protobuf\") {\n bodyData = writeProtobufMessage(reqBody, protobufFun);\n contentType = \"application/x-protobuf\";\n }\n else {\n throw impossible(encoding, \"Impossible encoding\");\n }\n const headers = new Headers();\n headers.set(\"content-type\", contentType);\n if (this.#jwt !== undefined) {\n headers.set(\"authorization\", `Bearer ${this.#jwt}`);\n }\n return new Request(url.toString(), { method: \"POST\", headers, body: bodyData });\n }\n}\nfunction handlePipelineResponse(pipeline, respBody) {\n if (respBody.results.length !== pipeline.length) {\n throw new ProtoError(\"Server returned unexpected number of pipeline results\");\n }\n for (let i = 0; i < pipeline.length; ++i) {\n const result = respBody.results[i];\n const entry = pipeline[i];\n if (result.type === \"ok\") {\n if (result.response.type !== entry.request.type) {\n throw new ProtoError(\"Received unexpected type of response\");\n }\n entry.responseCallback(result.response);\n }\n else if (result.type === \"error\") {\n entry.errorCallback(errorFromProto(result.error));\n }\n else if (result.type === \"none\") {\n throw new ProtoError(\"Received unrecognized type of StreamResult\");\n }\n else {\n throw impossible(result, \"Received impossible type of StreamResult\");\n }\n }\n}\nasync function decodePipelineResponse(resp, encoding) {\n if (encoding === \"json\") {\n const respJson = await resp.json();\n return readJsonObject(respJson, json_PipelineRespBody);\n }\n else if (encoding === \"protobuf\") {\n const respData = await resp.arrayBuffer();\n return readProtobufMessage(new Uint8Array(respData), protobuf_PipelineRespBody);\n }\n else {\n throw impossible(encoding, \"Impossible encoding\");\n }\n}\nasync function errorFromResponse(resp) {\n const respType = resp.headers.get(\"content-type\") ?? \"text/plain\";\n if (respType === \"application/json\") {\n const respBody = await resp.json();\n if (\"message\" in respBody) {\n return errorFromProto(respBody);\n }\n }\n let message = `Server returned HTTP status ${resp.status}`;\n if (respType === \"text/plain\") {\n const respBody = (await resp.text()).trim();\n if (respBody !==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