@limrun/ui 0.14.0-rc.3 → 0.14.0-rc.5

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.
Files changed (76) hide show
  1. package/dist/app-store-relay/index.cjs +3 -3
  2. package/dist/app-store-relay/index.d.ts +108 -4
  3. package/dist/app-store-relay/index.js +353 -160
  4. package/dist/app-store-relay/react.cjs +1 -1
  5. package/dist/app-store-relay/react.js +32 -33
  6. package/dist/apple-credentials/index.cjs +1 -0
  7. package/dist/apple-credentials/index.d.ts +110 -0
  8. package/dist/apple-credentials/index.js +291 -0
  9. package/dist/browser-storage-BnO-Ma-e.mjs +219 -0
  10. package/dist/browser-storage-DLxIqZk5.js +1 -0
  11. package/dist/client-C9z_sgOf.js +1 -0
  12. package/dist/{client-C8ZDEjtD.mjs → client-CFDB4mX5.mjs} +38 -31
  13. package/dist/components/remote-control.d.ts +156 -0
  14. package/dist/core/device-install/apple/provisioning.d.ts +25 -0
  15. package/dist/core/device-install/apple/relay.d.ts +13 -0
  16. package/dist/core/device-install/storage/browser-storage.d.ts +8 -0
  17. package/dist/core/device-install/storage/index.d.ts +1 -0
  18. package/dist/core/device-install/storage/secret-store.d.ts +124 -0
  19. package/dist/core/device-install/types.d.ts +6 -0
  20. package/dist/core/errors.d.ts +1 -0
  21. package/dist/core/play-publish/google.d.ts +1 -1
  22. package/dist/device-build/index.cjs +1 -1
  23. package/dist/device-build/index.js +21 -20
  24. package/dist/device-build/react.cjs +1 -1
  25. package/dist/device-build/react.js +42 -43
  26. package/dist/device-install/index.cjs +1 -1
  27. package/dist/device-install/index.js +64 -63
  28. package/dist/device-install/react.cjs +1 -1
  29. package/dist/device-install/react.js +47 -49
  30. package/dist/errors-BSkqS7U-.js +1 -0
  31. package/dist/errors-gy8yQJos.mjs +6 -0
  32. package/dist/gsa-srp-Bme3JLEi.mjs +266 -0
  33. package/dist/gsa-srp-CCIfUz7Y.js +1 -0
  34. package/dist/index-ChhtuQ7e.js +22 -0
  35. package/dist/index-YDu8K9a4.mjs +11279 -0
  36. package/dist/index.cjs +1 -1
  37. package/dist/index.css +1 -1
  38. package/dist/index.js +1405 -1125
  39. package/dist/play-publish/index.cjs +1 -1
  40. package/dist/play-publish/index.js +27 -24
  41. package/dist/play-publish/react.cjs +1 -1
  42. package/dist/play-publish/react.d.ts +12 -2
  43. package/dist/play-publish/react.js +70 -60
  44. package/dist/{provisioning-BmsEnF6X.mjs → provisioning-CDPvxd1h.mjs} +64 -33
  45. package/dist/provisioning-CbC4h--7.js +1 -0
  46. package/package.json +6 -1
  47. package/src/app-store-relay/index.ts +358 -23
  48. package/src/app-store-relay/react.ts +1 -4
  49. package/src/apple-credentials/index.test.ts +180 -0
  50. package/src/apple-credentials/index.ts +388 -0
  51. package/src/components/remote-control.css +32 -0
  52. package/src/components/remote-control.tsx +865 -5
  53. package/src/core/device-install/apple/client.ts +13 -6
  54. package/src/core/device-install/apple/provisioning.test.ts +30 -0
  55. package/src/core/device-install/apple/provisioning.ts +39 -0
  56. package/src/core/device-install/apple/relay.ts +20 -0
  57. package/src/core/device-install/operations/operations.ts +7 -5
  58. package/src/core/device-install/storage/browser-storage.test.ts +65 -0
  59. package/src/core/device-install/storage/browser-storage.ts +33 -0
  60. package/src/core/device-install/storage/index.ts +1 -0
  61. package/src/core/device-install/storage/secret-store.ts +332 -0
  62. package/src/core/device-install/types.ts +6 -0
  63. package/src/core/errors.ts +3 -0
  64. package/src/core/play-publish/google.ts +11 -2
  65. package/src/device-build/react.ts +1 -4
  66. package/src/device-install/demo/demo.tsx +1 -4
  67. package/src/device-install/react.ts +1 -4
  68. package/src/play-publish/README.md +5 -4
  69. package/src/play-publish/react.ts +72 -32
  70. package/vite.config.ts +1 -0
  71. package/dist/browser-storage-Cx9eW-bm.mjs +0 -205
  72. package/dist/browser-storage-jJaIht4K.js +0 -1
  73. package/dist/client-BtC4n_qf.js +0 -1
  74. package/dist/index-CMeQfhYy.js +0 -22
  75. package/dist/index-DFdCvi2_.mjs +0 -11543
  76. package/dist/provisioning-Va0PH4Kk.js +0 -1
