the-forest/client/node_modules/.cache/babel-loader/4719fa18202e034d41067fc046cc211aa7447122b3612ab97ac1ee23757a5783.json

1 line
5.8 KiB
JSON
Raw Normal View History

2024-09-17 20:35:18 -04:00
{"ast":null,"code":"\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.ResultSetImpl = exports.transactionModeToBegin = exports.supportedUrlLink = void 0;\nconst js_base64_1 = require(\"js-base64\");\nexports.supportedUrlLink = \"https://github.com/libsql/libsql-client-ts#supported-urls\";\nfunction transactionModeToBegin(mode) {\n if (mode === \"write\") {\n return \"BEGIN IMMEDIATE\";\n } else if (mode === \"read\") {\n return \"BEGIN TRANSACTION READONLY\";\n } else if (mode === \"deferred\") {\n return \"BEGIN DEFERRED\";\n } else {\n throw RangeError('Unknown transaction mode, supported values are \"write\", \"read\" and \"deferred\"');\n }\n}\nexports.transactionModeToBegin = transactionModeToBegin;\nclass ResultSetImpl {\n columns;\n columnTypes;\n rows;\n rowsAffected;\n lastInsertRowid;\n constructor(columns, columnTypes, rows, rowsAffected, lastInsertRowid) {\n this.columns = columns;\n this.columnTypes = columnTypes;\n this.rows = rows;\n this.rowsAffected = rowsAffected;\n this.lastInsertRowid = lastInsertRowid;\n }\n toJSON() {\n return {\n columns: this.columns,\n columnTypes: this.columnTypes,\n rows: this.rows.map(rowToJson),\n rowsAffected: this.rowsAffected,\n lastInsertRowid: this.lastInsertRowid !== undefined ? \"\" + this.lastInsertRowid : null\n };\n }\n}\nexports.ResultSetImpl = ResultSetImpl;\nfunction rowToJson(row) {\n return Array.prototype.map.call(row, valueToJson);\n}\nfunction valueToJson(value) {\n if (typeof value === \"bigint\") {\n return \"\" + value;\n } else if (value instanceof ArrayBuffer) {\n return js_base64_1.Base64.fromUint8Array(new Uint8Array(value));\n } else {\n return value;\n }\n}","map":{"version":3,"names":["Object","defineProperty","exports","value","ResultSetImpl","transactionModeToBegin","supportedUrlLink","js_base64_1","require","mode","RangeError","columns","columnTypes","rows","rowsAffected","lastInsertRowid","constructor","toJSON","map","rowToJson","undefined","row","Array","prototype","call","valueToJson","ArrayBuffer","Base64","fromUint8Array","Uint8Array"],"sources":["/Users/shoofle/Projects/the-forest/node_modules/@libsql/core/lib-cjs/util.js"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ResultSetImpl = exports.transactionModeToBegin = exports.supportedUrlLink = void 0;\nconst js_base64_1 = require(\"js-base64\");\nexports.supportedUrlLink = \"https://github.com/libsql/libsql-client-ts#supported-urls\";\nfunction transactionModeToBegin(mode) {\n if (mode === \"write\") {\n return \"BEGIN IMMEDIATE\";\n }\n else if (mode === \"read\") {\n return \"BEGIN TRANSACTION READONLY\";\n }\n else if (mode === \"deferred\") {\n return \"BEGIN DEFERRED\";\n }\n else {\n throw RangeError('Unknown transaction mode, supported values are \"write\", \"read\" and \"deferred\"');\n }\n}\nexports.transactionModeToBegin = transactionModeToBegin;\nclass ResultSetImpl {\n columns;\n columnTypes;\n rows;\n rowsAffected;\n lastInsertRowid;\n constructor(columns, columnTypes, rows, rowsAffected, lastInsertRowid) {\n this.columns = columns;\n this.columnTypes = columnTypes;\n this.rows = rows;\n this.rowsAffected = rowsAffected;\n this.lastInsertRowid = lastInsertRowid;\n }\n toJSON() {\n return {\n columns: this.columns,\n columnTypes: this.columnTypes,\n rows: this.rows.map(rowToJson),\n rowsAffected: this.rowsAffected,\n lastInsertRowid: this.lastInsertRowid !== undefined\n ? \"\" + this.lastInsertRowid\n : null,\n };\n }\n}\nexports.ResultSetImpl = ResultSetImpl;\nfunction rowToJson(row) {\n return Array.prototype.map.call(row, valueToJson);\n}\nfunction valueToJson(value) {\n if (typeof value === \"bigint\") {\n return \"\" + value;\n }\n else if (value inst