libsql-stateless
Advanced tools
Comparing version 2.8.6 to 2.9.0
@@ -11,3 +11,3 @@ type libsqlResult<T, E> = { | ||
authToken?: string; | ||
fetch?: typeof fetch; | ||
fetch?: libsqlFetchLike; | ||
}; | ||
@@ -22,2 +22,12 @@ type libsqlError = { | ||
}; | ||
type libsqlFetchLike = (input: string, init?: { | ||
body?: string; | ||
headers?: Record<string, string>; | ||
method?: 'POST' | 'GET'; | ||
}) => Promise<{ | ||
readonly ok: boolean; | ||
readonly status: number; | ||
json(): Promise<any>; | ||
text(): Promise<string>; | ||
}>; | ||
type libsqlPipelineReq = { | ||
@@ -155,2 +165,2 @@ baton: string | null; | ||
export { libsqlBatch, type libsqlBatchReqStep, type libsqlBatchReqStepExecCond, type libsqlBatchStreamReq, type libsqlBatchStreamResOk, type libsqlBatchStreamResOkData, type libsqlCloseStreamReq, type libsqlCloseStreamResOk, type libsqlConfig, type libsqlError, libsqlExecute, type libsqlExecuteStreamReq, type libsqlExecuteStreamResOk, type libsqlPipelineReq, type libsqlPipelineRes, type libsqlResult, type libsqlSQLColumnElm, type libsqlSQLStatement, type libsqlSQLValue, libsqlServerCompatCheck, type libsqlStatementResOkData, type libsqlStreamResErr, type libsqlStreamResErrData, type libsqlStreamResOk }; | ||
export { libsqlBatch, type libsqlBatchReqStep, type libsqlBatchReqStepExecCond, type libsqlBatchStreamReq, type libsqlBatchStreamResOk, type libsqlBatchStreamResOkData, type libsqlCloseStreamReq, type libsqlCloseStreamResOk, type libsqlConfig, type libsqlError, libsqlExecute, type libsqlExecuteStreamReq, type libsqlExecuteStreamResOk, type libsqlFetchLike, type libsqlPipelineReq, type libsqlPipelineRes, type libsqlResult, type libsqlSQLColumnElm, type libsqlSQLStatement, type libsqlSQLValue, libsqlServerCompatCheck, type libsqlStatementResOkData, type libsqlStreamResErr, type libsqlStreamResErrData, type libsqlStreamResOk }; |
@@ -1,3 +0,3 @@ | ||
async function r(e){let s=await(e.conf.fetch??globalThis.fetch)(`${e.conf.db_url}/v3/pipeline`,{method:"POST",headers:e.conf.authToken?{Authorization:"Bearer "+e.conf.authToken}:void 0,body:JSON.stringify(e.req_json)});return s.ok?{isOk:!0,val:await s.json()}:{isOk:!1,err:{kind:"LIBSQL_SERVER_ERROR",server_message:await(async()=>{try{return await s.text()}catch{return null}})(),http_status_code:s.status}}}async function i(e,s){let t=await r({conf:e,req_json:{baton:null,requests:[{type:"execute",stmt:s},{type:"close"}]}});if(t.isOk){let l=t.val.results[0];return l.type=="ok"?{isOk:!0,val:l.response.result}:{isOk:!1,err:{kind:"LIBSQL_RESPONSE_ERROR",data:l.error}}}else return t}async function a(e,s){let t=await r({conf:e,req_json:{baton:null,requests:[{type:"batch",batch:{steps:s}},{type:"close"}]}});if(t.isOk){let l=t.val.results[0];return l.type=="ok"?{isOk:!0,val:l.response.result}:{isOk:!1,err:{kind:"LIBSQL_RESPONSE_ERROR",data:l.error}}}else return t}async function n(e){return (await fetch(`${e.db_url}/v3`,{method:"GET"})).ok?{isOk:!0,val:null}:{isOk:!1,err:null}} | ||
async function r(e){let s=await(e.conf.fetch??globalThis.fetch)(`${e.conf.db_url}/v3/pipeline`,{method:"POST",headers:e.conf.authToken?{Authorization:"Bearer "+e.conf.authToken}:void 0,body:JSON.stringify(e.req_json)});return s.ok?{isOk:!0,val:await s.json()}:{isOk:!1,err:{kind:"LIBSQL_SERVER_ERROR",server_message:await(async()=>{try{return await s.text()}catch{return null}})(),http_status_code:s.status}}}async function i(e,s){let t=await r({conf:e,req_json:{baton:null,requests:[{type:"execute",stmt:s},{type:"close"}]}});if(t.isOk){let l=t.val.results[0];return l.type=="ok"?{isOk:!0,val:l.response.result}:{isOk:!1,err:{kind:"LIBSQL_RESPONSE_ERROR",data:l.error}}}else return t}async function a(e,s){let t=await r({conf:e,req_json:{baton:null,requests:[{type:"batch",batch:{steps:s}},{type:"close"}]}});if(t.isOk){let l=t.val.results[0];return l.type=="ok"?{isOk:!0,val:l.response.result}:{isOk:!1,err:{kind:"LIBSQL_RESPONSE_ERROR",data:l.error}}}else return t}async function n(e){return (await(e.fetch??globalThis.fetch)(`${e.db_url}/v3`,{method:"GET"})).ok?{isOk:!0,val:null}:{isOk:!1,err:null}} | ||
export { a as libsqlBatch, i as libsqlExecute, n as libsqlServerCompatCheck }; |
{ | ||
"name": "libsql-stateless", | ||
"version": "2.8.6", | ||
"version": "2.9.0", | ||
"description": "thin libSQL stateless http driver for TypeScript and JavaScript", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/DaBigBlob/libsql-stateless#readme", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
12456
178
0