@@ -1,84 +1,84 @@
1
- import { p as D } from "../client-C8ZDEjtD.mjs";
2
- import { A as Pe, f as he, o as qe, a as Be, b as Se, c as Ce, d as Re, s as Te, t as Ee, e as Ke } from "../client-C8ZDEjtD.mjs";
3
- import { f as p } from "../index-DFdCvi2_.mjs";
4
- import { A as ke } from "../index-DFdCvi2_.mjs";
5
- import { l as w, f as g, a as I, s as P, b as h, d as q, c as B, e as S, h as C, i as R, r as T, j as E, k as K, m as U, n as k, o as x } from "../provisioning-BmsEnF6X.mjs";
6
- const F = {
1
+ import { p as g, a as d } from "../client-CFDB4mX5.mjs";
2
+ import { A as Ne, f as Oe, o as Fe, b as ze, c as Ve, d as He, e as _e, s as Ge, t as Me, g as We } from "../client-CFDB4mX5.mjs";
3
+ import { f as l } from "../index-YDu8K9a4.mjs";
4
+ import { A as Qe } from "../gsa-srp-Bme3JLEi.mjs";
5
+ import { l as C, f as q, a as B, s as R, b as T, d as E, c as K, e as $, h as k, i as U, r as L, j as x, k as N, m as O, n as F, o as z, q as V, t as H } from "../provisioning-CDPvxd1h.mjs";
6
+ const _ = {
7
7
  name: "RSASSA-PKCS1-v1_5",
8
8
  modulusLength: 2048,
9
9
  publicExponent: new Uint8Array([1, 0, 1]),
10
10
  hash: "SHA-256"
11
11
  };
12
- async function re(e) {
12
+ async function de(e) {
13
13
  if (!crypto.subtle)
14
14
  throw new Error("WebCrypto is not available in this browser.");
15
- const t = await crypto.subtle.generateKey(F, !0, ["sign", "verify"]), r = new Uint8Array(await crypto.subtle.exportKey("spki", t.publicKey)), n = l(
16
- $(0),
17
- N(e),
15
+ const t = await crypto.subtle.generateKey(_, !0, ["sign", "verify"]), r = new Uint8Array(await crypto.subtle.exportKey("spki", t.publicKey)), n = f(
16
+ j(0),
17
+ G(e),
18
18
  r,
19
- L(0, new Uint8Array())
19
+ W(0, new Uint8Array())
20
20
  ), i = new Uint8Array(
21
21
  await crypto.subtle.sign(
22
22
  "RSASSA-PKCS1-v1_5",
23
23
  t.privateKey,
24
- J(n)
24
+ ie(n)
25
25
  )
26
- ), o = l(
26
+ ), o = f(
27
27
  n,
28
- l(b("1.2.840.113549.1.1.11"), H()),
29
- M(i)
30
- ), s = new Uint8Array(await crypto.subtle.exportKey("pkcs8", t.privateKey));
28
+ f(D("1.2.840.113549.1.1.11"), Q()),
29
+ Y(i)
30
+ ), a = new Uint8Array(await crypto.subtle.exportKey("pkcs8", t.privateKey));
31
31
  return {
32
32
  privateKey: t.privateKey,
33
- privateKeyPKCS8Base64: d(s),
34
- publicKeySPKIBase64: d(r),
35
- csrPEM: j("CERTIFICATE REQUEST", o),
36
- csrBase64: d(o)
33
+ privateKeyPKCS8Base64: m(a),
34
+ publicKeySPKIBase64: m(r),
35
+ csrPEM: ee("CERTIFICATE REQUEST", o),
36
+ csrBase64: m(o)
37
37
  };
38
38
  }
39
- function ne(e) {
39
+ function fe(e) {
40
40
  if (!e.certificateBase64 && !e.certificatePEM)
41
41
  throw new Error("certificateBase64 or certificatePEM is required.");
42
- const t = p.pki.privateKeyFromPem(V("PRIVATE KEY", e.privateKeyPKCS8Base64)), r = e.certificatePEM ? p.pki.certificateFromPem(e.certificatePEM) : p.pki.certificateFromAsn1(
43
- p.asn1.fromDer(p.util.createBuffer(z(e.certificateBase64)))
44
- ), n = p.pkcs12.toPkcs12Asn1(t, [r], e.password, {
42
+ const t = l.pki.privateKeyFromPem(te("PRIVATE KEY", e.privateKeyPKCS8Base64)), r = e.certificatePEM ? l.pki.certificateFromPem(e.certificatePEM) : l.pki.certificateFromAsn1(
43
+ l.asn1.fromDer(l.util.createBuffer(ne(e.certificateBase64)))
44
+ ), n = l.pkcs12.toPkcs12Asn1(t, [r], e.password, {
45
45
  algorithm: "3des",
46
46
  friendlyName: e.friendlyName
47
- }), i = p.asn1.toDer(n).getBytes();
48
- return Q(i);
47
+ }), i = l.asn1.toDer(n).getBytes();
48
+ return re(i);
49
49
  }
50
- function N(e) {
51
- const t = [m("2.5.4.3", W(e.commonName))];
52
- return e.emailAddress && t.push(m("1.2.840.113549.1.9.1", G(e.emailAddress))), l(...t);
50
+ function G(e) {
51
+ const t = [I("2.5.4.3", J(e.commonName))];
52
+ return e.emailAddress && t.push(I("1.2.840.113549.1.9.1", X(e.emailAddress))), f(...t);
53
53
  }
54
- function m(e, t) {
55
- return O(l(b(e), t));
54
+ function I(e, t) {
55
+ return M(f(D(e), t));
56
56
  }
57
- function l(...e) {
58
- return c(48, f(...e));
57
+ function f(...e) {
58
+ return c(48, w(...e));
59
59
  }
60
- function O(...e) {
61
- return c(49, f(...e));
60
+ function M(...e) {
61
+ return c(49, w(...e));
62
62
  }
63
- function L(e, t) {
63
+ function W(e, t) {
64
64
  return c(160 + e, t);
65
65
  }
66
- function $(e) {
66
+ function j(e) {
67
67
  return c(2, new Uint8Array([e]));
68
68
  }
69
- function H() {
69
+ function Q() {
70
70
  return new Uint8Array([5, 0]);
71
71
  }
72
- function W(e) {
72
+ function J(e) {
73
73
  return c(12, new TextEncoder().encode(e));
74
74
  }
75
- function G(e) {
75
+ function X(e) {
76
76
  return c(22, new TextEncoder().encode(e));
77
77
  }
78
- function M(e) {
79
- return c(3, f(new Uint8Array([0]), e));
78
+ function Y(e) {
79
+ return c(3, w(new Uint8Array([0]), e));
80
80
  }
81
- function b(e) {
81
+ function D(e) {
82
82
  const t = e.split(".").map((n) => parseInt(n, 10));
83
83
  if (t.length < 2 || t.some((n) => !Number.isFinite(n)))
84
84
  throw new Error(`Invalid OID: ${e}`);
@@ -93,9 +93,9 @@ function b(e) {
93
93
  return c(6, new Uint8Array(r));
94
94
  }
95
95
  function c(e, t) {
96
- return f(new Uint8Array([e]), _(t.byteLength), t);
96
+ return w(new Uint8Array([e]), Z(t.byteLength), t);
97
97
  }
98
- function _(e) {
98
+ function Z(e) {
99
99
  if (e < 128)
100
100
  return new Uint8Array([e]);
101
101
  const t = [];
@@ -104,22 +104,22 @@ function _(e) {
104
104
  t.unshift(r & 255), r >>= 8;
105
105
  return new Uint8Array([128 | t.length, ...t]);
106
106
  }
107
- function f(...e) {
107
+ function w(...e) {
108
108
  const t = e.reduce((i, o) => i + o.byteLength, 0), r = new Uint8Array(t);
109
109
  let n = 0;
110
110
  for (const i of e)
111
111
  r.set(i, n), n += i.byteLength;
112
112
  return r;
113
113
  }
114
- function j(e, t) {
115
- const n = d(t).match(/.{1,64}/g) ?? [];
114
+ function ee(e, t) {
115
+ const n = m(t).match(/.{1,64}/g) ?? [];
116
116
  return `-----BEGIN ${e}-----
117
117
  ${n.join(`
118
118
  `)}
119
119
  -----END ${e}-----
120
120
  `;
121
121
  }
122
- function V(e, t) {
122
+ function te(e, t) {
123
123
  const r = t.match(/.{1,64}/g) ?? [];
124
124
  return `-----BEGIN ${e}-----
125
125
  ${r.join(`
@@ -127,90 +127,90 @@ ${r.join(`
127
127
  -----END ${e}-----
128
128
  `;
129
129
  }
130
- function d(e) {
130
+ function m(e) {
131
131
  let t = "";
132
132
  for (const r of e)
133
133
  t += String.fromCharCode(r);
134
134
  return btoa(t);
135
135
  }
136
- function Q(e) {
136
+ function re(e) {
137
137
  return btoa(e);
138
138
  }
139
- function z(e) {
139
+ function ne(e) {
140
140
  return atob(e);
141
141
  }
142
- function J(e) {
142
+ function ie(e) {
143
143
  const t = new Uint8Array(e.byteLength);
144
144
  return t.set(e), t.buffer;
145
145
  }
146
- async function a({
146
+ async function s({
147
147
  relay: e,
148
148
  request: t,
149
149
  label: r = "Apple Developer Portal request",
150
150
  validatePortalResponse: n = !0,
151
151
  mapBody: i
152
152
  }) {
153
- const o = await D(e, t);
154
- return n && X(o.body, r), i ? i(o.body, o) : o;
153
+ const o = await g(e, t);
154
+ return n && se(o.body, r), i ? i(o.body, o) : o;
155
155
  }
156
- async function ie(e) {
157
- return a({
156
+ async function ye(e) {
157
+ return s({
158
158
  ...e,
159
- request: w(),
159
+ request: C(),
160
160
  label: "Apple Developer team list",
161
- mapBody: (t) => Y([
161
+ mapBody: (t) => pe([
162
162
  ...t?.teams ?? [],
163
163
  ...t?.availableProviders ?? [],
164
164
  ...t?.provider ? [t.provider] : []
165
165
  ])
166
166
  });
167
167
  }
168
- async function oe({
168
+ async function Ae({
169
169
  certificateKind: e = "development",
170
170
  teamId: t = "",
171
171
  ...r
172
172
  }) {
173
- return a({
173
+ return s({
174
174
  ...r,
175
- request: e === "distribution" ? g(t) : I(t),
175
+ request: e === "distribution" ? q(t) : B(t),
176
176
  label: "Apple Developer certificate list",
177
177
  mapBody: (n) => n?.certRequests ?? []
178
178
  });
179
179
  }
180
- async function ae({
180
+ async function me({
181
181
  certificateKind: e = "development",
182
182
  teamId: t = "",
183
183
  csrPEM: r,
184
184
  ...n
185
185
  }) {
186
- return a({
186
+ return s({
187
187
  ...n,
188
- request: e === "distribution" ? P({ csrPEM: r, teamID: t }) : h({ csrPEM: r, teamID: t }),
188
+ request: e === "distribution" ? R({ csrPEM: r, teamID: t }) : T({ csrPEM: r, teamID: t }),
189
189
  label: e === "distribution" ? "Apple Distribution certificate creation" : "Apple Development certificate creation",
190
190
  mapBody: (i) => i?.certRequest
191
191
  });
192
192
  }
193
- async function se({
193
+ async function ve({
194
194
  certificateKind: e = "development",
195
195
  certificateId: t,
196
196
  teamId: r = "",
197
197
  ...n
198
198
  }) {
199
- return a({
199
+ return s({
200
200
  ...n,
201
- request: e === "distribution" ? q(t, r) : B(t, r),
201
+ request: e === "distribution" ? E(t, r) : K(t, r),
202
202
  label: "Apple certificate download",
203
203
  validatePortalResponse: !1,
204
204
  mapBody: (i, o) => o
205
205
  });
206
206
  }
207
- async function ce({
207
+ async function we({
208
208
  certificateKind: e = "development",
209
209
  certificateId: t,
210
210
  teamId: r = "",
211
211
  ...n
212
212
  }) {
213
- return a({
213
+ return s({
214
214
  ...n,
215
215
  request: {
216
216
  method: "POST",
@@ -225,49 +225,49 @@ async function ce({
225
225
  mapBody: (i) => i
226
226
  });
227
227
  }
228
- async function pe({
228
+ async function be({
229
229
  teamId: e = "",
230
230
  search: t = "",
231
231
  ...r
232
232
  }) {
233
233
  const n = t.trim().toLowerCase();
234
- return a({
234
+ return s({
235
235
  ...r,
236
- request: S({ bundleID: t, teamID: e }),
236
+ request: $({ bundleID: t, teamID: e }),
237
237
  label: "Apple bundle ID list",
238
238
  // Apple's listAppIds.action returns the full paginated list and does not
239
239
  // honor a server-side search filter, so apply the `search` filter here.
240
240
  mapBody: (i) => {
241
241
  const o = i?.appIds ?? [];
242
242
  return n ? o.filter(
243
- (s) => [s.identifier, s.bundleId, s.name].some(
244
- (u) => typeof u == "string" && u.toLowerCase().includes(n)
243
+ (a) => [a.identifier, a.bundleId, a.name].some(
244
+ (p) => typeof p == "string" && p.toLowerCase().includes(n)
245
245
  )
246
246
  ) : o;
247
247
  }
248
248
  });
249
249
  }
250
- async function le({
250
+ async function Ie({
251
251
  teamId: e = "",
252
252
  bundleId: t,
253
253
  name: r,
254
254
  ...n
255
255
  }) {
256
- return a({
256
+ return s({
257
257
  ...n,
258
- request: C({ bundleID: t, teamID: e, name: r }),
258
+ request: k({ bundleID: t, teamID: e, name: r }),
259
259
  label: "Apple bundle ID creation",
260
260
  mapBody: (i) => i?.appId
261
261
  });
262
262
  }
263
- async function ue({
263
+ async function Se({
264
264
  teamId: e = "",
265
265
  appIdId: t,
266
266
  bundleId: r,
267
267
  name: n,
268
268
  ...i
269
269
  }) {
270
- return a({
270
+ return s({
271
271
  ...i,
272
272
  request: {
273
273
  method: "POST",
@@ -283,8 +283,8 @@ async function ue({
283
283
  mapBody: (o) => o?.appId
284
284
  });
285
285
  }
286
- async function de({ teamId: e = "", appIdId: t, ...r }) {
287
- return a({
286
+ async function De({ teamId: e = "", appIdId: t, ...r }) {
287
+ return s({
288
288
  ...r,
289
289
  request: {
290
290
  method: "POST",
@@ -295,47 +295,47 @@ async function de({ teamId: e = "", appIdId: t, ...r }) {
295
295
  mapBody: (n) => n
296
296
  });
297
297
  }
298
- async function fe({
298
+ async function he({
299
299
  teamId: e = "",
300
300
  deviceUDID: t = "",
301
301
  ...r
302
302
  }) {
303
- const n = A(t);
304
- return a({
303
+ const n = S(t);
304
+ return s({
305
305
  ...r,
306
- request: R({ deviceUDID: t, teamID: e }),
306
+ request: U({ deviceUDID: t, teamID: e }),
307
307
  label: "Apple device list",
308
308
  // Apple's listDevices.action returns the full paginated list and does not
309
309
  // honor a server-side UDID filter, so apply the `deviceUDID` filter here.
310
310
  mapBody: (i) => {
311
311
  const o = i?.devices ?? [];
312
- return n ? o.filter((s) => A(s.deviceNumber) === n) : o;
312
+ return n ? o.filter((a) => S(a.deviceNumber) === n) : o;
313
313
  }
314
314
  });
315
315
  }
316
- function A(e) {
316
+ function S(e) {
317
317
  return (e ?? "").replace(/-/g, "").replace(/[^a-fA-F0-9]/g, "").toUpperCase();
318
318
  }
319
- async function ye({
319
+ async function Pe({
320
320
  teamId: e = "",
321
321
  deviceUDID: t,
322
322
  name: r,
323
323
  ...n
324
324
  }) {
325
- return a({
325
+ return s({
326
326
  ...n,
327
- request: T({ deviceUDID: t, teamID: e, name: r }),
327
+ request: L({ deviceUDID: t, teamID: e, name: r }),
328
328
  label: "Apple device registration",
329
329
  mapBody: (i) => i?.device
330
330
  });
331
331
  }
332
- async function me({
332
+ async function ge({
333
333
  teamId: e = "",
334
334
  deviceId: t,
335
335
  name: r,
336
336
  ...n
337
337
  }) {
338
- return a({
338
+ return s({
339
339
  ...n,
340
340
  request: {
341
341
  method: "POST",
@@ -346,8 +346,8 @@ async function me({
346
346
  mapBody: (i) => i?.device
347
347
  });
348
348
  }
349
- async function Ae({ teamId: e = "", deviceId: t, ...r }) {
350
- return a({
349
+ async function Ce({ teamId: e = "", deviceId: t, ...r }) {
350
+ return s({
351
351
  ...r,
352
352
  request: {
353
353
  method: "POST",
@@ -358,68 +358,79 @@ async function Ae({ teamId: e = "", deviceId: t, ...r }) {
358
358
  mapBody: (n) => n
359
359
  });
360
360
  }
361
- async function be({
361
+ async function qe({
362
362
  profileKind: e = "development",
363
363
  teamId: t = "",
364
364
  bundleId: r = "",
365
365
  ...n
366
366
  }) {
367
- return a({
367
+ return s({
368
368
  ...n,
369
- request: e === "adhoc" ? E({ bundleID: r, teamID: t }) : K({ bundleID: r, teamID: t }),
369
+ request: e === "adhoc" ? x({ bundleID: r, teamID: t }) : e === "appstore" ? N({ bundleID: r, teamID: t }) : O({ bundleID: r, teamID: t }),
370
370
  label: "Apple provisioning profile list",
371
371
  mapBody: (i) => i?.provisioningProfiles ?? []
372
372
  });
373
373
  }
374
- async function ve({
374
+ async function Be({
375
375
  profileKind: e = "development",
376
376
  teamId: t = "",
377
377
  bundleId: r,
378
378
  appIdId: n,
379
379
  certificateIds: i,
380
- deviceIds: o,
381
- name: s,
382
- ...u
380
+ deviceIds: o = [],
381
+ name: a,
382
+ ...p
383
383
  }) {
384
- const [y] = i;
385
- if (!y)
384
+ const [u] = i;
385
+ if (!u)
386
386
  throw new Error("At least one certificate ID is required to create an Apple provisioning profile.");
387
- return a({
388
- ...u,
389
- request: e === "adhoc" ? U({
390
- bundleID: r,
391
- teamID: t,
392
- appIDID: n,
393
- certificateID: y,
394
- deviceIDs: o,
395
- name: s
396
- }) : k({
397
- bundleID: r,
387
+ let A;
388
+ if (e === "appstore") {
389
+ if (!a)
390
+ throw new Error("An explicit name is required to create an App Store provisioning profile.");
391
+ A = z({
398
392
  teamID: t,
399
393
  appIDID: n,
400
- certificateID: y,
401
- deviceIDs: o,
402
- name: s
403
- }),
394
+ certificateID: u,
395
+ name: a
396
+ });
397
+ } else e === "adhoc" ? A = V({
398
+ bundleID: r,
399
+ teamID: t,
400
+ appIDID: n,
401
+ certificateID: u,
402
+ deviceIDs: o,
403
+ name: a
404
+ }) : A = H({
405
+ bundleID: r,
406
+ teamID: t,
407
+ appIDID: n,
408
+ certificateID: u,
409
+ deviceIDs: o,
410
+ name: a
411
+ });
412
+ return s({
413
+ ...p,
414
+ request: A,
404
415
  label: "Apple provisioning profile creation",
405
- mapBody: (v) => v?.provisioningProfile
416
+ mapBody: (P) => P?.provisioningProfile
406
417
  });
407
418
  }
408
- async function De({
419
+ async function Re({
409
420
  teamId: e = "",
410
421
  profileId: t,
411
422
  ...r
412
423
  }) {
413
- return a({
424
+ return s({
414
425
  ...r,
415
- request: x(t, e),
426
+ request: F(t, e),
416
427
  label: "Apple provisioning profile download",
417
428
  validatePortalResponse: !1,
418
429
  mapBody: (n, i) => i
419
430
  });
420
431
  }
421
- async function we({ teamId: e = "", profileId: t, ...r }) {
422
- return a({
432
+ async function Te({ teamId: e = "", profileId: t, ...r }) {
433
+ return s({
423
434
  ...r,
424
435
  request: {
425
436
  method: "POST",
@@ -430,7 +441,180 @@ async function we({ teamId: e = "", profileId: t, ...r }) {
430
441
  mapBody: (n) => n
431
442
  });
432
443
  }
433
- function X(e, t) {
444
+ async function Ee({
445
+ relay: e,
446
+ providerId: t
447
+ }) {
448
+ const r = Number(t), n = await d(e, {
449
+ method: "POST",
450
+ path: "/olympus/v1/session",
451
+ payload: {
452
+ provider: { providerId: Number.isNaN(r) ? t : r }
453
+ }
454
+ });
455
+ if (n.status < 200 || n.status >= 300)
456
+ throw new Error(
457
+ `App Store Connect provider switch failed: HTTP ${n.status} ${n.rawBody ?? ""}`.trim()
458
+ );
459
+ return n;
460
+ }
461
+ async function Ke({ relay: e }) {
462
+ const t = await d(e, {
463
+ path: "/iris/v1/apiKeys"
464
+ });
465
+ return y(t, "App Store Connect API key list"), h(t.body?.data);
466
+ }
467
+ async function $e({
468
+ relay: e,
469
+ nickname: t,
470
+ roles: r = ["APP_MANAGER"],
471
+ allAppsVisible: n = !0
472
+ }) {
473
+ if (!t)
474
+ throw new Error("A nickname is required to create an App Store Connect API key.");
475
+ const i = await d(e, {
476
+ method: "POST",
477
+ path: "/iris/v1/apiKeys",
478
+ payload: {
479
+ data: {
480
+ type: "apiKeys",
481
+ attributes: {
482
+ nickname: t,
483
+ allAppsVisible: n,
484
+ keyType: "PUBLIC_API",
485
+ roles: r
486
+ }
487
+ }
488
+ }
489
+ });
490
+ y(i, "App Store Connect API key creation");
491
+ const o = b(i.body?.data);
492
+ if (!o?.id)
493
+ throw new Error("App Store Connect API key creation did not return a key ID.");
494
+ return o;
495
+ }
496
+ async function ke({
497
+ relay: e,
498
+ keyId: t
499
+ }) {
500
+ const r = await d(e, {
501
+ path: `/iris/v1/apiKeys/${encodeURIComponent(t)}`,
502
+ query: { "fields[apiKeys]": "privateKey", include: "provider" }
503
+ });
504
+ y(r, "App Store Connect API key download");
505
+ const n = b(r.body?.data), i = v(n?.attributes, "privateKey");
506
+ if (!i)
507
+ throw new Error(
508
+ `App Store Connect API key ${t} returned no private key. Apple serves it only once; revoke the key and create a new one.`
509
+ );
510
+ const o = (r.body?.included ?? []).find((p) => p.type === "providers"), a = v(o?.attributes, "publicProviderId") ?? v(n?.attributes, "issuerId") ?? o?.id;
511
+ return { privateKeyPem: i, issuerId: a };
512
+ }
513
+ async function oe({ relay: e, bundleId: t }) {
514
+ const r = await d(e, {
515
+ path: "/iris/v1/apps",
516
+ query: { "filter[bundleId]": t }
517
+ });
518
+ return y(r, "App Store Connect app lookup"), h(r.body?.data).find(
519
+ (n) => v(n.attributes, "bundleId") === t
520
+ );
521
+ }
522
+ async function ae({
523
+ relay: e,
524
+ bundleId: t,
525
+ name: r,
526
+ sku: n,
527
+ primaryLocale: i = "en-US",
528
+ versionString: o = "1.0"
529
+ }) {
530
+ if (!r)
531
+ throw new Error("An app name is required to create an App Store Connect app record.");
532
+ const a = "IOS", p = await d(e, {
533
+ method: "POST",
534
+ path: "/iris/v1/apps",
535
+ payload: {
536
+ data: {
537
+ type: "apps",
538
+ attributes: {
539
+ sku: n || t,
540
+ primaryLocale: i,
541
+ bundleId: t
542
+ },
543
+ relationships: {
544
+ appStoreVersions: {
545
+ data: [{ type: "appStoreVersions", id: `\${store-version-${a}}` }]
546
+ },
547
+ appInfos: {
548
+ data: [{ type: "appInfos", id: "${new-appInfo-id}" }]
549
+ }
550
+ }
551
+ },
552
+ included: [
553
+ {
554
+ type: "appInfos",
555
+ id: "${new-appInfo-id}",
556
+ relationships: {
557
+ appInfoLocalizations: {
558
+ data: [{ type: "appInfoLocalizations", id: "${new-appInfoLocalization-id}" }]
559
+ }
560
+ }
561
+ },
562
+ {
563
+ type: "appInfoLocalizations",
564
+ id: "${new-appInfoLocalization-id}",
565
+ attributes: { locale: i, name: r }
566
+ },
567
+ {
568
+ type: "appStoreVersions",
569
+ id: `\${store-version-${a}}`,
570
+ attributes: { platform: a, versionString: o },
571
+ relationships: {
572
+ appStoreVersionLocalizations: {
573
+ data: [
574
+ { type: "appStoreVersionLocalizations", id: `\${new-${a}VersionLocalization-id}` }
575
+ ]
576
+ }
577
+ }
578
+ },
579
+ {
580
+ type: "appStoreVersionLocalizations",
581
+ id: `\${new-${a}VersionLocalization-id}`,
582
+ attributes: { locale: i }
583
+ }
584
+ ]
585
+ }
586
+ });
587
+ y(p, "App Store Connect app creation");
588
+ const u = b(p.body?.data);
589
+ if (!u?.id)
590
+ throw new Error("App Store Connect app creation did not return an app ID.");
591
+ return u;
592
+ }
593
+ async function Ue(e) {
594
+ const t = await oe({ relay: e.relay, bundleId: e.bundleId });
595
+ return t ? { app: t, created: !1 } : { app: await ae(e), created: !0 };
596
+ }
597
+ function y(e, t) {
598
+ const r = e.body?.errors;
599
+ if (r && r.length > 0) {
600
+ const n = r.map((i) => i.detail ?? i.title ?? i.code ?? i.status).filter(Boolean).join("; ");
601
+ throw new Error(`${t} failed: ${n || `HTTP ${e.status}`}`);
602
+ }
603
+ if (e.status < 200 || e.status >= 300)
604
+ throw new Error(`${t} failed: HTTP ${e.status} ${e.rawBody ?? ""}`.trim());
605
+ }
606
+ function h(e) {
607
+ return e ? Array.isArray(e) ? e : [e] : [];
608
+ }
609
+ function b(e) {
610
+ if (e)
611
+ return Array.isArray(e) ? e[0] : e;
612
+ }
613
+ function v(e, t) {
614
+ const r = e?.[t];
615
+ return typeof r == "string" && r !== "" ? r : void 0;
616
+ }
617
+ function se(e, t) {
434
618
  if (!e)
435
619
  throw new Error(`${t} returned an empty response.`);
436
620
  if (e.resultCode !== void 0 && e.resultCode !== 0)
@@ -438,7 +622,7 @@ function X(e, t) {
438
622
  `${t} failed: ${e.userString ?? e.resultString ?? e.resultCode}`
439
623
  );
440
624
  }
441
- function Y(e) {
625
+ function pe(e) {
442
626
  const t = /* @__PURE__ */ new Set(), r = [];
443
627
  for (const n of e) {
444
628
  const i = String(
@@ -449,36 +633,45 @@ function Y(e) {
449
633
  return r;
450
634
  }
451
635
  export {
452
- ke as AppleGsaSrpClient,
453
- Pe as AppleRelayWebSocketClient,
454
- X as assertAppleDeveloperPortalResponseOK,
455
- le as createAppleBundleID,
456
- ae as createAppleCertificate,
457
- ve as createAppleProfile,
458
- de as deleteAppleBundleID,
459
- ce as deleteAppleCertificate,
460
- Ae as deleteAppleDevice,
461
- we as deleteAppleProfile,
462
- se as downloadAppleCertificate,
463
- De as downloadAppleProfile,
464
- ne as exportAppleCertificateP12,
465
- he as fetchAppleAccountSession,
466
- re as generateAppleSigningKeyAndCSR,
467
- pe as listAppleBundleIDs,
468
- oe as listAppleCertificates,
469
- fe as listAppleDevices,
470
- be as listAppleProfiles,
471
- ie as listAppleTeams,
472
- qe as openAppleRelayWebSocket,
473
- Be as proxyPhoneTwoFactorCode,
474
- Se as proxySrpComplete,
475
- Ce as proxySrpInit,
476
- Re as proxyTwoFactorCode,
477
- ye as registerAppleDevice,
478
- a as requestAppleProvisioning,
479
- Te as startBrowserOwnedAppleIDLogin,
480
- Ee as triggerPhoneTwoFactor,
481
- Ke as triggerTrustedDeviceTwoFactor,
482
- ue as updateAppleBundleID,
483
- me as updateAppleDevice
636
+ Qe as AppleGsaSrpClient,
637
+ Ne as AppleRelayWebSocketClient,
638
+ y as assertAppStoreConnectResponseOK,
639
+ se as assertAppleDeveloperPortalResponseOK,
640
+ $e as createAppStoreConnectApiKey,
641
+ ae as createAppStoreConnectApp,
642
+ Ie as createAppleBundleID,
643
+ me as createAppleCertificate,
644
+ Be as createAppleProfile,
645
+ De as deleteAppleBundleID,
646
+ we as deleteAppleCertificate,
647
+ Ce as deleteAppleDevice,
648
+ Te as deleteAppleProfile,
649
+ ke as downloadAppStoreConnectApiKeyPrivateKey,
650
+ ve as downloadAppleCertificate,
651
+ Re as downloadAppleProfile,
652
+ Ue as ensureAppStoreConnectApp,
653
+ fe as exportAppleCertificateP12,
654
+ Oe as fetchAppleAccountSession,
655
+ oe as findAppStoreConnectApp,
656
+ de as generateAppleSigningKeyAndCSR,
657
+ Ke as listAppStoreConnectApiKeys,
658
+ be as listAppleBundleIDs,
659
+ Ae as listAppleCertificates,
660
+ he as listAppleDevices,
661
+ qe as listAppleProfiles,
662
+ ye as listAppleTeams,
663
+ Fe as openAppleRelayWebSocket,
664
+ d as proxyAppStoreConnectRequest,
665
+ ze as proxyPhoneTwoFactorCode,
666
+ Ve as proxySrpComplete,
667
+ He as proxySrpInit,
668
+ _e as proxyTwoFactorCode,
669
+ Pe as registerAppleDevice,
670
+ s as requestAppleProvisioning,
671
+ Ge as startBrowserOwnedAppleIDLogin,
672
+ Ee as switchAppStoreConnectProvider,
673
+ Me as triggerPhoneTwoFactor,
674
+ We as triggerTrustedDeviceTwoFactor,
675
+ Se as updateAppleBundleID,
676
+ ge as updateAppleDevice
484
677
  };