-
Notifications
You must be signed in to change notification settings - Fork 158
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor openapi notification to match postman implementation
- Loading branch information
Omar Rida
authored and
Omar Rida
committed
Mar 20, 2024
1 parent
74fd632
commit 068d708
Showing
3 changed files
with
25 additions
and
33 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { FernGeneratorExec, FernGeneratorExecClient } from "@fern-fern/generator-exec-sdk"; | ||
|
||
export class GeneratorNotificationService { | ||
// implementation defined in constructor | ||
public sendUpdate: (update: FernGeneratorExec.GeneratorUpdate) => Promise<void>; | ||
|
||
constructor(generatorConfig: FernGeneratorExec.GeneratorConfig) { | ||
// eslint-disable-next-line no-console | ||
console.log(`Generator config environment is ${generatorConfig.environment.type}`); | ||
if (generatorConfig.environment.type === "remote") { | ||
const generatorExecClient = new FernGeneratorExecClient({ | ||
environment: generatorConfig.environment.coordinatorUrlV2 | ||
}); | ||
const taskId = generatorConfig.environment.id; | ||
this.sendUpdate = async (update) => { | ||
await generatorExecClient.logging.sendUpdate(taskId, [update]); | ||
}; | ||
} else { | ||
// no-op | ||
this.sendUpdate = () => Promise.resolve(); | ||
} | ||
} | ||
} |
This file was deleted.
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