{"size": 3506, "ext": "js", "max_stars_repo_path": "node_modules/expo-cli/build/appleApi/provisioningProfile.js", "max_stars_repo_name": "BeaSMS/NextWeek-Ecoleta", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "node_modules/expo-cli/build/appleApi/provisioningProfile.js", "max_issues_repo_name": "BeaSMS/NextWeek-Ecoleta", "max_issues_repo_issues_event_min_datetime": "2021-10-06T18:21:33.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-27T06:09:02.000Z", "max_forks_repo_path": "node_modules/expo-cli/build/appleApi/provisioningProfile.js", "max_forks_repo_name": "BeaSMS/NextWeek-Ecoleta", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 5, "max_forks_count": null, "avg_line_length": 35.4141414141, "max_line_length": 219, "alphanum_fraction": 0.7193382772}
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.ProvisioningProfileManager = void 0;

function _ora() {
  const data = _interopRequireDefault(require("ora"));

  _ora = function () {
    return data;
  };

  return data;
}

function _xdl() {
  const data = require("@expo/xdl");

  _xdl = function () {
    return data;
  };

  return data;
}

function _fastlane() {
  const data = require("./fastlane");

  _fastlane = function () {
    return data;
  };

  return data;
}

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

class ProvisioningProfileManager {
  constructor(appleCtx) {
    _defineProperty(this, "ctx", void 0);

    this.ctx = appleCtx;
  }

  async useExisting(bundleIdentifier, provisioningProfile, distCert) {
    const spinner = (0, _ora().default)(`Configuring existing Provisioning Profiles from Apple...`).start();

    if (!provisioningProfile.provisioningProfileId) {
      throw new Error('Provisioning profile: cannot use existing profile, insufficient id');
    }

    if (!distCert.distCertSerialNumber) {
      distCert.distCertSerialNumber = _xdl().IosCodeSigning.findP12CertSerialNumber(distCert.certP12, distCert.certPassword);
    }

    const args = ['use-existing', this.ctx.appleId, this.ctx.appleIdPassword, this.ctx.team.id, String(this.ctx.team.inHouse), bundleIdentifier, provisioningProfile.provisioningProfileId, distCert.distCertSerialNumber];
    const result = await (0, _fastlane().runAction)(_fastlane().travelingFastlane.manageProvisioningProfiles, args);
    spinner.succeed();
    return result;
  }

  async list(bundleIdentifier) {
    const spinner = (0, _ora().default)(`Getting Provisioning Profiles from Apple...`).start();
    const args = ['list', this.ctx.appleId, this.ctx.appleIdPassword, this.ctx.team.id, String(this.ctx.team.inHouse), bundleIdentifier];
    const {
      profiles
    } = await (0, _fastlane().runAction)(_fastlane().travelingFastlane.manageProvisioningProfiles, args);
    spinner.succeed();
    return profiles;
  }

  async create(bundleIdentifier, distCert, profileName) {
    const spinner = (0, _ora().default)(`Creating Provisioning Profile on Apple Servers...`).start();

    if (!distCert.distCertSerialNumber) {
      distCert.distCertSerialNumber = _xdl().IosCodeSigning.findP12CertSerialNumber(distCert.certP12, distCert.certPassword);
    }

    const args = ['create', this.ctx.appleId, this.ctx.appleIdPassword, this.ctx.team.id, String(this.ctx.team.inHouse), bundleIdentifier, distCert.distCertSerialNumber, profileName];
    const result = await (0, _fastlane().runAction)(_fastlane().travelingFastlane.manageProvisioningProfiles, args);
    spinner.succeed();
    return result;
  }

  async revoke(bundleIdentifier) {
    const spinner = (0, _ora().default)(`Revoking Provisioning Profile on Apple Servers...`).start();
    const args = ['revoke', this.ctx.appleId, this.ctx.appleIdPassword, this.ctx.team.id, String(this.ctx.team.inHouse), bundleIdentifier];
    await (0, _fastlane().runAction)(_fastlane().travelingFastlane.manageProvisioningProfiles, args);
    spinner.succeed();
  }

}

exports.ProvisioningProfileManager = ProvisioningProfileManager;
//# sourceMappingURL=provisioningProfile.js.map