diff --git a/.eslintrc.json b/.eslintrc.json index 259d5c5c..adfb9e34 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -27,5 +27,8 @@ ], "import/newline-after-import": "error", "prettier/prettier": "error" + }, + "env": { + "node": true } } diff --git a/.github/workflows/pr-test.yml b/.github/workflows/pr-test.yml index 9fef9ba5..233f8723 100644 --- a/.github/workflows/pr-test.yml +++ b/.github/workflows/pr-test.yml @@ -17,8 +17,8 @@ jobs: - name: Install dependencies run: npm install - - name: Build - run: npm run build + - name: Build and Smoke Test + run: npm run test:smoketest - name: Run Unit Tests run: | diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 19d37f78..228d21c5 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -21,8 +21,8 @@ jobs: - name: Install dependencies run: npm i - - name: Build - run: npm run build + - name: Build and Smoke Test + run: npm run test:smoketest - name: Run Unit Tests run: | diff --git a/.vscode/settings.json b/.vscode/settings.json index 8e962fe3..dc96b7fb 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -6,7 +6,8 @@ "zeebe", "github", "modeler", - "operate" + "operate", + "camunda8" ], "editor.formatOnSave": true, diff --git a/package-lock.json b/package-lock.json index fa6adc8b..643d92ca 100644 --- a/package-lock.json +++ b/package-lock.json @@ -57,6 +57,7 @@ "shx": "^0.3.4", "ts-jest": "^29.1.1", "tsconfig-paths": "^4.2.0", + "tsd": "^0.31.0", "typedoc": "^0.25.9", "typedoc-plugin-include-example": "^1.2.0", "typedoc-plugin-missing-exports": "^2.2.0", @@ -3444,6 +3445,15 @@ "optional": true, "peer": true }, + "node_modules/@tsd/typescript": { + "version": "5.4.4", + "resolved": "https://registry.npmjs.org/@tsd/typescript/-/typescript-5.4.4.tgz", + "integrity": "sha512-sqE6Rz9UNHBuCtuREo/PwsuUaegP1KDSfxMd+9K1qPpt7XO8BmkIImUp7zAqyvwXWUHs+sj6osEkkpyE0tFgfA==", + "dev": true, + "engines": { + "node": ">=14.17" + } + }, "node_modules/@types/babel__core": { "version": "7.20.5", "dev": true, @@ -3499,6 +3509,24 @@ "@types/ms": "*" } }, + "node_modules/@types/eslint": { + "version": "8.56.7", + "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.56.7.tgz", + "integrity": "sha512-SjDvI/x3zsZnOkYZ3lCt9lOZWZLB2jIlNKz+LBgCtDurK0JZcwucxYHn1w2BJkD34dgX9Tjnak0txtq4WTggEA==", + "dev": true, + "optional": true, + "peer": true, + "dependencies": { + "@types/estree": "*", + "@types/json-schema": "*" + } + }, + "node_modules/@types/estree": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz", + "integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==", + "dev": true + }, "node_modules/@types/graceful-fs": { "version": "4.1.9", "dev": true, @@ -6429,6 +6457,108 @@ "eslint": ">=7.0.0" } }, + "node_modules/eslint-formatter-pretty": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/eslint-formatter-pretty/-/eslint-formatter-pretty-4.1.0.tgz", + "integrity": "sha512-IsUTtGxF1hrH6lMWiSl1WbGaiP01eT6kzywdY1U+zLc0MP+nwEnUiS9UI8IaOTUhTeQJLlCEWIbXINBH4YJbBQ==", + "dev": true, + "dependencies": { + "@types/eslint": "^7.2.13", + "ansi-escapes": "^4.2.1", + "chalk": "^4.1.0", + "eslint-rule-docs": "^1.1.5", + "log-symbols": "^4.0.0", + "plur": "^4.0.0", + "string-width": "^4.2.0", + "supports-hyperlinks": "^2.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint-formatter-pretty/node_modules/@types/eslint": { + "version": "7.29.0", + "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-7.29.0.tgz", + "integrity": "sha512-VNcvioYDH8/FxaeTKkM4/TiTwt6pBV9E3OfGmvaw8tPl0rrHCJ4Ll15HRT+pMiFAf/MLQvAzC+6RzUMEL9Ceng==", + "dev": true, + "dependencies": { + "@types/estree": "*", + "@types/json-schema": "*" + } + }, + "node_modules/eslint-formatter-pretty/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/eslint-formatter-pretty/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/eslint-formatter-pretty/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/eslint-formatter-pretty/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/eslint-formatter-pretty/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/eslint-formatter-pretty/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/eslint-import-resolver-node": { "version": "0.3.9", "dev": true, @@ -6578,6 +6708,12 @@ } } }, + "node_modules/eslint-rule-docs": { + "version": "1.1.235", + "resolved": "https://registry.npmjs.org/eslint-rule-docs/-/eslint-rule-docs-1.1.235.tgz", + "integrity": "sha512-+TQ+x4JdTnDoFEXXb3fDvfGOwnyNV7duH8fXWTPD1ieaBmB8omj7Gw/pMBBu4uI2uJCCU8APDaQJzWuXnTsH4A==", + "dev": true + }, "node_modules/eslint-scope": { "version": "7.2.2", "dev": true, @@ -7888,6 +8024,15 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/irregular-plurals": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/irregular-plurals/-/irregular-plurals-3.5.0.tgz", + "integrity": "sha512-1ANGLZ+Nkv1ptFb2pa8oG8Lem4krflKuX/gINiHJHjJUKaJHk/SXk5x6K3J+39/p0h1RQ2saROclJJ+QLvETCQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/is-array-buffer": { "version": "3.0.2", "dev": true, @@ -10911,76 +11056,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/meow/node_modules/hosted-git-info": { - "version": "2.8.9", - "dev": true, - "license": "ISC" - }, - "node_modules/meow/node_modules/read-pkg": { - "version": "5.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/normalize-package-data": "^2.4.0", - "normalize-package-data": "^2.5.0", - "parse-json": "^5.0.0", - "type-fest": "^0.6.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/meow/node_modules/read-pkg-up": { - "version": "7.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "find-up": "^4.1.0", - "read-pkg": "^5.2.0", - "type-fest": "^0.8.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/meow/node_modules/read-pkg-up/node_modules/type-fest": { - "version": "0.8.1", - "dev": true, - "license": "(MIT OR CC0-1.0)", - "engines": { - "node": ">=8" - } - }, - "node_modules/meow/node_modules/read-pkg/node_modules/normalize-package-data": { - "version": "2.5.0", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "hosted-git-info": "^2.1.4", - "resolve": "^1.10.0", - "semver": "2 || 3 || 4 || 5", - "validate-npm-package-license": "^3.0.1" - } - }, - "node_modules/meow/node_modules/read-pkg/node_modules/type-fest": { - "version": "0.6.0", - "dev": true, - "license": "(MIT OR CC0-1.0)", - "engines": { - "node": ">=8" - } - }, - "node_modules/meow/node_modules/semver": { - "version": "5.7.2", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver" - } - }, "node_modules/meow/node_modules/type-fest": { "version": "0.18.1", "dev": true, @@ -14858,6 +14933,21 @@ "node": ">=8" } }, + "node_modules/plur": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/plur/-/plur-4.0.0.tgz", + "integrity": "sha512-4UGewrYgqDFw9vV6zNV+ADmPAUAfJPKtGvb/VdpQAx25X5f3xXdGdyOEVFwkl8Hl/tl7+xbeHqSEM+D5/TirUg==", + "dev": true, + "dependencies": { + "irregular-plurals": "^3.2.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/prelude-ls": { "version": "1.2.1", "dev": true, @@ -15061,6 +15151,83 @@ "dev": true, "license": "MIT" }, + "node_modules/read-pkg": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-5.2.0.tgz", + "integrity": "sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg==", + "dev": true, + "dependencies": { + "@types/normalize-package-data": "^2.4.0", + "normalize-package-data": "^2.5.0", + "parse-json": "^5.0.0", + "type-fest": "^0.6.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/read-pkg-up": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-7.0.1.tgz", + "integrity": "sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg==", + "dev": true, + "dependencies": { + "find-up": "^4.1.0", + "read-pkg": "^5.2.0", + "type-fest": "^0.8.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/read-pkg-up/node_modules/type-fest": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", + "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/read-pkg/node_modules/hosted-git-info": { + "version": "2.8.9", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", + "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", + "dev": true + }, + "node_modules/read-pkg/node_modules/normalize-package-data": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", + "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", + "dev": true, + "dependencies": { + "hosted-git-info": "^2.1.4", + "resolve": "^1.10.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + } + }, + "node_modules/read-pkg/node_modules/semver": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "dev": true, + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/read-pkg/node_modules/type-fest": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.6.0.tgz", + "integrity": "sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/readable-stream": { "version": "2.3.8", "dev": true, @@ -16332,6 +16499,40 @@ "node": ">=4" } }, + "node_modules/supports-hyperlinks": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/supports-hyperlinks/-/supports-hyperlinks-2.3.0.tgz", + "integrity": "sha512-RpsAZlpWcDwOPQA22aCH4J0t7L8JmAvsCxfOSEwm7cQs3LshN36QaTkwd70DnBOXDWGssw2eUoc8CaRWT0XunA==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0", + "supports-color": "^7.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/supports-hyperlinks/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/supports-hyperlinks/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/supports-preserve-symlinks-flag": { "version": "1.0.0", "dev": true, @@ -16709,6 +16910,65 @@ "node": ">=4" } }, + "node_modules/tsd": { + "version": "0.31.0", + "resolved": "https://registry.npmjs.org/tsd/-/tsd-0.31.0.tgz", + "integrity": "sha512-yjBiQ5n8OMv/IZOuhDjBy0ZLCoJ7rky/RxRh5W4sJ0oNNCU/kf6s3puPAkGNi59PptDdkcpUm+RsKSdjR2YbNg==", + "dev": true, + "dependencies": { + "@tsd/typescript": "~5.4.3", + "eslint-formatter-pretty": "^4.1.0", + "globby": "^11.0.1", + "jest-diff": "^29.0.3", + "meow": "^9.0.0", + "path-exists": "^4.0.0", + "read-pkg-up": "^7.0.0" + }, + "bin": { + "tsd": "dist/cli.js" + }, + "engines": { + "node": ">=14.16" + } + }, + "node_modules/tsd/node_modules/meow": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/meow/-/meow-9.0.0.tgz", + "integrity": "sha512-+obSblOQmRhcyBt62furQqRAQpNyWXo8BuQ5bN7dG8wmwQ+vwHKp/rCFD4CrTP8CsDQD1sjoZ94K417XEUk8IQ==", + "dev": true, + "dependencies": { + "@types/minimist": "^1.2.0", + "camelcase-keys": "^6.2.2", + "decamelize": "^1.2.0", + "decamelize-keys": "^1.1.0", + "hard-rejection": "^2.1.0", + "minimist-options": "4.1.0", + "normalize-package-data": "^3.0.0", + "read-pkg-up": "^7.0.1", + "redent": "^3.0.0", + "trim-newlines": "^3.0.0", + "type-fest": "^0.18.0", + "yargs-parser": "^20.2.3" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/tsd/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/tslib": { "version": "2.6.2", "dev": true, diff --git a/package.json b/package.json index b05d7f22..9484b55f 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ "test:local-integration": "jest --runInBand --detectOpenHandles --verbose --testPathIgnorePatterns disconnection --testPathIgnorePatterns admin --testPathIgnorePatterns multitenancy --testPathIgnorePatterns __tests__/config -u", "test:docker": "jest --runInBand --testPathIgnorePatterns disconnection --testPathIgnorePatterns __tests__/config local-integration --detectOpenHandles --verbose true", "test:disconnect": "jest --runInBand --verbose true --detectOpenHandles --testPathIgnorePatterns __tests__/config disconnection", + "test:smoketest": "npm run build && node smoke-test/smoke-test.js && npx tsd --typings dist/", "prepublishOnly": "npm run build && npm run test", "commit": "cz", "prepare": "husky install", @@ -73,6 +74,9 @@ "prettier --write" ] }, + "tsd": { + "directory": "test-d" + }, "devDependencies": { "@commitlint/cli": "^18.4.3", "@commitlint/config-conventional": "^18.4.3", @@ -102,6 +106,7 @@ "shx": "^0.3.4", "ts-jest": "^29.1.1", "tsconfig-paths": "^4.2.0", + "tsd": "^0.31.0", "typedoc": "^0.25.9", "typedoc-plugin-include-example": "^1.2.0", "typedoc-plugin-missing-exports": "^2.2.0", @@ -127,4 +132,4 @@ "typed-duration": "^1.0.12", "uuid": "^7.0.3" } -} +} \ No newline at end of file diff --git a/smoke-test/package-lock.json b/smoke-test/package-lock.json new file mode 100644 index 00000000..9ea68617 --- /dev/null +++ b/smoke-test/package-lock.json @@ -0,0 +1,29 @@ +{ + "name": "smoke-test", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "smoke-test", + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "@types/node": "^20.12.5" + } + }, + "node_modules/@types/node": { + "version": "20.12.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.5.tgz", + "integrity": "sha512-BD+BjQ9LS/D8ST9p5uqBxghlN+S42iuNxjsUGjeZobe/ciXzk2qb1B6IXc6AnRLS+yFJRpN2IPEHMzwspfDJNw==", + "dependencies": { + "undici-types": "~5.26.4" + } + }, + "node_modules/undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==" + } + } +} diff --git a/smoke-test/package.json b/smoke-test/package.json new file mode 100644 index 00000000..b1bff066 --- /dev/null +++ b/smoke-test/package.json @@ -0,0 +1,15 @@ +{ + "name": "smoke-test", + "version": "1.0.0", + "description": "", + "main": "smoke-test.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": "", + "license": "ISC", + "dependencies": { + "@types/node": "^20.12.5" + } +} diff --git a/smoke-test/smoke-test.js b/smoke-test/smoke-test.js new file mode 100644 index 00000000..5f574706 --- /dev/null +++ b/smoke-test/smoke-test.js @@ -0,0 +1,45 @@ +/* eslint-disable @typescript-eslint/no-unused-vars */ +/* eslint-disable @typescript-eslint/no-var-requires */ +const { Camunda8 } = require('..') + +console.log('Running smoke test...') + +const camunda = new Camunda8({ + CAMUNDA_OAUTH_DISABLED: true, + ZEEBE_ADDRESS: 'localhost:26500', + ZEEBE_CLIENT_ID: 'zeebeClientId', + ZEEBE_CLIENT_SECRET: 'zeebeClientSecret', + CAMUNDA_CONSOLE_BASE_URL: 'http://localhost:8080', + CAMUNDA_MODELER_BASE_URL: 'http://localhost:8080', + CAMUNDA_TASKLIST_BASE_URL: 'http://localhost:8080', + CAMUNDA_OPERATE_BASE_URL: 'http://localhost:8080', + CAMUNDA_OPTIMIZE_BASE_URL: 'http://localhost:8080', +}) + +// console.log(camunda) + +const zeebe = camunda.getZeebeGrpcApiClient() + +// console.log(zeebe) + +const tasklist = camunda.getTasklistApiClient() + +// console.log(tasklist) + +const modeler = camunda.getModelerApiClient() + +// console.log(modeler) + +const optimize = camunda.getOptimizeApiClient() + +// console.log(optimize) + +const admin = camunda.getAdminApiClient() + +// console.log(admin) + +const operate = camunda.getOperateApiClient() + +// console.log(operate) + +console.log('Smoke test passed!') diff --git a/smoke-test/tsconfig.json b/smoke-test/tsconfig.json new file mode 100644 index 00000000..e260bf63 --- /dev/null +++ b/smoke-test/tsconfig.json @@ -0,0 +1,9 @@ +{ + "compilerOptions": { + "moduleResolution": "node", + "allowJs": true, + "checkJs": true, + "noEmit": true + }, + "include": ["*.js"] +} diff --git a/src/c8/index.ts b/src/c8/index.ts index d774e4ba..d95d678e 100644 --- a/src/c8/index.ts +++ b/src/c8/index.ts @@ -37,13 +37,15 @@ export class Camunda8 { private tasklistApiClient?: TasklistApiClient private zeebeGrpcClient?: ZeebeGrpcClient private configuration: CamundaPlatform8Configuration - private oAuthProvider: OAuthProvider + private oAuthProvider?: OAuthProvider constructor(config: DeepPartial = {}) { this.configuration = CamundaEnvironmentConfigurator.mergeConfigWithEnvironment(config) - - this.oAuthProvider = new OAuthProvider({ config: this.configuration }) + // Respect Oauth disabled flag + if (!this.configuration.CAMUNDA_OAUTH_DISABLED) { + this.oAuthProvider = new OAuthProvider({ config: this.configuration }) + } } public getOperateApiClient(): OperateApiClient { @@ -96,7 +98,7 @@ export class Camunda8 { return this.tasklistApiClient } - public getZeebeApiClient(): ZeebeGrpcClient { + public getZeebeGrpcApiClient(): ZeebeGrpcClient { if (!this.zeebeGrpcClient) { this.zeebeGrpcClient = new ZeebeGrpcClient({ config: this.configuration, diff --git a/test-d/index.test-d.ts b/test-d/index.test-d.ts new file mode 100644 index 00000000..c3dea6d2 --- /dev/null +++ b/test-d/index.test-d.ts @@ -0,0 +1,31 @@ +import { expectType } from 'tsd' + +import { + Admin, + Camunda8, + Modeler, + Operate, + Optimize, + Tasklist, + Zeebe, +} from '..' + +expectType(new Camunda8({ CAMUNDA_OAUTH_DISABLED: true })) +expectType( + new Camunda8({ CAMUNDA_OAUTH_DISABLED: true }).getOperateApiClient() +) +expectType( + new Camunda8({ CAMUNDA_OAUTH_DISABLED: true }).getAdminApiClient() +) +expectType( + new Camunda8({ CAMUNDA_OAUTH_DISABLED: true }).getModelerApiClient() +) +expectType( + new Camunda8({ CAMUNDA_OAUTH_DISABLED: true }).getOptimizeApiClient() +) +expectType( + new Camunda8({ CAMUNDA_OAUTH_DISABLED: true }).getTasklistApiClient() +) +expectType( + new Camunda8({ CAMUNDA_OAUTH_DISABLED: true }).getZeebeGrpcApiClient() +) diff --git a/tsconfig.json b/tsconfig.json index 841b8f10..0e648550 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -27,5 +27,5 @@ } ] }, - "exclude": ["node_modules", "src/__tests__/*"] + "exclude": ["node_modules", "src/__tests__/*", "test-d"] }