-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add Additional orchestration capabilities by providing $httpyac (…
- Loading branch information
Showing
29 changed files
with
524 additions
and
439 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import * as models from '../../models'; | ||
import * as utils from '../../utils'; | ||
|
||
export class HttpyacJsApi { | ||
constructor( | ||
private readonly context: models.ProcessorContext, | ||
private readonly httpFileStore: models.HttpFileStore | ||
) {} | ||
|
||
findHttpRegionInContext(name: string) { | ||
return utils.findHttpRegionInContext(name, this.context); | ||
} | ||
|
||
async import(fileName: string) { | ||
return await utils.importHttpFileInContext(fileName, this.httpFileStore, this.context); | ||
} | ||
|
||
setVariables(vars: models.Variables) { | ||
utils.setVariableInContext(vars, this.context); | ||
} | ||
|
||
async execute(httpRegion: models.HttpRegion | string, vars?: models.Variables): Promise<boolean> { | ||
if (vars) { | ||
utils.setVariableInContext(vars, this.context); | ||
} | ||
let obj: models.HttpRegion | undefined; | ||
if (utils.isString(httpRegion)) { | ||
obj = utils.findHttpRegionInContext(httpRegion, this.context); | ||
} else { | ||
obj = httpRegion; | ||
} | ||
if (obj) { | ||
const result = await obj?.execute(this.context); | ||
if (result) { | ||
const envKey = utils.toEnvironmentKey(this.context.httpFile.activeEnvironment); | ||
utils.setVariableInContext(obj.variablesPerEnv[envKey], this.context); | ||
} | ||
return result; | ||
} | ||
return false; | ||
} | ||
} |
Oops, something went wrong.