1 line
4.9 KiB
JSON
1 line
4.9 KiB
JSON
|
{"ast":null,"code":"import { Base64 } from \"js-base64\";\nexport const supportedUrlLink = \"https://github.com/libsql/libsql-client-ts#supported-urls\";\nexport function 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}\nexport class 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}\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 Base64.fromUint8Array(new Uint8Array(value));\n } else {\n return value;\n }\n}","map":{"version":3,"names":["Base64","supportedUrlLink","transactionModeToBegin","mode","RangeError","ResultSetImpl","columns","columnTypes","rows","rowsAffected","lastInsertRowid","constructor","toJSON","map","rowToJson","undefined","row","Array","prototype","call","valueToJson","value","ArrayBuffer","fromUint8Array","Uint8Array"],"sources":["/Users/shoofle/Projects/the-forest/node_modules/@libsql/core/lib-esm/util.js"],"sourcesContent":["import { Base64 } from \"js-base64\";\nexport const supportedUrlLink = \"https://github.com/libsql/libsql-client-ts#supported-urls\";\nexport function 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}\nexport class 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}\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 instanceof ArrayBuffer) {\n return Base64.fromUint8Array(new Uint8Array(value));\n }\n else {\n return value;\n }\n}\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,WAAW;AAClC,OAAO,MAAMC,gBAAgB,GAAG,2DAA2D;AAC3F,OAAO,SAASC,sBAAsBA,CAACC,IAAI,EAAE;EACzC,IAAIA,IAAI,KAAK,OAAO,EAAE;IAClB,OAAO,iBAAiB;EAC5B,CAAC,MACI,IAAIA,IAAI,KAAK,MAAM,EAAE;IACtB,OAAO,4BAA4B;EACvC,CAAC,MACI,IAAIA,IAAI,KAAK,UAAU,EAAE;IAC1B,OAAO,gBAAgB;EAC3B,CAAC,MACI;IACD,MAAMC,UAAU,CAAC,+EAA+E,CAAC;EACrG;AACJ;AACA,OAAO,MAAMC,aAAa,CAAC;EACvBC,OAAO;EACPC,WAAW;EACXC,IAAI;EACJC,YAAY;EACZC,eAAe;EACfC,WAAWA,CAACL,OAAO,EAAEC,WAAW
|