@mcesystems/apple-kit 1.0.92 → 1.0.93

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
@@ -374,6 +374,12 @@ var require_retry_promise = __commonJS({
374
374
  }
375
375
  });
376
376
 
377
+ // src/logic/appleDeviceKit.ts
378
+ import { readFileSync, unlinkSync } from "node:fs";
379
+ import { mkdir, stat } from "node:fs/promises";
380
+ import { writeFile as writeFile2 } from "node:fs/promises";
381
+ import { join as join5 } from "node:path";
382
+
377
383
  // ../tool-debug/dist/index.mjs
378
384
  import process2 from "node:process";
379
385
  import os from "node:os";
@@ -1207,14 +1213,14 @@ function createLoggers(namespace, logLevel = process.env.LOG_LEVEL ?? "none") {
1207
1213
  const logInfo8 = (0, import_debug.default)(`${namespace}:info`);
1208
1214
  const logTask5 = (0, import_debug.default)(`${namespace}:task`);
1209
1215
  const logError4 = (0, import_debug.default)(`${namespace}:error`);
1210
- const logDetail3 = (0, import_debug.default)(`${namespace}:detail`);
1216
+ const logDetail4 = (0, import_debug.default)(`${namespace}:detail`);
1211
1217
  const logDebug = (0, import_debug.default)(`${namespace}:debug`);
1212
1218
  const logWarning2 = (0, import_debug.default)(`${namespace}:warning`);
1213
1219
  const logColor = (0, import_debug.default)(`${namespace}:color`);
1214
1220
  logInfo8.color = "19";
1215
1221
  logTask5.color = "25";
1216
1222
  logError4.color = "1";
1217
- logDetail3.color = "199";
1223
+ logDetail4.color = "199";
1218
1224
  logWarning2.color = "186";
1219
1225
  logDebug.color = "211";
1220
1226
  logColor.enabled = true;
@@ -1222,7 +1228,7 @@ function createLoggers(namespace, logLevel = process.env.LOG_LEVEL ?? "none") {
1222
1228
  logInfo8.namespace = `${namespace2}:info`;
1223
1229
  logTask5.namespace = `${namespace2}:task`;
1224
1230
  logError4.namespace = `${namespace2}:error`;
1225
- logDetail3.namespace = `${namespace2}:detail`;
1231
+ logDetail4.namespace = `${namespace2}:detail`;
1226
1232
  logWarning2.namespace = `${namespace2}:warning`;
1227
1233
  logDebug.namespace = `${namespace2}:debug`;
1228
1234
  }
@@ -1233,7 +1239,7 @@ function createLoggers(namespace, logLevel = process.env.LOG_LEVEL ?? "none") {
1233
1239
  logTask5.enabled = true;
1234
1240
  logError4.enabled = true;
1235
1241
  logWarning2.enabled = true;
1236
- logDetail3.enabled = false;
1242
+ logDetail4.enabled = false;
1237
1243
  logDebug.enabled = false;
1238
1244
  break;
1239
1245
  case "debug":
@@ -1241,7 +1247,7 @@ function createLoggers(namespace, logLevel = process.env.LOG_LEVEL ?? "none") {
1241
1247
  logTask5.enabled = true;
1242
1248
  logError4.enabled = true;
1243
1249
  logWarning2.enabled = true;
1244
- logDetail3.enabled = true;
1250
+ logDetail4.enabled = true;
1245
1251
  logDebug.enabled = true;
1246
1252
  break;
1247
1253
  case "none":
@@ -1249,7 +1255,7 @@ function createLoggers(namespace, logLevel = process.env.LOG_LEVEL ?? "none") {
1249
1255
  logTask5.enabled = false;
1250
1256
  logError4.enabled = false;
1251
1257
  logWarning2.enabled = false;
1252
- logDetail3.enabled = false;
1258
+ logDetail4.enabled = false;
1253
1259
  logDebug.enabled = false;
1254
1260
  break;
1255
1261
  }
@@ -1267,7 +1273,7 @@ function createLoggers(namespace, logLevel = process.env.LOG_LEVEL ?? "none") {
1267
1273
  logError4.color = color;
1268
1274
  break;
1269
1275
  case "detail":
1270
- logDetail3.color = color;
1276
+ logDetail4.color = color;
1271
1277
  break;
1272
1278
  case "warning":
1273
1279
  logWarning2.color = color;
@@ -1334,7 +1340,7 @@ ${" ".repeat(padding)}${"=".repeat(80)}`;
1334
1340
  const functionName = functionMatch ? functionMatch[1] : "<anonymous>";
1335
1341
  callerDetails = `${functionName}`;
1336
1342
  }
1337
- logDetail3(`${header(`*${title}* ${callerDetails}`)}
1343
+ logDetail4(`${header(`*${title}* ${callerDetails}`)}
1338
1344
  ${args.reduce((acc, arg) => `${acc}
1339
1345
  ${logDataDetail(arg)}`, "")}
1340
1346
 
@@ -1357,7 +1363,7 @@ ${"=".repeat(80)}`);
1357
1363
  logInfo: logInfo8,
1358
1364
  logTask: logTask5,
1359
1365
  logError: logError4,
1360
- logDetail: logDetail3,
1366
+ logDetail: logDetail4,
1361
1367
  logDebug,
1362
1368
  logWarning: logWarning2,
1363
1369
  logColor,
@@ -11714,12 +11720,12 @@ var require_form_data = __commonJS3({
11714
11720
  if (value.end != void 0 && value.end != Infinity && value.start != void 0) {
11715
11721
  callback(null, value.end + 1 - (value.start ? value.start : 0));
11716
11722
  } else {
11717
- fs.stat(value.path, function(err, stat) {
11723
+ fs.stat(value.path, function(err, stat2) {
11718
11724
  if (err) {
11719
11725
  callback(err);
11720
11726
  return;
11721
11727
  }
11722
- var fileSize = stat.size - (value.start ? value.start : 0);
11728
+ var fileSize = stat2.size - (value.start ? value.start : 0);
11723
11729
  callback(null, fileSize);
11724
11730
  });
11725
11731
  }
@@ -15797,16 +15803,16 @@ var require_printer = __commonJS3({
15797
15803
  },
15798
15804
  // Document
15799
15805
  Document: {
15800
- leave: (node) => join5(node.definitions, "\n\n")
15806
+ leave: (node) => join6(node.definitions, "\n\n")
15801
15807
  },
15802
15808
  OperationDefinition: {
15803
15809
  leave(node) {
15804
- const varDefs = hasMultilineItems(node.variableDefinitions) ? wrap("(\n", join5(node.variableDefinitions, "\n"), "\n)") : wrap("(", join5(node.variableDefinitions, ", "), ")");
15805
- const prefix = wrap("", node.description, "\n") + join5(
15810
+ const varDefs = hasMultilineItems(node.variableDefinitions) ? wrap("(\n", join6(node.variableDefinitions, "\n"), "\n)") : wrap("(", join6(node.variableDefinitions, ", "), ")");
15811
+ const prefix = wrap("", node.description, "\n") + join6(
15806
15812
  [
15807
15813
  node.operation,
15808
- join5([node.name, varDefs]),
15809
- join5(node.directives, " ")
15814
+ join6([node.name, varDefs]),
15815
+ join6(node.directives, " ")
15810
15816
  ],
15811
15817
  " "
15812
15818
  );
@@ -15814,7 +15820,7 @@ var require_printer = __commonJS3({
15814
15820
  }
15815
15821
  },
15816
15822
  VariableDefinition: {
15817
- leave: ({ variable, type, defaultValue, directives, description }) => wrap("", description, "\n") + variable + ": " + type + wrap(" = ", defaultValue) + wrap(" ", join5(directives, " "))
15823
+ leave: ({ variable, type, defaultValue, directives, description }) => wrap("", description, "\n") + variable + ": " + type + wrap(" = ", defaultValue) + wrap(" ", join6(directives, " "))
15818
15824
  },
15819
15825
  SelectionSet: {
15820
15826
  leave: ({ selections }) => block(selections)
@@ -15822,11 +15828,11 @@ var require_printer = __commonJS3({
15822
15828
  Field: {
15823
15829
  leave({ alias, name, arguments: args, directives, selectionSet }) {
15824
15830
  const prefix = wrap("", alias, ": ") + name;
15825
- let argsLine = prefix + wrap("(", join5(args, ", "), ")");
15831
+ let argsLine = prefix + wrap("(", join6(args, ", "), ")");
15826
15832
  if (argsLine.length > MAX_LINE_LENGTH) {
15827
- argsLine = prefix + wrap("(\n", indent(join5(args, "\n")), "\n)");
15833
+ argsLine = prefix + wrap("(\n", indent(join6(args, "\n")), "\n)");
15828
15834
  }
15829
- return join5([argsLine, join5(directives, " "), selectionSet], " ");
15835
+ return join6([argsLine, join6(directives, " "), selectionSet], " ");
15830
15836
  }
15831
15837
  },
15832
15838
  Argument: {
@@ -15834,14 +15840,14 @@ var require_printer = __commonJS3({
15834
15840
  },
15835
15841
  // Fragments
15836
15842
  FragmentSpread: {
15837
- leave: ({ name, directives }) => "..." + name + wrap(" ", join5(directives, " "))
15843
+ leave: ({ name, directives }) => "..." + name + wrap(" ", join6(directives, " "))
15838
15844
  },
15839
15845
  InlineFragment: {
15840
- leave: ({ typeCondition, directives, selectionSet }) => join5(
15846
+ leave: ({ typeCondition, directives, selectionSet }) => join6(
15841
15847
  [
15842
15848
  "...",
15843
15849
  wrap("on ", typeCondition),
15844
- join5(directives, " "),
15850
+ join6(directives, " "),
15845
15851
  selectionSet
15846
15852
  ],
15847
15853
  " "
@@ -15857,7 +15863,7 @@ var require_printer = __commonJS3({
15857
15863
  description
15858
15864
  }) => wrap("", description, "\n") + // Note: fragment variable definitions are experimental and may be changed
15859
15865
  // or removed in the future.
15860
- `fragment ${name}${wrap("(", join5(variableDefinitions, ", "), ")")} on ${typeCondition} ${wrap("", join5(directives, " "), " ")}` + selectionSet
15866
+ `fragment ${name}${wrap("(", join6(variableDefinitions, ", "), ")")} on ${typeCondition} ${wrap("", join6(directives, " "), " ")}` + selectionSet
15861
15867
  },
15862
15868
  // Value
15863
15869
  IntValue: {
@@ -15879,17 +15885,17 @@ var require_printer = __commonJS3({
15879
15885
  leave: ({ value }) => value
15880
15886
  },
15881
15887
  ListValue: {
15882
- leave: ({ values }) => "[" + join5(values, ", ") + "]"
15888
+ leave: ({ values }) => "[" + join6(values, ", ") + "]"
15883
15889
  },
15884
15890
  ObjectValue: {
15885
- leave: ({ fields }) => "{" + join5(fields, ", ") + "}"
15891
+ leave: ({ fields }) => "{" + join6(fields, ", ") + "}"
15886
15892
  },
15887
15893
  ObjectField: {
15888
15894
  leave: ({ name, value }) => name + ": " + value
15889
15895
  },
15890
15896
  // Directive
15891
15897
  Directive: {
15892
- leave: ({ name, arguments: args }) => "@" + name + wrap("(", join5(args, ", "), ")")
15898
+ leave: ({ name, arguments: args }) => "@" + name + wrap("(", join6(args, ", "), ")")
15893
15899
  },
15894
15900
  // Type
15895
15901
  NamedType: {
@@ -15903,138 +15909,138 @@ var require_printer = __commonJS3({
15903
15909
  },
15904
15910
  // Type System Definitions
15905
15911
  SchemaDefinition: {
15906
- leave: ({ description, directives, operationTypes }) => wrap("", description, "\n") + join5(["schema", join5(directives, " "), block(operationTypes)], " ")
15912
+ leave: ({ description, directives, operationTypes }) => wrap("", description, "\n") + join6(["schema", join6(directives, " "), block(operationTypes)], " ")
15907
15913
  },
15908
15914
  OperationTypeDefinition: {
15909
15915
  leave: ({ operation, type }) => operation + ": " + type
15910
15916
  },
15911
15917
  ScalarTypeDefinition: {
15912
- leave: ({ description, name, directives }) => wrap("", description, "\n") + join5(["scalar", name, join5(directives, " ")], " ")
15918
+ leave: ({ description, name, directives }) => wrap("", description, "\n") + join6(["scalar", name, join6(directives, " ")], " ")
15913
15919
  },
15914
15920
  ObjectTypeDefinition: {
15915
- leave: ({ description, name, interfaces, directives, fields }) => wrap("", description, "\n") + join5(
15921
+ leave: ({ description, name, interfaces, directives, fields }) => wrap("", description, "\n") + join6(
15916
15922
  [
15917
15923
  "type",
15918
15924
  name,
15919
- wrap("implements ", join5(interfaces, " & ")),
15920
- join5(directives, " "),
15925
+ wrap("implements ", join6(interfaces, " & ")),
15926
+ join6(directives, " "),
15921
15927
  block(fields)
15922
15928
  ],
15923
15929
  " "
15924
15930
  )
15925
15931
  },
15926
15932
  FieldDefinition: {
15927
- leave: ({ description, name, arguments: args, type, directives }) => wrap("", description, "\n") + name + (hasMultilineItems(args) ? wrap("(\n", indent(join5(args, "\n")), "\n)") : wrap("(", join5(args, ", "), ")")) + ": " + type + wrap(" ", join5(directives, " "))
15933
+ leave: ({ description, name, arguments: args, type, directives }) => wrap("", description, "\n") + name + (hasMultilineItems(args) ? wrap("(\n", indent(join6(args, "\n")), "\n)") : wrap("(", join6(args, ", "), ")")) + ": " + type + wrap(" ", join6(directives, " "))
15928
15934
  },
15929
15935
  InputValueDefinition: {
15930
- leave: ({ description, name, type, defaultValue, directives }) => wrap("", description, "\n") + join5(
15931
- [name + ": " + type, wrap("= ", defaultValue), join5(directives, " ")],
15936
+ leave: ({ description, name, type, defaultValue, directives }) => wrap("", description, "\n") + join6(
15937
+ [name + ": " + type, wrap("= ", defaultValue), join6(directives, " ")],
15932
15938
  " "
15933
15939
  )
15934
15940
  },
15935
15941
  InterfaceTypeDefinition: {
15936
- leave: ({ description, name, interfaces, directives, fields }) => wrap("", description, "\n") + join5(
15942
+ leave: ({ description, name, interfaces, directives, fields }) => wrap("", description, "\n") + join6(
15937
15943
  [
15938
15944
  "interface",
15939
15945
  name,
15940
- wrap("implements ", join5(interfaces, " & ")),
15941
- join5(directives, " "),
15946
+ wrap("implements ", join6(interfaces, " & ")),
15947
+ join6(directives, " "),
15942
15948
  block(fields)
15943
15949
  ],
15944
15950
  " "
15945
15951
  )
15946
15952
  },
15947
15953
  UnionTypeDefinition: {
15948
- leave: ({ description, name, directives, types }) => wrap("", description, "\n") + join5(
15949
- ["union", name, join5(directives, " "), wrap("= ", join5(types, " | "))],
15954
+ leave: ({ description, name, directives, types }) => wrap("", description, "\n") + join6(
15955
+ ["union", name, join6(directives, " "), wrap("= ", join6(types, " | "))],
15950
15956
  " "
15951
15957
  )
15952
15958
  },
15953
15959
  EnumTypeDefinition: {
15954
- leave: ({ description, name, directives, values }) => wrap("", description, "\n") + join5(["enum", name, join5(directives, " "), block(values)], " ")
15960
+ leave: ({ description, name, directives, values }) => wrap("", description, "\n") + join6(["enum", name, join6(directives, " "), block(values)], " ")
15955
15961
  },
15956
15962
  EnumValueDefinition: {
15957
- leave: ({ description, name, directives }) => wrap("", description, "\n") + join5([name, join5(directives, " ")], " ")
15963
+ leave: ({ description, name, directives }) => wrap("", description, "\n") + join6([name, join6(directives, " ")], " ")
15958
15964
  },
15959
15965
  InputObjectTypeDefinition: {
15960
- leave: ({ description, name, directives, fields }) => wrap("", description, "\n") + join5(["input", name, join5(directives, " "), block(fields)], " ")
15966
+ leave: ({ description, name, directives, fields }) => wrap("", description, "\n") + join6(["input", name, join6(directives, " "), block(fields)], " ")
15961
15967
  },
15962
15968
  DirectiveDefinition: {
15963
- leave: ({ description, name, arguments: args, repeatable, locations }) => wrap("", description, "\n") + "directive @" + name + (hasMultilineItems(args) ? wrap("(\n", indent(join5(args, "\n")), "\n)") : wrap("(", join5(args, ", "), ")")) + (repeatable ? " repeatable" : "") + " on " + join5(locations, " | ")
15969
+ leave: ({ description, name, arguments: args, repeatable, locations }) => wrap("", description, "\n") + "directive @" + name + (hasMultilineItems(args) ? wrap("(\n", indent(join6(args, "\n")), "\n)") : wrap("(", join6(args, ", "), ")")) + (repeatable ? " repeatable" : "") + " on " + join6(locations, " | ")
15964
15970
  },
15965
15971
  SchemaExtension: {
15966
- leave: ({ directives, operationTypes }) => join5(
15967
- ["extend schema", join5(directives, " "), block(operationTypes)],
15972
+ leave: ({ directives, operationTypes }) => join6(
15973
+ ["extend schema", join6(directives, " "), block(operationTypes)],
15968
15974
  " "
15969
15975
  )
15970
15976
  },
15971
15977
  ScalarTypeExtension: {
15972
- leave: ({ name, directives }) => join5(["extend scalar", name, join5(directives, " ")], " ")
15978
+ leave: ({ name, directives }) => join6(["extend scalar", name, join6(directives, " ")], " ")
15973
15979
  },
15974
15980
  ObjectTypeExtension: {
15975
- leave: ({ name, interfaces, directives, fields }) => join5(
15981
+ leave: ({ name, interfaces, directives, fields }) => join6(
15976
15982
  [
15977
15983
  "extend type",
15978
15984
  name,
15979
- wrap("implements ", join5(interfaces, " & ")),
15980
- join5(directives, " "),
15985
+ wrap("implements ", join6(interfaces, " & ")),
15986
+ join6(directives, " "),
15981
15987
  block(fields)
15982
15988
  ],
15983
15989
  " "
15984
15990
  )
15985
15991
  },
15986
15992
  InterfaceTypeExtension: {
15987
- leave: ({ name, interfaces, directives, fields }) => join5(
15993
+ leave: ({ name, interfaces, directives, fields }) => join6(
15988
15994
  [
15989
15995
  "extend interface",
15990
15996
  name,
15991
- wrap("implements ", join5(interfaces, " & ")),
15992
- join5(directives, " "),
15997
+ wrap("implements ", join6(interfaces, " & ")),
15998
+ join6(directives, " "),
15993
15999
  block(fields)
15994
16000
  ],
15995
16001
  " "
15996
16002
  )
15997
16003
  },
15998
16004
  UnionTypeExtension: {
15999
- leave: ({ name, directives, types }) => join5(
16005
+ leave: ({ name, directives, types }) => join6(
16000
16006
  [
16001
16007
  "extend union",
16002
16008
  name,
16003
- join5(directives, " "),
16004
- wrap("= ", join5(types, " | "))
16009
+ join6(directives, " "),
16010
+ wrap("= ", join6(types, " | "))
16005
16011
  ],
16006
16012
  " "
16007
16013
  )
16008
16014
  },
16009
16015
  EnumTypeExtension: {
16010
- leave: ({ name, directives, values }) => join5(["extend enum", name, join5(directives, " "), block(values)], " ")
16016
+ leave: ({ name, directives, values }) => join6(["extend enum", name, join6(directives, " "), block(values)], " ")
16011
16017
  },
16012
16018
  InputObjectTypeExtension: {
16013
- leave: ({ name, directives, fields }) => join5(["extend input", name, join5(directives, " "), block(fields)], " ")
16019
+ leave: ({ name, directives, fields }) => join6(["extend input", name, join6(directives, " "), block(fields)], " ")
16014
16020
  },
16015
16021
  // Schema Coordinates
16016
16022
  TypeCoordinate: {
16017
16023
  leave: ({ name }) => name
16018
16024
  },
16019
16025
  MemberCoordinate: {
16020
- leave: ({ name, memberName }) => join5([name, wrap(".", memberName)])
16026
+ leave: ({ name, memberName }) => join6([name, wrap(".", memberName)])
16021
16027
  },
16022
16028
  ArgumentCoordinate: {
16023
- leave: ({ name, fieldName, argumentName }) => join5([name, wrap(".", fieldName), wrap("(", argumentName, ":)")])
16029
+ leave: ({ name, fieldName, argumentName }) => join6([name, wrap(".", fieldName), wrap("(", argumentName, ":)")])
16024
16030
  },
16025
16031
  DirectiveCoordinate: {
16026
- leave: ({ name }) => join5(["@", name])
16032
+ leave: ({ name }) => join6(["@", name])
16027
16033
  },
16028
16034
  DirectiveArgumentCoordinate: {
16029
- leave: ({ name, argumentName }) => join5(["@", name, wrap("(", argumentName, ":)")])
16035
+ leave: ({ name, argumentName }) => join6(["@", name, wrap("(", argumentName, ":)")])
16030
16036
  }
16031
16037
  };
16032
- function join5(maybeArray, separator = "") {
16038
+ function join6(maybeArray, separator = "") {
16033
16039
  var _maybeArray$filter$jo;
16034
16040
  return (_maybeArray$filter$jo = maybeArray === null || maybeArray === void 0 ? void 0 : maybeArray.filter((x) => x).join(separator)) !== null && _maybeArray$filter$jo !== void 0 ? _maybeArray$filter$jo : "";
16035
16041
  }
16036
16042
  function block(array) {
16037
- return wrap("{\n", indent(join5(array, "\n")), "\n}");
16043
+ return wrap("{\n", indent(join6(array, "\n")), "\n}");
16038
16044
  }
16039
16045
  function wrap(start, maybeString, end = "") {
16040
16046
  return maybeString != null && maybeString !== "" ? start + maybeString + end : "";
@@ -37000,14 +37006,14 @@ function createLoggers2(namespace, logLevel = process.env.LOG_LEVEL ?? "none") {
37000
37006
  const logInfo222 = (0, import_debug2.default)(`${namespace}:info`);
37001
37007
  const logTask5 = (0, import_debug2.default)(`${namespace}:task`);
37002
37008
  const logError22 = (0, import_debug2.default)(`${namespace}:error`);
37003
- const logDetail3 = (0, import_debug2.default)(`${namespace}:detail`);
37009
+ const logDetail4 = (0, import_debug2.default)(`${namespace}:detail`);
37004
37010
  const logDebug = (0, import_debug2.default)(`${namespace}:debug`);
37005
37011
  const logWarning2 = (0, import_debug2.default)(`${namespace}:warning`);
37006
37012
  const logColor = (0, import_debug2.default)(`${namespace}:color`);
37007
37013
  logInfo222.color = "19";
37008
37014
  logTask5.color = "25";
37009
37015
  logError22.color = "1";
37010
- logDetail3.color = "199";
37016
+ logDetail4.color = "199";
37011
37017
  logWarning2.color = "186";
37012
37018
  logDebug.color = "211";
37013
37019
  logColor.enabled = true;
@@ -37015,7 +37021,7 @@ function createLoggers2(namespace, logLevel = process.env.LOG_LEVEL ?? "none") {
37015
37021
  logInfo222.namespace = `${namespace2}:info`;
37016
37022
  logTask5.namespace = `${namespace2}:task`;
37017
37023
  logError22.namespace = `${namespace2}:error`;
37018
- logDetail3.namespace = `${namespace2}:detail`;
37024
+ logDetail4.namespace = `${namespace2}:detail`;
37019
37025
  logWarning2.namespace = `${namespace2}:warning`;
37020
37026
  logDebug.namespace = `${namespace2}:debug`;
37021
37027
  }
@@ -37026,7 +37032,7 @@ function createLoggers2(namespace, logLevel = process.env.LOG_LEVEL ?? "none") {
37026
37032
  logTask5.enabled = true;
37027
37033
  logError22.enabled = true;
37028
37034
  logWarning2.enabled = true;
37029
- logDetail3.enabled = false;
37035
+ logDetail4.enabled = false;
37030
37036
  logDebug.enabled = false;
37031
37037
  break;
37032
37038
  case "debug":
@@ -37034,7 +37040,7 @@ function createLoggers2(namespace, logLevel = process.env.LOG_LEVEL ?? "none") {
37034
37040
  logTask5.enabled = true;
37035
37041
  logError22.enabled = true;
37036
37042
  logWarning2.enabled = true;
37037
- logDetail3.enabled = true;
37043
+ logDetail4.enabled = true;
37038
37044
  logDebug.enabled = true;
37039
37045
  break;
37040
37046
  case "none":
@@ -37042,7 +37048,7 @@ function createLoggers2(namespace, logLevel = process.env.LOG_LEVEL ?? "none") {
37042
37048
  logTask5.enabled = false;
37043
37049
  logError22.enabled = false;
37044
37050
  logWarning2.enabled = false;
37045
- logDetail3.enabled = false;
37051
+ logDetail4.enabled = false;
37046
37052
  logDebug.enabled = false;
37047
37053
  break;
37048
37054
  }
@@ -37060,7 +37066,7 @@ function createLoggers2(namespace, logLevel = process.env.LOG_LEVEL ?? "none") {
37060
37066
  logError22.color = color;
37061
37067
  break;
37062
37068
  case "detail":
37063
- logDetail3.color = color;
37069
+ logDetail4.color = color;
37064
37070
  break;
37065
37071
  case "warning":
37066
37072
  logWarning2.color = color;
@@ -37127,7 +37133,7 @@ ${" ".repeat(padding)}${"=".repeat(80)}`;
37127
37133
  const functionName = functionMatch ? functionMatch[1] : "<anonymous>";
37128
37134
  callerDetails = `${functionName}`;
37129
37135
  }
37130
- logDetail3(`${header(`*${title}* ${callerDetails}`)}
37136
+ logDetail4(`${header(`*${title}* ${callerDetails}`)}
37131
37137
  ${args.reduce((acc, arg) => `${acc}
37132
37138
  ${logDataDetail(arg)}`, "")}
37133
37139
 
@@ -37150,7 +37156,7 @@ ${"=".repeat(80)}`);
37150
37156
  logInfo: logInfo222,
37151
37157
  logTask: logTask5,
37152
37158
  logError: logError22,
37153
- logDetail: logDetail3,
37159
+ logDetail: logDetail4,
37154
37160
  logDebug,
37155
37161
  logWarning: logWarning2,
37156
37162
  logColor,
@@ -38097,14 +38103,14 @@ function createLoggers22(namespace, logLevel = process.env.LOG_LEVEL ?? "none")
38097
38103
  const logInfo32 = (0, import_debug22.default)(`${namespace}:info`);
38098
38104
  const logTask5 = (0, import_debug22.default)(`${namespace}:task`);
38099
38105
  const logError22 = (0, import_debug22.default)(`${namespace}:error`);
38100
- const logDetail3 = (0, import_debug22.default)(`${namespace}:detail`);
38106
+ const logDetail4 = (0, import_debug22.default)(`${namespace}:detail`);
38101
38107
  const logDebug = (0, import_debug22.default)(`${namespace}:debug`);
38102
38108
  const logWarning2 = (0, import_debug22.default)(`${namespace}:warning`);
38103
38109
  const logColor = (0, import_debug22.default)(`${namespace}:color`);
38104
38110
  logInfo32.color = "19";
38105
38111
  logTask5.color = "25";
38106
38112
  logError22.color = "1";
38107
- logDetail3.color = "199";
38113
+ logDetail4.color = "199";
38108
38114
  logWarning2.color = "186";
38109
38115
  logDebug.color = "211";
38110
38116
  logColor.enabled = true;
@@ -38112,7 +38118,7 @@ function createLoggers22(namespace, logLevel = process.env.LOG_LEVEL ?? "none")
38112
38118
  logInfo32.namespace = `${namespace2}:info`;
38113
38119
  logTask5.namespace = `${namespace2}:task`;
38114
38120
  logError22.namespace = `${namespace2}:error`;
38115
- logDetail3.namespace = `${namespace2}:detail`;
38121
+ logDetail4.namespace = `${namespace2}:detail`;
38116
38122
  logWarning2.namespace = `${namespace2}:warning`;
38117
38123
  logDebug.namespace = `${namespace2}:debug`;
38118
38124
  }
@@ -38123,7 +38129,7 @@ function createLoggers22(namespace, logLevel = process.env.LOG_LEVEL ?? "none")
38123
38129
  logTask5.enabled = true;
38124
38130
  logError22.enabled = true;
38125
38131
  logWarning2.enabled = true;
38126
- logDetail3.enabled = false;
38132
+ logDetail4.enabled = false;
38127
38133
  logDebug.enabled = false;
38128
38134
  break;
38129
38135
  case "debug":
@@ -38131,7 +38137,7 @@ function createLoggers22(namespace, logLevel = process.env.LOG_LEVEL ?? "none")
38131
38137
  logTask5.enabled = true;
38132
38138
  logError22.enabled = true;
38133
38139
  logWarning2.enabled = true;
38134
- logDetail3.enabled = true;
38140
+ logDetail4.enabled = true;
38135
38141
  logDebug.enabled = true;
38136
38142
  break;
38137
38143
  case "none":
@@ -38139,7 +38145,7 @@ function createLoggers22(namespace, logLevel = process.env.LOG_LEVEL ?? "none")
38139
38145
  logTask5.enabled = false;
38140
38146
  logError22.enabled = false;
38141
38147
  logWarning2.enabled = false;
38142
- logDetail3.enabled = false;
38148
+ logDetail4.enabled = false;
38143
38149
  logDebug.enabled = false;
38144
38150
  break;
38145
38151
  }
@@ -38157,7 +38163,7 @@ function createLoggers22(namespace, logLevel = process.env.LOG_LEVEL ?? "none")
38157
38163
  logError22.color = color;
38158
38164
  break;
38159
38165
  case "detail":
38160
- logDetail3.color = color;
38166
+ logDetail4.color = color;
38161
38167
  break;
38162
38168
  case "warning":
38163
38169
  logWarning2.color = color;
@@ -38224,7 +38230,7 @@ ${" ".repeat(padding)}${"=".repeat(80)}`;
38224
38230
  const functionName = functionMatch ? functionMatch[1] : "<anonymous>";
38225
38231
  callerDetails = `${functionName}`;
38226
38232
  }
38227
- logDetail3(`${header(`*${title}* ${callerDetails}`)}
38233
+ logDetail4(`${header(`*${title}* ${callerDetails}`)}
38228
38234
  ${args.reduce((acc, arg) => `${acc}
38229
38235
  ${logDataDetail(arg)}`, "")}
38230
38236
 
@@ -38247,7 +38253,7 @@ ${"=".repeat(80)}`);
38247
38253
  logInfo: logInfo32,
38248
38254
  logTask: logTask5,
38249
38255
  logError: logError22,
38250
- logDetail: logDetail3,
38256
+ logDetail: logDetail4,
38251
38257
  logDebug,
38252
38258
  logWarning: logWarning2,
38253
38259
  logColor,
@@ -39308,8 +39314,8 @@ var IosClient = class {
39308
39314
  };
39309
39315
 
39310
39316
  // src/logic/appleDeviceKit.ts
39311
- var { logInfo: logInfo7, setNamespace: setNamespace6, logError: logError3 } = createLoggers("apple-kit");
39312
- var AppleDeviceKit = class {
39317
+ var { logInfo: logInfo7, setNamespace: setNamespace6, logError: logError3, logDetail: logDetail3 } = createLoggers("apple-kit");
39318
+ var AppleDeviceKit = class _AppleDeviceKit {
39313
39319
  constructor(udid, logicalPort, usbmuxdAddress) {
39314
39320
  this.logicalPort = logicalPort;
39315
39321
  this.deviceId = udid;
@@ -39342,6 +39348,69 @@ var AppleDeviceKit = class {
39342
39348
  activationFlow;
39343
39349
  proxyActions;
39344
39350
  tunnelProcess = null;
39351
+ static IOS_17_VERSION = 17;
39352
+ /**
39353
+ * Check if iOS version requires tunneling (iOS 17+)
39354
+ */
39355
+ async requiresTunneling() {
39356
+ try {
39357
+ const deviceInfo = await this.info();
39358
+ const productVersion = deviceInfo.ProductVersion;
39359
+ const majorVersion = Number.parseInt(productVersion.split(".")[0] || "0", 10);
39360
+ return majorVersion >= _AppleDeviceKit.IOS_17_VERSION;
39361
+ } catch (error) {
39362
+ logError3(
39363
+ `Failed to check iOS version for device ${this.deviceId}, assuming tunneling required: ${error instanceof Error ? error.message : String(error)}`
39364
+ );
39365
+ return true;
39366
+ }
39367
+ }
39368
+ /**
39369
+ * Ensure tunnel is started for iOS 17+ devices
39370
+ */
39371
+ async ensureTunnel() {
39372
+ const requiresTunnel = await this.requiresTunneling();
39373
+ if (!requiresTunnel) {
39374
+ logDetail3(`Device ${this.deviceId} does not require tunneling (iOS < 17)`);
39375
+ return;
39376
+ }
39377
+ const existingTunnel = this.tunnelProcess;
39378
+ if (existingTunnel && !existingTunnel.killed) {
39379
+ logDetail3(`Tunnel already running for device ${this.deviceId}`);
39380
+ return;
39381
+ }
39382
+ logInfo7(`Starting tunnel for device ${this.deviceId} (iOS 17+)`);
39383
+ try {
39384
+ const tunnelProcess = await this.iosClient.tunnelStart(true);
39385
+ this.tunnelProcess = tunnelProcess;
39386
+ tunnelProcess.on("exit", (code) => {
39387
+ logError3(`Tunnel process for device ${this.deviceId} exited with code ${code}`);
39388
+ this.tunnelProcess = null;
39389
+ });
39390
+ tunnelProcess.on("error", (error) => {
39391
+ logError3(`Tunnel process error for device ${this.deviceId}: ${error.message}`);
39392
+ this.tunnelProcess = null;
39393
+ });
39394
+ await new Promise((resolve2) => setTimeout(resolve2, 1e3));
39395
+ logInfo7(`Tunnel started successfully for device ${this.deviceId}`);
39396
+ } catch (error) {
39397
+ logError3(
39398
+ `Failed to start tunnel for device ${this.deviceId}: ${error instanceof Error ? error.message : String(error)}`
39399
+ );
39400
+ throw error;
39401
+ }
39402
+ }
39403
+ /**
39404
+ * Stop tunnel for a device
39405
+ */
39406
+ stopTunnel() {
39407
+ const tunnelProcess = this.tunnelProcess;
39408
+ if (tunnelProcess && !tunnelProcess.killed) {
39409
+ logInfo7(`Stopping tunnel for device ${this.deviceId}`);
39410
+ tunnelProcess.kill();
39411
+ this.tunnelProcess = null;
39412
+ }
39413
+ }
39345
39414
  static setResourcesDir(dir) {
39346
39415
  setResourcesDir(dir);
39347
39416
  }
@@ -39522,6 +39591,90 @@ var AppleDeviceKit = class {
39522
39591
  this.ensureNotDisposed();
39523
39592
  return this.activationFlow.run(void 0, signal, config);
39524
39593
  }
39594
+ /**
39595
+ * Push a file to the device using fsync
39596
+ */
39597
+ async pushFile(bundleId, fileName, fileData) {
39598
+ const requiresTunnel = await this.requiresTunneling();
39599
+ if (requiresTunnel) {
39600
+ await this.ensureTunnel();
39601
+ }
39602
+ const tmpDir = join5(process.cwd(), "tmp");
39603
+ const tmpFilePath = join5(tmpDir, fileName);
39604
+ try {
39605
+ await mkdir(tmpDir, { recursive: true });
39606
+ await writeFile2(tmpFilePath, fileData);
39607
+ const stats = await stat(tmpFilePath);
39608
+ logDetail3(`Temp file written: ${tmpFilePath}, size: ${stats.size} bytes`);
39609
+ if (stats.size !== fileData.length) {
39610
+ throw new Error(
39611
+ `File size mismatch: expected ${fileData.length} bytes, got ${stats.size} bytes`
39612
+ );
39613
+ }
39614
+ const devicePath = `Documents/${fileName}`;
39615
+ const pushResult = await this.iosClient.fsyncPush({
39616
+ app: bundleId,
39617
+ srcPath: tmpFilePath,
39618
+ dstPath: devicePath
39619
+ });
39620
+ logDetail3(`Push: ${JSON.stringify(pushResult)}`);
39621
+ if (pushResult.exitCode !== 0) {
39622
+ const errorMessages = pushResult.logMessages.filter((msg) => msg.level === "error").map((msg) => msg.msg).join("; ");
39623
+ const allMessages = pushResult.logMessages.map((msg) => `${msg.level}: ${msg.msg}`).join("; ");
39624
+ throw new Error(
39625
+ `fsync push failed (exit code ${pushResult.exitCode}): ${errorMessages || allMessages || "Unknown error"}`
39626
+ );
39627
+ }
39628
+ logInfo7(`File ${fileName} pushed to device ${this.deviceId}`);
39629
+ } finally {
39630
+ if (requiresTunnel) {
39631
+ this.stopTunnel();
39632
+ }
39633
+ try {
39634
+ unlinkSync(tmpFilePath);
39635
+ } catch (_error) {
39636
+ }
39637
+ }
39638
+ }
39639
+ /**
39640
+ * Pull a file from the device using fsync
39641
+ */
39642
+ async pullFile(bundleId, fileName) {
39643
+ const requiresTunnel = await this.requiresTunneling();
39644
+ if (requiresTunnel) {
39645
+ await this.ensureTunnel();
39646
+ }
39647
+ const tmpDir = join5(process.cwd(), "tmp");
39648
+ const tmpFilePath = join5(tmpDir, fileName);
39649
+ try {
39650
+ await mkdir(tmpDir, { recursive: true });
39651
+ const devicePath = `Documents/${fileName}`;
39652
+ const pullResult = await this.iosClient.fsyncPull({
39653
+ app: bundleId,
39654
+ srcPath: devicePath,
39655
+ dstPath: tmpDir
39656
+ });
39657
+ logDetail3(`Pull: ${JSON.stringify(pullResult)}`);
39658
+ if (pullResult.exitCode !== 0) {
39659
+ const errorMessages = pullResult.logMessages.filter((msg) => msg.level === "error").map((msg) => msg.msg).join("; ");
39660
+ const allMessages = pullResult.logMessages.map((msg) => `${msg.level}: ${msg.msg}`).join("; ");
39661
+ throw new Error(
39662
+ `fsync pull failed (exit code ${pullResult.exitCode}): ${errorMessages || allMessages || "Unknown error"}`
39663
+ );
39664
+ }
39665
+ const fileData = readFileSync(tmpFilePath);
39666
+ logInfo7(`File ${fileName} pulled from device ${this.deviceId}`);
39667
+ return fileData;
39668
+ } finally {
39669
+ if (requiresTunnel) {
39670
+ this.stopTunnel();
39671
+ }
39672
+ try {
39673
+ unlinkSync(tmpFilePath);
39674
+ } catch (_error) {
39675
+ }
39676
+ }
39677
+ }
39525
39678
  /**
39526
39679
  * Get the device UDID
39527
39680
  */
@@ -39565,7 +39718,7 @@ var AppleDeviceKit = class {
39565
39718
  }
39566
39719
  logInfo7(`Disposing AppleDeviceKit for device: ${this.deviceId}`);
39567
39720
  this.closePortForward();
39568
- this.tunnelProcess?.kill();
39721
+ this.stopTunnel();
39569
39722
  this.isDisposed = true;
39570
39723
  }
39571
39724
  /**