{"ast":null,"code":"\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.WsStream = void 0;\nconst errors_js_1 = require(\"../errors.js\");\nconst queue_js_1 = require(\"../queue.js\");\nconst stream_js_1 = require(\"../stream.js\");\nconst cursor_js_1 = require(\"./cursor.js\");\nclass WsStream extends stream_js_1.Stream {\n #client;\n #streamId;\n #queue;\n #cursor;\n #closing;\n #closed;\n /** @private */\n static open(client) {\n const streamId = client._streamIdAlloc.alloc();\n const stream = new WsStream(client, streamId);\n const responseCallback = () => undefined;\n const errorCallback = e => stream.#setClosed(e);\n const request = {\n type: \"open_stream\",\n streamId\n };\n client._sendRequest(request, {\n responseCallback,\n errorCallback\n });\n return stream;\n }\n /** @private */\n constructor(client, streamId) {\n super(client.intMode);\n this.#client = client;\n this.#streamId = streamId;\n this.#queue = new queue_js_1.Queue();\n this.#cursor = undefined;\n this.#closing = false;\n this.#closed = undefined;\n }\n /** Get the {@link WsClient} object that this stream belongs to. */\n client() {\n return this.#client;\n }\n /** @private */\n _sqlOwner() {\n return this.#client;\n }\n /** @private */\n _execute(stmt) {\n return this.#sendStreamRequest({\n type: \"execute\",\n streamId: this.#streamId,\n stmt\n }).then(response => {\n return response.result;\n });\n }\n /** @private */\n _batch(batch) {\n return this.#sendStreamRequest({\n type: \"batch\",\n streamId: this.#streamId,\n batch\n }).then(response => {\n return response.result;\n });\n }\n /** @private */\n _describe(protoSql) {\n this.#client._ensureVersion(2, \"describe()\");\n return this.#sendStreamRequest({\n type: \"describe\",\n streamId: this.#streamId,\n sql: protoSql.sql,\n sqlId: protoSql.sqlId\n }).then(response => {\n return response.result;\n });\n }\n /** @private */\n _sequence(protoSql) {\n this.#client._ensureVersion(2, \"sequence()\");\n return this.#sendStreamRequest({\n type: \"sequence\",\n streamId: this.#streamId,\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 streamId: this.#streamId\n }).then(response => {\n return response.isAutocommit;\n });\n }\n #sendStreamRequest(request) {\n return new Promise((responseCallback, errorCallback) => {\n this.#pushToQueue({\n type: \"request\",\n request,\n responseCallback,\n errorCallback\n });\n });\n }\n /** @private */\n _openCursor(batch) {\n this.#client._ensureVersion(3, \"cursor\");\n return new Promise((cursorCallback, errorCallback) => {\n this.#pushToQueue({\n type: \"cursor\",\n batch,\n cursorCallback,\n errorCallback\n });\n });\n }\n /** @private */\n _sendCursorRequest(cursor, request) {\n if (cursor !== this.#cursor) {\n throw new errors_js_1.InternalError(\"Cursor not associated with the stream attempted to execute a request\");\n }\n return new Promise((responseCallback, errorCallback) => {\n if (this.#closed !== undefined) {\n errorCallback(new errors_js_1.ClosedError(\"Stream is closed\", this.#closed));\n } else {\n this.#client._sendRequest(request, {\n responseCallback,\n errorCallback\n });\n }\n });\n }\n /** @private */\n _cursorClosed(cursor) {\n if (cursor !== this.#cursor) {\n throw new errors_js_1.InternalError(\"Cursor was closed, but it was not associated with the stream\");\n }\n this.#cursor = undefined;\n this.#flushQueue();\n }\n #pushToQueue(entry) {\n if (this.#closed !== undefined) {\n entry.errorCallback(new errors_js_1.ClosedError(\"Stream is closed\", this.#closed));\n } else if (this.#closing) {\n entry.errorCallback(new errors_js_1.ClosedError(\"Stream is closing\", undefined));\n } else {\n this.#queue.push(entry);\n this.#flushQueue();\n }\n }\n #flushQueue() {\n for (;;) {\n const entry = this.#queue.first();\n if (entry === undefined && this.#cursor === undefined && this.#closing) {\n this.#setClosed(new errors_js_1.ClientError(\"Stream was gracefully closed\"));\n break;\n } else if (entry?.type === \"request\" && this.#cursor === undefined) {\n const {\n request,\n responseCallback,\n errorCallback\n } = entry;\n this.#queue.shift();\n this.#client._sendRequest(request, {\n responseCallback,\n errorCallback\n });\n } else if (entry?.type === \"cursor\" && this.#cursor === undefined) {\n const {\n batch,\n cursorCallback\n } = entry;\n this.#queue.shift();\n const cursorId = this.#client._cursorIdAlloc.alloc();\n const cursor = new cursor_js_1.WsCursor(this.#client, this, cursorId);\n const request = {\n type: \"open_cursor\",\n streamId: this.#streamId,\n cursorId,\n batch\n };\n const responseCallback = () => undefined;\n const errorCallback = e => cursor._setClosed(e);\n this.#client._sendRequest(request, {\n responseCallback,\n errorCallback\n });\n this.#cursor = cursor;\n cursorCallback(cursor);\n } else {\n break;\n }\n }\n }\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 for (;;) {\n const entry = this.#queue.shift();\n if (entry !== undefined) {\n entry.errorCallback(error);\n } else {\n break;\n }\n }\n const request = {\n type: \"close_stream\",\n streamId: this.#streamId\n };\n const responseCallback = () => this.#client._streamIdAlloc.free(this.#streamId);\n const errorCallback = () => undefined;\n this.#client._sendRequest(request, {\n responseCallback,\n errorCallback\n });\n }\n /** Immediately close the stream. */\n close() {\n this.#setClosed(new errors_js_1.ClientError(\"Stream was manually closed\"));\n }\n /** Gracefully close the stream. */\n closeGracefully() {\n this.#closing = true;\n this.#flushQueue();\n }\n /** True if the stream is closed or closing. */\n get closed() {\n return this.#closed !== undefined || this.#closing;\n }\n}\nexports.WsStream = WsStream;","map":{"version":3,"names":["Object","defineProperty","exports","value","WsStream","errors_js_1","require","queue_js_1","stream_js_1","cursor_js_1","Stream","client","streamId","queue","cursor","closing","closed","open","_streamIdAlloc","alloc","stream","responseCallback","undefined","errorCallback","e","setClosed","request","type","_sendRequest","constructor","intMode","Queue","_sqlOwner","_execute","stmt","sendStreamRequest","then","response","result","_batch","batch","_describe","protoSql","_ensureVersion","sql","sqlId","_sequence","_response","getAutocommit","isAutocommit","#sendStreamRequest","Promise","pushToQueue","_openCursor","cursorCallback","_sendCursorRequest","InternalError","ClosedError","_cursorClosed","flushQueue","#pushToQueue","entry","push","#flushQueue","first","ClientError","shift","cursorId","_cursorIdAlloc","WsCursor","_setClosed","#setClosed","error","free","close","closeGracefully"],"sources":["/Users/shoofle/Projects/the-forest/node_modules/@libsql/hrana-client/lib-cjs/ws/stream.js"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.WsStream = void 0;\nconst errors_js_1 = require(\"../errors.js\");\nconst queue_js_1 = require(\"../queue.js\");\nconst stream_js_1 = require(\"../stream.js\");\nconst cursor_js_1 = require(\"./cursor.js\");\nclass WsStream extends stream_js_1.Stream {\n #client;\n #streamId;\n #queue;\n #cursor;\n #closing;\n #closed;\n /** @private */\n static open(client) {\n const streamId = client._streamIdAlloc.alloc();\n const stream = new WsStream(client, streamId);\n const responseCallback = () => undefined;\n const errorCallback = (e) => stream.#setClosed(e);\n const request = { type: \"open_stream\", streamId };\n client._sendRequest(request, { responseCallback, errorCallback });\n return stream;\n }\n /** @private */\n constructor(client, streamId) {\n super(client.intMode);\n this.#client = client;\n this.#streamId = streamId;\n this.#queue = new queue_js_1.Queue();\n this.#cursor = undefined;\n this.#closing = false;\n this.#closed = undefined;\n }\n /** Get the {@link WsClient} object that this stream belongs to. */\n client() {\n return this.#client;\n }\n /** @private */\n _sqlOwner() {\n return this.#client;\n }\n /** @private */\n _execute(stmt) {\n return this.#sendStreamRequest({\n type: \"execute\",\n streamId: this.#streamId,\n stmt,\n }).then((response) => {\n return response.result;\n });\n }\n /** @private */\n _batch(batch) {\n return this.#sendStreamRequest({\n type: \"batch\",\n streamId: this.#streamId,\n batch,\n }).then((response) => {\n return response.result;\n });\n }\n /** @private */\n _describe(protoSql) {\n this.#client._ensureVersion(2, \"describe()\");\n return this.#sendStreamRequest({\n type: \"describe\",\n streamId: this.#streamId,\n sql: protoSql.sql,\n sqlId: protoSql.sqlId,\n }).then((response) => {\n return response.result;\n });\n }\n /** @private */\n _sequence(protoSql) {\n this.#client._ensureVersion(2, \"sequence()\");\n return this.#sendStreamRequest({\n type: \"sequence\",\n streamId: this.#streamId,\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 streamId: this.#streamId,\n }).then((response) => {\n return response.isAutocommit;\n });\n }\n #sendStreamRequest(request) {\n return new Promise((responseCallback, errorCallback) => {\n this.#pushToQueue({ type: \"request\", request, responseCallback, errorCallback });\n });\n }\n /** @private */\n _openCursor(batch) {\n this.#client._ensureVersion(3, \"cursor\");\n return new Promise((cursorCallback, errorCallback) => {\n this.#pushToQueue({ type: \"cursor\", batch, cursorCallback, errorCallback });\n });\n }\n /** @private */\n _sendCursorRequest(cursor, request) {\n if (cursor !== this.#cursor) {\n throw new errors_js_1.InternalError(\"Cursor not associated with the stream attempted to execute a request\");\n }\n return new Promise((responseCallback, errorCallback) => {\n if (this.#closed !== undefined) {\n errorCallback(new errors_js_1.ClosedError(\"Stream is closed\", this.#closed));\n }\n else {\n this.#client._sendRequest(request, { responseCallback, errorCallback });\n }\n });\n }\n /** @private */\n _cursorClosed(cursor) {\n if (cursor !== this.#cursor) {\n throw new errors_js_1.InternalError(\"Cursor was closed, but it was not associated with the stream\");\n }\n this.#cursor = undefined;\n this.#flushQueue();\n }\n #pushToQueue(entry) {\n if (this.#closed !== undefined) {\n entry.errorCallback(new errors_js_1.ClosedError(\"Stream is closed\", this.#closed));\n }\n else if (this.#closing) {\n entry.errorCallback(new errors_js_1.ClosedError(\"Stream is closing\", undefined));\n }\n else {\n this.#queue.push(entry);\n this.#flushQueue();\n }\n }\n #flushQueue() {\n for (;;) {\n const entry = this.#queue.first();\n if (entry === undefined && this.#cursor === undefined && this.#closing) {\n this.#setClosed(new errors_js_1.ClientError(\"Stream was gracefully closed\"));\n break;\n }\n else if (entry?.type === \"request\" && this.#cursor === undefined) {\n const { request, responseCallback, errorCallback } = entry;\n this.#queue.shift();\n this.#client._sendRequest(request, { responseCallback, errorCallback });\n }\n else if (entry?.type === \"cursor\" && this.#cursor === undefined) {\n const { batch, cursorCallback } = entry;\n this.#queue.shift();\n const cursorId = this.#client._cursorIdAlloc.alloc();\n const cursor = new cursor_js_1.WsCursor(this.#client, this, cursorId);\n const request = {\n type: \"open_cursor\",\n streamId: this.#streamId,\n cursorId,\n batch,\n };\n const responseCallback = () => undefined;\n const errorCallback = (e) => cursor._setClosed(e);\n this.#client._sendRequest(request, { responseCallback, errorCallback });\n this.#cursor = cursor;\n cursorCallback(cursor);\n }\n else {\n break;\n }\n }\n }\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 for (;;) {\n const entry = this.#queue.shift();\n if (entry !== undefined) {\n entry.errorCallback(error);\n }\n else {\n break;\n }\n }\n const request = { type: \"close_stream\", streamId: this.#streamId };\n const responseCallback = () => this.#client._streamIdAlloc.free(this.#streamId);\n const errorCallback = () => undefined;\n this.#client._sendRequest(request, { responseCallback, errorCallback });\n }\n /** Immediately close the stream. */\n close() {\n this.#setClosed(new errors_js_1.ClientError(\"Stream was manually closed\"));\n }\n /** Gracefully close the stream. */\n closeGracefully() {\n this.#closing = true;\n this.#flushQueue();\n }\n /** True if the stream is closed or closing. */\n get closed() {\n return this.#closed !== undefined || this.#closing;\n }\n}\nexports.WsStream = WsStream;\n"],"mappings":"AAAA,YAAY;;AACZA,MAAM,CAACC,cAAc,CAACC,OAAO,EAAE,YAAY,EAAE;EAAEC,KAAK,EAAE;AAAK,CAAC,CAAC;AAC7DD,OAAO,CAACE,QAAQ,GAAG,KAAK,CAAC;AACzB,MAAMC,WAAW,GAAGC,OAAO,CAAC,cAAc,CAAC;AAC3C,MAAMC,UAAU,GAAGD,OAAO,CAAC,aAAa,CAAC;AACzC,MA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