From e3ded54b4e24cfdb9322fead7aa3fce6be8d3e53 Mon Sep 17 00:00:00 2001 From: Josh Wulf Date: Wed, 10 Apr 2024 20:04:59 +1200 Subject: [PATCH 1/9] refactor: replace zeebe-node with @camunda8/sdk fixes #4109 --- app/lib/index.js | 4 +- app/lib/zeebe-api/zeebe-api.js | 38 +++-- app/package.json | 2 +- package-lock.json | 288 +++++++++++++++++++-------------- 4 files changed, 186 insertions(+), 146 deletions(-) diff --git a/app/lib/index.js b/app/lib/index.js index 87a0794bdc..695403031e 100644 --- a/app/lib/index.js +++ b/app/lib/index.js @@ -22,7 +22,7 @@ const path = require('path'); const fs = require('fs'); -const ZeebeNode = require('zeebe-node'); +const Camunda8 = require('@camunda8/sdk'); const Cli = require('./cli'); const Config = require('./config'); @@ -680,7 +680,7 @@ function bootstrap() { errorTracking.setTag(Sentry, 'plugins', generatePluginsTag(plugins)); // (9) zeebe API - const zeebeAPI = new ZeebeAPI({ readFile }, ZeebeNode, flags); + const zeebeAPI = new ZeebeAPI({ readFile }, Camunda8.ZeebeGrpcApiClient, flags); return { config, diff --git a/app/lib/zeebe-api/zeebe-api.js b/app/lib/zeebe-api/zeebe-api.js index 67b11ba15b..e21769316a 100644 --- a/app/lib/zeebe-api/zeebe-api.js +++ b/app/lib/zeebe-api/zeebe-api.js @@ -110,10 +110,10 @@ const CLIENT_OPTIONS_SECRETS = [ */ class ZeebeAPI { - constructor(fs, ZeebeNode, flags, log = createLog('app:zeebe-api')) { + constructor(fs, ZeebeGrpcApiClient, flags, log = createLog('app:zeebe-api')) { this._fs = fs; - this._ZeebeNode = ZeebeNode; + this._ZeebeGrpcApiClient = ZeebeGrpcApiClient; this._flags = flags; this._log = log; @@ -331,8 +331,9 @@ class ZeebeAPI { url } = endpoint; + /** @type {Camunda8PlatformConfiguration} */ let options = { - retry: false + zeebeGrpcSettings: { ZEEBE_GRPC_CLIENT_RETRY: false } }; if (!values(ENDPOINT_TYPES).includes(type) || !values(AUTH_TYPES).includes(authType)) { @@ -350,26 +351,23 @@ class ZeebeAPI { } else if (authType === AUTH_TYPES.OAUTH) { options = { ...options, - oAuth: { - url: endpoint.oauthURL, - audience: endpoint.audience, - scope: endpoint.scope, - clientId: endpoint.clientId, - clientSecret: endpoint.clientSecret, - cacheOnDisk: false - } + ZEEBE_ADDRESS: endpoint.oauthURL, + CAMUNDA_ZEEBE_OAUTH_AUDIENCE: endpoint.audience, + CAMUNDA_TOKEN_SCOPE: endpoint.scope, + CAMUNDA_ZEEBE_CLIENT_ID: endpoint.clientId, + CAMUNDA_ZEEBE_CLIENT_SECRET: endpoint.clientSecret, + CAMUNDA_TOKEN_DISK_CACHE_DISABLE: true }; } else if (type === ENDPOINT_TYPES.CAMUNDA_CLOUD) { options = { ...options, - camundaCloud: { - clientId: endpoint.clientId, - clientSecret: endpoint.clientSecret, - clusterId: endpoint.clusterId, - cacheOnDisk: false, - ...(endpoint.clusterRegion ? { clusterRegion: endpoint.clusterRegion } : {}) - }, - useTLS: true + ZEEBE_ADDRESS: endpoint.camundaCloudClusterUrl, + CAMUNDA_ZEEBE_OAUTH_AUDIENCE: endpoint.audience, + CAMUNDA_TOKEN_SCOPE: endpoint.scope, + CAMUNDA_ZEEBE_CLIENT_ID: endpoint.clientId, + CAMUNDA_ZEEBE_CLIENT_SECRET: endpoint.clientSecret, + CAMUNDA_TOKEN_DISK_CACHE_DISABLE: true, + CAMUNDA_SECURE_CONNECTION: true }; } @@ -389,7 +387,7 @@ class ZeebeAPI { ) }); - return new this._ZeebeNode.ZBClient(url, options); + return new this._ZeebeGrpcApiClient({ config: options }); } async _withTLSConfig(url, options) { diff --git a/app/package.json b/app/package.json index 0c2e60ecdf..76c0a0a8f7 100644 --- a/app/package.json +++ b/app/package.json @@ -19,7 +19,7 @@ "min-dash": "^4.1.1", "mri": "^1.1.6", "parents": "^1.0.1", - "zeebe-node": "^8.3.2" + "@camunda8/sdk": "^8.5.0" }, "homepage": "https://github.com/camunda/camunda-modeler", "repository": { diff --git a/package-lock.json b/package-lock.json index b79d001fa4..54107cb2c1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -53,6 +53,7 @@ "version": "5.23.0", "license": "MIT", "dependencies": { + "@camunda8/sdk": "^8.5.0", "@sentry/integrations": "^7.113.0", "@sentry/node": "^8.0.0", "epipebomb": "^1.0.0", @@ -60,8 +61,7 @@ "ids": "^1.0.0", "min-dash": "^4.1.1", "mri": "^1.1.6", - "parents": "^1.0.1", - "zeebe-node": "^8.3.2" + "parents": "^1.0.1" }, "optionalDependencies": { "vscode-windows-ca-certs": "^0.3.0" @@ -3127,6 +3127,56 @@ "resolved": "https://registry.npmjs.org/@camunda/zeebe-element-templates-json-schema/-/zeebe-element-templates-json-schema-0.19.2.tgz", "integrity": "sha512-T0U6Ij3AS191KADumm5rXCVUYtKSFBiipexQL3lJHey1XmADmTGIqhAe8+iCyKqUaxixjv5Q/IkuFD2NqBoIpw==" }, + "node_modules/@camunda8/sdk": { + "version": "8.5.0", + "resolved": "https://registry.npmjs.org/@camunda8/sdk/-/sdk-8.5.0.tgz", + "integrity": "sha512-fyY5YME0revYwxko9bz7Cnndh18LOeDRugxG8rcyP71CFNRsg1h9qK2TD7IQHi+boU8+lXVhwIk4FrRX7BZ1XA==", + "dependencies": { + "@grpc/grpc-js": "1.9.7", + "@grpc/proto-loader": "0.7.10", + "chalk": "^2.4.2", + "console-stamp": "^3.0.2", + "dayjs": "^1.8.15", + "debug": "^4.3.4", + "fast-xml-parser": "^4.1.3", + "got": "^11.8.6", + "lodash.mergewith": "^4.6.2", + "long": "^4.0.0", + "lossless-json": "^4.0.1", + "neon-env": "^0.1.3", + "node-fetch": "^2.7.0", + "promise-retry": "^1.1.1", + "reflect-metadata": "^0.2.1", + "stack-trace": "0.0.10", + "typed-duration": "^1.0.12", + "uuid": "^7.0.3" + } + }, + "node_modules/@camunda8/sdk/node_modules/err-code": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/err-code/-/err-code-1.1.2.tgz", + "integrity": "sha512-CJAN+O0/yA1CKfRn9SXOGctSpEM7DCon/r/5r2eXFMY2zCCJBasFhcM5I+1kh3Ap11FsQCX+vGHceNPvpWKhoA==" + }, + "node_modules/@camunda8/sdk/node_modules/promise-retry": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/promise-retry/-/promise-retry-1.1.1.tgz", + "integrity": "sha512-StEy2osPr28o17bIW776GtwO6+Q+M9zPiZkYfosciUUMYqjhU/ffwRAH0zN2+uvGyUsn8/YICIHRzLbPacpZGw==", + "dependencies": { + "err-code": "^1.0.0", + "retry": "^0.10.0" + }, + "engines": { + "node": ">=0.12" + } + }, + "node_modules/@camunda8/sdk/node_modules/retry": { + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/retry/-/retry-0.10.1.tgz", + "integrity": "sha512-ZXUSQYTHdl3uS7IuCehYfMzKyIDBNoAuUblvy5oGO5UJSUTmStUUVPXbA9Qxd173Bgre53yCQczQuHgRWAdvJQ==", + "engines": { + "node": "*" + } + }, "node_modules/@carbon/grid": { "version": "11.22.0", "resolved": "https://registry.npmjs.org/@carbon/grid/-/grid-11.22.0.tgz", @@ -14559,7 +14609,6 @@ }, "node_modules/encoding": { "version": "0.1.13", - "dev": true, "license": "MIT", "optional": true, "dependencies": { @@ -16028,10 +16077,6 @@ "node": ">=0.4.x" } }, - "node_modules/fp-ts": { - "version": "2.12.3", - "license": "MIT" - }, "node_modules/fromentries": { "version": "1.3.2", "dev": true, @@ -16598,8 +16643,9 @@ } }, "node_modules/got": { - "version": "11.8.5", - "license": "MIT", + "version": "11.8.6", + "resolved": "https://registry.npmjs.org/got/-/got-11.8.6.tgz", + "integrity": "sha512-6tfZ91bOr7bOXnK7PRDCGBLa1H4U080YHNaAQ2KsMGlLEzRbk44nsZF2E1IeRc3vtJHPVbKCYgdFbaGO2ljd8g==", "dependencies": { "@sindresorhus/is": "^4.0.0", "@szmarczak/http-timer": "^4.0.5", @@ -16990,7 +17036,7 @@ }, "node_modules/iconv-lite": { "version": "0.6.3", - "dev": true, + "devOptional": true, "license": "MIT", "dependencies": { "safer-buffer": ">= 2.1.2 < 3.0.0" @@ -19804,6 +19850,11 @@ "version": "4.6.2", "license": "MIT" }, + "node_modules/lodash.mergewith": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.mergewith/-/lodash.mergewith-4.6.2.tgz", + "integrity": "sha512-GK3g5RPZWTRSeLSpgP8Xhra+pnjBC56q9FZYe1d5RN3TJ35dbkGy3YqBSMbyCrlbi+CM9Z3Jk5yTL7RCsqboyQ==" + }, "node_modules/lodash.union": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/lodash.union/-/lodash.union-4.6.0.tgz", @@ -19929,6 +19980,11 @@ "loose-envify": "cli.js" } }, + "node_modules/lossless-json": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/lossless-json/-/lossless-json-4.0.1.tgz", + "integrity": "sha512-l0L+ppmgPDnb+JGxNLndPtJZGNf6+ZmVaQzoxQm3u6TXmhdnsA+YtdVR8DjzZd/em58686CQhOFDPewfJ4l7MA==" + }, "node_modules/loupe": { "version": "2.3.7", "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.7.tgz", @@ -21711,6 +21767,14 @@ "dev": true, "license": "MIT" }, + "node_modules/neon-env": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/neon-env/-/neon-env-0.1.3.tgz", + "integrity": "sha512-Zo+L6Nm19gJrjyfhxn/ZDm8eIIDzr75o64ZhijBau4LNuhLzjEAteRg3gchIvgaN8XTo5BxN6iTNP5clZQ0agA==", + "engines": { + "node": "^14.18 || >=16.0.0" + } + }, "node_modules/netmask": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/netmask/-/netmask-2.0.2.tgz", @@ -21801,10 +21865,9 @@ "optional": true }, "node_modules/node-fetch": { - "version": "2.6.12", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.12.tgz", - "integrity": "sha512-C/fGU2E8ToujUivIO0H+tpQ6HWo4eEmchoPIoXtxCrVghxdKq+QOHqEZW7tuP3KlV3bC8FRMO5nMCC7Zm1VP6g==", - "dev": true, + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", "dependencies": { "whatwg-url": "^5.0.0" }, @@ -25822,6 +25885,11 @@ "node": ">=8" } }, + "node_modules/reflect-metadata": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.2.2.tgz", + "integrity": "sha512-urBwgfrvVP/eAyXx4hluJivBKzuEbSQs9rKWCrCkbSxNv8mxPcUZKeuoF3Uy4mJl3Lwprp6yy5/39VWigZ4K6Q==" + }, "node_modules/regenerate": { "version": "1.4.2", "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.2.tgz", @@ -28641,7 +28709,7 @@ }, "node_modules/safer-buffer": { "version": "2.1.2", - "dev": true, + "devOptional": true, "license": "MIT" }, "node_modules/sanitize-filename": { @@ -30366,8 +30434,7 @@ "node_modules/tr46": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", - "dev": true + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" }, "node_modules/trim-newlines": { "version": "3.0.1", @@ -32607,8 +32674,7 @@ "node_modules/webidl-conversions": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", - "dev": true + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" }, "node_modules/webpack": { "version": "5.90.2", @@ -32758,7 +32824,6 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", - "dev": true, "dependencies": { "tr46": "~0.0.3", "webidl-conversions": "^3.0.0" @@ -33211,55 +33276,6 @@ "resolved": "https://registry.npmjs.org/zeebe-bpmn-moddle/-/zeebe-bpmn-moddle-1.1.0.tgz", "integrity": "sha512-ES/UZFO0VmKvAzL4+cD3VcQpKvlmgLtnFKTyiv0DdDcxNrdQg1rI0OmUdrKMiybAbtAgPDkVXZCusE3kkXwEyQ==" }, - "node_modules/zeebe-node": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/zeebe-node/-/zeebe-node-8.3.2.tgz", - "integrity": "sha512-3/xbiTvhaa668JHtMEwELv5dN6HR7Qw8gzmCdjp3Brj6ekdhROVx8x/0JWKSV3Mx64ac3+eEc+9nB5+ZXcO/bg==", - "dependencies": { - "@grpc/grpc-js": "1.9.7", - "@grpc/proto-loader": "0.7.10", - "chalk": "^2.4.2", - "console-stamp": "^3.0.2", - "dayjs": "^1.8.15", - "debug": "^4.2.0", - "fast-xml-parser": "^4.1.3", - "fp-ts": "^2.5.1", - "got": "^11.8.5", - "long": "^4.0.0", - "promise-retry": "^1.1.1", - "stack-trace": "0.0.10", - "typed-duration": "^1.0.12", - "uuid": "^7.0.3" - }, - "bin": { - "zeebe-node": "bin/zeebe-node" - }, - "engines": { - "node": ">=16.6.1" - } - }, - "node_modules/zeebe-node/node_modules/err-code": { - "version": "1.1.2", - "license": "MIT" - }, - "node_modules/zeebe-node/node_modules/promise-retry": { - "version": "1.1.1", - "license": "MIT", - "dependencies": { - "err-code": "^1.0.0", - "retry": "^0.10.0" - }, - "engines": { - "node": ">=0.12" - } - }, - "node_modules/zeebe-node/node_modules/retry": { - "version": "0.10.1", - "license": "MIT", - "engines": { - "node": "*" - } - }, "node_modules/zip-stream": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/zip-stream/-/zip-stream-6.0.0.tgz", @@ -35095,6 +35111,52 @@ "resolved": "https://registry.npmjs.org/@camunda/zeebe-element-templates-json-schema/-/zeebe-element-templates-json-schema-0.19.2.tgz", "integrity": "sha512-T0U6Ij3AS191KADumm5rXCVUYtKSFBiipexQL3lJHey1XmADmTGIqhAe8+iCyKqUaxixjv5Q/IkuFD2NqBoIpw==" }, + "@camunda8/sdk": { + "version": "8.5.0", + "resolved": "https://registry.npmjs.org/@camunda8/sdk/-/sdk-8.5.0.tgz", + "integrity": "sha512-fyY5YME0revYwxko9bz7Cnndh18LOeDRugxG8rcyP71CFNRsg1h9qK2TD7IQHi+boU8+lXVhwIk4FrRX7BZ1XA==", + "requires": { + "@grpc/grpc-js": "1.9.7", + "@grpc/proto-loader": "0.7.10", + "chalk": "^2.4.2", + "console-stamp": "^3.0.2", + "dayjs": "^1.8.15", + "debug": "^4.3.4", + "fast-xml-parser": "^4.1.3", + "got": "^11.8.6", + "lodash.mergewith": "^4.6.2", + "long": "^4.0.0", + "lossless-json": "^4.0.1", + "neon-env": "^0.1.3", + "node-fetch": "^2.7.0", + "promise-retry": "^1.1.1", + "reflect-metadata": "^0.2.1", + "stack-trace": "0.0.10", + "typed-duration": "^1.0.12", + "uuid": "^7.0.3" + }, + "dependencies": { + "err-code": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/err-code/-/err-code-1.1.2.tgz", + "integrity": "sha512-CJAN+O0/yA1CKfRn9SXOGctSpEM7DCon/r/5r2eXFMY2zCCJBasFhcM5I+1kh3Ap11FsQCX+vGHceNPvpWKhoA==" + }, + "promise-retry": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/promise-retry/-/promise-retry-1.1.1.tgz", + "integrity": "sha512-StEy2osPr28o17bIW776GtwO6+Q+M9zPiZkYfosciUUMYqjhU/ffwRAH0zN2+uvGyUsn8/YICIHRzLbPacpZGw==", + "requires": { + "err-code": "^1.0.0", + "retry": "^0.10.0" + } + }, + "retry": { + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/retry/-/retry-0.10.1.tgz", + "integrity": "sha512-ZXUSQYTHdl3uS7IuCehYfMzKyIDBNoAuUblvy5oGO5UJSUTmStUUVPXbA9Qxd173Bgre53yCQczQuHgRWAdvJQ==" + } + } + }, "@carbon/grid": { "version": "11.22.0", "resolved": "https://registry.npmjs.org/@carbon/grid/-/grid-11.22.0.tgz", @@ -40672,14 +40734,16 @@ "requires": { "@sentry/integrations": "^7.113.0", "@sentry/node": "^8.0.0", + "@camunda8/sdk": "^8.5.0", + "@sentry/integrations": "^7.82.0", + "@sentry/node": "^7.82.0", "epipebomb": "^1.0.0", "fast-glob": "^3.3.1", "ids": "^1.0.0", "min-dash": "^4.1.1", "mri": "^1.1.6", "parents": "^1.0.1", - "vscode-windows-ca-certs": "^0.3.0", - "zeebe-node": "^8.3.2" + "vscode-windows-ca-certs": "^0.3.0" }, "dependencies": { "min-dash": { @@ -44018,7 +44082,6 @@ }, "encoding": { "version": "0.1.13", - "dev": true, "optional": true, "requires": { "iconv-lite": "^0.6.2" @@ -45062,9 +45125,6 @@ "version": "0.2.2", "dev": true }, - "fp-ts": { - "version": "2.12.3" - }, "fromentries": { "version": "1.3.2", "dev": true @@ -45468,7 +45528,9 @@ } }, "got": { - "version": "11.8.5", + "version": "11.8.6", + "resolved": "https://registry.npmjs.org/got/-/got-11.8.6.tgz", + "integrity": "sha512-6tfZ91bOr7bOXnK7PRDCGBLa1H4U080YHNaAQ2KsMGlLEzRbk44nsZF2E1IeRc3vtJHPVbKCYgdFbaGO2ljd8g==", "requires": { "@sindresorhus/is": "^4.0.0", "@szmarczak/http-timer": "^4.0.5", @@ -45719,7 +45781,7 @@ }, "iconv-lite": { "version": "0.6.3", - "dev": true, + "devOptional": true, "requires": { "safer-buffer": ">= 2.1.2 < 3.0.0" } @@ -47683,6 +47745,11 @@ "lodash.merge": { "version": "4.6.2" }, + "lodash.mergewith": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.mergewith/-/lodash.mergewith-4.6.2.tgz", + "integrity": "sha512-GK3g5RPZWTRSeLSpgP8Xhra+pnjBC56q9FZYe1d5RN3TJ35dbkGy3YqBSMbyCrlbi+CM9Z3Jk5yTL7RCsqboyQ==" + }, "lodash.union": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/lodash.union/-/lodash.union-4.6.0.tgz", @@ -47763,6 +47830,11 @@ "js-tokens": "^3.0.0 || ^4.0.0" } }, + "lossless-json": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/lossless-json/-/lossless-json-4.0.1.tgz", + "integrity": "sha512-l0L+ppmgPDnb+JGxNLndPtJZGNf6+ZmVaQzoxQm3u6TXmhdnsA+YtdVR8DjzZd/em58686CQhOFDPewfJ4l7MA==" + }, "loupe": { "version": "2.3.7", "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.7.tgz", @@ -48882,6 +48954,11 @@ "version": "2.6.2", "dev": true }, + "neon-env": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/neon-env/-/neon-env-0.1.3.tgz", + "integrity": "sha512-Zo+L6Nm19gJrjyfhxn/ZDm8eIIDzr75o64ZhijBau4LNuhLzjEAteRg3gchIvgaN8XTo5BxN6iTNP5clZQ0agA==" + }, "netmask": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/netmask/-/netmask-2.0.2.tgz", @@ -48948,10 +49025,9 @@ "optional": true }, "node-fetch": { - "version": "2.6.12", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.12.tgz", - "integrity": "sha512-C/fGU2E8ToujUivIO0H+tpQ6HWo4eEmchoPIoXtxCrVghxdKq+QOHqEZW7tuP3KlV3bC8FRMO5nMCC7Zm1VP6g==", - "dev": true, + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", "requires": { "whatwg-url": "^5.0.0" } @@ -51782,6 +51858,11 @@ "strip-indent": "^3.0.0" } }, + "reflect-metadata": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.2.2.tgz", + "integrity": "sha512-urBwgfrvVP/eAyXx4hluJivBKzuEbSQs9rKWCrCkbSxNv8mxPcUZKeuoF3Uy4mJl3Lwprp6yy5/39VWigZ4K6Q==" + }, "regenerate": { "version": "1.4.2", "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.2.tgz", @@ -53691,7 +53772,7 @@ }, "safer-buffer": { "version": "2.1.2", - "dev": true + "devOptional": true }, "sanitize-filename": { "version": "1.6.3", @@ -54965,8 +55046,7 @@ "tr46": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", - "dev": true + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" }, "trim-newlines": { "version": "3.0.1", @@ -56462,8 +56542,7 @@ "webidl-conversions": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", - "dev": true + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" }, "webpack": { "version": "5.90.2", @@ -56563,7 +56642,6 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", - "dev": true, "requires": { "tr46": "~0.0.3", "webidl-conversions": "^3.0.0" @@ -56883,42 +56961,6 @@ "resolved": "https://registry.npmjs.org/zeebe-bpmn-moddle/-/zeebe-bpmn-moddle-1.1.0.tgz", "integrity": "sha512-ES/UZFO0VmKvAzL4+cD3VcQpKvlmgLtnFKTyiv0DdDcxNrdQg1rI0OmUdrKMiybAbtAgPDkVXZCusE3kkXwEyQ==" }, - "zeebe-node": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/zeebe-node/-/zeebe-node-8.3.2.tgz", - "integrity": "sha512-3/xbiTvhaa668JHtMEwELv5dN6HR7Qw8gzmCdjp3Brj6ekdhROVx8x/0JWKSV3Mx64ac3+eEc+9nB5+ZXcO/bg==", - "requires": { - "@grpc/grpc-js": "1.9.7", - "@grpc/proto-loader": "0.7.10", - "chalk": "^2.4.2", - "console-stamp": "^3.0.2", - "dayjs": "^1.8.15", - "debug": "^4.2.0", - "fast-xml-parser": "^4.1.3", - "fp-ts": "^2.5.1", - "got": "^11.8.5", - "long": "^4.0.0", - "promise-retry": "^1.1.1", - "stack-trace": "0.0.10", - "typed-duration": "^1.0.12", - "uuid": "^7.0.3" - }, - "dependencies": { - "err-code": { - "version": "1.1.2" - }, - "promise-retry": { - "version": "1.1.1", - "requires": { - "err-code": "^1.0.0", - "retry": "^0.10.0" - } - }, - "retry": { - "version": "0.10.1" - } - } - }, "zip-stream": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/zip-stream/-/zip-stream-6.0.0.tgz", From 4a5075b91c1c01560049ed61131f15e5de0b01a2 Mon Sep 17 00:00:00 2001 From: Josh Wulf Date: Wed, 10 Apr 2024 20:44:20 +1200 Subject: [PATCH 2/9] refactor: pass Camunda8 through --- app/lib/index.js | 4 ++-- app/lib/zeebe-api/zeebe-api.js | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/lib/index.js b/app/lib/index.js index 695403031e..547243eb59 100644 --- a/app/lib/index.js +++ b/app/lib/index.js @@ -22,7 +22,7 @@ const path = require('path'); const fs = require('fs'); -const Camunda8 = require('@camunda8/sdk'); +const { Camunda8 } = require('@camunda8/sdk'); const Cli = require('./cli'); const Config = require('./config'); @@ -680,7 +680,7 @@ function bootstrap() { errorTracking.setTag(Sentry, 'plugins', generatePluginsTag(plugins)); // (9) zeebe API - const zeebeAPI = new ZeebeAPI({ readFile }, Camunda8.ZeebeGrpcApiClient, flags); + const zeebeAPI = new ZeebeAPI({ readFile }, Camunda8, flags); return { config, diff --git a/app/lib/zeebe-api/zeebe-api.js b/app/lib/zeebe-api/zeebe-api.js index e21769316a..dfd4816998 100644 --- a/app/lib/zeebe-api/zeebe-api.js +++ b/app/lib/zeebe-api/zeebe-api.js @@ -110,10 +110,10 @@ const CLIENT_OPTIONS_SECRETS = [ */ class ZeebeAPI { - constructor(fs, ZeebeGrpcApiClient, flags, log = createLog('app:zeebe-api')) { + constructor(fs, Camunda8, flags, log = createLog('app:zeebe-api')) { this._fs = fs; - this._ZeebeGrpcApiClient = ZeebeGrpcApiClient; + this._Camunda8 = Camunda8; this._flags = flags; this._log = log; @@ -387,7 +387,7 @@ class ZeebeAPI { ) }); - return new this._ZeebeGrpcApiClient({ config: options }); + return (new this._Camunda8(options)).getZeebeGrpcApiClient(); } async _withTLSConfig(url, options) { From 21448cf2df646c6710ac41aa289d9c0bba5c34c7 Mon Sep 17 00:00:00 2001 From: Maciej Barelkowski Date: Thu, 11 Apr 2024 17:33:39 +0200 Subject: [PATCH 3/9] deps: reinstall --- app/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/package.json b/app/package.json index 76c0a0a8f7..fe9f64bc62 100644 --- a/app/package.json +++ b/app/package.json @@ -11,6 +11,7 @@ }, "license": "MIT", "dependencies": { + "@camunda8/sdk": "^8.5.0", "@sentry/integrations": "^7.113.0", "@sentry/node": "^8.0.0", "epipebomb": "^1.0.0", @@ -18,8 +19,7 @@ "ids": "^1.0.0", "min-dash": "^4.1.1", "mri": "^1.1.6", - "parents": "^1.0.1", - "@camunda8/sdk": "^8.5.0" + "parents": "^1.0.1" }, "homepage": "https://github.com/camunda/camunda-modeler", "repository": { From d2ff05d1fbfece1a2c4034b49e809d74d9a21ea3 Mon Sep 17 00:00:00 2001 From: Maciej Barelkowski Date: Thu, 11 Apr 2024 17:51:21 +0200 Subject: [PATCH 4/9] test: adjust tests --- app/lib/zeebe-api/zeebe-api.js | 12 +- app/test/spec/zeebe-api/zeebe-api-spec.js | 510 ++++++++++------------ 2 files changed, 224 insertions(+), 298 deletions(-) diff --git a/app/lib/zeebe-api/zeebe-api.js b/app/lib/zeebe-api/zeebe-api.js index dfd4816998..4bc259c39a 100644 --- a/app/lib/zeebe-api/zeebe-api.js +++ b/app/lib/zeebe-api/zeebe-api.js @@ -372,7 +372,11 @@ class ZeebeAPI { } options = await this._withTLSConfig(url, options); - options = this._withPortConfig(url, options); + + // do not override camunda cloud port (handled by the client) + if (type !== ENDPOINT_TYPES.CAMUNDA_CLOUD) { + options = this._withPortConfig(url, options); + } this._log.debug('creating client', { url, @@ -441,12 +445,6 @@ class ZeebeAPI { } _withPortConfig(url, options) { - - // do not override camunda cloud port (handled by zeebe-node) - if (options.camundaCloud) { - return options; - } - const parsedUrl = new URL(url); // do not override port if already set in url diff --git a/app/test/spec/zeebe-api/zeebe-api-spec.js b/app/test/spec/zeebe-api/zeebe-api-spec.js index 41ac0153d3..116cbbf276 100644 --- a/app/test/spec/zeebe-api/zeebe-api-spec.js +++ b/app/test/spec/zeebe-api/zeebe-api-spec.js @@ -36,7 +36,7 @@ describe('ZeebeAPI', function() { it('should set success=true for correct check', async () => { // given - const zeebeAPI = mockZeebeNode(); + const zeebeAPI = mockCamundaClient(); const parameters = { endpoint: { @@ -56,13 +56,11 @@ describe('ZeebeAPI', function() { it('should set success=false on failure', async () => { // given - const zeebeAPI = mockZeebeNode({ - ZBClient: function() { - return { - topology: function() { - throw new Error('TEST ERROR.'); - } - }; + const zeebeAPI = mockCamundaClient({ + ZBClient: { + topology: function() { + throw new Error('TEST ERROR.'); + } } }); @@ -86,13 +84,11 @@ describe('ZeebeAPI', function() { it('for ', async () => { // given - const zeebeAPI = mockZeebeNode({ - ZBClient: function() { - return { - topology: function() { - throw new NetworkError('TEST ERROR.', 14); - } - }; + const zeebeAPI = mockCamundaClient({ + ZBClient: { + topology: function() { + throw new NetworkError('TEST ERROR.', 14); + } } }); @@ -113,13 +109,11 @@ describe('ZeebeAPI', function() { it('for (Cloud)', async () => { // given - const zeebeAPI = mockZeebeNode({ - ZBClient: function() { - return { - topology: function() { - throw new NetworkError('TEST ERROR.', 14); - } - }; + const zeebeAPI = mockCamundaClient({ + ZBClient: { + topology: function() { + throw new NetworkError('TEST ERROR.', 14); + } } }); @@ -139,13 +133,11 @@ describe('ZeebeAPI', function() { it('for (Cloud)', async () => { // given - const zeebeAPI = mockZeebeNode({ - ZBClient: function() { - return { - topology: function() { - throw new NetworkError('TEST ERROR.', 13); - } - }; + const zeebeAPI = mockCamundaClient({ + ZBClient: { + topology: function() { + throw new NetworkError('TEST ERROR.', 13); + } } }); @@ -165,13 +157,11 @@ describe('ZeebeAPI', function() { it('for (self-managed)', async () => { // given - const zeebeAPI = mockZeebeNode({ - ZBClient: function() { - return { - topology: function() { - throw new NetworkError('Error: 13 INTERNAL:'); - } - }; + const zeebeAPI = mockCamundaClient({ + ZBClient: { + topology: function() { + throw new NetworkError('Error: 13 INTERNAL:'); + } } }); @@ -192,13 +182,11 @@ describe('ZeebeAPI', function() { it('for (self-managed)', async () => { // given - const zeebeAPI = mockZeebeNode({ - ZBClient: function() { - return { - topology: function() { - throw new NetworkError('Error: 14 UNAVAILABLE:'); - } - }; + const zeebeAPI = mockCamundaClient({ + ZBClient: { + topology: function() { + throw new NetworkError('Error: 14 UNAVAILABLE:'); + } } }); @@ -219,13 +207,11 @@ describe('ZeebeAPI', function() { it('for ', async () => { // given - const zeebeAPI = mockZeebeNode({ - ZBClient: function() { - return { - topology: function() { - throw new NetworkError('ENOTFOUND'); - } - }; + const zeebeAPI = mockCamundaClient({ + ZBClient: { + topology: function() { + throw new NetworkError('ENOTFOUND'); + } } }); @@ -246,13 +232,11 @@ describe('ZeebeAPI', function() { it('for (OAuth)', async () => { // given - const zeebeAPI = mockZeebeNode({ - ZBClient: function() { - return { - topology: function() { - throw new NetworkError('ENOTFOUND'); - } - }; + const zeebeAPI = mockCamundaClient({ + ZBClient: { + topology: function() { + throw new NetworkError('ENOTFOUND'); + } } }); @@ -274,13 +258,11 @@ describe('ZeebeAPI', function() { it('for (Cloud)', async () => { // given - const zeebeAPI = mockZeebeNode({ - ZBClient: function() { - return { - topology: function() { - throw new NetworkError('ENOTFOUND'); - } - }; + const zeebeAPI = mockCamundaClient({ + ZBClient: { + topology: function() { + throw new NetworkError('ENOTFOUND'); + } } }); @@ -300,13 +282,11 @@ describe('ZeebeAPI', function() { it('for ', async () => { // given - const zeebeAPI = mockZeebeNode({ - ZBClient: function() { - return { - topology: function() { - throw new NetworkError('Unauthorized'); - } - }; + const zeebeAPI = mockCamundaClient({ + ZBClient: { + topology: function() { + throw new NetworkError('Unauthorized'); + } } }); @@ -327,13 +307,11 @@ describe('ZeebeAPI', function() { it('for - Cloud', async () => { // given - const zeebeAPI = mockZeebeNode({ - ZBClient: function() { - return { - topology: function() { - throw new NetworkError('Unauthorized'); - } - }; + const zeebeAPI = mockCamundaClient({ + ZBClient: { + topology: function() { + throw new NetworkError('Unauthorized'); + } } }); @@ -353,13 +331,11 @@ describe('ZeebeAPI', function() { it('for ', async () => { // given - const zeebeAPI = mockZeebeNode({ - ZBClient: function() { - return { - topology: function() { - throw new NetworkError('Forbidden'); - } - }; + const zeebeAPI = mockCamundaClient({ + ZBClient: { + topology: function() { + throw new NetworkError('Forbidden'); + } } }); @@ -379,13 +355,11 @@ describe('ZeebeAPI', function() { it('for ', async () => { // given - const zeebeAPI = mockZeebeNode({ - ZBClient: function() { - return { - topology: function() { - throw new NetworkError('Unsupported protocol'); - } - }; + const zeebeAPI = mockCamundaClient({ + ZBClient: { + topology: function() { + throw new NetworkError('Unsupported protocol'); + } } }); @@ -407,13 +381,11 @@ describe('ZeebeAPI', function() { it('for ', async () => { // given - const zeebeAPI = mockZeebeNode({ - ZBClient: function() { - return { - topology: function() { - throw new NetworkError('Some random error'); - } - }; + const zeebeAPI = mockCamundaClient({ + ZBClient: { + topology: function() { + throw new NetworkError('Some random error'); + } } }); @@ -434,13 +406,11 @@ describe('ZeebeAPI', function() { it('for no message', async () => { // given - const zeebeAPI = mockZeebeNode({ - ZBClient: function() { - return { - topology: function() { - throw new NetworkError(); - } - }; + const zeebeAPI = mockCamundaClient({ + ZBClient: { + topology: function() { + throw new NetworkError(); + } } }); @@ -461,13 +431,11 @@ describe('ZeebeAPI', function() { it('for ', async () => { // given - const zeebeAPI = mockZeebeNode({ - ZBClient: function() { - return { - topology: function() { - throw new NetworkError('Method not found', 12); - } - }; + const zeebeAPI = mockCamundaClient({ + ZBClient: { + topology: function() { + throw new NetworkError('Method not found', 12); + } } }); @@ -496,7 +464,7 @@ describe('ZeebeAPI', function() { it('should set success=true for successful instance run', async () => { // given - const zeebeAPI = mockZeebeNode(); + const zeebeAPI = mockCamundaClient(); const parameters = { endpoint: { @@ -517,13 +485,11 @@ describe('ZeebeAPI', function() { it('should set success=false on failure', async () => { // given - const zeebeAPI = mockZeebeNode({ - ZBClient: function() { - return { - createProcessInstance: function() { - throw new Error('TEST ERROR.'); - } - }; + const zeebeAPI = mockCamundaClient({ + ZBClient: { + createProcessInstance: function() { + throw new Error('TEST ERROR.'); + } } }); @@ -548,13 +514,11 @@ describe('ZeebeAPI', function() { it('should return serialized error', async function() { // given - const zeebeAPI = mockZeebeNode({ - ZBClient: function() { - return { - createProcessInstance: function() { - throw new Error('TEST ERROR.'); - } - }; + const zeebeAPI = mockCamundaClient({ + ZBClient: { + createProcessInstance: function() { + throw new Error('TEST ERROR.'); + } } }); @@ -581,7 +545,7 @@ describe('ZeebeAPI', function() { it('should set success=true for successful deployment', async () => { // given - const zeebeAPI = mockZeebeNode(); + const zeebeAPI = mockCamundaClient(); const parameters = { endpoint: { @@ -604,13 +568,11 @@ describe('ZeebeAPI', function() { // given const error = new Error('test'); - const zeebeAPI = mockZeebeNode({ - ZBClient: function() { - return { - deployResource: function() { - throw error; - } - }; + const zeebeAPI = mockCamundaClient({ + ZBClient: { + deployResource: function() { + throw error; + } } }); @@ -636,13 +598,11 @@ describe('ZeebeAPI', function() { // given const error = new Error('test'); - const zeebeAPI = mockZeebeNode({ - ZBClient: function() { - return { - deployResource: function() { - throw error; - } - }; + const zeebeAPI = mockCamundaClient({ + ZBClient: { + deployResource: function() { + throw error; + } } }); @@ -669,7 +629,7 @@ describe('ZeebeAPI', function() { readFile: sinon.spy(() => ({})) }; - const zeebeAPI = mockZeebeNode({ fs }); + const zeebeAPI = mockCamundaClient({ fs }); const parameters = { filePath: 'filePath', @@ -697,7 +657,7 @@ describe('ZeebeAPI', function() { // given const deployResourceSpy = sinon.spy(); - const zeebeAPI = mockZeebeNode({ + const zeebeAPI = mockCamundaClient({ ZBClient: function() { return { deployResource: deployResourceSpy @@ -733,7 +693,7 @@ describe('ZeebeAPI', function() { // given const deployResourceSpy = sinon.spy(); - const zeebeAPI = mockZeebeNode({ + const zeebeAPI = mockCamundaClient({ ZBClient: function() { return { deployResource: deployResourceSpy @@ -770,7 +730,7 @@ describe('ZeebeAPI', function() { // given const deployResourceSpy = sinon.spy(); - const zeebeAPI = mockZeebeNode({ + const zeebeAPI = mockCamundaClient({ ZBClient: function() { return { deployResource: deployResourceSpy @@ -811,7 +771,7 @@ describe('ZeebeAPI', function() { // given const deployResourceSpy = sinon.spy(); - const zeebeAPI = mockZeebeNode({ + const zeebeAPI = mockCamundaClient({ ZBClient: function() { return { deployResource: deployResourceSpy, @@ -841,7 +801,7 @@ describe('ZeebeAPI', function() { // given const deployResourceSpy = sinon.spy(); - const zeebeAPI = mockZeebeNode({ + const zeebeAPI = mockCamundaClient({ ZBClient: function() { return { deployResource: deployResourceSpy, @@ -872,7 +832,7 @@ describe('ZeebeAPI', function() { // given const deployResourceSpy = sinon.spy(); - const zeebeAPI = mockZeebeNode({ + const zeebeAPI = mockCamundaClient({ ZBClient: function() { return { deployResource: deployResourceSpy, @@ -903,7 +863,7 @@ describe('ZeebeAPI', function() { // given const deployResourceSpy = sinon.spy(); - const zeebeAPI = mockZeebeNode({ + const zeebeAPI = mockCamundaClient({ ZBClient: function() { return { deployResource: deployResourceSpy, @@ -933,7 +893,7 @@ describe('ZeebeAPI', function() { // given const deployResourceSpy = sinon.spy(); - const zeebeAPI = mockZeebeNode({ + const zeebeAPI = mockCamundaClient({ ZBClient: function() { return { deployResource: deployResourceSpy, @@ -964,7 +924,7 @@ describe('ZeebeAPI', function() { // given const deployResourceSpy = sinon.spy(); - const zeebeAPI = mockZeebeNode({ + const zeebeAPI = mockCamundaClient({ ZBClient: function() { return { deployResource: deployResourceSpy, @@ -995,7 +955,7 @@ describe('ZeebeAPI', function() { // given const deployResourceSpy = sinon.spy(); - const zeebeAPI = mockZeebeNode({ + const zeebeAPI = mockCamundaClient({ ZBClient: function() { return { deployResource: deployResourceSpy, @@ -1025,7 +985,7 @@ describe('ZeebeAPI', function() { // given const deployResourceSpy = sinon.spy(); - const zeebeAPI = mockZeebeNode({ + const zeebeAPI = mockCamundaClient({ ZBClient: function() { return { deployResource: deployResourceSpy, @@ -1055,7 +1015,7 @@ describe('ZeebeAPI', function() { // given const deployResourceSpy = sinon.spy(); - const zeebeAPI = mockZeebeNode({ + const zeebeAPI = mockCamundaClient({ ZBClient: function() { return { deployResource: deployResourceSpy, @@ -1085,7 +1045,7 @@ describe('ZeebeAPI', function() { // given const deployResourceSpy = sinon.spy(); - const zeebeAPI = mockZeebeNode({ + const zeebeAPI = mockCamundaClient({ ZBClient: function() { return { deployResource: deployResourceSpy, @@ -1116,7 +1076,7 @@ describe('ZeebeAPI', function() { // given const deployResourceSpy = sinon.spy(); - const zeebeAPI = mockZeebeNode({ + const zeebeAPI = mockCamundaClient({ ZBClient: function() { return { deployResource: deployResourceSpy, @@ -1147,7 +1107,7 @@ describe('ZeebeAPI', function() { // given const deployResourceSpy = sinon.spy(); - const zeebeAPI = mockZeebeNode({ + const zeebeAPI = mockCamundaClient({ ZBClient: function() { return { deployResource: deployResourceSpy, @@ -1178,7 +1138,7 @@ describe('ZeebeAPI', function() { // given const deployResourceSpy = sinon.spy(); - const zeebeAPI = mockZeebeNode({ + const zeebeAPI = mockCamundaClient({ ZBClient: function() { return { deployResource: deployResourceSpy, @@ -1267,7 +1227,7 @@ describe('ZeebeAPI', function() { }; }); - const zeebeAPI = mockZeebeNode({ + const zeebeAPI = mockCamundaClient({ ZBClient: ZBClientMock }); @@ -1315,7 +1275,7 @@ describe('ZeebeAPI', function() { // given const deployResourceSpy = sinon.spy(); - const zeebeAPI = mockZeebeNode({ + const zeebeAPI = mockCamundaClient({ ZBClient: function() { return { deployResource: deployResourceSpy @@ -1356,13 +1316,11 @@ describe('ZeebeAPI', function() { // given const topologyResponse = { clusterSize: 3, gatewayVersion: '0.26.0' }; - const zeebeAPI = mockZeebeNode({ - ZBClient: function() { - return { - topology: function() { - return topologyResponse; - } - }; + const zeebeAPI = mockCamundaClient({ + ZBClient: { + topology: function() { + return topologyResponse; + } } }); @@ -1386,13 +1344,11 @@ describe('ZeebeAPI', function() { // given const topologyResponse = { clusterSize: 3, gatewayVersion: '0.26.0' }; - const zeebeAPI = mockZeebeNode({ - ZBClient: function() { - return { - topology: function() { - return topologyResponse; - } - }; + const zeebeAPI = mockCamundaClient({ + ZBClient: { + topology: function() { + return topologyResponse; + } } }); @@ -1415,13 +1371,11 @@ describe('ZeebeAPI', function() { it('should set success=false on failure', async () => { // given - const zeebeAPI = mockZeebeNode({ - ZBClient: function() { - return { - topology: function() { - throw new Error('TEST ERROR.'); - } - }; + const zeebeAPI = mockCamundaClient({ + ZBClient: { + topology: function() { + throw new Error('TEST ERROR.'); + } } }); @@ -1446,13 +1400,11 @@ describe('ZeebeAPI', function() { it('for ', async () => { // given - const zeebeAPI = mockZeebeNode({ - ZBClient: function() { - return { - topology: function() { - throw new NetworkError('TEST ERROR.', 14); - } - }; + const zeebeAPI = mockCamundaClient({ + ZBClient: { + topology: function() { + throw new NetworkError('TEST ERROR.', 14); + } } }); @@ -1473,13 +1425,11 @@ describe('ZeebeAPI', function() { it('for (Cloud)', async () => { // given - const zeebeAPI = mockZeebeNode({ - ZBClient: function() { - return { - topology: function() { - throw new NetworkError('TEST ERROR.', 14); - } - }; + const zeebeAPI = mockCamundaClient({ + ZBClient: { + topology: function() { + throw new NetworkError('TEST ERROR.', 14); + } } }); @@ -1499,13 +1449,11 @@ describe('ZeebeAPI', function() { it('for (Cloud)', async () => { // given - const zeebeAPI = mockZeebeNode({ - ZBClient: function() { - return { - topology: function() { - throw new NetworkError('TEST ERROR.', 13); - } - }; + const zeebeAPI = mockCamundaClient({ + ZBClient: { + topology: function() { + throw new NetworkError('TEST ERROR.', 13); + } } }); @@ -1525,13 +1473,11 @@ describe('ZeebeAPI', function() { it('for ', async () => { // given - const zeebeAPI = mockZeebeNode({ - ZBClient: function() { - return { - topology: function() { - throw new NetworkError('ENOTFOUND'); - } - }; + const zeebeAPI = mockCamundaClient({ + ZBClient: { + topology: function() { + throw new NetworkError('ENOTFOUND'); + } } }); @@ -1552,13 +1498,11 @@ describe('ZeebeAPI', function() { it('for (OAuth)', async () => { // given - const zeebeAPI = mockZeebeNode({ - ZBClient: function() { - return { - topology: function() { - throw new NetworkError('ENOTFOUND'); - } - }; + const zeebeAPI = mockCamundaClient({ + ZBClient: { + topology: function() { + throw new NetworkError('ENOTFOUND'); + } } }); @@ -1580,13 +1524,11 @@ describe('ZeebeAPI', function() { it('for (Cloud)', async () => { // given - const zeebeAPI = mockZeebeNode({ - ZBClient: function() { - return { - topology: function() { - throw new NetworkError('ENOTFOUND'); - } - }; + const zeebeAPI = mockCamundaClient({ + ZBClient: { + topology: function() { + throw new NetworkError('ENOTFOUND'); + } } }); @@ -1606,13 +1548,11 @@ describe('ZeebeAPI', function() { it('for ', async () => { // given - const zeebeAPI = mockZeebeNode({ - ZBClient: function() { - return { - topology: function() { - throw new NetworkError('Unauthorized'); - } - }; + const zeebeAPI = mockCamundaClient({ + ZBClient: { + topology: function() { + throw new NetworkError('Unauthorized'); + } } }); @@ -1633,13 +1573,11 @@ describe('ZeebeAPI', function() { it('for - Cloud', async () => { // given - const zeebeAPI = mockZeebeNode({ - ZBClient: function() { - return { - topology: function() { - throw new NetworkError('Unauthorized'); - } - }; + const zeebeAPI = mockCamundaClient({ + ZBClient: { + topology: function() { + throw new NetworkError('Unauthorized'); + } } }); @@ -1659,13 +1597,11 @@ describe('ZeebeAPI', function() { it('for ', async () => { // given - const zeebeAPI = mockZeebeNode({ - ZBClient: function() { - return { - topology: function() { - throw new NetworkError('Forbidden'); - } - }; + const zeebeAPI = mockCamundaClient({ + ZBClient: { + topology: function() { + throw new NetworkError('Forbidden'); + } } }); @@ -1685,13 +1621,11 @@ describe('ZeebeAPI', function() { it('for ', async () => { // given - const zeebeAPI = mockZeebeNode({ - ZBClient: function() { - return { - topology: function() { - throw new NetworkError('Unsupported protocol'); - } - }; + const zeebeAPI = mockCamundaClient({ + ZBClient: { + topology: function() { + throw new NetworkError('Unsupported protocol'); + } } }); @@ -1713,13 +1647,11 @@ describe('ZeebeAPI', function() { it('for ', async () => { // given - const zeebeAPI = mockZeebeNode({ - ZBClient: function() { - return { - topology: function() { - throw new NetworkError('Some random error'); - } - }; + const zeebeAPI = mockCamundaClient({ + ZBClient: { + topology: function() { + throw new NetworkError('Some random error'); + } } }); @@ -1740,13 +1672,11 @@ describe('ZeebeAPI', function() { it('for no message', async () => { // given - const zeebeAPI = mockZeebeNode({ - ZBClient: function() { - return { - topology: function() { - throw new NetworkError(); - } - }; + const zeebeAPI = mockCamundaClient({ + ZBClient: { + topology: function() { + throw new NetworkError(); + } } }); @@ -1775,7 +1705,7 @@ describe('ZeebeAPI', function() { // given let usedConfig; - const zeebeAPI = mockZeebeNode({ + const zeebeAPI = mockCamundaClient({ ZBClient: function(...args) { usedConfig = args; @@ -1805,7 +1735,7 @@ describe('ZeebeAPI', function() { // given const createSpy = sinon.spy(); - const zeebeAPI = mockZeebeNode({ + const zeebeAPI = mockCamundaClient({ ZBClient: createSpy }); @@ -1828,7 +1758,7 @@ describe('ZeebeAPI', function() { // given const createSpy = sinon.spy(); - const zeebeAPI = mockZeebeNode({ + const zeebeAPI = mockCamundaClient({ ZBClient: createSpy }); @@ -1857,7 +1787,7 @@ describe('ZeebeAPI', function() { close: noop }); - const zeebeAPI = mockZeebeNode({ + const zeebeAPI = mockCamundaClient({ ZBClient: createSpy }); @@ -1890,12 +1820,10 @@ describe('ZeebeAPI', function() { // given const closeSpy = sinon.spy(); - const zeebeAPI = mockZeebeNode({ - ZBClient: function() { - return { - deployResource: noop, - close: closeSpy - }; + const zeebeAPI = mockCamundaClient({ + ZBClient: { + deployResource: noop, + close: closeSpy } }); const parameters = { @@ -1926,7 +1854,7 @@ describe('ZeebeAPI', function() { // given let usedConfig; - const zeebeAPI = mockZeebeNode({ + const zeebeAPI = mockCamundaClient({ ZBClient: function(...args) { usedConfig = args; @@ -1956,7 +1884,7 @@ describe('ZeebeAPI', function() { // given let usedConfig; - const zeebeAPI = mockZeebeNode({ + const zeebeAPI = mockCamundaClient({ ZBClient: function(...args) { usedConfig = args; @@ -1986,7 +1914,7 @@ describe('ZeebeAPI', function() { // given let usedConfig; - const zeebeAPI = mockZeebeNode({ + const zeebeAPI = mockCamundaClient({ ZBClient: function(...args) { usedConfig = args; @@ -2017,7 +1945,7 @@ describe('ZeebeAPI', function() { // given let usedConfig; - const zeebeAPI = mockZeebeNode({ + const zeebeAPI = mockCamundaClient({ ZBClient: function(...args) { usedConfig = args; @@ -2047,7 +1975,7 @@ describe('ZeebeAPI', function() { // given let usedConfig; - const zeebeAPI = mockZeebeNode({ + const zeebeAPI = mockCamundaClient({ ZBClient: function(...args) { usedConfig = args; @@ -2077,7 +2005,7 @@ describe('ZeebeAPI', function() { // given let usedConfig; - const zeebeAPI = mockZeebeNode({ + const zeebeAPI = mockCamundaClient({ ZBClient: function(...args) { usedConfig = args; @@ -2107,7 +2035,7 @@ describe('ZeebeAPI', function() { // given let usedConfig; - const zeebeAPI = mockZeebeNode({ + const zeebeAPI = mockCamundaClient({ ZBClient: function(...args) { usedConfig = args; @@ -2140,7 +2068,7 @@ describe('ZeebeAPI', function() { error: sinon.spy(), warn: sinon.spy() }; - const zeebeAPI = mockZeebeNode({ + const zeebeAPI = mockCamundaClient({ ZBClient: function(...args) { configSpy(...args); @@ -2527,7 +2455,7 @@ function setupPlatformStub() { }); } -function mockZeebeNode(options = {}) { +function mockCamundaClient(options = {}) { const fs = options.fs || { readFile: () => ({}) }; @@ -2542,18 +2470,18 @@ function mockZeebeNode(options = {}) { ...(options.log || {}) }; - const ZeebeNode = { - ZBClient: options.ZBClient || function() { - return { + class CamundaClient { + getZeebeGrpcApiClient() { + return options.ZBClient || { topology: noop, deployResource: noop, createProcessInstance: noop, close: noop }; } - }; + } - return new ZeebeAPI(fs, ZeebeNode, flags, log); + return new ZeebeAPI(fs, CamundaClient, flags, log); } function noop() {} From f408ec709315b37303861beb2dddabaf8032f7df Mon Sep 17 00:00:00 2001 From: Maciej Barelkowski Date: Mon, 15 Apr 2024 15:12:14 +0200 Subject: [PATCH 5/9] test: improve mock --- app/test/spec/zeebe-api/zeebe-api-spec.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/test/spec/zeebe-api/zeebe-api-spec.js b/app/test/spec/zeebe-api/zeebe-api-spec.js index 116cbbf276..6ef78fe9c0 100644 --- a/app/test/spec/zeebe-api/zeebe-api-spec.js +++ b/app/test/spec/zeebe-api/zeebe-api-spec.js @@ -2472,12 +2472,12 @@ function mockCamundaClient(options = {}) { class CamundaClient { getZeebeGrpcApiClient() { - return options.ZBClient || { + return Object.assign({ topology: noop, deployResource: noop, createProcessInstance: noop, close: noop - }; + }, options.ZBClient); } } From e0f49d514a68d8325c2988268f6bda19bca0e16a Mon Sep 17 00:00:00 2001 From: Maciej Barelkowski Date: Mon, 15 Apr 2024 16:00:58 +0200 Subject: [PATCH 6/9] fix: pass URL correctly --- app/lib/zeebe-api/zeebe-api.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/lib/zeebe-api/zeebe-api.js b/app/lib/zeebe-api/zeebe-api.js index 4bc259c39a..c07190d054 100644 --- a/app/lib/zeebe-api/zeebe-api.js +++ b/app/lib/zeebe-api/zeebe-api.js @@ -351,7 +351,7 @@ class ZeebeAPI { } else if (authType === AUTH_TYPES.OAUTH) { options = { ...options, - ZEEBE_ADDRESS: endpoint.oauthURL, + ZEEBE_ADDRESS: endpoint.url, CAMUNDA_ZEEBE_OAUTH_AUDIENCE: endpoint.audience, CAMUNDA_TOKEN_SCOPE: endpoint.scope, CAMUNDA_ZEEBE_CLIENT_ID: endpoint.clientId, @@ -369,6 +369,11 @@ class ZeebeAPI { CAMUNDA_TOKEN_DISK_CACHE_DISABLE: true, CAMUNDA_SECURE_CONNECTION: true }; + } else if (type === ENDPOINT_TYPES.SELF_HOSTED) { + options = { + ...options, + ZEEBE_ADDRESS: endpoint.url + }; } options = await this._withTLSConfig(url, options); From 56f7b9f36b2b644a4dac276a7c830eb8abea670b Mon Sep 17 00:00:00 2001 From: Maciej Barelkowski Date: Mon, 15 Apr 2024 16:01:05 +0200 Subject: [PATCH 7/9] test: adjust tests --- app/test/spec/zeebe-api/zeebe-api-spec.js | 234 ++++++++-------------- 1 file changed, 80 insertions(+), 154 deletions(-) diff --git a/app/test/spec/zeebe-api/zeebe-api-spec.js b/app/test/spec/zeebe-api/zeebe-api-spec.js index 6ef78fe9c0..bb196b13ca 100644 --- a/app/test/spec/zeebe-api/zeebe-api-spec.js +++ b/app/test/spec/zeebe-api/zeebe-api-spec.js @@ -658,10 +658,8 @@ describe('ZeebeAPI', function() { const deployResourceSpy = sinon.spy(); const zeebeAPI = mockCamundaClient({ - ZBClient: function() { - return { - deployResource: deployResourceSpy - }; + ZBClient: { + deployResource: deployResourceSpy }, fs: { readFile() { @@ -694,10 +692,8 @@ describe('ZeebeAPI', function() { const deployResourceSpy = sinon.spy(); const zeebeAPI = mockCamundaClient({ - ZBClient: function() { - return { - deployResource: deployResourceSpy - }; + ZBClient: { + deployResource: deployResourceSpy }, fs: { readFile() { @@ -731,10 +727,8 @@ describe('ZeebeAPI', function() { const deployResourceSpy = sinon.spy(); const zeebeAPI = mockCamundaClient({ - ZBClient: function() { - return { - deployResource: deployResourceSpy - }; + ZBClient: { + deployResource: deployResourceSpy }, fs: { readFile() { @@ -772,10 +766,8 @@ describe('ZeebeAPI', function() { const deployResourceSpy = sinon.spy(); const zeebeAPI = mockCamundaClient({ - ZBClient: function() { - return { - deployResource: deployResourceSpy, - }; + ZBClient: { + deployResource: deployResourceSpy, } }); @@ -802,10 +794,8 @@ describe('ZeebeAPI', function() { const deployResourceSpy = sinon.spy(); const zeebeAPI = mockCamundaClient({ - ZBClient: function() { - return { - deployResource: deployResourceSpy, - }; + ZBClient: { + deployResource: deployResourceSpy, } }); @@ -833,10 +823,8 @@ describe('ZeebeAPI', function() { const deployResourceSpy = sinon.spy(); const zeebeAPI = mockCamundaClient({ - ZBClient: function() { - return { - deployResource: deployResourceSpy, - }; + ZBClient: { + deployResource: deployResourceSpy, } }); @@ -864,10 +852,8 @@ describe('ZeebeAPI', function() { const deployResourceSpy = sinon.spy(); const zeebeAPI = mockCamundaClient({ - ZBClient: function() { - return { - deployResource: deployResourceSpy, - }; + ZBClient: { + deployResource: deployResourceSpy, } }); @@ -894,10 +880,8 @@ describe('ZeebeAPI', function() { const deployResourceSpy = sinon.spy(); const zeebeAPI = mockCamundaClient({ - ZBClient: function() { - return { - deployResource: deployResourceSpy, - }; + ZBClient: { + deployResource: deployResourceSpy, } }); @@ -925,10 +909,8 @@ describe('ZeebeAPI', function() { const deployResourceSpy = sinon.spy(); const zeebeAPI = mockCamundaClient({ - ZBClient: function() { - return { - deployResource: deployResourceSpy, - }; + ZBClient: { + deployResource: deployResourceSpy, } }); @@ -956,10 +938,8 @@ describe('ZeebeAPI', function() { const deployResourceSpy = sinon.spy(); const zeebeAPI = mockCamundaClient({ - ZBClient: function() { - return { - deployResource: deployResourceSpy, - }; + ZBClient: { + deployResource: deployResourceSpy, } }); @@ -986,10 +966,8 @@ describe('ZeebeAPI', function() { const deployResourceSpy = sinon.spy(); const zeebeAPI = mockCamundaClient({ - ZBClient: function() { - return { - deployResource: deployResourceSpy, - }; + ZBClient: { + deployResource: deployResourceSpy, } }); @@ -1016,10 +994,8 @@ describe('ZeebeAPI', function() { const deployResourceSpy = sinon.spy(); const zeebeAPI = mockCamundaClient({ - ZBClient: function() { - return { - deployResource: deployResourceSpy, - }; + ZBClient: { + deployResource: deployResourceSpy, } }); @@ -1046,10 +1022,8 @@ describe('ZeebeAPI', function() { const deployResourceSpy = sinon.spy(); const zeebeAPI = mockCamundaClient({ - ZBClient: function() { - return { - deployResource: deployResourceSpy, - }; + ZBClient: { + deployResource: deployResourceSpy, } }); @@ -1077,10 +1051,8 @@ describe('ZeebeAPI', function() { const deployResourceSpy = sinon.spy(); const zeebeAPI = mockCamundaClient({ - ZBClient: function() { - return { - deployResource: deployResourceSpy, - }; + ZBClient: { + deployResource: deployResourceSpy, } }); @@ -1108,10 +1080,8 @@ describe('ZeebeAPI', function() { const deployResourceSpy = sinon.spy(); const zeebeAPI = mockCamundaClient({ - ZBClient: function() { - return { - deployResource: deployResourceSpy, - }; + ZBClient: { + deployResource: deployResourceSpy, } }); @@ -1139,10 +1109,8 @@ describe('ZeebeAPI', function() { const deployResourceSpy = sinon.spy(); const zeebeAPI = mockCamundaClient({ - ZBClient: function() { - return { - deployResource: deployResourceSpy, - }; + ZBClient: { + deployResource: deployResourceSpy, } }); @@ -1219,16 +1187,14 @@ describe('ZeebeAPI', function() { it('should pass configuration', async () => { // given + const configSpy = sinon.spy(); const deployResourceSpy = sinon.spy(); - const ZBClientMock = sinon.spy(function() { - return { - deployResource: deployResourceSpy - }; - }); - const zeebeAPI = mockCamundaClient({ - ZBClient: ZBClientMock + configSpy, + ZBClient: { + deployResource: deployResourceSpy + } }); // when @@ -1248,17 +1214,17 @@ describe('ZeebeAPI', function() { }); // then - const [ url, config ] = ZBClientMock.getCall(0).args; + const config = configSpy.getCall(0).args[0]; // ZBClient is invoked accordingly - expect(url).to.eql(TEST_URL); + expect(config.ZEEBE_ADDRESS).to.eql(TEST_URL); - expect(config.oAuth).to.include.keys({ - audience: 'audience', - clientId: 'clientId', - clientSecret: 'clientSecret', - scope: 'scope', - url: 'oauthURL' + expect(config).to.include.keys({ + CAMUNDA_ZEEBE_OAUTH_AUDIENCE: 'audience', + CAMUNDA_ZEEBE_CLIENT_ID: 'clientId', + CAMUNDA_ZEEBE_CLIENT_SECRET: 'clientSecret', + CAMUNDA_TOKEN_SCOPE: 'scope', + ZEEBE_ADDRESS: 'oauthURL' }); // deployment is executed appropriately @@ -1276,10 +1242,8 @@ describe('ZeebeAPI', function() { const deployResourceSpy = sinon.spy(); const zeebeAPI = mockCamundaClient({ - ZBClient: function() { - return { - deployResource: deployResourceSpy - }; + ZBClient: { + deployResource: deployResourceSpy } }); @@ -1706,12 +1670,8 @@ describe('ZeebeAPI', function() { let usedConfig; const zeebeAPI = mockCamundaClient({ - ZBClient: function(...args) { - usedConfig = args; - - return { - deployResource: noop - }; + configSpy(config) { + usedConfig = config; } }); @@ -1726,7 +1686,7 @@ describe('ZeebeAPI', function() { await zeebeAPI.deploy(parameters); // then - expect(usedConfig[0]).to.eql('https://camunda.com'); + expect(usedConfig.ZEEBE_ADDRESS).to.eql('https://camunda.com'); }); @@ -1736,7 +1696,7 @@ describe('ZeebeAPI', function() { const createSpy = sinon.spy(); const zeebeAPI = mockCamundaClient({ - ZBClient: createSpy + configSpy: createSpy }); const parameters = { @@ -1759,7 +1719,7 @@ describe('ZeebeAPI', function() { const createSpy = sinon.spy(); const zeebeAPI = mockCamundaClient({ - ZBClient: createSpy + configSpy: createSpy }); const parameters = { @@ -1782,13 +1742,10 @@ describe('ZeebeAPI', function() { it('should create new client instance if config is different', async () => { // given - const createSpy = sinon.stub().returns({ - deployResource: noop, - close: noop - }); + const createSpy = sinon.spy(); const zeebeAPI = mockCamundaClient({ - ZBClient: createSpy + configSpy: createSpy }); const parameters = { @@ -1822,7 +1779,6 @@ describe('ZeebeAPI', function() { const zeebeAPI = mockCamundaClient({ ZBClient: { - deployResource: noop, close: closeSpy } }); @@ -1855,12 +1811,8 @@ describe('ZeebeAPI', function() { let usedConfig; const zeebeAPI = mockCamundaClient({ - ZBClient: function(...args) { - usedConfig = args; - - return { - deployResource: noop - }; + configSpy(config) { + usedConfig = config; } }); @@ -1875,7 +1827,7 @@ describe('ZeebeAPI', function() { await zeebeAPI.deploy(parameters); // then - expect(usedConfig[1]).to.have.property('useTLS', true); + expect(usedConfig).to.have.property('useTLS', true); }); @@ -1885,12 +1837,8 @@ describe('ZeebeAPI', function() { let usedConfig; const zeebeAPI = mockCamundaClient({ - ZBClient: function(...args) { - usedConfig = args; - - return { - deployResource: noop - }; + configSpy(config) { + usedConfig = config; } }); @@ -1905,7 +1853,7 @@ describe('ZeebeAPI', function() { await zeebeAPI.deploy(parameters); // then - expect(usedConfig[1]).to.have.property('useTLS', false); + expect(usedConfig).to.have.property('useTLS', false); }); @@ -1915,12 +1863,8 @@ describe('ZeebeAPI', function() { let usedConfig; const zeebeAPI = mockCamundaClient({ - ZBClient: function(...args) { - usedConfig = args; - - return { - deployResource: noop - }; + configSpy(config) { + usedConfig = config; } }); @@ -1936,7 +1880,7 @@ describe('ZeebeAPI', function() { await zeebeAPI.deploy(parameters); // then - expect(usedConfig[1]).to.have.property('useTLS', false); + expect(usedConfig).to.have.property('useTLS', false); }); @@ -1946,12 +1890,8 @@ describe('ZeebeAPI', function() { let usedConfig; const zeebeAPI = mockCamundaClient({ - ZBClient: function(...args) { - usedConfig = args; - - return { - deployResource: noop - }; + configSpy(config) { + usedConfig = config; } }); @@ -1966,7 +1906,7 @@ describe('ZeebeAPI', function() { await zeebeAPI.deploy(parameters); // then - expect(usedConfig[1]).to.have.property('useTLS', true); + expect(usedConfig).to.have.property('CAMUNDA_SECURE_CONNECTION', true); }); @@ -1976,12 +1916,8 @@ describe('ZeebeAPI', function() { let usedConfig; const zeebeAPI = mockCamundaClient({ - ZBClient: function(...args) { - usedConfig = args; - - return { - deployResource: noop - }; + configSpy(config) { + usedConfig = config; } }); @@ -1996,7 +1932,7 @@ describe('ZeebeAPI', function() { await zeebeAPI.deploy(parameters); // then - expect(usedConfig[1]).not.to.have.property('port'); + expect(usedConfig).not.to.have.property('port'); }); @@ -2006,12 +1942,8 @@ describe('ZeebeAPI', function() { let usedConfig; const zeebeAPI = mockCamundaClient({ - ZBClient: function(...args) { - usedConfig = args; - - return { - deployResource: noop - }; + configSpy(config) { + usedConfig = config; } }); @@ -2026,7 +1958,7 @@ describe('ZeebeAPI', function() { await zeebeAPI.deploy(parameters); // then - expect(usedConfig[1]).to.have.property('port', '80'); + expect(usedConfig).to.have.property('port', '80'); }); @@ -2036,12 +1968,8 @@ describe('ZeebeAPI', function() { let usedConfig; const zeebeAPI = mockCamundaClient({ - ZBClient: function(...args) { - usedConfig = args; - - return { - deployResource: noop - }; + configSpy(config) { + usedConfig = config; } }); @@ -2056,7 +1984,7 @@ describe('ZeebeAPI', function() { await zeebeAPI.deploy(parameters); // then - expect(usedConfig[1]).to.have.property('port', '443'); + expect(usedConfig).to.have.property('port', '443'); }); @@ -2069,13 +1997,7 @@ describe('ZeebeAPI', function() { warn: sinon.spy() }; const zeebeAPI = mockCamundaClient({ - ZBClient: function(...args) { - configSpy(...args); - - return { - deployResource: noop - }; - }, + configSpy, flags: { get() { return '/path/to/cert.pem'; @@ -2471,6 +2393,10 @@ function mockCamundaClient(options = {}) { }; class CamundaClient { + constructor(config) { + options.configSpy && options.configSpy(config); + } + getZeebeGrpcApiClient() { return Object.assign({ topology: noop, From f97611db29303c22978849ff0e8c4d5510317635 Mon Sep 17 00:00:00 2001 From: Maciej Barelkowski Date: Wed, 22 May 2024 16:25:26 +0200 Subject: [PATCH 8/9] deps: use @camunda8/sdk@8.5.3 --- app/package.json | 2 +- package-lock.json | 226 ++++++++++++++++++++++++++++++++++------------ 2 files changed, 171 insertions(+), 57 deletions(-) diff --git a/app/package.json b/app/package.json index fe9f64bc62..f1b9379dbd 100644 --- a/app/package.json +++ b/app/package.json @@ -11,7 +11,7 @@ }, "license": "MIT", "dependencies": { - "@camunda8/sdk": "^8.5.0", + "@camunda8/sdk": "^8.5.3", "@sentry/integrations": "^7.113.0", "@sentry/node": "^8.0.0", "epipebomb": "^1.0.0", diff --git a/package-lock.json b/package-lock.json index 54107cb2c1..37d7fda596 100644 --- a/package-lock.json +++ b/package-lock.json @@ -53,7 +53,7 @@ "version": "5.23.0", "license": "MIT", "dependencies": { - "@camunda8/sdk": "^8.5.0", + "@camunda8/sdk": "^8.5.3", "@sentry/integrations": "^7.113.0", "@sentry/node": "^8.0.0", "epipebomb": "^1.0.0", @@ -3128,28 +3128,31 @@ "integrity": "sha512-T0U6Ij3AS191KADumm5rXCVUYtKSFBiipexQL3lJHey1XmADmTGIqhAe8+iCyKqUaxixjv5Q/IkuFD2NqBoIpw==" }, "node_modules/@camunda8/sdk": { - "version": "8.5.0", - "resolved": "https://registry.npmjs.org/@camunda8/sdk/-/sdk-8.5.0.tgz", - "integrity": "sha512-fyY5YME0revYwxko9bz7Cnndh18LOeDRugxG8rcyP71CFNRsg1h9qK2TD7IQHi+boU8+lXVhwIk4FrRX7BZ1XA==", + "version": "8.5.3", + "resolved": "https://registry.npmjs.org/@camunda8/sdk/-/sdk-8.5.3.tgz", + "integrity": "sha512-nJatfx5VjtqwpAMwKppjP5Mvyf87YAfrUCM2c1dnzzo1TPylGHxUZlJoOK9eCbcRh+re+5Us2tpezdHR9bdnKw==", "dependencies": { - "@grpc/grpc-js": "1.9.7", - "@grpc/proto-loader": "0.7.10", + "@grpc/grpc-js": "1.10.7", + "@grpc/proto-loader": "0.7.13", "chalk": "^2.4.2", "console-stamp": "^3.0.2", "dayjs": "^1.8.15", "debug": "^4.3.4", "fast-xml-parser": "^4.1.3", "got": "^11.8.6", + "jwt-decode": "^4.0.0", "lodash.mergewith": "^4.6.2", "long": "^4.0.0", "lossless-json": "^4.0.1", "neon-env": "^0.1.3", - "node-fetch": "^2.7.0", "promise-retry": "^1.1.1", "reflect-metadata": "^0.2.1", "stack-trace": "0.0.10", "typed-duration": "^1.0.12", "uuid": "^7.0.3" + }, + "optionalDependencies": { + "win-ca": "3.5.1" } }, "node_modules/@camunda8/sdk/node_modules/err-code": { @@ -3537,25 +3540,25 @@ "license": "MIT" }, "node_modules/@grpc/grpc-js": { - "version": "1.9.7", - "resolved": "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-1.9.7.tgz", - "integrity": "sha512-yMaA/cIsRhGzW3ymCNpdlPcInXcovztlgu/rirThj2b87u3RzWUszliOqZ/pldy7yhmJPS8uwog+kZSTa4A0PQ==", + "version": "1.10.7", + "resolved": "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-1.10.7.tgz", + "integrity": "sha512-ZMBVjSeDAz3tFSehyO6Pd08xZT1HfIwq3opbeM4cDlBh52gmwp0wVIPcQur53NN0ac68HMZ/7SF2rGRD5KmVmg==", "dependencies": { - "@grpc/proto-loader": "^0.7.8", - "@types/node": ">=12.12.47" + "@grpc/proto-loader": "^0.7.13", + "@js-sdsl/ordered-map": "^4.4.2" }, "engines": { - "node": "^8.13.0 || >=10.10.0" + "node": ">=12.10.0" } }, "node_modules/@grpc/proto-loader": { - "version": "0.7.10", - "resolved": "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.7.10.tgz", - "integrity": "sha512-CAqDfoaQ8ykFd9zqBDn4k6iWT9loLAlc2ETmDFS9JCD70gDcnA4L3AFEo2iV7KyAtAAHFW9ftq1Fz+Vsgq80RQ==", + "version": "0.7.13", + "resolved": "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.7.13.tgz", + "integrity": "sha512-AiXO/bfe9bmxBjxxtYxFAXGZvMaN5s8kO+jBHAJCON8rJoB5YS/D6X7ZNc6XQkuHNmyl4CYaMI1fJ/Gn27RGGw==", "dependencies": { "lodash.camelcase": "^4.3.0", "long": "^5.0.0", - "protobufjs": "^7.2.4", + "protobufjs": "^7.2.5", "yargs": "^17.7.2" }, "bin": { @@ -3923,6 +3926,15 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, + "node_modules/@js-sdsl/ordered-map": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/@js-sdsl/ordered-map/-/ordered-map-4.4.2.tgz", + "integrity": "sha512-iUKgm52T8HOE/makSxjqoWhe95ZJA1/G1sYsGev2JDKUSS14KAgg1LHb+Ba+IPow0xflbnSkOsZcO08C7w1gYw==", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/js-sdsl" + } + }, "node_modules/@lerna/create": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/@lerna/create/-/create-8.0.0.tgz", @@ -14609,6 +14621,7 @@ }, "node_modules/encoding": { "version": "0.1.13", + "dev": true, "license": "MIT", "optional": true, "dependencies": { @@ -17036,7 +17049,7 @@ }, "node_modules/iconv-lite": { "version": "0.6.3", - "devOptional": true, + "dev": true, "license": "MIT", "dependencies": { "safer-buffer": ">= 2.1.2 < 3.0.0" @@ -17591,6 +17604,12 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/is-electron": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/is-electron/-/is-electron-2.2.2.tgz", + "integrity": "sha512-FO/Rhvz5tuw4MCWkpMzHFKWD2LsfHzIb7i6MdPYZ/KW7AlxawyLkqdy+jPZP1WubqEADE3O4FUENlJHDfQASRg==", + "optional": true + }, "node_modules/is-empty": { "version": "1.2.0", "dev": true, @@ -18438,6 +18457,14 @@ "dev": true, "license": "MIT" }, + "node_modules/jwt-decode": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jwt-decode/-/jwt-decode-4.0.0.tgz", + "integrity": "sha512-+KJGIyHgkGuIq3IEBNftfhW/LfWhXUIY6OmyVWjliu5KH1y0fw7VQ8YndE2O4qZdMSd9SqbnC8GOcZEy0Om7sA==", + "engines": { + "node": ">=18" + } + }, "node_modules/karma": { "version": "6.4.2", "resolved": "https://registry.npmjs.org/karma/-/karma-6.4.2.tgz", @@ -21868,6 +21895,7 @@ "version": "2.7.0", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "dev": true, "dependencies": { "whatwg-url": "^5.0.0" }, @@ -21883,6 +21911,15 @@ } } }, + "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==", + "optional": true, + "engines": { + "node": ">= 6.13.0" + } + }, "node_modules/node-gyp": { "version": "9.3.0", "dev": true, @@ -24524,7 +24561,7 @@ }, "node_modules/pify": { "version": "3.0.0", - "dev": true, + "devOptional": true, "license": "MIT", "engines": { "node": ">=4" @@ -24933,9 +24970,9 @@ } }, "node_modules/protobufjs": { - "version": "7.2.5", - "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.2.5.tgz", - "integrity": "sha512-gGXRSXvxQ7UiPgfw8gevrfRWcTlSbOFg+p/N+JVJEK5VhueL2miT6qTymqAmjr1Q5WbOCyJbyrk6JfWKwlFn6A==", + "version": "7.3.0", + "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.3.0.tgz", + "integrity": "sha512-YWD03n3shzV9ImZRX3ccbjqLxj7NokGN0V/ESiBV5xWqrommYHYiihuIyavq03pWSGqlyvYUFmfoMKd+1rPA/g==", "hasInstallScript": true, "dependencies": { "@protobufjs/aspromise": "^1.1.2", @@ -28709,7 +28746,7 @@ }, "node_modules/safer-buffer": { "version": "2.1.2", - "devOptional": true, + "dev": true, "license": "MIT" }, "node_modules/sanitize-filename": { @@ -29588,7 +29625,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/split/-/split-1.0.1.tgz", "integrity": "sha512-mTyOoPbrivtXnwnIxZRFYRrPNtEFKlpB2fvjSnCQUiAA6qAZzqwna5envK4uk6OIeP17CsdF3rSBGYVBsU0Tkg==", - "dev": true, + "devOptional": true, "dependencies": { "through": "2" }, @@ -30254,7 +30291,7 @@ }, "node_modules/through": { "version": "2.3.8", - "dev": true, + "devOptional": true, "license": "MIT" }, "node_modules/through2": { @@ -30434,7 +30471,8 @@ "node_modules/tr46": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", + "dev": true }, "node_modules/trim-newlines": { "version": "3.0.1", @@ -32674,7 +32712,8 @@ "node_modules/webidl-conversions": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", + "dev": true }, "node_modules/webpack": { "version": "5.90.2", @@ -32824,6 +32863,7 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "dev": true, "dependencies": { "tr46": "~0.0.3", "webidl-conversions": "^3.0.0" @@ -32893,6 +32933,31 @@ "dev": true, "license": "MIT" }, + "node_modules/win-ca": { + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/win-ca/-/win-ca-3.5.1.tgz", + "integrity": "sha512-RNy9gpBS6cxWHjfbqwBA7odaHyT+YQNhtdpJZwYCFoxB/Dq22oeOZ9YCXMwjhLytKpo7JJMnKdJ/ve7N12zzfQ==", + "hasInstallScript": true, + "optional": true, + "dependencies": { + "is-electron": "^2.2.0", + "make-dir": "^1.3.0", + "node-forge": "^1.2.1", + "split": "^1.0.1" + } + }, + "node_modules/win-ca/node_modules/make-dir": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.3.0.tgz", + "integrity": "sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ==", + "optional": true, + "dependencies": { + "pify": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/wordwrap": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", @@ -35112,28 +35177,29 @@ "integrity": "sha512-T0U6Ij3AS191KADumm5rXCVUYtKSFBiipexQL3lJHey1XmADmTGIqhAe8+iCyKqUaxixjv5Q/IkuFD2NqBoIpw==" }, "@camunda8/sdk": { - "version": "8.5.0", - "resolved": "https://registry.npmjs.org/@camunda8/sdk/-/sdk-8.5.0.tgz", - "integrity": "sha512-fyY5YME0revYwxko9bz7Cnndh18LOeDRugxG8rcyP71CFNRsg1h9qK2TD7IQHi+boU8+lXVhwIk4FrRX7BZ1XA==", + "version": "8.5.3", + "resolved": "https://registry.npmjs.org/@camunda8/sdk/-/sdk-8.5.3.tgz", + "integrity": "sha512-nJatfx5VjtqwpAMwKppjP5Mvyf87YAfrUCM2c1dnzzo1TPylGHxUZlJoOK9eCbcRh+re+5Us2tpezdHR9bdnKw==", "requires": { - "@grpc/grpc-js": "1.9.7", - "@grpc/proto-loader": "0.7.10", + "@grpc/grpc-js": "1.10.7", + "@grpc/proto-loader": "0.7.13", "chalk": "^2.4.2", "console-stamp": "^3.0.2", "dayjs": "^1.8.15", "debug": "^4.3.4", "fast-xml-parser": "^4.1.3", "got": "^11.8.6", + "jwt-decode": "^4.0.0", "lodash.mergewith": "^4.6.2", "long": "^4.0.0", "lossless-json": "^4.0.1", "neon-env": "^0.1.3", - "node-fetch": "^2.7.0", "promise-retry": "^1.1.1", "reflect-metadata": "^0.2.1", "stack-trace": "0.0.10", "typed-duration": "^1.0.12", - "uuid": "^7.0.3" + "uuid": "^7.0.3", + "win-ca": "3.5.1" }, "dependencies": { "err-code": { @@ -35440,22 +35506,22 @@ "dev": true }, "@grpc/grpc-js": { - "version": "1.9.7", - "resolved": "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-1.9.7.tgz", - "integrity": "sha512-yMaA/cIsRhGzW3ymCNpdlPcInXcovztlgu/rirThj2b87u3RzWUszliOqZ/pldy7yhmJPS8uwog+kZSTa4A0PQ==", + "version": "1.10.7", + "resolved": "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-1.10.7.tgz", + "integrity": "sha512-ZMBVjSeDAz3tFSehyO6Pd08xZT1HfIwq3opbeM4cDlBh52gmwp0wVIPcQur53NN0ac68HMZ/7SF2rGRD5KmVmg==", "requires": { - "@grpc/proto-loader": "^0.7.8", - "@types/node": ">=12.12.47" + "@grpc/proto-loader": "^0.7.13", + "@js-sdsl/ordered-map": "^4.4.2" } }, "@grpc/proto-loader": { - "version": "0.7.10", - "resolved": "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.7.10.tgz", - "integrity": "sha512-CAqDfoaQ8ykFd9zqBDn4k6iWT9loLAlc2ETmDFS9JCD70gDcnA4L3AFEo2iV7KyAtAAHFW9ftq1Fz+Vsgq80RQ==", + "version": "0.7.13", + "resolved": "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.7.13.tgz", + "integrity": "sha512-AiXO/bfe9bmxBjxxtYxFAXGZvMaN5s8kO+jBHAJCON8rJoB5YS/D6X7ZNc6XQkuHNmyl4CYaMI1fJ/Gn27RGGw==", "requires": { "lodash.camelcase": "^4.3.0", "long": "^5.0.0", - "protobufjs": "^7.2.4", + "protobufjs": "^7.2.5", "yargs": "^17.7.2" }, "dependencies": { @@ -35712,6 +35778,11 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, + "@js-sdsl/ordered-map": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/@js-sdsl/ordered-map/-/ordered-map-4.4.2.tgz", + "integrity": "sha512-iUKgm52T8HOE/makSxjqoWhe95ZJA1/G1sYsGev2JDKUSS14KAgg1LHb+Ba+IPow0xflbnSkOsZcO08C7w1gYw==" + }, "@lerna/create": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/@lerna/create/-/create-8.0.0.tgz", @@ -40732,11 +40803,9 @@ "camunda-modeler": { "version": "file:app", "requires": { + "@camunda8/sdk": "^8.5.3", "@sentry/integrations": "^7.113.0", "@sentry/node": "^8.0.0", - "@camunda8/sdk": "^8.5.0", - "@sentry/integrations": "^7.82.0", - "@sentry/node": "^7.82.0", "epipebomb": "^1.0.0", "fast-glob": "^3.3.1", "ids": "^1.0.0", @@ -44082,6 +44151,7 @@ }, "encoding": { "version": "0.1.13", + "dev": true, "optional": true, "requires": { "iconv-lite": "^0.6.2" @@ -45781,7 +45851,7 @@ }, "iconv-lite": { "version": "0.6.3", - "devOptional": true, + "dev": true, "requires": { "safer-buffer": ">= 2.1.2 < 3.0.0" } @@ -46166,6 +46236,12 @@ "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==", "dev": true }, + "is-electron": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/is-electron/-/is-electron-2.2.2.tgz", + "integrity": "sha512-FO/Rhvz5tuw4MCWkpMzHFKWD2LsfHzIb7i6MdPYZ/KW7AlxawyLkqdy+jPZP1WubqEADE3O4FUENlJHDfQASRg==", + "optional": true + }, "is-empty": { "version": "1.2.0", "dev": true @@ -46721,6 +46797,11 @@ "version": "4.2.1", "dev": true }, + "jwt-decode": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jwt-decode/-/jwt-decode-4.0.0.tgz", + "integrity": "sha512-+KJGIyHgkGuIq3IEBNftfhW/LfWhXUIY6OmyVWjliu5KH1y0fw7VQ8YndE2O4qZdMSd9SqbnC8GOcZEy0Om7sA==" + }, "karma": { "version": "6.4.2", "resolved": "https://registry.npmjs.org/karma/-/karma-6.4.2.tgz", @@ -49028,10 +49109,17 @@ "version": "2.7.0", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "dev": true, "requires": { "whatwg-url": "^5.0.0" } }, + "node-forge": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.3.1.tgz", + "integrity": "sha512-dPEtOeMvF9VMcYV/1Wb8CPoVAXtp6MKMlcbAt4ddqmGqUJ6fQZFXkNZNkNlfevtNkGtaSoXf/vNNNSvgrdXwtA==", + "optional": true + }, "node-gyp": { "version": "9.3.0", "dev": true, @@ -50907,7 +50995,7 @@ }, "pify": { "version": "3.0.0", - "dev": true + "devOptional": true }, "pinkie": { "version": "2.0.4", @@ -51168,9 +51256,9 @@ } }, "protobufjs": { - "version": "7.2.5", - "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.2.5.tgz", - "integrity": "sha512-gGXRSXvxQ7UiPgfw8gevrfRWcTlSbOFg+p/N+JVJEK5VhueL2miT6qTymqAmjr1Q5WbOCyJbyrk6JfWKwlFn6A==", + "version": "7.3.0", + "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.3.0.tgz", + "integrity": "sha512-YWD03n3shzV9ImZRX3ccbjqLxj7NokGN0V/ESiBV5xWqrommYHYiihuIyavq03pWSGqlyvYUFmfoMKd+1rPA/g==", "requires": { "@protobufjs/aspromise": "^1.1.2", "@protobufjs/base64": "^1.1.2", @@ -53772,7 +53860,7 @@ }, "safer-buffer": { "version": "2.1.2", - "devOptional": true + "dev": true }, "sanitize-filename": { "version": "1.6.3", @@ -54434,7 +54522,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/split/-/split-1.0.1.tgz", "integrity": "sha512-mTyOoPbrivtXnwnIxZRFYRrPNtEFKlpB2fvjSnCQUiAA6qAZzqwna5envK4uk6OIeP17CsdF3rSBGYVBsU0Tkg==", - "dev": true, + "devOptional": true, "requires": { "through": "2" } @@ -54913,7 +55001,7 @@ }, "through": { "version": "2.3.8", - "dev": true + "devOptional": true }, "through2": { "version": "2.0.5", @@ -55046,7 +55134,8 @@ "tr46": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", + "dev": true }, "trim-newlines": { "version": "3.0.1", @@ -56542,7 +56631,8 @@ "webidl-conversions": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", + "dev": true }, "webpack": { "version": "5.90.2", @@ -56642,6 +56732,7 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "dev": true, "requires": { "tr46": "~0.0.3", "webidl-conversions": "^3.0.0" @@ -56695,6 +56786,29 @@ "version": "2.0.0", "dev": true }, + "win-ca": { + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/win-ca/-/win-ca-3.5.1.tgz", + "integrity": "sha512-RNy9gpBS6cxWHjfbqwBA7odaHyT+YQNhtdpJZwYCFoxB/Dq22oeOZ9YCXMwjhLytKpo7JJMnKdJ/ve7N12zzfQ==", + "optional": true, + "requires": { + "is-electron": "^2.2.0", + "make-dir": "^1.3.0", + "node-forge": "^1.2.1", + "split": "^1.0.1" + }, + "dependencies": { + "make-dir": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.3.0.tgz", + "integrity": "sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ==", + "optional": true, + "requires": { + "pify": "^3.0.0" + } + } + } + }, "wordwrap": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", From c437f3b327b93f75d0cb16b939dd00d73e019bfe Mon Sep 17 00:00:00 2001 From: Maciej Barelkowski Date: Wed, 22 May 2024 17:24:33 +0200 Subject: [PATCH 9/9] test: adjust after rebase --- app/test/spec/zeebe-api/zeebe-api-spec.js | 24 +++++++++++------------ 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/app/test/spec/zeebe-api/zeebe-api-spec.js b/app/test/spec/zeebe-api/zeebe-api-spec.js index bb196b13ca..78387ab895 100644 --- a/app/test/spec/zeebe-api/zeebe-api-spec.js +++ b/app/test/spec/zeebe-api/zeebe-api-spec.js @@ -1147,7 +1147,7 @@ describe('ZeebeAPI', function() { }; }); - const zeebeAPI = mockZeebeNode({ + const zeebeAPI = mockCamundaClient({ ZBClient: ZBClientMock }); @@ -2230,7 +2230,7 @@ describe('ZeebeAPI', function() { warn: logSpy }; - const zeebeAPI = mockZeebeNode({ log }); + const zeebeAPI = mockCamundaClient({ log }); const parameters = { endpoint: { @@ -2296,7 +2296,7 @@ describe('ZeebeAPI', function() { warn: logSpy }; - const zeebeAPI = mockZeebeNode({ log }); + const zeebeAPI = mockCamundaClient({ log }); const parameters = { endpoint: { @@ -2315,8 +2315,6 @@ describe('ZeebeAPI', function() { await zeebeAPI.deploy(parameters); // then - console.log(logSpy.getCalls().map(call => JSON.stringify(call.args), null, 2)); - expect(logSpy).to.have.been.called; const createClientCall = logSpy.getCalls().find(call => call.args[ 0 ] === 'creating client'); @@ -2326,15 +2324,15 @@ describe('ZeebeAPI', function() { expect(createClientCall.args[ 1 ]).to.eql({ url: 'http://localhost:26500', options:{ - retry: false, - oAuth: { - url: 'oauthURL', - audience: 'audience', - scope: 'scope', - clientId: '******', - clientSecret: '******', - cacheOnDisk: false, + zeebeGrpcSettings: { + ZEEBE_GRPC_CLIENT_RETRY: false }, + CAMUNDA_TOKEN_DISK_CACHE_DISABLE: true, + CAMUNDA_TOKEN_SCOPE: 'scope', + CAMUNDA_ZEEBE_CLIENT_ID: '******', + CAMUNDA_ZEEBE_CLIENT_SECRET: '******', + CAMUNDA_ZEEBE_OAUTH_AUDIENCE: 'audience', + ZEEBE_ADDRESS: 'http://localhost:26500', useTLS: false } });