{"_id":"@acdibble/tuql","_rev":"1-2f6a928dc8b73b7d5fccfd56f58aa52a","name":"@acdibble/tuql","dist-tags":{"latest":"2.0.1"},"versions":{"2.0.0":{"name":"@acdibble/tuql","version":"2.0.0","description":"_Pronounced: Too cool_","main":"dist/index.js","bin":{"tuql":"dist/bin/index.js"},"scripts":{"start":"babel-node src/index.js","build":"babel src --out-dir dist","prepublish":"npm run build","test":"jest","test:watch":"jest --watch"},"author":{"name":"Brad Daily","email":"brad.daily@gmail.com"},"license":"MIT","keywords":["graphql","sqlite"],"dependencies":{"command-line-args":"^5.2.1","command-line-usage":"^6.1.3","cors":"^2.8.5","express":"^4.18.2","express-graphql":"^0.12.0","graphql":"^16.6.0","graphql-relay":"^0.10.0","graphql-sequelize":"^9.4.3","pluralize":"^8.0.0","sequelize":"^6.25.0","sqlite3":"^5.1.2"},"devDependencies":{"@babel/cli":"^7.19.3","@babel/core":"^7.19.3","@babel/preset-env":"^7.19.4","babel-jest":"^29.1.2","jest":"^29.1.2","prettier":"^2.7.1"},"jest":{"collectCoverage":true,"collectCoverageFrom":["src/**/*.js","!src/__tests__/*"],"testPathIgnorePatterns":["/node_modules/","/dist/"]},"gitHead":"4c00a3795288f52a49413d61bec2b209ffe7c4b4","_id":"@acdibble/tuql@2.0.0","_nodeVersion":"16.17.0","_npmVersion":"8.15.0","dist":{"integrity":"sha512-dqk69oqbcJkliZQwpaE+YN93ss5JozKySFZd+ZP7uZG38q04T4011nZvQJ2nf7b3zgEbevu4T2IaM6zR6BnyDw==","shasum":"f191f5823c2d5eebddda374cd6491ca5bc9b7346","tarball":"https://registry.npmjs.org/@acdibble/tuql/-/tuql-2.0.0.tgz","fileCount":12,"unpackedSize":25947,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHiKvD6+x8VCJRviW893dp5HWHgWUFOotA4CUlQelUIMAiEA0Mi0A0aT6Pj0UR0t/fFCAb69McaFnP97M7VEVS4Uf0M="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjRorIACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpbYQ//X8Fu0m0tu2dTTbk829UNMDzBOiYKu7YPWYeS9c8Y6eFQfeIE\r\nbYaEikcB9PavPi5RNISGzd1EC6O54efSkKcA2dsJ0theH/008UQvDq6k2NNL\r\njmzT5BbrK3loFwCHSOANf+DrXNZoMdVNkf1yTSlgPZF4JUXP+/tVqFN6qUVh\r\n+iKXRLSvsDmQTR1KI/Rq5E+GV+AmtUDEIHRLxjtgF4qSNzqFs9ZN+zVglYEl\r\ngi1xRV6kzPCI15B4io1y1uUOJQ0OPO1wlNortxRPDqB2xu8U/ilsx01Xliv7\r\nbv2jE79bSwaDLJZlo+H25+ZmnHlSZEGH5bYQOAn6PwvTJabGm6xW6DID7nD5\r\njpnMQ767K1BttwodzLb6HBjLzwN7w1HawvxEzj/M0cC7FDfCgbAqdfv4p5un\r\n/AnN7tKSdUW55S8ayhJFRSbTp/Ei7CRhIQidbtQryH5K0iOnplBw8OWIP8nw\r\nTbxfo2H2/0mqhjULTJI3HKZB8HB2TxLP21nndmHUTRkRPNcGSNltVmTQ9Nx1\r\n8iNke9uUpCkvsQ8J/XM49i8IF3PIGOMtqjSwu1Bcq5Eld69sVRXBwBwUI2mQ\r\nNwiLxnY2ob7VIz5VDyJexRVdzu9usdVzOz5ZNUMUnIW73/D0wVRVdYazkbEO\r\nkh4yJ+y9Act6+ew/qMV7Ktcs0ENA0mj3rrM=\r\n=38Qx\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"acdibble","email":"acdibble@gmail.com"},"directories":{},"maintainers":[{"name":"acdibble","email":"acdibble@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/tuql_2.0.0_1665567432135_0.08382702748720572"},"_hasShrinkwrap":false},"2.0.1":{"name":"@acdibble/tuql","version":"2.0.1","description":"_Pronounced: Too cool_","main":"dist/index.js","bin":{"tuql":"dist/bin/index.js"},"scripts":{"start":"babel-node src/index.js","build":"babel src --out-dir dist","prepublish":"npm run build","test":"jest","test:watch":"jest --watch"},"author":{"name":"Brad Daily","email":"brad.daily@gmail.com"},"license":"MIT","keywords":["graphql","sqlite"],"dependencies":{"command-line-args":"^5.2.1","command-line-usage":"^6.1.3","cors":"^2.8.5","express":"^4.18.2","express-graphql":"^0.12.0","graphql":"^16.6.0","graphql-relay":"^0.10.0","graphql-sequelize":"^9.4.3","pluralize":"^8.0.0","sequelize":"^6.25.0","sqlite3":"^5.1.2"},"devDependencies":{"@babel/cli":"^7.19.3","@babel/core":"^7.19.3","@babel/preset-env":"^7.19.4","babel-jest":"^29.1.2","jest":"^29.1.2","prettier":"^2.7.1"},"jest":{"collectCoverage":true,"collectCoverageFrom":["src/**/*.js","!src/__tests__/*"],"testPathIgnorePatterns":["/node_modules/","/dist/"]},"gitHead":"c35100d30080869e0a709c8ebffab4e4aee7f899","_id":"@acdibble/tuql@2.0.1","_nodeVersion":"16.17.0","_npmVersion":"8.15.0","dist":{"integrity":"sha512-eUUnEvmpMyOzKGygBY7N1rMBzPEELPo8waBSmOyKI8BfI87c9QM4hxdH+lKFNIu0GOY95vYP2W2mgPkpmHH5NQ==","shasum":"4a725dedfe915972ef74ffc4ab361b02b92f1cff","tarball":"https://registry.npmjs.org/@acdibble/tuql/-/tuql-2.0.1.tgz","fileCount":12,"unpackedSize":25947,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC3WAVEGeE0UrGK/s+yifE3KMSTofokC/iRB74zs+A0agIgII0Caq5lbkt3uuPdCLsNJo3RpiYJA6inHBHTpC8k5ZI="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjRouqACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoSyA//U99NTlZexmEi1LrivhcJV8pidb7R5ERrlz5LgIli8Uod5FNm\r\nn231n7FmfceOslHjkH6BLHNTa9RDiR2qSd4pTcQqI3i57dK4Vj4RtZ2pw8wg\r\nrJ/P3GdYZW5DcgA2x5JtoAV4UeSOkqlhXwHngia2BrF6hD+4ITSkaU+N8Juu\r\noYdo7N21pdbh5kkxHzafcWjsXE6lEMnLYOGiIJhoZX6lwC4aMZOOUIZ3Vyv5\r\n6FiDIY0Ke8vAD0aBm2Gkr54muVLLVICXgW/0xle8w3AOljlkU5vLV0D5FK79\r\nlVdUyf33I5UPdDnEaBXz5y1Ay3ccyaWmOrBiomMbzugtxS7Fw025XRXr83+3\r\nuLlVlg4Gfnk5LJDKTKyyoSkysYAy3FDstI9nt2OYiXx9OjNQiz8cN8c9e5oE\r\n7aFVw9hHDjynqjTbrmikm2n/ASDQ9/ICEgSLXOEr5YuZMcWzg5XX+HenPWxM\r\nJqFGsdAiMil15diPtGsWrGjn6TXwYOmDMrexwHpcwEvH0BRsSIigTctOkbM3\r\n5fqH2XhKziDlKKkrQWtglu+sWAd1GvJn40IiZzqpv/+aV4DQ2XRAdC74ZppC\r\nyzaR+Krjjipo1BT4oH8DmoyPiwseBma8g0aVA/k9TKA20ousTrbNXUJnfbWd\r\naW/77ijwPHvjZFysudE8IP8uJhxlCX/5dyE=\r\n=/fHy\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"acdibble","email":"acdibble@gmail.com"},"directories":{},"maintainers":[{"name":"acdibble","email":"acdibble@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/tuql_2.0.1_1665567658411_0.47276985565265006"},"_hasShrinkwrap":false}},"time":{"created":"2022-10-12T09:37:12.059Z","2.0.0":"2022-10-12T09:37:12.359Z","modified":"2022-10-12T09:40:58.676Z","2.0.1":"2022-10-12T09:40:58.585Z"},"maintainers":[{"name":"acdibble","email":"acdibble@gmail.com"}],"description":"_Pronounced: Too cool_","keywords":["graphql","sqlite"],"author":{"name":"Brad Daily","email":"brad.daily@gmail.com"},"license":"MIT","readme":"# tuql ![build status](https://github.com/bradleyboy/tuql/actions/workflows/nodejs.yml/badge.svg) [![Coverage Status](https://coveralls.io/repos/github/bradleyboy/tuql/badge.svg?branch=master)](https://coveralls.io/github/bradleyboy/tuql?branch=master)\n\n_Pronounced: Too cool_\n\n**tuql** is a simple tool that turns a sanely formatted sqlite database into a graphql endpoint. It tries to infer relationships between objects, currently supporting `belongsTo`, `hasMany` and `belongsToMany`. It also forms the basic mutations necessary to create, update, and delete objects, as well as assoicate many-to-many relationships.\n\n## Installing\n\n`npm install -g tuql`\n\n## Using\n\n`tuql --db path/to/database.sqlite`\n\nYou can also optionally set the port and enable graphiql:\n\n`tuql --db path/to/database.sqlite --port 8888 --graphiql`\n\nOr, you can use a sql file with statements to build up an in-memory database:\n\n`tuql --infile path/to/db_dump.sql --graphiql`\n\nIf you'd like to print out the schema itself, use:\n\n`tuql --db path/to/database.sqlite --schema`\n\nOr send it to a file:\n\n`tuql --db path/to/database.sqlite --schema > schema.graphql`\n\n## How it works\n\nImagine your sqlite schema looked something like this:\n\n| posts | users | categories | category_post |\n| :-: | :-: | :-: | :-: |\n| id      | id | id | category_id |\n| user_id | username | title | post_id |\n| title   | | |\n| body    | | |\n\n**tuql** will automatically define models and associations, so that graphql queries like this will work right out of the box:\n\n```graphql\n{\n  posts {\n    title\n    body\n    user {\n      username\n    }\n    categories {\n      title\n    }\n  }\n}\n```\n\n**tuql** works one of two ways. It prefers to map your schema based on the foreign key information in your tables. If foreign keys are not present, **tuql** assumes the following about your schema in order to map relationships:\n\n1. The primary key column is named `id` or `thing_id` or `thingId`, where `thing` is the singular form of the table name. Example: For a table named **posts**, the primary key column should be named `id`, `post_id` or `postId`.\n2. Similarly, foreign key columns should be `thing_id` or `thingId`, where `thing` is the singular form of the associated table.\n3. For many-to-many associations, the table name should be in the form of `foo_bar` or `bar_foo` (ordering is not important). The columns should follow the same pattern as #2 above.\n","readmeFilename":"Readme.md"}