Skip to content

Commit

Permalink
fix(cli): fix tenant create command
Browse files Browse the repository at this point in the history
  • Loading branch information
Plopix committed Jan 24, 2025
1 parent fbe3bb6 commit e4ab127
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
4 changes: 4 additions & 0 deletions components/cli/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to this project will be documented in this file.

## [5.2.2]

- fix bug introduced in the 5.2.1 for tenant create command

## [5.2.1]

- capability to replace Root Tenant Id and Vat Type in the install process from the extra mutation.
Expand Down
2 changes: 1 addition & 1 deletion components/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@crystallize/cli",
"version": "5.2.1",
"version": "5.2.2",
"description": "Crystallize CLI",
"module": "src/index.ts",
"repository": "https://github.com/CrystallizeAPI/crystallize-cli",
Expand Down
13 changes: 11 additions & 2 deletions components/cli/src/domain/use-cases/create-clean-tenant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type Deps = {
type Command = {
tenant: Tenant;
credentials: PimCredentials;
folder: string;
folder?: string;
};

export type CreateCleanTenantHandlerDefinition = CommandHandlerDefinition<
Expand All @@ -36,7 +36,7 @@ const handler = async (
id: string;
identifier: string;
}> => {
const { folder, tenant, credentials } = envelope.message;
const { tenant, credentials } = envelope.message;
const finalCredentials = credentials || (await credentialsRetriever.getCredentials());
const client = createCrystallizeClient({
tenantIdentifier: '',
Expand Down Expand Up @@ -86,6 +86,15 @@ const handler = async (
const query = jsonToGraphQLQuery({ mutation });
await client.pimApi(query);

// if we have a folder, we check that folder for .crystallize folder and convention
const { folder } = envelope.message;
if (!folder) {
return {
id,
identifier,
};
}

const cClient = createCrystallizeClient({
tenantIdentifier: tenant.identifier,
tenantId: id,
Expand Down

0 comments on commit e4ab127

Please sign in to comment.