the-forest/client/node_modules/.cache/babel-loader/fde96125137c22227fb553743cc92d25518b6b416ae968bdb3929ae5b2c263aa.json

1 line
4.2 KiB
JSON
Raw Normal View History

2024-09-17 20:35:18 -04:00
{"ast":null,"code":"import { ClientError, ClosedError, MisuseError } from \"./errors.js\";\n/** Text of an SQL statement cached on the server. */\nexport class 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 MisuseError(\"Attempted to use SQL text opened with other object\");\n } else if (this.#closed !== undefined) {\n throw new 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 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}\nexport function 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}","map":{"version":3,"names":["ClientError","ClosedError","MisuseError","Sql","owner","sqlId","closed","constructor","undefined","_getSqlId","close","_setClosed","error","_closeSql","sqlToProto","sql"],"sources":["/Users/shoofle/Projects/the-forest/node_modules/@libsql/hrana-client/lib-esm/sql.js"],"sourcesContent":["import { ClientError, ClosedError, MisuseError } from \"./errors.js\";\n/** Text of an SQL statement cached on the server. */\nexport class 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 MisuseError(\"Attempted to use SQL text opened with other object\");\n }\n else if (this.#closed !== undefined) {\n throw new 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 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}\nexport function sqlToProto(owner, sql) {\n if (sql instanceof Sql) {\n return { sqlId: sql._getSqlId(owner) };\n }\n else {\n return { sql: \"\" + sql };\n }\n}\n"],"mappings":"AAAA,SAASA,WAAW,EAAEC,WAAW,EAAEC,WAAW,QAAQ,aAAa;AACnE;AACA,OAAO,MAAMC,GAAG,CAAC;EACb,CAACC,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,CAAC,oDAAoD,CAAC;IAC/E,CAAC,MACI,IAAI,IAAI,CAAC,CAACI,MAAM,KAAKE,SAAS,EAAE;MACjC,MAAM,IAAIP,WAAW,CAAC,oBAAoB,EAAE,IAAI,CAAC,CAACK,MAAM,CAAC;IAC7D;IACA,OAAO,IAAI,CAAC,CAACD,KAAK;EACtB;EACA;EACAK,KAAKA,CAAA,EAAG;IACJ,IAAI,CAACC,UAAU,CAAC,IAAIX,WAAW,CAAC,8BAA8B,CAAC,CAAC;EACpE;EACA;EACAW,UAAUA,CAACC,KAAK,EAAE;IACd,IAAI,IAAI,CAAC,CAACN,MAAM,KAAKE,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