From fb970a593de2bacdce2ef3bafe20fa365baf587e Mon Sep 17 00:00:00 2001 From: Gabriel Massadas Date: Wed, 28 Feb 2024 23:15:07 +0000 Subject: [PATCH] Add type hints --- .eslintrc.js | 11 - .prettierrc.js | 7 - LICENSE | 2 +- README.md | 17 +- commitlint.config.js => commitlint.config.cjs | 0 ...fileTransformer.js => fileTransformer.cjs} | 0 .../{preparePublish.js => preparePublish.cjs} | 0 jest.config.js => jest.config.cjs | 2 +- package-lock.json | 1095 +---------------- package.json | 39 +- rollup.config.mjs | 14 +- src/Builder.ts | 63 +- src/databases/d1.ts | 8 +- src/databases/pg.ts | 6 +- src/{workers-qb.ts => index.ts} | 0 src/interfaces.ts | 61 +- src/tools.ts | 10 +- src/typefest.ts | 24 + tests/builder/batch.test.ts | 7 +- tests/builder/delete.test.ts | 10 +- tests/builder/insert.test.ts | 32 +- tests/builder/select.test.ts | 36 +- tests/builder/update.test.ts | 22 +- tests/utils.ts | 10 +- tools/{packagejson.js => packagejson.cjs} | 0 tsconfig.json | 2 +- 26 files changed, 284 insertions(+), 1194 deletions(-) delete mode 100644 .eslintrc.js delete mode 100644 .prettierrc.js rename commitlint.config.js => commitlint.config.cjs (100%) rename config/{fileTransformer.js => fileTransformer.cjs} (100%) rename config/{preparePublish.js => preparePublish.cjs} (100%) rename jest.config.js => jest.config.cjs (90%) rename src/{workers-qb.ts => index.ts} (100%) create mode 100644 src/typefest.ts rename tools/{packagejson.js => packagejson.cjs} (100%) diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index f3b4ca1..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1,11 +0,0 @@ -module.exports = { - parser: '@typescript-eslint/parser', - extends: ['plugin:@typescript-eslint/recommended', 'prettier'], - parserOptions: { - sourceType: 'module', - }, - rules: { - 'prettier/prettier': 'error', - }, - plugins: ['@typescript-eslint', 'prettier'], -} diff --git a/.prettierrc.js b/.prettierrc.js deleted file mode 100644 index 5741c94..0000000 --- a/.prettierrc.js +++ /dev/null @@ -1,7 +0,0 @@ -module.exports = { - semi: false, - singleQuote: true, - trailingComma: 'es5', - arrowParens: 'always', - printWidth: 120, -} diff --git a/LICENSE b/LICENSE index fb699ee..c84b618 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2022 Gabriel Massadas +Copyright (c) 2024 Gabriel Massadas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 715bd87..c3fef12 100644 --- a/README.md +++ b/README.md @@ -47,10 +47,16 @@ export default { async fetch(request: Request, env: Env, ctx: ExecutionContext): Promise { const qb = new D1QB(env.DB) - const fetched = await qb - .fetchOne({ + type Employee = { + name: string + role: string + level: number + } + + const employeeList = await qb + .fetchOne({ tableName: 'employees', - fields: 'count(*) as count', + fields: '*', where: { conditions: 'active = ?1', params: [true], @@ -58,8 +64,11 @@ export default { }) .execute() + // You get IDE type hints on each employee data, like: + // employeeList.results[0].name + return Response.json({ - activeEmployees: fetched.results?.count || 0, + activeEmployees: employeeList.results?.length || 0, }) }, } diff --git a/commitlint.config.js b/commitlint.config.cjs similarity index 100% rename from commitlint.config.js rename to commitlint.config.cjs diff --git a/config/fileTransformer.js b/config/fileTransformer.cjs similarity index 100% rename from config/fileTransformer.js rename to config/fileTransformer.cjs diff --git a/config/preparePublish.js b/config/preparePublish.cjs similarity index 100% rename from config/preparePublish.js rename to config/preparePublish.cjs diff --git a/jest.config.js b/jest.config.cjs similarity index 90% rename from jest.config.js rename to jest.config.cjs index 805af32..a5e204f 100644 --- a/jest.config.js +++ b/jest.config.cjs @@ -4,7 +4,7 @@ module.exports = { transform: { '^.+\\.(ts|tsx)$': 'ts-jest', '\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': - './config/fileTransformer.js', + './config/fileTransformer.cjs', }, globals: { 'ts-jest': { diff --git a/package-lock.json b/package-lock.json index 4500803..e8cdc8c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,7 +7,6 @@ "": { "name": "workers-qb", "version": "0.0.1", - "hasInstallScript": true, "license": "MIT", "devDependencies": { "@commitlint/cli": "^13.1.0", @@ -610,29 +609,6 @@ "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", "dev": true }, - "node_modules/@cloudflare/kv-asset-handler": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/@cloudflare/kv-asset-handler/-/kv-asset-handler-0.2.0.tgz", - "integrity": "sha512-MVbXLbTcAotOPUj0pAMhVtJ+3/kFkwJqc5qNOleOZTv6QkZZABDMS21dSrSlVswEHwrpWC03e4fWytjqKvuE2A==", - "dependencies": { - "mime": "^3.0.0" - } - }, - "node_modules/@cloudflare/workerd-darwin-64": { - "version": "1.20230518.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-64/-/workerd-darwin-64-1.20230518.0.tgz", - "integrity": "sha512-reApIf2/do6GjLlajU6LbRYh8gm/XcaRtzGbF8jo5IzyDSsdStmfNuvq7qssZXG92219Yp1kuTgR9+D1GGZGbg==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=16" - } - }, "node_modules/@commitlint/cli": { "version": "13.1.0", "resolved": "https://registry.npmjs.org/@commitlint/cli/-/cli-13.1.0.tgz", @@ -912,52 +888,6 @@ "node": ">=v12" } }, - "node_modules/@esbuild-plugins/node-globals-polyfill": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/@esbuild-plugins/node-globals-polyfill/-/node-globals-polyfill-0.1.1.tgz", - "integrity": "sha512-MR0oAA+mlnJWrt1RQVQ+4VYuRJW/P2YmRTv1AsplObyvuBMnPHiizUF95HHYiSsMGLhyGtWufaq2XQg6+iurBg==", - "peerDependencies": { - "esbuild": "*" - } - }, - "node_modules/@esbuild-plugins/node-modules-polyfill": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/@esbuild-plugins/node-modules-polyfill/-/node-modules-polyfill-0.1.4.tgz", - "integrity": "sha512-uZbcXi0zbmKC/050p3gJnne5Qdzw8vkXIv+c2BW0Lsc1ji1SkrxbKPUy5Efr0blbTu1SL8w4eyfpnSdPg3G0Qg==", - "dependencies": { - "escape-string-regexp": "^4.0.0", - "rollup-plugin-node-polyfills": "^0.2.1" - }, - "peerDependencies": { - "esbuild": "*" - } - }, - "node_modules/@esbuild-plugins/node-modules-polyfill/node_modules/escape-string-regexp": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", - "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@esbuild/darwin-x64": { - "version": "0.16.3", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.16.3.tgz", - "integrity": "sha512-uEqZQ2omc6BvWqdCiyZ5+XmxuHEi1SPzpVxXCSSV2+Sh7sbXbpeNhHIeFrIpRjAs0lI1FmA1iIOxFozKBhKgRQ==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=12" - } - }, "node_modules/@eslint/eslintrc": { "version": "0.4.3", "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.4.3.tgz", @@ -1876,6 +1806,7 @@ "version": "8.8.0", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.0.tgz", "integrity": "sha512-QOxyigPVrpZ2GXT+PFyZTl6TtOFc5egxHIP9IlQ+RbupQuX4RkT/Bee4/kQuC02Xkzg84JcT7oLYtDIQxp+v7w==", + "dev": true, "bin": { "acorn": "bin/acorn" }, @@ -1892,14 +1823,6 @@ "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, - "node_modules/acorn-walk": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", - "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", - "engines": { - "node": ">=0.4.0" - } - }, "node_modules/ajv": { "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", @@ -1980,6 +1903,7 @@ "version": "3.1.2", "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==", + "dev": true, "dependencies": { "normalize-path": "^3.0.0", "picomatch": "^2.0.4" @@ -2021,14 +1945,6 @@ "node": ">=0.10.0" } }, - "node_modules/as-table": { - "version": "1.0.55", - "resolved": "https://registry.npmjs.org/as-table/-/as-table-1.0.55.tgz", - "integrity": "sha512-xvsWESUJn0JN421Xb9MQw6AsMHRCUknCe0Wjlxvjud80mU4E6hQf1A6NzQKcYNmYw62MfzEtXc+badstZP3JpQ==", - "dependencies": { - "printable-characters": "^1.0.42" - } - }, "node_modules/astral-regex": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", @@ -2135,66 +2051,6 @@ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "dev": true }, - "node_modules/base64-js": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", - "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/better-sqlite3": { - "version": "8.4.0", - "resolved": "https://registry.npmjs.org/better-sqlite3/-/better-sqlite3-8.4.0.tgz", - "integrity": "sha512-NmsNW1CQvqMszu/CFAJ3pLct6NEFlNfuGM6vw72KHkjOD1UDnL96XNN1BMQc1hiHo8vE2GbOWQYIpZ+YM5wrZw==", - "hasInstallScript": true, - "dependencies": { - "bindings": "^1.5.0", - "prebuild-install": "^7.1.0" - } - }, - "node_modules/binary-extensions": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", - "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", - "engines": { - "node": ">=8" - } - }, - "node_modules/bindings": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", - "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", - "dependencies": { - "file-uri-to-path": "1.0.0" - } - }, - "node_modules/bl": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", - "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", - "dependencies": { - "buffer": "^5.5.0", - "inherits": "^2.0.4", - "readable-stream": "^3.4.0" - } - }, - "node_modules/blake3-wasm": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/blake3-wasm/-/blake3-wasm-2.1.5.tgz", - "integrity": "sha512-F1+K8EbfOZE49dtoPtmxUQrpXaBIl3ICvasLh+nJta0xkz+9kF/7uet9fLnwKqhDrmj6g+6K3Tw9yQPUg2ka5g==" - }, "node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -2209,6 +2065,7 @@ "version": "3.0.2", "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, "dependencies": { "fill-range": "^7.0.1" }, @@ -2265,53 +2122,11 @@ "node-int64": "^0.4.0" } }, - "node_modules/buffer": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", - "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "dependencies": { - "base64-js": "^1.3.1", - "ieee754": "^1.1.13" - } - }, "node_modules/buffer-from": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", - "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==" - }, - "node_modules/buffer-writer": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/buffer-writer/-/buffer-writer-2.0.0.tgz", - "integrity": "sha512-a7ZpuTZU1TRtnwyCNW3I5dc0wWNC3VR9S++Ewyk2HHZdrO3CQJqSpd+95Us590V6AL7JqUAH2IwZ/398PmNFgw==", - "optional": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/busboy": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz", - "integrity": "sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==", - "dependencies": { - "streamsearch": "^1.1.0" - }, - "engines": { - "node": ">=10.16.0" - } + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "dev": true }, "node_modules/callsites": { "version": "3.1.0", @@ -2364,20 +2179,6 @@ } ] }, - "node_modules/capnp-ts": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/capnp-ts/-/capnp-ts-0.7.0.tgz", - "integrity": "sha512-XKxXAC3HVPv7r674zP0VC3RTXz+/JKhfyw94ljvF80yynK6VkTnqE3jMuN8b3dUVmmc43TjyxjW4KTsmB3c86g==", - "dependencies": { - "debug": "^4.3.1", - "tslib": "^2.2.0" - } - }, - "node_modules/capnp-ts/node_modules/tslib": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.2.tgz", - "integrity": "sha512-5svOrSA2w3iGFDs1HibEVBGbDrAY82bFQ3HZ3ixB+88nsbsWQoKqDRb5UBYAUPEzbBn6dAp5gRNXglySbx1MlA==" - }, "node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -2403,37 +2204,6 @@ "node": ">=10" } }, - "node_modules/chokidar": { - "version": "3.5.3", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", - "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ], - "dependencies": { - "anymatch": "~3.1.2", - "braces": "~3.0.2", - "glob-parent": "~5.1.2", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.6.0" - }, - "engines": { - "node": ">= 8.10.0" - }, - "optionalDependencies": { - "fsevents": "~2.3.2" - } - }, - "node_modules/chownr": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", - "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==" - }, "node_modules/ci-info": { "version": "3.3.2", "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.3.2.tgz", @@ -2575,14 +2345,6 @@ "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", "dev": true }, - "node_modules/cookie": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", - "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==", - "engines": { - "node": ">= 0.6" - } - }, "node_modules/cosmiconfig": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.0.1.tgz", @@ -2622,15 +2384,11 @@ "node": ">=8" } }, - "node_modules/data-uri-to-buffer": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-2.0.2.tgz", - "integrity": "sha512-ND9qDTLc6diwj+Xe5cdAgVTbLVdXbtxTJRXRhli8Mowuaan+0EJOtdqJ0QCHNSSPyoXGx9HX2/VMnKeC34AChA==" - }, "node_modules/debug": { "version": "4.3.2", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", + "dev": true, "dependencies": { "ms": "2.1.2" }, @@ -2674,34 +2432,12 @@ "node": ">=0.10.0" } }, - "node_modules/decompress-response": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz", - "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==", - "dependencies": { - "mimic-response": "^3.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/dedent": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/dedent/-/dedent-0.7.0.tgz", "integrity": "sha512-Q6fKUPqnAHAyhiUgFU7BUzLiv0kd8saH9al7tnu5Q/okj6dnupxyTgFIBjVzJATdfIAm9NAsvXNzjaKa+bxVyA==", "dev": true }, - "node_modules/deep-extend": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", - "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", - "engines": { - "node": ">=4.0.0" - } - }, "node_modules/deep-is": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", @@ -2717,14 +2453,6 @@ "node": ">=0.10.0" } }, - "node_modules/detect-libc": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.1.tgz", - "integrity": "sha512-463v3ZeIrcWtdgIg6vI6XUncguvr2TnGl4SzDXinkt9mSLpBJKXT3mW6xT3VQdDN11+WVs29pgvivTc4Lp8v+w==", - "engines": { - "node": ">=8" - } - }, "node_modules/detect-newline": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz", @@ -2809,14 +2537,6 @@ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", "dev": true }, - "node_modules/end-of-stream": { - "version": "1.4.4", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", - "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", - "dependencies": { - "once": "^1.4.0" - } - }, "node_modules/enquirer": { "version": "2.3.6", "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz", @@ -2838,42 +2558,6 @@ "is-arrayish": "^0.2.1" } }, - "node_modules/esbuild": { - "version": "0.16.3", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.16.3.tgz", - "integrity": "sha512-71f7EjPWTiSguen8X/kxEpkAS7BFHwtQKisCDDV3Y4GLGWBaoSCyD5uXkaUew6JDzA9FEN1W23mdnSwW9kqCeg==", - "hasInstallScript": true, - "bin": { - "esbuild": "bin/esbuild" - }, - "engines": { - "node": ">=12" - }, - "optionalDependencies": { - "@esbuild/android-arm": "0.16.3", - "@esbuild/android-arm64": "0.16.3", - "@esbuild/android-x64": "0.16.3", - "@esbuild/darwin-arm64": "0.16.3", - "@esbuild/darwin-x64": "0.16.3", - "@esbuild/freebsd-arm64": "0.16.3", - "@esbuild/freebsd-x64": "0.16.3", - "@esbuild/linux-arm": "0.16.3", - "@esbuild/linux-arm64": "0.16.3", - "@esbuild/linux-ia32": "0.16.3", - "@esbuild/linux-loong64": "0.16.3", - "@esbuild/linux-mips64el": "0.16.3", - "@esbuild/linux-ppc64": "0.16.3", - "@esbuild/linux-riscv64": "0.16.3", - "@esbuild/linux-s390x": "0.16.3", - "@esbuild/linux-x64": "0.16.3", - "@esbuild/netbsd-x64": "0.16.3", - "@esbuild/openbsd-x64": "0.16.3", - "@esbuild/sunos-x64": "0.16.3", - "@esbuild/win32-arm64": "0.16.3", - "@esbuild/win32-ia32": "0.16.3", - "@esbuild/win32-x64": "0.16.3" - } - }, "node_modules/escalade": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", @@ -3222,25 +2906,6 @@ "node": ">= 0.8.0" } }, - "node_modules/exit-hook": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/exit-hook/-/exit-hook-2.2.1.tgz", - "integrity": "sha512-eNTPlAD67BmP31LDINZ3U7HSF8l57TxOY2PmBJ1shpCvpnxBF93mWCE8YHBnXs8qiUZJc9WDcWIeC3a2HIAMfw==", - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/expand-template": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/expand-template/-/expand-template-2.0.3.tgz", - "integrity": "sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==", - "engines": { - "node": ">=6" - } - }, "node_modules/expect": { "version": "28.1.3", "resolved": "https://registry.npmjs.org/expect/-/expect-28.1.3.tgz", @@ -3349,15 +3014,11 @@ "node": "^10.12.0 || >=12.0.0" } }, - "node_modules/file-uri-to-path": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", - "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==" - }, "node_modules/fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, "dependencies": { "to-regex-range": "^5.0.1" }, @@ -3417,11 +3078,6 @@ } ] }, - "node_modules/fs-constants": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", - "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==" - }, "node_modules/fs-extra": { "version": "10.0.0", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.0.0.tgz", @@ -3446,6 +3102,7 @@ "version": "2.3.2", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, "hasInstallScript": true, "optional": true, "os": [ @@ -3494,15 +3151,6 @@ "node": ">=8.0.0" } }, - "node_modules/get-source": { - "version": "2.0.12", - "resolved": "https://registry.npmjs.org/get-source/-/get-source-2.0.12.tgz", - "integrity": "sha512-X5+4+iD+HoSeEED+uwrQ07BOQr0kEDFMVqqpBuI+RaZBpBpHCuXxo70bjar6f0b0u/DQJsJ7ssurpP0V60Az+w==", - "dependencies": { - "data-uri-to-buffer": "^2.0.0", - "source-map": "^0.6.1" - } - }, "node_modules/get-stream": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", @@ -3534,11 +3182,6 @@ "node": ">=10" } }, - "node_modules/github-from-package": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz", - "integrity": "sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==" - }, "node_modules/glob": { "version": "7.1.7", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz", @@ -3563,6 +3206,7 @@ "version": "5.1.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, "dependencies": { "is-glob": "^4.0.1" }, @@ -3570,11 +3214,6 @@ "node": ">= 6" } }, - "node_modules/glob-to-regexp": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz", - "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==" - }, "node_modules/global-dirs": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-0.1.1.tgz", @@ -3721,11 +3360,6 @@ "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", "dev": true }, - "node_modules/http-cache-semantics": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz", - "integrity": "sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==" - }, "node_modules/human-signals": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", @@ -3750,25 +3384,6 @@ "url": "https://github.com/sponsors/typicode" } }, - "node_modules/ieee754": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, "node_modules/ignore": { "version": "5.1.8", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.8.tgz", @@ -3850,12 +3465,14 @@ "node_modules/inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true }, "node_modules/ini": { "version": "1.3.8", "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", - "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==" + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", + "dev": true }, "node_modules/is-arrayish": { "version": "0.2.1", @@ -3863,17 +3480,6 @@ "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", "dev": true }, - "node_modules/is-binary-path": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", - "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", - "dependencies": { - "binary-extensions": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/is-core-module": { "version": "2.11.0", "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.11.0.tgz", @@ -3890,6 +3496,7 @@ "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true, "engines": { "node": ">=0.10.0" } @@ -3916,6 +3523,7 @@ "version": "4.0.1", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", + "dev": true, "dependencies": { "is-extglob": "^2.1.1" }, @@ -3927,6 +3535,7 @@ "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, "engines": { "node": ">=0.12.0" } @@ -5249,6 +4858,7 @@ "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, "dependencies": { "yallist": "^4.0.0" }, @@ -5256,14 +4866,6 @@ "node": ">=10" } }, - "node_modules/magic-string": { - "version": "0.25.9", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.9.tgz", - "integrity": "sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ==", - "dependencies": { - "sourcemap-codec": "^1.4.8" - } - }, "node_modules/make-dir": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", @@ -5410,6 +5012,18 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/meow/node_modules/type-fest": { + "version": "0.18.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.18.1.tgz", + "integrity": "sha512-OIAYXk8+ISY+qTOwkHtKqzAuxchoMiD9Udx+FSGQDuiRR+PJKJHc2NJAXlbhkGwTt/4/nKZxELY1w3ReWOL8mw==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/merge-stream": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", @@ -5438,17 +5052,6 @@ "node": ">=8.6" } }, - "node_modules/mime": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/mime/-/mime-3.0.0.tgz", - "integrity": "sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A==", - "bin": { - "mime": "cli.js" - }, - "engines": { - "node": ">=10.0.0" - } - }, "node_modules/mimic-fn": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", @@ -5458,17 +5061,6 @@ "node": ">=6" } }, - "node_modules/mimic-response": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz", - "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/min-indent": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz", @@ -5478,39 +5070,6 @@ "node": ">=4" } }, - "node_modules/miniflare": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/miniflare/-/miniflare-3.0.0.tgz", - "integrity": "sha512-CW8yS00pQCbq2o4K8drePzJBkE0heL9cCY/O8DcYJOHd4M0RVutjrp+LqUP4hfzweZ+LqrLo8+Rzy4cORisQoQ==", - "dependencies": { - "acorn": "^8.8.0", - "acorn-walk": "^8.2.0", - "better-sqlite3": "^8.1.0", - "capnp-ts": "^0.7.0", - "exit-hook": "^2.2.1", - "glob-to-regexp": "^0.4.1", - "http-cache-semantics": "^4.1.0", - "kleur": "^4.1.5", - "source-map-support": "0.5.21", - "stoppable": "^1.1.0", - "undici": "^5.13.0", - "workerd": "^1.20230512.0", - "ws": "^8.11.0", - "youch": "^3.2.2", - "zod": "^3.20.6" - }, - "engines": { - "node": ">=16.13" - } - }, - "node_modules/miniflare/node_modules/kleur": { - "version": "4.1.5", - "resolved": "https://registry.npmjs.org/kleur/-/kleur-4.1.5.tgz", - "integrity": "sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==", - "engines": { - "node": ">=6" - } - }, "node_modules/minimatch": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", @@ -5523,14 +5082,6 @@ "node": "*" } }, - "node_modules/minimist": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", - "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/minimist-options": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/minimist-options/-/minimist-options-4.1.0.tgz", @@ -5545,45 +5096,11 @@ "node": ">= 6" } }, - "node_modules/mkdirp-classic": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz", - "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==" - }, "node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" - }, - "node_modules/mustache": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/mustache/-/mustache-4.2.0.tgz", - "integrity": "sha512-71ippSywq5Yb7/tVYyGbkBggbU8H3u5Rz56fH60jGFgr8uHwxs+aSKeqmluIVzM0m0kB7xQjKS6qPfd0b2ZoqQ==", - "bin": { - "mustache": "bin/mustache" - } - }, - "node_modules/nanoid": { - "version": "3.3.6", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.6.tgz", - "integrity": "sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "bin": { - "nanoid": "bin/nanoid.cjs" - }, - "engines": { - "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" - } - }, - "node_modules/napi-build-utils": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-1.0.2.tgz", - "integrity": "sha512-ONmRUqK7zj7DWX0D9ADe03wbwOBZxNAfF20PlGfCWQcD3+/MakShIHrMqx9YwPTfxDdF1zLeL+RGZiR9kGMLdg==" + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true }, "node_modules/natural-compare": { "version": "1.4.0", @@ -5591,25 +5108,6 @@ "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", "dev": true }, - "node_modules/node-abi": { - "version": "3.40.0", - "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.40.0.tgz", - "integrity": "sha512-zNy02qivjjRosswoYmPi8hIKJRr8MpQyeKT6qlcq/OnOgA3Rhoae+IYOqsM9V5+JnHWmxKnWOT2GxvtqdtOCXA==", - "dependencies": { - "semver": "^7.3.5" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/node-forge": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.3.1.tgz", - "integrity": "sha512-dPEtOeMvF9VMcYV/1Wb8CPoVAXtp6MKMlcbAt4ddqmGqUJ6fQZFXkNZNkNlfevtNkGtaSoXf/vNNNSvgrdXwtA==", - "engines": { - "node": ">= 6.13.0" - } - }, "node_modules/node-int64": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", @@ -5641,6 +5139,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, "engines": { "node": ">=0.10.0" } @@ -5679,6 +5178,7 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, "dependencies": { "wrappy": "1" } @@ -5751,12 +5251,6 @@ "node": ">=6" } }, - "node_modules/packet-reader": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/packet-reader/-/packet-reader-1.0.0.tgz", - "integrity": "sha512-HAKu/fG3HpHFO0AA8WE8q2g+gBJaZ9MG7fcKk+IJPLTGAD6Psw4443l+9DGRbOIh3/aXr7Phy0TjilYivJo5XQ==", - "optional": true - }, "node_modules/parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", @@ -5820,11 +5314,6 @@ "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", "dev": true }, - "node_modules/path-to-regexp": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.2.1.tgz", - "integrity": "sha512-JLyh7xT1kizaEvcaXOQwOc2/Yhw6KZOvPf1S8401UyLk86CU79LN3vl7ztXGm/pZ+YjoyAJ4rxmHwbkBXJX+yw==" - }, "node_modules/path-type": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", @@ -5834,105 +5323,6 @@ "node": ">=8" } }, - "node_modules/pg": { - "version": "8.11.0", - "resolved": "https://registry.npmjs.org/pg/-/pg-8.11.0.tgz", - "integrity": "sha512-meLUVPn2TWgJyLmy7el3fQQVwft4gU5NGyvV0XbD41iU9Jbg8lCH4zexhIkihDzVHJStlt6r088G6/fWeNjhXA==", - "optional": true, - "dependencies": { - "buffer-writer": "2.0.0", - "packet-reader": "1.0.0", - "pg-connection-string": "^2.6.0", - "pg-pool": "^3.6.0", - "pg-protocol": "^1.6.0", - "pg-types": "^2.1.0", - "pgpass": "1.x" - }, - "engines": { - "node": ">= 8.0.0" - }, - "optionalDependencies": { - "pg-cloudflare": "^1.1.0" - }, - "peerDependencies": { - "pg-native": ">=3.0.1" - }, - "peerDependenciesMeta": { - "pg-native": { - "optional": true - } - } - }, - "node_modules/pg-cloudflare": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/pg-cloudflare/-/pg-cloudflare-1.1.0.tgz", - "integrity": "sha512-tGM8/s6frwuAIyRcJ6nWcIvd3+3NmUKIs6OjviIm1HPPFEt5MzQDOTBQyhPWg/m0kCl95M6gA1JaIXtS8KovOA==", - "optional": true - }, - "node_modules/pg-connection-string": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-2.6.0.tgz", - "integrity": "sha512-x14ibktcwlHKoHxx9X3uTVW9zIGR41ZB6QNhHb21OPNdCCO3NaRnpJuwKIQSR4u+Yqjx4HCvy7Hh7VSy1U4dGg==", - "optional": true - }, - "node_modules/pg-int8": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/pg-int8/-/pg-int8-1.0.1.tgz", - "integrity": "sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw==", - "optional": true, - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/pg-pool": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/pg-pool/-/pg-pool-3.6.0.tgz", - "integrity": "sha512-clFRf2ksqd+F497kWFyM21tMjeikn60oGDmqMT8UBrynEwVEX/5R5xd2sdvdo1cZCFlguORNpVuqxIj+aK4cfQ==", - "optional": true, - "peerDependencies": { - "pg": ">=8.0" - } - }, - "node_modules/pg-protocol": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/pg-protocol/-/pg-protocol-1.6.0.tgz", - "integrity": "sha512-M+PDm637OY5WM307051+bsDia5Xej6d9IR4GwJse1qA1DIhiKlksvrneZOYQq42OM+spubpcNYEo2FcKQrDk+Q==", - "optional": true - }, - "node_modules/pg-types": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/pg-types/-/pg-types-2.2.0.tgz", - "integrity": "sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA==", - "optional": true, - "dependencies": { - "pg-int8": "1.0.1", - "postgres-array": "~2.0.0", - "postgres-bytea": "~1.0.0", - "postgres-date": "~1.0.4", - "postgres-interval": "^1.1.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/pgpass": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/pgpass/-/pgpass-1.0.5.tgz", - "integrity": "sha512-FdW9r/jQZhSeohs1Z3sI1yxFQNFvMcnmfuj4WBMUTxOrAyLMaTcE1aAMBiTlbMNaXvBCQuVi0R7hd8udDSP7ug==", - "optional": true, - "dependencies": { - "split2": "^4.1.0" - } - }, - "node_modules/pgpass/node_modules/split2": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/split2/-/split2-4.2.0.tgz", - "integrity": "sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==", - "optional": true, - "engines": { - "node": ">= 10.x" - } - }, "node_modules/picocolors": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", @@ -5943,6 +5333,7 @@ "version": "2.3.1", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, "engines": { "node": ">=8.6" }, @@ -5986,70 +5377,6 @@ "node": ">=8" } }, - "node_modules/postgres-array": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/postgres-array/-/postgres-array-2.0.0.tgz", - "integrity": "sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA==", - "optional": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/postgres-bytea": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/postgres-bytea/-/postgres-bytea-1.0.0.tgz", - "integrity": "sha512-xy3pmLuQqRBZBXDULy7KbaitYqLcmxigw14Q5sj8QBVLqEwXfeybIKVWiqAXTlcvdvb0+xkOtDbfQMOf4lST1w==", - "optional": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/postgres-date": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/postgres-date/-/postgres-date-1.0.7.tgz", - "integrity": "sha512-suDmjLVQg78nMK2UZ454hAG+OAW+HQPZ6n++TNDUX+L0+uUlLywnoxJKDou51Zm+zTCjrCl0Nq6J9C5hP9vK/Q==", - "optional": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/postgres-interval": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/postgres-interval/-/postgres-interval-1.2.0.tgz", - "integrity": "sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ==", - "optional": true, - "dependencies": { - "xtend": "^4.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/prebuild-install": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-7.1.1.tgz", - "integrity": "sha512-jAXscXWMcCK8GgCoHOfIr0ODh5ai8mj63L2nWrjuAgXE6tDyYGnx4/8o/rCgU+B4JSyZBKbeZqzhtwtC3ovxjw==", - "dependencies": { - "detect-libc": "^2.0.0", - "expand-template": "^2.0.3", - "github-from-package": "0.0.0", - "minimist": "^1.2.3", - "mkdirp-classic": "^0.5.3", - "napi-build-utils": "^1.0.1", - "node-abi": "^3.3.0", - "pump": "^3.0.0", - "rc": "^1.2.7", - "simple-get": "^4.0.0", - "tar-fs": "^2.0.0", - "tunnel-agent": "^0.6.0" - }, - "bin": { - "prebuild-install": "bin.js" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/prelude-ls": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", @@ -6147,11 +5474,6 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/printable-characters": { - "version": "1.0.42", - "resolved": "https://registry.npmjs.org/printable-characters/-/printable-characters-1.0.42.tgz", - "integrity": "sha512-dKp+C4iXWK4vVYZmYSd0KBH5F/h1HoZRsbJ82AVKRO3PEo8L4lBS/vLwhVtpwwuYcoIsVY+1JYKR268yn480uQ==" - }, "node_modules/progress": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", @@ -6174,15 +5496,6 @@ "node": ">= 6" } }, - "node_modules/pump": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", - "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", - "dependencies": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } - }, "node_modules/punycode": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", @@ -6240,28 +5553,6 @@ "safe-buffer": "^5.1.0" } }, - "node_modules/rc": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", - "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", - "dependencies": { - "deep-extend": "^0.6.0", - "ini": "~1.3.0", - "minimist": "^1.2.0", - "strip-json-comments": "~2.0.1" - }, - "bin": { - "rc": "cli.js" - } - }, - "node_modules/rc/node_modules/strip-json-comments": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", - "integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==", - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/react-is": { "version": "17.0.2", "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", @@ -6349,6 +5640,7 @@ "version": "3.6.0", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dev": true, "dependencies": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", @@ -6358,17 +5650,6 @@ "node": ">= 6" } }, - "node_modules/readdirp": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", - "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", - "dependencies": { - "picomatch": "^2.2.1" - }, - "engines": { - "node": ">=8.10.0" - } - }, "node_modules/redent": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/redent/-/redent-3.0.0.tgz", @@ -6577,43 +5858,6 @@ "node": ">=0.8.0" } }, - "node_modules/rollup-plugin-inject": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rollup-plugin-inject/-/rollup-plugin-inject-3.0.2.tgz", - "integrity": "sha512-ptg9PQwzs3orn4jkgXJ74bfs5vYz1NCZlSQMBUA0wKcGp5i5pA1AO3fOUEte8enhGUC+iapTCzEWw2jEFFUO/w==", - "deprecated": "This package has been deprecated and is no longer maintained. Please use @rollup/plugin-inject.", - "dependencies": { - "estree-walker": "^0.6.1", - "magic-string": "^0.25.3", - "rollup-pluginutils": "^2.8.1" - } - }, - "node_modules/rollup-plugin-inject/node_modules/estree-walker": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.6.1.tgz", - "integrity": "sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w==" - }, - "node_modules/rollup-plugin-node-polyfills": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/rollup-plugin-node-polyfills/-/rollup-plugin-node-polyfills-0.2.1.tgz", - "integrity": "sha512-4kCrKPTJ6sK4/gLL/U5QzVT8cxJcofO0OU74tnB19F40cmuAKSzH5/siithxlofFEjwvw1YAhPmbvGNA6jEroA==", - "dependencies": { - "rollup-plugin-inject": "^3.0.0" - } - }, - "node_modules/rollup-pluginutils": { - "version": "2.8.2", - "resolved": "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-2.8.2.tgz", - "integrity": "sha512-EEp9NhnUkwY8aif6bxgovPHMoMoNr2FulJziTndpt5H9RdwC47GSGuII9XxpSdzVGM0GWrNPHV6ie1LTNJPaLQ==", - "dependencies": { - "estree-walker": "^0.6.1" - } - }, - "node_modules/rollup-pluginutils/node_modules/estree-walker": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.6.1.tgz", - "integrity": "sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w==" - }, "node_modules/run-parallel": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", @@ -6641,6 +5885,7 @@ "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true, "funding": [ { "type": "github", @@ -6656,21 +5901,11 @@ } ] }, - "node_modules/selfsigned": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/selfsigned/-/selfsigned-2.1.1.tgz", - "integrity": "sha512-GSL3aowiF7wa/WtSFwnUrludWFoNhftq8bUkH9pkzjpN2XSPOAYEgg6e0sS9s0rZwgJzJiQRPU18A6clnoW5wQ==", - "dependencies": { - "node-forge": "^1" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/semver": { "version": "7.3.5", "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "dev": true, "dependencies": { "lru-cache": "^6.0.0" }, @@ -6717,49 +5952,6 @@ "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", "dev": true }, - "node_modules/simple-concat": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz", - "integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/simple-get": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-4.0.1.tgz", - "integrity": "sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "dependencies": { - "decompress-response": "^6.0.0", - "once": "^1.3.1", - "simple-concat": "^1.0.0" - } - }, "node_modules/sisteransi": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz", @@ -6802,6 +5994,7 @@ "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, "engines": { "node": ">=0.10.0" } @@ -6810,17 +6003,12 @@ "version": "0.5.21", "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", + "dev": true, "dependencies": { "buffer-from": "^1.0.0", "source-map": "^0.6.0" } }, - "node_modules/sourcemap-codec": { - "version": "1.4.8", - "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz", - "integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==", - "deprecated": "Please use @jridgewell/sourcemap-codec instead" - }, "node_modules/spdx-correct": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz", @@ -6889,36 +6077,11 @@ "node": ">=8" } }, - "node_modules/stacktracey": { - "version": "2.1.8", - "resolved": "https://registry.npmjs.org/stacktracey/-/stacktracey-2.1.8.tgz", - "integrity": "sha512-Kpij9riA+UNg7TnphqjH7/CzctQ/owJGNbFkfEeve4Z4uxT5+JapVLFXcsurIfN34gnTWZNJ/f7NMG0E8JDzTw==", - "dependencies": { - "as-table": "^1.0.36", - "get-source": "^2.0.12" - } - }, - "node_modules/stoppable": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/stoppable/-/stoppable-1.1.0.tgz", - "integrity": "sha512-KXDYZ9dszj6bzvnEMRYvxgeTHU74QBFL54XKtP3nyMuJ81CFYtABZ3bAzL2EdFUaEwJOBOgENyFj3R7oTzDyyw==", - "engines": { - "node": ">=4", - "npm": ">=6" - } - }, - "node_modules/streamsearch": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz", - "integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==", - "engines": { - "node": ">=10.0.0" - } - }, "node_modules/string_decoder": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dev": true, "dependencies": { "safe-buffer": "~5.2.0" } @@ -7080,32 +6243,6 @@ "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", "dev": true }, - "node_modules/tar-fs": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.1.tgz", - "integrity": "sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng==", - "dependencies": { - "chownr": "^1.1.1", - "mkdirp-classic": "^0.5.2", - "pump": "^3.0.0", - "tar-stream": "^2.1.4" - } - }, - "node_modules/tar-stream": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz", - "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==", - "dependencies": { - "bl": "^4.0.3", - "end-of-stream": "^1.4.1", - "fs-constants": "^1.0.0", - "inherits": "^2.0.3", - "readable-stream": "^3.1.1" - }, - "engines": { - "node": ">=6" - } - }, "node_modules/terminal-link": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/terminal-link/-/terminal-link-2.1.1.tgz", @@ -7203,6 +6340,7 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, "dependencies": { "is-number": "^7.0.0" }, @@ -7292,17 +6430,6 @@ "typescript": ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta" } }, - "node_modules/tunnel-agent": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", - "integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==", - "dependencies": { - "safe-buffer": "^5.0.1" - }, - "engines": { - "node": "*" - } - }, "node_modules/type-check": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", @@ -7324,18 +6451,6 @@ "node": ">=4" } }, - "node_modules/type-fest": { - "version": "0.18.1", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.18.1.tgz", - "integrity": "sha512-OIAYXk8+ISY+qTOwkHtKqzAuxchoMiD9Udx+FSGQDuiRR+PJKJHc2NJAXlbhkGwTt/4/nKZxELY1w3ReWOL8mw==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/typescript": { "version": "4.9.5", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", @@ -7349,17 +6464,6 @@ "node": ">=4.2.0" } }, - "node_modules/undici": { - "version": "5.22.1", - "resolved": "https://registry.npmjs.org/undici/-/undici-5.22.1.tgz", - "integrity": "sha512-Ji2IJhFXZY0x/0tVBXeQwgPlLWw13GVzpsWPQ3rV50IFMMof2I55PZZxtm4P6iNq+L5znYN9nSTAq0ZyE6lSJw==", - "dependencies": { - "busboy": "^1.6.0" - }, - "engines": { - "node": ">=14.0" - } - }, "node_modules/universalify": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", @@ -7407,7 +6511,8 @@ "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "dev": true }, "node_modules/v8-compile-cache": { "version": "2.3.0", @@ -7472,62 +6577,6 @@ "node": ">=0.10.0" } }, - "node_modules/workerd": { - "version": "1.20230518.0", - "resolved": "https://registry.npmjs.org/workerd/-/workerd-1.20230518.0.tgz", - "integrity": "sha512-VNmK0zoNZXrwEEx77O/oQDVUzzyDjf5kKKK8bty+FmKCd5EQJCpqi8NlRKWLGMyyYrKm86MFz0kAsreTEs7HHA==", - "hasInstallScript": true, - "bin": { - "workerd": "bin/workerd" - }, - "engines": { - "node": ">=16" - }, - "optionalDependencies": { - "@cloudflare/workerd-darwin-64": "1.20230518.0", - "@cloudflare/workerd-darwin-arm64": "1.20230518.0", - "@cloudflare/workerd-linux-64": "1.20230518.0", - "@cloudflare/workerd-linux-arm64": "1.20230518.0", - "@cloudflare/workerd-windows-64": "1.20230518.0" - } - }, - "node_modules/wrangler": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/wrangler/-/wrangler-3.0.0.tgz", - "integrity": "sha512-azppXJjEQeaVg3wxFZJOGDGtpR8e9clHr2aHuanGHOk9vX3gvesCv97BF/n8qh1Y1d7vDKOBdfQW3UOYZNFGNw==", - "dependencies": { - "@cloudflare/kv-asset-handler": "^0.2.0", - "@esbuild-plugins/node-globals-polyfill": "^0.1.1", - "@esbuild-plugins/node-modules-polyfill": "^0.1.4", - "blake3-wasm": "^2.1.5", - "chokidar": "^3.5.3", - "esbuild": "0.16.3", - "miniflare": "^3.0.0", - "nanoid": "^3.3.3", - "path-to-regexp": "^6.2.0", - "selfsigned": "^2.0.1", - "source-map": "^0.7.4", - "xxhash-wasm": "^1.0.1" - }, - "bin": { - "wrangler": "bin/wrangler.js", - "wrangler2": "bin/wrangler.js" - }, - "engines": { - "node": ">=16.13.0" - }, - "optionalDependencies": { - "fsevents": "~2.3.2" - } - }, - "node_modules/wrangler/node_modules/source-map": { - "version": "0.7.4", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz", - "integrity": "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==", - "engines": { - "node": ">= 8" - } - }, "node_modules/wrap-ansi": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", @@ -7548,7 +6597,8 @@ "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true }, "node_modules/write-file-atomic": { "version": "4.0.1", @@ -7563,40 +6613,6 @@ "node": "^12.13.0 || ^14.15.0 || >=16" } }, - "node_modules/ws": { - "version": "8.13.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", - "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", - "engines": { - "node": ">=10.0.0" - }, - "peerDependencies": { - "bufferutil": "^4.0.1", - "utf-8-validate": ">=5.0.2" - }, - "peerDependenciesMeta": { - "bufferutil": { - "optional": true - }, - "utf-8-validate": { - "optional": true - } - } - }, - "node_modules/xtend": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", - "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", - "optional": true, - "engines": { - "node": ">=0.4" - } - }, - "node_modules/xxhash-wasm": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/xxhash-wasm/-/xxhash-wasm-1.0.2.tgz", - "integrity": "sha512-ibF0Or+FivM9lNrg+HGJfVX8WJqgo+kCLDc4vx6xMeTce7Aj+DLttKbxxRR/gNLSAelRc1omAPlJ77N/Jem07A==" - }, "node_modules/y18n": { "version": "5.0.8", "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", @@ -7609,7 +6625,8 @@ "node_modules/yallist": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true }, "node_modules/yaml": { "version": "1.10.2", @@ -7667,24 +6684,6 @@ "funding": { "url": "https://github.com/sponsors/sindresorhus" } - }, - "node_modules/youch": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/youch/-/youch-3.2.3.tgz", - "integrity": "sha512-ZBcWz/uzZaQVdCvfV4uk616Bbpf2ee+F/AvuKDR5EwX/Y4v06xWdtMluqTD7+KlZdM93lLm9gMZYo0sKBS0pgw==", - "dependencies": { - "cookie": "^0.5.0", - "mustache": "^4.2.0", - "stacktracey": "^2.1.8" - } - }, - "node_modules/zod": { - "version": "3.21.4", - "resolved": "https://registry.npmjs.org/zod/-/zod-3.21.4.tgz", - "integrity": "sha512-m46AKbrzKVzOzs/DZgVnG5H55N1sv1M8qZU3A8RIKbs3mrACDNeIOeilDymVb2HdmP8uwshOCF4uJ8uM9rCqJw==", - "funding": { - "url": "https://github.com/sponsors/colinhacks" - } } } } diff --git a/package.json b/package.json index 32e1fa9..5a66f83 100644 --- a/package.json +++ b/package.json @@ -1,14 +1,15 @@ { "name": "workers-qb", "version": "0.0.1", + "type": "module", "description": "Zero dependencies Query Builder for Cloudflare Workers", - "main": "./dist/workers-qb.js", - "types": "./dist/src/workers-qb.d.ts", + "main": "./dist/index.js", + "types": "./dist/src/index.d.ts", "exports": { ".": { - "types": "./dist/src/workers-qb.d.ts", - "import": "./dist/workers-qb.mjs", - "require": "./dist/workers-qb.js" + "types": "./dist/src/index.d.ts", + "import": "./dist/index.mjs", + "require": "./dist/index.js" } }, "files": [ @@ -21,8 +22,8 @@ "postpublish": "pinst --enable", "build": "rollup -c", "package": "npm run build && npm pack", - "test": "jest --no-cache --runInBand", - "test:cov": "jest --coverage --no-cache --runInBand", + "test": "jest --config jest.config.cjs --no-cache --runInBand", + "test:cov": "jest --config jest.config.cjs --coverage --no-cache --runInBand", "addscope": "node tools/packagejson name @g4brym/workers-qb", "prettify": "prettier --check . || (prettier -w .; exit 1)", "prepare": "husky install" @@ -83,5 +84,29 @@ "rollup-plugin-bundle-size": "^1.0.3", "ts-jest": "^28.0.5", "typescript": "^4.8.4" + }, + "prettier": { + "semi": false, + "singleQuote": true, + "trailingComma": "es5", + "arrowParens": "always", + "printWidth": 120 + }, + "eslintConfig": { + "parser": "@typescript-eslint/parser", + "extends": [ + "plugin:@typescript-eslint/recommended", + "prettier" + ], + "parserOptions": { + "sourceType": "module" + }, + "rules": { + "prettier/prettier": "error" + }, + "plugins": [ + "@typescript-eslint", + "prettier" + ] } } diff --git a/rollup.config.mjs b/rollup.config.mjs index ecc19e7..f6e3065 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -4,10 +4,16 @@ import terser from '@rollup/plugin-terser' import typescript from '@rollup/plugin-typescript' export default defineConfig({ - input: 'src/workers-qb.ts', + input: 'src/index.ts', output: [ - { format: 'cjs', file: 'dist/workers-qb.js' }, - { format: 'es', file: 'dist/workers-qb.mjs' }, + { format: 'cjs', file: 'dist/index.js' }, + { format: 'es', file: 'dist/index.mjs' }, + ], + plugins: [ + typescript({ + sourceMap: false, + }), + terser(), + bundleSize(), ], - plugins: [typescript(), terser(), bundleSize()], }) diff --git a/src/Builder.ts b/src/Builder.ts index 8152e3b..43327d3 100644 --- a/src/Builder.ts +++ b/src/Builder.ts @@ -1,41 +1,59 @@ -import { ConflictUpsert, Delete, Insert, Join, RawQuery, SelectAll, SelectOne, Update } from './interfaces' +import { + ArrayResult, + ConflictUpsert, + DefaultObject, + Delete, + EitherResult, + Insert, + Join, + OneResult, + RawQuery, + SelectAll, + SelectOne, + Update, +} from './interfaces' import { ConflictTypes, FetchTypes, OrderTypes } from './enums' import { Query, Raw } from './tools' -export class QueryBuilder { +export class QueryBuilder { _debugger = false setDebugger(state: boolean): void { this._debugger = state } - async execute(query: Query): Promise { + async execute(query: Query): Promise { throw new Error('Execute method not implemented') } - async batchExecute(queryArray: Query[]): Promise<(GenericResultOne | GenericResult)[]> { + async batchExecute(queryArray: Query[]): Promise { throw new Error('Batch execute method not implemented') } - createTable(params: { tableName: string; schema: string; ifNotExists?: boolean }): Query { + createTable(params: { + tableName: string + schema: string + ifNotExists?: boolean + }): Query> { return new Query( (q: Query) => { return this.execute(q) }, `CREATE TABLE ${params.ifNotExists ? 'IF NOT EXISTS' : ''} ${params.tableName} - ( - ${params.schema} - )` + ( ${params.schema})` ) } - dropTable(params: { tableName: string; ifExists?: boolean }): Query { + dropTable(params: { + tableName: string + ifExists?: boolean + }): Query> { return new Query((q: Query) => { return this.execute(q) }, `DROP TABLE ${params.ifExists ? 'IF EXISTS' : ''} ${params.tableName}`) } - fetchOne(params: SelectOne): Query { + fetchOne(params: SelectOne): Query> { return new Query( (q: Query) => { return this.execute(q) @@ -46,7 +64,7 @@ export class QueryBuilder { ) } - fetchAll(params: SelectAll): Query { + fetchAll(params: SelectAll): Query> { return new Query( (q: Query) => { return this.execute(q) @@ -57,7 +75,7 @@ export class QueryBuilder { ) } - raw(params: RawQuery): Query { + raw(params: RawQuery): Query> { return new Query( (q: Query) => { return this.execute(q) @@ -68,7 +86,7 @@ export class QueryBuilder { ) } - insert(params: Insert): Query { + insert(params: Insert): Query> { let args: any[] = [] if (typeof params.onConflict === 'object') { @@ -104,7 +122,7 @@ export class QueryBuilder { ) } - update(params: Update): Query { + update(params: Update): Query> { let args = this._parse_arguments(params.data) if (params.where && params.where.params) { @@ -121,7 +139,7 @@ export class QueryBuilder { ) } - delete(params: Delete): Query { + delete(params: Delete): Query> { return new Query( (q: Query) => { return this.execute(q) @@ -203,7 +221,7 @@ export class QueryBuilder { } return ( - `INSERT ${orConflict}INTO ${params.tableName} (${columns})` + + `INSERT ${orConflict} INTO ${params.tableName} (${columns})` + ` VALUES ${rows.join(', ')}` + onConflict + this._returning(params.returning) @@ -226,19 +244,26 @@ export class QueryBuilder { } return ( - `UPDATE ${this._onConflict(params.onConflict)}${params.tableName} SET ${set.join(', ')}` + + `UPDATE ${this._onConflict(params.onConflict)}${params.tableName} + SET ${set.join(', ')}` + this._where(params.where?.conditions) + this._returning(params.returning) ) } _delete(params: Delete): string { - return `DELETE FROM ${params.tableName}` + this._where(params.where?.conditions) + this._returning(params.returning) + return ( + `DELETE + FROM ${params.tableName}` + + this._where(params.where?.conditions) + + this._returning(params.returning) + ) } _select(params: SelectAll): string { return ( - `SELECT ${this._fields(params.fields)} FROM ${params.tableName}` + + `SELECT ${this._fields(params.fields)} + FROM ${params.tableName}` + this._join(params.join) + this._where(params.where?.conditions) + this._groupBy(params.groupBy) + diff --git a/src/databases/d1.ts b/src/databases/d1.ts index 4b89a26..f448dc2 100644 --- a/src/databases/d1.ts +++ b/src/databases/d1.ts @@ -1,9 +1,9 @@ import { QueryBuilder } from '../Builder' import { FetchTypes } from '../enums' import { Query } from '../tools' -import { D1Result, D1ResultOne } from '../interfaces' +import { D1Result } from '../interfaces' -export class D1QB extends QueryBuilder { +export class D1QB extends QueryBuilder { public db: any constructor(db: any) { @@ -11,7 +11,7 @@ export class D1QB extends QueryBuilder { this.db = db } - async execute(query: Query): Promise { + async execute(query: Query) { let stmt = this.db.prepare(query.query) if (this._debugger) { @@ -44,7 +44,7 @@ export class D1QB extends QueryBuilder { return stmt.run() } - async batchExecute(queryArray: Query[]): Promise<(D1ResultOne | D1Result)[]> { + async batchExecute(queryArray: Query[]) { if (this._debugger) { console.log({ 'workers-qb': queryArray, diff --git a/src/databases/pg.ts b/src/databases/pg.ts index 6a4871c..ce98687 100644 --- a/src/databases/pg.ts +++ b/src/databases/pg.ts @@ -1,9 +1,9 @@ import { QueryBuilder } from '../Builder' import { FetchTypes } from '../enums' import { Query } from '../tools' -import { PGResult, PGResultOne } from '../interfaces' +import { PGResult } from '../interfaces' -export class PGQB extends QueryBuilder { +export class PGQB extends QueryBuilder { public db: any constructor(db: any) { @@ -20,7 +20,7 @@ export class PGQB extends QueryBuilder { await this.db.end() } - async execute(query: Query): Promise { + async execute(query: Query) { const queryString = query.query.replaceAll('?', '$') if (this._debugger) { diff --git a/src/workers-qb.ts b/src/index.ts similarity index 100% rename from src/workers-qb.ts rename to src/index.ts diff --git a/src/interfaces.ts b/src/interfaces.ts index efc4652..b052c19 100644 --- a/src/interfaces.ts +++ b/src/interfaces.ts @@ -1,20 +1,23 @@ import { ConflictTypes, FetchTypes, JoinTypes, OrderTypes } from './enums' import { Raw } from './tools' +import { IsEqual, Merge, Primitive, Simplify } from './typefest' -export interface Where { +export type DefaultObject = Record + +export type Where = { conditions: string | Array // TODO: enable named parameters Record - params?: (string | boolean | number | null)[] + params?: (string | boolean | number | null | Raw)[] } -export interface Join { +export type Join = { type?: string | JoinTypes table: string | SelectAll on: string alias?: string } -export interface SelectOne { +export type SelectOne = { tableName: string fields: string | Array where?: Where @@ -25,23 +28,23 @@ export interface SelectOne { offset?: number } -export interface RawQuery { +export type RawQuery = { query: string args?: (string | number | boolean | null | Raw)[] fetchType?: FetchTypes } -export interface SelectAll extends SelectOne { +export type SelectAll = SelectOne & { limit?: number } -export interface ConflictUpsert { +export type ConflictUpsert = { column: string | Array data: Record where?: Where } -export interface Insert { +export type Insert = { tableName: string data: | Record @@ -50,7 +53,7 @@ export interface Insert { onConflict?: string | ConflictTypes | ConflictUpsert } -export interface Update { +export type Update = { tableName: string data: Record where?: Where @@ -58,40 +61,40 @@ export interface Update { onConflict?: string | ConflictTypes } -export interface Delete { +export type Delete = { tableName: string where: Where returning?: string | Array } -export interface D1Result { - changes?: number - duration: number - last_row_id?: string | number - results?: Array> - served_by: string - success: boolean -} - -export interface D1ResultOne { +export type D1Result = { changes?: number duration: number last_row_id?: string | number - results?: Record served_by: string success: boolean } -export interface PGResult { +export type PGResult = { command: string lastRowId?: string | number rowCount: number - results?: Array> } -export interface PGResultOne { - command: string - lastRowId?: string | number - rowCount: number - results?: Record -} +export type ArrayResult = Merge }> +export type OneResult = Merge +export type EitherResult = Merge | Result }> + +// Types bellow are WIP to improve even more type hints for raw and insert queries +export type GetFetchValue = T extends { fetchType?: infer U } ? U : never +export type SwitchFetch = IsEqual extends true + ? ArrayResult + : IsEqual extends true + ? OneResult + : A + +export type FindResult = Simplify, A, B>> + +// raw(params: P): Query> { +// +// } diff --git a/src/tools.ts b/src/tools.ts index ae136d5..1e085a2 100644 --- a/src/tools.ts +++ b/src/tools.ts @@ -1,4 +1,4 @@ -import { FetchTypes } from 'enums' +import { FetchTypes } from './enums' export class Raw { public isRaw = true @@ -8,14 +8,14 @@ export class Raw { } } -export class Query { - executeMethod: (query: Query) => Promise +export class Query { + executeMethod: (query: Query) => Promise public query: string public arguments?: (string | number | boolean | null | Raw)[] public fetchType?: FetchTypes constructor( - executeMethod: (query: Query) => Promise, + executeMethod: (query: Query) => Promise, query: string, args?: (string | number | boolean | null | Raw)[], fetchType?: FetchTypes @@ -26,7 +26,7 @@ export class Query { this.fetchType = fetchType } - async execute(): Promise { + async execute(): Promise { return this.executeMethod(this) } } diff --git a/src/typefest.ts b/src/typefest.ts new file mode 100644 index 0000000..50c4ad5 --- /dev/null +++ b/src/typefest.ts @@ -0,0 +1,24 @@ +// Code taken from type-fest + +export type Primitive = null | undefined | string | number | boolean | symbol | bigint + +export type OmitIndexSignature = { + [KeyType in keyof ObjectType as {} extends Record ? never : KeyType]: ObjectType[KeyType] +} + +export type PickIndexSignature = { + [KeyType in keyof ObjectType as {} extends Record ? KeyType : never]: ObjectType[KeyType] +} + +export type Simplify = { [KeyType in keyof T]: T[KeyType] } & {} + +type SimpleMerge = { + [Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key] +} & Source + +export type Merge = Simplify< + SimpleMerge, PickIndexSignature> & + SimpleMerge, OmitIndexSignature> +> + +export type IsEqual = (() => G extends A ? 1 : 2) extends () => G extends B ? 1 : 2 ? true : false diff --git a/tests/builder/batch.test.ts b/tests/builder/batch.test.ts index 2085d67..75dcea8 100644 --- a/tests/builder/batch.test.ts +++ b/tests/builder/batch.test.ts @@ -18,6 +18,11 @@ describe('Batch Builder', () => { }), ]) - expect(db.batch).toHaveBeenCalledWith(['SELECT * FROM tableA LIMIT 1', 'SELECT * FROM tableB']) + expect(db.batch).toHaveBeenCalledWith([ + `SELECT * + FROM tableA LIMIT 1`, + `SELECT * + FROM tableB`, + ]) }) }) diff --git a/tests/builder/delete.test.ts b/tests/builder/delete.test.ts index 776e483..ac9c6db 100644 --- a/tests/builder/delete.test.ts +++ b/tests/builder/delete.test.ts @@ -1,4 +1,4 @@ -import { QuerybuilderTest } from '../utils' +import { QuerybuilderTest, trimQuery } from '../utils' describe('Delete Builder', () => { test('delete with one where without returning', async () => { @@ -10,7 +10,7 @@ describe('Delete Builder', () => { }, }) - expect(result.query).toEqual('DELETE FROM testTable WHERE field = ?1') + expect(trimQuery(result.query)).toEqual('DELETE FROM testTable WHERE field = ?1') expect(result.arguments).toEqual(['test']) expect(result.fetchType).toEqual('ALL') }) @@ -24,7 +24,7 @@ describe('Delete Builder', () => { }, }) - expect(result.query).toEqual('DELETE FROM testTable WHERE field = ?1 AND id = ?2') + expect(trimQuery(result.query)).toEqual('DELETE FROM testTable WHERE field = ?1 AND id = ?2') expect(result.arguments).toEqual(['test', 123]) expect(result.fetchType).toEqual('ALL') }) @@ -39,7 +39,7 @@ describe('Delete Builder', () => { returning: 'id', }) - expect(result.query).toEqual('DELETE FROM testTable WHERE field = ?1 AND id = ?2 RETURNING id') + expect(trimQuery(result.query)).toEqual('DELETE FROM testTable WHERE field = ?1 AND id = ?2 RETURNING id') expect(result.arguments).toEqual(['test', 123]) expect(result.fetchType).toEqual('ALL') }) @@ -54,7 +54,7 @@ describe('Delete Builder', () => { returning: ['id', 'field'], }) - expect(result.query).toEqual('DELETE FROM testTable WHERE field = ?1 AND id = ?2 RETURNING id, field') + expect(trimQuery(result.query)).toEqual('DELETE FROM testTable WHERE field = ?1 AND id = ?2 RETURNING id, field') expect(result.arguments).toEqual(['test', 123]) expect(result.fetchType).toEqual('ALL') }) diff --git a/tests/builder/insert.test.ts b/tests/builder/insert.test.ts index d65cc1c..2de2356 100644 --- a/tests/builder/insert.test.ts +++ b/tests/builder/insert.test.ts @@ -1,4 +1,4 @@ -import { QuerybuilderTest } from '../utils' +import { QuerybuilderTest, trimQuery } from '../utils' import { ConflictTypes } from '../../src/enums' import { Raw } from '../../src/tools' @@ -11,7 +11,7 @@ describe('Insert Builder', () => { }, }) - expect(result.query).toEqual('INSERT INTO testTable (my_field) VALUES (?1)') + expect(trimQuery(result.query)).toEqual('INSERT INTO testTable (my_field) VALUES (?1)') expect(result.arguments).toEqual(['test']) expect(result.fetchType).toEqual('ONE') }) @@ -25,7 +25,9 @@ describe('Insert Builder', () => { }, }) - expect(result.query).toEqual('INSERT INTO testTable (my_field, created_at) VALUES (?1, CURRENT_TIMESTAMP)') + expect(trimQuery(result.query)).toEqual( + 'INSERT INTO testTable (my_field, created_at) VALUES (?1, CURRENT_TIMESTAMP)' + ) expect(result.arguments).toEqual(['test']) expect(result.fetchType).toEqual('ONE') }) @@ -39,7 +41,7 @@ describe('Insert Builder', () => { }, }) - expect(result.query).toEqual('INSERT INTO testTable (my_field, another) VALUES (?1, ?2)') + expect(trimQuery(result.query)).toEqual('INSERT INTO testTable (my_field, another) VALUES (?1, ?2)') expect(result.arguments).toEqual(['test', 123]) expect(result.fetchType).toEqual('ONE') }) @@ -54,7 +56,7 @@ describe('Insert Builder', () => { returning: 'id', }) - expect(result.query).toEqual('INSERT INTO testTable (my_field, another) VALUES (?1, ?2) RETURNING id') + expect(trimQuery(result.query)).toEqual('INSERT INTO testTable (my_field, another) VALUES (?1, ?2) RETURNING id') expect(result.arguments).toEqual(['test', 123]) expect(result.fetchType).toEqual('ONE') }) @@ -69,7 +71,9 @@ describe('Insert Builder', () => { returning: ['id', 'my_field'], }) - expect(result.query).toEqual('INSERT INTO testTable (my_field, another) VALUES (?1, ?2) RETURNING id, my_field') + expect(trimQuery(result.query)).toEqual( + 'INSERT INTO testTable (my_field, another) VALUES (?1, ?2) RETURNING id, my_field' + ) expect(result.arguments).toEqual(['test', 123]) expect(result.fetchType).toEqual('ONE') }) @@ -85,7 +89,7 @@ describe('Insert Builder', () => { onConflict: ConflictTypes.IGNORE, }) - expect(result.query).toEqual( + expect(trimQuery(result.query)).toEqual( 'INSERT OR IGNORE INTO testTable (my_field, another) VALUES (?1, ?2) RETURNING id, my_field' ) expect(result.arguments).toEqual(['test', 123]) @@ -103,7 +107,7 @@ describe('Insert Builder', () => { onConflict: 'REPLACE', }) - expect(result.query).toEqual( + expect(trimQuery(result.query)).toEqual( 'INSERT OR REPLACE INTO testTable (my_field, another) VALUES (?1, ?2) RETURNING id, my_field' ) expect(result.arguments).toEqual(['test', 123]) @@ -131,7 +135,7 @@ describe('Insert Builder', () => { onConflict: 'REPLACE', }) - expect(result.query).toEqual( + expect(trimQuery(result.query)).toEqual( 'INSERT OR REPLACE INTO testTable (my_field, another) VALUES (?1, ?2), (?3, ?4), (?5, ?6) RETURNING id, my_field' ) expect(result.arguments).toEqual(['test1', 123, 'test2', 456, 'test3', 789]) @@ -155,7 +159,7 @@ describe('Insert Builder', () => { }, }) - expect(result.query).toEqual( + expect(trimQuery(result.query)).toEqual( 'INSERT INTO phonebook2 (name, phonenumber, validDate) VALUES (?3, ?4, ?5) ON CONFLICT (name) DO ' + 'UPDATE SET phonenumber = ?1, validDate = ?2' ) @@ -190,7 +194,7 @@ describe('Insert Builder', () => { }, }) - expect(result.query).toEqual( + expect(trimQuery(result.query)).toEqual( 'INSERT INTO phonebook2 (name, phonenumber, validDate) VALUES (?4, ?5, ?6) ON CONFLICT (name) DO ' + 'UPDATE SET phonenumber = ?2, validDate = ?3 WHERE excluded.validDate > ?1' ) @@ -225,7 +229,7 @@ describe('Insert Builder', () => { }, }) - expect(result.query).toEqual( + expect(trimQuery(result.query)).toEqual( 'INSERT INTO phonebook2 (name, phonenumber, validDate) VALUES (?3, ?4, ?5) ON CONFLICT (name) DO ' + 'UPDATE SET phonenumber = ?1, validDate = ?2 WHERE excluded.validDate > phonebook2.validDate' ) @@ -260,7 +264,7 @@ describe('Insert Builder', () => { }, }) - expect(result.query).toEqual( + expect(trimQuery(result.query)).toEqual( 'INSERT INTO phonebook2 (name, phonenumber, validDate) VALUES (?2, ?3, ?4) ON CONFLICT (name) DO ' + 'UPDATE SET phonenumber = excluded.phonenumber, validDate = excluded.validDate WHERE excluded.validDate > ?1' ) @@ -287,7 +291,7 @@ describe('Insert Builder', () => { }, }) - expect(result.query).toEqual( + expect(trimQuery(result.query)).toEqual( 'INSERT INTO phonebook2 (name, phonenumber, validDate) VALUES (?1, ?2, ?3) ON CONFLICT (name, phonenumber) DO ' + 'UPDATE SET validDate = excluded.validDate WHERE excluded.validDate > phonebook2.validDate' ) diff --git a/tests/builder/select.test.ts b/tests/builder/select.test.ts index e2e9e25..0064058 100644 --- a/tests/builder/select.test.ts +++ b/tests/builder/select.test.ts @@ -1,4 +1,4 @@ -import { QuerybuilderTest } from '../utils' +import { QuerybuilderTest, trimQuery } from '../utils' import { JoinTypes, OrderTypes } from '../../src/enums' describe('Select Builder', () => { @@ -8,7 +8,7 @@ describe('Select Builder', () => { fields: '*', }) - expect(result.query).toEqual('SELECT * FROM testTable') + expect(trimQuery(result.query)).toEqual('SELECT * FROM testTable') expect(result.arguments).toBeUndefined() expect(result.fetchType).toEqual('ALL') }) @@ -23,7 +23,7 @@ describe('Select Builder', () => { }, }) - expect(result.query).toEqual('SELECT * FROM testTable WHERE field = ?1 LIMIT 1') + expect(trimQuery(result.query)).toEqual('SELECT * FROM testTable WHERE field = ?1 LIMIT 1') expect(result.arguments).toEqual(['test']) expect(result.fetchType).toEqual('ONE') }) @@ -42,7 +42,7 @@ describe('Select Builder', () => { }, }) - expect(result.query).toEqual( + expect(trimQuery(result.query)).toEqual( 'SELECT * FROM testTable JOIN employees ON testTable.employee_id = employees.id ' + 'WHERE field = ?1' ) expect(result.arguments).toEqual(['test']) @@ -69,7 +69,7 @@ describe('Select Builder', () => { ], }) - expect(result.query).toEqual( + expect(trimQuery(result.query)).toEqual( 'SELECT * FROM testTable' + ' JOIN employees ON testTable.employee_id = employees.id' + ' JOIN offices ON testTable.office_id = offices.id' + @@ -94,7 +94,7 @@ describe('Select Builder', () => { }, }) - expect(result.query).toEqual( + expect(trimQuery(result.query)).toEqual( 'SELECT * FROM testTable LEFT JOIN employees ON testTable.employee_id = employees.id WHERE field = ?1' ) expect(result.arguments).toEqual(['test']) @@ -120,7 +120,7 @@ describe('Select Builder', () => { }, }) - expect(result.query).toEqual( + expect(trimQuery(result.query)).toEqual( 'SELECT * FROM testTable JOIN (SELECT test_table_id, GROUP_CONCAT(attribute) ' + 'AS attributes FROM otherTable GROUP BY test_table_id) AS otherTableGrouped ON testTable.id = otherTableGrouped.' + 'test_table_id WHERE field = ?1' @@ -161,7 +161,7 @@ describe('Select Builder', () => { }, }) - expect(result.query).toEqual( + expect(trimQuery(result.query)).toEqual( 'SELECT * FROM testTable JOIN (SELECT test_table_id, GROUP_CONCAT(attribute) ' + 'AS attributes, GROUP_CONCAT(other_attributes, ";") AS other_attributes FROM otherTable JOIN ' + '(SELECT other_table_id, GROUP_CONCAT(other_attribute) AS other_attributes FROM otherTableTwo ' + @@ -181,7 +181,7 @@ describe('Select Builder', () => { }, }) - expect(result.query).toEqual("SELECT * FROM testTable WHERE field = 'test' LIMIT 1") + expect(trimQuery(result.query)).toEqual("SELECT * FROM testTable WHERE field = 'test' LIMIT 1") expect(result.arguments).toBeUndefined() expect(result.fetchType).toEqual('ONE') }) @@ -196,7 +196,7 @@ describe('Select Builder', () => { }, }) - expect(result.query).toEqual('SELECT * FROM testTable WHERE field = ?1 AND test = ?2') + expect(trimQuery(result.query)).toEqual('SELECT * FROM testTable WHERE field = ?1 AND test = ?2') expect(result.arguments).toEqual(['test', 123]) expect(result.fetchType).toEqual('ALL') }) @@ -212,7 +212,7 @@ describe('Select Builder', () => { groupBy: 'type', }) - expect(result.query).toEqual('SELECT * FROM testTable WHERE field = ?1 AND test = ?2 GROUP BY type') + expect(trimQuery(result.query)).toEqual('SELECT * FROM testTable WHERE field = ?1 AND test = ?2 GROUP BY type') expect(result.arguments).toEqual(['test', 123]) expect(result.fetchType).toEqual('ALL') }) @@ -228,7 +228,7 @@ describe('Select Builder', () => { groupBy: ['type', 'day'], }) - expect(result.query).toEqual('SELECT * FROM testTable WHERE field = ?1 AND test = ?2 GROUP BY type, day') + expect(trimQuery(result.query)).toEqual('SELECT * FROM testTable WHERE field = ?1 AND test = ?2 GROUP BY type, day') expect(result.arguments).toEqual(['test', 123]) expect(result.fetchType).toEqual('ALL') }) @@ -245,7 +245,7 @@ describe('Select Builder', () => { having: 'COUNT(trackid) > 15', }) - expect(result.query).toEqual( + expect(trimQuery(result.query)).toEqual( 'SELECT * FROM testTable WHERE field = ?1 AND test = ?2 GROUP BY type HAVING COUNT(trackid) > 15' ) expect(result.arguments).toEqual(['test', 123]) @@ -264,7 +264,9 @@ describe('Select Builder', () => { orderBy: 'id', }) - expect(result.query).toEqual('SELECT * FROM testTable WHERE field = ?1 AND test = ?2 GROUP BY type ORDER BY id') + expect(trimQuery(result.query)).toEqual( + 'SELECT * FROM testTable WHERE field = ?1 AND test = ?2 GROUP BY type ORDER BY id' + ) expect(result.arguments).toEqual(['test', 123]) expect(result.fetchType).toEqual('ALL') }) @@ -281,7 +283,7 @@ describe('Select Builder', () => { orderBy: ['id', 'timestamp'], }) - expect(result.query).toEqual( + expect(trimQuery(result.query)).toEqual( 'SELECT * FROM testTable WHERE field = ?1 AND test = ?2 GROUP BY type ORDER BY id, timestamp' ) expect(result.arguments).toEqual(['test', 123]) @@ -303,7 +305,7 @@ describe('Select Builder', () => { }, }) - expect(result.query).toEqual( + expect(trimQuery(result.query)).toEqual( 'SELECT * FROM testTable WHERE field = ?1 AND test = ?2 GROUP BY type ORDER BY id ASC, timestamp DESC' ) expect(result.arguments).toEqual(['test', 123]) @@ -323,7 +325,7 @@ describe('Select Builder', () => { offset: 15, }) - expect(result.query).toEqual( + expect(trimQuery(result.query)).toEqual( 'SELECT * FROM testTable WHERE field = ?1 AND test = ?2 GROUP BY type LIMIT 10 OFFSET 15' ) expect(result.arguments).toEqual(['test', 123]) diff --git a/tests/builder/update.test.ts b/tests/builder/update.test.ts index 89d86fb..9a0aad9 100644 --- a/tests/builder/update.test.ts +++ b/tests/builder/update.test.ts @@ -1,4 +1,4 @@ -import { QuerybuilderTest } from '../utils' +import { QuerybuilderTest, trimQuery } from '../utils' import { ConflictTypes } from '../../src/enums' import { Raw } from '../../src/tools' @@ -15,7 +15,7 @@ describe('Update Builder', () => { }, }) - expect(result.query).toEqual('UPDATE testTable SET my_field = ?2 WHERE field = ?1') + expect(trimQuery(result.query)).toEqual('UPDATE testTable SET my_field = ?2 WHERE field = ?1') expect(result.arguments).toEqual(['test_where', 'test_data']) expect(result.fetchType).toEqual('ALL') }) @@ -34,7 +34,7 @@ describe('Update Builder', () => { }, }) - expect(result.query).toEqual( + expect(trimQuery(result.query)).toEqual( 'UPDATE testTable SET my_field = ?2, updated_at = CURRENT_TIMESTAMP, another = ?3 WHERE field = ?1' ) expect(result.arguments).toEqual(['test_where', 'test_data', '123']) @@ -53,7 +53,7 @@ describe('Update Builder', () => { }, }) - expect(result.query).toEqual('UPDATE testTable SET my_field = ?2 WHERE field = ?1') + expect(trimQuery(result.query)).toEqual('UPDATE testTable SET my_field = ?2 WHERE field = ?1') expect(result.arguments).toEqual(['test', 'test_update']) expect(result.fetchType).toEqual('ALL') }) @@ -71,7 +71,7 @@ describe('Update Builder', () => { }, }) - expect(result.query).toEqual('UPDATE testTable SET my_field = ?2, another = ?3 WHERE field = ?1') + expect(trimQuery(result.query)).toEqual('UPDATE testTable SET my_field = ?2, another = ?3 WHERE field = ?1') expect(result.arguments).toEqual(['test', 'test_update', 123]) expect(result.fetchType).toEqual('ALL') }) @@ -89,7 +89,9 @@ describe('Update Builder', () => { }, }) - expect(result.query).toEqual('UPDATE testTable SET my_field = ?3, another = ?4 WHERE field = ?1 AND id = ?2') + expect(trimQuery(result.query)).toEqual( + 'UPDATE testTable SET my_field = ?3, another = ?4 WHERE field = ?1 AND id = ?2' + ) expect(result.arguments).toEqual(['test', 345, 'test_update', 123]) expect(result.fetchType).toEqual('ALL') }) @@ -108,7 +110,7 @@ describe('Update Builder', () => { returning: 'id', }) - expect(result.query).toEqual( + expect(trimQuery(result.query)).toEqual( 'UPDATE testTable SET my_field = ?3, another = ?4 WHERE field = ?1 AND id = ?2 RETURNING id' ) expect(result.arguments).toEqual(['test', 345, 'test_update', 123]) @@ -129,7 +131,7 @@ describe('Update Builder', () => { returning: ['id', 'field'], }) - expect(result.query).toEqual( + expect(trimQuery(result.query)).toEqual( 'UPDATE testTable SET my_field = ?3, another = ?4 WHERE field = ?1 AND id = ?2 RETURNING id, field' ) expect(result.arguments).toEqual(['test', 345, 'test_update', 123]) @@ -151,7 +153,7 @@ describe('Update Builder', () => { onConflict: ConflictTypes.IGNORE, }) - expect(result.query).toEqual( + expect(trimQuery(result.query)).toEqual( 'UPDATE OR IGNORE testTable SET my_field = ?3, another = ?4 WHERE field = ?1 AND id = ?2 RETURNING id, field' ) expect(result.arguments).toEqual(['test', 345, 'test_update', 123]) @@ -173,7 +175,7 @@ describe('Update Builder', () => { onConflict: 'REPLACE', }) - expect(result.query).toEqual( + expect(trimQuery(result.query)).toEqual( 'UPDATE OR REPLACE testTable SET my_field = ?3, another = ?4 WHERE field = ?1 AND id = ?2 RETURNING id, field' ) expect(result.arguments).toEqual(['test', 345, 'test_update', 123]) diff --git a/tests/utils.ts b/tests/utils.ts index 6087f59..2c95655 100644 --- a/tests/utils.ts +++ b/tests/utils.ts @@ -1,9 +1,9 @@ import { QueryBuilder } from '../src/Builder' import { Query } from '../src/tools' -import { D1Result, D1ResultOne } from '../src/interfaces' +import { D1Result } from '../src/interfaces' -export class QuerybuilderTest extends QueryBuilder { - async execute(query: Query): Promise { +export class QuerybuilderTest extends QueryBuilder { + async execute(query: Query) { return { duration: 0, success: true, @@ -11,3 +11,7 @@ export class QuerybuilderTest extends QueryBuilder { } } } + +export function trimQuery(query: string): string { + return query.replace(/\s\s+/g, ' ') +} diff --git a/tools/packagejson.js b/tools/packagejson.cjs similarity index 100% rename from tools/packagejson.js rename to tools/packagejson.cjs diff --git a/tsconfig.json b/tsconfig.json index 99d5791..aecd4ea 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -18,7 +18,7 @@ "strict": true, "traceResolution": false, "module": "esnext", - "outDir": "dist/mjs", + "outDir": "dist", "target": "esnext" }, "exclude": ["node_modules", "dist"],