@mcesystems/apple-kit 1.0.52 → 1.0.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +36 -4
- package/dist/index.js.map +2 -2
- package/dist/index.mjs +36 -4
- package/dist/index.mjs.map +2 -2
- package/dist/types/logic/activationFlow.d.ts +1 -0
- package/dist/types/logic/activationFlow.d.ts.map +1 -1
- package/dist/types/logic/iosCli.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -33938,6 +33938,9 @@ function createIosCli(iosBinaryPath) {
|
|
|
33938
33938
|
async installProfile(deviceId, profilePath) {
|
|
33939
33939
|
return runIosCommand(iosBinaryPath, ["profile", "add", profilePath, "--udid", deviceId]);
|
|
33940
33940
|
},
|
|
33941
|
+
async removeProfile(deviceId, profileName) {
|
|
33942
|
+
return runIosCommand(iosBinaryPath, ["profile", "remove", profileName, "--udid", deviceId]);
|
|
33943
|
+
},
|
|
33941
33944
|
async skipSteps(deviceId) {
|
|
33942
33945
|
return runIosCommand(iosBinaryPath, ["prepare", "--skip-all", "--udid", deviceId]);
|
|
33943
33946
|
},
|
|
@@ -33963,7 +33966,9 @@ function createIosCli(iosBinaryPath) {
|
|
|
33963
33966
|
|
|
33964
33967
|
// src/logic/activationFlow.ts
|
|
33965
33968
|
var DEFAULT_RETRIES = 150;
|
|
33966
|
-
var DEFAULT_RETRY_DELAY_MS =
|
|
33969
|
+
var DEFAULT_RETRY_DELAY_MS = 1e3;
|
|
33970
|
+
var TIME_BETWEEN_INSTALLS = 5e3;
|
|
33971
|
+
var TIME_TO_WAIT_FOR_MANAGED_APP_INSTALL = 1e4;
|
|
33967
33972
|
function sleep(ms) {
|
|
33968
33973
|
return new Promise((resolve5) => setTimeout(resolve5, ms));
|
|
33969
33974
|
}
|
|
@@ -33991,23 +33996,27 @@ var ActivationFlow = class {
|
|
|
33991
33996
|
await this.retryIosCommand("wipe", () => this.iosCli.wipe(udid));
|
|
33992
33997
|
return "wiped";
|
|
33993
33998
|
}
|
|
33994
|
-
await this.installWifiProfile(udid);
|
|
33999
|
+
const wifiProfileIdentifier = await this.installWifiProfile(udid);
|
|
33995
34000
|
await this.installMdmProfile(udid);
|
|
33996
34001
|
await this.retryIosCommand("skip steps", () => this.iosCli.skipSteps(udid));
|
|
33997
34002
|
await this.installManagedApp(udid);
|
|
34003
|
+
await sleep(TIME_TO_WAIT_FOR_MANAGED_APP_INSTALL);
|
|
34004
|
+
await this.removeWifiProfile(udid, wifiProfileIdentifier);
|
|
33998
34005
|
return "activated";
|
|
33999
34006
|
}
|
|
34000
34007
|
async installWifiProfile(udid) {
|
|
34001
34008
|
const wifiProfile = await generateWifiProfileFromEnv();
|
|
34002
34009
|
if (!wifiProfile) {
|
|
34003
|
-
return;
|
|
34010
|
+
return void 0;
|
|
34004
34011
|
}
|
|
34005
34012
|
const wifiProfilePath = await saveWifiProfileToTemp(wifiProfile);
|
|
34013
|
+
const wifiProfileIdentifier = getProfileIdentifierFromProfile(wifiProfile);
|
|
34006
34014
|
await this.retryIosCommand(
|
|
34007
34015
|
"install wifi profile",
|
|
34008
34016
|
() => this.iosCli.installProfile(udid, wifiProfilePath)
|
|
34009
34017
|
);
|
|
34010
34018
|
await removeTempFile(wifiProfilePath, "wifi profile");
|
|
34019
|
+
return wifiProfileIdentifier;
|
|
34011
34020
|
}
|
|
34012
34021
|
async getActivationState(udid) {
|
|
34013
34022
|
const infoResult = await this.retryIosCommand("device info", () => this.iosCli.info(udid));
|
|
@@ -34065,9 +34074,19 @@ var ActivationFlow = class {
|
|
|
34065
34074
|
const mdmInstallOptions = getMdmInstallOptionsFromEnv();
|
|
34066
34075
|
const client = await this.requireMdmClient();
|
|
34067
34076
|
logTask("Installing app via MDM for management takeover");
|
|
34068
|
-
await sleep(
|
|
34077
|
+
await sleep(TIME_BETWEEN_INSTALLS);
|
|
34069
34078
|
client.installApp(udid, mdmInstallOptions);
|
|
34070
34079
|
}
|
|
34080
|
+
async removeWifiProfile(udid, profileIdentifier) {
|
|
34081
|
+
if (!profileIdentifier) {
|
|
34082
|
+
return;
|
|
34083
|
+
}
|
|
34084
|
+
logTask("Removing WiFi profile");
|
|
34085
|
+
await this.retryIosCommand(
|
|
34086
|
+
"remove wifi profile",
|
|
34087
|
+
() => this.iosCli.removeProfile(udid, profileIdentifier)
|
|
34088
|
+
);
|
|
34089
|
+
}
|
|
34071
34090
|
async requireMdmClient() {
|
|
34072
34091
|
const client = await this.mdmClientPromise;
|
|
34073
34092
|
if (!client) {
|
|
@@ -34147,6 +34166,19 @@ function parseBooleanEnv(value) {
|
|
|
34147
34166
|
}
|
|
34148
34167
|
return void 0;
|
|
34149
34168
|
}
|
|
34169
|
+
function getProfileIdentifierFromProfile(profile) {
|
|
34170
|
+
const pattern = /<key>PayloadIdentifier<\/key>\s*<string>([^<]+)<\/string>/g;
|
|
34171
|
+
const matches = [];
|
|
34172
|
+
let match = pattern.exec(profile);
|
|
34173
|
+
while (match) {
|
|
34174
|
+
matches.push(match[1].trim());
|
|
34175
|
+
match = pattern.exec(profile);
|
|
34176
|
+
}
|
|
34177
|
+
if (matches.length === 0) {
|
|
34178
|
+
return void 0;
|
|
34179
|
+
}
|
|
34180
|
+
return matches[matches.length - 1];
|
|
34181
|
+
}
|
|
34150
34182
|
function resolveResourcesDir(resourcesDir) {
|
|
34151
34183
|
if (resourcesDir) {
|
|
34152
34184
|
return resolve4(resourcesDir);
|