{"_id":"hrana-client","_rev":"3-10cd07f96ac5c7af835258f4ae3a29ee","name":"hrana-client","dist-tags":{"latest":"0.6.3"},"versions":{"0.6.0":{"name":"hrana-client","version":"0.6.0","keywords":["hrana","libsql","sqld","database"],"description":"Hrana client for connecting to sqld over HTTP or WebSocket","repository":{"type":"git","url":"git+https://github.com/libsql/hrana-client-ts.git"},"homepage":"https://github.com/libsql/hrana-client-ts","authors":["Jan Špaček <honza@chiselstrike.com>","LocalBox Crox (DaBigBlov) <libsql@hman.io>"],"license":"MIT","type":"module","main":"lib-cjs/index.js","types":"lib-esm/index.d.ts","exports":{".":{"types":"./lib-esm/index.d.ts","import":"./lib-esm/index.js","require":"./lib-cjs/index.js"}},"scripts":{"clean":"rm -rf ./lib-cjs ./lib-esm ./*.tsbuildinfo","prepublishOnly":"npm run clean-build","prebuild":"rm -rf ./lib-cjs ./lib-esm","build":"npm run build:cjs && npm run build:esm","build:cjs":"tsc -p tsconfig.build-cjs.json","build:esm":"tsc -p tsconfig.build-esm.json","postbuild":"cp package-cjs.json ./lib-cjs/package.json","clean-build":"npm run clean && npm run build","typecheck":"tsc --noEmit","test":"jest --runInBand","typedoc":"rm -rf ./docs && typedoc"},"dependencies":{"@libsql/isomorphic-ws":"^0.1.5","cross-fetch":"^4.0.0","js-base64":"^3.7.5"},"devDependencies":{"@types/jest":"^29","jest":"^29.6.2","ts-jest":"^29.1.1","typedoc":"^0.24.8","typescript":"^5.1.6"},"_id":"hrana-client@0.6.0","gitHead":"59d3fbe2a3d3fadd23e8e27bf1215f74bd5cee7f","bugs":{"url":"https://github.com/libsql/hrana-client-ts/issues"},"_nodeVersion":"21.7.1","_npmVersion":"10.5.0","dist":{"integrity":"sha512-It4QWqtGtLgWvHydLp20l/By1VR4D6GqsGxEa47wFd+toesWySTA2UH9RIlpBK8pQkXC9ezJKMyjypcqiLvBfQ==","shasum":"fe8230b27cd0ab711494cf78601a62f5e2a67d4d","tarball":"https://registry.npmjs.org/hrana-client/-/hrana-client-0.6.0.tgz","fileCount":136,"unpackedSize":305217,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBBzeOV1NeVjPh5nAwHLRJwEupNxx0K7RjByiXVEBcpBAiEA1lL1c3DJQu1+AXtIPuoETKcC8PkgqtdG/Rljg4x4yp4="}]},"_npmUser":{"name":"localbox","email":"localboxcrox@gmail.com"},"directories":{},"maintainers":[{"name":"localbox","email":"localboxcrox@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/hrana-client_0.6.0_1712040805833_0.06406019728820334"},"_hasShrinkwrap":false},"0.6.1":{"name":"hrana-client","version":"0.6.1","keywords":["hrana","libsql","sqld","database"],"description":"Hrana client for connecting to sqld over HTTP or WebSocket","repository":{"type":"git","url":"git+https://github.com/libsql/hrana-client-ts.git"},"homepage":"https://github.com/libsql/hrana-client-ts","authors":["Jan Špaček <honza@chiselstrike.com>","LocalBox Crox (DaBigBlov) <libsql@hman.io>"],"license":"MIT","type":"module","main":"lib-cjs/index.js","types":"lib-esm/index.d.ts","exports":{".":{"types":"./lib-esm/index.d.ts","import":"./lib-esm/index.js","require":"./lib-cjs/index.js"}},"scripts":{"clean":"rm -rf ./lib-cjs ./lib-esm ./*.tsbuildinfo","prepublishOnly":"npm run clean-build","prebuild":"rm -rf ./lib-cjs ./lib-esm","build":"npm run build:cjs && npm run build:esm","build:cjs":"tsc -p tsconfig.build-cjs.json","build:esm":"tsc -p tsconfig.build-esm.json","postbuild":"cp package-cjs.json ./lib-cjs/package.json","clean-build":"npm run clean && npm run build","typecheck":"tsc --noEmit","test":"jest --runInBand","typedoc":"rm -rf ./docs && typedoc"},"dependencies":{"@libsql/isomorphic-ws":"^0.1.5","cross-fetch":"^4.0.0","js-base64":"^3.7.5"},"devDependencies":{"@types/jest":"^29","jest":"^29.6.2","ts-jest":"^29.1.1","typedoc":"^0.24.8","typescript":"^5.1.6"},"_id":"hrana-client@0.6.1","gitHead":"51b006cb260a73699bce34caf2e9dc41104783df","bugs":{"url":"https://github.com/libsql/hrana-client-ts/issues"},"_nodeVersion":"21.7.1","_npmVersion":"10.5.0","dist":{"integrity":"sha512-DsEOHysCtirqbwRyv/nTqP7mp9tm1GaveiVz6XiyQsODWLw+hE8Z4PkOCsgoBfMCqJzWcJDSZN8DWcIQhzDeag==","shasum":"159e5d60a71728f301aa6bfd601e9df9cccc5027","tarball":"https://registry.npmjs.org/hrana-client/-/hrana-client-0.6.1.tgz","fileCount":136,"unpackedSize":305217,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCovcJtLwuirOl6TyEATAm18RAUWqZEVXS7OAn4w1+b8QIgLKZf/7oaQDb5JoCiT6gp+Xei6Y1TKD++SkWoKshMAmE="}]},"_npmUser":{"name":"localbox","email":"localboxcrox@gmail.com"},"directories":{},"maintainers":[{"name":"localbox","email":"localboxcrox@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/hrana-client_0.6.1_1712040859263_0.3465616014948787"},"_hasShrinkwrap":false},"0.6.2":{"name":"hrana-client","version":"0.6.2","keywords":["hrana","libsql","sqld","database"],"description":"Hrana client for connecting to sqld over HTTP or WebSocket","repository":{"type":"git","url":"git+https://github.com/DaBigBlob/hrana-client.git"},"homepage":"https://github.com/DaBigBlob/hrana-client","authors":["Jan Špaček <honza@chiselstrike.com>","LocalBox Crox (DaBigBlov) <libsql@hman.io>"],"license":"MIT","type":"module","main":"lib-cjs/index.js","types":"lib-esm/index.d.ts","exports":{".":{"types":"./lib-esm/index.d.ts","import":"./lib-esm/index.js","require":"./lib-cjs/index.js"}},"scripts":{"clean":"rm -rf ./lib-cjs ./lib-esm ./*.tsbuildinfo","prepublishOnly":"npm run clean-build","prebuild":"rm -rf ./lib-cjs ./lib-esm","build":"npm run build:cjs && npm run build:esm","build:cjs":"tsc -p tsconfig.build-cjs.json","build:esm":"tsc -p tsconfig.build-esm.json","postbuild":"cp package-cjs.json ./lib-cjs/package.json","clean-build":"npm run clean && npm run build","typecheck":"tsc --noEmit","test":"jest --runInBand","typedoc":"rm -rf ./docs && typedoc"},"dependencies":{"@libsql/isomorphic-ws":"^0.1.5","cross-fetch":"^4.0.0","js-base64":"^3.7.5"},"devDependencies":{"@types/jest":"^29","jest":"^29.6.2","ts-jest":"^29.1.1","typedoc":"^0.24.8","typescript":"^5.1.6"},"_id":"hrana-client@0.6.2","gitHead":"61cc42e6a5c86ff9efb12009d159a5d6ebc34121","bugs":{"url":"https://github.com/DaBigBlob/hrana-client/issues"},"_nodeVersion":"21.7.1","_npmVersion":"10.5.0","dist":{"integrity":"sha512-uL+ykzZiyzcsycUfCMJ83cINjz/COe7nRtOerEo7RSXjUPC4DSQfTkZwtMZG9Lf6/SFexEL8DwNF/zNQcED3Sw==","shasum":"f5b6950a6c7e7db09df8a5892bb35063c2eab2c2","tarball":"https://registry.npmjs.org/hrana-client/-/hrana-client-0.6.2.tgz","fileCount":136,"unpackedSize":305217,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBI2LdnBPoHfUXhAwRJEcXjTR3JQOMj5LsZgZo8xL4h4AiBYaKZl+kNX9w5d0YaF/tRehzi4wLutRoHYbJuppr+l4Q=="}]},"_npmUser":{"name":"localbox","email":"localboxcrox@gmail.com"},"directories":{},"maintainers":[{"name":"localbox","email":"localboxcrox@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/hrana-client_0.6.2_1712041118556_0.7851530556552853"},"_hasShrinkwrap":false},"0.6.3":{"name":"hrana-client","version":"0.6.3","keywords":["hrana","libsql","sqld","database"],"description":"Hrana client for connecting to sqld over HTTP or WebSocket","repository":{"type":"git","url":"git+https://github.com/DaBigBlob/hrana-client.git"},"homepage":"https://github.com/DaBigBlob/hrana-client","authors":["Jan Špaček <honza@chiselstrike.com>","LocalBox Crox (DaBigBlov) <libsql@hman.io>"],"license":"MIT","type":"module","main":"lib-cjs/index.js","types":"lib-esm/index.d.ts","exports":{".":{"types":"./lib-esm/index.d.ts","import":"./lib-esm/index.js","require":"./lib-cjs/index.js"}},"scripts":{"clean":"rm -rf ./lib-cjs ./lib-esm ./*.tsbuildinfo","prepublishOnly":"npm run clean-build","prebuild":"rm -rf ./lib-cjs ./lib-esm","build":"npm run build:cjs && npm run build:esm","build:cjs":"tsc -p tsconfig.build-cjs.json","build:esm":"tsc -p tsconfig.build-esm.json","postbuild":"cp package-cjs.json ./lib-cjs/package.json","clean-build":"npm run clean && npm run build","typecheck":"tsc --noEmit","test":"jest --runInBand","typedoc":"rm -rf ./docs && typedoc"},"dependencies":{"@libsql/isomorphic-ws":"^0.1.5","cross-fetch":"^4.0.0","js-base64":"^3.7.5"},"devDependencies":{"@types/jest":"^29","jest":"^29.6.2","ts-jest":"^29.1.1","typedoc":"^0.24.8","typescript":"^5.1.6"},"_id":"hrana-client@0.6.3","gitHead":"f26ed75575cb2b84e03edec1bd2c12d694b241b0","bugs":{"url":"https://github.com/DaBigBlob/hrana-client/issues"},"_nodeVersion":"21.7.1","_npmVersion":"10.5.0","dist":{"integrity":"sha512-peCQHTRow+pyOluYIPcObRQfd+rgRjwavynoCXY+JnsalCyspZRG+pW0FXee6dej8kOPJrf7xlZ/S468Q7VlUw==","shasum":"74368e65c6379fe041729cc3d21ad1ef04567633","tarball":"https://registry.npmjs.org/hrana-client/-/hrana-client-0.6.3.tgz","fileCount":136,"unpackedSize":305255,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEcnnvXosD4CxxWesgyvwxrU+zG0QcbN6uJv1q1fSQtQAiEAjonBqwu13T/KYnP+4gJmSNEosWkpGjfjjMWSaPo6cPc="}]},"_npmUser":{"name":"localbox","email":"localboxcrox@gmail.com"},"directories":{},"maintainers":[{"name":"localbox","email":"localboxcrox@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/hrana-client_0.6.3_1712048473205_0.14449585326634495"},"_hasShrinkwrap":false}},"time":{"created":"2024-04-02T06:53:25.832Z","0.6.0":"2024-04-02T06:53:25.975Z","modified":"2024-04-02T09:01:13.536Z","0.6.1":"2024-04-02T06:54:19.410Z","0.6.2":"2024-04-02T06:58:38.715Z","0.6.3":"2024-04-02T09:01:13.367Z"},"maintainers":[{"name":"localbox","email":"localboxcrox@gmail.com"}],"description":"Hrana client for connecting to sqld over HTTP or WebSocket","homepage":"https://github.com/DaBigBlob/hrana-client","keywords":["hrana","libsql","sqld","database"],"repository":{"type":"git","url":"git+https://github.com/DaBigBlob/hrana-client.git"},"bugs":{"url":"https://github.com/DaBigBlob/hrana-client/issues"},"license":"MIT","readme":"# Hrana client for TypeScript\n\n**[API docs][docs] | [Github][github] | [npm][npm]**\n\n[docs]: https://libsql.org/hrana-client-ts/\n[github]: https://github.com/DaBigBlob/hrana-client/\n[npm]: https://www.npmjs.com/package/hrana-client\n\nThis package implements a Hrana client for TypeScript. Hrana is the protocol for connecting to sqld using WebSocket or HTTP.\n\n> This package is intended mostly for internal use. Consider using the [`libsql-client`][libsql-client] package, which will use Hrana automatically.\n\n[libsql-client]: https://www.npmjs.com/package/libsql-client\n\n## Usage\n\n```typescript\nimport * as hrana from \"hrana-client\";\n\n// Open a `hrana.Client`, which works like a connection pool in standard SQL\n// databases. \nconst url = process.env.URL ?? \"ws://localhost:8080\"; // Address of the sqld server\nconst jwt = process.env.JWT; // JWT token for authentication\n// Here we are using Hrana over WebSocket:\nconst client = hrana.openWs(url, jwt);\n// But we can also use Hrana over HTTP:\n// const client = hrana.openHttp(url, jwt);\n\n// Open a `hrana.Stream`, which is an interactive SQL stream. This corresponds\n// to a \"connection\" from other SQL databases\nconst stream = client.openStream();\n\n// Fetch all rows returned by a SQL statement\nconst books = await stream.query(\"SELECT title, year FROM book WHERE author = 'Jane Austen'\");\n// The rows are returned in an Array...\nfor (const book of books.rows) {\n    // every returned row works as an array (`book[1]`) and as an object (`book.year`)\n    console.log(`${book.title} from ${book.year}`);\n}\n\n// Fetch a single row\nconst book = await stream.queryRow(\"SELECT title, MIN(year) FROM book\");\nif (book.row !== undefined) {\n    console.log(`The oldest book is ${book.row.title} from year ${book.row[1]}`);\n}\n\n// Fetch a single value, using a bound parameter\nconst year = await stream.queryValue([\"SELECT MAX(year) FROM book WHERE author = ?\", [\"Jane Austen\"]]);\nif (year.value !== undefined) {\n    console.log(`Last book from Jane Austen was published in ${year.value}`);\n}\n\n// Execute a statement that does not return any rows\nconst res = await stream.run([\"DELETE FROM book WHERE author = ?\", [\"J. K. Rowling\"]])\nconsole.log(`${res.affectedRowCount} books have been cancelled`);\n\n// When you are done, remember to close the client\nclient.close();\n```\n","readmeFilename":"README.md"}