UNPKG

teamcity-service-messages

Version:
121 lines (120 loc) 3.37 kB
"use strict"; const message_1 = require("./message"); const settings_1 = require("./settings"); class ServiceMessages { constructor() { this.Message = message_1.Message; } get stdout() { return settings_1.settings.stdout; } set stdout(value) { settings_1.settings.stdout = value; } get autoFlowId() { return settings_1.settings.autoFlowId; } set autoFlowId(value) { settings_1.settings.autoFlowId = value; } /** * Build a message and either print it (chainable API) or return the string, * depending on `stdout`. The chainable return type is preserved for the * common (stdout enabled) case; when stdout is disabled the generated string * is returned at runtime instead. */ emit(type, args) { const output = new message_1.Message(type, args).toString(); if (settings_1.settings.stdout) { console.log(output); return this; } return output; } blockClosed(args) { return this.emit('blockClosed', args); } blockOpened(args) { return this.emit('blockOpened', args); } buildNumber(number) { return this.emit('buildNumber', number); } buildProblem(args) { return this.emit('buildProblem', args); } buildStatisticValue(args) { return this.emit('buildStatisticValue', args); } buildStatus(args) { return this.emit('buildStatus', args); } compilationFinished(args) { return this.emit('compilationFinished', args); } compilationStarted(args) { return this.emit('compilationStarted', args); } disableServiceMessages() { return this.emit('disableServiceMessages'); } enableServiceMessages() { return this.emit('enableServiceMessages'); } importData(args) { return this.emit('importData', args); } inspectionType(args) { return this.emit('inspectionType', args); } inspection(args) { return this.emit('inspection', args); } message(args) { return this.emit('message', args); } progressFinish(message) { return this.emit('progressFinish', message); } progressMessage(message) { return this.emit('progressMessage', message); } progressStart(message) { return this.emit('progressStart', message); } publishArtifacts(path) { return this.emit('publishArtifacts', path); } setParameter(args) { return this.emit('setParameter', args); } testFailed(args) { return this.emit('testFailed', args); } testFinished(args) { return this.emit('testFinished', args); } testIgnored(args) { return this.emit('testIgnored', args); } testMetadata(args) { return this.emit('testMetadata', args); } testStarted(args) { return this.emit('testStarted', args); } testStdErr(args) { return this.emit('testStdErr', args); } testStdOut(args) { return this.emit('testStdOut', args); } testSuiteFinished(args) { return this.emit('testSuiteFinished', args); } testSuiteStarted(args) { return this.emit('testSuiteStarted', args); } } const tsm = new ServiceMessages(); module.exports = tsm;