{"bugs":{"url":"https://github.com/kriasoft/node-sqlite/issues"},"dist":{"shasum":"52c81deab94901020430cafd692db56b06119154","tarball":"https://registry.npmjs.org/sqlite/-/sqlite-4.0.0-beta.2.tgz","fileCount":25,"integrity":"sha512-PjILQHw6nOZk5+bn2TaZW+17GfxYUOK3cLDLtaJNToO++yI1zAehRLakJvuYaiGa8zRe75PLxtXJ6Tgv2JLJRA==","signatures":[{"sig":"MEQCICaRDYjw97vYEh2+1m7N3ZR+pTtZQI1PS/fi96IYMPC7AiAOXEPV/J4FZzph0Pv4YRUATjy2JmBkTAH2oM1GizxOsg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":75411,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJed0yjCRA9TVsSAnZWagAAmYgP/A6Js+D40fuxXhWGyfly\nEEyYw5i7LJDn1uTiPygDwLjLvzFFncet/LhwjLlOccavmuldh3ybE97NoibE\nquCBT+foFBhKUSYMHmDijhBgU7DQmSRnF56aqp6LULYU7ePGOEgyGhSMDLHv\nq783SjZgS0lMzFDGXiXRLxaFKo14IFguLdQTqQhd+Qp/y9IVoEYcr7kK3z2k\nrFevsC18/oi4hqMzduZ9cBPcr4giUtOFjheldfQtJFqmHgdNqvJItzKTPM6F\nb//m9JnZfVKp7QKQY7zf+P+S9jOA4qSE8sp7PGgyYn5IzAvTqfs1ExZP6z7W\nJMt8r4Uo8ysMLKISG5zog2WtPjqPMPyOrSRfT8eyJwI+/5zEuYpytko/LAcL\nRsczZTzHHyIKg4xgKi+knVxPgQgfAKDFIit2858rf9XS2anZP/bEqr8GU13a\nNcGtWCSUpSj3waJOonpOFx/jmkwzB0VL3CZXP1i9fkih+CgXycg+ha8p7raO\nyhaF2pE4HAHTspdr6gqwQg3/EAb5fd6iokxJHgKcihiwu+aCtQni7tqwYx9N\npt16PmsBbufpS00l+deHYOPRGtQhm37j4z/4UPAYczhVdcx7Aw/+2HesBgqK\n0gYSKFoTCMR2eYcN+sA/XdZXFGUIPFxoRL/00iQI5LvxoD+tdBCIw83MQHlp\nncng\r\n=UYuL\r\n-----END PGP SIGNATURE-----\r\n"},"main":"build/index.js","name":"sqlite","types":"build/index.d.ts","author":{"url":"https://www.kriasoft.com","name":"Kriasoft","email":"hello@kriasoft.com"},"readme":"# SQLite Client for Node.js Apps\n\n[![NPM version](http://img.shields.io/npm/v/sqlite.svg?style=flat-square)](https://www.npmjs.com/package/sqlite)\n[![Build Status](http://img.shields.io/travis/kriasoft/node-sqlite/master.svg?style=flat-square)](https://travis-ci.org/kriasoft/node-sqlite)\n[![Online Chat](http://img.shields.io/badge/chat-%23node--sqlite_on_Gitter-blue.svg?style=flat-square)](https://gitter.im/kriasoft/node-sqlite)\n![built with typescript](https://camo.githubusercontent.com/92e9f7b1209bab9e3e9cd8cdf62f072a624da461/68747470733a2f2f666c61742e62616467656e2e6e65742f62616467652f4275696c74253230576974682f547970655363726970742f626c7565) \n[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)\n\n> A wrapper library that adds ES6 promises and SQL-based migrations API to\n> [sqlite3](https://github.com/mapbox/node-sqlite3/) ([docs](https://github.com/mapbox/node-sqlite3/wiki)).\n\n**note** v4 of `sqlite` has breaking changes compared to v3! Please see `CHANGELOG.md` for more details.\n\n<!-- TOC -->\n- [Installation](#installation)\n- [Usage](#usage)\n  - [Opening the database](#opening-the-database)\n    - [Without caching](#without-caching)\n    - [With caching](#with-caching)\n    - [With a custom driver](#with-a-custom-driver)\n    - [`open` config params](#open-config-params)\n  - [Examples](#examples)\n    - [Creating a table and inserting data](#creating-a-table-and-inserting-data)\n    - [Getting a single row](#getting-a-single-row)\n    - [Getting many rows](#getting-many-rows)\n    - [Inserting rows (part 2)](#inserting-rows-part-2)\n    - [Updating rows](#updating-rows)\n    - [Prepared statement](#prepared-statement)\n    - [Get the driver instance](#get-the-driver-instance)\n    - [Closing the database](#closing-the-database)\n  - [ES6 tagged template strings](#es6-tagged-template-strings)\n  - [Migrations](#migrations)\n  - [API Documentation](#api-documentation)\n- [References](#references)\n- [Support](#support)\n- [License](#license)\n\n<!-- TOC END -->\n\n## Installation\n\n```sh\n# v4 of sqlite is targted for nodejs 10 and on.\n$ npm install sqlite@4.0.0-beta.2 --save\n\n# If you need a legacy version for an older version of nodejs\n# install v3 instead, and look at the v3 branch readme for usage details\n$ npm install sqlite@3 --save\n```\n\n## Usage\n\nThis module has the same API as the original `sqlite3` library ([docs](https://github.com/mapbox/node-sqlite3/wiki/API)),\nexcept that all its API methods return ES6 Promises and do not accept callback arguments (with the exception of `each()`).\n\n### Opening the database\n\n#### Without caching\n\n```typescript\nimport { open } from 'sqlite'\n\n// this is a top-level await\n(async () => {\n    // open the database\n    const db = await open({\n      filename: '/tmp/database.db'\n    })\n})()\n```\nor\n\n```typescript\nimport { open } from 'sqlite'\n\nopen({\n  filename: '/tmp/database.db'\n}).then((db) => {\n  // do your thing\n})\n```\n\n#### With caching\n\nIf you want to enable the [database object cache](https://github.com/mapbox/node-sqlite3/wiki/Caching)\n\n```typescript\nimport { open } from 'sqlite'\n\n(async () => {\n    const db = await open({\n      filename: '/tmp/database.db',\n      cache: true\n    })\n})()\n```\n\n#### With a custom driver\n\nYou can use an alternative library to `sqlite3` as long as it conforms to the `sqlite3` [API](https://github.com/mapbox/node-sqlite3/wiki/API).\n\nFor example, using `sqlite3-offline`:\n\n```typescript\nimport { open } from 'sqlite'\n\n(async () => {\n    const db = await open({\n      filename: '/tmp/database.db',\n      cache: true\n    })\n})()\n```\n\n#### `open` config params\n\n```typescript\n\n// db is an instance of Sqlite3Database\n// which is a wrapper around `sqlite3#Database`\nconst db = await open({\n  /**\n   * Valid values are filenames, \":memory:\" for an anonymous in-memory\n   * database and an empty string for an anonymous disk-based database.\n   * Anonymous databases are not persisted and when closing the database\n   * handle, their contents are lost.\n   */\n  filename: string\n\n  /**\n   * One or more of sqlite3.OPEN_READONLY, sqlite3.OPEN_READWRITE and\n   * sqlite3.OPEN_CREATE. The default value is OPEN_READWRITE | OPEN_CREATE.\n   */\n  mode?: OpenDatabaseEnum\n\n  /**\n   * Use an alternative library instead of sqlite3. The interface of the library must\n   * conform to `sqlite3`.\n   *\n   * The default is to use `sqlite3` as the driver.\n   *\n   * @see https://github.com/mapbox/node-sqlite3/wiki/API\n   */\n  driver?: any\n\n  /**\n   * If true, uses the `sqlite3` built-in database object cache to avoid opening the same\n   * database multiple times.\n   *\n   * Does not apply if `driver` is defined.\n   *\n   * @see https://github.com/mapbox/node-sqlite3/wiki/Caching\n   */\n  cached?: boolean\n\n  /**\n   * Enables verbose mode.\n   *\n   * This only applies to the `sqlite3` driver.\n   */\n  verbose?: boolean\n})\n```\n\n### Examples\n\n- See the `src/**/__tests__` directory for more example usages\n- See the `docs/` directory for full documentation.\n- Also visit the `sqlite3` library [API docs](https://github.com/mapbox/node-sqlite3/wiki/API)\n\n#### Creating a table and inserting data\n\n```typescript\nawait db.exec('CREATE TABLE tbl (col TEXT)')\nawait db.exec('INSERT INTO tbl VALUES (\"test\")')\n```\n\n#### Getting a single row\n\n```typescript\nconst result = await db.get('SELECT col FROM tbl WHERE col = ?', 'test')\n\n// { col: 'test' }\n```\n\n```typescript\nconst result = await db.get('SELECT col FROM tbl WHERE col = ?', ['test'])\n\n// { col: 'test' }\n```\n\n```typescript\nconst result = await db.get('SELECT col FROM tbl WHERE col = :test', {\n  ':test': 'test'\n})\n\n// { col: 'test' }\n```\n\n#### Getting many rows\n\n```typescript\nconst result = await db.all('SELECT col FROM tbl')\n\n// [{ col: 'test' }]\n```\n\n#### Inserting rows (part 2)\n\n```typescript\nconst result = await db.run(\n  'INSERT INTO tbl (col) VALUES (?)',\n  'foo'\n)\n\n/*\n{\n  // row ID of the inserted row\n  lastId: 1,\n  // instance of Sqlite3Statement\n  // which is a wrapper around `sqlite3#Statement`\n  stmt: <Sqlite3Statement>\n}\n*/\n```\n\n```typescript\nconst result = await db.run('INSERT INTO tbl(col) VALUES (:col)', {\n  ':col': 'something'\n})\n```\n\n#### Updating rows\n\n```typescript\nconst result = await db.run(\n  'UPDATE tbl SET col = ? WHERE col = ?',\n  'foo',\n  'test'\n)\n\n/*\n{\n  // number of rows changed\n  changes: 1,\n  // instance of Sqlite3Statement\n  // which is a wrapper around `sqlite3#Statement`\n  stmt: <Sqlite3Statement>\n}\n*/\n```\n\n#### Prepared statement\n\n```typescript\n// stmt is an instance of Sqlite3Statement\n// which is a wrapper around `sqlite3#Statement`\nconst stmt = await db.prepare('SELECT col FROM tbl WHERE 1 = ? AND 5 = ?5')\nawait stmt.bind({ 1: 1, 5: 5 })\nlet result = await stmt.get()\n// { col: 'some text' }\n```\n\n```typescript\nconst stmt = await db.prepare(\n  'SELECT col FROM tbl WHERE 13 = @thirteen ORDER BY col DESC'\n)\n\nconst result = await stmt.all({ '@thirteen': 13 })\n```\n\n#### Get the driver instance\n\nUseful if you need to call methods that are not supported yet.\n\n```typescript\nconst rawDb = db.getDatabaseInstance()\nconst rawStatement = stmt.getStatementInstance()\n```\n\n#### Closing the database\n\n```typescript\nawait db.close()\n```\n\n### ES6 tagged template strings\n\nThis module is compatible with [sql-template-strings](https://www.npmjs.com/package/sql-template-strings).\n\n```js\nimport SQL from 'sql-template-strings'\n\nconst book = 'harry potter';\nconst author = 'J. K. Rowling';\n\nconst data = await db.all(SQL`SELECT author FROM books WHERE name = ${book} AND author = ${author}`);\n```\n\n### Migrations\n\nThis module comes with a lightweight migrations API that works with [SQL-based migration files](https://github.com/kriasoft/node-sqlite/tree/master/migrations)\n\nWith default configuration, you can create a `migrations/` directory in your project with SQL files,\nand call the `migrate()` method to run the SQL in the directory against the database.\n\nSee this project's `migrations/` folder for examples.\n\n```typescript\nawait db.migrate({    \n    /**\n    * If true, will force the migration API to rollback and re-apply the latest migration over\n    * again each time when Node.js app launches.\n    */\n    force?: boolean\n    /**\n    * Migrations table name. Default is 'migrations'\n    */\n    table?: string\n    /**\n    * Path to the migrations folder. Default is `path.join(process.cwd(), 'migrations')`\n    */\n    migrationsPath?: string\n})\n```\n\n### API Documentation\n\nSee the `docs` directory for full documentation.\n\n## References\n\n* [Using SQLite with Node.js for Rapid Prototyping](https://medium.com/@tarkus/node-js-and-sqlite-for-rapid-prototyping-bc9cf1f26f10) on Medium.com\n* [SQLite Documentation](https://www.sqlite.org/docs.html), e.g. [SQL Syntax](https://www.sqlite.org/lang.html), [Data Types](https://www.sqlite.org/datatype3.html) etc. on SQLite.org\n* ES6 tagged [sql-template-strings](https://www.npmjs.com/package/sql-template-strings).\n\n## Support\n\n* Join [#node-sqlite](https://gitter.im/kriasoft/node-sqlite) chat room on Gitter to stay up to date regarding the project\n* Join [#sqlite](https://webchat.freenode.net/?channels=sql,sqlite) IRC chat room on Freenode about general discussion about SQLite\n\n## License\n\nThe MIT License © 2020-present Kriasoft / Theo Gravity. All rights reserved.\n\n---\nMade with ♥ by [Konstantin Tarkus](https://github.com/koistya) ([@koistya](https://twitter.com/koistya)), [Theo Gravity](https://github.com/theogravity) and [contributors](https://github.com/kriasoft/node-sqlite/graphs/contributors)\n","gitHead":"4f9554dee1f46b12cdf4f40873efdb751377e85d","license":"MIT","scripts":{"toc":"toc-md README.md README.md","lint":"prettier-standard src/**/*.ts && standardx src/**/*.ts","test":"jest","build":"npm run build:clean && npm run compile","debug":"ts-node-dev --inspect -- src/index.ts","compile":"tsc","test:ci":"jest --ci --coverage","add-readme":"git add README.md","test:debug":"node --inspect-brk node_modules/.bin/jest","test:watch":"jest --watch","build:clean":"rm -rf build/*","debug:break":"ts-node-dev --inspect-brk -- src/index.ts","lint-staged":"lint-staged","ts-node-dev":"ts-node-dev","version-bump":"version-bump","changelog:help":"changelog-version","prepare-publish":"npm run changelog:verify && version-bump && npm run changelog:release","changelog:verify":"changelog-version verify","changelog:prepare":"changelog-version prepare","changelog:release":"changelog-version release","test:coverage:watch":"jest --coverage --watch"},"_npmUser":{"name":"theo.gravity","email":"theo@suteki.nu"},"homepage":"https://github.com/kriasoft/node-sqlite#readme","keywords":["sqlite","db","database","sql","migrate","migration","migrations","migrator","seed","seeds","seeder","node","node5","babel","es6","async","promise","promises","api"],"pre-commit":["toc","lint-staged","test:ci","build"],"repository":{"url":"git+https://github.com/kriasoft/node-sqlite.git","type":"git"},"_npmVersion":"6.13.4","description":"SQLite client for Node.js applications with SQL-based migrations API written in Typescript","directories":{},"lint-staged":{"src/**/*.ts":["prettier-standard","git add"]},"maintainers":[{"name":"koistya","email":"hello@tarkus.me"},{"name":"theo.gravity","email":"theo@suteki.nu"}],"_nodeVersion":"10.19.0","contributors":[{"url":"https://twitter.com/koistya","name":"Konstantin Tarkus","email":"hello@tarkus.me"},{"url":"https://theogravity.com","name":"Theo Gravity","email":"theo@suteki.nu"}],"dependencies":{"sqlite3":"^4.1.1"},"eslintConfig":{"rules":{"@typescript-eslint/no-unused-vars":[2,{"args":"none"}]},"parser":"@typescript-eslint/parser","plugins":["@typescript-eslint/eslint-plugin"],"parserOptions":{"sourceType":"module","ecmaVersion":6,"ecmaFeatures":{"modules":true}}},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jest":"25.1.0","eslint":"6.8.0","ts-jest":"25.2.1","ts-node":"8.7.0","jest-cli":"25.1.0","standardx":"^5.0.0","pre-commit":"1.2.2","toc-md-alt":"^0.3.2","typescript":"3.8.3","@types/jest":"25.1.4","@types/node":"^13.9.2","lint-staged":"10.0.8","ts-node-dev":"1.0.0-pre.44","@types/sqlite3":"^3.1.6","sqlite3-offline":"^4.2.0","prettier-standard":"16.2.1","jest-junit-reporter":"1.1.0","sql-template-strings":"^2.2.2","@typescript-eslint/parser":"^2.24.0","@theo.gravity/version-bump":"1.2.6","@theo.gravity/changelog-version":"2.1.10","@typescript-eslint/eslint-plugin":"^2.24.0"},"_npmOperationalInternal":{"tmp":"tmp/sqlite_4.0.0-beta.2_1584876707503_0.7521896776976609","host":"s3://npm-registry-packages"},"_id":"sqlite@4.0.0-beta.2","version":"4.0.0-beta.2"}