@mcesystems/apple-kit 1.0.50 → 1.0.52
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 +121 -167
- package/dist/index.js.map +4 -4
- package/dist/index.mjs +118 -164
- package/dist/index.mjs.map +4 -4
- package/dist/resources/plist/certificate-trust.xml +3 -1
- package/dist/types/logic/actions/install.d.ts +1 -0
- package/dist/types/logic/actions/install.d.ts.map +1 -1
- package/dist/types/logic/activationFlow.d.ts +1 -2
- package/dist/types/logic/activationFlow.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -15027,19 +15027,19 @@ var require_printer = __commonJS({
|
|
|
15027
15027
|
},
|
|
15028
15028
|
// Document
|
|
15029
15029
|
Document: function Document(node) {
|
|
15030
|
-
return
|
|
15030
|
+
return join9(node.definitions, "\n\n") + "\n";
|
|
15031
15031
|
},
|
|
15032
15032
|
OperationDefinition: function OperationDefinition(node) {
|
|
15033
15033
|
var op = node.operation;
|
|
15034
15034
|
var name = node.name;
|
|
15035
|
-
var varDefs = wrap("(",
|
|
15036
|
-
var directives =
|
|
15035
|
+
var varDefs = wrap("(", join9(node.variableDefinitions, ", "), ")");
|
|
15036
|
+
var directives = join9(node.directives, " ");
|
|
15037
15037
|
var selectionSet = node.selectionSet;
|
|
15038
|
-
return !name && !directives && !varDefs && op === "query" ? selectionSet :
|
|
15038
|
+
return !name && !directives && !varDefs && op === "query" ? selectionSet : join9([op, join9([name, varDefs]), directives, selectionSet], " ");
|
|
15039
15039
|
},
|
|
15040
15040
|
VariableDefinition: function VariableDefinition(_ref) {
|
|
15041
15041
|
var variable = _ref.variable, type = _ref.type, defaultValue = _ref.defaultValue, directives = _ref.directives;
|
|
15042
|
-
return variable + ": " + type + wrap(" = ", defaultValue) + wrap(" ",
|
|
15042
|
+
return variable + ": " + type + wrap(" = ", defaultValue) + wrap(" ", join9(directives, " "));
|
|
15043
15043
|
},
|
|
15044
15044
|
SelectionSet: function SelectionSet(_ref2) {
|
|
15045
15045
|
var selections = _ref2.selections;
|
|
@@ -15047,7 +15047,7 @@ var require_printer = __commonJS({
|
|
|
15047
15047
|
},
|
|
15048
15048
|
Field: function Field(_ref3) {
|
|
15049
15049
|
var alias = _ref3.alias, name = _ref3.name, args = _ref3.arguments, directives = _ref3.directives, selectionSet = _ref3.selectionSet;
|
|
15050
|
-
return
|
|
15050
|
+
return join9([wrap("", alias, ": ") + name + wrap("(", join9(args, ", "), ")"), join9(directives, " "), selectionSet], " ");
|
|
15051
15051
|
},
|
|
15052
15052
|
Argument: function Argument(_ref4) {
|
|
15053
15053
|
var name = _ref4.name, value = _ref4.value;
|
|
@@ -15056,18 +15056,18 @@ var require_printer = __commonJS({
|
|
|
15056
15056
|
// Fragments
|
|
15057
15057
|
FragmentSpread: function FragmentSpread(_ref5) {
|
|
15058
15058
|
var name = _ref5.name, directives = _ref5.directives;
|
|
15059
|
-
return "..." + name + wrap(" ",
|
|
15059
|
+
return "..." + name + wrap(" ", join9(directives, " "));
|
|
15060
15060
|
},
|
|
15061
15061
|
InlineFragment: function InlineFragment(_ref6) {
|
|
15062
15062
|
var typeCondition = _ref6.typeCondition, directives = _ref6.directives, selectionSet = _ref6.selectionSet;
|
|
15063
|
-
return
|
|
15063
|
+
return join9(["...", wrap("on ", typeCondition), join9(directives, " "), selectionSet], " ");
|
|
15064
15064
|
},
|
|
15065
15065
|
FragmentDefinition: function FragmentDefinition(_ref7) {
|
|
15066
15066
|
var name = _ref7.name, typeCondition = _ref7.typeCondition, variableDefinitions = _ref7.variableDefinitions, directives = _ref7.directives, selectionSet = _ref7.selectionSet;
|
|
15067
15067
|
return (
|
|
15068
15068
|
// Note: fragment variable definitions are experimental and may be changed
|
|
15069
15069
|
// or removed in the future.
|
|
15070
|
-
"fragment ".concat(name).concat(wrap("(",
|
|
15070
|
+
"fragment ".concat(name).concat(wrap("(", join9(variableDefinitions, ", "), ")"), " ") + "on ".concat(typeCondition, " ").concat(wrap("", join9(directives, " "), " ")) + selectionSet
|
|
15071
15071
|
);
|
|
15072
15072
|
},
|
|
15073
15073
|
// Value
|
|
@@ -15096,11 +15096,11 @@ var require_printer = __commonJS({
|
|
|
15096
15096
|
},
|
|
15097
15097
|
ListValue: function ListValue(_ref13) {
|
|
15098
15098
|
var values = _ref13.values;
|
|
15099
|
-
return "[" +
|
|
15099
|
+
return "[" + join9(values, ", ") + "]";
|
|
15100
15100
|
},
|
|
15101
15101
|
ObjectValue: function ObjectValue(_ref14) {
|
|
15102
15102
|
var fields = _ref14.fields;
|
|
15103
|
-
return "{" +
|
|
15103
|
+
return "{" + join9(fields, ", ") + "}";
|
|
15104
15104
|
},
|
|
15105
15105
|
ObjectField: function ObjectField(_ref15) {
|
|
15106
15106
|
var name = _ref15.name, value = _ref15.value;
|
|
@@ -15109,7 +15109,7 @@ var require_printer = __commonJS({
|
|
|
15109
15109
|
// Directive
|
|
15110
15110
|
Directive: function Directive(_ref16) {
|
|
15111
15111
|
var name = _ref16.name, args = _ref16.arguments;
|
|
15112
|
-
return "@" + name + wrap("(",
|
|
15112
|
+
return "@" + name + wrap("(", join9(args, ", "), ")");
|
|
15113
15113
|
},
|
|
15114
15114
|
// Type
|
|
15115
15115
|
NamedType: function NamedType(_ref17) {
|
|
@@ -15127,7 +15127,7 @@ var require_printer = __commonJS({
|
|
|
15127
15127
|
// Type System Definitions
|
|
15128
15128
|
SchemaDefinition: function SchemaDefinition(_ref20) {
|
|
15129
15129
|
var directives = _ref20.directives, operationTypes = _ref20.operationTypes;
|
|
15130
|
-
return
|
|
15130
|
+
return join9(["schema", join9(directives, " "), block(operationTypes)], " ");
|
|
15131
15131
|
},
|
|
15132
15132
|
OperationTypeDefinition: function OperationTypeDefinition(_ref21) {
|
|
15133
15133
|
var operation = _ref21.operation, type = _ref21.type;
|
|
@@ -15135,85 +15135,85 @@ var require_printer = __commonJS({
|
|
|
15135
15135
|
},
|
|
15136
15136
|
ScalarTypeDefinition: addDescription(function(_ref22) {
|
|
15137
15137
|
var name = _ref22.name, directives = _ref22.directives;
|
|
15138
|
-
return
|
|
15138
|
+
return join9(["scalar", name, join9(directives, " ")], " ");
|
|
15139
15139
|
}),
|
|
15140
15140
|
ObjectTypeDefinition: addDescription(function(_ref23) {
|
|
15141
15141
|
var name = _ref23.name, interfaces = _ref23.interfaces, directives = _ref23.directives, fields = _ref23.fields;
|
|
15142
|
-
return
|
|
15142
|
+
return join9(["type", name, wrap("implements ", join9(interfaces, " & ")), join9(directives, " "), block(fields)], " ");
|
|
15143
15143
|
}),
|
|
15144
15144
|
FieldDefinition: addDescription(function(_ref24) {
|
|
15145
15145
|
var name = _ref24.name, args = _ref24.arguments, type = _ref24.type, directives = _ref24.directives;
|
|
15146
|
-
return name + (hasMultilineItems(args) ? wrap("(\n", indent(
|
|
15146
|
+
return name + (hasMultilineItems(args) ? wrap("(\n", indent(join9(args, "\n")), "\n)") : wrap("(", join9(args, ", "), ")")) + ": " + type + wrap(" ", join9(directives, " "));
|
|
15147
15147
|
}),
|
|
15148
15148
|
InputValueDefinition: addDescription(function(_ref25) {
|
|
15149
15149
|
var name = _ref25.name, type = _ref25.type, defaultValue = _ref25.defaultValue, directives = _ref25.directives;
|
|
15150
|
-
return
|
|
15150
|
+
return join9([name + ": " + type, wrap("= ", defaultValue), join9(directives, " ")], " ");
|
|
15151
15151
|
}),
|
|
15152
15152
|
InterfaceTypeDefinition: addDescription(function(_ref26) {
|
|
15153
15153
|
var name = _ref26.name, directives = _ref26.directives, fields = _ref26.fields;
|
|
15154
|
-
return
|
|
15154
|
+
return join9(["interface", name, join9(directives, " "), block(fields)], " ");
|
|
15155
15155
|
}),
|
|
15156
15156
|
UnionTypeDefinition: addDescription(function(_ref27) {
|
|
15157
15157
|
var name = _ref27.name, directives = _ref27.directives, types = _ref27.types;
|
|
15158
|
-
return
|
|
15158
|
+
return join9(["union", name, join9(directives, " "), types && types.length !== 0 ? "= " + join9(types, " | ") : ""], " ");
|
|
15159
15159
|
}),
|
|
15160
15160
|
EnumTypeDefinition: addDescription(function(_ref28) {
|
|
15161
15161
|
var name = _ref28.name, directives = _ref28.directives, values = _ref28.values;
|
|
15162
|
-
return
|
|
15162
|
+
return join9(["enum", name, join9(directives, " "), block(values)], " ");
|
|
15163
15163
|
}),
|
|
15164
15164
|
EnumValueDefinition: addDescription(function(_ref29) {
|
|
15165
15165
|
var name = _ref29.name, directives = _ref29.directives;
|
|
15166
|
-
return
|
|
15166
|
+
return join9([name, join9(directives, " ")], " ");
|
|
15167
15167
|
}),
|
|
15168
15168
|
InputObjectTypeDefinition: addDescription(function(_ref30) {
|
|
15169
15169
|
var name = _ref30.name, directives = _ref30.directives, fields = _ref30.fields;
|
|
15170
|
-
return
|
|
15170
|
+
return join9(["input", name, join9(directives, " "), block(fields)], " ");
|
|
15171
15171
|
}),
|
|
15172
15172
|
DirectiveDefinition: addDescription(function(_ref31) {
|
|
15173
15173
|
var name = _ref31.name, args = _ref31.arguments, repeatable = _ref31.repeatable, locations = _ref31.locations;
|
|
15174
|
-
return "directive @" + name + (hasMultilineItems(args) ? wrap("(\n", indent(
|
|
15174
|
+
return "directive @" + name + (hasMultilineItems(args) ? wrap("(\n", indent(join9(args, "\n")), "\n)") : wrap("(", join9(args, ", "), ")")) + (repeatable ? " repeatable" : "") + " on " + join9(locations, " | ");
|
|
15175
15175
|
}),
|
|
15176
15176
|
SchemaExtension: function SchemaExtension(_ref32) {
|
|
15177
15177
|
var directives = _ref32.directives, operationTypes = _ref32.operationTypes;
|
|
15178
|
-
return
|
|
15178
|
+
return join9(["extend schema", join9(directives, " "), block(operationTypes)], " ");
|
|
15179
15179
|
},
|
|
15180
15180
|
ScalarTypeExtension: function ScalarTypeExtension(_ref33) {
|
|
15181
15181
|
var name = _ref33.name, directives = _ref33.directives;
|
|
15182
|
-
return
|
|
15182
|
+
return join9(["extend scalar", name, join9(directives, " ")], " ");
|
|
15183
15183
|
},
|
|
15184
15184
|
ObjectTypeExtension: function ObjectTypeExtension(_ref34) {
|
|
15185
15185
|
var name = _ref34.name, interfaces = _ref34.interfaces, directives = _ref34.directives, fields = _ref34.fields;
|
|
15186
|
-
return
|
|
15186
|
+
return join9(["extend type", name, wrap("implements ", join9(interfaces, " & ")), join9(directives, " "), block(fields)], " ");
|
|
15187
15187
|
},
|
|
15188
15188
|
InterfaceTypeExtension: function InterfaceTypeExtension(_ref35) {
|
|
15189
15189
|
var name = _ref35.name, directives = _ref35.directives, fields = _ref35.fields;
|
|
15190
|
-
return
|
|
15190
|
+
return join9(["extend interface", name, join9(directives, " "), block(fields)], " ");
|
|
15191
15191
|
},
|
|
15192
15192
|
UnionTypeExtension: function UnionTypeExtension(_ref36) {
|
|
15193
15193
|
var name = _ref36.name, directives = _ref36.directives, types = _ref36.types;
|
|
15194
|
-
return
|
|
15194
|
+
return join9(["extend union", name, join9(directives, " "), types && types.length !== 0 ? "= " + join9(types, " | ") : ""], " ");
|
|
15195
15195
|
},
|
|
15196
15196
|
EnumTypeExtension: function EnumTypeExtension(_ref37) {
|
|
15197
15197
|
var name = _ref37.name, directives = _ref37.directives, values = _ref37.values;
|
|
15198
|
-
return
|
|
15198
|
+
return join9(["extend enum", name, join9(directives, " "), block(values)], " ");
|
|
15199
15199
|
},
|
|
15200
15200
|
InputObjectTypeExtension: function InputObjectTypeExtension(_ref38) {
|
|
15201
15201
|
var name = _ref38.name, directives = _ref38.directives, fields = _ref38.fields;
|
|
15202
|
-
return
|
|
15202
|
+
return join9(["extend input", name, join9(directives, " "), block(fields)], " ");
|
|
15203
15203
|
}
|
|
15204
15204
|
};
|
|
15205
15205
|
function addDescription(cb) {
|
|
15206
15206
|
return function(node) {
|
|
15207
|
-
return
|
|
15207
|
+
return join9([node.description, cb(node)], "\n");
|
|
15208
15208
|
};
|
|
15209
15209
|
}
|
|
15210
|
-
function
|
|
15210
|
+
function join9(maybeArray, separator) {
|
|
15211
15211
|
return maybeArray ? maybeArray.filter(function(x) {
|
|
15212
15212
|
return x;
|
|
15213
15213
|
}).join(separator || "") : "";
|
|
15214
15214
|
}
|
|
15215
15215
|
function block(array) {
|
|
15216
|
-
return array && array.length !== 0 ? "{\n" + indent(
|
|
15216
|
+
return array && array.length !== 0 ? "{\n" + indent(join9(array, "\n")) + "\n}" : "";
|
|
15217
15217
|
}
|
|
15218
15218
|
function wrap(start, maybeString, end) {
|
|
15219
15219
|
return maybeString ? start + maybeString + (end || "") : "";
|
|
@@ -33375,12 +33375,11 @@ async function installApp(ipaPath, udid, options) {
|
|
|
33375
33375
|
const mdmClient = await resolveMdmClient(options.mdm);
|
|
33376
33376
|
const mdmInstallOptions = getMdmInstallOptions(options.mdm);
|
|
33377
33377
|
await mdmClient.installApp(udid, mdmInstallOptions);
|
|
33378
|
-
return;
|
|
33379
33378
|
}
|
|
33379
|
+
await installLocalApp(ipaPath, udid);
|
|
33380
|
+
}
|
|
33381
|
+
async function installLocalApp(ipaPath, udid) {
|
|
33380
33382
|
logTask(`Installing app ${ipaPath} on device ${udid}`);
|
|
33381
|
-
if (!await isPaired(udid)) {
|
|
33382
|
-
await waitForPairing(udid, 1e4);
|
|
33383
|
-
}
|
|
33384
33383
|
await runIDeviceTool("ideviceinstaller", ["-u", udid, "install", ipaPath]);
|
|
33385
33384
|
}
|
|
33386
33385
|
async function uninstallApp(bundleId, udid) {
|
|
@@ -33671,16 +33670,13 @@ function killPortForwardProcess(process2) {
|
|
|
33671
33670
|
|
|
33672
33671
|
// src/logic/activationFlow.ts
|
|
33673
33672
|
var import_node_fs4 = require("node:fs");
|
|
33674
|
-
var import_promises3 = require("node:fs/promises");
|
|
33675
|
-
var import_node_os3 = require("node:os");
|
|
33676
|
-
var import_node_path8 = require("node:path");
|
|
33677
|
-
var import_node_url2 = require("node:url");
|
|
33678
|
-
|
|
33679
|
-
// src/utils/trustProfile.ts
|
|
33680
|
-
var import_node_crypto2 = require("node:crypto");
|
|
33681
33673
|
var import_promises2 = require("node:fs/promises");
|
|
33682
33674
|
var import_node_os2 = require("node:os");
|
|
33683
33675
|
var import_node_path7 = require("node:path");
|
|
33676
|
+
var import_node_url2 = require("node:url");
|
|
33677
|
+
|
|
33678
|
+
// src/utils/wifiProfile.ts
|
|
33679
|
+
var import_node_crypto2 = require("node:crypto");
|
|
33684
33680
|
|
|
33685
33681
|
// src/utils/templateLoader.ts
|
|
33686
33682
|
var import_node_fs3 = require("node:fs");
|
|
@@ -33770,56 +33766,7 @@ function escapeXml(str) {
|
|
|
33770
33766
|
return str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
33771
33767
|
}
|
|
33772
33768
|
|
|
33773
|
-
// src/utils/trustProfile.ts
|
|
33774
|
-
async function generateTrustProfile(config, options) {
|
|
33775
|
-
const {
|
|
33776
|
-
organizationName,
|
|
33777
|
-
certificateBase64,
|
|
33778
|
-
certificateDisplayName = `${organizationName} Enterprise Certificate`,
|
|
33779
|
-
profileDisplayName = `${organizationName} Enterprise Trust`
|
|
33780
|
-
} = config;
|
|
33781
|
-
const profileUuid = (0, import_node_crypto2.randomUUID)().toUpperCase();
|
|
33782
|
-
const certificateUuid = (0, import_node_crypto2.randomUUID)().toUpperCase();
|
|
33783
|
-
const orgShortName = organizationName.split(/\s+/)[0].toLowerCase();
|
|
33784
|
-
const timestamp = Date.now();
|
|
33785
|
-
const profileId = `com.${orgShortName}.enterprise.trust.${timestamp}`;
|
|
33786
|
-
const payloadId = `${profileId}.cert`;
|
|
33787
|
-
logInfo(`Generating trust profile for: ${organizationName}`);
|
|
33788
|
-
const cleanCertBase64 = certificateBase64.replace(/-----BEGIN CERTIFICATE-----/g, "").replace(/-----END CERTIFICATE-----/g, "").replace(/\s/g, "");
|
|
33789
|
-
const template = await loadTemplate("certificate-trust.xml", options?.plistDir);
|
|
33790
|
-
const certificateFileName = `${orgShortName}_enterprise.cer`;
|
|
33791
|
-
const variables = {
|
|
33792
|
-
organizationName,
|
|
33793
|
-
certificateBase64: cleanCertBase64,
|
|
33794
|
-
certificateDescription: `Trusts ${organizationName} enterprise apps`,
|
|
33795
|
-
certificateDisplayName,
|
|
33796
|
-
profileDisplayName,
|
|
33797
|
-
profileId,
|
|
33798
|
-
profileUuid,
|
|
33799
|
-
payloadId,
|
|
33800
|
-
certificateUuid,
|
|
33801
|
-
certificateFileName,
|
|
33802
|
-
removalDisallowed: "false"
|
|
33803
|
-
};
|
|
33804
|
-
return processTemplate(template, variables);
|
|
33805
|
-
}
|
|
33806
|
-
async function generateTrustProfileFromEnv(organizationName, options) {
|
|
33807
|
-
const certBase64 = process.env.TRUST_CERT_BASE64;
|
|
33808
|
-
if (!certBase64) {
|
|
33809
|
-
logInfo("TRUST_CERT_BASE64 environment variable not set, skipping trust profile generation.");
|
|
33810
|
-
return void 0;
|
|
33811
|
-
}
|
|
33812
|
-
return generateTrustProfile(
|
|
33813
|
-
{
|
|
33814
|
-
organizationName,
|
|
33815
|
-
certificateBase64: certBase64
|
|
33816
|
-
},
|
|
33817
|
-
options
|
|
33818
|
-
);
|
|
33819
|
-
}
|
|
33820
|
-
|
|
33821
33769
|
// src/utils/wifiProfile.ts
|
|
33822
|
-
var import_node_crypto3 = require("node:crypto");
|
|
33823
33770
|
async function generateWifiProfile(config, options) {
|
|
33824
33771
|
const {
|
|
33825
33772
|
ssid,
|
|
@@ -33834,8 +33781,8 @@ async function generateWifiProfile(config, options) {
|
|
|
33834
33781
|
eapType = "PEAP",
|
|
33835
33782
|
acceptAnyCertificate = true
|
|
33836
33783
|
} = config;
|
|
33837
|
-
const profileUuid = (0,
|
|
33838
|
-
const payloadUuid = (0,
|
|
33784
|
+
const profileUuid = (0, import_node_crypto2.randomUUID)().toUpperCase();
|
|
33785
|
+
const payloadUuid = (0, import_node_crypto2.randomUUID)().toUpperCase();
|
|
33839
33786
|
const profileId = `com.mce.wifi.${ssid.replace(/[^a-zA-Z0-9]/g, "")}.${Date.now()}`;
|
|
33840
33787
|
const payloadId = `${profileId}.payload`;
|
|
33841
33788
|
logInfo(`Generating WiFi profile for SSID: ${ssid}, encryption: ${encryptionType}`);
|
|
@@ -34033,10 +33980,13 @@ function createIosCli(iosBinaryPath) {
|
|
|
34033
33980
|
var import_meta3 = {};
|
|
34034
33981
|
var DEFAULT_RETRIES = 150;
|
|
34035
33982
|
var DEFAULT_RETRY_DELAY_MS = 2e3;
|
|
33983
|
+
function sleep(ms) {
|
|
33984
|
+
return new Promise((resolve5) => setTimeout(resolve5, ms));
|
|
33985
|
+
}
|
|
34036
33986
|
var ActivationFlow = class {
|
|
34037
33987
|
iosCli;
|
|
34038
33988
|
mdmClientPromise;
|
|
34039
|
-
organizationName;
|
|
33989
|
+
// private readonly organizationName?: string;
|
|
34040
33990
|
resourcesDir;
|
|
34041
33991
|
constructor(config) {
|
|
34042
33992
|
const iosBinaryPath = resolveIosBinaryPath(config);
|
|
@@ -34045,7 +33995,6 @@ var ActivationFlow = class {
|
|
|
34045
33995
|
}
|
|
34046
33996
|
this.iosCli = createIosCli(iosBinaryPath);
|
|
34047
33997
|
this.mdmClientPromise = createMdmClientFromEnv({ resourcesDir: config.resourcesDir });
|
|
34048
|
-
this.organizationName = config.organizationName ?? process.env.ORGANIZATION_NAME;
|
|
34049
33998
|
this.resourcesDir = config.resourcesDir;
|
|
34050
33999
|
}
|
|
34051
34000
|
async run(udid) {
|
|
@@ -34061,12 +34010,11 @@ var ActivationFlow = class {
|
|
|
34061
34010
|
await this.installWifiProfile(udid);
|
|
34062
34011
|
await this.installMdmProfile(udid);
|
|
34063
34012
|
await this.retryIosCommand("skip steps", () => this.iosCli.skipSteps(udid));
|
|
34064
|
-
await this.
|
|
34013
|
+
await this.installManagedApp(udid);
|
|
34065
34014
|
return "activated";
|
|
34066
34015
|
}
|
|
34067
34016
|
async installWifiProfile(udid) {
|
|
34068
|
-
const
|
|
34069
|
-
const wifiProfile = await generateWifiProfileFromEnv({ plistDir });
|
|
34017
|
+
const wifiProfile = await generateWifiProfileFromEnv();
|
|
34070
34018
|
if (!wifiProfile) {
|
|
34071
34019
|
return;
|
|
34072
34020
|
}
|
|
@@ -34086,15 +34034,6 @@ var ActivationFlow = class {
|
|
|
34086
34034
|
return activationState;
|
|
34087
34035
|
}
|
|
34088
34036
|
async installMdmProfile(udid) {
|
|
34089
|
-
const offlineProfilePath = getResourcesEnrollmentProfilePath(this.resourcesDir, udid);
|
|
34090
|
-
if (offlineProfilePath) {
|
|
34091
|
-
logTask("Installing MDM enrollment profile from resources");
|
|
34092
|
-
await this.retryIosCommand(
|
|
34093
|
-
"install mdm profile",
|
|
34094
|
-
() => this.iosCli.installProfile(udid, offlineProfilePath)
|
|
34095
|
-
);
|
|
34096
|
-
return;
|
|
34097
|
-
}
|
|
34098
34037
|
const client = await this.requireMdmClient();
|
|
34099
34038
|
logTask("Installing MDM enrollment profile");
|
|
34100
34039
|
const enrollmentProfile = await this.retry(
|
|
@@ -34112,32 +34051,38 @@ var ActivationFlow = class {
|
|
|
34112
34051
|
);
|
|
34113
34052
|
await removeTempFile(profilePath, "mdm profile");
|
|
34114
34053
|
}
|
|
34115
|
-
async installTrustProfile(udid) {
|
|
34116
|
-
|
|
34117
|
-
|
|
34118
|
-
|
|
34119
|
-
|
|
34120
|
-
|
|
34121
|
-
|
|
34122
|
-
|
|
34123
|
-
|
|
34124
|
-
|
|
34125
|
-
|
|
34126
|
-
|
|
34127
|
-
|
|
34128
|
-
|
|
34129
|
-
|
|
34130
|
-
|
|
34131
|
-
|
|
34132
|
-
|
|
34133
|
-
|
|
34134
|
-
|
|
34135
|
-
|
|
34136
|
-
|
|
34137
|
-
|
|
34138
|
-
|
|
34139
|
-
|
|
34140
|
-
);
|
|
34054
|
+
// private async installTrustProfile(udid: string): Promise<void> {
|
|
34055
|
+
// const resourcesProfilePath = getResourcesTrustProfilePath(this.resourcesDir);
|
|
34056
|
+
// if (existsSync(resourcesProfilePath)) {
|
|
34057
|
+
// logTask("Installing trust profile from resources");
|
|
34058
|
+
// await this.retryIosCommand("install trust profile", () =>
|
|
34059
|
+
// this.iosCli.installProfile(udid, resourcesProfilePath)
|
|
34060
|
+
// );
|
|
34061
|
+
// return;
|
|
34062
|
+
// }
|
|
34063
|
+
// if (!this.organizationName) {
|
|
34064
|
+
// logError("ORGANIZATION_NAME is required to generate trust profile");
|
|
34065
|
+
// throw new Error("ORGANIZATION_NAME is required for trust profile generation");
|
|
34066
|
+
// }
|
|
34067
|
+
// const trustProfile = await generateTrustProfileFromEnv(this.organizationName);
|
|
34068
|
+
// if (!trustProfile) {
|
|
34069
|
+
// return;
|
|
34070
|
+
// }
|
|
34071
|
+
// logTask("Generating trust profile and saving to resources");
|
|
34072
|
+
// await ensureResourcesDirExists(this.resourcesDir);
|
|
34073
|
+
// await writeFile(resourcesProfilePath, trustProfile, "utf-8");
|
|
34074
|
+
// await this.retryIosCommand("install trust profile", () =>
|
|
34075
|
+
// this.iosCli.installProfile(udid, resourcesProfilePath)
|
|
34076
|
+
// );
|
|
34077
|
+
// }
|
|
34078
|
+
async installManagedApp(udid) {
|
|
34079
|
+
const ipaPath = resolveManagedAppPath(this.resourcesDir);
|
|
34080
|
+
await installLocalApp(ipaPath, udid);
|
|
34081
|
+
const mdmInstallOptions = getMdmInstallOptionsFromEnv();
|
|
34082
|
+
const client = await this.requireMdmClient();
|
|
34083
|
+
logTask("Installing app via MDM for management takeover");
|
|
34084
|
+
await sleep(1e4);
|
|
34085
|
+
client.installApp(udid, mdmInstallOptions);
|
|
34141
34086
|
}
|
|
34142
34087
|
async requireMdmClient() {
|
|
34143
34088
|
const client = await this.mdmClientPromise;
|
|
@@ -34170,53 +34115,62 @@ var ActivationFlow = class {
|
|
|
34170
34115
|
}
|
|
34171
34116
|
};
|
|
34172
34117
|
async function saveProfileToTemp(profile, prefix) {
|
|
34173
|
-
const tempFilePath = (0,
|
|
34174
|
-
await (0,
|
|
34118
|
+
const tempFilePath = (0, import_node_path7.join)((0, import_node_os2.tmpdir)(), `mce_${prefix}_${Date.now()}.mobileconfig`);
|
|
34119
|
+
await (0, import_promises2.writeFile)(tempFilePath, profile, "utf-8");
|
|
34175
34120
|
logInfo(`Profile saved to: ${tempFilePath}`);
|
|
34176
34121
|
return tempFilePath;
|
|
34177
34122
|
}
|
|
34178
34123
|
async function removeTempFile(filePath, label) {
|
|
34179
34124
|
try {
|
|
34180
|
-
await (0,
|
|
34125
|
+
await (0, import_promises2.unlink)(filePath);
|
|
34181
34126
|
logInfo(`Removed ${label} temp file: ${filePath}`);
|
|
34182
34127
|
} catch (error) {
|
|
34183
34128
|
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
34184
34129
|
logError(`Failed to remove ${label} temp file: ${errorMsg}`);
|
|
34185
34130
|
}
|
|
34186
34131
|
}
|
|
34187
|
-
function
|
|
34132
|
+
function resolveManagedAppPath(resourcesDir) {
|
|
34188
34133
|
const resolvedResourcesDir = resolveResourcesDir(resourcesDir);
|
|
34189
|
-
|
|
34134
|
+
const ipaPath = (0, import_node_path7.join)(resolvedResourcesDir, "deviceagent.ipa");
|
|
34135
|
+
if (!(0, import_node_fs4.existsSync)(ipaPath)) {
|
|
34136
|
+
throw new Error(`Managed app IPA not found at ${ipaPath}`);
|
|
34137
|
+
}
|
|
34138
|
+
return ipaPath;
|
|
34190
34139
|
}
|
|
34191
|
-
|
|
34192
|
-
const
|
|
34193
|
-
|
|
34140
|
+
function getMdmInstallOptionsFromEnv() {
|
|
34141
|
+
const appId = process.env.MDM_APP_ID;
|
|
34142
|
+
const url = process.env.MDM_APP_URL;
|
|
34143
|
+
const waitForInstalled = parseBooleanEnv(process.env.MDM_APP_WAIT_FOR_INSTALLED);
|
|
34144
|
+
if (!appId && !url) {
|
|
34145
|
+
throw new Error("MDM install requires MDM_APP_ID or MDM_APP_URL.");
|
|
34146
|
+
}
|
|
34147
|
+
return {
|
|
34148
|
+
appId,
|
|
34149
|
+
url,
|
|
34150
|
+
waitForInstalled
|
|
34151
|
+
};
|
|
34152
|
+
}
|
|
34153
|
+
function parseBooleanEnv(value) {
|
|
34154
|
+
if (!value) {
|
|
34155
|
+
return void 0;
|
|
34156
|
+
}
|
|
34157
|
+
const normalized = value.trim().toLowerCase();
|
|
34158
|
+
if (normalized === "true" || normalized === "1" || normalized === "yes") {
|
|
34159
|
+
return true;
|
|
34160
|
+
}
|
|
34161
|
+
if (normalized === "false" || normalized === "0" || normalized === "no") {
|
|
34162
|
+
return false;
|
|
34163
|
+
}
|
|
34164
|
+
return void 0;
|
|
34194
34165
|
}
|
|
34195
34166
|
function resolveResourcesDir(resourcesDir) {
|
|
34196
34167
|
if (resourcesDir) {
|
|
34197
|
-
return (0,
|
|
34168
|
+
return (0, import_node_path7.resolve)(resourcesDir);
|
|
34198
34169
|
}
|
|
34199
34170
|
const currentFile = (0, import_node_url2.fileURLToPath)(import_meta3.url);
|
|
34200
|
-
const currentDir = (0,
|
|
34201
|
-
const packageRoot = (0,
|
|
34202
|
-
return (0,
|
|
34203
|
-
}
|
|
34204
|
-
function resolveResourcesPlistDir(resourcesDir) {
|
|
34205
|
-
return (0, import_node_path8.join)(resolveResourcesDir(resourcesDir), "plist");
|
|
34206
|
-
}
|
|
34207
|
-
function getResourcesEnrollmentProfilePath(resourcesDir, udid) {
|
|
34208
|
-
const baseDir = resolveResourcesDir(resourcesDir);
|
|
34209
|
-
const mdmDir = (0, import_node_path8.join)(baseDir, "mdm");
|
|
34210
|
-
const candidates = [
|
|
34211
|
-
udid ? (0, import_node_path8.join)(mdmDir, `enrollment_${udid}.mobileconfig`) : void 0,
|
|
34212
|
-
(0, import_node_path8.join)(mdmDir, "enrollment.mobileconfig")
|
|
34213
|
-
];
|
|
34214
|
-
for (const candidate of candidates) {
|
|
34215
|
-
if (candidate && (0, import_node_fs4.existsSync)(candidate)) {
|
|
34216
|
-
return candidate;
|
|
34217
|
-
}
|
|
34218
|
-
}
|
|
34219
|
-
return void 0;
|
|
34171
|
+
const currentDir = (0, import_node_path7.dirname)(currentFile);
|
|
34172
|
+
const packageRoot = (0, import_node_path7.join)(currentDir, "..", "..");
|
|
34173
|
+
return (0, import_node_path7.join)(packageRoot, "resources");
|
|
34220
34174
|
}
|
|
34221
34175
|
function resolveIosBinaryPath(config) {
|
|
34222
34176
|
if (config.iosBinaryPath) {
|
|
@@ -34227,7 +34181,7 @@ function resolveIosBinaryPath(config) {
|
|
|
34227
34181
|
}
|
|
34228
34182
|
const platform = process.platform;
|
|
34229
34183
|
const binaryName = platform === "win32" ? "ios.exe" : "ios";
|
|
34230
|
-
return (0,
|
|
34184
|
+
return (0, import_node_path7.join)(resolveResourcesDir(config.resourcesDir), "ios", "bin", platform, binaryName);
|
|
34231
34185
|
}
|
|
34232
34186
|
function getActivationState2(output) {
|
|
34233
34187
|
if (!Array.isArray(output) || output.length === 0) {
|
|
@@ -34502,7 +34456,7 @@ var AppleDeviceKit = class {
|
|
|
34502
34456
|
|
|
34503
34457
|
// src/logic/actions/usbmuxd.ts
|
|
34504
34458
|
var import_node_child_process4 = require("node:child_process");
|
|
34505
|
-
var
|
|
34459
|
+
var import_node_path8 = require("node:path");
|
|
34506
34460
|
var usbmuxdProcess = null;
|
|
34507
34461
|
function startUsbmuxd(foreground = false, options) {
|
|
34508
34462
|
const current = usbmuxdProcess;
|
|
@@ -34512,7 +34466,7 @@ function startUsbmuxd(foreground = false, options) {
|
|
|
34512
34466
|
}
|
|
34513
34467
|
const binPath = getResourcesBinPath({ resourcesDir: options?.resourcesDir });
|
|
34514
34468
|
const ext = process.platform === "win32" ? ".exe" : "";
|
|
34515
|
-
const toolPath = binPath ? (0,
|
|
34469
|
+
const toolPath = binPath ? (0, import_node_path8.join)(binPath, `usbmuxd${ext}`) : `usbmuxd${ext}`;
|
|
34516
34470
|
const args = foreground ? ["-f"] : [];
|
|
34517
34471
|
const spawnOptions = {
|
|
34518
34472
|
windowsHide: true,
|