nativescript
Version:
Command-line interface for building NativeScript projects
65 lines • 3.19 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ListiOSApps = void 0;
const helpers_1 = require("../common/helpers");
const command_params_1 = require("../common/command-params");
const yok_1 = require("../common/yok");
class ListiOSApps {
constructor($injector, $applePortalApplicationService, $applePortalSessionService, $logger, $projectData, $devicePlatformsConstants, $platformValidationService, $errors, $prompter, $options) {
this.$injector = $injector;
this.$applePortalApplicationService = $applePortalApplicationService;
this.$applePortalSessionService = $applePortalSessionService;
this.$logger = $logger;
this.$projectData = $projectData;
this.$devicePlatformsConstants = $devicePlatformsConstants;
this.$platformValidationService = $platformValidationService;
this.$errors = $errors;
this.$prompter = $prompter;
this.$options = $options;
this.allowedParameters = [
new command_params_1.StringCommandParameter(this.$injector),
new command_params_1.StringCommandParameter(this.$injector),
];
this.$projectData.initializeProjectData();
}
async execute(args) {
if (!this.$platformValidationService.isPlatformSupportedForOS(this.$devicePlatformsConstants.iOS, this.$projectData)) {
this.$errors.fail(`Applications for platform ${this.$devicePlatformsConstants.iOS} can not be built on this OS`);
}
let username = args[0];
let password = args[1];
if (!username) {
username = await this.$prompter.getString("Apple ID", {
allowEmpty: false,
});
}
if (!password) {
password = await this.$prompter.getPassword("Apple ID password");
}
const user = await this.$applePortalSessionService.createUserSession({ username, password }, {
sessionBase64: this.$options.appleSessionBase64,
});
if (!user.areCredentialsValid) {
this.$errors.fail(`Invalid username and password combination. Used '${username}' as the username.`);
}
const applications = await this.$applePortalApplicationService.getApplications(user);
if (!applications || !applications.length) {
this.$logger.info("Seems you don't have any applications yet.");
}
else {
const table = (0, helpers_1.createTable)(["Application Name", "Bundle Identifier", "In Flight Version"], applications.map((application) => {
const version = (application &&
application.versionSets &&
application.versionSets.length &&
application.versionSets[0].inFlightVersion &&
application.versionSets[0].inFlightVersion.version) ||
"";
return [application.name, application.bundleId, version];
}));
this.$logger.info(table.toString());
}
}
}
exports.ListiOSApps = ListiOSApps;
yok_1.injector.registerCommand("appstore|*list", ListiOSApps);
//# sourceMappingURL=appstore-list.js.map