Skip to content
Merged
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
2 changes: 2 additions & 0 deletions src/api/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export interface VersionRequest {
}

export interface VersionResponse {
doc_name: string
doc_public_url?: string
id: string
}
Expand Down Expand Up @@ -92,4 +93,5 @@ export interface WorkflowVersionRequest {
export interface WorkflowVersionResponse {
id: string
mcp_server_id: string
mcp_server_name: string
}
8 changes: 5 additions & 3 deletions src/commands/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
token: flagsBuilder.token(),
}

protected async deployDirectory(

Check warning on line 79 in src/commands/deploy.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on ubuntu-latest

Async method 'deployDirectory' has too many parameters (10). Maximum allowed is 4

Check warning on line 79 in src/commands/deploy.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on ubuntu-latest

Async method 'deployDirectory' has too many parameters (10). Maximum allowed is 4

Check warning on line 79 in src/commands/deploy.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on ubuntu-latest

Async method 'deployDirectory' has too many parameters (10). Maximum allowed is 4

Check warning on line 79 in src/commands/deploy.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on macos-latest

Async method 'deployDirectory' has too many parameters (10). Maximum allowed is 4

Check warning on line 79 in src/commands/deploy.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on windows-latest

Async method 'deployDirectory' has too many parameters (10). Maximum allowed is 4

Check warning on line 79 in src/commands/deploy.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on macos-latest

Async method 'deployDirectory' has too many parameters (10). Maximum allowed is 4

Check warning on line 79 in src/commands/deploy.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on windows-latest

Async method 'deployDirectory' has too many parameters (10). Maximum allowed is 4

Check warning on line 79 in src/commands/deploy.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on windows-latest

Async method 'deployDirectory' has too many parameters (10). Maximum allowed is 4

Check warning on line 79 in src/commands/deploy.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on macos-latest

Async method 'deployDirectory' has too many parameters (10). Maximum allowed is 4

Check warning on line 79 in src/commands/deploy.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on ubuntu-latest

Async method 'deployDirectory' has too many parameters (10). Maximum allowed is 4

Check warning on line 79 in src/commands/deploy.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on ubuntu-latest

Async method 'deployDirectory' has too many parameters (10). Maximum allowed is 4

Check warning on line 79 in src/commands/deploy.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on ubuntu-latest

Async method 'deployDirectory' has too many parameters (10). Maximum allowed is 4

Check warning on line 79 in src/commands/deploy.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on macos-latest

Async method 'deployDirectory' has too many parameters (10). Maximum allowed is 4

Check warning on line 79 in src/commands/deploy.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on windows-latest

Async method 'deployDirectory' has too many parameters (10). Maximum allowed is 4

Check warning on line 79 in src/commands/deploy.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on macos-latest

Async method 'deployDirectory' has too many parameters (10). Maximum allowed is 4

Check warning on line 79 in src/commands/deploy.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on macos-latest

Async method 'deployDirectory' has too many parameters (10). Maximum allowed is 4

Check warning on line 79 in src/commands/deploy.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on windows-latest

Async method 'deployDirectory' has too many parameters (10). Maximum allowed is 4

Check warning on line 79 in src/commands/deploy.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on windows-latest

Async method 'deployDirectory' has too many parameters (10). Maximum allowed is 4
dir: string,
dryRun: boolean,
token: string,
Expand Down Expand Up @@ -148,7 +148,7 @@
}
}

