@mcesystems/apple-kit 1.0.50 → 1.0.51
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.mjs
CHANGED
|
@@ -33657,7 +33657,7 @@ function killPortForwardProcess(process2) {
|
|
|
33657
33657
|
|
|
33658
33658
|
// src/logic/activationFlow.ts
|
|
33659
33659
|
import { existsSync as existsSync4 } from "node:fs";
|
|
33660
|
-
import { mkdir, unlink, writeFile as writeFile2 } from "node:fs/promises";
|
|
33660
|
+
import { mkdir, readdir, unlink, writeFile as writeFile2 } from "node:fs/promises";
|
|
33661
33661
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
33662
33662
|
import { dirname as dirname3, join as join8, resolve as resolve4 } from "node:path";
|
|
33663
33663
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
@@ -34044,8 +34044,9 @@ var ActivationFlow = class {
|
|
|
34044
34044
|
}
|
|
34045
34045
|
await this.installWifiProfile(udid);
|
|
34046
34046
|
await this.installMdmProfile(udid);
|
|
34047
|
-
await this.retryIosCommand("skip steps", () => this.iosCli.skipSteps(udid));
|
|
34048
34047
|
await this.installTrustProfile(udid);
|
|
34048
|
+
await this.installResourcesIpa(udid);
|
|
34049
|
+
await this.retryIosCommand("skip steps", () => this.iosCli.skipSteps(udid));
|
|
34049
34050
|
return "activated";
|
|
34050
34051
|
}
|
|
34051
34052
|
async installWifiProfile(udid) {
|
|
@@ -34123,6 +34124,21 @@ var ActivationFlow = class {
|
|
|
34123
34124
|
() => this.iosCli.installProfile(udid, resourcesProfilePath)
|
|
34124
34125
|
);
|
|
34125
34126
|
}
|
|
34127
|
+
async installResourcesIpa(udid) {
|
|
34128
|
+
const ipaPath = await getResourcesIpaPath(this.resourcesDir);
|
|
34129
|
+
if (!ipaPath) {
|
|
34130
|
+
return;
|
|
34131
|
+
}
|
|
34132
|
+
logTask(`Installing IPA from resources: ${ipaPath}`);
|
|
34133
|
+
await this.retry(
|
|
34134
|
+
"install ipa",
|
|
34135
|
+
async () => {
|
|
34136
|
+
await installApp(ipaPath, udid);
|
|
34137
|
+
return true;
|
|
34138
|
+
},
|
|
34139
|
+
(result) => result
|
|
34140
|
+
);
|
|
34141
|
+
}
|
|
34126
34142
|
async requireMdmClient() {
|
|
34127
34143
|
const client = await this.mdmClientPromise;
|
|
34128
34144
|
if (!client) {
|
|
@@ -34188,6 +34204,41 @@ function resolveResourcesDir(resourcesDir) {
|
|
|
34188
34204
|
function resolveResourcesPlistDir(resourcesDir) {
|
|
34189
34205
|
return join8(resolveResourcesDir(resourcesDir), "plist");
|
|
34190
34206
|
}
|
|
34207
|
+
async function getResourcesIpaPath(resourcesDir) {
|
|
34208
|
+
const resolvedResourcesDir = resolveResourcesDir(resourcesDir);
|
|
34209
|
+
const candidateDirs = [resolvedResourcesDir, join8(resolvedResourcesDir, "apps")];
|
|
34210
|
+
for (const dir of candidateDirs) {
|
|
34211
|
+
const entries = await safeReadDir(dir);
|
|
34212
|
+
if (!entries) {
|
|
34213
|
+
continue;
|
|
34214
|
+
}
|
|
34215
|
+
for (const entry of entries) {
|
|
34216
|
+
if (!entry.isFile()) {
|
|
34217
|
+
continue;
|
|
34218
|
+
}
|
|
34219
|
+
const name = entry.name.toLowerCase();
|
|
34220
|
+
if (name.endsWith(".ipa")) {
|
|
34221
|
+
return join8(dir, entry.name);
|
|
34222
|
+
}
|
|
34223
|
+
}
|
|
34224
|
+
}
|
|
34225
|
+
return void 0;
|
|
34226
|
+
}
|
|
34227
|
+
function isErrorWithCode(error) {
|
|
34228
|
+
return typeof error === "object" && error !== null && "code" in error;
|
|
34229
|
+
}
|
|
34230
|
+
async function safeReadDir(dir) {
|
|
34231
|
+
try {
|
|
34232
|
+
return await readdir(dir, { withFileTypes: true });
|
|
34233
|
+
} catch (error) {
|
|
34234
|
+
if (isErrorWithCode(error) && typeof error.code === "string" && error.code === "ENOENT") {
|
|
34235
|
+
return void 0;
|
|
34236
|
+
}
|
|
34237
|
+
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
34238
|
+
logError(`Failed to read resources directory ${dir}: ${errorMsg}`);
|
|
34239
|
+
return void 0;
|
|
34240
|
+
}
|
|
34241
|
+
}
|
|
34191
34242
|
function getResourcesEnrollmentProfilePath(resourcesDir, udid) {
|
|
34192
34243
|
const baseDir = resolveResourcesDir(resourcesDir);
|
|
34193
34244
|
const mdmDir = join8(baseDir, "mdm");
|