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,EAAEC,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