protected async deploySingleFile(

Check warning on line 151 in src/commands/deploy.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on ubuntu-latest

Async method 'deploySingleFile' has too many parameters (10). Maximum allowed is 4

Check warning on line 151 in src/commands/deploy.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on ubuntu-latest

Async method 'deploySingleFile' has too many parameters (10). Maximum allowed is 4

Check warning on line 151 in src/commands/deploy.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on ubuntu-latest

Async method 'deploySingleFile' has too many parameters (10). Maximum allowed is 4

Check warning on line 151 in src/commands/deploy.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on macos-latest

Async method 'deploySingleFile' has too many parameters (10). Maximum allowed is 4

Check warning on line 151 in src/commands/deploy.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on windows-latest

Async method 'deploySingleFile' has too many parameters (10). Maximum allowed is 4

Check warning on line 151 in src/commands/deploy.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on macos-latest

Async method 'deploySingleFile' has too many parameters (10). Maximum allowed is 4

Check warning on line 151 in src/commands/deploy.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on windows-latest

Async method 'deploySingleFile' has too many parameters (10). Maximum allowed is 4

Check warning on line 151 in src/commands/deploy.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on windows-latest

Async method 'deploySingleFile' has too many parameters (10). Maximum allowed is 4

Check warning on line 151 in src/commands/deploy.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on macos-latest

Async method 'deploySingleFile' has too many parameters (10). Maximum allowed is 4

Check warning on line 151 in src/commands/deploy.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on ubuntu-latest

Async method 'deploySingleFile' has too many parameters (10). Maximum allowed is 4

Check warning on line 151 in src/commands/deploy.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on ubuntu-latest

Async method 'deploySingleFile' has too many parameters (10). Maximum allowed is 4

Check warning on line 151 in src/commands/deploy.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on ubuntu-latest

Async method 'deploySingleFile' has too many parameters (10). Maximum allowed is 4

Check warning on line 151 in src/commands/deploy.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on macos-latest

Async method 'deploySingleFile' has too many parameters (10). Maximum allowed is 4

Check warning on line 151 in src/commands/deploy.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on windows-latest

Async method 'deploySingleFile' has too many parameters (10). Maximum allowed is 4

Check warning on line 151 in src/commands/deploy.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on macos-latest

Async method 'deploySingleFile' has too many parameters (10). Maximum allowed is 4

Check warning on line 151 in src/commands/deploy.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on macos-latest

Async method 'deploySingleFile' has too many parameters (10). Maximum allowed is 4

Check warning on line 151 in src/commands/deploy.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on windows-latest

Async method 'deploySingleFile' has too many parameters (10). Maximum allowed is 4

Check warning on line 151 in src/commands/deploy.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on windows-latest

Async method 'deploySingleFile' has too many parameters (10). Maximum allowed is 4
api: API,
dryRun: boolean,
documentation: string,
Expand All @@ -174,17 +174,18 @@
overlay,
temporary,
)
const docName = response?.doc_name || documentation

if (dryRun) {
ux.stdout(ux.colorize('green', 'Definition is valid'))
} else if (response) {
process.stdout.write(ux.colorize('green', `Your ${documentation} documentation...`))
process.stdout.write(ux.colorize('green', `Your ${docName} documentation...`))
ux.stdout(
ux.colorize('green', `has received a new ${temporary ? 'preview' : 'deployment'} which will soon be ready at:`),
)
ux.stdout(ux.colorize('underline', response.doc_public_url!))
} else {
ux.warn(`Your ${documentation} documentation has not changed`)
ux.warn(`Your ${docName} documentation has not changed`)
}
}

Expand All @@ -196,9 +197,10 @@
mcpServer,
token,
)
const mcpServerName = response?.mcp_server_name || mcpServer

