Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deps: replace zeebe-node with @camunda8/sdk #4233

Draft
wants to merge 9 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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, flags);

return {
config,
Expand Down
55 changes: 28 additions & 27 deletions app/lib/zeebe-api/zeebe-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@ const CLIENT_OPTIONS_SECRETS = [
*/

class ZeebeAPI {
constructor(fs, ZeebeNode, flags, log = createLog('app:zeebe-api')) {
constructor(fs, Camunda8, flags, log = createLog('app:zeebe-api')) {
this._fs = fs;

this._ZeebeNode = ZeebeNode;
this._Camunda8 = Camunda8;
this._flags = flags;
this._log = log;

Expand Down Expand Up @@ -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)) {
Expand All @@ -350,31 +351,37 @@ 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.url,
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
};
} else if (type === ENDPOINT_TYPES.SELF_HOSTED) {
options = {
...options,
ZEEBE_ADDRESS: endpoint.url
};
}

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,
Expand All @@ -389,7 +396,7 @@ class ZeebeAPI {
)
});

return new this._ZeebeNode.ZBClient(url, options);
return (new this._Camunda8(options)).getZeebeGrpcApiClient();
}

async _withTLSConfig(url, options) {
Expand Down Expand Up @@ -443,12 +450,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
Expand Down
4 changes: 2 additions & 2 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
},
"license": "MIT",
"dependencies": {
"@camunda8/sdk": "^8.5.3",
"@sentry/integrations": "^7.113.0",
"@sentry/node": "^8.0.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",
"zeebe-node": "^8.3.2"
"parents": "^1.0.1"
},
"homepage": "https://github.com/camunda/camunda-modeler",
"repository": {
Expand Down
Loading
Loading