{"_id":"@bluebeela/workers-qb","_rev":"2-51faab6cf2a12785171201b54e771013","name":"@bluebeela/workers-qb","dist-tags":{"latest":"0.2.3"},"versions":{"0.2.0":{"name":"@bluebeela/workers-qb","version":"0.2.0","description":"Zero dependencies Query Builder for Cloudflare D1 Workers & Workers Analytic Engine","main":"dist/cjs/index.js","module":"dist/esm/index.js","umd:main":"dist/umd/index.js","types":"dist/types/index.d.js","scripts":{"_postinstall":"husky install","prepublishOnly":"pinst --disable","postpublish":"pinst --enable","build":"npm run build:cjs && npm run build:esm && npm run build:umd && npm run build:types","build:cjs":"node tools/cleanup cjs && tsc -p config/tsconfig.cjs.json","build:esm":"node tools/cleanup esm && tsc -p config/tsconfig.esm.json","build:umd":"node tools/cleanup umd && webpack --config config/webpack.config.js","build:types":"node tools/cleanup types && tsc -p config/tsconfig.types.json","clean":"node tools/cleanup","package":"npm run build && npm pack","test":"jest --no-cache --runInBand","test:cov":"jest --coverage --no-cache --runInBand","addscope":"node tools/packagejson name @g4brym/workers-qb"},"publishConfig":{"access":"public"},"keywords":["cloudflare","worker","workers","serverless","cloudflare d1","d1sql","sql builder","query builder","cloudflare sql","workers sql","cf","optional","middleware","query","parameters","typescript","npm","package","cjs","esm","umd","typed"],"author":{"name":"Gabriel Massadas"},"license":"MIT","homepage":"https://github.com/G4brym/workers-qb","repository":{"type":"git","url":"git+ssh://git@github.com/G4brym/workers-qb.git"},"bugs":{"url":"https://github.com/G4brym/workers-qb/issues"},"dependencies":{},"devDependencies":{"@commitlint/cli":"^13.1.0","@commitlint/config-conventional":"^13.1.0","@types/jest":"^27.0.1","@typescript-eslint/eslint-plugin":"^4.31.1","@typescript-eslint/parser":"^4.31.1","eslint":"^7.32.0","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^4.0.0","husky":"^7.0.2","jest":"^28.1.2","pinst":"^2.1.6","prettier":"^2.4.0","ts-jest":"^28.0.5","ts-loader":"^9.2.5","typescript":"^4.4.3","webpack":"^5.52.1","webpack-cli":"^4.8.0"},"gitHead":"f01dcd6c8dc94c3a441d7f4765a06ba822a251e4","_id":"@bluebeela/workers-qb@0.2.0","_nodeVersion":"14.20.0","_npmVersion":"6.14.17","dist":{"integrity":"sha512-Yxwv3zTtBWyDylryJ+5QAm5su1uruY2ab2J4AlRrAbQAEDch/U0ih6BJXEBrPK3ZSRYMGDlo90wfvPWB3XxJzg==","shasum":"65ae28fff065ddef2cc0aeefd93d2b96d66c3d70","tarball":"https://registry.npmjs.org/@bluebeela/workers-qb/-/workers-qb-0.2.0.tgz","fileCount":25,"unpackedSize":78192,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCVd23H1uqzMh2W3BTSShaLmDlYIXZO8yrIgGLtcLsxLgIhAPP3VDoRz1/C/B2Gf9WSokeYTALpVdlEQYDbgP7WcQnm"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjNxf8ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo9sQ//eJ++ryodIPz67bDl5Pw9/dZUshjtD4ddb90tKvs8phdmL/Ac\r\n3XlcbpTbA6rwZ4DwkNl7mVZiKeUVk6D2TwZfe4x5fMqz0KoeGJpxozvq/EUF\r\np9/nzvCHxW/Dzhd5CXUuP7l18PE4a+0IPw46jMkzTtr6peqjITgUcuF3909u\r\nAluk7xAkl1CQW3VofsWhbZE9Fa4K35ivURkMD7fFP9GvNhB/HALgrBnVVJbp\r\nJdtZKvOxh+3AUZpJOqmTH2VG+NGoWm+4s/eJxuv5A7FI3QaPS9IacGQekzH7\r\n3taQ+S+bxSpXTpW+/KrRdAP8OgvhqPUS6/IbaVb95PrMnCWc45DI9Mm8WKvH\r\ncnDDGiDIe9+mjQwFwqirqdj/heQujZiifVVjLJ57mOor8YritafBfyRZYNzU\r\nKpwrKyzDsdaRx3tX0E+SGvzW+kGLut3V8TiowkRjCPZ/Zayp544MX8X7Wpr2\r\nI4omSWt/+7lvV8b5FBV/rPMZeqL+bCjtkHKGnDnjdGTFTFDitlXaUP8i2Ak0\r\n+N/D0ICmVozIiRWoFc2yVyhhtl4dnVCD653HNuzX0qO7Er2KtMKLt42T8bgt\r\nZQxN0PkEuXupJB/yb383fiQRL9SlAM6Gynuzz1NxZiE/l+HlohWnoDBCjv4a\r\nP5PN9wOMo5CpXsF/Zt+A8NhueAf5Nkp4m6A=\r\n=E1rE\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"bluebeela","email":"sbluebeel@gmail.com"},"directories":{},"maintainers":[{"name":"bluebeela","email":"sbluebeel@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/workers-qb_0.2.0_1664555004461_0.8417747815585188"},"_hasShrinkwrap":false},"0.2.2":{"name":"@bluebeela/workers-qb","version":"0.2.2","description":"Zero dependencies Query Builder for Cloudflare D1 Workers & Workers Analytic Engine","main":"dist/cjs/index.js","module":"dist/esm/index.js","umd:main":"dist/umd/index.js","types":"dist/types/index.d.js","scripts":{"_postinstall":"husky install","prepublishOnly":"pinst --disable","postpublish":"pinst --enable","build":"npm run build:cjs && npm run build:esm && npm run build:umd && npm run build:types","build:cjs":"node tools/cleanup cjs && tsc -p config/tsconfig.cjs.json","build:esm":"node tools/cleanup esm && tsc -p config/tsconfig.esm.json","build:umd":"node tools/cleanup umd && webpack --config config/webpack.config.js","build:types":"node tools/cleanup types && tsc -p config/tsconfig.types.json","clean":"node tools/cleanup","package":"npm run build && npm pack","test":"jest --no-cache --runInBand","test:cov":"jest --coverage --no-cache --runInBand","addscope":"node tools/packagejson name @g4brym/workers-qb"},"publishConfig":{"access":"public"},"keywords":["cloudflare","worker","workers","serverless","cloudflare d1","d1sql","sql builder","query builder","cloudflare sql","workers sql","cf","optional","middleware","query","parameters","typescript","npm","package","cjs","esm","umd","typed"],"author":{"name":"Gabriel Massadas"},"license":"MIT","homepage":"https://github.com/G4brym/workers-qb","repository":{"type":"git","url":"git+ssh://git@github.com/G4brym/workers-qb.git"},"bugs":{"url":"https://github.com/G4brym/workers-qb/issues"},"dependencies":{},"devDependencies":{"@commitlint/cli":"^13.1.0","@commitlint/config-conventional":"^13.1.0","@types/jest":"^27.0.1","@typescript-eslint/eslint-plugin":"^4.31.1","@typescript-eslint/parser":"^4.31.1","eslint":"^7.32.0","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^4.0.0","husky":"^7.0.2","jest":"^28.1.2","pinst":"^2.1.6","prettier":"^2.4.0","ts-jest":"^28.0.5","ts-loader":"^9.2.5","typescript":"^4.4.3","webpack":"^5.52.1","webpack-cli":"^4.8.0"},"gitHead":"42e564d072ecd825b494482551ee5950d873a2cb","_id":"@bluebeela/workers-qb@0.2.2","_nodeVersion":"14.20.0","_npmVersion":"6.14.17","dist":{"integrity":"sha512-7eUXDznMhzP/A4YHaquLx1XUQqgqQAQ+wrZ4bl9kxrSxOeQ5xSSvu/iHeDgHZ3jN3iHz8HS7JMCmTpyiZWTuMA==","shasum":"185ba3c0ba02197eb6f5cfc735dc96602cf703ff","tarball":"https://registry.npmjs.org/@bluebeela/workers-qb/-/workers-qb-0.2.2.tgz","fileCount":25,"unpackedSize":85006,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD9qfCSQM+FlJq5RUWRMG0lrQGalfiRpOb3NOACZIeEuAIhAOeO16qRkaeJL7Iy9Ap1ohOKBFV/2zw6EJKkYLTrCSAo"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjNxk8ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrtuxAAhCAC3YmOlGCZPQgWGa82LuT6UHE6Jwga8zJR3dHbAVV+SpJ3\r\ntPbELMl75MXlN2GwF0NCtSZx8OcbhLhd7cCJqR+3xt3/BYdHPBZE1uTkbJNl\r\n9WBpUqyVdrR7eQ8BA0Iq5daB5he4nks2EaIa3KYDmwuzTZogjdLf5zCTE7wS\r\nzPZgC02J8OvgyWxNsukIaHt5GaY7fOE1cpIAFSALWLYFibXp4I3mMrrKQkm4\r\n64/kLR+YJHoV1ZWcM1LQg0I/m09j3tMwenGiEbGonTPxCq6eOLD3nsdXv/Bp\r\n1CKMk9XR2hBjB57DZUVPAWHd6ojQC9lJcwqkrciXHPt5axS9Nh/Wu+9AX+ep\r\nGnwSi090vGwf3lSQe+qgnJjSo3us0gDbZZ7x1MBM3HytW4zILMG0HXY71D2U\r\n4WZowUSaUYa+Hqy6/B+giIA7FT+PQTBdfMtbCLhZuDXy2bl86zV1EPjHNio6\r\nQgo2jPe4O8PhignkoMSaE5itXOlT7akCZp6AmK1p7qNYKqODltjmhTsMpl4S\r\nOl9mUh/hrCjf3xM7JukN1zUj7d5jBvQog5E4XgwVjdQQyw30AajvtE36vqJZ\r\nJDSsgd16w7owpxb13qAd19zm/glh1UqA+FF8/UH8vQxUKpSp1MNg1SLpWcQb\r\nXwUgS6ItJ1Pcs7coscJAmOYbyyGXUN/ufNg=\r\n=+pdX\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"bluebeela","email":"sbluebeel@gmail.com"},"directories":{},"maintainers":[{"name":"bluebeela","email":"sbluebeel@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/workers-qb_0.2.2_1664555324152_0.7734593134557783"},"_hasShrinkwrap":false},"0.2.3":{"name":"@bluebeela/workers-qb","version":"0.2.3","description":"Zero dependencies Query Builder for Cloudflare D1 Workers & Workers Analytic Engine","main":"dist/cjs/index.js","module":"dist/esm/index.js","umd:main":"dist/umd/index.js","types":"dist/types/index.d.js","scripts":{"_postinstall":"husky install","prepublishOnly":"pinst --disable","postpublish":"pinst --enable","build":"npm run build:cjs && npm run build:esm && npm run build:umd && npm run build:types","build:cjs":"node tools/cleanup cjs && tsc -p config/tsconfig.cjs.json","build:esm":"node tools/cleanup esm && tsc -p config/tsconfig.esm.json","build:umd":"node tools/cleanup umd && webpack --config config/webpack.config.js","build:types":"node tools/cleanup types && tsc -p config/tsconfig.types.json","clean":"node tools/cleanup","package":"npm run build && npm pack","test":"jest --no-cache --runInBand","test:cov":"jest --coverage --no-cache --runInBand","addscope":"node tools/packagejson name @bluebeela/workers-qb"},"publishConfig":{"access":"public"},"keywords":["cloudflare","worker","workers","serverless","cloudflare d1","d1sql","sql builder","query builder","cloudflare sql","workers sql","cf","optional","middleware","query","parameters","typescript","npm","package","cjs","esm","umd","typed"],"author":{"name":"Gabriel Massadas"},"license":"MIT","homepage":"https://github.com/G4brym/workers-qb","repository":{"type":"git","url":"git+ssh://git@github.com/G4brym/workers-qb.git"},"bugs":{"url":"https://github.com/G4brym/workers-qb/issues"},"dependencies":{},"devDependencies":{"@commitlint/cli":"^13.1.0","@commitlint/config-conventional":"^13.1.0","@types/jest":"^27.0.1","@typescript-eslint/eslint-plugin":"^4.31.1","@typescript-eslint/parser":"^4.31.1","eslint":"^7.32.0","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^4.0.0","husky":"^7.0.2","jest":"^28.1.2","pinst":"^2.1.6","prettier":"^2.4.0","ts-jest":"^28.0.5","ts-loader":"^9.2.5","typescript":"^4.4.3","webpack":"^5.52.1","webpack-cli":"^4.8.0"},"gitHead":"d47529136ecf6a84f1309ac19a6f448d49482441","_id":"@bluebeela/workers-qb@0.2.3","_nodeVersion":"14.20.0","_npmVersion":"6.14.17","dist":{"integrity":"sha512-i4I4MZiRrQBGFoWfXNnMys6o23GBLjwulB36487vZbTlfBsBX+7jLChNUuceDX1JKrFnNl5V5uZl8e78oydTwg==","shasum":"7c5e6fb3b58631c3c66dfe4ed784e42a13c858cf","tarball":"https://registry.npmjs.org/@bluebeela/workers-qb/-/workers-qb-0.2.3.tgz","fileCount":25,"unpackedSize":86651,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAm+aWqP9JTCgwoBq4jT+0OcZs9SEkJYwwK1PvQ3bHIUAiAKSDv5++uGunNMBQSt5mzmPaIDKTln82ggIRfodFNc7Q=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjNyA2ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpqRQ/9Hjjnvf2w5tDk3Ap7OEPmqNVDalwEEtcVJZVmxM4zhh4ncFxL\r\n9pP2fhcYoq9xPYKc338BHrLhWzKRU8ZQklnafDP/vjvFGZmZ1wKOyoibnhBY\r\nKdAOmqSYN+KXd+ij/uOBRr418MLMoPa53MfXhW0SWBe5u6/+Sb3BBFALRLrI\r\nwc1FO2u+1s02SeJYeF7Tq9Yt8g4AbkbDKUZrdK/XSP8/8f6e8/ErXoD0epxj\r\nyZzjla/TIYZjej/yVQwgtfq9UsG7Zd9cbxtINs9pvxaFIdbCCBoL1uw3PPVr\r\nP/Uz+Equ2F2uQfrdxvRTWocL3vZ/n3/jHRINaMVCm9ykn5p4gGxKUMOJxbUH\r\ncKsXTnB+RJvNU2iG1s7d17Bzwg9508MZ2tePzK3BiDK5s4yCF3wZneFSrLzL\r\nqZyKJwXH9a20rn64QnsxL4sngVudwR8QTdMcygKDBdy5il5t76qTgzM1axQw\r\nZ9eetvWCR7rtumEUaNMExaw+RHaENt4kcboO3huO7zXhj1PTOxJ96cC8pnSU\r\nG6bXHJ17auuGb6UTxhiskDyZ9gCuDxeElllIzpCVLZbpNUJcgXQx9Hdhk/Py\r\nWtZLdA3jJuZv7Fz2Zdh+ai7mWYJxx6G3THX/mEsVIQefy7NfwU2nT8XFr98f\r\nomz3+te9sAkEz8/C9lvN44bJke/uk9ngHB8=\r\n=o877\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"bluebeela","email":"sbluebeel@gmail.com"},"directories":{},"maintainers":[{"name":"bluebeela","email":"sbluebeel@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/workers-qb_0.2.3_1664557110333_0.524203691057374"},"_hasShrinkwrap":false}},"time":{"created":"2022-09-30T16:23:24.407Z","0.2.0":"2022-09-30T16:23:24.702Z","modified":"2022-09-30T16:58:30.631Z","0.2.2":"2022-09-30T16:28:44.361Z","0.2.3":"2022-09-30T16:58:30.551Z"},"maintainers":[{"name":"bluebeela","email":"sbluebeel@gmail.com"}],"description":"Zero dependencies Query Builder for Cloudflare D1 Workers & Workers Analytic Engine","homepage":"https://github.com/G4brym/workers-qb","keywords":["cloudflare","worker","workers","serverless","cloudflare d1","d1sql","sql builder","query builder","cloudflare sql","workers sql","cf","optional","middleware","query","parameters","typescript","npm","package","cjs","esm","umd","typed"],"repository":{"type":"git","url":"git+ssh://git@github.com/G4brym/workers-qb.git"},"author":{"name":"Gabriel Massadas"},"bugs":{"url":"https://github.com/G4brym/workers-qb/issues"},"license":"MIT","readme":"# workers-qb\n\nZero dependencies Query Builder for [Cloudflare D1](https://blog.cloudflare.com/introducing-d1/) \n[Workers](https://developers.cloudflare.com/workers/)\n\nThis module provides a simple standardized interface while keeping the\nbenefits and speed of using raw queries over a traditional ORM.\n\n`workers-qb` is not intended to provide ORM-like functionality, rather to make it easier to interact with the database from\ncode for direct SQL access using convenient wrapper methods.\n\nRead the documentation [Here](https://workers-qb.massadas.com/)!\n\n## Features\n- [x] Zero dependencies.\n- [x] Fully typed/TypeScript support\n- [x] SQL Type checking with compatible IDE's\n- [x] Insert/Update/Select/Delete queries\n- [x] Create/drop tables\n- [x] Keep where conditions simple in code\n- [ ] Bulk insert/update\n- [ ] Named parameters (waiting for full support in D1)\n\n## Installation\n\n```\nnpm install workers-qb\n```\n\n## Basic Usage\n```ts\nimport { D1QB } from 'workers-qb'\nconst qb = new D1QB(env.DB)\n\nconst fetched = await qb.fetchOne({\n    tableName: \"employees\",\n    fields: \"count(*) as count\",\n    where: {\n      conditions: \"active = ?1\",\n      params: [true]\n    },\n})\n\nconsole.log(`Company has ${fetched.results.count} active employees`)\n```\n\n#### Fetching a single record\n\n```ts\nconst qb = new D1QB(env.DB)\n\nconst fetched = await qb.fetchOne({\n    tableName: \"employees\",\n    fields: \"count(*) as count\",\n    where: {\n      conditions: \"department = ?1\",\n      params: [\"HQ\"]\n    },\n})\n\nconsole.log(`There are ${fetched.results.count} employees in the HR department`)\n```\n\n#### Fetching multiple records\n\n```ts\nimport { OrderTypes } from 'workers-qb'\nconst qb = new D1QB(env.DB)\n\nconst fetched = await qb.fetchAll({\n    tableName: \"employees\",\n    fields: [\n        \"role\",\n        \"count(*) as count\",\n    ],\n    where: {\n      conditions: \"department = ?1\",\n      params: [\"HR\"]\n    },\n    groupBy: \"role\",\n    orderBy: {\n      \"count\": OrderTypes.DESC,\n    },\n})\n\nconsole.log(`Roles in the HR department:`)\n\nfetched.results.forEach((employee) => {\n    console.log(`${employee.role} has ${employee.count} employees`)\n})\n```\n\n#### Inserting rows\n\n```ts\nconst qb = new D1QB(env.DB)\n\nconst inserted = await qb.insert({\n    tableName: \"employees\",\n    data: {\n        name: \"Joe\",\n        role: \"manager\",\n        department: \"store\",\n    },\n    returning: \"*\",\n})\n\nconsole.log(inserted)  // This will contain the data after SQL triggers and primary keys that are automated\n```\n\n#### Updating rows\n\n```ts\nconst updated = await qb.update({\n    tableName: \"employees\",\n    data: {\n      role: \"CEO\",\n      department: \"HQ\",\n    },\n    where: {\n      conditions: \"id = ?1\",\n      params: [123]\n    },\n})\n\nconsole.log(`Lines affected in this query: ${updated.changes}`)\n```\n\n#### Deleting rows\n\n```ts\nconst deleted = await qb.delete({\n    tableName: \"employees\",\n    where: {\n      conditions: \"id = ?1\",\n      params: [123]\n    },\n})\n\nconsole.log(`Lines affected in this query: ${deleted.changes}`)\n```\n\n#### Dropping and creating tables\n\n```ts\nconst created = await qb.createTable({\n    tableName: \"testTable\",\n    schema: `\n      id INTEGER PRIMARY KEY AUTOINCREMENT,\n      name TEXT NOT NULL\n    `,\n    ifNotExists: true,\n})\n\n\nconst dropped = await qb.dropTable({\n    tableName: \"testTable\"\n})\n```\n\n\n## Development\n\n### Set up tools and environment\n\nYou need to have [Node.js](https://nodejs.org/en/download/) installed. Node includes npm as its default package manager.\n\nOpen the whole package folder with a good code editor, preferably [Visual Studio Code](https://code.visualstudio.com/download). Consider installing VS Code extensions [ES Lint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode).\n\nIn the VS Code top menu: **Terminal** -> **New Terminal**\n\n### Install dependencies\n\nInstall dependencies with npm:\n\n```bash\nnpm i\n```\n\n### Write your code\n\nWrite your code in **src** folder, and unit test in **test** folder.\n\nThe VS Code shortcuts for formatting of a code file are: <kbd>Shift</kbd> + <kbd>Alt</kbd> + <kbd>F</kbd> (Windows); <kbd>Shift</kbd> + <kbd>Option (Alt)</kbd> + <kbd>F</kbd> (MacOS); <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>I</kbd> (Linux).\n\n### Test\n\nTest your code with Jest framework:\n\n```bash\nnpm run test\n```\n\n**Note:** This project uses [husky](https://typicode.github.io/husky/), [pinst](https://github.com/typicode/pinst) and [commitlint](https://commitlint.js.org/) to automatically execute test and [lint commit message](https://www.conventionalcommits.org/) before every commit.\n\n### Build\n\nBuild production (distribution) files in your **dist** folder:\n\n```bash\nnpm run build\n```\n\nIt generates CommonJS (in **dist/cjs** folder), ES Modules (in **dist/esm** folder), bundled and minified UMD (in **dist/umd** folder), as well as TypeScript declaration files (in **dist/types** folder).\n\n### Try it before publishing\n\nRun:\n\n```bash\nnpm link\n```\n\n[npm link](https://docs.npmjs.com/cli/v6/commands/npm-link) will create a symlink in the global folder, which may be **{prefix}/lib/node_modules/workers-qb** or **C:\\Users\\<username>\\AppData\\Roaming\\npm\\node_modules\\workers-qb**.\n\nCreate an empty folder elsewhere, you don't even need to `npm init` (to generate **package.json**). Open the folder with VS Code, open a terminal and just run:\n\n```bash\nnpm link workers-qb\n```\n\nThis will create a symbolic link from globally-installed workers-qb to **node_modules/** of the current folder.\n\nYou can then create a, for example, **testsql.ts** file with the content:\n\n```ts\nimport { D1QB } from 'workers-qb'\nconst qb = new D1QB(env.DB)\n\nconsole.log(\"Creating table...\")\nconst created = await qb.createTable({\n    tableName: \"testTable\",\n    schema: `\n      id INTEGER PRIMARY KEY AUTOINCREMENT,\n      name TEXT NOT NULL\n    `,\n    ifNotExists: true,\n})\nconsole.log(created)\n\nconsole.log(\"Inserting rows...\")\nconst inserted = await qb.insert({\n    tableName: \"testTable\",\n    data: {\n        name: \"my name\",\n    },\n    returning: \"*\",\n})\nconsole.log(inserted)\n\nconsole.log(\"Selecting rows...\")\nconst selected = await qb.fetchAll({\n    tableName: \"testTable\",\n    fields: \"*\"\n})\nconsole.log(selected)\n```\n\nIf you don't see any linting errors in VS Code, if you put your mouse cursor over `D1QB` and see its type, then it's all good.\n\nWhenever you want to uninstall the globally-installed workers-qb and remove the symlink in the global folder, run:\n\n```bash\nnpm uninstall workers-qb -g\n```\n","readmeFilename":"README.md"}