@limrun/ui 0.13.8 → 0.14.0-rc.1
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/app-store-relay/index.cjs +3 -3
- package/dist/app-store-relay/index.d.ts +3 -5
- package/dist/app-store-relay/index.js +56 -58
- package/dist/app-store-relay/react.cjs +1 -1
- package/dist/app-store-relay/react.d.ts +2 -2
- package/dist/app-store-relay/react.js +35 -34
- package/dist/client-BtC4n_qf.js +1 -0
- package/dist/client-CBX-hLnL.mjs +189 -0
- package/dist/core/device-install/apple/client.d.ts +5 -4
- package/dist/core/device-install/apple/relay.d.ts +24 -13
- package/dist/core/device-install/operations/limbuild-client.d.ts +2 -1
- package/dist/core/device-install/operations/operations.d.ts +19 -4
- package/dist/core/device-install/operations/relay-client.d.ts +2 -1
- package/dist/device-build/index.cjs +1 -1
- package/dist/device-build/index.js +1 -1
- package/dist/device-build/react.cjs +1 -1
- package/dist/device-build/react.d.ts +1 -0
- package/dist/device-build/react.js +34 -33
- package/dist/device-install/index.cjs +1 -1
- package/dist/device-install/index.d.ts +1 -1
- package/dist/device-install/index.js +121 -119
- package/dist/device-install/react.cjs +1 -1
- package/dist/device-install/react.d.ts +4 -3
- package/dist/device-install/react.js +58 -54
- package/dist/limbuild-client-BagK_FWE.mjs +83 -0
- package/dist/limbuild-client-CVDwq54z.js +1 -0
- package/package.json +1 -1
- package/src/app-store-relay/index.test.ts +19 -29
- package/src/app-store-relay/index.ts +6 -9
- package/src/app-store-relay/react.ts +5 -4
- package/src/core/device-install/apple/client.ts +22 -33
- package/src/core/device-install/apple/relay.ts +108 -148
- package/src/core/device-install/operations/limbuild-client.ts +3 -0
- package/src/core/device-install/operations/operations.ts +21 -9
- package/src/core/device-install/operations/relay-client.ts +3 -2
- package/src/device-build/react.ts +2 -0
- package/src/device-install/README.md +5 -5
- package/src/device-install/demo/demo.tsx +26 -28
- package/src/device-install/index.ts +1 -0
- package/src/device-install/react.ts +12 -6
- package/dist/client-ASLtHFLh.js +0 -1
- package/dist/client-CGdh8yoJ.mjs +0 -234
- package/dist/limbuild-client-CgEncrgx.js +0 -1
- package/dist/limbuild-client-D7U7w342.mjs +0 -81
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
startDeviceInstall,
|
|
9
9
|
type DeviceInstallLog,
|
|
10
10
|
type DeviceRelayTarget,
|
|
11
|
+
type InstallSource,
|
|
11
12
|
type RelayClient,
|
|
12
13
|
type StoredPairRecord,
|
|
13
14
|
} from './index';
|
|
@@ -17,6 +18,7 @@ export type DeviceInstallRelayBusyAction = 'usb' | 'pair' | 'install';
|
|
|
17
18
|
export type UseDeviceInstallRelayOptions = {
|
|
18
19
|
apiUrl?: string;
|
|
19
20
|
token?: string;
|
|
21
|
+
organizationId?: string;
|
|
20
22
|
log?: DeviceInstallLog;
|
|
21
23
|
};
|
|
22
24
|
|
|
@@ -31,7 +33,7 @@ export type UseDeviceInstallRelayResult = {
|
|
|
31
33
|
canInstall: boolean;
|
|
32
34
|
requestUSBAccess: () => Promise<DeviceRelayTarget | undefined>;
|
|
33
35
|
pairBrowser: () => Promise<StoredPairRecord | undefined>;
|
|
34
|
-
startInstallation: () => Promise<RelayClient | undefined>;
|
|
36
|
+
startInstallation: (installSource: InstallSource) => Promise<RelayClient | undefined>;
|
|
35
37
|
stopRelay: () => void;
|
|
36
38
|
clearError: () => void;
|
|
37
39
|
};
|
|
@@ -39,6 +41,7 @@ export type UseDeviceInstallRelayResult = {
|
|
|
39
41
|
export function useDeviceInstallRelay({
|
|
40
42
|
apiUrl,
|
|
41
43
|
token,
|
|
44
|
+
organizationId,
|
|
42
45
|
log = noopLog,
|
|
43
46
|
}: UseDeviceInstallRelayOptions): UseDeviceInstallRelayResult {
|
|
44
47
|
const [device, setDevice] = useState<DeviceRelayTarget | undefined>();
|
|
@@ -108,8 +111,9 @@ export function useDeviceInstallRelay({
|
|
|
108
111
|
try {
|
|
109
112
|
await cleanupDeviceAccess();
|
|
110
113
|
const result = await pairDevice({
|
|
111
|
-
|
|
114
|
+
registryApiUrl: apiUrl,
|
|
112
115
|
token,
|
|
116
|
+
organizationId,
|
|
113
117
|
log: logRef.current,
|
|
114
118
|
target: device,
|
|
115
119
|
});
|
|
@@ -130,9 +134,9 @@ export function useDeviceInstallRelay({
|
|
|
130
134
|
} finally {
|
|
131
135
|
setBusyAction(undefined);
|
|
132
136
|
}
|
|
133
|
-
}, [apiUrl, cleanupDeviceAccess, device, token]);
|
|
137
|
+
}, [apiUrl, cleanupDeviceAccess, device, organizationId, token]);
|
|
134
138
|
|
|
135
|
-
const startInstallation = useCallback(async () => {
|
|
139
|
+
const startInstallation = useCallback(async (installSource: InstallSource) => {
|
|
136
140
|
if (!apiUrl || !device || !pairRecord) {
|
|
137
141
|
throw new Error('Select and pair a USB device before starting installation.');
|
|
138
142
|
}
|
|
@@ -141,11 +145,13 @@ export function useDeviceInstallRelay({
|
|
|
141
145
|
try {
|
|
142
146
|
await cleanupDeviceAccess();
|
|
143
147
|
relayRef.current = await startDeviceInstall({
|
|
144
|
-
|
|
148
|
+
registryApiUrl: apiUrl,
|
|
145
149
|
token,
|
|
150
|
+
organizationId,
|
|
146
151
|
log: logRef.current,
|
|
147
152
|
target: device,
|
|
148
153
|
pairRecord,
|
|
154
|
+
installSource,
|
|
149
155
|
});
|
|
150
156
|
logRef.current('Device install started', 'Installation will continue through the connected iPhone.');
|
|
151
157
|
return relayRef.current;
|
|
@@ -156,7 +162,7 @@ export function useDeviceInstallRelay({
|
|
|
156
162
|
} finally {
|
|
157
163
|
setBusyAction(undefined);
|
|
158
164
|
}
|
|
159
|
-
}, [apiUrl, cleanupDeviceAccess, device, pairRecord, token]);
|
|
165
|
+
}, [apiUrl, cleanupDeviceAccess, device, organizationId, pairRecord, token]);
|
|
160
166
|
|
|
161
167
|
const stopRelay = useCallback(() => {
|
|
162
168
|
void cleanupDeviceAccess();
|
package/dist/client-ASLtHFLh.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const E=require("./index-CMeQfhYy.js");async function P(e,s){const r=await fetch(p(e,"/apple/auth/session",s),{method:"POST",headers:R(s)});if(!r.ok)throw new Error(`Apple relay session failed: HTTP ${r.status} ${await r.text()}`);return await r.json()}async function y(e,s,r){const t=await fetch(p(e,"/apple/auth/session/delete",r),{method:"POST",headers:u(r),body:JSON.stringify({appleSessionId:s})});if(!t.ok)throw new Error(`Apple relay session delete failed: HTTP ${t.status} ${await t.text()}`)}async function g(e,s,r,t){return N(e,"/apple/auth/srp/init",s,r,t)}async function m(e,s,r,t){return N(e,"/apple/auth/srp/complete",s,r,t)}async function S(e,s,r){const t=await fetch(p(e,"/apple/auth/2fa/trigger",r),{method:"POST",headers:u(r),body:JSON.stringify({appleSessionId:s})});if(!t.ok)throw new Error(`Apple 2FA trigger failed: HTTP ${t.status} ${await t.text()}`);return await t.json()}async function $(e,s,r,t="sms",o){const a=await fetch(p(e,"/apple/auth/2fa/phone/trigger",o),{method:"POST",headers:u(o),body:JSON.stringify({appleSessionId:s,phoneNumberId:r,mode:t})});if(!a.ok)throw new Error(`Apple phone 2FA trigger failed: HTTP ${a.status} ${await a.text()}`);return await a.json()}async function x(e,s,r,t){const o=await fetch(p(e,"/apple/auth/2fa",t),{method:"POST",headers:u(t),body:JSON.stringify({appleSessionId:s,code:r})});if(!o.ok)throw new Error(`Apple 2FA proxy failed: HTTP ${o.status} ${await o.text()}`);return await o.json()}async function A(e,s,r,t,o="sms",a){const n=await fetch(p(e,"/apple/auth/2fa/phone",a),{method:"POST",headers:u(a),body:JSON.stringify({appleSessionId:s,phoneNumberId:r,mode:o,code:t})});if(!n.ok)throw new Error(`Apple phone 2FA proxy failed: HTTP ${n.status} ${await n.text()}`);return await n.json()}async function O(e,s,r){const t=await fetch(p(e,"/apple/auth/finalize",r),{method:"POST",headers:u(r),body:JSON.stringify({appleSessionId:s})});if(!t.ok)throw new Error(`Apple session finalization failed: HTTP ${t.status} ${await t.text()}`);return await t.json()}async function H(e,s,r,t){const o=await fetch(p(e,"/apple/provisioning",t),{method:"POST",headers:u(t),body:JSON.stringify({appleSessionId:s,...r})});if(!o.ok)throw new Error(`Apple provisioning proxy failed: HTTP ${o.status} ${await o.text()}`);return F(await o.json())}async function N(e,s,r,t,o){const a=await fetch(p(e,s,o),{method:"POST",headers:u(o),body:JSON.stringify({appleSessionId:r,payload:t})});if(!a.ok)throw new Error(`Apple proxy ${s} failed: HTTP ${a.status} ${await a.text()}`);return F(await a.json())}function F(e){if(e.body!==void 0||!e.rawBody)return e;try{return{...e,body:JSON.parse(e.rawBody)}}catch{return e}}function p(e,s,r){const t=e.replace(/\/$/,""),o=s.startsWith("/")?s:`/${s}`,a=new URL(`${t}${o}`);return r&&a.searchParams.set("token",r),a}function u(e){return{"Content-Type":"application/json",...R(e)}}function R(e){return e?{Authorization:`Bearer ${e}`}:{}}async function v({limbuildApiUrl:e,accountName:s,password:r,token:t}){const{appleSessionId:o}=await P(e,t);try{const a=new E.AppleGsaSrpClient(s),n=await g(e,o,await a.init(),t);if(n.status<200||n.status>=300)throw new Error(`Apple SRP init failed: HTTP ${n.status} ${n.rawBody??""}`.trim());if(!n.body)throw new Error("Apple SRP init response did not include a body.");const b=await a.complete(r,n.body),f=await m(e,o,{...b,rememberMe:!1,trustTokens:[]},t),T=f.status===409;let i,d={type:"trustedDevice"};if(T){i=await S(e,o,t);const c=j(i.body);if(i.status===412){if(!c)throw new Error("Apple requested phone verification but did not include a trusted phone number.");d={type:"phone",phoneNumberId:c.id,mode:c.pushMode??"sms"},i=await $(e,o,c.id,c.pushMode??"sms",t)}if(i.status<200||i.status>=300)throw new Error(`Apple two-factor challenge failed: HTTP ${i.status} ${i.rawBody??""}`.trim())}else if(f.status<200||f.status>=300)throw new Error(`Apple SRP complete failed: HTTP ${f.status} ${f.rawBody??""}`.trim());return{appleSessionId:o,completeResponse:f,twoFactorChallengeResponse:i,requiresTwoFactor:T,finishTwoFactor:async c=>{const w=d.type==="phone"?await A(e,o,d.phoneNumberId,c,d.mode,t):await x(e,o,c,t);if(w.status<200||w.status>=300)throw new Error(`Apple two-factor code failed: HTTP ${w.status} ${w.rawBody??""}`.trim());return w},finalize:async()=>O(e,o,t),close:()=>y(e,o,t)}}catch(a){throw await y(e,o,t).catch(()=>{}),a}}function j(e){if(!l(e))return;const s=l(e.phoneNumberVerification)?e.phoneNumberVerification:void 0,r=h(s?.trustedPhoneNumber)??h(e.trustedPhoneNumber)??h(e.phoneNumber);if(!r)return;const t=r.id;if(typeof t!="number")return;const o=typeof r.pushMode=="string"?r.pushMode:typeof e.mode=="string"?e.mode:void 0;return{id:t,pushMode:o}}function h(e){return l(e)?e:void 0}function l(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}exports.createAppleRelaySession=P;exports.deleteAppleRelaySession=y;exports.fetchAppleAccountSession=O;exports.proxyPhoneTwoFactorCode=A;exports.proxyProvisioningRequest=H;exports.proxySrpComplete=m;exports.proxySrpInit=g;exports.proxyTwoFactorCode=x;exports.startBrowserOwnedAppleIDLogin=v;exports.triggerPhoneTwoFactor=$;exports.triggerTrustedDeviceTwoFactor=S;
|
package/dist/client-CGdh8yoJ.mjs
DELETED
|
@@ -1,234 +0,0 @@
|
|
|
1
|
-
import { A as S } from "./index-DFdCvi2_.mjs";
|
|
2
|
-
async function x(t, a) {
|
|
3
|
-
const r = await fetch(p(t, "/apple/auth/session", a), {
|
|
4
|
-
method: "POST",
|
|
5
|
-
headers: $(a)
|
|
6
|
-
});
|
|
7
|
-
if (!r.ok)
|
|
8
|
-
throw new Error(`Apple relay session failed: HTTP ${r.status} ${await r.text()}`);
|
|
9
|
-
return await r.json();
|
|
10
|
-
}
|
|
11
|
-
async function T(t, a, r) {
|
|
12
|
-
const e = await fetch(p(t, "/apple/auth/session/delete", r), {
|
|
13
|
-
method: "POST",
|
|
14
|
-
headers: u(r),
|
|
15
|
-
body: JSON.stringify({ appleSessionId: a })
|
|
16
|
-
});
|
|
17
|
-
if (!e.ok)
|
|
18
|
-
throw new Error(`Apple relay session delete failed: HTTP ${e.status} ${await e.text()}`);
|
|
19
|
-
}
|
|
20
|
-
async function A(t, a, r, e) {
|
|
21
|
-
return m(
|
|
22
|
-
t,
|
|
23
|
-
"/apple/auth/srp/init",
|
|
24
|
-
a,
|
|
25
|
-
r,
|
|
26
|
-
e
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
async function O(t, a, r, e) {
|
|
30
|
-
return m(t, "/apple/auth/srp/complete", a, r, e);
|
|
31
|
-
}
|
|
32
|
-
async function N(t, a, r) {
|
|
33
|
-
const e = await fetch(p(t, "/apple/auth/2fa/trigger", r), {
|
|
34
|
-
method: "POST",
|
|
35
|
-
headers: u(r),
|
|
36
|
-
body: JSON.stringify({ appleSessionId: a })
|
|
37
|
-
});
|
|
38
|
-
if (!e.ok)
|
|
39
|
-
throw new Error(`Apple 2FA trigger failed: HTTP ${e.status} ${await e.text()}`);
|
|
40
|
-
return await e.json();
|
|
41
|
-
}
|
|
42
|
-
async function b(t, a, r, e = "sms", o) {
|
|
43
|
-
const s = await fetch(p(t, "/apple/auth/2fa/phone/trigger", o), {
|
|
44
|
-
method: "POST",
|
|
45
|
-
headers: u(o),
|
|
46
|
-
body: JSON.stringify({ appleSessionId: a, phoneNumberId: r, mode: e })
|
|
47
|
-
});
|
|
48
|
-
if (!s.ok)
|
|
49
|
-
throw new Error(`Apple phone 2FA trigger failed: HTTP ${s.status} ${await s.text()}`);
|
|
50
|
-
return await s.json();
|
|
51
|
-
}
|
|
52
|
-
async function E(t, a, r, e) {
|
|
53
|
-
const o = await fetch(p(t, "/apple/auth/2fa", e), {
|
|
54
|
-
method: "POST",
|
|
55
|
-
headers: u(e),
|
|
56
|
-
body: JSON.stringify({ appleSessionId: a, code: r })
|
|
57
|
-
});
|
|
58
|
-
if (!o.ok)
|
|
59
|
-
throw new Error(`Apple 2FA proxy failed: HTTP ${o.status} ${await o.text()}`);
|
|
60
|
-
return await o.json();
|
|
61
|
-
}
|
|
62
|
-
async function H(t, a, r, e, o = "sms", s) {
|
|
63
|
-
const n = await fetch(p(t, "/apple/auth/2fa/phone", s), {
|
|
64
|
-
method: "POST",
|
|
65
|
-
headers: u(s),
|
|
66
|
-
body: JSON.stringify({ appleSessionId: a, phoneNumberId: r, mode: o, code: e })
|
|
67
|
-
});
|
|
68
|
-
if (!n.ok)
|
|
69
|
-
throw new Error(`Apple phone 2FA proxy failed: HTTP ${n.status} ${await n.text()}`);
|
|
70
|
-
return await n.json();
|
|
71
|
-
}
|
|
72
|
-
async function F(t, a, r) {
|
|
73
|
-
const e = await fetch(p(t, "/apple/auth/finalize", r), {
|
|
74
|
-
method: "POST",
|
|
75
|
-
headers: u(r),
|
|
76
|
-
body: JSON.stringify({ appleSessionId: a })
|
|
77
|
-
});
|
|
78
|
-
if (!e.ok)
|
|
79
|
-
throw new Error(`Apple session finalization failed: HTTP ${e.status} ${await e.text()}`);
|
|
80
|
-
return await e.json();
|
|
81
|
-
}
|
|
82
|
-
async function j(t, a, r, e) {
|
|
83
|
-
const o = await fetch(p(t, "/apple/provisioning", e), {
|
|
84
|
-
method: "POST",
|
|
85
|
-
headers: u(e),
|
|
86
|
-
body: JSON.stringify({ appleSessionId: a, ...r })
|
|
87
|
-
});
|
|
88
|
-
if (!o.ok)
|
|
89
|
-
throw new Error(`Apple provisioning proxy failed: HTTP ${o.status} ${await o.text()}`);
|
|
90
|
-
return P(await o.json());
|
|
91
|
-
}
|
|
92
|
-
async function m(t, a, r, e, o) {
|
|
93
|
-
const s = await fetch(p(t, a, o), {
|
|
94
|
-
method: "POST",
|
|
95
|
-
headers: u(o),
|
|
96
|
-
body: JSON.stringify({ appleSessionId: r, payload: e })
|
|
97
|
-
});
|
|
98
|
-
if (!s.ok)
|
|
99
|
-
throw new Error(`Apple proxy ${a} failed: HTTP ${s.status} ${await s.text()}`);
|
|
100
|
-
return P(await s.json());
|
|
101
|
-
}
|
|
102
|
-
function P(t) {
|
|
103
|
-
if (t.body !== void 0 || !t.rawBody)
|
|
104
|
-
return t;
|
|
105
|
-
try {
|
|
106
|
-
return {
|
|
107
|
-
...t,
|
|
108
|
-
body: JSON.parse(t.rawBody)
|
|
109
|
-
};
|
|
110
|
-
} catch {
|
|
111
|
-
return t;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
function p(t, a, r) {
|
|
115
|
-
const e = t.replace(/\/$/, ""), o = a.startsWith("/") ? a : `/${a}`, s = new URL(`${e}${o}`);
|
|
116
|
-
return r && s.searchParams.set("token", r), s;
|
|
117
|
-
}
|
|
118
|
-
function u(t) {
|
|
119
|
-
return {
|
|
120
|
-
"Content-Type": "application/json",
|
|
121
|
-
...$(t)
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
function $(t) {
|
|
125
|
-
return t ? { Authorization: `Bearer ${t}` } : {};
|
|
126
|
-
}
|
|
127
|
-
async function J({
|
|
128
|
-
limbuildApiUrl: t,
|
|
129
|
-
accountName: a,
|
|
130
|
-
password: r,
|
|
131
|
-
token: e
|
|
132
|
-
}) {
|
|
133
|
-
const { appleSessionId: o } = await x(t, e);
|
|
134
|
-
try {
|
|
135
|
-
const s = new S(a), n = await A(t, o, await s.init(), e);
|
|
136
|
-
if (n.status < 200 || n.status >= 300)
|
|
137
|
-
throw new Error(
|
|
138
|
-
`Apple SRP init failed: HTTP ${n.status} ${n.rawBody ?? ""}`.trim()
|
|
139
|
-
);
|
|
140
|
-
if (!n.body)
|
|
141
|
-
throw new Error("Apple SRP init response did not include a body.");
|
|
142
|
-
const g = await s.complete(r, n.body), f = await O(
|
|
143
|
-
t,
|
|
144
|
-
o,
|
|
145
|
-
{
|
|
146
|
-
...g,
|
|
147
|
-
rememberMe: !1,
|
|
148
|
-
trustTokens: []
|
|
149
|
-
},
|
|
150
|
-
e
|
|
151
|
-
), l = f.status === 409;
|
|
152
|
-
let i, d = { type: "trustedDevice" };
|
|
153
|
-
if (l) {
|
|
154
|
-
i = await N(t, o, e);
|
|
155
|
-
const c = R(i.body);
|
|
156
|
-
if (i.status === 412) {
|
|
157
|
-
if (!c)
|
|
158
|
-
throw new Error("Apple requested phone verification but did not include a trusted phone number.");
|
|
159
|
-
d = {
|
|
160
|
-
type: "phone",
|
|
161
|
-
phoneNumberId: c.id,
|
|
162
|
-
mode: c.pushMode ?? "sms"
|
|
163
|
-
}, i = await b(
|
|
164
|
-
t,
|
|
165
|
-
o,
|
|
166
|
-
c.id,
|
|
167
|
-
c.pushMode ?? "sms",
|
|
168
|
-
e
|
|
169
|
-
);
|
|
170
|
-
}
|
|
171
|
-
if (i.status < 200 || i.status >= 300)
|
|
172
|
-
throw new Error(
|
|
173
|
-
`Apple two-factor challenge failed: HTTP ${i.status} ${i.rawBody ?? ""}`.trim()
|
|
174
|
-
);
|
|
175
|
-
} else if (f.status < 200 || f.status >= 300)
|
|
176
|
-
throw new Error(
|
|
177
|
-
`Apple SRP complete failed: HTTP ${f.status} ${f.rawBody ?? ""}`.trim()
|
|
178
|
-
);
|
|
179
|
-
return {
|
|
180
|
-
appleSessionId: o,
|
|
181
|
-
completeResponse: f,
|
|
182
|
-
twoFactorChallengeResponse: i,
|
|
183
|
-
requiresTwoFactor: l,
|
|
184
|
-
finishTwoFactor: async (c) => {
|
|
185
|
-
const h = d.type === "phone" ? await H(
|
|
186
|
-
t,
|
|
187
|
-
o,
|
|
188
|
-
d.phoneNumberId,
|
|
189
|
-
c,
|
|
190
|
-
d.mode,
|
|
191
|
-
e
|
|
192
|
-
) : await E(t, o, c, e);
|
|
193
|
-
if (h.status < 200 || h.status >= 300)
|
|
194
|
-
throw new Error(
|
|
195
|
-
`Apple two-factor code failed: HTTP ${h.status} ${h.rawBody ?? ""}`.trim()
|
|
196
|
-
);
|
|
197
|
-
return h;
|
|
198
|
-
},
|
|
199
|
-
finalize: async () => F(t, o, e),
|
|
200
|
-
close: () => T(t, o, e)
|
|
201
|
-
};
|
|
202
|
-
} catch (s) {
|
|
203
|
-
throw await T(t, o, e).catch(() => {
|
|
204
|
-
}), s;
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
function R(t) {
|
|
208
|
-
if (!y(t)) return;
|
|
209
|
-
const a = y(t.phoneNumberVerification) ? t.phoneNumberVerification : void 0, r = w(a?.trustedPhoneNumber) ?? w(t.trustedPhoneNumber) ?? w(t.phoneNumber);
|
|
210
|
-
if (!r) return;
|
|
211
|
-
const e = r.id;
|
|
212
|
-
if (typeof e != "number") return;
|
|
213
|
-
const o = typeof r.pushMode == "string" ? r.pushMode : typeof t.mode == "string" ? t.mode : void 0;
|
|
214
|
-
return { id: e, pushMode: o };
|
|
215
|
-
}
|
|
216
|
-
function w(t) {
|
|
217
|
-
return y(t) ? t : void 0;
|
|
218
|
-
}
|
|
219
|
-
function y(t) {
|
|
220
|
-
return typeof t == "object" && t !== null && !Array.isArray(t);
|
|
221
|
-
}
|
|
222
|
-
export {
|
|
223
|
-
H as a,
|
|
224
|
-
O as b,
|
|
225
|
-
x as c,
|
|
226
|
-
T as d,
|
|
227
|
-
A as e,
|
|
228
|
-
F as f,
|
|
229
|
-
E as g,
|
|
230
|
-
N as h,
|
|
231
|
-
j as p,
|
|
232
|
-
J as s,
|
|
233
|
-
b as t
|
|
234
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";async function l(o,t){const a=new URL(`${o}/info`);t&&a.searchParams.set("token",t);const e=await fetch(a.toString(),{headers:t?{Authorization:`Bearer ${t}`}:void 0});if(!e.ok){const n=await e.text();throw new Error(`Info request failed: HTTP ${e.status} ${n}`)}return await e.json()}async function u({limbuildApiUrl:o,token:t,certificateP12Base64:a,certificatePassword:e,provisioningProfileBase64:n}){const d=new URL(`${o}/exec`);t&&d.searchParams.set("token",t);const r=await fetch(d.toString(),{method:"POST",headers:{"Content-Type":"application/json",...t?{Authorization:`Bearer ${t}`}:{}},body:JSON.stringify({command:"xcodebuild",xcodebuild:{sdk:"iphoneos"},signing:{certificateP12Base64:a,...e?{certificatePassword:e}:{},provisioningProfileBase64:n}})});if(!r.ok){const s=await r.text();throw new Error(`Build request failed: HTTP ${r.status} ${s}`)}return await r.json()}async function f({limbuildApiUrl:o,execId:t,token:a}){const e=new URL(`${o}/exec/${encodeURIComponent(t)}/ios/ota`);a&&e.searchParams.set("token",a);const n=await fetch(e.toString(),{headers:a?{Authorization:`Bearer ${a}`}:void 0});if(!n.ok){const d=await n.text();throw new Error(`OTA install metadata failed: HTTP ${n.status} ${d}`)}return await n.json()}function h({limbuildApiUrl:o,execId:t,token:a,onLine:e,onStatus:n,onError:d}){const r=new URL(`${o}/exec/${t}/events`);a&&r.searchParams.set("token",a);const s=new EventSource(r.toString());return n("running"),s.addEventListener("command",i=>e({type:"command",data:i.data})),s.addEventListener("stdout",i=>e({type:"stdout",data:i.data})),s.addEventListener("stderr",i=>e({type:"stderr",data:i.data})),s.addEventListener("exitCode",i=>{const c=parseInt(i.data,10);n(c===0?"succeeded":c<0?"cancelled":"failed"),s.close()}),s.onerror=()=>{s.close(),n("failed"),d?.(new Error("Build log stream closed before completion."))},()=>s.close()}exports.fetchLimbuildInfo=l;exports.getIOSOTAInstall=f;exports.startSignedDeviceBuild=u;exports.watchBuildLogEvents=h;
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
async function u(o, t) {
|
|
2
|
-
const a = new URL(`${o}/info`);
|
|
3
|
-
t && a.searchParams.set("token", t);
|
|
4
|
-
const e = await fetch(a.toString(), {
|
|
5
|
-
headers: t ? { Authorization: `Bearer ${t}` } : void 0
|
|
6
|
-
});
|
|
7
|
-
if (!e.ok) {
|
|
8
|
-
const n = await e.text();
|
|
9
|
-
throw new Error(`Info request failed: HTTP ${e.status} ${n}`);
|
|
10
|
-
}
|
|
11
|
-
return await e.json();
|
|
12
|
-
}
|
|
13
|
-
async function l({
|
|
14
|
-
limbuildApiUrl: o,
|
|
15
|
-
token: t,
|
|
16
|
-
certificateP12Base64: a,
|
|
17
|
-
certificatePassword: e,
|
|
18
|
-
provisioningProfileBase64: n
|
|
19
|
-
}) {
|
|
20
|
-
const d = new URL(`${o}/exec`);
|
|
21
|
-
t && d.searchParams.set("token", t);
|
|
22
|
-
const r = await fetch(d.toString(), {
|
|
23
|
-
method: "POST",
|
|
24
|
-
headers: {
|
|
25
|
-
"Content-Type": "application/json",
|
|
26
|
-
...t ? { Authorization: `Bearer ${t}` } : {}
|
|
27
|
-
},
|
|
28
|
-
body: JSON.stringify({
|
|
29
|
-
command: "xcodebuild",
|
|
30
|
-
xcodebuild: { sdk: "iphoneos" },
|
|
31
|
-
signing: {
|
|
32
|
-
certificateP12Base64: a,
|
|
33
|
-
...e ? { certificatePassword: e } : {},
|
|
34
|
-
provisioningProfileBase64: n
|
|
35
|
-
}
|
|
36
|
-
})
|
|
37
|
-
});
|
|
38
|
-
if (!r.ok) {
|
|
39
|
-
const s = await r.text();
|
|
40
|
-
throw new Error(`Build request failed: HTTP ${r.status} ${s}`);
|
|
41
|
-
}
|
|
42
|
-
return await r.json();
|
|
43
|
-
}
|
|
44
|
-
async function f({ limbuildApiUrl: o, execId: t, token: a }) {
|
|
45
|
-
const e = new URL(`${o}/exec/${encodeURIComponent(t)}/ios/ota`);
|
|
46
|
-
a && e.searchParams.set("token", a);
|
|
47
|
-
const n = await fetch(e.toString(), {
|
|
48
|
-
headers: a ? { Authorization: `Bearer ${a}` } : void 0
|
|
49
|
-
});
|
|
50
|
-
if (!n.ok) {
|
|
51
|
-
const d = await n.text();
|
|
52
|
-
throw new Error(`OTA install metadata failed: HTTP ${n.status} ${d}`);
|
|
53
|
-
}
|
|
54
|
-
return await n.json();
|
|
55
|
-
}
|
|
56
|
-
function w({
|
|
57
|
-
limbuildApiUrl: o,
|
|
58
|
-
execId: t,
|
|
59
|
-
token: a,
|
|
60
|
-
onLine: e,
|
|
61
|
-
onStatus: n,
|
|
62
|
-
onError: d
|
|
63
|
-
}) {
|
|
64
|
-
const r = new URL(`${o}/exec/${t}/events`);
|
|
65
|
-
a && r.searchParams.set("token", a);
|
|
66
|
-
const s = new EventSource(r.toString());
|
|
67
|
-
return n("running"), s.addEventListener("command", (i) => e({ type: "command", data: i.data })), s.addEventListener("stdout", (i) => e({ type: "stdout", data: i.data })), s.addEventListener("stderr", (i) => e({ type: "stderr", data: i.data })), s.addEventListener("exitCode", (i) => {
|
|
68
|
-
const c = parseInt(i.data, 10);
|
|
69
|
-
n(
|
|
70
|
-
c === 0 ? "succeeded" : c < 0 ? "cancelled" : "failed"
|
|
71
|
-
), s.close();
|
|
72
|
-
}), s.onerror = () => {
|
|
73
|
-
s.close(), n("failed"), d?.(new Error("Build log stream closed before completion."));
|
|
74
|
-
}, () => s.close();
|
|
75
|
-
}
|
|
76
|
-
export {
|
|
77
|
-
u as f,
|
|
78
|
-
f as g,
|
|
79
|
-
l as s,
|
|
80
|
-
w
|
|
81
|
-
};
|