diff --git a/.gitignore b/.gitignore index 24f6ccb..3999fd7 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ .antlr .idea node_modules -.DS_Store \ No newline at end of file +.DS_Store +release diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..449691b --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +save-exact=true \ No newline at end of file diff --git a/esbuild.package.js b/esbuild.package.js index 189f557..09709dc 100644 --- a/esbuild.package.js +++ b/esbuild.package.js @@ -2,6 +2,7 @@ const fs = require('fs'); const path = require('path'); const esbuild = require('esbuild'); const { clean } = require('esbuild-plugin-clean'); +const { copy } = require('esbuild-plugin-copy'); const { copyFolderFiles, addReleaseFlag } = require('@hackolade/hck-esbuild-plugins-pack'); const { EXCLUDED_EXTENSIONS, EXCLUDED_FILES, DEFAULT_RELEASE_FOLDER_PATH } = require('./buildConstants'); @@ -21,10 +22,17 @@ esbuild outdir: RELEASE_FOLDER_PATH, minify: true, logLevel: 'info', + external: ['lodash', 'electron'], plugins: [ clean({ patterns: [DEFAULT_RELEASE_FOLDER_PATH], }), + copy({ + assets: { + from: [path.join('node_modules', 'lodash', '**', '*')], + to: [path.join('node_modules', 'lodash')], + }, + }), copyFolderFiles({ fromPath: __dirname, targetFolderPath: RELEASE_FOLDER_PATH, diff --git a/package-lock.json b/package-lock.json index e83140f..2457cf2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,13 +1,14 @@ { "name": "CouchbaseV7Plus", - "version": "0.2.1", + "version": "0.2.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "CouchbaseV7Plus", - "version": "0.2.1", + "version": "0.2.3", "dependencies": { + "@hackolade/fetch": "1.1.0", "antlr4": "4.9.2", "async": "3.2.5", "exponential-backoff": "3.1.1", @@ -21,10 +22,11 @@ "@typescript-eslint/parser": "7.11.0", "esbuild": "0.20.2", "esbuild-plugin-clean": "1.0.1", + "esbuild-plugin-copy": "2.1.1", "eslint": "8.57.0", "eslint-config-prettier": "9.1.0", - "eslint-formatter-teamcity": "^1.0.0", - "eslint-plugin-import": "^2.26.0", + "eslint-formatter-teamcity": "1.0.0", + "eslint-plugin-import": "2.26.0", "eslint-plugin-prettier": "5.1.3", "eslint-plugin-unused-imports": "3.2.0", "lint-staged": "14.0.1", @@ -482,6 +484,17 @@ "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, + "node_modules/@hackolade/fetch": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@hackolade/fetch/-/fetch-1.1.0.tgz", + "integrity": "sha512-P6VoXDh5yAjwC7oVKqhkxMs53Qv07CVJLw69wsRgJkKvpBpkKpDRZM3dQ4uExtwwsrxGk3b4gxANUb7IHFffDQ==", + "dependencies": { + "@smithy/fetch-http-handler": "4.0.0", + "@smithy/protocol-http": "4.1.5", + "@smithy/querystring-builder": "3.0.8", + "@smithy/types": "3.6.0" + } + }, "node_modules/@hackolade/hck-esbuild-plugins-pack": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/@hackolade/hck-esbuild-plugins-pack/-/hck-esbuild-plugins-pack-0.0.1.tgz", @@ -598,6 +611,113 @@ "url": "https://opencollective.com/unts" } }, + "node_modules/@smithy/fetch-http-handler": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@smithy/fetch-http-handler/-/fetch-http-handler-4.0.0.tgz", + "integrity": "sha512-MLb1f5tbBO2X6K4lMEKJvxeLooyg7guq48C2zKr4qM7F2Gpkz4dc+hdSgu77pCJ76jVqFBjZczHYAs6dp15N+g==", + "dependencies": { + "@smithy/protocol-http": "^4.1.5", + "@smithy/querystring-builder": "^3.0.8", + "@smithy/types": "^3.6.0", + "@smithy/util-base64": "^3.0.0", + "tslib": "^2.6.2" + } + }, + "node_modules/@smithy/is-array-buffer": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@smithy/is-array-buffer/-/is-array-buffer-3.0.0.tgz", + "integrity": "sha512-+Fsu6Q6C4RSJiy81Y8eApjEB5gVtM+oFKTffg+jSuwtvomJJrhUJBu2zS8wjXSgH/g1MKEWrzyChTBe6clb5FQ==", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@smithy/protocol-http": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/@smithy/protocol-http/-/protocol-http-4.1.5.tgz", + "integrity": "sha512-hsjtwpIemmCkm3ZV5fd/T0bPIugW1gJXwZ/hpuVubt2hEUApIoUTrf6qIdh9MAWlw0vjMrA1ztJLAwtNaZogvg==", + "dependencies": { + "@smithy/types": "^3.6.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@smithy/querystring-builder": { + "version": "3.0.8", + "resolved": "https://registry.npmjs.org/@smithy/querystring-builder/-/querystring-builder-3.0.8.tgz", + "integrity": "sha512-btYxGVqFUARbUrN6VhL9c3dnSviIwBYD9Rz1jHuN1hgh28Fpv2xjU1HeCeDJX68xctz7r4l1PBnFhGg1WBBPuA==", + "dependencies": { + "@smithy/types": "^3.6.0", + "@smithy/util-uri-escape": "^3.0.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@smithy/types": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/@smithy/types/-/types-3.6.0.tgz", + "integrity": "sha512-8VXK/KzOHefoC65yRgCn5vG1cysPJjHnOVt9d0ybFQSmJgQj152vMn4EkYhGuaOmnnZvCPav/KnYyE6/KsNZ2w==", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@smithy/util-base64": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@smithy/util-base64/-/util-base64-3.0.0.tgz", + "integrity": "sha512-Kxvoh5Qtt0CDsfajiZOCpJxgtPHXOKwmM+Zy4waD43UoEMA+qPxxa98aE/7ZhdnBFZFXMOiBR5xbcaMhLtznQQ==", + "dependencies": { + "@smithy/util-buffer-from": "^3.0.0", + "@smithy/util-utf8": "^3.0.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@smithy/util-buffer-from": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@smithy/util-buffer-from/-/util-buffer-from-3.0.0.tgz", + "integrity": "sha512-aEOHCgq5RWFbP+UDPvPot26EJHjOC+bRgse5A8V3FSShqd5E5UN4qc7zkwsvJPPAVsf73QwYcHN1/gt/rtLwQA==", + "dependencies": { + "@smithy/is-array-buffer": "^3.0.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@smithy/util-uri-escape": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@smithy/util-uri-escape/-/util-uri-escape-3.0.0.tgz", + "integrity": "sha512-LqR7qYLgZTD7nWLBecUi4aqolw8Mhza9ArpNEQ881MJJIU2sE5iHCK6TdyqqzcDLy0OPe10IY4T8ctVdtynubg==", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@smithy/util-utf8": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@smithy/util-utf8/-/util-utf8-3.0.0.tgz", + "integrity": "sha512-rUeT12bxFnplYDe815GXbq/oixEGHfRFFtcTF3YdDi/JaENIM6aSYYLJydG83UNzLXeRI5K8abYd/8Sp/QM0kA==", + "dependencies": { + "@smithy/util-buffer-from": "^3.0.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, "node_modules/@types/json5": { "version": "0.0.29", "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", @@ -904,6 +1024,19 @@ "node": ">=14" } }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/argparse": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", @@ -955,26 +1088,6 @@ "node": ">=8" } }, - "node_modules/array.prototype.findlastindex": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/array.prototype.findlastindex/-/array.prototype.findlastindex-1.2.5.tgz", - "integrity": "sha512-zfETvRFA8o7EiNn++N5f/kaCw221hrpGsDmcpndVupkPzEc1Wuf3VgC0qby1BbHs7f5DVYjgtEU2LLh5bqeGfQ==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.7", - "define-properties": "^1.2.1", - "es-abstract": "^1.23.2", - "es-errors": "^1.3.0", - "es-object-atoms": "^1.0.0", - "es-shim-unscopables": "^1.0.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/array.prototype.flat": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.2.tgz", @@ -993,24 +1106,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/array.prototype.flatmap": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/array.prototype.flatmap/-/array.prototype.flatmap-1.3.2.tgz", - "integrity": "sha512-Ewyx0c9PmpcsByhSW4r+9zDU7sGjFc86qf/kKtuSCRdhfbk0SNLLkaT5qvcHnRGgc5NP/ly/y+qkXkqONX54CQ==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1", - "es-shim-unscopables": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/arraybuffer.prototype.slice": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.3.tgz", @@ -1059,6 +1154,18 @@ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "dev": true }, + "node_modules/binary-extensions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", + "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/brace-expansion": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", @@ -1124,6 +1231,42 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, + "node_modules/chokidar": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", + "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", + "dev": true, + "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" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/chokidar/node_modules/glob-parent": { + "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" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/clean-stack": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", @@ -1575,6 +1718,35 @@ "esbuild": ">= 0.14.0" } }, + "node_modules/esbuild-plugin-copy": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/esbuild-plugin-copy/-/esbuild-plugin-copy-2.1.1.tgz", + "integrity": "sha512-Bk66jpevTcV8KMFzZI1P7MZKZ+uDcrZm2G2egZ2jNIvVnivDpodZI+/KnpL3Jnap0PBdIHU7HwFGB8r+vV5CVw==", + "dev": true, + "dependencies": { + "chalk": "^4.1.2", + "chokidar": "^3.5.3", + "fs-extra": "^10.0.1", + "globby": "^11.0.3" + }, + "peerDependencies": { + "esbuild": ">= 0.14.0" + } + }, + "node_modules/esbuild-plugin-copy/node_modules/fs-extra": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", + "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", + "dev": true, + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=12" + } + }, "node_modules/escape-string-regexp": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", @@ -1724,28 +1896,24 @@ } }, "node_modules/eslint-plugin-import": { - "version": "2.29.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.29.1.tgz", - "integrity": "sha512-BbPC0cuExzhiMo4Ff1BTVwHpjjv28C5R+btTOGaCRC7UEz801up0JadwkeSk5Ued6TG34uaczuVuH6qyy5YUxw==", + "version": "2.26.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.26.0.tgz", + "integrity": "sha512-hYfi3FXaM8WPLf4S1cikh/r4IxnO6zrhZbEGz2b660EJRbuxgpDS5gkCuYgGWg2xxh2rBuIr4Pvhve/7c31koA==", "dev": true, "dependencies": { - "array-includes": "^3.1.7", - "array.prototype.findlastindex": "^1.2.3", - "array.prototype.flat": "^1.3.2", - "array.prototype.flatmap": "^1.3.2", - "debug": "^3.2.7", + "array-includes": "^3.1.4", + "array.prototype.flat": "^1.2.5", + "debug": "^2.6.9", "doctrine": "^2.1.0", - "eslint-import-resolver-node": "^0.3.9", - "eslint-module-utils": "^2.8.0", - "hasown": "^2.0.0", - "is-core-module": "^2.13.1", + "eslint-import-resolver-node": "^0.3.6", + "eslint-module-utils": "^2.7.3", + "has": "^1.0.3", + "is-core-module": "^2.8.1", "is-glob": "^4.0.3", "minimatch": "^3.1.2", - "object.fromentries": "^2.0.7", - "object.groupby": "^1.0.1", - "object.values": "^1.1.7", - "semver": "^6.3.1", - "tsconfig-paths": "^3.15.0" + "object.values": "^1.1.5", + "resolve": "^1.22.0", + "tsconfig-paths": "^3.14.1" }, "engines": { "node": ">=4" @@ -1765,12 +1933,12 @@ } }, "node_modules/eslint-plugin-import/node_modules/debug": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", - "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", "dev": true, "dependencies": { - "ms": "^2.1.1" + "ms": "2.0.0" } }, "node_modules/eslint-plugin-import/node_modules/doctrine": { @@ -1797,14 +1965,11 @@ "node": "*" } }, - "node_modules/eslint-plugin-import/node_modules/semver": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", - "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", - "dev": true, - "bin": { - "semver": "bin/semver.js" - } + "node_modules/eslint-plugin-import/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "dev": true }, "node_modules/eslint-plugin-prettier": { "version": "5.1.3", @@ -2159,6 +2324,20 @@ "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", "dev": true }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, "node_modules/function-bind": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", @@ -2373,6 +2552,15 @@ "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", "dev": true }, + "node_modules/has": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.4.tgz", + "integrity": "sha512-qdSAmqLF6209RFj4VVItywPMbm3vWylknmB3nvNiUIs72xAimcM8nVYxYr7ncvZq5qzk9MKIZR8ijqD/1QuYjQ==", + "dev": true, + "engines": { + "node": ">= 0.4.0" + } + }, "node_modules/has-bigints": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz", @@ -2565,6 +2753,18 @@ "url": "https://github.com/sponsors/ljharb" } }, + "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==", + "dev": true, + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/is-boolean-object": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz", @@ -3131,6 +3331,15 @@ "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", "dev": true }, + "node_modules/normalize-path": { + "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" + } + }, "node_modules/npm-run-path": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.3.0.tgz", @@ -3194,38 +3403,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/object.fromentries": { - "version": "2.0.8", - "resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.8.tgz", - "integrity": "sha512-k6E21FzySsSK5a21KRADBd/NGneRegFO5pLHfdQLpRDETUNJueLXs3WCzyQ3tFRDYgbq3KHGXfTbi2bs8WQ6rQ==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.7", - "define-properties": "^1.2.1", - "es-abstract": "^1.23.2", - "es-object-atoms": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/object.groupby": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/object.groupby/-/object.groupby-1.0.3.tgz", - "integrity": "sha512-+Lhy3TQTuzXI5hevh8sBGqbmurHbbIjAi0Z4S63nthVLmLxfbj4T54a4CfZrXIrt9iP4mVAPYMo/v99taj3wjQ==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.7", - "define-properties": "^1.2.1", - "es-abstract": "^1.23.2" - }, - "engines": { - "node": ">= 0.4" - } - }, "node_modules/object.values": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.2.0.tgz", @@ -3493,6 +3670,18 @@ "node": ">=4" } }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, "node_modules/regexp.prototype.flags": { "version": "1.5.2", "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.2.tgz", @@ -4043,8 +4232,7 @@ "node_modules/tslib": { "version": "2.6.3", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.3.tgz", - "integrity": "sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==", - "dev": true + "integrity": "sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==" }, "node_modules/type-check": { "version": "0.4.0", diff --git a/package.json b/package.json index ab167b3..d7a7385 100644 --- a/package.json +++ b/package.json @@ -32,6 +32,7 @@ "package": "node esbuild.package.js" }, "dependencies": { + "@hackolade/fetch": "1.1.0", "antlr4": "4.9.2", "async": "3.2.5", "exponential-backoff": "3.1.1", @@ -41,18 +42,19 @@ }, "devDependencies": { "@hackolade/hck-esbuild-plugins-pack": "0.0.1", - "@typescript-eslint/parser": "7.11.0", "@typescript-eslint/eslint-plugin": "7.11.0", + "@typescript-eslint/parser": "7.11.0", "esbuild": "0.20.2", "esbuild-plugin-clean": "1.0.1", + "esbuild-plugin-copy": "2.1.1", "eslint": "8.57.0", "eslint-config-prettier": "9.1.0", - "eslint-formatter-teamcity": "^1.0.0", - "eslint-plugin-import": "^2.26.0", + "eslint-formatter-teamcity": "1.0.0", + "eslint-plugin-import": "2.26.0", "eslint-plugin-prettier": "5.1.3", "eslint-plugin-unused-imports": "3.2.0", "lint-staged": "14.0.1", "prettier": "3.2.5", "simple-git-hooks": "2.11.1" } -} \ No newline at end of file +} diff --git a/reverse_engineering/api.js b/reverse_engineering/api.js index 37a6223..725020c 100644 --- a/reverse_engineering/api.js +++ b/reverse_engineering/api.js @@ -120,7 +120,7 @@ const getDbCollectionsNames = async (connectionInfo, appLogger, callback, app) = try { const cluster = await connectionHelper.connect({ connectionInfo, app }); - const documents = await clusterHelper.getDbCollectionsNames({ connectionInfo, cluster, logger, app }); + const documents = await clusterHelper.getDbCollectionsNames({ connectionInfo, cluster, logger }); callback(null, documents); } catch (error) { @@ -150,7 +150,7 @@ const getDbCollectionsData = async (data, appLogger, callback, app) => { const collections = data.collectionData.collections; const modelInfo = connectionHelper.getConnectionInfo(); const cluster = await connectionHelper.connect({ connectionInfo, app }); - const indexes = await indexHelper.getIndexes({ cluster, connectionInfo, logger, app }); + const indexes = await indexHelper.getIndexes({ cluster, connectionInfo, logger }); const indexesByCollectionMap = indexHelper.getIndexesByCollectionMap({ indexes }); const dbCollectionsData = []; @@ -166,7 +166,6 @@ const getDbCollectionsData = async (data, appLogger, callback, app) => { collectionIndexes, includeEmptyCollection, logger, - app, }); dbCollectionsData.push(dbCollectionData); diff --git a/reverse_engineering/helpers/indexHelper.js b/reverse_engineering/helpers/indexHelper.js index 552e7a8..2305f2e 100644 --- a/reverse_engineering/helpers/indexHelper.js +++ b/reverse_engineering/helpers/indexHelper.js @@ -72,7 +72,7 @@ const getKeysAndExpression = index => { }; const checkKeySimple = key => { - return /^\`.*?\`$/.test(key) || /^\(\`.*?\`\)$/.test(key); + return /^`.*?`$/.test(key) || /^\(`.*?`\)$/.test(key); }; const getExpression = key => { @@ -86,7 +86,7 @@ const getExpression = key => { const getSimpleKey = key => { const isDescending = key.endsWith('DESC'); const keyName = key - .replace(/\`/gi, '') + .replace(/`/gi, '') .replace(' DESC', '') .replace(/^\s+/, '') .replace(/\s+$/, '') @@ -109,9 +109,9 @@ const getWhereCondition = index => { } }; -const getIndexes = async ({ cluster, connectionInfo, logger, app }) => { +const getIndexes = async ({ cluster, connectionInfo, logger }) => { try { - const indexData = await restApiHelper.getIndexes({ connectionInfo, logger, app }); + const indexData = await restApiHelper.getIndexes({ connectionInfo, logger }); const statements = indexData.map(indx => indx.definition).join(';\n'); if (!statements) { diff --git a/reverse_engineering/helpers/restApiHelper.js b/reverse_engineering/helpers/restApiHelper.js index 8603485..6a32688 100644 --- a/reverse_engineering/helpers/restApiHelper.js +++ b/reverse_engineering/helpers/restApiHelper.js @@ -6,6 +6,7 @@ */ const { isObject } = require('lodash'); +const { hckFetch } = require('@hackolade/fetch'); const { DEFAULT_LIMIT } = require('../../shared/constants'); class CustomError extends Error { @@ -17,16 +18,14 @@ class CustomError extends Error { } class CouchbaseRestApiService { - constructor(connectionInfo, httpService) { - this.host = connectionInfo.host; - this.port = connectionInfo.port; + constructor({ host, port, couchbase_username, couchbase_password }) { + this.host = host; + this.port = port; - if (connectionInfo?.couchbase_username && connectionInfo?.couchbase_password) { - this.password = connectionInfo.couchbase_password; - this.username = connectionInfo.couchbase_username; + if (couchbase_username && couchbase_password) { + this.password = couchbase_password; + this.username = couchbase_username; } - - this.httpService = httpService; } /** @@ -49,10 +48,9 @@ class CouchbaseRestApiService { headers: { Authorization: `Basic ${encodedCredentials}`, }, - useElectronNet: true, }; - return await this.httpService.get(uri, options); + return hckFetch(uri, options); } catch (error) { throw new CustomError({ message: error.statusText || error.message, @@ -94,23 +92,19 @@ const safeParse = value => { const isBinaryFile = obj => isObject(obj) && !!obj.base64 && !!obj.meta; -const createRestApiService = ({ connectionInfo, app }) => { - const httpService = app.require('httpService'); - const httpServiceInstance = httpService.createInstance(connectionInfo); - const apiService = new CouchbaseRestApiService(connectionInfo, httpServiceInstance); - - return apiService; +const createRestApiService = ({ connectionInfo }) => { + return new CouchbaseRestApiService(connectionInfo); }; /** - * @param {{ connectionInfo: ConnectionInfo; bucketName: string; scopeName: string; collectionName: string; logger: Logger; app: App }} param0 + * @param {{ connectionInfo: ConnectionInfo; bucketName: string; scopeName: string; collectionName: string; logger: Logger; }} param0 * @returns {Promise} */ -const getCollectionDocuments = async ({ connectionInfo, bucketName, scopeName, collectionName, logger, app }) => { +const getCollectionDocuments = async ({ connectionInfo, bucketName, scopeName, collectionName, logger }) => { try { logger.info(`${bucketName}.${scopeName}.${collectionName}: Start getting documents using REST API`); - const apiService = createRestApiService({ connectionInfo, app }); + const apiService = createRestApiService({ connectionInfo }); const { rows } = await apiService.getCollectionDocuments({ bucketName, scopeName, @@ -131,13 +125,13 @@ const getCollectionDocuments = async ({ connectionInfo, bucketName, scopeName, c }; /** - * @param {{ connectionInfo: ConnectionInfo; logger: Logger; app: App }} param0 + * @param {{ connectionInfo: ConnectionInfo; logger: Logger; }} param0 * @returns {Promise} */ -const getIndexes = async ({ connectionInfo, logger, app }) => { +const getIndexes = async ({ connectionInfo, logger }) => { logger.info(`Start getting indexes using REST API`); - const apiService = createRestApiService({ connectionInfo, app }); + const apiService = createRestApiService({ connectionInfo }); const { indexes } = await apiService.getIndexes(); return indexes; diff --git a/shared/helpers/clusterHelper.js b/shared/helpers/clusterHelper.js index 2c56d87..1811ecb 100644 --- a/shared/helpers/clusterHelper.js +++ b/shared/helpers/clusterHelper.js @@ -262,7 +262,6 @@ const getCollectionDocumentsByInfer = async ({ cluster, bucketName, scopeName, c * collectionIndexes: object[]; * includeEmptyCollection: boolean; * logger: Logger; - * app: App; * }} param0 * @returns {Promise} */ @@ -275,7 +274,6 @@ const getDbCollectionData = async ({ collectionIndexes, includeEmptyCollection, logger, - app, }) => { try { const limit = await getCollectionSamplingSize({ @@ -321,7 +319,6 @@ const getDbCollectionData = async ({ collectionIndexes, includeEmptyCollection, logger, - app, }); } }; @@ -337,7 +334,6 @@ const getDbCollectionData = async ({ * collectionIndexes: object[]; * includeEmptyCollection: boolean; * logger: Logger; - * app: App; * }} param0 * @returns {Promise} */ @@ -351,7 +347,6 @@ const getDbCollectionDataByErrorHandling = async ({ collectionIndexes, includeEmptyCollection, logger, - app, }) => { try { const errorCode = getErrorCode({ error }); @@ -376,7 +371,6 @@ const getDbCollectionDataByErrorHandling = async ({ scopeName, collectionName, logger, - app, }); break; }