if (response) {
process.stdout.write(ux.colorize('green', `Your ${mcpServer} MCP server...`))
process.stdout.write(ux.colorize('green', `Your ${mcpServerName} MCP server...`))
ux.stdout(ux.colorize('green', `has received a new workflow definition which will soon be ready.`))
} else {
ux.warn(`Your ${mcpServer} MCP server has not changed.`)
Expand Down
34 changes: 19 additions & 15 deletions src/core/diff.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
import {DiffRequest, DiffResponse, VersionRequest, VersionResponse, WithDiff} from '../api/models.js'
import {API} from '../definition.js'

export interface DiffResult extends DiffResponse {
doc_name?: string
}

export class Diff {
// 120 seconds = 2 minutes
static readonly TIMEOUT = 120
Expand All @@ -29,7 +33,7 @@
return process.env.BUMP_POLLING_PERIOD ? Number(process.env.BUMP_POLLING_PERIOD) : 1000
}

async createDiff(

Check warning on line 36 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on ubuntu-latest

Async method 'createDiff' has too many parameters (5). Maximum allowed is 4

Check warning on line 36 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on ubuntu-latest

Async method 'createDiff' has too many parameters (5). Maximum allowed is 4

Check warning on line 36 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on ubuntu-latest

Async method 'createDiff' has too many parameters (5). Maximum allowed is 4

Check warning on line 36 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on macos-latest

Async method 'createDiff' has too many parameters (5). Maximum allowed is 4

Check warning on line 36 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on windows-latest

Async method 'createDiff' has too many parameters (5). Maximum allowed is 4

Check warning on line 36 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on macos-latest

Async method 'createDiff' has too many parameters (5). Maximum allowed is 4

Check warning on line 36 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on windows-latest

Async method 'createDiff' has too many parameters (5). Maximum allowed is 4

Check warning on line 36 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on windows-latest

Async method 'createDiff' has too many parameters (5). Maximum allowed is 4

Check warning on line 36 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on macos-latest

Async method 'createDiff' has too many parameters (5). Maximum allowed is 4

Check warning on line 36 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on ubuntu-latest

Async method 'createDiff' has too many parameters (5). Maximum allowed is 4

Check warning on line 36 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on ubuntu-latest

Async method 'createDiff' has too many parameters (5). Maximum allowed is 4

Check warning on line 36 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on ubuntu-latest

Async method 'createDiff' has too many parameters (5). Maximum allowed is 4

Check warning on line 36 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on macos-latest

Async method 'createDiff' has too many parameters (5). Maximum allowed is 4

Check warning on line 36 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on windows-latest

Async method 'createDiff' has too many parameters (5). Maximum allowed is 4

Check warning on line 36 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on macos-latest

Async method 'createDiff' has too many parameters (5). Maximum allowed is 4

Check warning on line 36 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on macos-latest

Async method 'createDiff' has too many parameters (5). Maximum allowed is 4

Check warning on line 36 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on windows-latest

Async method 'createDiff' has too many parameters (5). Maximum allowed is 4

Check warning on line 36 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on windows-latest

Async method 'createDiff' has too many parameters (5). Maximum allowed is 4
file1: string,
file2: string,
expires: string | undefined,
Expand Down Expand Up @@ -64,7 +68,7 @@
}
}

async createVersion(

Check warning on line 71 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on ubuntu-latest

Async method 'createVersion' has too many parameters (7). Maximum allowed is 4

Check warning on line 71 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on ubuntu-latest

Async method 'createVersion' has too many parameters (7). Maximum allowed is 4

Check warning on line 71 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on ubuntu-latest

Async method 'createVersion' has too many parameters (7). Maximum allowed is 4

Check warning on line 71 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on macos-latest

Async method 'createVersion' has too many parameters (7). Maximum allowed is 4

Check warning on line 71 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on windows-latest

Async method 'createVersion' has too many parameters (7). Maximum allowed is 4

Check warning on line 71 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on macos-latest

Async method 'createVersion' has too many parameters (7). Maximum allowed is 4

Check warning on line 71 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on windows-latest

Async method 'createVersion' has too many parameters (7). Maximum allowed is 4

Check warning on line 71 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on windows-latest

Async method 'createVersion' has too many parameters (7). Maximum allowed is 4

Check warning on line 71 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on macos-latest

Async method 'createVersion' has too many parameters (7). Maximum allowed is 4

Check warning on line 71 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on ubuntu-latest

Async method 'createVersion' has too many parameters (7). Maximum allowed is 4

Check warning on line 71 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on ubuntu-latest

Async method 'createVersion' has too many parameters (7). Maximum allowed is 4

Check warning on line 71 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on ubuntu-latest

Async method 'createVersion' has too many parameters (7). Maximum allowed is 4

Check warning on line 71 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on macos-latest

Async method 'createVersion' has too many parameters (7). Maximum allowed is 4

Check warning on line 71 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on windows-latest

Async method 'createVersion' has too many parameters (7). Maximum allowed is 4

Check warning on line 71 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on macos-latest

Async method 'createVersion' has too many parameters (7). Maximum allowed is 4

Check warning on line 71 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on macos-latest

Async method 'createVersion' has too many parameters (7). Maximum allowed is 4

Check warning on line 71 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on windows-latest

Async method 'createVersion' has too many parameters (7). Maximum allowed is 4

Check warning on line 71 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on windows-latest

Async method 'createVersion' has too many parameters (7). Maximum allowed is 4
file: string,
documentation: string,
token: string,
Expand Down Expand Up @@ -108,11 +112,12 @@
return debug(`bump-cli:core:diff`)(formatter, ...args)
}

