libsql-stateless-easy
Advanced tools
Comparing version 1.5.2 to 1.5.3
@@ -17,2 +17,3 @@ "use strict"; | ||
constructor(conf) { | ||
(0, functions_js_1.CheckHttpUrl)(conf.db_url); | ||
this.conf = conf; | ||
@@ -19,0 +20,0 @@ this.closed = false; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.libsqlExecuteMultiple = exports.libsqlBatchTransaction = exports.libsqlServerCompatCheck = exports.libsqlBatch = exports.libsqlExecute = void 0; | ||
exports.libsqlExecuteMultiple = exports.libsqlBatchTransaction = exports.libsqlServerCompatCheck = exports.libsqlBatch = exports.libsqlExecute = exports.CheckHttpUrl = void 0; | ||
const libsql_stateless_1 = require("libsql-stateless"); | ||
@@ -22,4 +22,4 @@ const builders_js_1 = require("./builders.js"); | ||
} | ||
exports.CheckHttpUrl = CheckHttpUrl; | ||
async function libsqlExecute(conf, stmt) { | ||
CheckHttpUrl(conf.db_url); | ||
const res = await (0, libsql_stateless_1.libsqlExecute)(conf, (0, builders_js_1.libsqlStatementBuilder)(stmt)); | ||
@@ -37,3 +37,2 @@ if (res.isOk) | ||
async function libsqlBatch(conf, steps, step_conditions) { | ||
CheckHttpUrl(conf.db_url); | ||
const res = await (0, libsql_stateless_1.libsqlBatch)(conf, (0, builders_js_1.libsqlBatchReqStepsBuilder)(steps, step_conditions)); | ||
@@ -51,3 +50,2 @@ if (res.isOk) | ||
async function libsqlServerCompatCheck(conf) { | ||
CheckHttpUrl(conf.db_url); | ||
const res = await (0, libsql_stateless_1.libsqlServerCompatCheck)(conf); | ||
@@ -58,3 +56,2 @@ return (res.isOk) ? true : false; | ||
async function libsqlBatchTransaction(conf, steps, mode = "deferred") { | ||
CheckHttpUrl(conf.db_url); | ||
const res = await (0, libsql_stateless_1.libsqlBatch)(conf, (0, builders_js_1.libsqlTransactionBatchReqStepsBuilder)(steps, mode)); | ||
@@ -72,3 +69,2 @@ if (res.isOk) | ||
async function libsqlExecuteMultiple(conf, sql) { | ||
CheckHttpUrl(conf.db_url); | ||
const sqlArr = sql.split(";").filter(s => s.trim() !== "").map((s, i) => { | ||
@@ -75,0 +71,0 @@ return { |
@@ -1,2 +0,2 @@ | ||
import { libsqlBatch, libsqlBatchTransaction, libsqlExecute, libsqlExecuteMultiple, libsqlServerCompatCheck } from "./functions.js"; | ||
import { CheckHttpUrl, libsqlBatch, libsqlBatchTransaction, libsqlExecute, libsqlExecuteMultiple, libsqlServerCompatCheck } from "./functions.js"; | ||
import { InternalError, LibsqlError } from "./errors.js"; | ||
@@ -14,2 +14,3 @@ class libsqlClient { | ||
constructor(conf) { | ||
CheckHttpUrl(conf.db_url); | ||
this.conf = conf; | ||
@@ -16,0 +17,0 @@ this.closed = false; |
import { libsqlBatchReqStepExecCond } from "libsql-stateless"; | ||
import { ResultSet, TransactionMode, rawSQLStatement, libsqlConfig } from "./types.js"; | ||
export declare function CheckHttpUrl(url: string): void; | ||
export declare function libsqlExecute(conf: libsqlConfig, stmt: rawSQLStatement): Promise<ResultSet>; | ||
@@ -4,0 +5,0 @@ export declare function libsqlBatch(conf: libsqlConfig, steps: Array<rawSQLStatement>, step_conditions: Array<libsqlBatchReqStepExecCond | null | undefined>): Promise<Array<ResultSet | null>>; |
@@ -5,3 +5,3 @@ import { libsqlExecute as LIBlibsqlExecute, libsqlBatch as LIBlibsqlBatch, libsqlServerCompatCheck as LIBlibsqlServerCompatCheck } from "libsql-stateless"; | ||
import { HttpServerError, LibsqlError, ResponseError } from "./errors.js"; | ||
function CheckHttpUrl(url) { | ||
export function CheckHttpUrl(url) { | ||
const _url = (() => { | ||
@@ -21,3 +21,2 @@ try { | ||
export async function libsqlExecute(conf, stmt) { | ||
CheckHttpUrl(conf.db_url); | ||
const res = await LIBlibsqlExecute(conf, libsqlStatementBuilder(stmt)); | ||
@@ -34,3 +33,2 @@ if (res.isOk) | ||
export async function libsqlBatch(conf, steps, step_conditions) { | ||
CheckHttpUrl(conf.db_url); | ||
const res = await LIBlibsqlBatch(conf, libsqlBatchReqStepsBuilder(steps, step_conditions)); | ||
@@ -47,3 +45,2 @@ if (res.isOk) | ||
export async function libsqlServerCompatCheck(conf) { | ||
CheckHttpUrl(conf.db_url); | ||
const res = await LIBlibsqlServerCompatCheck(conf); | ||
@@ -53,3 +50,2 @@ return (res.isOk) ? true : false; | ||
export async function libsqlBatchTransaction(conf, steps, mode = "deferred") { | ||
CheckHttpUrl(conf.db_url); | ||
const res = await LIBlibsqlBatch(conf, libsqlTransactionBatchReqStepsBuilder(steps, mode)); | ||
@@ -66,3 +62,2 @@ if (res.isOk) | ||
export async function libsqlExecuteMultiple(conf, sql) { | ||
CheckHttpUrl(conf.db_url); | ||
const sqlArr = sql.split(";").filter(s => s.trim() !== "").map((s, i) => { | ||
@@ -69,0 +64,0 @@ return { |
{ | ||
"name": "libsql-stateless-easy", | ||
"version": "1.5.2", | ||
"version": "1.5.3", | ||
"homepage": "https://github.com/DaBigBlob/libsql-stateless-easy#readme", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -6,6 +6,4 @@ # libsql-stateless-easy | ||
- ✅ **Is built for:** Quick stateless query execution. (Mainly for serverless and edge functions.) | ||
- ✅ Supports everything in `@libsql/client/web` **except (explicit) `transactions`. | ||
- ✅ Supports everything in `@libsql/client/web` **except `interactive transactions`. | ||
- ✅ **The API provided by `libsql-stateless-easy` is simple** and exactly the same as `@libsql/client/web`. | ||
- ⚠️ `libsql-stateless-easy` comes with the cost of (computational and memory) overheads potentially unneeded by you. But is still very very very slim compared to `@libsql/client/web`. | ||
<br> | ||
@@ -83,6 +81,4 @@ | ||
# This Documentation is incomplete | ||
I'll complete it when I have more time. | ||
### List of other stuff in this library | ||
Feel free to explore them (or even contribute to the documentation!) | ||
Feel free to explore them (however you dont need to as they've been neatly packaged into the `client`) | ||
```ts | ||
@@ -89,0 +85,0 @@ import { |
61374
1346
92