1 line
4.8 KiB
JSON
1 line
4.8 KiB
JSON
{"ast":null,"code":"\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.sqlToProto = exports.Sql = void 0;\nconst errors_js_1 = require(\"./errors.js\");\n/** Text of an SQL statement cached on the server. */\nclass Sql {\n #owner;\n #sqlId;\n #closed;\n /** @private */\n constructor(owner, sqlId) {\n this.#owner = owner;\n this.#sqlId = sqlId;\n this.#closed = undefined;\n }\n /** @private */\n _getSqlId(owner) {\n if (this.#owner !== owner) {\n throw new errors_js_1.MisuseError(\"Attempted to use SQL text opened with other object\");\n } else if (this.#closed !== undefined) {\n throw new errors_js_1.ClosedError(\"SQL text is closed\", this.#closed);\n }\n return this.#sqlId;\n }\n /** Remove the SQL text from the server, releasing resouces. */\n close() {\n this._setClosed(new errors_js_1.ClientError(\"SQL text was manually closed\"));\n }\n /** @private */\n _setClosed(error) {\n if (this.#closed === undefined) {\n this.#closed = error;\n this.#owner._closeSql(this.#sqlId);\n }\n }\n /** True if the SQL text is closed (removed from the server). */\n get closed() {\n return this.#closed !== undefined;\n }\n}\nexports.Sql = Sql;\nfunction sqlToProto(owner, sql) {\n if (sql instanceof Sql) {\n return {\n sqlId: sql._getSqlId(owner)\n };\n } else {\n return {\n sql: \"\" + sql\n };\n }\n}\nexports.sqlToProto = sqlToProto;","map":{"version":3,"names":["Object","defineProperty","exports","value","sqlToProto","Sql","errors_js_1","require","owner","sqlId","closed","constructor","undefined","_getSqlId","MisuseError","ClosedError","close","_setClosed","ClientError","error","_closeSql","sql"],"sources":["/Users/shoofle/Projects/the-forest/node_modules/@libsql/hrana-client/lib-cjs/sql.js"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.sqlToProto = exports.Sql = void 0;\nconst errors_js_1 = require(\"./errors.js\");\n/** Text of an SQL statement cached on the server. */\nclass Sql {\n #owner;\n #sqlId;\n #closed;\n /** @private */\n constructor(owner, sqlId) {\n this.#owner = owner;\n this.#sqlId = sqlId;\n this.#closed = undefined;\n }\n /** @private */\n _getSqlId(owner) {\n if (this.#owner !== owner) {\n throw new errors_js_1.MisuseError(\"Attempted to use SQL text opened with other object\");\n }\n else if (this.#closed !== undefined) {\n throw new errors_js_1.ClosedError(\"SQL text is closed\", this.#closed);\n }\n return this.#sqlId;\n }\n /** Remove the SQL text from the server, releasing resouces. */\n close() {\n this._setClosed(new errors_js_1.ClientError(\"SQL text was manually closed\"));\n }\n /** @private */\n _setClosed(error) {\n if (this.#closed === undefined) {\n this.#closed = error;\n this.#owner._closeSql(this.#sqlId);\n }\n }\n /** True if the SQL text is closed (removed from the server). */\n get closed() {\n return this.#closed !== undefined;\n }\n}\nexports.Sql = Sql;\nfunction sqlToProto(owner, sql) {\n if (sql instanceof Sql) {\n return { sqlId: sql._getSqlId(owner) };\n }\n else {\n return { sql: \"\" + sql };\n }\n}\nexports.sqlToProto = sqlToProto;\n"],"mappings":"AAAA,YAAY;;AACZA,MAAM,CAACC,cAAc,CAACC,OAAO,EAAE,YAAY,EAAE;EAAEC,KAAK,EAAE;AAAK,CAAC,CAAC;AAC7DD,OAAO,CAACE,UAAU,GAAGF,OAAO,CAACG,GAAG,GAAG,KAAK,CAAC;AACzC,MAAMC,WAAW,GAAGC,OAAO,CAAC,aAAa,CAAC;AAC1C;AACA,MAAMF,GAAG,CAAC;EACN,CAACG,KAAK;EACN,CAACC,KAAK;EACN,CAACC,MAAM;EACP;EACAC,WAAWA,CAACH,KAAK,EAAEC,KAAK,EAAE;IACtB,IAAI,CAAC,CAACD,KAAK,GAAGA,KAAK;IACnB,IAAI,CAAC,CAACC,KAAK,GAAGA,KAAK;IACnB,IAAI,CAAC,CAACC,MAAM,GAAGE,SAAS;EAC5B;EACA;EACAC,SAASA,CAACL,KAAK,EAAE;IACb,IAAI,IAAI,CAAC,CAACA,KAAK,KAAKA,KAAK,EAAE;MACvB,MAAM,IAAIF,WAAW,CAACQ,WAAW,CAAC,oDAAoD,CAAC;IAC3F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