extractDiff(versionWithDiff: VersionResponse & WithDiff): DiffResponse {
extractDiff(versionWithDiff: VersionResponse & WithDiff): DiffResult {
// TODO: return a real diff_id in the GET /version API

Check warning on line 116 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on ubuntu-latest

Unexpected 'todo' comment: 'TODO: return a real diff_id in the GET...'

Check warning on line 116 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on ubuntu-latest

Unexpected 'todo' comment: 'TODO: return a real diff_id in the GET...'

Check warning on line 116 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on ubuntu-latest

Unexpected 'todo' comment: 'TODO: return a real diff_id in the GET...'

Check warning on line 116 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on macos-latest

Unexpected 'todo' comment: 'TODO: return a real diff_id in the GET...'

Check warning on line 116 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on windows-latest

Unexpected 'todo' comment: 'TODO: return a real diff_id in the GET...'

Check warning on line 116 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on macos-latest

Unexpected 'todo' comment: 'TODO: return a real diff_id in the GET...'

Check warning on line 116 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on windows-latest

Unexpected 'todo' comment: 'TODO: return a real diff_id in the GET...'

Check warning on line 116 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on windows-latest

Unexpected 'todo' comment: 'TODO: return a real diff_id in the GET...'

Check warning on line 116 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on macos-latest

Unexpected 'todo' comment: 'TODO: return a real diff_id in the GET...'

Check warning on line 116 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on ubuntu-latest

Unexpected 'todo' comment: 'TODO: return a real diff_id in the GET...'

Check warning on line 116 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on ubuntu-latest

Unexpected 'todo' comment: 'TODO: return a real diff_id in the GET...'

Check warning on line 116 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on ubuntu-latest

Unexpected 'todo' comment: 'TODO: return a real diff_id in the GET...'

Check warning on line 116 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on macos-latest

Unexpected 'todo' comment: 'TODO: return a real diff_id in the GET...'

Check warning on line 116 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on windows-latest

Unexpected 'todo' comment: 'TODO: return a real diff_id in the GET...'

Check warning on line 116 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on macos-latest

Unexpected 'todo' comment: 'TODO: return a real diff_id in the GET...'

Check warning on line 116 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on macos-latest

Unexpected 'todo' comment: 'TODO: return a real diff_id in the GET...'

Check warning on line 116 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on windows-latest

Unexpected 'todo' comment: 'TODO: return a real diff_id in the GET...'

Check warning on line 116 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on windows-latest

Unexpected 'todo' comment: 'TODO: return a real diff_id in the GET...'
return {
breaking: versionWithDiff.diff_breaking,
details: versionWithDiff.diff_details,
doc_name: versionWithDiff.doc_name,
id: versionWithDiff.id,
markdown: versionWithDiff.diff_markdown,
public_url: versionWithDiff.diff_public_url,
Expand All @@ -133,7 +138,7 @@
await this.delay(this.pollingPeriod)
}

public async run(

Check warning on line 141 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on ubuntu-latest

Async method 'run' has too many parameters (10). Maximum allowed is 4

Check warning on line 141 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on ubuntu-latest

Async method 'run' has too many parameters (10). Maximum allowed is 4

Check warning on line 141 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on ubuntu-latest

Async method 'run' has too many parameters (10). Maximum allowed is 4

Check warning on line 141 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on macos-latest

Async method 'run' has too many parameters (10). Maximum allowed is 4

Check warning on line 141 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on windows-latest

Async method 'run' has too many parameters (10). Maximum allowed is 4

Check warning on line 141 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on macos-latest

Async method 'run' has too many parameters (10). Maximum allowed is 4

Check warning on line 141 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on windows-latest

Async method 'run' has too many parameters (10). Maximum allowed is 4

Check warning on line 141 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on windows-latest

Async method 'run' has too many parameters (10). Maximum allowed is 4

Check warning on line 141 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on macos-latest

Async method 'run' has too many parameters (10). Maximum allowed is 4

Check warning on line 141 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on ubuntu-latest

Async method 'run' has too many parameters (10). Maximum allowed is 4

Check warning on line 141 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on ubuntu-latest

Async method 'run' has too many parameters (10). Maximum allowed is 4

Check warning on line 141 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on ubuntu-latest

Async method 'run' has too many parameters (10). Maximum allowed is 4

Check warning on line 141 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on macos-latest

Async method 'run' has too many parameters (10). Maximum allowed is 4

Check warning on line 141 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on windows-latest

Async method 'run' has too many parameters (10). Maximum allowed is 4

Check warning on line 141 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on macos-latest

Async method 'run' has too many parameters (10). Maximum allowed is 4

Check warning on line 141 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on macos-latest

Async method 'run' has too many parameters (10). Maximum allowed is 4

Check warning on line 141 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on windows-latest

Async method 'run' has too many parameters (10). Maximum allowed is 4

Check warning on line 141 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on windows-latest

Async method 'run' has too many parameters (10). Maximum allowed is 4
file1: string,
file2: string | undefined,
documentation: string | undefined,
Expand All @@ -144,7 +149,7 @@
expires?: string | undefined,
overlays1?: string[] | undefined,
overlays2?: string[] | undefined,
): Promise<DiffResponse | undefined> {
): Promise<DiffResult | undefined> {
if (!this._config) this._config = await Config.load(resolve(import.meta.dirname, './../../'))

let diffVersion: DiffResponse | VersionResponse | undefined
Expand Down Expand Up @@ -182,13 +187,14 @@
}

async waitResult(
result: DiffResponse | VersionResponse,
apiResponse: DiffResponse | VersionResponse,
token: string | undefined,
opts: {format: string; timeout: number},
): Promise<DiffResponse> {
const pollingResponse = await (this.isVersion(result) && token
? this.bumpClient.getVersion(result.id, token)
: this.bumpClient.getDiff(result.id, opts.format))
): Promise<DiffResult> {
let diffResult: DiffResult = {id: apiResponse.id}
const pollingResponse = await (this.isVersion(apiResponse) && token
? this.bumpClient.getVersion(apiResponse.id, token)
: this.bumpClient.getDiff(apiResponse.id, opts.format))

if (opts.timeout <= 0) {
throw new CLIError(
Expand All @@ -198,30 +204,28 @@

switch (pollingResponse.status) {
case 200: {
let diff: DiffResponse | (VersionResponse & WithDiff) = pollingResponse.data
const diff: DiffResponse | (VersionResponse & WithDiff) = pollingResponse.data

if (this.isVersionWithDiff(diff)) {
diff = this.extractDiff(diff)
}
diffResult = this.isVersionWithDiff(diff) ? this.extractDiff(diff) : diff

this.d('Received diff:')
this.d(diff)
return diff
this.d(diffResult)
return diffResult
break
}

case 202: {
this.d('Waiting 1 sec before next poll')
await this.pollingDelay()
return this.waitResult(result, token, {
return this.waitResult(apiResponse, token, {
format: opts.format,
timeout: opts.timeout - 1,
})
break
}
}

return {} as DiffResponse
return diffResult
}

private async delay(ms: number): Promise<void> {
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const COMMANDS = {
preview: Preview,
}

export {DiffResponse, PreviewResponse, VersionResponse, WithDiff} from './api/models.js'
export {PreviewResponse, VersionResponse, WithDiff} from './api/models.js'

export {default as Deploy} from './commands/deploy.js'
export {default as Preview} from './commands/preview.js'
Expand Down
27 changes: 27 additions & 0 deletions test/commands/deploy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import {API} from '../../src/definition'

nock.disableNetConnect()

Check warning on line 8 in test/commands/deploy.test.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on ubuntu-latest

Caution: `nock` also has a named export `disableNetConnect`. Check if you meant to write `import {disableNetConnect} from 'nock'` instead

Check warning on line 8 in test/commands/deploy.test.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on ubuntu-latest

Caution: `nock` also has a named export `disableNetConnect`. Check if you meant to write `import {disableNetConnect} from 'nock'` instead

Check warning on line 8 in test/commands/deploy.test.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on ubuntu-latest

Caution: `nock` also has a named export `disableNetConnect`. Check if you meant to write `import {disableNetConnect} from 'nock'` instead

Check warning on line 8 in test/commands/deploy.test.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on macos-latest

Caution: `nock` also has a named export `disableNetConnect`. Check if you meant to write `import {disableNetConnect} from 'nock'` instead

Check warning on line 8 in test/commands/deploy.test.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on windows-latest

Caution: `nock` also has a named export `disableNetConnect`. Check if you meant to write `import {disableNetConnect} from 'nock'` instead

Check warning on line 8 in test/commands/deploy.test.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on macos-latest

Caution: `nock` also has a named export `disableNetConnect`. Check if you meant to write `import {disableNetConnect} from 'nock'` instead

Check warning on line 8 in test/commands/deploy.test.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on windows-latest

Caution: `nock` also has a named export `disableNetConnect`. Check if you meant to write `import {disableNetConnect} from 'nock'` instead

Check warning on line 8 in test/commands/deploy.test.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on windows-latest

Caution: `nock` also has a named export `disableNetConnect`. Check if you meant to write `import {disableNetConnect} from 'nock'` instead

Check warning on line 8 in test/commands/deploy.test.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on macos-latest

Caution: `nock` also has a named export `disableNetConnect`. Check if you meant to write `import {disableNetConnect} from 'nock'` instead

Check warning on line 8 in test/commands/deploy.test.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on ubuntu-latest

Caution: `nock` also has a named export `disableNetConnect`. Check if you meant to write `import {disableNetConnect} from 'nock'` instead

Check warning on line 8 in test/commands/deploy.test.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on ubuntu-latest

Caution: `nock` also has a named export `disableNetConnect`. Check if you meant to write `import {disableNetConnect} from 'nock'` instead

Check warning on line 8 in test/commands/deploy.test.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on ubuntu-latest

Caution: `nock` also has a named export `disableNetConnect`. Check if you meant to write `import {disableNetConnect} from 'nock'` instead

Check warning on line 8 in test/commands/deploy.test.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on macos-latest

Caution: `nock` also has a named export `disableNetConnect`. Check if you meant to write `import {disableNetConnect} from 'nock'` instead

Check warning on line 8 in test/commands/deploy.test.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on windows-latest

Caution: `nock` also has a named export `disableNetConnect`. Check if you meant to write `import {disableNetConnect} from 'nock'` instead

Check warning on line 8 in test/commands/deploy.test.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on macos-latest

Caution: `nock` also has a named export `disableNetConnect`. Check if you meant to write `import {disableNetConnect} from 'nock'` instead

Check warning on line 8 in test/commands/deploy.test.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on macos-latest

Caution: `nock` also has a named export `disableNetConnect`. Check if you meant to write `import {disableNetConnect} from 'nock'` instead

Check warning on line 8 in test/commands/deploy.test.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on windows-latest

Caution: `nock` also has a named export `disableNetConnect`. Check if you meant to write `import {disableNetConnect} from 'nock'` instead

Check warning on line 8 in test/commands/deploy.test.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on windows-latest

Caution: `nock` also has a named export `disableNetConnect`. Check if you meant to write `import {disableNetConnect} from 'nock'` instead

process.env.BUMP_TOKEN = process.env.BUMP_TOKEN || 'BAR'

Expand Down Expand Up @@ -41,6 +41,20 @@
expect(stdout).to.contain('http://localhost/doc/1')
})

it('sends new version to Bump, and use docName from response', async () => {
nock('https://bump.sh')
.post('/api/v1/versions', (body) => body.documentation === '42' && !body.branch_name)
.reply(201, {doc_name: 'Cou Cou', doc_public_url: 'http://localhost/doc/1'})

const {stderr, stdout} = await runCommand(['deploy', 'examples/valid/openapi.v3.json', '--doc', '42'].join(' '))

expect(stderr).to.contain("Let's deploy on Bump.sh... done\n")
expect(stdout).to.contain(
'Your Cou Cou documentation...has received a new deployment which will soon be ready at:',
)
expect(stdout).to.contain('http://localhost/doc/1')
})

it('sends new version to Bump on given branch', async () => {
nock('https://bump.sh')
.post('/api/v1/versions', (body) => body.documentation === 'coucou' && body.branch_name === 'next')
Expand Down Expand Up @@ -92,7 +106,7 @@

it("doesn't try to auto create a documentation", async () => {
nock('https://bump.sh')
.post('/api/v1/validations', (body) => !body.auto_create_documentation)

Check warning on line 109 in test/commands/deploy.test.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on ubuntu-latest

Too many nested callbacks (5). Maximum allowed is 4

Check warning on line 109 in test/commands/deploy.test.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on ubuntu-latest

Too many nested callbacks (5). Maximum allowed is 4

Check warning on line 109 in test/commands/deploy.test.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on ubuntu-latest

Too many nested callbacks (5). Maximum allowed is 4

Check warning on line 109 in test/commands/deploy.test.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on macos-latest

Too many nested callbacks (5). Maximum allowed is 4

Check warning on line 109 in test/commands/deploy.test.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on windows-latest

Too many nested callbacks (5). Maximum allowed is 4

Check warning on line 109 in test/commands/deploy.test.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on macos-latest

Too many nested callbacks (5). Maximum allowed is 4

Check warning on line 109 in test/commands/deploy.test.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on windows-latest

Too many nested callbacks (5). Maximum allowed is 4

Check warning on line 109 in test/commands/deploy.test.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on windows-latest

Too many nested callbacks (5). Maximum allowed is 4

Check warning on line 109 in test/commands/deploy.test.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on macos-latest

Too many nested callbacks (5). Maximum allowed is 4

Check warning on line 109 in test/commands/deploy.test.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on ubuntu-latest

Too many nested callbacks (5). Maximum allowed is 4

Check warning on line 109 in test/commands/deploy.test.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on ubuntu-latest

Too many nested callbacks (5). Maximum allowed is 4

Check warning on line 109 in test/commands/deploy.test.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on ubuntu-latest

Too many nested callbacks (5). Maximum allowed is 4

Check warning on line 109 in test/commands/deploy.test.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on macos-latest

Too many nested callbacks (5). Maximum allowed is 4

Check warning on line 109 in test/commands/deploy.test.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on windows-latest

Too many nested callbacks (5). Maximum allowed is 4

Check warning on line 109 in test/commands/deploy.test.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on macos-latest

Too many nested callbacks (5). Maximum allowed is 4

Check warning on line 109 in test/commands/deploy.test.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on macos-latest

Too many nested callbacks (5). Maximum allowed is 4

Check warning on line 109 in test/commands/deploy.test.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on windows-latest

Too many nested callbacks (5). Maximum allowed is 4

Check warning on line 109 in test/commands/deploy.test.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on windows-latest

Too many nested callbacks (5). Maximum allowed is 4
.reply(200)

await runCommand(
Expand Down Expand Up @@ -125,6 +139,19 @@
)
})

it('sends new workflow definition (flower) to Bump, and display doc name', async () => {
nock('https://bump.sh').post('/api/v1/mcp-servers/crab/deploy').reply(201, {mcp_server_name: 'Flower Power'})

const {stderr, stdout} = await runCommand(
['deploy', 'examples/valid/flower/parking.yml', '--mcp-server', 'crab'].join(' '),
)

expect(stderr).to.contain("Let's deploy on Bump.sh... done\n")
expect(stdout).to.contain(
'Your Flower Power MCP server...has received a new workflow definition which will soon be ready.',
)
})

it('sends new workflow definition with openapi sources (arazzo) to Bump', async () => {
const [definition, references] = await (
await API.load('examples/valid/arazzo/wikimedia.json')
Expand Down
Loading