{"_id":"@c0va23/surrealdb","name":"@c0va23/surrealdb","dist-tags":{"latest":"1.3.9"},"versions":{"1.3.9":{"name":"@c0va23/surrealdb","version":"1.3.9","type":"module","license":"Apache-2.0","description":"The official SurrealDB SDK for JavaScript.","keywords":["surrealdb","surrealdb.js","javascript","typescript"],"repository":{"type":"git","url":"git+https://github.com/surrealdb/surrealdb.js.git"},"homepage":"https://github.com/surrealdb/surrealdb.js","publishConfig":{"access":"public"},"packageManager":"^bun@1.1.17","devDependencies":{"@biomejs/biome":"1.8.3","@types/bun":"latest","compare-versions":"^6.1.1","dts-bundle-generator":"^9.5.1","esbuild":"^0.21.5","esbuild-plugin-tsc":"^0.4.0","get-port":"^7.1.0"},"peerDependencies":{"typescript":"^5.0.0","tslib":"^2.6.3"},"dependencies":{"isows":"^1.0.6","uuidv7":"^1.0.1"},"scripts":{"ts":"tsc --watch --noEmit true --emitDeclarationOnly false","qc":"biome check .","qa":"biome check . --write","qau":"biome check . --write --unsafe","build":"bun run scripts/build.ts","jsr":"bun run scripts/jsr.ts"},"engines":{"node":">=18.0.0"},"browser":"./dist/index.bundled.mjs","types":"./dist/index.d.ts","main":"./dist/index.mjs","exports":{".":{"require":"./dist/index.cjs","import":"./dist/index.mjs","types":"./dist/index.d.ts","browser":"./dist/index.bundled.mjs"}},"_id":"@c0va23/surrealdb@1.3.9","gitHead":"a9baa6b4cb5d208b8cb61633d811fe425dd95564","bugs":{"url":"https://github.com/surrealdb/surrealdb.js/issues"},"_nodeVersion":"22.16.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-t3cWbbw9ainLN68uw+yoX5+wAyTPPDR9oRBqMO2cO/HTW/KJL0J9pYWa/jP6VPb/cEXecT4yrlKnXCOImVAiJw==","shasum":"de3bbd7b13b68af2b05790d371c3d67353be2025","tarball":"https://registry.npmjs.org/@c0va23/surrealdb/-/surrealdb-1.3.9.tgz","fileCount":11,"unpackedSize":862045,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCdj/uG8bLVjyyepAceN56iN0uFmLj8RkNFG0FmpaICcAIgKkzKe40odyMZMp2QEiT37hR1qvoasL6YLm7nSpcV8DY="}]},"_npmUser":{"name":"c0va23","email":"c0va23@gmail.com"},"directories":{},"maintainers":[{"name":"c0va23","email":"c0va23@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/surrealdb_1.3.9_1755366351944_0.030870911790468636"},"_hasShrinkwrap":false}},"time":{"created":"2025-08-16T17:45:51.775Z","1.3.9":"2025-08-16T17:45:52.220Z","modified":"2025-08-16T17:45:52.495Z"},"maintainers":[{"name":"c0va23","email":"c0va23@gmail.com"}],"description":"The official SurrealDB SDK for JavaScript.","homepage":"https://github.com/surrealdb/surrealdb.js","keywords":["surrealdb","surrealdb.js","javascript","typescript"],"repository":{"type":"git","url":"git+https://github.com/surrealdb/surrealdb.js.git"},"bugs":{"url":"https://github.com/surrealdb/surrealdb.js/issues"},"license":"Apache-2.0","readme":"<br>\n\n<p align=\"center\">\n    <img width=120 src=\"https://raw.githubusercontent.com/surrealdb/icons/main/surreal.svg\" />\n    &nbsp;\n    <img width=120 src=\"https://raw.githubusercontent.com/surrealdb/icons/main/javascript.svg\" />\n</p>\n\n<h3 align=\"center\">The official SurrealDB SDK for JavaScript.</h3>\n\n<br>\n\n<p align=\"center\">\n    <a href=\"https://github.com/surrealdb/surrealdb.js\"><img src=\"https://img.shields.io/badge/status-stable-ff00bb.svg?style=flat-square\"></a>\n    &nbsp;\n    <a href=\"https://surrealdb.com/docs/sdk/javascript\"><img src=\"https://img.shields.io/badge/docs-view-44cc11.svg?style=flat-square\"></a>\n    &nbsp;\n    <a href=\"https://www.npmjs.com/package/surrealdb\"><img src=\"https://img.shields.io/npm/v/surrealdb?style=flat-square\"></a>\n    &nbsp;\n    <a href=\"https://www.npmjs.com/package/surrealdb\"><img src=\"https://img.shields.io/npm/dm/surrealdb?style=flat-square\"></a>\n    &nbsp;\n    <a href=\"https://deno.land/x/surrealdb\"><img src=\"https://img.shields.io/npm/v/surrealdb?style=flat-square&label=deno\"></a>\n</p>\n\n<p align=\"center\">\n    <a href=\"https://surrealdb.com/discord\"><img src=\"https://img.shields.io/discord/902568124350599239?label=discord&style=flat-square&color=5a66f6\"></a>\n    &nbsp;\n    <a href=\"https://twitter.com/surrealdb\"><img src=\"https://img.shields.io/badge/twitter-follow_us-1d9bf0.svg?style=flat-square\"></a>\n    &nbsp;\n    <a href=\"https://www.linkedin.com/company/surrealdb/\"><img src=\"https://img.shields.io/badge/linkedin-connect_with_us-0a66c2.svg?style=flat-square\"></a>\n    &nbsp;\n    <a href=\"https://www.youtube.com/@SurrealDB\"><img src=\"https://img.shields.io/badge/youtube-subscribe-fc1c1c.svg?style=flat-square\"></a>\n</p>\n\n# surrealdb\n\nThe official SurrealDB SDK for JavaScript.\n\n## Documentation\n\nView the SDK documentation [here](https://surrealdb.com/docs/sdk/javascript).\n\n## Learn SurrealDB\n\n- SurrealDB University: https://surrealdb.com/learn/fundamentals\n- Aeon's Surreal Renaissance (Interative book): https://surrealdb.com/learn/book\n- Documentation: https://surrealdb.com/docs\n\n## How to install\n\n### Install for [JSR/Deno](https://jsr.io/@surrealdb/surrealdb)\n\nImport it with:\n\n```ts\nimport Surreal from \"@surrealdb/surrealdb\";\n```\n\n### Install for [Node.js](https://www.npmjs.com/package/surrealdb)\n\nInstall it with:\n\n```sh\n# using npm\nnpm i surrealdb\n# or using pnpm\npnpm i surrealdb\n# or using yarn\nyarn add surrealdb\n```\n\nNext, just import it with:\n\n```ts\nconst { Surreal } = require(\"surrealdb\");\n```\n\nor when you use modules:\n\n```ts\nimport Surreal from \"surrealdb\";\n```\n\n### Install for the browser\n\nFor usage in a browser environment, when using a bundler (e.g. [Rollup](https://rollupjs.org/), [Vite](https://vitejs.dev/), or [webpack](https://webpack.js.org/)) you can install it with:\n\n```sh\n# using npm\nnpm i surrealdb\n# or using pnpm\npnpm i surrealdb\n# or using yarn\nyarn add surrealdb\n```\n\nNext, just import it with:\n\n```ts\nimport Surreal from \"surrealdb\";\n```\n\nor when you use CommonJS:\n\n```ts\nconst { Surreal } = require(\"surrealdb\");\n```\n\n### Install for the browser with a CDN\n\nFor fast prototyping we provide a browser-ready bundle. You can import it with:\n\n```ts\nimport Surreal from \"https://unpkg.com/surrealdb\";\n// or\nimport Surreal from \"https://cdn.jsdelivr.net/npm/surrealdb\";\n```\n\n_**NOTE: this bundle is not optimized for production! So don't use it in production!**_\n\n## Getting started\n\nIn the example below you can see how to connect to a remote instance of SurrealDB, authenticating with the database, and issuing queries for creating, updating, and selecting data from records.\n\n> This example requires SurrealDB to be [installed](https://surrealdb.com/install) and running on port 8000.\n\n> This example makes use of [top level await](https://v8.dev/features/top-level-await), available in [modern browsers](https://caniuse.com/mdn-javascript_operators_await_top_level), [Deno](https://deno.com/) and [Node.js](https://nodejs.org/) >= 14.8.\n\n```ts\nimport { Surreal, RecordId, Table } from \"surrealdb\";\n\nconst db = new Surreal();\n\n// Connect to the database\nawait db.connect(\"http://127.0.0.1:8000/rpc\");\n\n// Select a specific namespace / database\nawait db.use({\n    namespace: \"test\",\n    database: \"test\"\n});\n\n// Signin as a namespace, database, or root user\nawait db.signin({\n    username: \"root\",\n    password: \"root\",\n});\n\n// Create a new person with a random id\nlet created = await db.create(\"person\", {\n    title: \"Founder & CEO\",\n    name: {\n        first: \"Tobie\",\n        last: \"Morgan Hitchcock\",\n    },\n    marketing: true,\n});\n\n// Update a person record with a specific id\nlet updated = await db.merge(new RecordId('person', 'jaime'), {\n    marketing: true,\n});\n\n// Select all people records\nlet people = await db.select(\"person\");\n\n// Perform a custom advanced query\nlet groups = await db.query(\n    \"SELECT marketing, count() FROM $tb GROUP BY marketing\",\n    {\n        tb: new Table(\"person\"),\n    },\n);\n```\n\n## Contributing\n\n### Local setup\n\nThis is a [Bun](https://bun.sh) project, not Node.js. It works across all major runtimes, however.\n\n#### Supported environments\n\n- [Deno](https://deno.land)\n- [Node.js](https://nodejs.org)\n- [Bun](https://bun.sh)\n- Web Browsers\n\n### Requirements\n\n- Bun\n- SurrealDB (for testing)\n\n### Build for all supported environments\n\nFor Deno, no build is needed. For all other environments run\n\n`bun run build`.\n\n### Code Quality Fixes\n\n`bun qa`\n\n### Code Quality unsafe fixes\n\n`bun qau`\n\n### Run tests for WS\n\n`bun test`\n\n### Run tests for HTTP\n\n`SURREAL_PROTOCOL=http bun test`\n\n### PRs\n\nBefore you commit, please format and lint your code accordingly to check for\nerrors, and ensure all tests still pass\n\n### Local setup\n\nFor local development the\n[Bun extension](https://marketplace.visualstudio.com/items?itemName=oven.bun-vscode) and [Biome extension](https://marketplace.visualstudio.com/items?itemName=biomejs.biome)\nfor VSCode are helpful.\n\n### Directory structure\n\n- `./biome.json` include settings for code quality.\n- `./scripts` include the build scripts for NPM and JSR.\n- `./src` includes all source code. `./src/index.ts` is the main entrypoint.\n- `./dist` is build by `./scripts/build.ts` and includes the compiled and minified bundles for ESM, CJS and bundled ESM targets.\n- `./tests` includes all test files.\n","readmeFilename":"README.md","_rev":"1-5434e6a005f55400bcfc48b1fb08450a"}