Skip to content

Commit

Permalink
refactor(cloud): extract some utilities out of CloudApi (#6707)
Browse files Browse the repository at this point in the history
* chore: fix some typos

* refactor(cloud): move some static util methods outside `CloudApi` class

* chore: update jsdocs

* chore: use readonly fields where possible

* refactor: rename class `CloudApi` -> `GardenCloudApi`

* refactor: extract `apiFetch` machinery as inner http client class
  • Loading branch information
vvagaytsev authored Dec 11, 2024
1 parent a9c205b commit 8813634
Show file tree
Hide file tree
Showing 17 changed files with 421 additions and 398 deletions.
6 changes: 3 additions & 3 deletions core/src/cli/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ import { generateBasicDebugInfoReport } from "../commands/get/get-debug-info.js"
import type { AnalyticsHandler } from "../analytics/analytics.js"
import type { GardenPluginReference } from "../plugin/plugin.js"
import type { CloudApiFactory } from "../cloud/api.js"
import { CloudApi, CloudApiTokenRefreshError, getGardenCloudDomain } from "../cloud/api.js"
import { GardenCloudApi, CloudApiTokenRefreshError, getGardenCloudDomain } from "../cloud/api.js"
import { findProjectConfig } from "../config/base.js"
import { pMemoizeDecorator } from "../lib/p-memoize.js"
import { getCustomCommands } from "../commands/custom.js"
Expand Down Expand Up @@ -98,7 +98,7 @@ export class GardenCli {
public processRecord?: GardenProcess
protected cloudApiFactory: CloudApiFactory

constructor({ plugins, initLogger = false, cloudApiFactory = CloudApi.factory }: GardenCliParams = {}) {
constructor({ plugins, initLogger = false, cloudApiFactory = GardenCloudApi.factory }: GardenCliParams = {}) {
this.plugins = plugins || []
this.initLogger = initLogger
this.cloudApiFactory = cloudApiFactory
Expand Down Expand Up @@ -251,7 +251,7 @@ ${renderCommands(commands)}
gardenInitLog?.info("Initializing...")

// Init Cloud API (if applicable)
let cloudApi: CloudApi | undefined
let cloudApi: GardenCloudApi | undefined
if (!command.noProject) {
const config = await this.getProjectConfig(log, workingDir)
const cloudDomain = getGardenCloudDomain(config?.domain)
Expand Down
Loading

0 comments on commit 8813634

Please sign in to comment.