"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
function _xdl() {
const data = require("@expo/xdl");
_xdl = function () {
return data;
};
return data;
}
function _log() {
const data = _interopRequireDefault(require("../log"));
_log = function () {
return data;
};
return data;
}
function table() {
const data = _interopRequireWildcard(require("../commands/utils/cli-table"));
table = function () {
return data;
};
return data;
}
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _default = program => {
program.command('publish:set [project-dir]').alias('ps').description('Set a published release to be served from a specified channel.').option('-c, --release-channel <channel-name>', 'The channel to set the published release. (Required)').option('-p, --publish-id <publish-id>', 'The id of the published release to serve from the channel. (Required)').asyncActionProjectDir(async (projectDir, options) => {
if (!options.releaseChannel) {
throw new Error('You must specify a release channel.');
}
if (!options.publishId) {
throw new Error('You must specify a publish id. You can find ids using publish:history.');
}
const user = await _xdl().UserManager.ensureLoggedInAsync();
const api = _xdl().ApiV2.clientForUser(user);
try {
let result = await api.postAsync('publish/set', {
releaseChannel: options.releaseChannel,
publishId: options.publishId,
slug: await _xdl().Project.getSlugAsync(projectDir, options)
});
let tableString = table().printTableJson(result.queryResult, 'Channel Set Status ', 'SUCCESS');
console.log(tableString);
} catch (e) {
_log().default.error(e);
}
});
program.command('publish:rollback [project-dir]').alias('pr').description('Rollback an update to a channel.').option('--channel-id <channel-id>', 'The channel id to rollback in the channel. (Required)').asyncActionProjectDir(async (projectDir, options) => {
if (!options.channelId) {
throw new Error('You must specify a channel id. You can find ids using publish:history.');
}
const user = await _xdl().UserManager.getCurrentUserAsync();
const api = _xdl().ApiV2.clientForUser(user);
try {
let result = await api.postAsync('publish/rollback', {
channelId: options.channelId,
slug: await _xdl().Project.getSlugAsync(projectDir, options)
});
let tableString = table().printTableJson(result.queryResult, 'Channel Rollback Status ', 'SUCCESS');
console.log(tableString);
} catch (e) {
_log().default.error(e);
}
});
};
exports.default = _default;
//# sourceMappingURL=../__sourcemaps__/commands/publish-modify.js.map