@mcesystems/apple-kit 1.0.48 → 1.0.50

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
@@ -15027,19 +15027,19 @@ var require_printer = __commonJS({
15027
15027
  },
15028
15028
  // Document
15029
15029
  Document: function Document(node) {
15030
- return join8(node.definitions, "\n\n") + "\n";
15030
+ return join10(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("(", join8(node.variableDefinitions, ", "), ")");
15036
- var directives = join8(node.directives, " ");
15035
+ var varDefs = wrap("(", join10(node.variableDefinitions, ", "), ")");
15036
+ var directives = join10(node.directives, " ");
15037
15037
  var selectionSet = node.selectionSet;
15038
- return !name && !directives && !varDefs && op === "query" ? selectionSet : join8([op, join8([name, varDefs]), directives, selectionSet], " ");
15038
+ return !name && !directives && !varDefs && op === "query" ? selectionSet : join10([op, join10([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(" ", join8(directives, " "));
15042
+ return variable + ": " + type + wrap(" = ", defaultValue) + wrap(" ", join10(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 join8([wrap("", alias, ": ") + name + wrap("(", join8(args, ", "), ")"), join8(directives, " "), selectionSet], " ");
15050
+ return join10([wrap("", alias, ": ") + name + wrap("(", join10(args, ", "), ")"), join10(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(" ", join8(directives, " "));
15059
+ return "..." + name + wrap(" ", join10(directives, " "));
15060
15060
  },
15061
15061
  InlineFragment: function InlineFragment(_ref6) {
15062
15062
  var typeCondition = _ref6.typeCondition, directives = _ref6.directives, selectionSet = _ref6.selectionSet;
15063
- return join8(["...", wrap("on ", typeCondition), join8(directives, " "), selectionSet], " ");
15063
+ return join10(["...", wrap("on ", typeCondition), join10(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("(", join8(variableDefinitions, ", "), ")"), " ") + "on ".concat(typeCondition, " ").concat(wrap("", join8(directives, " "), " ")) + selectionSet
15070
+ "fragment ".concat(name).concat(wrap("(", join10(variableDefinitions, ", "), ")"), " ") + "on ".concat(typeCondition, " ").concat(wrap("", join10(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 "[" + join8(values, ", ") + "]";
15099
+ return "[" + join10(values, ", ") + "]";
15100
15100
  },
15101
15101
  ObjectValue: function ObjectValue(_ref14) {
15102
15102
  var fields = _ref14.fields;
15103
- return "{" + join8(fields, ", ") + "}";
15103
+ return "{" + join10(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("(", join8(args, ", "), ")");
15112
+ return "@" + name + wrap("(", join10(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 join8(["schema", join8(directives, " "), block(operationTypes)], " ");
15130
+ return join10(["schema", join10(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 join8(["scalar", name, join8(directives, " ")], " ");
15138
+ return join10(["scalar", name, join10(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 join8(["type", name, wrap("implements ", join8(interfaces, " & ")), join8(directives, " "), block(fields)], " ");
15142
+ return join10(["type", name, wrap("implements ", join10(interfaces, " & ")), join10(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(join8(args, "\n")), "\n)") : wrap("(", join8(args, ", "), ")")) + ": " + type + wrap(" ", join8(directives, " "));
15146
+ return name + (hasMultilineItems(args) ? wrap("(\n", indent(join10(args, "\n")), "\n)") : wrap("(", join10(args, ", "), ")")) + ": " + type + wrap(" ", join10(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 join8([name + ": " + type, wrap("= ", defaultValue), join8(directives, " ")], " ");
15150
+ return join10([name + ": " + type, wrap("= ", defaultValue), join10(directives, " ")], " ");
15151
15151
  }),
15152
15152
  InterfaceTypeDefinition: addDescription(function(_ref26) {
15153
15153
  var name = _ref26.name, directives = _ref26.directives, fields = _ref26.fields;
15154
- return join8(["interface", name, join8(directives, " "), block(fields)], " ");
15154
+ return join10(["interface", name, join10(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 join8(["union", name, join8(directives, " "), types && types.length !== 0 ? "= " + join8(types, " | ") : ""], " ");
15158
+ return join10(["union", name, join10(directives, " "), types && types.length !== 0 ? "= " + join10(types, " | ") : ""], " ");
15159
15159
  }),
15160
15160
  EnumTypeDefinition: addDescription(function(_ref28) {
15161
15161
  var name = _ref28.name, directives = _ref28.directives, values = _ref28.values;
15162
- return join8(["enum", name, join8(directives, " "), block(values)], " ");
15162
+ return join10(["enum", name, join10(directives, " "), block(values)], " ");
15163
15163
  }),
15164
15164
  EnumValueDefinition: addDescription(function(_ref29) {
15165
15165
  var name = _ref29.name, directives = _ref29.directives;
15166
- return join8([name, join8(directives, " ")], " ");
15166
+ return join10([name, join10(directives, " ")], " ");
15167
15167
  }),
15168
15168
  InputObjectTypeDefinition: addDescription(function(_ref30) {
15169
15169
  var name = _ref30.name, directives = _ref30.directives, fields = _ref30.fields;
15170
- return join8(["input", name, join8(directives, " "), block(fields)], " ");
15170
+ return join10(["input", name, join10(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(join8(args, "\n")), "\n)") : wrap("(", join8(args, ", "), ")")) + (repeatable ? " repeatable" : "") + " on " + join8(locations, " | ");
15174
+ return "directive @" + name + (hasMultilineItems(args) ? wrap("(\n", indent(join10(args, "\n")), "\n)") : wrap("(", join10(args, ", "), ")")) + (repeatable ? " repeatable" : "") + " on " + join10(locations, " | ");
15175
15175
  }),
15176
15176
  SchemaExtension: function SchemaExtension(_ref32) {
15177
15177
  var directives = _ref32.directives, operationTypes = _ref32.operationTypes;
15178
- return join8(["extend schema", join8(directives, " "), block(operationTypes)], " ");
15178
+ return join10(["extend schema", join10(directives, " "), block(operationTypes)], " ");
15179
15179
  },
15180
15180
  ScalarTypeExtension: function ScalarTypeExtension(_ref33) {
15181
15181
  var name = _ref33.name, directives = _ref33.directives;
15182
- return join8(["extend scalar", name, join8(directives, " ")], " ");
15182
+ return join10(["extend scalar", name, join10(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 join8(["extend type", name, wrap("implements ", join8(interfaces, " & ")), join8(directives, " "), block(fields)], " ");
15186
+ return join10(["extend type", name, wrap("implements ", join10(interfaces, " & ")), join10(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 join8(["extend interface", name, join8(directives, " "), block(fields)], " ");
15190
+ return join10(["extend interface", name, join10(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 join8(["extend union", name, join8(directives, " "), types && types.length !== 0 ? "= " + join8(types, " | ") : ""], " ");
15194
+ return join10(["extend union", name, join10(directives, " "), types && types.length !== 0 ? "= " + join10(types, " | ") : ""], " ");
15195
15195
  },
15196
15196
  EnumTypeExtension: function EnumTypeExtension(_ref37) {
15197
15197
  var name = _ref37.name, directives = _ref37.directives, values = _ref37.values;
15198
- return join8(["extend enum", name, join8(directives, " "), block(values)], " ");
15198
+ return join10(["extend enum", name, join10(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 join8(["extend input", name, join8(directives, " "), block(fields)], " ");
15202
+ return join10(["extend input", name, join10(directives, " "), block(fields)], " ");
15203
15203
  }
15204
15204
  };
15205
15205
  function addDescription(cb) {
15206
15206
  return function(node) {
15207
- return join8([node.description, cb(node)], "\n");
15207
+ return join10([node.description, cb(node)], "\n");
15208
15208
  };
15209
15209
  }
15210
- function join8(maybeArray, separator) {
15210
+ function join10(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(join8(array, "\n")) + "\n}" : "";
15216
+ return array && array.length !== 0 ? "{\n" + indent(join10(array, "\n")) + "\n}" : "";
15217
15217
  }
15218
15218
  function wrap(start, maybeString, end) {
15219
15219
  return maybeString ? start + maybeString + (end || "") : "";
@@ -15370,9 +15370,9 @@ var require_iterall = __commonJS({
15370
15370
  };
15371
15371
  function unwrapAsyncFromSync(iterator, fn, value) {
15372
15372
  var step;
15373
- return new Promise(function(resolve) {
15373
+ return new Promise(function(resolve5) {
15374
15374
  step = iterator[fn](value);
15375
- resolve(step.value);
15375
+ resolve5(step.value);
15376
15376
  }).then(function(value2) {
15377
15377
  return { value: value2, done: step.done };
15378
15378
  });
@@ -15381,13 +15381,13 @@ var require_iterall = __commonJS({
15381
15381
  var asyncIterator = createAsyncIterator(source);
15382
15382
  if (asyncIterator) {
15383
15383
  var i = 0;
15384
- return new Promise(function(resolve, reject) {
15384
+ return new Promise(function(resolve5, reject) {
15385
15385
  function next() {
15386
15386
  asyncIterator.next().then(function(step) {
15387
15387
  if (!step.done) {
15388
15388
  Promise.resolve(callback.call(thisArg, step.value, i++, source)).then(next).catch(reject);
15389
15389
  } else {
15390
- resolve();
15390
+ resolve5();
15391
15391
  }
15392
15392
  return null;
15393
15393
  }).catch(reject);
@@ -15567,35 +15567,35 @@ var require_introspection = __commonJS({
15567
15567
  types: {
15568
15568
  description: "A list of all types supported by this server.",
15569
15569
  type: (0, _definition.GraphQLNonNull)((0, _definition.GraphQLList)((0, _definition.GraphQLNonNull)(__Type))),
15570
- resolve: function resolve(schema) {
15570
+ resolve: function resolve5(schema) {
15571
15571
  return (0, _objectValues.default)(schema.getTypeMap());
15572
15572
  }
15573
15573
  },
15574
15574
  queryType: {
15575
15575
  description: "The type that query operations will be rooted at.",
15576
15576
  type: (0, _definition.GraphQLNonNull)(__Type),
15577
- resolve: function resolve(schema) {
15577
+ resolve: function resolve5(schema) {
15578
15578
  return schema.getQueryType();
15579
15579
  }
15580
15580
  },
15581
15581
  mutationType: {
15582
15582
  description: "If this server supports mutation, the type that mutation operations will be rooted at.",
15583
15583
  type: __Type,
15584
- resolve: function resolve(schema) {
15584
+ resolve: function resolve5(schema) {
15585
15585
  return schema.getMutationType();
15586
15586
  }
15587
15587
  },
15588
15588
  subscriptionType: {
15589
15589
  description: "If this server support subscription, the type that subscription operations will be rooted at.",
15590
15590
  type: __Type,
15591
- resolve: function resolve(schema) {
15591
+ resolve: function resolve5(schema) {
15592
15592
  return schema.getSubscriptionType();
15593
15593
  }
15594
15594
  },
15595
15595
  directives: {
15596
15596
  description: "A list of all directives supported by this server.",
15597
15597
  type: (0, _definition.GraphQLNonNull)((0, _definition.GraphQLList)((0, _definition.GraphQLNonNull)(__Directive))),
15598
- resolve: function resolve(schema) {
15598
+ resolve: function resolve5(schema) {
15599
15599
  return schema.getDirectives();
15600
15600
  }
15601
15601
  }
@@ -15610,25 +15610,25 @@ var require_introspection = __commonJS({
15610
15610
  return {
15611
15611
  name: {
15612
15612
  type: (0, _definition.GraphQLNonNull)(_scalars.GraphQLString),
15613
- resolve: function resolve(obj) {
15613
+ resolve: function resolve5(obj) {
15614
15614
  return obj.name;
15615
15615
  }
15616
15616
  },
15617
15617
  description: {
15618
15618
  type: _scalars.GraphQLString,
15619
- resolve: function resolve(obj) {
15619
+ resolve: function resolve5(obj) {
15620
15620
  return obj.description;
15621
15621
  }
15622
15622
  },
15623
15623
  locations: {
15624
15624
  type: (0, _definition.GraphQLNonNull)((0, _definition.GraphQLList)((0, _definition.GraphQLNonNull)(__DirectiveLocation))),
15625
- resolve: function resolve(obj) {
15625
+ resolve: function resolve5(obj) {
15626
15626
  return obj.locations;
15627
15627
  }
15628
15628
  },
15629
15629
  args: {
15630
15630
  type: (0, _definition.GraphQLNonNull)((0, _definition.GraphQLList)((0, _definition.GraphQLNonNull)(__InputValue))),
15631
- resolve: function resolve(directive) {
15631
+ resolve: function resolve5(directive) {
15632
15632
  return directive.args;
15633
15633
  }
15634
15634
  }
@@ -15726,7 +15726,7 @@ var require_introspection = __commonJS({
15726
15726
  return {
15727
15727
  kind: {
15728
15728
  type: (0, _definition.GraphQLNonNull)(__TypeKind),
15729
- resolve: function resolve(type) {
15729
+ resolve: function resolve5(type) {
15730
15730
  if ((0, _definition.isScalarType)(type)) {
15731
15731
  return TypeKind.SCALAR;
15732
15732
  } else if ((0, _definition.isObjectType)(type)) {
@@ -15749,13 +15749,13 @@ var require_introspection = __commonJS({
15749
15749
  },
15750
15750
  name: {
15751
15751
  type: _scalars.GraphQLString,
15752
- resolve: function resolve(obj) {
15752
+ resolve: function resolve5(obj) {
15753
15753
  return obj.name !== void 0 ? obj.name : void 0;
15754
15754
  }
15755
15755
  },
15756
15756
  description: {
15757
15757
  type: _scalars.GraphQLString,
15758
- resolve: function resolve(obj) {
15758
+ resolve: function resolve5(obj) {
15759
15759
  return obj.description !== void 0 ? obj.description : void 0;
15760
15760
  }
15761
15761
  },
@@ -15767,7 +15767,7 @@ var require_introspection = __commonJS({
15767
15767
  defaultValue: false
15768
15768
  }
15769
15769
  },
15770
- resolve: function resolve(type, _ref) {
15770
+ resolve: function resolve5(type, _ref) {
15771
15771
  var includeDeprecated = _ref.includeDeprecated;
15772
15772
  if ((0, _definition.isObjectType)(type) || (0, _definition.isInterfaceType)(type)) {
15773
15773
  var fields2 = (0, _objectValues.default)(type.getFields());
@@ -15783,7 +15783,7 @@ var require_introspection = __commonJS({
15783
15783
  },
15784
15784
  interfaces: {
15785
15785
  type: (0, _definition.GraphQLList)((0, _definition.GraphQLNonNull)(__Type)),
15786
- resolve: function resolve(type) {
15786
+ resolve: function resolve5(type) {
15787
15787
  if ((0, _definition.isObjectType)(type)) {
15788
15788
  return type.getInterfaces();
15789
15789
  }
@@ -15791,7 +15791,7 @@ var require_introspection = __commonJS({
15791
15791
  },
15792
15792
  possibleTypes: {
15793
15793
  type: (0, _definition.GraphQLList)((0, _definition.GraphQLNonNull)(__Type)),
15794
- resolve: function resolve(type, args, context, _ref2) {
15794
+ resolve: function resolve5(type, args, context, _ref2) {
15795
15795
  var schema = _ref2.schema;
15796
15796
  if ((0, _definition.isAbstractType)(type)) {
15797
15797
  return schema.getPossibleTypes(type);
@@ -15806,7 +15806,7 @@ var require_introspection = __commonJS({
15806
15806
  defaultValue: false
15807
15807
  }
15808
15808
  },
15809
- resolve: function resolve(type, _ref3) {
15809
+ resolve: function resolve5(type, _ref3) {
15810
15810
  var includeDeprecated = _ref3.includeDeprecated;
15811
15811
  if ((0, _definition.isEnumType)(type)) {
15812
15812
  var values = type.getValues();
@@ -15821,7 +15821,7 @@ var require_introspection = __commonJS({
15821
15821
  },
15822
15822
  inputFields: {
15823
15823
  type: (0, _definition.GraphQLList)((0, _definition.GraphQLNonNull)(__InputValue)),
15824
- resolve: function resolve(type) {
15824
+ resolve: function resolve5(type) {
15825
15825
  if ((0, _definition.isInputObjectType)(type)) {
15826
15826
  return (0, _objectValues.default)(type.getFields());
15827
15827
  }
@@ -15829,7 +15829,7 @@ var require_introspection = __commonJS({
15829
15829
  },
15830
15830
  ofType: {
15831
15831
  type: __Type,
15832
- resolve: function resolve(obj) {
15832
+ resolve: function resolve5(obj) {
15833
15833
  return obj.ofType !== void 0 ? obj.ofType : void 0;
15834
15834
  }
15835
15835
  }
@@ -15844,37 +15844,37 @@ var require_introspection = __commonJS({
15844
15844
  return {
15845
15845
  name: {
15846
15846
  type: (0, _definition.GraphQLNonNull)(_scalars.GraphQLString),
15847
- resolve: function resolve(obj) {
15847
+ resolve: function resolve5(obj) {
15848
15848
  return obj.name;
15849
15849
  }
15850
15850
  },
15851
15851
  description: {
15852
15852
  type: _scalars.GraphQLString,
15853
- resolve: function resolve(obj) {
15853
+ resolve: function resolve5(obj) {
15854
15854
  return obj.description;
15855
15855
  }
15856
15856
  },
15857
15857
  args: {
15858
15858
  type: (0, _definition.GraphQLNonNull)((0, _definition.GraphQLList)((0, _definition.GraphQLNonNull)(__InputValue))),
15859
- resolve: function resolve(field) {
15859
+ resolve: function resolve5(field) {
15860
15860
  return field.args;
15861
15861
  }
15862
15862
  },
15863
15863
  type: {
15864
15864
  type: (0, _definition.GraphQLNonNull)(__Type),
15865
- resolve: function resolve(obj) {
15865
+ resolve: function resolve5(obj) {
15866
15866
  return obj.type;
15867
15867
  }
15868
15868
  },
15869
15869
  isDeprecated: {
15870
15870
  type: (0, _definition.GraphQLNonNull)(_scalars.GraphQLBoolean),
15871
- resolve: function resolve(obj) {
15871
+ resolve: function resolve5(obj) {
15872
15872
  return obj.isDeprecated;
15873
15873
  }
15874
15874
  },
15875
15875
  deprecationReason: {
15876
15876
  type: _scalars.GraphQLString,
15877
- resolve: function resolve(obj) {
15877
+ resolve: function resolve5(obj) {
15878
15878
  return obj.deprecationReason;
15879
15879
  }
15880
15880
  }
@@ -15889,26 +15889,26 @@ var require_introspection = __commonJS({
15889
15889
  return {
15890
15890
  name: {
15891
15891
  type: (0, _definition.GraphQLNonNull)(_scalars.GraphQLString),
15892
- resolve: function resolve(obj) {
15892
+ resolve: function resolve5(obj) {
15893
15893
  return obj.name;
15894
15894
  }
15895
15895
  },
15896
15896
  description: {
15897
15897
  type: _scalars.GraphQLString,
15898
- resolve: function resolve(obj) {
15898
+ resolve: function resolve5(obj) {
15899
15899
  return obj.description;
15900
15900
  }
15901
15901
  },
15902
15902
  type: {
15903
15903
  type: (0, _definition.GraphQLNonNull)(__Type),
15904
- resolve: function resolve(obj) {
15904
+ resolve: function resolve5(obj) {
15905
15905
  return obj.type;
15906
15906
  }
15907
15907
  },
15908
15908
  defaultValue: {
15909
15909
  type: _scalars.GraphQLString,
15910
15910
  description: "A GraphQL-formatted string representing the default value for this input value.",
15911
- resolve: function resolve(inputVal) {
15911
+ resolve: function resolve5(inputVal) {
15912
15912
  var valueAST = (0, _astFromValue.astFromValue)(inputVal.defaultValue, inputVal.type);
15913
15913
  return valueAST ? (0, _printer.print)(valueAST) : null;
15914
15914
  }
@@ -15924,25 +15924,25 @@ var require_introspection = __commonJS({
15924
15924
  return {
15925
15925
  name: {
15926
15926
  type: (0, _definition.GraphQLNonNull)(_scalars.GraphQLString),
15927
- resolve: function resolve(obj) {
15927
+ resolve: function resolve5(obj) {
15928
15928
  return obj.name;
15929
15929
  }
15930
15930
  },
15931
15931
  description: {
15932
15932
  type: _scalars.GraphQLString,
15933
- resolve: function resolve(obj) {
15933
+ resolve: function resolve5(obj) {
15934
15934
  return obj.description;
15935
15935
  }
15936
15936
  },
15937
15937
  isDeprecated: {
15938
15938
  type: (0, _definition.GraphQLNonNull)(_scalars.GraphQLBoolean),
15939
- resolve: function resolve(obj) {
15939
+ resolve: function resolve5(obj) {
15940
15940
  return obj.isDeprecated;
15941
15941
  }
15942
15942
  },
15943
15943
  deprecationReason: {
15944
15944
  type: _scalars.GraphQLString,
15945
- resolve: function resolve(obj) {
15945
+ resolve: function resolve5(obj) {
15946
15946
  return obj.deprecationReason;
15947
15947
  }
15948
15948
  }
@@ -16005,7 +16005,7 @@ var require_introspection = __commonJS({
16005
16005
  type: (0, _definition.GraphQLNonNull)(__Schema),
16006
16006
  description: "Access the current type schema of this server.",
16007
16007
  args: [],
16008
- resolve: function resolve(source, args, context, _ref4) {
16008
+ resolve: function resolve5(source, args, context, _ref4) {
16009
16009
  var schema = _ref4.schema;
16010
16010
  return schema;
16011
16011
  },
@@ -16026,7 +16026,7 @@ var require_introspection = __commonJS({
16026
16026
  extensions: void 0,
16027
16027
  astNode: void 0
16028
16028
  }],
16029
- resolve: function resolve(source, _ref5, context, _ref6) {
16029
+ resolve: function resolve5(source, _ref5, context, _ref6) {
16030
16030
  var name = _ref5.name;
16031
16031
  var schema = _ref6.schema;
16032
16032
  return schema.getType(name);
@@ -16041,7 +16041,7 @@ var require_introspection = __commonJS({
16041
16041
  type: (0, _definition.GraphQLNonNull)(_scalars.GraphQLString),
16042
16042
  description: "The name of the current Object type at runtime.",
16043
16043
  args: [],
16044
- resolve: function resolve(source, args, context, _ref7) {
16044
+ resolve: function resolve5(source, args, context, _ref7) {
16045
16045
  var parentType = _ref7.parentType;
16046
16046
  return parentType.name;
16047
16047
  },
@@ -20545,8 +20545,8 @@ var require_graphql = __commonJS({
20545
20545
  }
20546
20546
  function graphql(argsOrSchema, source, rootValue, contextValue, variableValues, operationName, fieldResolver, typeResolver) {
20547
20547
  var _arguments = arguments;
20548
- return new Promise(function(resolve) {
20549
- return resolve(
20548
+ return new Promise(function(resolve5) {
20549
+ return resolve5(
20550
20550
  // Extract arguments from object args if provided.
20551
20551
  _arguments.length === 1 ? graphqlImpl(argsOrSchema) : graphqlImpl({
20552
20552
  schema: argsOrSchema,
@@ -21396,8 +21396,8 @@ var require_mapAsyncIterator = __commonJS({
21396
21396
  });
21397
21397
  }
21398
21398
  function asyncMapValue(value, callback) {
21399
- return new Promise(function(resolve) {
21400
- return resolve(callback(value));
21399
+ return new Promise(function(resolve5) {
21400
+ return resolve5(callback(value));
21401
21401
  });
21402
21402
  }
21403
21403
  function iteratorResult(value) {
@@ -31146,7 +31146,7 @@ var require_lib3 = __commonJS({
31146
31146
  let accum = [];
31147
31147
  let accumBytes = 0;
31148
31148
  let abort = false;
31149
- return new Body.Promise(function(resolve, reject) {
31149
+ return new Body.Promise(function(resolve5, reject) {
31150
31150
  let resTimeout;
31151
31151
  if (_this4.timeout) {
31152
31152
  resTimeout = setTimeout(function() {
@@ -31180,7 +31180,7 @@ var require_lib3 = __commonJS({
31180
31180
  }
31181
31181
  clearTimeout(resTimeout);
31182
31182
  try {
31183
- resolve(Buffer.concat(accum, accumBytes));
31183
+ resolve5(Buffer.concat(accum, accumBytes));
31184
31184
  } catch (err) {
31185
31185
  reject(new FetchError(`Could not create Buffer from response body for ${_this4.url}: ${err.message}`, "system", err));
31186
31186
  }
@@ -31855,7 +31855,7 @@ var require_lib3 = __commonJS({
31855
31855
  throw new Error("native promise missing, set fetch.Promise to your favorite alternative");
31856
31856
  }
31857
31857
  Body.Promise = fetch2.Promise;
31858
- return new fetch2.Promise(function(resolve, reject) {
31858
+ return new fetch2.Promise(function(resolve5, reject) {
31859
31859
  const request = new Request(url, opts);
31860
31860
  const options = getNodeRequestOptions(request);
31861
31861
  const send = (options.protocol === "https:" ? https : http).request;
@@ -31988,7 +31988,7 @@ var require_lib3 = __commonJS({
31988
31988
  requestOpts.body = void 0;
31989
31989
  requestOpts.headers.delete("content-length");
31990
31990
  }
31991
- resolve(fetch2(new Request(locationURL, requestOpts)));
31991
+ resolve5(fetch2(new Request(locationURL, requestOpts)));
31992
31992
  finalize();
31993
31993
  return;
31994
31994
  }
@@ -32009,7 +32009,7 @@ var require_lib3 = __commonJS({
32009
32009
  const codings = headers.get("Content-Encoding");
32010
32010
  if (!request.compress || request.method === "HEAD" || codings === null || res.statusCode === 204 || res.statusCode === 304) {
32011
32011
  response = new Response(body, response_options);
32012
- resolve(response);
32012
+ resolve5(response);
32013
32013
  return;
32014
32014
  }
32015
32015
  const zlibOptions = {
@@ -32019,7 +32019,7 @@ var require_lib3 = __commonJS({
32019
32019
  if (codings == "gzip" || codings == "x-gzip") {
32020
32020
  body = body.pipe(zlib.createGunzip(zlibOptions));
32021
32021
  response = new Response(body, response_options);
32022
- resolve(response);
32022
+ resolve5(response);
32023
32023
  return;
32024
32024
  }
32025
32025
  if (codings == "deflate" || codings == "x-deflate") {
@@ -32031,12 +32031,12 @@ var require_lib3 = __commonJS({
32031
32031
  body = body.pipe(zlib.createInflateRaw());
32032
32032
  }
32033
32033
  response = new Response(body, response_options);
32034
- resolve(response);
32034
+ resolve5(response);
32035
32035
  });
32036
32036
  raw.on("end", function() {
32037
32037
  if (!response) {
32038
32038
  response = new Response(body, response_options);
32039
- resolve(response);
32039
+ resolve5(response);
32040
32040
  }
32041
32041
  });
32042
32042
  return;
@@ -32044,11 +32044,11 @@ var require_lib3 = __commonJS({
32044
32044
  if (codings == "br" && typeof zlib.createBrotliDecompress === "function") {
32045
32045
  body = body.pipe(zlib.createBrotliDecompress());
32046
32046
  response = new Response(body, response_options);
32047
- resolve(response);
32047
+ resolve5(response);
32048
32048
  return;
32049
32049
  }
32050
32050
  response = new Response(body, response_options);
32051
- resolve(response);
32051
+ resolve5(response);
32052
32052
  });
32053
32053
  writeToStream(req, request);
32054
32054
  });
@@ -32142,14 +32142,14 @@ var getLocalHosts = () => {
32142
32142
  }
32143
32143
  return results;
32144
32144
  };
32145
- var checkAvailablePort = (options) => new Promise((resolve, reject) => {
32145
+ var checkAvailablePort = (options) => new Promise((resolve5, reject) => {
32146
32146
  const server = net.createServer();
32147
32147
  server.unref();
32148
32148
  server.on("error", reject);
32149
32149
  server.listen(options, () => {
32150
32150
  const { port } = server.address();
32151
32151
  server.close(() => {
32152
- resolve(port);
32152
+ resolve5(port);
32153
32153
  });
32154
32154
  });
32155
32155
  });
@@ -32274,7 +32274,7 @@ import { promisify } from "node:util";
32274
32274
 
32275
32275
  // src/logic/utils/resolvePath.ts
32276
32276
  import { existsSync } from "node:fs";
32277
- import { dirname, isAbsolute, join } from "node:path";
32277
+ import { dirname, isAbsolute, join, resolve } from "node:path";
32278
32278
  function getModuleDir() {
32279
32279
  if (typeof import.meta !== "undefined" && import.meta.url) {
32280
32280
  const { fileURLToPath: fileURLToPath3 } = __require("node:url");
@@ -32295,7 +32295,14 @@ function getPlatformDir() {
32295
32295
  }
32296
32296
  return platform;
32297
32297
  }
32298
- function getResourcesBinPath() {
32298
+ function getResourcesBinPath(options) {
32299
+ if (options?.resourcesDir) {
32300
+ const platformDir = getPlatformDir();
32301
+ const candidate = join(resolve(options.resourcesDir), "bin", platformDir);
32302
+ if (existsSync(candidate)) {
32303
+ return candidate;
32304
+ }
32305
+ }
32299
32306
  const envBinPath = process.env.IDeviceBinPath;
32300
32307
  if (envBinPath) {
32301
32308
  if (isAbsolute(envBinPath)) {
@@ -32468,6 +32475,9 @@ async function getDeviceInfo(udid) {
32468
32475
  };
32469
32476
  }
32470
32477
 
32478
+ // src/utils/mdmClient.ts
32479
+ import { join as join4, resolve as resolve2 } from "node:path";
32480
+
32471
32481
  // ../../node_modules/.pnpm/graphql-request@5.2.0_encoding@0.1.13_graphql@14.7.0/node_modules/graphql-request/build/esm/defaultJsonSerializer.js
32472
32482
  var defaultJsonSerializer = {
32473
32483
  parse: JSON.parse,
@@ -32720,22 +32730,22 @@ var GraphQLWebSocketClient = class {
32720
32730
  };
32721
32731
  }
32722
32732
  rawRequest(query, variables) {
32723
- return new Promise((resolve, reject) => {
32733
+ return new Promise((resolve5, reject) => {
32724
32734
  let result;
32725
32735
  this.rawSubscribe(query, {
32726
32736
  next: (data, extensions) => result = { data, extensions },
32727
32737
  error: reject,
32728
- complete: () => resolve(result)
32738
+ complete: () => resolve5(result)
32729
32739
  }, variables);
32730
32740
  });
32731
32741
  }
32732
32742
  request(document2, variables) {
32733
- return new Promise((resolve, reject) => {
32743
+ return new Promise((resolve5, reject) => {
32734
32744
  let result;
32735
32745
  this.subscribe(document2, {
32736
32746
  next: (data) => result = data,
32737
32747
  error: reject,
32738
- complete: () => resolve(result)
32748
+ complete: () => resolve5(result)
32739
32749
  }, variables);
32740
32750
  });
32741
32751
  }
@@ -33239,9 +33249,9 @@ function createMdmClient(config) {
33239
33249
  }
33240
33250
  };
33241
33251
  }
33242
- async function createMdmClientFromEnv() {
33252
+ async function createMdmClientFromEnv(options) {
33243
33253
  const endpoint = process.env.MDM_ENDPOINT;
33244
- const credPath = process.env.MDM_CRED_PATH ?? process.env.APP_CRED_PATH;
33254
+ const credPath = resolveCredentialsPath(options);
33245
33255
  if (!endpoint || !credPath) {
33246
33256
  return void 0;
33247
33257
  }
@@ -33253,6 +33263,15 @@ async function createMdmClientFromEnv() {
33253
33263
  timeout: 6e4
33254
33264
  });
33255
33265
  }
33266
+ function resolveCredentialsPath(options) {
33267
+ if (options?.credentialsPath) {
33268
+ return resolve2(options.credentialsPath);
33269
+ }
33270
+ if (options?.resourcesDir) {
33271
+ return join4(resolve2(options.resourcesDir), "@clientLocal.json");
33272
+ }
33273
+ return process.env.MDM_CRED_PATH ?? process.env.APP_CRED_PATH;
33274
+ }
33256
33275
 
33257
33276
  // src/logic/actions/pair.ts
33258
33277
  async function isPaired(udid) {
@@ -33302,7 +33321,7 @@ async function waitForPairing(udid, timeout2 = 12e4, pollInterval = 1e3) {
33302
33321
  logInfo(`Device ${udid} is now paired`);
33303
33322
  return true;
33304
33323
  }
33305
- await new Promise((resolve) => setTimeout(resolve, pollInterval));
33324
+ await new Promise((resolve5) => setTimeout(resolve5, pollInterval));
33306
33325
  }
33307
33326
  throw new Error(`Timeout waiting for device pairing after ${timeout2}ms`);
33308
33327
  }
@@ -33390,7 +33409,7 @@ async function wakeDevice(udid) {
33390
33409
  await runIDeviceTool("idevicepair", ["-u", udid, "validate"]);
33391
33410
  } catch {
33392
33411
  }
33393
- await new Promise((resolve) => setTimeout(resolve, 1e3));
33412
+ await new Promise((resolve5) => setTimeout(resolve5, 1e3));
33394
33413
  logInfo("Device wake attempt completed");
33395
33414
  } catch (error) {
33396
33415
  logInfo(
@@ -33422,7 +33441,7 @@ async function launchApp(bundleId, args, udid) {
33422
33441
  throw new Error("debugserver_not_available");
33423
33442
  }
33424
33443
  logInfo(`App ${bundleId} launched successfully using idevicedebug`);
33425
- await new Promise((resolve) => setTimeout(resolve, 1e3));
33444
+ await new Promise((resolve5) => setTimeout(resolve5, 1e3));
33426
33445
  return;
33427
33446
  } catch (error) {
33428
33447
  const errorMsg = error instanceof Error ? error.message : String(error);
@@ -33532,7 +33551,7 @@ async function launchAppWithPymobiledevice3(bundleId, args, udid) {
33532
33551
  );
33533
33552
  }
33534
33553
  logInfo(`App ${bundleId} launched successfully using pymobiledevice3 with tunnel`);
33535
- await new Promise((resolve) => setTimeout(resolve, 500));
33554
+ await new Promise((resolve5) => setTimeout(resolve5, 500));
33536
33555
  return;
33537
33556
  } catch {
33538
33557
  throw new Error(
@@ -33549,7 +33568,7 @@ async function launchAppWithPymobiledevice3(bundleId, args, udid) {
33549
33568
  logInfo(`Warning: pymobiledevice3 reported errors: ${output.substring(0, 300)}`);
33550
33569
  }
33551
33570
  logInfo(`App ${bundleId} launched successfully using pymobiledevice3`);
33552
- await new Promise((resolve) => setTimeout(resolve, 1e3));
33571
+ await new Promise((resolve5) => setTimeout(resolve5, 1e3));
33553
33572
  } catch (error) {
33554
33573
  const errorMsg = error instanceof Error ? error.message : String(error);
33555
33574
  if (errorMsg.includes("not found") || errorMsg.includes("command not found") || errorMsg.includes("cannot find") || errorMsg.includes("No module named")) {
@@ -33563,13 +33582,13 @@ async function launchAppWithPymobiledevice3(bundleId, args, udid) {
33563
33582
 
33564
33583
  // src/logic/actions/proxy.ts
33565
33584
  import { spawn } from "node:child_process";
33566
- import { join as join4 } from "node:path";
33585
+ import { join as join5 } from "node:path";
33567
33586
  function startPortForward(localPort, devicePort, udid, startupTimeout = 500) {
33568
- return new Promise((resolve, reject) => {
33587
+ return new Promise((resolve5, reject) => {
33569
33588
  logTask(`Starting port forward ${localPort} -> ${devicePort} for device ${udid}`);
33570
33589
  const binPath = getResourcesBinPath();
33571
33590
  const ext = process.platform === "win32" ? ".exe" : "";
33572
- const toolPath = binPath ? join4(binPath, `iproxy${ext}`) : `iproxy${ext}`;
33591
+ const toolPath = binPath ? join5(binPath, `iproxy${ext}`) : `iproxy${ext}`;
33573
33592
  const spawnOptions = {
33574
33593
  windowsHide: true,
33575
33594
  stdio: ["ignore", "pipe", "pipe"]
@@ -33618,7 +33637,7 @@ function startPortForward(localPort, devicePort, udid, startupTimeout = 500) {
33618
33637
  if (!hasResolved) {
33619
33638
  hasResolved = true;
33620
33639
  logTask(`Port forward started: ${localPort} -> ${devicePort} for device ${udid}`);
33621
- resolve({
33640
+ resolve5({
33622
33641
  result: {
33623
33642
  localPort,
33624
33643
  devicePort
@@ -33640,32 +33659,35 @@ function killPortForwardProcess(process2) {
33640
33659
  import { existsSync as existsSync4 } from "node:fs";
33641
33660
  import { mkdir, unlink, writeFile as writeFile2 } from "node:fs/promises";
33642
33661
  import { tmpdir as tmpdir2 } from "node:os";
33643
- import { dirname as dirname3, join as join7 } from "node:path";
33662
+ import { dirname as dirname3, join as join8, resolve as resolve4 } from "node:path";
33644
33663
  import { fileURLToPath as fileURLToPath2 } from "node:url";
33645
33664
 
33646
33665
  // src/utils/trustProfile.ts
33647
33666
  import { randomUUID } from "node:crypto";
33648
33667
  import { writeFile } from "node:fs/promises";
33649
33668
  import { tmpdir } from "node:os";
33650
- import { join as join6 } from "node:path";
33669
+ import { join as join7 } from "node:path";
33651
33670
 
33652
33671
  // src/utils/templateLoader.ts
33653
33672
  import { existsSync as existsSync3 } from "node:fs";
33654
33673
  import { readFile } from "node:fs/promises";
33655
- import { dirname as dirname2, isAbsolute as isAbsolute2, join as join5 } from "node:path";
33674
+ import { dirname as dirname2, isAbsolute as isAbsolute2, join as join6, resolve as resolve3 } from "node:path";
33656
33675
  import { fileURLToPath } from "node:url";
33657
33676
  function resolveEnvPlistDir() {
33658
33677
  const envPath = process.env.RESOURCES_PLIST_DIR || process.env.resourcesPlistDir;
33659
33678
  if (!envPath) {
33660
33679
  return null;
33661
33680
  }
33662
- const absolutePath = isAbsolute2(envPath) ? envPath : join5(process.cwd(), envPath);
33681
+ const absolutePath = isAbsolute2(envPath) ? envPath : join6(process.cwd(), envPath);
33663
33682
  if (existsSync3(absolutePath)) {
33664
33683
  return absolutePath;
33665
33684
  }
33666
33685
  return null;
33667
33686
  }
33668
- function getPlistDir() {
33687
+ function getPlistDir(overrideDir) {
33688
+ if (overrideDir) {
33689
+ return resolve3(overrideDir);
33690
+ }
33669
33691
  const envPlistDir = resolveEnvPlistDir();
33670
33692
  if (envPlistDir) {
33671
33693
  return envPlistDir;
@@ -33681,31 +33703,30 @@ function getPlistDir() {
33681
33703
  } catch {
33682
33704
  baseDir = process.cwd();
33683
33705
  }
33684
- const sourcePlistDir = join5(baseDir, "../plist");
33706
+ const sourcePlistDir = join6(baseDir, "../plist");
33685
33707
  if (existsSync3(sourcePlistDir)) {
33686
33708
  return sourcePlistDir;
33687
33709
  }
33688
- const distPlistDir = join5(baseDir, "../plist");
33710
+ const distPlistDir = join6(baseDir, "../plist");
33689
33711
  if (existsSync3(distPlistDir)) {
33690
33712
  return distPlistDir;
33691
33713
  }
33692
- const distPlistDir2 = join5(baseDir, "../dist/plist");
33714
+ const distPlistDir2 = join6(baseDir, "../dist/plist");
33693
33715
  if (existsSync3(distPlistDir2)) {
33694
33716
  return distPlistDir2;
33695
33717
  }
33696
- const srcPlistFallback = join5(process.cwd(), "src/plist");
33718
+ const srcPlistFallback = join6(process.cwd(), "src/plist");
33697
33719
  if (existsSync3(srcPlistFallback)) {
33698
33720
  return srcPlistFallback;
33699
33721
  }
33700
- const distPlistFallback = join5(process.cwd(), "dist/plist");
33722
+ const distPlistFallback = join6(process.cwd(), "dist/plist");
33701
33723
  if (existsSync3(distPlistFallback)) {
33702
33724
  return distPlistFallback;
33703
33725
  }
33704
- return join5(process.cwd(), "src/plist");
33726
+ return join6(process.cwd(), "src/plist");
33705
33727
  }
33706
- var PLIST_DIR = getPlistDir();
33707
- async function loadTemplate(templateName) {
33708
- const templatePath = join5(PLIST_DIR, templateName);
33728
+ async function loadTemplate(templateName, plistDir) {
33729
+ const templatePath = join6(getPlistDir(plistDir), templateName);
33709
33730
  const content = await readFile(templatePath, "utf-8");
33710
33731
  return content;
33711
33732
  }
@@ -33735,7 +33756,7 @@ function escapeXml(str) {
33735
33756
  }
33736
33757
 
33737
33758
  // src/utils/trustProfile.ts
33738
- async function generateTrustProfile(config) {
33759
+ async function generateTrustProfile(config, options) {
33739
33760
  const {
33740
33761
  organizationName,
33741
33762
  certificateBase64,
@@ -33750,7 +33771,7 @@ async function generateTrustProfile(config) {
33750
33771
  const payloadId = `${profileId}.cert`;
33751
33772
  logInfo(`Generating trust profile for: ${organizationName}`);
33752
33773
  const cleanCertBase64 = certificateBase64.replace(/-----BEGIN CERTIFICATE-----/g, "").replace(/-----END CERTIFICATE-----/g, "").replace(/\s/g, "");
33753
- const template = await loadTemplate("certificate-trust.xml");
33774
+ const template = await loadTemplate("certificate-trust.xml", options?.plistDir);
33754
33775
  const certificateFileName = `${orgShortName}_enterprise.cer`;
33755
33776
  const variables = {
33756
33777
  organizationName,
@@ -33767,21 +33788,24 @@ async function generateTrustProfile(config) {
33767
33788
  };
33768
33789
  return processTemplate(template, variables);
33769
33790
  }
33770
- async function generateTrustProfileFromEnv(organizationName) {
33791
+ async function generateTrustProfileFromEnv(organizationName, options) {
33771
33792
  const certBase64 = process.env.TRUST_CERT_BASE64;
33772
33793
  if (!certBase64) {
33773
33794
  logInfo("TRUST_CERT_BASE64 environment variable not set, skipping trust profile generation.");
33774
33795
  return void 0;
33775
33796
  }
33776
- return generateTrustProfile({
33777
- organizationName,
33778
- certificateBase64: certBase64
33779
- });
33797
+ return generateTrustProfile(
33798
+ {
33799
+ organizationName,
33800
+ certificateBase64: certBase64
33801
+ },
33802
+ options
33803
+ );
33780
33804
  }
33781
33805
 
33782
33806
  // src/utils/wifiProfile.ts
33783
33807
  import { randomUUID as randomUUID2 } from "node:crypto";
33784
- async function generateWifiProfile(config) {
33808
+ async function generateWifiProfile(config, options) {
33785
33809
  const {
33786
33810
  ssid,
33787
33811
  password,
@@ -33801,7 +33825,7 @@ async function generateWifiProfile(config) {
33801
33825
  const payloadId = `${profileId}.payload`;
33802
33826
  logInfo(`Generating WiFi profile for SSID: ${ssid}, encryption: ${encryptionType}`);
33803
33827
  const templateName = enterprise ? "wifi-enterprise.xml" : "wifi-standard.xml";
33804
- const template = await loadTemplate(templateName);
33828
+ const template = await loadTemplate(templateName, options?.plistDir);
33805
33829
  const variables = {
33806
33830
  ssid,
33807
33831
  password: password || "",
@@ -33835,7 +33859,7 @@ async function generateWifiProfile(config) {
33835
33859
  }
33836
33860
  return profile;
33837
33861
  }
33838
- async function generateWifiProfileFromEnv() {
33862
+ async function generateWifiProfileFromEnv(options) {
33839
33863
  const ssid = process.env.WIFI_SSID;
33840
33864
  if (!ssid) {
33841
33865
  logInfo("WIFI_SSID not set, skipping WiFi profile generation");
@@ -33851,7 +33875,7 @@ async function generateWifiProfileFromEnv() {
33851
33875
  eapType: parseWifiEapType(process.env.WIFI_EAP_TYPE)
33852
33876
  };
33853
33877
  logInfo(`Generating WiFi profile from env: SSID=${ssid}, enterprise=${config.enterprise}`);
33854
- return generateWifiProfile(config);
33878
+ return generateWifiProfile(config, options);
33855
33879
  }
33856
33880
  async function saveWifiProfileToTemp(profile) {
33857
33881
  const fs = await import("node:fs/promises");
@@ -33907,7 +33931,7 @@ function parseWifiEapType(value) {
33907
33931
  // src/logic/iosCli.ts
33908
33932
  import { spawn as spawn2 } from "node:child_process";
33909
33933
  function runIosCommand(iosBinaryPath, args) {
33910
- return new Promise((resolve, reject) => {
33934
+ return new Promise((resolve5, reject) => {
33911
33935
  const child = spawn2(iosBinaryPath, args, {
33912
33936
  windowsHide: true,
33913
33937
  stdio: ["ignore", "pipe", "pipe"]
@@ -33933,7 +33957,7 @@ function runIosCommand(iosBinaryPath, args) {
33933
33957
  msg: lineJson.msg,
33934
33958
  timestamp: lineJson.timestamp
33935
33959
  }));
33936
- resolve({
33960
+ resolve5({
33937
33961
  command: iosBinaryPath,
33938
33962
  args,
33939
33963
  output,
@@ -33997,10 +34021,16 @@ var ActivationFlow = class {
33997
34021
  iosCli;
33998
34022
  mdmClientPromise;
33999
34023
  organizationName;
34024
+ resourcesDir;
34000
34025
  constructor(config) {
34001
- this.iosCli = createIosCli(config.iosBinaryPath);
34002
- this.mdmClientPromise = createMdmClientFromEnv();
34026
+ const iosBinaryPath = resolveIosBinaryPath(config);
34027
+ if (!iosBinaryPath) {
34028
+ throw new Error("iosBinaryPath is required. Provide iosBinaryPath or resourcesDir.");
34029
+ }
34030
+ this.iosCli = createIosCli(iosBinaryPath);
34031
+ this.mdmClientPromise = createMdmClientFromEnv({ resourcesDir: config.resourcesDir });
34003
34032
  this.organizationName = config.organizationName ?? process.env.ORGANIZATION_NAME;
34033
+ this.resourcesDir = config.resourcesDir;
34004
34034
  }
34005
34035
  async run(udid) {
34006
34036
  logTask(`Starting activation flow for device ${udid}`);
@@ -34019,7 +34049,8 @@ var ActivationFlow = class {
34019
34049
  return "activated";
34020
34050
  }
34021
34051
  async installWifiProfile(udid) {
34022
- const wifiProfile = await generateWifiProfileFromEnv();
34052
+ const plistDir = this.resourcesDir ? resolveResourcesPlistDir(this.resourcesDir) : void 0;
34053
+ const wifiProfile = await generateWifiProfileFromEnv({ plistDir });
34023
34054
  if (!wifiProfile) {
34024
34055
  return;
34025
34056
  }
@@ -34039,6 +34070,15 @@ var ActivationFlow = class {
34039
34070
  return activationState;
34040
34071
  }
34041
34072
  async installMdmProfile(udid) {
34073
+ const offlineProfilePath = getResourcesEnrollmentProfilePath(this.resourcesDir, udid);
34074
+ if (offlineProfilePath) {
34075
+ logTask("Installing MDM enrollment profile from resources");
34076
+ await this.retryIosCommand(
34077
+ "install mdm profile",
34078
+ () => this.iosCli.installProfile(udid, offlineProfilePath)
34079
+ );
34080
+ return;
34081
+ }
34042
34082
  const client = await this.requireMdmClient();
34043
34083
  logTask("Installing MDM enrollment profile");
34044
34084
  const enrollmentProfile = await this.retry(
@@ -34057,7 +34097,7 @@ var ActivationFlow = class {
34057
34097
  await removeTempFile(profilePath, "mdm profile");
34058
34098
  }
34059
34099
  async installTrustProfile(udid) {
34060
- const resourcesProfilePath = getResourcesTrustProfilePath();
34100
+ const resourcesProfilePath = getResourcesTrustProfilePath(this.resourcesDir);
34061
34101
  if (existsSync4(resourcesProfilePath)) {
34062
34102
  logTask("Installing trust profile from resources");
34063
34103
  await this.retryIosCommand(
@@ -34070,12 +34110,13 @@ var ActivationFlow = class {
34070
34110
  logError("ORGANIZATION_NAME is required to generate trust profile");
34071
34111
  throw new Error("ORGANIZATION_NAME is required for trust profile generation");
34072
34112
  }
34073
- const trustProfile = await generateTrustProfileFromEnv(this.organizationName);
34113
+ const plistDir = this.resourcesDir ? resolveResourcesPlistDir(this.resourcesDir) : void 0;
34114
+ const trustProfile = await generateTrustProfileFromEnv(this.organizationName, { plistDir });
34074
34115
  if (!trustProfile) {
34075
34116
  return;
34076
34117
  }
34077
34118
  logTask("Generating trust profile and saving to resources");
34078
- await ensureResourcesDirExists();
34119
+ await ensureResourcesDirExists(this.resourcesDir);
34079
34120
  await writeFile2(resourcesProfilePath, trustProfile, "utf-8");
34080
34121
  await this.retryIosCommand(
34081
34122
  "install trust profile",
@@ -34107,13 +34148,13 @@ var ActivationFlow = class {
34107
34148
  logError(`${label} failed: ${errorMsg}`);
34108
34149
  }
34109
34150
  logInfo(`Retrying ${label}... ${attempt + 1} of ${retries}`);
34110
- await new Promise((resolve) => setTimeout(resolve, retryDelayMs));
34151
+ await new Promise((resolve5) => setTimeout(resolve5, retryDelayMs));
34111
34152
  }
34112
34153
  throw new Error(`Failed to ${label} after ${retries} attempts`);
34113
34154
  }
34114
34155
  };
34115
34156
  async function saveProfileToTemp(profile, prefix) {
34116
- const tempFilePath = join7(tmpdir2(), `mce_${prefix}_${Date.now()}.mobileconfig`);
34157
+ const tempFilePath = join8(tmpdir2(), `mce_${prefix}_${Date.now()}.mobileconfig`);
34117
34158
  await writeFile2(tempFilePath, profile, "utf-8");
34118
34159
  logInfo(`Profile saved to: ${tempFilePath}`);
34119
34160
  return tempFilePath;
@@ -34127,18 +34168,50 @@ async function removeTempFile(filePath, label) {
34127
34168
  logError(`Failed to remove ${label} temp file: ${errorMsg}`);
34128
34169
  }
34129
34170
  }
34130
- function getResourcesTrustProfilePath() {
34131
- const currentFile = fileURLToPath2(import.meta.url);
34132
- const currentDir = dirname3(currentFile);
34133
- const packageRoot = join7(currentDir, "..", "..");
34134
- return join7(packageRoot, "resources", "trust_profile.mobileconfig");
34171
+ function getResourcesTrustProfilePath(resourcesDir) {
34172
+ const resolvedResourcesDir = resolveResourcesDir(resourcesDir);
34173
+ return join8(resolvedResourcesDir, "trust_profile.mobileconfig");
34174
+ }
34175
+ async function ensureResourcesDirExists(resourcesDir) {
34176
+ const resolvedResourcesDir = resolveResourcesDir(resourcesDir);
34177
+ await mkdir(resolvedResourcesDir, { recursive: true });
34135
34178
  }
34136
- async function ensureResourcesDirExists() {
34179
+ function resolveResourcesDir(resourcesDir) {
34180
+ if (resourcesDir) {
34181
+ return resolve4(resourcesDir);
34182
+ }
34137
34183
  const currentFile = fileURLToPath2(import.meta.url);
34138
34184
  const currentDir = dirname3(currentFile);
34139
- const packageRoot = join7(currentDir, "..", "..");
34140
- const resourcesDir = join7(packageRoot, "resources");
34141
- await mkdir(resourcesDir, { recursive: true });
34185
+ const packageRoot = join8(currentDir, "..", "..");
34186
+ return join8(packageRoot, "resources");
34187
+ }
34188
+ function resolveResourcesPlistDir(resourcesDir) {
34189
+ return join8(resolveResourcesDir(resourcesDir), "plist");
34190
+ }
34191
+ function getResourcesEnrollmentProfilePath(resourcesDir, udid) {
34192
+ const baseDir = resolveResourcesDir(resourcesDir);
34193
+ const mdmDir = join8(baseDir, "mdm");
34194
+ const candidates = [
34195
+ udid ? join8(mdmDir, `enrollment_${udid}.mobileconfig`) : void 0,
34196
+ join8(mdmDir, "enrollment.mobileconfig")
34197
+ ];
34198
+ for (const candidate of candidates) {
34199
+ if (candidate && existsSync4(candidate)) {
34200
+ return candidate;
34201
+ }
34202
+ }
34203
+ return void 0;
34204
+ }
34205
+ function resolveIosBinaryPath(config) {
34206
+ if (config.iosBinaryPath) {
34207
+ return config.iosBinaryPath;
34208
+ }
34209
+ if (!config.resourcesDir) {
34210
+ return void 0;
34211
+ }
34212
+ const platform = process.platform;
34213
+ const binaryName = platform === "win32" ? "ios.exe" : "ios";
34214
+ return join8(resolveResourcesDir(config.resourcesDir), "ios", "bin", platform, binaryName);
34142
34215
  }
34143
34216
  function getActivationState2(output) {
34144
34217
  if (!Array.isArray(output) || output.length === 0) {
@@ -34410,10 +34483,86 @@ var AppleDeviceKit = class {
34410
34483
  this.dispose();
34411
34484
  }
34412
34485
  };
34486
+
34487
+ // src/logic/actions/usbmuxd.ts
34488
+ import { spawn as spawn3 } from "node:child_process";
34489
+ import { join as join9 } from "node:path";
34490
+ var usbmuxdProcess = null;
34491
+ function startUsbmuxd(foreground = false, options) {
34492
+ const current = usbmuxdProcess;
34493
+ if (current && isProcessRunning(current)) {
34494
+ logInfo("usbmuxd is already running");
34495
+ return current;
34496
+ }
34497
+ const binPath = getResourcesBinPath({ resourcesDir: options?.resourcesDir });
34498
+ const ext = process.platform === "win32" ? ".exe" : "";
34499
+ const toolPath = binPath ? join9(binPath, `usbmuxd${ext}`) : `usbmuxd${ext}`;
34500
+ const args = foreground ? ["-f"] : [];
34501
+ const spawnOptions = {
34502
+ windowsHide: true,
34503
+ stdio: ["ignore", "pipe", "pipe"]
34504
+ };
34505
+ if (binPath) {
34506
+ spawnOptions.cwd = binPath;
34507
+ }
34508
+ if (!foreground) {
34509
+ spawnOptions.detached = true;
34510
+ }
34511
+ logTask(`Starting usbmuxd with path: ${toolPath}`);
34512
+ const child = spawn3(toolPath, args, spawnOptions);
34513
+ usbmuxdProcess = child;
34514
+ child.stdout?.on("data", (data) => {
34515
+ logInfo(data.toString());
34516
+ });
34517
+ child.stderr?.on("data", (data) => {
34518
+ logError(data.toString());
34519
+ });
34520
+ child.on("error", (error) => {
34521
+ logError(`usbmuxd failed to start: ${error.message}`);
34522
+ });
34523
+ child.on("exit", (code) => {
34524
+ if (usbmuxdProcess === child) {
34525
+ usbmuxdProcess = null;
34526
+ }
34527
+ logInfo(`usbmuxd exited with code ${code ?? "unknown"}`);
34528
+ });
34529
+ return child;
34530
+ }
34531
+ function stopUsbmuxd() {
34532
+ const current = usbmuxdProcess;
34533
+ if (!current || !isProcessRunning(current)) {
34534
+ logInfo("usbmuxd is not running");
34535
+ return;
34536
+ }
34537
+ logTask("Stopping usbmuxd");
34538
+ current.kill();
34539
+ usbmuxdProcess = null;
34540
+ }
34541
+ function isUsbmuxdRunning() {
34542
+ const current = usbmuxdProcess;
34543
+ return Boolean(current && isProcessRunning(current));
34544
+ }
34545
+ function ensureUsbmuxd(foreground = false, options) {
34546
+ const current = usbmuxdProcess;
34547
+ if (current && isProcessRunning(current)) {
34548
+ return current;
34549
+ }
34550
+ return startUsbmuxd(foreground, options);
34551
+ }
34552
+ function isProcessRunning(process2) {
34553
+ if (process2.killed) {
34554
+ return false;
34555
+ }
34556
+ return process2.exitCode === null;
34557
+ }
34413
34558
  export {
34414
34559
  ActivationFlow,
34415
34560
  AppleDeviceKit,
34416
- createIosCli
34561
+ createIosCli,
34562
+ ensureUsbmuxd,
34563
+ isUsbmuxdRunning,
34564
+ startUsbmuxd,
34565
+ stopUsbmuxd
34417
34566
  };
34418
34567
  /*! Bundled license information:
34419
34568