From 85bdb9153a38222d76fa456dfc98441de3644c9e Mon Sep 17 00:00:00 2001 From: Michael Goberling Date: Wed, 4 Dec 2024 19:07:26 -0500 Subject: [PATCH] fix: scopes not attached to credentials when adding services --- lib/index.js | 7 +++++-- test/lib/index.test.js | 6 +++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/index.js b/lib/index.js index 754a44d..f147668 100644 --- a/lib/index.js +++ b/lib/index.js @@ -357,7 +357,10 @@ class LibConsoleCLI { )).id } else { // default is jwt credentialId = (await this.createEnterpriseCredentials(orgId, project, workspace, certDir)).id + credentialType = 'entp' } + } else { // If using an existing credential, ignore the passed credential type. If it's a service credential, use 'entp'... + credentialType = credential.integration_type === 'service' ? 'entp' : credential.integration_type } spinner.start(`Attaching Services to the ${credentialType} Credentials of Workspace ${workspace.name}...`) @@ -368,7 +371,7 @@ class LibConsoleCLI { orgId, project.id, workspace.id, - 'entp', + credentialType, credentialId, serviceInfo )).body @@ -768,7 +771,7 @@ class LibConsoleCLI { } LibConsoleCLI.JWT_CREDENTIAL = 'jwt' -LibConsoleCLI.OAUTH_SERVER_TO_SERVER_CREDENTIAL = 'oauth server-to-server' +LibConsoleCLI.OAUTH_SERVER_TO_SERVER_CREDENTIAL = 'oauth_server_to_server' // static function making sure there are no spinner running (e.g. in case of error) LibConsoleCLI.cleanStdOut = () => { spinner.stop() } diff --git a/test/lib/index.test.js b/test/lib/index.test.js index e2eb589..ad38c63 100644 --- a/test/lib/index.test.js +++ b/test/lib/index.test.js @@ -372,7 +372,7 @@ describe('instance methods tests', () => { orgId, projectId, workspaceId, - integrations[0].flow_type, + integrations[0].integration_type, integrations[0].id_integration, dataMocks.subscribeServicesPayload ) @@ -399,7 +399,7 @@ describe('instance methods tests', () => { orgId, projectId, workspaceId, - integrations[0].flow_type, + integrations[0].integration_type, integrations[0].id_integration, dataMocks.subscribeServicesPayload ) @@ -569,7 +569,7 @@ describe('instance methods tests', () => { orgId, projectId, workspaceId, - oauthS2SCredential.flow_type, + oauthS2SCredential.integration_type, oauthS2SCredential.id_integration, dataMocks.subscribeServicesPayload )